1/** 2 * @licstart The following is the entire license notice for the 3 * JavaScript code in this page 4 * 5 * Copyright 2023 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 = root.pdfjsWorker = factory(); 26 else if(typeof define === 'function' && define.amd) 27 define("pdfjs-dist/build/pdf.worker", [], () => { return (root.pdfjsWorker = factory()); }); 28 else if(typeof exports === 'object') 29 exports["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory(); 30 else 31 root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory(); 32})(globalThis, () => { 33return /******/ (() => { // webpackBootstrap 34/******/ "use strict"; 35/******/ var __webpack_modules__ = ([ 36/* 0 */, 37/* 1 */ 38/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 39 40 41 42Object.defineProperty(exports, "__esModule", ({ 43 value: true 44})); 45exports.WorkerTask = exports.WorkerMessageHandler = void 0; 46var _util = __w_pdfjs_require__(2); 47var _core_utils = __w_pdfjs_require__(3); 48var _primitives = __w_pdfjs_require__(4); 49var _pdf_manager = __w_pdfjs_require__(6); 50var _annotation = __w_pdfjs_require__(10); 51var _cleanup_helper = __w_pdfjs_require__(68); 52var _writer = __w_pdfjs_require__(73); 53var _message_handler = __w_pdfjs_require__(104); 54var _worker_stream = __w_pdfjs_require__(105); 55var _struct_tree = __w_pdfjs_require__(72); 56class WorkerTask { 57 constructor(name) { 58 this.name = name; 59 this.terminated = false; 60 this._capability = new _util.PromiseCapability(); 61 } 62 get finished() { 63 return this._capability.promise; 64 } 65 finish() { 66 this._capability.resolve(); 67 } 68 terminate() { 69 this.terminated = true; 70 } 71 ensureNotTerminated() { 72 if (this.terminated) { 73 throw new Error("Worker task was terminated"); 74 } 75 } 76} 77exports.WorkerTask = WorkerTask; 78class WorkerMessageHandler { 79 static setup(handler, port) { 80 let testMessageProcessed = false; 81 handler.on("test", function (data) { 82 if (testMessageProcessed) { 83 return; 84 } 85 testMessageProcessed = true; 86 handler.send("test", data instanceof Uint8Array); 87 }); 88 handler.on("configure", function (data) { 89 (0, _util.setVerbosityLevel)(data.verbosity); 90 }); 91 handler.on("GetDocRequest", function (data) { 92 return WorkerMessageHandler.createDocumentHandler(data, port); 93 }); 94 } 95 static createDocumentHandler(docParams, port) { 96 let pdfManager; 97 let terminated = false; 98 let cancelXHRs = null; 99 const WorkerTasks = new Set(); 100 const verbosity = (0, _util.getVerbosityLevel)(); 101 const { 102 docId, 103 apiVersion 104 } = docParams; 105 const workerVersion = '3.11.174'; 106 if (apiVersion !== workerVersion) { 107 throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); 108 } 109 const enumerableProperties = []; 110 for (const property in []) { 111 enumerableProperties.push(property); 112 } 113 if (enumerableProperties.length) { 114 throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s."); 115 } 116 const workerHandlerName = docId + "_worker"; 117 let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port); 118 function ensureNotTerminated() { 119 if (terminated) { 120 throw new Error("Worker was terminated"); 121 } 122 } 123 function startWorkerTask(task) { 124 WorkerTasks.add(task); 125 } 126 function finishWorkerTask(task) { 127 task.finish(); 128 WorkerTasks.delete(task); 129 } 130 async function loadDocument(recoveryMode) { 131 await pdfManager.ensureDoc("checkHeader"); 132 await pdfManager.ensureDoc("parseStartXRef"); 133 await pdfManager.ensureDoc("parse", [recoveryMode]); 134 await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]); 135 await pdfManager.ensureDoc("checkLastPage", [recoveryMode]); 136 const isPureXfa = await pdfManager.ensureDoc("isPureXfa"); 137 if (isPureXfa) { 138 const task = new WorkerTask("loadXfaFonts"); 139 startWorkerTask(task); 140 await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]); 141 } 142 const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]); 143 const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null; 144 return { 145 numPages, 146 fingerprints, 147 htmlForXfa 148 }; 149 } 150 function getPdfManager({ 151 data, 152 password, 153 disableAutoFetch, 154 rangeChunkSize, 155 length, 156 docBaseUrl, 157 enableXfa, 158 evaluatorOptions 159 }) { 160 const pdfManagerArgs = { 161 source: null, 162 disableAutoFetch, 163 docBaseUrl, 164 docId, 165 enableXfa, 166 evaluatorOptions, 167 handler, 168 length, 169 password, 170 rangeChunkSize 171 }; 172 const pdfManagerCapability = new _util.PromiseCapability(); 173 let newPdfManager; 174 if (data) { 175 try { 176 pdfManagerArgs.source = data; 177 newPdfManager = new _pdf_manager.LocalPdfManager(pdfManagerArgs); 178 pdfManagerCapability.resolve(newPdfManager); 179 } catch (ex) { 180 pdfManagerCapability.reject(ex); 181 } 182 return pdfManagerCapability.promise; 183 } 184 let pdfStream, 185 cachedChunks = [];
186 try { 187 pdfStream = new _worker_stream.PDFWorkerStream(handler); 188 } catch (ex) { 189 pdfManagerCapability.reject(ex); 190 return pdfManagerCapability.promise; 191 } 192 const fullRequest = pdfStream.getFullReader(); 193 fullRequest.headersReady.then(function () { 194 if (!fullRequest.isRangeSupported) { 195 return; 196 } 197 pdfManagerArgs.source = pdfStream; 198 pdfManagerArgs.length = fullRequest.contentLength; 199 pdfManagerArgs.disableAutoFetch ||= fullRequest.isStreamingSupported; 200 newPdfManager = new _pdf_manager.NetworkPdfManager(pdfManagerArgs); 201 for (const chunk of cachedChunks) { 202 newPdfManager.sendProgressiveData(chunk); 203 } 204 cachedChunks = []; 205 pdfManagerCapability.resolve(newPdfManager); 206 cancelXHRs = null; 207 }).catch(function (reason) { 208 pdfManagerCapability.reject(reason); 209 cancelXHRs = null; 210 }); 211 let loaded = 0; 212 const flushChunks = function () { 213 const pdfFile = (0, _core_utils.arrayBuffersToBytes)(cachedChunks); 214 if (length && pdfFile.length !== length) { 215 (0, _util.warn)("reported HTTP length is different from actual"); 216 } 217 try { 218 pdfManagerArgs.source = pdfFile; 219 newPdfManager = new _pdf_manager.LocalPdfManager(pdfManagerArgs); 220 pdfManagerCapability.resolve(newPdfManager); 221 } catch (ex) { 222 pdfManagerCapability.reject(ex); 223 } 224 cachedChunks = []; 225 }; 226 new Promise(function (resolve, reject) { 227 const readChunk = function ({ 228 value, 229 done 230 }) { 231 try { 232 ensureNotTerminated(); 233 if (done) { 234 if (!newPdfManager) { 235 flushChunks(); 236 } 237 cancelXHRs = null; 238 return; 239 } 240 loaded += value.byteLength; 241 if (!fullRequest.isStreamingSupported) { 242 handler.send("DocProgress", { 243 loaded, 244 total: Math.max(loaded, fullRequest.contentLength || 0) 245 }); 246 } 247 if (newPdfManager) { 248 newPdfManager.sendProgressiveData(value); 249 } else { 250 cachedChunks.push(value); 251 } 252 fullRequest.read().then(readChunk, reject); 253 } catch (e) { 254 reject(e); 255 } 256 }; 257 fullRequest.read().then(readChunk, reject); 258 }).catch(function (e) { 259 pdfManagerCapability.reject(e); 260 cancelXHRs = null; 261 }); 262 cancelXHRs = function (reason) { 263 pdfStream.cancelAllRequests(reason); 264 }; 265 return pdfManagerCapability.promise; 266 } 267 function setupDoc(data) { 268 function onSuccess(doc) { 269 ensureNotTerminated(); 270 handler.send("GetDoc", { 271 pdfInfo: doc 272 }); 273 } 274 function onFailure(ex) { 275 ensureNotTerminated(); 276 if (ex instanceof _util.PasswordException) { 277 const task = new WorkerTask(`PasswordException: response ${ex.code}`); 278 startWorkerTask(task); 279 handler.sendWithPromise("PasswordRequest", ex).then(function ({ 280 password 281 }) { 282 finishWorkerTask(task); 283 pdfManager.updatePassword(password); 284 pdfManagerReady(); 285 }).catch(function () { 286 finishWorkerTask(task); 287 handler.send("DocException", ex); 288 }); 289 } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) { 290 handler.send("DocException", ex); 291 } else { 292 handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString())); 293 } 294 } 295 function pdfManagerReady() { 296 ensureNotTerminated(); 297 loadDocument(false).then(onSuccess, function (reason) { 298 ensureNotTerminated(); 299 if (!(reason instanceof _core_utils.XRefParseException)) { 300 onFailure(reason); 301 return; 302 } 303 pdfManager.requestLoadedStream().then(function () { 304 ensureNotTerminated();
vendor: 6,091 bytes, lines 305-455
305 loadDocument(true).then(onSuccess, onFailure); 306 }); 307 }); 308 } 309 ensureNotTerminated(); 310 getPdfManager(data).then(function (newPdfManager) { 311 if (terminated) { 312 newPdfManager.terminate(new _util.AbortException("Worker was terminated.")); 313 throw new Error("Worker was terminated"); 314 } 315 pdfManager = newPdfManager; 316 pdfManager.requestLoadedStream(true).then(stream => { 317 handler.send("DataLoaded", { 318 length: stream.bytes.byteLength 319 }); 320 }); 321 }).then(pdfManagerReady, onFailure); 322 } 323 handler.on("GetPage", function (data) { 324 return pdfManager.getPage(data.pageIndex).then(function (page) { 325 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]) { 326 return { 327 rotate, 328 ref, 329 userUnit, 330 view 331 }; 332 }); 333 }); 334 }); 335 handler.on("GetPageIndex", function (data) { 336 const pageRef = _primitives.Ref.get(data.num, data.gen); 337 return pdfManager.ensureCatalog("getPageIndex", [pageRef]); 338 }); 339 handler.on("GetDestinations", function (data) { 340 return pdfManager.ensureCatalog("destinations"); 341 }); 342 handler.on("GetDestination", function (data) { 343 return pdfManager.ensureCatalog("getDestination", [data.id]); 344 }); 345 handler.on("GetPageLabels", function (data) { 346 return pdfManager.ensureCatalog("pageLabels"); 347 }); 348 handler.on("GetPageLayout", function (data) { 349 return pdfManager.ensureCatalog("pageLayout"); 350 }); 351 handler.on("GetPageMode", function (data) { 352 return pdfManager.ensureCatalog("pageMode"); 353 }); 354 handler.on("GetViewerPreferences", function (data) { 355 return pdfManager.ensureCatalog("viewerPreferences"); 356 }); 357 handler.on("GetOpenAction", function (data) { 358 return pdfManager.ensureCatalog("openAction"); 359 }); 360 handler.on("GetAttachments", function (data) { 361 return pdfManager.ensureCatalog("attachments"); 362 }); 363 handler.on("GetDocJSActions", function (data) { 364 return pdfManager.ensureCatalog("jsActions"); 365 }); 366 handler.on("GetPageJSActions", function ({ 367 pageIndex 368 }) { 369 return pdfManager.getPage(pageIndex).then(function (page) { 370 return pdfManager.ensure(page, "jsActions"); 371 }); 372 }); 373 handler.on("GetOutline", function (data) { 374 return pdfManager.ensureCatalog("documentOutline"); 375 }); 376 handler.on("GetOptionalContentConfig", function (data) { 377 return pdfManager.ensureCatalog("optionalContentConfig"); 378 }); 379 handler.on("GetPermissions", function (data) { 380 return pdfManager.ensureCatalog("permissions"); 381 }); 382 handler.on("GetMetadata", function (data) { 383 return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]); 384 }); 385 handler.on("GetMarkInfo", function (data) { 386 return pdfManager.ensureCatalog("markInfo"); 387 }); 388 handler.on("GetData", function (data) { 389 return pdfManager.requestLoadedStream().then(function (stream) { 390 return stream.bytes; 391 }); 392 }); 393 handler.on("GetAnnotations", function ({ 394 pageIndex, 395 intent 396 }) { 397 return pdfManager.getPage(pageIndex).then(function (page) { 398 const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`); 399 startWorkerTask(task); 400 return page.getAnnotationsData(handler, task, intent).then(data => { 401 finishWorkerTask(task); 402 return data; 403 }, reason => { 404 finishWorkerTask(task); 405 throw reason; 406 }); 407 }); 408 }); 409 handler.on("GetFieldObjects", function (data) { 410 return pdfManager.ensureDoc("fieldObjects"); 411 }); 412 handler.on("HasJSActions", function (data) { 413 return pdfManager.ensureDoc("hasJSActions"); 414 }); 415 handler.on("GetCalculationOrderIds", function (data) { 416 return pdfManager.ensureDoc("calculationOrderIds"); 417 }); 418 handler.on("SaveDocument", async function ({ 419 isPureXfa, 420 numPages, 421 annotationStorage, 422 filename 423 }) { 424 const globalPromises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("startXRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("structTreeRoot")]; 425 const promises = []; 426 const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null; 427 const [stream, acroForm, acroFormRef, startXRef, xref, linearization, _structTreeRoot] = await Promise.all(globalPromises); 428 const catalogRef = xref.trailer.getRaw("Root") || null; 429 let structTreeRoot; 430 if (newAnnotationsByPage) { 431 if (!_structTreeRoot) { 432 if (await _struct_tree.StructTreeRoot.canCreateStructureTree({ 433 catalogRef, 434 pdfManager, 435 newAnnotationsByPage 436 })) { 437 structTreeRoot = null; 438 } 439 } else if (await _structTreeRoot.canUpdateStructTree({ 440 pdfManager, 441 newAnnotationsByPage 442 })) { 443 structTreeRoot = _structTreeRoot; 444 } 445 const imagePromises = _annotation.AnnotationFactory.generateImages(annotationStorage.values(), xref, pdfManager.evaluatorOptions.isOffscreenCanvasSupported); 446 const newAnnotationPromises = structTreeRoot === undefined ? promises : []; 447 for (const [pageIndex, annotations] of newAnnotationsByPage) { 448 newAnnotationPromises.push(pdfManager.getPage(pageIndex).then(page => { 449 const task = new WorkerTask(`Save (editor): page ${pageIndex}`); 450 return page.saveNewAnnotations(handler, task, annotations, imagePromises).finally(function () { 451 finishWorkerTask(task); 452 }); 453 })); 454 } 455 if (structTreeRoot === null) {
456 promises.push(Promise.all(newAnnotationPromises).then(async newRefs => { 457 await _struct_tree.StructTreeRoot.createStructureTree({ 458 newAnnotationsByPage, 459 xref, 460 catalogRef, 461 pdfManager, 462 newRefs 463 }); 464 return newRefs; 465 })); 466 } else if (structTreeRoot) { 467 promises.push(Promise.all(newAnnotationPromises).then(async newRefs => { 468 await structTreeRoot.updateStructureTree({ 469 newAnnotationsByPage, 470 pdfManager, 471 newRefs 472 }); 473 return newRefs; 474 })); 475 } 476 } 477 if (isPureXfa) { 478 promises.push(pdfManager.serializeXfaData(annotationStorage)); 479 } else { 480 for (let pageIndex = 0; pageIndex < numPages; pageIndex++) { 481 promises.push(pdfManager.getPage(pageIndex).then(function (page) { 482 const task = new WorkerTask(`Save: page ${pageIndex}`); 483 return page.save(handler, task, annotationStorage).finally(function () { 484 finishWorkerTask(task); 485 }); 486 })); 487 } 488 } 489 const refs = await Promise.all(promises); 490 let newRefs = []; 491 let xfaData = null; 492 if (isPureXfa) { 493 xfaData = refs[0]; 494 if (!xfaData) { 495 return stream.bytes; 496 } 497 } else { 498 newRefs = refs.flat(2); 499 if (newRefs.length === 0) { 500 return stream.bytes; 501 } 502 } 503 const needAppearances = acroFormRef && acroForm instanceof _primitives.Dict && newRefs.some(ref => ref.needAppearances); 504 const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null; 505 let xfaDatasetsRef = null; 506 let hasXfaDatasetsEntry = false; 507 if (Array.isArray(xfa)) { 508 for (let i = 0, ii = xfa.length; i < ii; i += 2) { 509 if (xfa[i] === "datasets") { 510 xfaDatasetsRef = xfa[i + 1]; 511 hasXfaDatasetsEntry = true; 512 } 513 } 514 if (xfaDatasetsRef === null) { 515 xfaDatasetsRef = xref.getNewTemporaryRef(); 516 } 517 } else if (xfa) { 518 (0, _util.warn)("Unsupported XFA type."); 519 } 520 let newXrefInfo = Object.create(null); 521 if (xref.trailer) { 522 const infoObj = Object.create(null); 523 const xrefInfo = xref.trailer.get("Info") || null; 524 if (xrefInfo instanceof _primitives.Dict) { 525 xrefInfo.forEach((key, value) => { 526 if (typeof value === "string") { 527 infoObj[key] = (0, _util.stringToPDFString)(value); 528 } 529 }); 530 } 531 newXrefInfo = { 532 rootRef: catalogRef, 533 encryptRef: xref.trailer.getRaw("Encrypt") || null, 534 newRef: xref.getNewTemporaryRef(), 535 infoRef: xref.trailer.getRaw("Info") || null, 536 info: infoObj, 537 fileIds: xref.trailer.get("ID") || null, 538 startXRef: linearization ? startXRef : xref.lastXRefStreamPos ?? startXRef, 539 filename 540 }; 541 } 542 return (0, _writer.incrementalUpdate)({ 543 originalData: stream.bytes, 544 xrefInfo: newXrefInfo, 545 newRefs, 546 xref, 547 hasXfa: !!xfa, 548 xfaDatasetsRef, 549 hasXfaDatasetsEntry, 550 needAppearances, 551 acroFormRef, 552 acroForm, 553 xfaData 554 }).finally(() => { 555 xref.resetNewTemporaryRef(); 556 }); 557 }); 558 handler.on("GetOperatorList", function (data, sink) { 559 const pageIndex = data.pageIndex; 560 pdfManager.getPage(pageIndex).then(function (page) { 561 const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`); 562 startWorkerTask(task); 563 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 564 page.getOperatorList({ 565 handler, 566 sink, 567 task, 568 intent: data.intent, 569 cacheKey: data.cacheKey, 570 annotationStorage: data.annotationStorage 571 }).then(function (operatorListInfo) { 572 finishWorkerTask(task); 573 if (start) { 574 (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}
574ms, len=${operatorListInfo.length}`); 575 } 576 sink.close(); 577 }, function (reason) { 578 finishWorkerTask(task); 579 if (task.terminated) { 580 return; 581 } 582 sink.error(reason); 583 }); 584 }); 585 }); 586 handler.on("GetTextContent", function (data, sink) { 587 const { 588 pageIndex, 589 includeMarkedContent, 590 disableNormalization 591 } = data; 592 pdfManager.getPage(pageIndex).then(function (page) { 593 const task = new WorkerTask("GetTextContent: page " + pageIndex); 594 startWorkerTask(task); 595 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 596 page.extractTextContent({ 597 handler, 598 task, 599 sink, 600 includeMarkedContent, 601 disableNormalization 602 }).then(function () { 603 finishWorkerTask(task); 604 if (start) { 605 (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`); 606 } 607 sink.close(); 608 }, function (reason) { 609 finishWorkerTask(task); 610 if (task.terminated) { 611 return; 612 } 613 sink.error(reason); 614 }); 615 }); 616 }); 617 handler.on("GetStructTree", function (data) { 618 return pdfManager.getPage(data.pageIndex).then(function (page) { 619 return pdfManager.ensure(page, "getStructTree"); 620 }); 621 }); 622 handler.on("FontFallback", function (data) { 623 return pdfManager.fontFallback(data.id, handler); 624 }); 625 handler.on("Cleanup", function (data) { 626 return pdfManager.cleanup(true); 627 }); 628 handler.on("Terminate", function (data) { 629 terminated = true; 630 const waitOn = []; 631 if (pdfManager) { 632 pdfManager.terminate(new _util.AbortException("Worker was terminated.")); 633 const cleanupPromise = pdfManager.cleanup(); 634 waitOn.push(cleanupPromise); 635 pdfManager = null; 636 } else { 637 (0, _cleanup_helper.clearGlobalCaches)(); 638 } 639 if (cancelXHRs) { 640 cancelXHRs(new _util.AbortException("Worker was terminated.")); 641 } 642 for (const task of WorkerTasks) { 643 waitOn.push(task.finished); 644 task.terminate(); 645 } 646 return Promise.all(waitOn).then(function () { 647 handler.destroy(); 648 handler = null; 649 }); 650 }); 651 handler.on("Ready", function (data) { 652 setupDoc(docParams); 653 docParams = null; 654 }); 655 return workerHandlerName; 656 } 657 static initializeFromPort(port) { 658 const handler = new _message_handler.MessageHandler("worker", "main", port); 659 WorkerMessageHandler.setup(handler, port); 660 handler.send("ready", null); 661 } 662} 663exports.WorkerMessageHandler = WorkerMessageHandler; 664function isMessagePort(maybePort) { 665 return typeof maybePort.postMessage === "function" && "onmessage" in maybePort; 666} 667if (typeof window === "undefined" && !_util.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) { 668 WorkerMessageHandler.initializeFromPort(self); 669} 670 671/***/ }), 672/* 2 */ 673/***/ ((__unused_webpack_module, exports) => { 674 675 676 677Object.defineProperty(exports, "__esModule", ({ 678 value: true 679})); 680exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.RenderingIntentFlag = exports.PromiseCapability = exp
680orts.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.MAX_IMAGE_SIZE_TO_CACHE = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.BASELINE_FACTOR = exports.AnnotationType = exports.AnnotationReplyType = exports.AnnotationPrefix = exports.AnnotationMode = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0; 681exports.assert = assert; 682exports.bytesToString = bytesToString; 683exports.createValidAbsoluteUrl = createValidAbsoluteUrl; 684exports.getModificationDate = getModificationDate; 685exports.getUuid = getUuid; 686exports.getVerbosityLevel = getVerbosityLevel; 687exports.info = info; 688exports.isArrayBuffer = isArrayBuffer; 689exports.isArrayEqual = isArrayEqual; 690exports.isNodeJS = void 0; 691exports.normalizeUnicode = normalizeUnicode; 692exports.objectFromMap = objectFromMap; 693exports.objectSize = objectSize; 694exports.setVerbosityLevel = setVerbosityLevel; 695exports.shadow = shadow; 696exports.string32 = string32; 697exports.stringToBytes = stringToBytes; 698exports.stringToPDFString = stringToPDFString; 699exports.stringToUTF8String = stringToUTF8String; 700exports.unreachable = unreachable; 701exports.utf8StringToString = utf8StringToString; 702exports.warn = warn; 703const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
704exports.isNodeJS = isNodeJS; 705const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; 706exports.IDENTITY_MATRIX = IDENTITY_MATRIX; 707const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; 708exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; 709const MAX_IMAGE_SIZE_TO_CACHE = 10e6; 710exports.MAX_IMAGE_SIZE_TO_CACHE = MAX_IMAGE_SIZE_TO_CACHE; 711const LINE_FACTOR = 1.35; 712exports.LINE_FACTOR = LINE_FACTOR; 713const LINE_DESCENT_FACTOR = 0.35; 714exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR; 715const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR; 716exports.BASELINE_FACTOR = BASELINE_FACTOR; 717const RenderingIntentFlag = { 718 ANY: 0x01, 719 DISPLAY: 0x02, 720 PRINT: 0x04, 721 SAVE: 0x08, 722 ANNOTATIONS_FORMS: 0x10, 723 ANNOTATIONS_STORAGE: 0x20, 724 ANNOTATIONS_DISABLE: 0x40, 725 OPLIST: 0x100 726}; 727exports.RenderingIntentFlag = RenderingIntentFlag; 728const AnnotationMode = { 729 DISABLE: 0, 730 ENABLE: 1, 731 ENABLE_FORMS: 2, 732 ENABLE_STORAGE: 3 733}; 734exports.AnnotationMode = AnnotationMode; 735const AnnotationEditorPrefix = "pdfjs_internal_editor_"; 736exports.AnnotationEditorPrefix = AnnotationEditorPrefix; 737const AnnotationEditorType = { 738 DISABLE: -1, 739 NONE: 0, 740 FREETEXT: 3, 741 STAMP: 13, 742 INK: 15 743}; 744exports.AnnotationEditorType = AnnotationEditorType; 745const AnnotationEditorParamsType = { 746 RESIZE: 1, 747 CREATE: 2, 748 FREETEXT_SIZE: 11, 749 FREETEXT_COLOR: 12, 750 FREETEXT_OPACITY: 13, 751 INK_COLOR: 21, 752 INK_THICKNESS: 22, 753 INK_OPACITY: 23 754}; 755exports.AnnotationEditorParamsType = AnnotationEditorParamsType; 756const PermissionFlag = { 757 PRINT: 0x04, 758 MODIFY_CONTENTS: 0x08, 759 COPY: 0x10, 760 MODIFY_ANNOTATIONS: 0x20, 761 FILL_INTERACTIVE_FORMS: 0x100, 762 COPY_FOR_ACCESSIBILITY: 0x200, 763 ASSEMBLE: 0x400, 764 PRINT_HIGH_QUALITY: 0x800 765}; 766exports.PermissionFlag = PermissionFlag; 767const TextRenderingMode = { 768 FILL: 0, 769 STROKE: 1, 770 FILL_STROKE: 2, 771 INVISIBLE: 3, 772 FILL_ADD_TO_PATH: 4, 773 STROKE_ADD_TO_PATH: 5, 774 FILL_STROKE_ADD_TO_PATH: 6, 775 ADD_TO_PATH: 7, 776 FILL_STROKE_MASK: 3, 777 ADD_TO_PATH_FLAG: 4 778}; 779exports.TextRenderingMode = TextRenderingMode; 780const ImageKind = { 781 GRAYSCALE_1BPP: 1, 782 RGB_24BPP: 2, 783 RGBA_32BPP: 3 784}; 785exports.ImageKind = ImageKind; 786const AnnotationType = { 787 TEXT: 1, 788 LINK: 2, 789 FREETEXT: 3, 790 LINE: 4, 791 SQUARE: 5, 792 CIRCLE: 6, 793 POLYGON: 7, 794 POLYLINE: 8, 795 HIGHLIGHT: 9, 796 UNDERLINE: 10, 797 SQUIGGLY: 11, 798 STRIKEOUT: 12, 799 STAMP: 13, 800 CARET: 14, 801 INK: 15, 802 POPUP: 16, 803 FILEATTACHMENT: 17, 804 SOUND: 18, 805 MOVIE: 19, 806 WIDGET: 20, 807 SCREEN: 21, 808 PRINTERMARK: 22, 809 TRAPNET: 23, 810 WATERMARK: 24, 811 THREED: 25, 812 REDACT: 26 813}; 814exports.AnnotationType = AnnotationType; 815const AnnotationReplyType = { 816 GROUP: "Group", 817 REPLY: "R" 818}; 819exports.AnnotationReplyType = AnnotationReplyType; 820const AnnotationFlag = { 821 INVISIBLE: 0x01, 822 HIDDEN: 0x02, 823 PRINT: 0x04, 824 NOZOOM: 0x08, 825 NOROTATE: 0x10, 826 NOVIEW: 0x20, 827 READONLY: 0x40, 828 LOCKED: 0x80, 829 TOGGLENOVIEW: 0x100, 830 LOCKEDCONTENTS: 0x200 831}; 832exports.AnnotationFlag = AnnotationFlag; 833const AnnotationFieldFlag = { 834 READONLY: 0x0000001, 835 REQUIRED: 0x0000002, 836 NOEXPORT: 0x0000004, 837 MULTILINE: 0x0001000, 838 PASSWORD: 0x0002000, 839 NOTOGGLETOOFF: 0x0004000, 840 RADIO: 0x0008000, 841 PUSHBUTTON: 0x0010000, 842 COMBO: 0x0020000, 843 EDIT: 0x0040000, 844 SORT: 0x0080000, 845 FILESELECT: 0x0100000, 846 MULTISELECT: 0x0200000, 847 DONOTSPELLCHECK: 0x0400000, 848 DONOTSCROLL: 0x0800000, 849 COMB: 0x1000000, 850 RICHTEXT: 0x2000000, 851 RADIOSINUNISON: 0x2000000, 852 COMMITONSELCHANGE: 0x4000000 853}; 854exports.AnnotationFieldFlag = AnnotationFieldFlag; 855const AnnotationBorderStyleType = { 856 SOLID: 1, 857 DASHED: 2, 858 BEVELED: 3, 859 INSET: 4, 860 UNDERLINE: 5 861}; 862exports.AnnotationBorderStyleType = AnnotationBorderStyleType; 863const AnnotationActionEventType = { 864 E: "Mouse Enter", 865 X: "Mouse Exit", 866 D: "Mouse Down", 867 U: "Mouse Up", 868 Fo: "Focus", 869 Bl: "Blur", 870 PO: "PageOpen", 871 PC: "PageClose", 872 PV: "PageVisible", 873 PI: "PageInvisible", 874 K: "Keystroke", 875 F: "Format", 876 V: "Validate", 877 C: "Calculate" 878}; 879exports.AnnotationActionEventType = AnnotationActionEventType; 880const DocumentActionEventType = { 881 WC: "WillClose", 882 WS: "WillSave", 883 DS: "DidSave", 884 WP: "WillPrint", 885 DP: "DidPrint" 886}; 887exports.DocumentActionEventType = DocumentActionEventType; 888const PageActionEventType = { 889 O: "PageOpen", 890 C: "PageClose" 891}; 892exports.PageActionEventType = PageActionEventType; 893const VerbosityLevel = { 894 ERRORS: 0, 895 WARNINGS: 1, 896 INFOS: 5 897}; 898exports.VerbosityLevel = VerbosityLevel; 899const CMapCompressionType = { 900 NONE: 0, 901 BINARY: 1 902}; 903exports.CMapCompressionType = CMapCompressionType; 904const OPS = { 905 dependency: 1, 906 setLineWidth: 2, 907 setLineCap: 3, 908 setLineJoin: 4, 909 setMiterLimit: 5, 910 setDash: 6, 911 setRenderingIntent: 7,
vendor: 5,984 bytes, lines 912-1155
912 setFlatness: 8, 913 setGState: 9, 914 save: 10, 915 restore: 11, 916 transform: 12, 917 moveTo: 13, 918 lineTo: 14, 919 curveTo: 15, 920 curveTo2: 16, 921 curveTo3: 17, 922 closePath: 18, 923 rectangle: 19, 924 stroke: 20, 925 closeStroke: 21, 926 fill: 22, 927 eoFill: 23, 928 fillStroke: 24, 929 eoFillStroke: 25, 930 closeFillStroke: 26, 931 closeEOFillStroke: 27, 932 endPath: 28, 933 clip: 29, 934 eoClip: 30, 935 beginText: 31, 936 endText: 32, 937 setCharSpacing: 33, 938 setWordSpacing: 34, 939 setHScale: 35, 940 setLeading: 36, 941 setFont: 37, 942 setTextRenderingMode: 38, 943 setTextRise: 39, 944 moveText: 40, 945 setLeadingMoveText: 41, 946 setTextMatrix: 42, 947 nextLine: 43, 948 showText: 44, 949 showSpacedText: 45, 950 nextLineShowText: 46, 951 nextLineSetSpacingShowText: 47, 952 setCharWidth: 48, 953 setCharWidthAndBounds: 49, 954 setStrokeColorSpace: 50, 955 setFillColorSpace: 51, 956 setStrokeColor: 52, 957 setStrokeColorN: 53, 958 setFillColor: 54, 959 setFillColorN: 55, 960 setStrokeGray: 56, 961 setFillGray: 57, 962 setStrokeRGBColor: 58, 963 setFillRGBColor: 59, 964 setStrokeCMYKColor: 60, 965 setFillCMYKColor: 61, 966 shadingFill: 62, 967 beginInlineImage: 63, 968 beginImageData: 64, 969 endInlineImage: 65, 970 paintXObject: 66, 971 markPoint: 67, 972 markPointProps: 68, 973 beginMarkedContent: 69, 974 beginMarkedContentProps: 70, 975 endMarkedContent: 71, 976 beginCompat: 72, 977 endCompat: 73, 978 paintFormXObjectBegin: 74, 979 paintFormXObjectEnd: 75, 980 beginGroup: 76, 981 endGroup: 77, 982 beginAnnotation: 80, 983 endAnnotation: 81, 984 paintImageMaskXObject: 83, 985 paintImageMaskXObjectGroup: 84, 986 paintImageXObject: 85, 987 paintInlineImageXObject: 86, 988 paintInlineImageXObjectGroup: 87, 989 paintImageXObjectRepeat: 88, 990 paintImageMaskXObjectRepeat: 89, 991 paintSolidColorImageMask: 90, 992 constructPath: 91 993}; 994exports.OPS = OPS; 995const PasswordResponses = { 996 NEED_PASSWORD: 1, 997 INCORRECT_PASSWORD: 2 998}; 999exports.PasswordResponses = PasswordResponses; 1000let verbosity = VerbosityLevel.WARNINGS; 1001function setVerbosityLevel(level) { 1002 if (Number.isInteger(level)) { 1003 verbosity = level; 1004 } 1005} 1006function getVerbosityLevel() { 1007 return verbosity; 1008} 1009function info(msg) { 1010 if (verbosity >= VerbosityLevel.INFOS) { 1011 console.log(`Info: ${msg}`); 1012 } 1013} 1014function warn(msg) { 1015 if (verbosity >= VerbosityLevel.WARNINGS) { 1016 console.log(`Warning: ${msg}`); 1017 } 1018} 1019function unreachable(msg) { 1020 throw new Error(msg); 1021} 1022function assert(cond, msg) { 1023 if (!cond) { 1024 unreachable(msg); 1025 } 1026} 1027function _isValidProtocol(url) { 1028 switch (url?.protocol) { 1029 case "http:": 1030 case "https:": 1031 case "ftp:": 1032 case "mailto:": 1033 case "tel:": 1034 return true; 1035 default: 1036 return false; 1037 } 1038} 1039function createValidAbsoluteUrl(url, baseUrl = null, options = null) { 1040 if (!url) { 1041 return null; 1042 } 1043 try { 1044 if (options && typeof url === "string") { 1045 if (options.addDefaultProtocol && url.startsWith("www.")) { 1046 const dots = url.match(/\./g); 1047 if (dots?.length >= 2) { 1048 url = `http://${url}`; 1049 } 1050 } 1051 if (options.tryConvertEncoding) { 1052 try { 1053 url = stringToUTF8String(url); 1054 } catch {} 1055 } 1056 } 1057 const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); 1058 if (_isValidProtocol(absoluteUrl)) { 1059 return absoluteUrl; 1060 } 1061 } catch {} 1062 return null; 1063} 1064function shadow(obj, prop, value, nonSerializable = false) { 1065 Object.defineProperty(obj, prop, { 1066 value, 1067 enumerable: !nonSerializable, 1068 configurable: true, 1069 writable: false 1070 }); 1071 return value; 1072} 1073const BaseException = function BaseExceptionClosure() { 1074 function BaseException(message, name) { 1075 if (this.constructor === BaseException) { 1076 unreachable("Cannot initialize BaseException."); 1077 } 1078 this.message = message; 1079 this.name = name; 1080 } 1081 BaseException.prototype = new Error(); 1082 BaseException.constructor = BaseException; 1083 return BaseException; 1084}(); 1085exports.BaseException = BaseException; 1086class PasswordException extends BaseException { 1087 constructor(msg, code) { 1088 super(msg, "PasswordException"); 1089 this.code = code; 1090 } 1091} 1092exports.PasswordException = PasswordException; 1093class UnknownErrorException extends BaseException { 1094 constructor(msg, details) { 1095 super(msg, "UnknownErrorException"); 1096 this.details = details; 1097 } 1098} 1099exports.UnknownErrorException = UnknownErrorException; 1100class InvalidPDFException extends BaseException { 1101 constructor(msg) { 1102 super(msg, "InvalidPDFException"); 1103 } 1104} 1105exports.InvalidPDFException = InvalidPDFException; 1106class MissingPDFException extends BaseException { 1107 constructor(msg) { 1108 super(msg, "MissingPDFException"); 1109 } 1110} 1111exports.MissingPDFException = MissingPDFException; 1112class UnexpectedResponseException extends BaseException { 1113 constructor(msg, status) { 1114 super(msg, "UnexpectedResponseException"); 1115 this.status = status; 1116 } 1117} 1118exports.UnexpectedResponseException = UnexpectedResponseException; 1119class FormatError extends BaseException { 1120 constructor(msg) { 1121 super(msg, "FormatError"); 1122 } 1123} 1124exports.FormatError = FormatError; 1125class AbortException extends BaseException { 1126 constructor(msg) { 1127 super(msg, "AbortException"); 1128 } 1129} 1130exports.AbortException = AbortException; 1131function bytesToString(bytes) { 1132 if (typeof bytes !== "object" || bytes?.length === undefined) { 1133 unreachable("Invalid argument for bytesToString"); 1134 } 1135 const length = bytes.length; 1136 const MAX_ARGUMENT_COUNT = 8192; 1137 if (length < MAX_ARGUMENT_COUNT) { 1138 return String.fromCharCode.apply(null, bytes); 1139 } 1140 const strBuf = []; 1141 for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) { 1142 const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); 1143 const chunk = bytes.subarray(i, chunkEnd); 1144 strBuf.push(String.fromCharCode.apply(null, chunk)); 1145 } 1146 return strBuf.join(""); 1147} 1148function stringToBytes(str) { 1149 if (typeof str !== "string") { 1150 unreachable("Invalid argument for stringToBytes"); 1151 } 1152 const length = str.length; 1153 const bytes = new Uint8Array(length); 1154 for (let i = 0; i < length; ++i) { 1155 bytes[i] = str.charCodeAt(i) & 0xff;
1156 } 1157 return bytes; 1158} 1159function string32(value) { 1160 return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 1161} 1162function objectSize(obj) { 1163 return Object.keys(obj).length; 1164} 1165function objectFromMap(map) { 1166 const obj = Object.create(null); 1167 for (const [key, value] of map) { 1168 obj[key] = value; 1169 } 1170 return obj; 1171} 1172function isLittleEndian() { 1173 const buffer8 = new Uint8Array(4); 1174 buffer8[0] = 1; 1175 const view32 = new Uint32Array(buffer8.buffer, 0, 1); 1176 return view32[0] === 1; 1177} 1178function isEvalSupported() { 1179 try { 1180 new Function(""); 1181 return true; 1182 } catch { 1183 return false; 1184 } 1185} 1186class FeatureTest { 1187 static get isLittleEndian() { 1188 return shadow(this, "isLittleEndian", isLittleEndian()); 1189 } 1190 static get isEvalSupported() { 1191 return shadow(this, "isEvalSupported", isEvalSupported()); 1192 } 1193 static get isOffscreenCanvasSupported() { 1194 return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined"); 1195 } 1196 static get platform() { 1197 if (typeof navigator === "undefined") { 1198 return shadow(this, "platform", { 1199 isWin: false, 1200 isMac: false 1201 }); 1202 } 1203 return shadow(this, "platform", { 1204 isWin: navigator.platform.includes("Win"), 1205 isMac: navigator.platform.includes("Mac") 1206 }); 1207 } 1208 static get isCSSRoundSupported() { 1209 return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)")); 1210 } 1211} 1212exports.FeatureTest = FeatureTest; 1213const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0")); 1214class Util { 1215 static makeHexColor(r, g, b) { 1216 return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`; 1217 } 1218 static scaleMinMax(transform, minMax) { 1219 let temp; 1220 if (transform[0]) { 1221 if (transform[0] < 0) { 1222 temp = minMax[0]; 1223 minMax[0] = minMax[1]; 1224 minMax[1] = temp; 1225 } 1226 minMax[0] *= transform[0]; 1227 minMax[1] *= transform[0]; 1228 if (transform[3] < 0) { 1229 temp = minMax[2]; 1230 minMax[2] = minMax[3]; 1231 minMax[3] = temp; 1232 } 1233 minMax[2] *= transform[3]; 1234 minMax[3] *= transform[3]; 1235 } else { 1236 temp = minMax[0]; 1237 minMax[0] = minMax[2]; 1238 minMax[2] = temp; 1239 temp = minMax[1]; 1240 minMax[1] = minMax[3]; 1241 minMax[3] = temp; 1242 if (transform[1] < 0) { 1243 temp = minMax[2]; 1244 minMax[2] = minMax[3]; 1245 minMax[3] = temp; 1246 } 1247 minMax[2] *= transform[1]; 1248 minMax[3] *= transform[1]; 1249 if (transform[2] < 0) { 1250 temp = minMax[0]; 1251 minMax[0] = minMax[1]; 1252 minMax[1] = temp; 1253 } 1254 minMax[0] *= transform[2]; 1255 minMax[1] *= transform[2]; 1256 } 1257 minMax[0] += transform[4]; 1258 minMax[1] += transform[4]; 1259 minMax[2] += transform[5]; 1260 minMax[3] += transform[5]; 1261 } 1262 static transform(m1, m2) { 1263 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]]; 1264 } 1265 static applyTransform(p, m) { 1266 const xt = p[0] * m[0] + p[1] * m[2] + m[4]; 1267 const yt = p[0] * m[1] + p[1] * m[3] + m[5]; 1268 return [xt, yt]; 1269 } 1270 static applyInverseTransform(p, m) { 1271 const d = m[0] * m[3] - m[1] * m[2]; 1272 const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; 1273 const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; 1274 return [xt, yt]; 1275 } 1276 static getAxialAlignedBoundingBox(r, m) { 1277 const p1 = this.applyTransform(r, m); 1278 const p2 = this.applyTransform(r.slice(2, 4), m); 1279 const p3 = this.applyTransform([r[0], r[3]], m); 1280 const p4 = this.applyTransform([r[2], r[1]], m); 1281 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])]; 1282 } 1283 static inverseTransform(m) { 1284 const d = m[0] * m[3] - m[1] * m[2]; 1285 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]; 1286 } 1287 static singularValueDecompose2dScale(m) { 1288 const transpose = [m[0], m[2], m[1], m[3]]; 1289 const a = m[0] * transpose[0] + m[1] * transpose[2]; 1290 const b = m[0] * transpose[1] + m[1] * transpose[3]; 1291 const c = m[2] * transpose[0] + m[3] * transpose[2]; 1292 const d = m[2] * transpose[1] + m[3] * transpose[3]; 1293 const first = (a + d) / 2; 1294 const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2; 1295 const sx = first + second || 1; 1296 const sy = first - second || 1; 1297 return [Math.sqrt(sx), Math.sqrt(sy)]; 1298 } 1299 static normalizeRect(rect) { 1300 const r = rect.slice(0); 1301 if (rect[0] > rect[2]) { 1302 r[0] = rect[2]; 1303 r[2] = rect[0]; 1304 } 1305 if (rect[1] > rect[3]) { 1306 r[1] = rect[3]; 1307 r[3] = rect[1]; 1308 } 1309 return r; 1310 } 1311 static intersect(rect1, rect2) { 1312 const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2])); 1313 const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2])); 1314 if (xLow > xHigh) { 1315 return null; 1316 } 1317 const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3])); 1318 const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3])); 1319 if (yLow > yHigh) { 1320 return null; 1321 } 1322 return [xLow, yLow, xHigh, yHigh]; 1323 } 1324 static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) { 1325 const tvalues = [], 1326 bounds = [[], []]; 1327 let a, b, c, t, t1, t2, b2ac, sqrtb2ac; 1328 for (let i = 0; i < 2; ++i) { 1329 if (i === 0) { 1330 b = 6 * x0 - 12 * x1 + 6 * x2; 1331 a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3; 1332 c = 3 * x1 - 3 * x0; 1333 } else { 1334 b = 6 * y0 - 12 * y1 + 6 * y2; 1335 a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3; 1336 c = 3 * y1 - 3 * y0; 1337 } 1338 if (Math.abs(a) < 1e-12) { 1339 if (Math.abs(b) < 1e-12) { 1340 continue; 1341 } 1342 t = -c / b; 1343 if (0 < t && t < 1) { 1344 tvalues.push(t); 1345 } 1346 continue; 1347 } 1348 b2ac = b * b - 4 * c * a; 1349 sqrtb2ac = Math.sqrt(b2ac); 1350 if (b2ac < 0) { 1351 continue; 1352 } 1353 t1 = (-b + sqrtb2ac) / (2 * a); 1354 if (0 < t1 && t1 < 1) { 1355 tvalues.push(t1); 1356 } 1357 t2 = (-b - sqrtb2ac) / (2 * a); 1358 if (0 < t2 && t2 < 1) { 1359 tvalues.push(t2); 1360 } 1361 } 1362 let j = tvalues.length, 1363 mt; 1364 const jlen = j; 1365 while (j--) { 1366 t = tvalues[j]; 1367 mt = 1 - t; 1368 bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3; 1369 bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3; 1370 } 1371 bounds[0][jlen] = x0; 1372 bounds[1][jlen] = y0; 1373 bounds[0][jlen + 1] = x3; 1374 bounds[1][jlen + 1] = y3; 1375 bounds[0].length = bounds[1].length = jlen + 2; 1376 return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])]; 1377 } 1378} 1379exports.Util = Util; 1380const 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]; 1381function stringToPDFString(str) { 1382 if (str[0] >= "\xEF") { 1383 let encoding; 1384 if (str[0] === "\xFE" && str[1] === "\xFF") { 1385 encoding = "utf-16be"; 1386 } else if (str[0] === "\xFF" && str[1] === "\xFE") { 1387 encoding = "utf-16le"; 1388 } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") { 1389 encoding = "utf-8"; 1390 } 1391 if (encoding) {
1392 try { 1393 const decoder = new TextDecoder(encoding, { 1394 fatal: true 1395 }); 1396 const buffer = stringToBytes(str); 1397 return decoder.decode(buffer); 1398 } catch (ex) { 1399 warn(`stringToPDFString: "${ex}".`); 1400 } 1401 } 1402 } 1403 const strBuf = []; 1404 for (let i = 0, ii = str.length; i < ii; i++) { 1405 const code = PDFStringTranslateTable[str.charCodeAt(i)]; 1406 strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); 1407 } 1408 return strBuf.join(""); 1409} 1410function stringToUTF8String(str) { 1411 return decodeURIComponent(escape(str)); 1412} 1413function utf8StringToString(str) { 1414 return unescape(encodeURIComponent(str)); 1415} 1416function isArrayBuffer(v) { 1417 return typeof v === "object" && v?.byteLength !== undefined; 1418} 1419function isArrayEqual(arr1, arr2) { 1420 if (arr1.length !== arr2.length) { 1421 return false; 1422 } 1423 for (let i = 0, ii = arr1.length; i < ii; i++) { 1424 if (arr1[i] !== arr2[i]) { 1425 return false; 1426 } 1427 } 1428 return true; 1429} 1430function getModificationDate(date = new Date()) { 1431 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")]; 1432 return buffer.join(""); 1433} 1434class PromiseCapability { 1435 #settled = false; 1436 constructor() { 1437 this.promise = new Promise((resolve, reject) => { 1438 this.resolve = data => { 1439 this.#settled = true; 1440 resolve(data); 1441 }; 1442 this.reject = reason => { 1443 this.#settled = true; 1444 reject(reason); 1445 }; 1446 }); 1447 } 1448 get settled() { 1449 return this.#settled; 1450 } 1451} 1452exports.PromiseCapability = PromiseCapability; 1453let NormalizeRegex = null; 1454let NormalizationMap = null; 1455function normalizeUnicode(str) { 1456 if (!NormalizeRegex) { 1457 NormalizeRegex = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu; 1458 NormalizationMap = new Map([["ſt", "ſt"]]); 1459 } 1460 return str.replaceAll(NormalizeRegex, (_, p1, p2) => { 1461 return p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2); 1462 }); 1463} 1464function getUuid() { 1465 if (typeof crypto !== "undefined" && typeof crypto?.randomUUID === "function") { 1466 return crypto.randomUUID(); 1467 } 1468 const buf = new Uint8Array(32); 1469 if (typeof crypto !== "undefined" && typeof crypto?.getRandomValues === "function") { 1470 crypto.getRandomValues(buf); 1471 } else { 1472 for (let i = 0; i < 32; i++) { 1473 buf[i] = Math.floor(Math.random() * 255); 1474 } 1475 } 1476 return bytesToString(buf); 1477} 1478const AnnotationPrefix = "pdfjs_internal_id_"; 1479exports.AnnotationPrefix = AnnotationPrefix; 1480 1481/***/ }), 1482/* 3 */ 1483/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 1484 1485 1486 1487Object.defineProperty(exports, "__esModule", ({ 1488 value: true 1489})); 1490exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = void 0; 1491exports.arrayBuffersToBytes = arrayBuffersToBytes; 1492exports.collectActions = collectActions; 1493exports.encodeToXmlString = encodeToXmlString; 1494exports.escapePDFName = escapePDFName; 1495exports.escapeString = escapeString; 1496exports.getInheritableProperty = getInheritableProperty; 1497exports.getLookupTableFactory = getLookupTableFactory; 1498exports.getNewAnnotationsMap = getNewAnnotationsMap; 1499exports.getRotationMatrix = getRotationMatrix; 1500exports.isAscii = isAscii; 1501exports.isWhiteSpace = isWhiteSpace; 1502exports.log2 = log2; 1503exports.numberToString = numberToString; 1504exports.parseXFAPath = parseXFAPath; 1505exports.readInt8 = readInt8; 1506exports.readUint16 = readUint16; 1507exports.readUint32 = readUint32; 1508exports.recoverJsURL = recoverJsURL; 1509exports.stringToUTF16HexString = stringToUTF16HexString; 1510exports.stringToUTF16String = stringToUTF16String; 1511exports.toRomanNumerals = toRomanNumerals; 1512exports.validateCSSFont = validateCSSFont; 1513exports.validateFontName = validateFontName; 1514var _util = __w_pdfjs_require__(2); 1515var _primitives = __w_pdfjs_require__(4); 1516var _base_stream = __w_pdfjs_require__(5); 1517const PDF_VERSION_REGEXP = /^[1-9]\.\d$/; 1518exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP; 1519function getLookupTableFactory(initializer) { 1520 let lookup; 1521 return function () { 1522 if (initializer) { 1523 lookup = Object.create(null); 1524 initializer(lookup); 1525 initializer = null; 1526 } 1527 return lookup; 1528 }; 1529} 1530class MissingDataException extends _util.BaseException { 1531 constructor(begin, end) { 1532 super(`Missing data [${begin}, ${end})`, "MissingDataException"); 1533 this.begin = begin; 1534 this.end = end; 1535 } 1536} 1537exports.MissingDataException = MissingDataException; 1538class ParserEOFException extends _util.BaseException { 1539 constructor(msg) { 1540 super(msg, "ParserEOFException"); 1541 } 1542} 1543exports.ParserEOFException = ParserEOFException; 1544class XRefEntryException extends _util.BaseException { 1545 constructor(msg) {
vendor: 11,651 bytes, lines 1546-1955
1546 super(msg, "XRefEntryException"); 1547 } 1548} 1549exports.XRefEntryException = XRefEntryException; 1550class XRefParseException extends _util.BaseException { 1551 constructor(msg) { 1552 super(msg, "XRefParseException"); 1553 } 1554} 1555exports.XRefParseException = XRefParseException; 1556function arrayBuffersToBytes(arr) { 1557 const length = arr.length; 1558 if (length === 0) { 1559 return new Uint8Array(0); 1560 } 1561 if (length === 1) { 1562 return new Uint8Array(arr[0]); 1563 } 1564 let dataLength = 0; 1565 for (let i = 0; i < length; i++) { 1566 dataLength += arr[i].byteLength; 1567 } 1568 const data = new Uint8Array(dataLength); 1569 let pos = 0; 1570 for (let i = 0; i < length; i++) { 1571 const item = new Uint8Array(arr[i]); 1572 data.set(item, pos); 1573 pos += item.byteLength; 1574 } 1575 return data; 1576} 1577function getInheritableProperty({ 1578 dict, 1579 key, 1580 getArray = false, 1581 stopWhenFound = true 1582}) { 1583 let values; 1584 const visited = new _primitives.RefSet(); 1585 while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) { 1586 if (dict.objId) { 1587 visited.put(dict.objId); 1588 } 1589 const value = getArray ? dict.getArray(key) : dict.get(key); 1590 if (value !== undefined) { 1591 if (stopWhenFound) { 1592 return value; 1593 } 1594 (values ||= []).push(value); 1595 } 1596 dict = dict.get("Parent"); 1597 } 1598 return values; 1599} 1600const 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"]; 1601function toRomanNumerals(number, lowerCase = false) { 1602 (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer."); 1603 const romanBuf = []; 1604 let pos; 1605 while (number >= 1000) { 1606 number -= 1000; 1607 romanBuf.push("M"); 1608 } 1609 pos = number / 100 | 0; 1610 number %= 100; 1611 romanBuf.push(ROMAN_NUMBER_MAP[pos]); 1612 pos = number / 10 | 0; 1613 number %= 10; 1614 romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); 1615 romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); 1616 const romanStr = romanBuf.join(""); 1617 return lowerCase ? romanStr.toLowerCase() : romanStr; 1618} 1619function log2(x) { 1620 if (x <= 0) { 1621 return 0; 1622 } 1623 return Math.ceil(Math.log2(x)); 1624} 1625function readInt8(data, offset) { 1626 return data[offset] << 24 >> 24; 1627} 1628function readUint16(data, offset) { 1629 return data[offset] << 8 | data[offset + 1]; 1630} 1631function readUint32(data, offset) { 1632 return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; 1633} 1634function isWhiteSpace(ch) { 1635 return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a; 1636} 1637function parseXFAPath(path) { 1638 const positionPattern = /(.+)\[(\d+)\]$/; 1639 return path.split(".").map(component => { 1640 const m = component.match(positionPattern); 1641 if (m) { 1642 return { 1643 name: m[1], 1644 pos: parseInt(m[2], 10) 1645 }; 1646 } 1647 return { 1648 name: component, 1649 pos: 0 1650 }; 1651 }); 1652} 1653function escapePDFName(str) { 1654 const buffer = []; 1655 let start = 0; 1656 for (let i = 0, ii = str.length; i < ii; i++) { 1657 const char = str.charCodeAt(i); 1658 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) { 1659 if (start < i) { 1660 buffer.push(str.substring(start, i)); 1661 } 1662 buffer.push(`#${char.toString(16)}`); 1663 start = i + 1; 1664 } 1665 } 1666 if (buffer.length === 0) { 1667 return str; 1668 } 1669 if (start < str.length) { 1670 buffer.push(str.substring(start, str.length)); 1671 } 1672 return buffer.join(""); 1673} 1674function escapeString(str) { 1675 return str.replaceAll(/([()\\\n\r])/g, match => { 1676 if (match === "\n") { 1677 return "\\n"; 1678 } else if (match === "\r") { 1679 return "\\r"; 1680 } 1681 return `\\${match}`; 1682 }); 1683} 1684function _collectJS(entry, xref, list, parents) { 1685 if (!entry) { 1686 return; 1687 } 1688 let parent = null; 1689 if (entry instanceof _primitives.Ref) { 1690 if (parents.has(entry)) { 1691 return; 1692 } 1693 parent = entry; 1694 parents.put(parent); 1695 entry = xref.fetch(entry); 1696 } 1697 if (Array.isArray(entry)) { 1698 for (const element of entry) { 1699 _collectJS(element, xref, list, parents); 1700 } 1701 } else if (entry instanceof _primitives.Dict) { 1702 if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) { 1703 const js = entry.get("JS"); 1704 let code; 1705 if (js instanceof _base_stream.BaseStream) { 1706 code = js.getString(); 1707 } else if (typeof js === "string") { 1708 code = js; 1709 } 1710 code &&= (0, _util.stringToPDFString)(code).replaceAll("\x00", ""); 1711 if (code) { 1712 list.push(code); 1713 } 1714 } 1715 _collectJS(entry.getRaw("Next"), xref, list, parents); 1716 } 1717 if (parent) { 1718 parents.remove(parent); 1719 } 1720} 1721function collectActions(xref, dict, eventType) { 1722 const actions = Object.create(null); 1723 const additionalActionsDicts = getInheritableProperty({ 1724 dict, 1725 key: "AA", 1726 stopWhenFound: false 1727 }); 1728 if (additionalActionsDicts) { 1729 for (let i = additionalActionsDicts.length - 1; i >= 0; i--) { 1730 const additionalActions = additionalActionsDicts[i]; 1731 if (!(additionalActions instanceof _primitives.Dict)) { 1732 continue; 1733 } 1734 for (const key of additionalActions.getKeys()) { 1735 const action = eventType[key]; 1736 if (!action) { 1737 continue; 1738 } 1739 const actionDict = additionalActions.getRaw(key); 1740 const parents = new _primitives.RefSet(); 1741 const list = []; 1742 _collectJS(actionDict, xref, list, parents); 1743 if (list.length > 0) { 1744 actions[action] = list; 1745 } 1746 } 1747 } 1748 } 1749 if (dict.has("A")) { 1750 const actionDict = dict.get("A"); 1751 const parents = new _primitives.RefSet(); 1752 const list = []; 1753 _collectJS(actionDict, xref, list, parents); 1754 if (list.length > 0) { 1755 actions.Action = list; 1756 } 1757 } 1758 return (0, _util.objectSize)(actions) > 0 ? actions : null; 1759} 1760const XMLEntities = { 1761 0x3c: "<", 1762 0x3e: ">", 1763 0x26: "&", 1764 0x22: """, 1765 0x27: "'" 1766}; 1767function encodeToXmlString(str) { 1768 const buffer = []; 1769 let start = 0; 1770 for (let i = 0, ii = str.length; i < ii; i++) { 1771 const char = str.codePointAt(i); 1772 if (0x20 <= char && char <= 0x7e) { 1773 const entity = XMLEntities[char]; 1774 if (entity) { 1775 if (start < i) { 1776 buffer.push(str.substring(start, i)); 1777 } 1778 buffer.push(entity); 1779 start = i + 1; 1780 } 1781 } else { 1782 if (start < i) { 1783 buffer.push(str.substring(start, i)); 1784 } 1785 buffer.push(`&#x${char.toString(16).toUpperCase()};`); 1786 if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) { 1787 i++; 1788 } 1789 start = i + 1; 1790 } 1791 } 1792 if (buffer.length === 0) { 1793 return str; 1794 } 1795 if (start < str.length) { 1796 buffer.push(str.substring(start, str.length)); 1797 } 1798 return buffer.join(""); 1799} 1800function validateFontName(fontFamily, mustWarn = false) { 1801 const m = /^("|').*("|')$/.exec(fontFamily); 1802 if (m && m[1] === m[2]) { 1803 const re = new RegExp(`[^\\\\]${m[1]}`); 1804 if (re.test(fontFamily.slice(1, -1))) { 1805 if (mustWarn) { 1806 (0, _util.warn)(`FontFamily contains unescaped ${m[1]}: ${fontFamily}.`); 1807 } 1808 return false; 1809 } 1810 } else { 1811 for (const ident of fontFamily.split(/[ \t]+/)) { 1812 if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) { 1813 if (mustWarn) { 1814 (0, _util.warn)(`FontFamily contains invalid <custom-ident>: ${fontFamily}.`); 1815 } 1816 return false; 1817 } 1818 } 1819 } 1820 return true; 1821} 1822function validateCSSFont(cssFontInfo) { 1823 const DEFAULT_CSS_FONT_OBLIQUE = "14"; 1824 const DEFAULT_CSS_FONT_WEIGHT = "400"; 1825 const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]); 1826 const { 1827 fontFamily, 1828 fontWeight, 1829 italicAngle 1830 } = cssFontInfo; 1831 if (!validateFontName(fontFamily, true)) { 1832 return false; 1833 } 1834 const weight = fontWeight ? fontWeight.toString() : ""; 1835 cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT; 1836 const angle = parseFloat(italicAngle); 1837 cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString(); 1838 return true; 1839} 1840function recoverJsURL(str) { 1841 const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"]; 1842 const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").replaceAll(".", "\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i"); 1843 const jsUrl = regex.exec(str); 1844 if (jsUrl?.[2]) { 1845 const url = jsUrl[2]; 1846 let newWindow = false; 1847 if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") { 1848 newWindow = true; 1849 } 1850 return { 1851 url, 1852 newWindow 1853 }; 1854 } 1855 return null; 1856} 1857function numberToString(value) { 1858 if (Number.isInteger(value)) { 1859 return value.toString(); 1860 } 1861 const roundedValue = Math.round(value * 100); 1862 if (roundedValue % 100 === 0) { 1863 return (roundedValue / 100).toString(); 1864 } 1865 if (roundedValue % 10 === 0) { 1866 return value.toFixed(1); 1867 } 1868 return value.toFixed(2); 1869} 1870function getNewAnnotationsMap(annotationStorage) { 1871 if (!annotationStorage) { 1872 return null; 1873 } 1874 const newAnnotationsByPage = new Map(); 1875 for (const [key, value] of annotationStorage) { 1876 if (!key.startsWith(_util.AnnotationEditorPrefix)) { 1877 continue; 1878 } 1879 let annotations = newAnnotationsByPage.get(value.pageIndex); 1880 if (!annotations) { 1881 annotations = []; 1882 newAnnotationsByPage.set(value.pageIndex, annotations); 1883 } 1884 annotations.push(value); 1885 } 1886 return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null; 1887} 1888function isAscii(str) { 1889 return /^[\x00-\x7F]*$/.test(str); 1890} 1891function stringToUTF16HexString(str) { 1892 const buf = []; 1893 for (let i = 0, ii = str.length; i < ii; i++) { 1894 const char = str.charCodeAt(i); 1895 buf.push((char >> 8 & 0xff).toString(16).padStart(2, "0"), (char & 0xff).toString(16).padStart(2, "0")); 1896 } 1897 return buf.join(""); 1898} 1899function stringToUTF16String(str, bigEndian = false) { 1900 const buf = []; 1901 if (bigEndian) { 1902 buf.push("\xFE\xFF"); 1903 } 1904 for (let i = 0, ii = str.length; i < ii; i++) { 1905 const char = str.charCodeAt(i); 1906 buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff)); 1907 } 1908 return buf.join(""); 1909} 1910function getRotationMatrix(rotation, width, height) { 1911 switch (rotation) { 1912 case 90: 1913 return [0, 1, -1, 0, width, 0]; 1914 case 180: 1915 return [-1, 0, 0, -1, width, height]; 1916 case 270: 1917 return [0, -1, 1, 0, 0, height]; 1918 default: 1919 throw new Error("Invalid rotation"); 1920 } 1921} 1922 1923/***/ }), 1924/* 4 */ 1925/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 1926 1927 1928 1929Object.defineProperty(exports, "__esModule", ({ 1930 value: true 1931})); 1932exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0; 1933exports.clearPrimitiveCaches = clearPrimitiveCaches; 1934exports.isCmd = isCmd; 1935exports.isDict = isDict; 1936exports.isName = isName; 1937exports.isRefsEqual = isRefsEqual; 1938var _util = __w_pdfjs_require__(2); 1939const CIRCULAR_REF = Symbol("CIRCULAR_REF"); 1940exports.CIRCULAR_REF = CIRCULAR_REF; 1941const EOF = Symbol("EOF"); 1942exports.EOF = EOF; 1943let CmdCache = Object.create(null); 1944let NameCache = Object.create(null); 1945let RefCache = Object.create(null); 1946function clearPrimitiveCaches() { 1947 CmdCache = Object.create(null); 1948 NameCache = Object.create(null); 1949 RefCache = Object.create(null); 1950} 1951class Name { 1952 constructor(name) { 1953 this.name = name; 1954 } 1955 static get(name) {
1956 return NameCache[name] ||= new Name(name); 1957 } 1958} 1959exports.Name = Name; 1960class Cmd { 1961 constructor(cmd) { 1962 this.cmd = cmd; 1963 } 1964 static get(cmd) { 1965 return CmdCache[cmd] ||= new Cmd(cmd); 1966 } 1967} 1968exports.Cmd = Cmd; 1969const nonSerializable = function nonSerializableClosure() { 1970 return nonSerializable; 1971}; 1972class Dict { 1973 constructor(xref = null) { 1974 this._map = Object.create(null); 1975 this.xref = xref; 1976 this.objId = null; 1977 this.suppressEncryption = false; 1978 this.__nonSerializable__ = nonSerializable; 1979 } 1980 assignXref(newXref) { 1981 this.xref = newXref; 1982 } 1983 get size() { 1984 return Object.keys(this._map).length; 1985 } 1986 get(key1, key2, key3) { 1987 let value = this._map[key1]; 1988 if (value === undefined && key2 !== undefined) { 1989 value = this._map[key2]; 1990 if (value === undefined && key3 !== undefined) { 1991 value = this._map[key3]; 1992 } 1993 } 1994 if (value instanceof Ref && this.xref) { 1995 return this.xref.fetch(value, this.suppressEncryption); 1996 } 1997 return value; 1998 } 1999 async getAsync(key1, key2, key3) { 2000 let value = this._map[key1]; 2001 if (value === undefined && key2 !== undefined) { 2002 value = this._map[key2]; 2003 if (value === undefined && key3 !== undefined) { 2004 value = this._map[key3]; 2005 } 2006 } 2007 if (value instanceof Ref && this.xref) { 2008 return this.xref.fetchAsync(value, this.suppressEncryption); 2009 } 2010 return value; 2011 } 2012 getArray(key1, key2, key3) { 2013 let value = this._map[key1]; 2014 if (value === undefined && key2 !== undefined) { 2015 value = this._map[key2]; 2016 if (value === undefined && key3 !== undefined) { 2017 value = this._map[key3]; 2018 } 2019 } 2020 if (value instanceof Ref && this.xref) { 2021 value = this.xref.fetch(value, this.suppressEncryption); 2022 } 2023 if (Array.isArray(value)) { 2024 value = value.slice(); 2025 for (let i = 0, ii = value.length; i < ii; i++) { 2026 if (value[i] instanceof Ref && this.xref) { 2027 value[i] = this.xref.fetch(value[i], this.suppressEncryption); 2028 } 2029 } 2030 } 2031 return value; 2032 } 2033 getRaw(key) { 2034 return this._map[key]; 2035 } 2036 getKeys() { 2037 return Object.keys(this._map); 2038 } 2039 getRawValues() { 2040 return Object.values(this._map); 2041 } 2042 set(key, value) { 2043 this._map[key] = value; 2044 } 2045 has(key) { 2046 return this._map[key] !== undefined; 2047 } 2048 forEach(callback) { 2049 for (const key in this._map) { 2050 callback(key, this.get(key)); 2051 } 2052 } 2053 static get empty() { 2054 const emptyDict = new Dict(null); 2055 emptyDict.set = (key, value) => { 2056 (0, _util.unreachable)("Should not call `set` on the empty dictionary."); 2057 }; 2058 return (0, _util.shadow)(this, "empty", emptyDict); 2059 } 2060 static merge({ 2061 xref, 2062 dictArray, 2063 mergeSubDicts = false 2064 }) { 2065 const mergedDict = new Dict(xref), 2066 properties = new Map(); 2067 for (const dict of dictArray) { 2068 if (!(dict instanceof Dict)) { 2069 continue; 2070 } 2071 for (const [key, value] of Object.entries(dict._map)) { 2072 let property = properties.get(key); 2073 if (property === undefined) { 2074 property = []; 2075 properties.set(key, property); 2076 } else if (!mergeSubDicts || !(value instanceof Dict)) { 2077 continue; 2078 } 2079 property.push(value); 2080 } 2081 } 2082 for (const [name, values] of properties) { 2083 if (values.length === 1 || !(values[0] instanceof Dict)) { 2084 mergedDict._map[name] = values[0]; 2085 continue; 2086 } 2087 const subDict = new Dict(xref); 2088 for (const dict of values) { 2089 for (const [key, value] of Object.entries(dict._map)) { 2090 if (subDict._map[key] === undefined) { 2091 subDict._map[key] = value; 2092 } 2093 } 2094 } 2095 if (subDict.size > 0) { 2096 mergedDict._map[name] = subDict; 2097 } 2098 } 2099 properties.clear(); 2100 return mergedDict.size > 0 ? mergedDict : Dict.empty; 2101 } 2102 clone() { 2103 const dict = new Dict(this.xref); 2104 for (const key of this.getKeys()) { 2105 dict.set(key, this.getRaw(key)); 2106 } 2107 return dict; 2108 } 2109} 2110exports.Dict = Dict; 2111class Ref { 2112 constructor(num, gen) { 2113 this.num = num; 2114 this.gen = gen; 2115 } 2116 toString() { 2117 if (this.gen === 0) { 2118 return `${this.num}R`; 2119 } 2120 return `${this.num}R${this.gen}`; 2121 } 2122 static fromString(str) { 2123 const ref = RefCache[str]; 2124 if (ref) { 2125 return ref; 2126 } 2127 const m = /^(\d+)R(\d*)$/.exec(str); 2128 if (!m || m[1] === "0") { 2129 return null; 2130 } 2131 return RefCache[str] = new Ref(parseInt(m[1]), !m[2] ? 0 : parseInt(m[2])); 2132 } 2133 static get(num, gen) {
2134 const key = gen === 0 ? `${num}R` : `${num}R${gen}`; 2135 return RefCache[key] ||= new Ref(num, gen); 2136 } 2137} 2138exports.Ref = Ref; 2139class RefSet { 2140 constructor(parent = null) { 2141 this._set = new Set(parent?._set); 2142 } 2143 has(ref) { 2144 return this._set.has(ref.toString()); 2145 } 2146 put(ref) { 2147 this._set.add(ref.toString()); 2148 } 2149 remove(ref) { 2150 this._set.delete(ref.toString()); 2151 } 2152 [Symbol.iterator]() { 2153 return this._set.values(); 2154 } 2155 clear() { 2156 this._set.clear(); 2157 } 2158} 2159exports.RefSet = RefSet; 2160class RefSetCache { 2161 constructor() { 2162 this._map = new Map(); 2163 } 2164 get size() { 2165 return this._map.size; 2166 } 2167 get(ref) { 2168 return this._map.get(ref.toString()); 2169 } 2170 has(ref) { 2171 return this._map.has(ref.toString()); 2172 } 2173 put(ref, obj) { 2174 this._map.set(ref.toString(), obj); 2175 } 2176 putAlias(ref, aliasRef) { 2177 this._map.set(ref.toString(), this.get(aliasRef)); 2178 } 2179 [Symbol.iterator]() { 2180 return this._map.values(); 2181 } 2182 clear() { 2183 this._map.clear(); 2184 } 2185} 2186exports.RefSetCache = RefSetCache; 2187function isName(v, name) { 2188 return v instanceof Name && (name === undefined || v.name === name); 2189} 2190function isCmd(v, cmd) { 2191 return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); 2192} 2193function isDict(v, type) { 2194 return v instanceof Dict && (type === undefined || isName(v.get("Type"), type)); 2195} 2196function isRefsEqual(v1, v2) { 2197 return v1.num === v2.num && v1.gen === v2.gen; 2198} 2199 2200/***/ }), 2201/* 5 */ 2202/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2203 2204 2205 2206Object.defineProperty(exports, "__esModule", ({ 2207 value: true 2208})); 2209exports.BaseStream = void 0; 2210var _util = __w_pdfjs_require__(2); 2211class BaseStream { 2212 constructor() { 2213 if (this.constructor === BaseStream) { 2214 (0, _util.unreachable)("Cannot initialize BaseStream."); 2215 } 2216 } 2217 get length() { 2218 (0, _util.unreachable)("Abstract getter `length` accessed"); 2219 } 2220 get isEmpty() { 2221 (0, _util.unreachable)("Abstract getter `isEmpty` accessed"); 2222 } 2223 get isDataLoaded() { 2224 return (0, _util.shadow)(this, "isDataLoaded", true); 2225 } 2226 getByte() { 2227 (0, _util.unreachable)("Abstract method `getByte` called"); 2228 } 2229 getBytes(length) { 2230 (0, _util.unreachable)("Abstract method `getBytes` called"); 2231 } 2232 peekByte() { 2233 const peekedByte = this.getByte(); 2234 if (peekedByte !== -1) { 2235 this.pos--; 2236 } 2237 return peekedByte; 2238 } 2239 peekBytes(length) { 2240 const bytes = this.getBytes(length); 2241 this.pos -= bytes.length; 2242 return bytes; 2243 } 2244 getUint16() { 2245 const b0 = this.getByte(); 2246 const b1 = this.getByte(); 2247 if (b0 === -1 || b1 === -1) { 2248 return -1; 2249 } 2250 return (b0 << 8) + b1; 2251 } 2252 getInt32() { 2253 const b0 = this.getByte(); 2254 const b1 = this.getByte(); 2255 const b2 = this.getByte(); 2256 const b3 = this.getByte(); 2257 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 2258 } 2259 getByteRange(begin, end) { 2260 (0, _util.unreachable)("Abstract method `getByteRange` called"); 2261 } 2262 getString(length) { 2263 return (0, _util.bytesToString)(this.getBytes(length)); 2264 } 2265 skip(n) { 2266 this.pos += n || 1; 2267 } 2268 reset() { 2269 (0, _util.unreachable)("Abstract method `reset` called"); 2270 } 2271 moveStart() { 2272 (0, _util.unreachable)("Abstract method `moveStart` called"); 2273 } 2274 makeSubStream(start, length, dict = null) { 2275 (0, _util.unreachable)("Abstract method `makeSubStream` called"); 2276 } 2277 getBaseStreams() { 2278 return null; 2279 } 2280} 2281exports.BaseStream = BaseStream; 2282 2283/***/ }), 2284/* 6 */ 2285/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2286 2287 2288 2289Object.defineProperty(exports, "__esModule", ({ 2290 value: true 2291})); 2292exports.NetworkPdfManager = exports.LocalPdfManager = void 0; 2293var _util = __w_pdfjs_require__(2); 2294var _chunked_stream = __w_pdfjs_require__(7); 2295var _core_utils = __w_pdfjs_require__(3); 2296var _document = __w_pdfjs_require__(9); 2297var _stream = __w_pdfjs_require__(8); 2298function parseDocBaseUrl(url) { 2299 if (url) { 2300 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url); 2301 if (absoluteUrl) { 2302 return absoluteUrl.href; 2303 } 2304 (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`); 2305 } 2306 return null; 2307} 2308class BasePdfManager { 2309 constructor(args) { 2310 if (this.constructor === BasePdfManager) { 2311 (0, _util.unreachable)("Cannot initialize BasePdfManager."); 2312 } 2313 this._docBaseUrl = parseDocBaseUrl(args.docBaseUrl); 2314 this._docId = args.docId; 2315 this._password = args.password; 2316 this.enableXfa = args.enableXfa; 2317 args.evaluatorOptions.isOffscreenCanvasSupported &&= _util.FeatureTest.isOffscreenCanvasSupported; 2318 this.evaluatorOptions = args.evaluatorOptions; 2319 } 2320 get docId() { 2321 return this._docId; 2322 } 2323 get password() { 2324 return this._password; 2325 } 2326 get docBaseUrl() { 2327 return this._docBaseUrl; 2328 } 2329 get catalog() { 2330 return this.pdfDocument.catalog; 2331 } 2332 ensureDoc(prop, args) { 2333 return this.ensure(this.pdfDocument, prop, args); 2334 } 2335 ensureXRef(prop, args) { 2336 return this.ensure(this.pdfDocument.xref, prop, args); 2337 } 2338 ensureCatalog(prop, args) { 2339 return this.ensure(this.pdfDocument.catalog, prop, args); 2340 } 2341 getPage(pageIndex) { 2342 return this.pdfDocument.getPage(pageIndex); 2343 } 2344 fontFallback(id, handler) { 2345 return this.pdfDocument.fontFallback(id, handler); 2346 } 2347 loadXfaFonts(handler, task) { 2348 return this.pdfDocument.loadXfaFonts(handler, task); 2349 } 2350 loadXfaImages() { 2351 return this.pdfDocument.loadXfaImages(); 2352 } 2353 serializeXfaData(annotationStorage) { 2354 return this.pdfDocument.serializeXfaData(annotationStorage); 2355 } 2356 cleanup(manuallyTriggered = false) { 2357 return this.pdfDocument.cleanup(manuallyTriggered); 2358 } 2359 async ensure(obj, prop, args) { 2360 (0, _util.unreachable)("Abstract method `ensure` called"); 2361 } 2362 requestRange(begin, end) { 2363 (0, _util.unreachable)("Abstract method `requestRange` called"); 2364 } 2365 requestLoadedStream(noFetch = false) { 2366 (0, _util.unreachable)("Abstract method `requestLoadedStream` called"); 2367 } 2368 sendProgressiveData(chunk) { 2369 (0, _util.unreachable)("Abstract method `sendProgressiveData` called"); 2370 } 2371 updatePassword(password) { 2372 this._password = password; 2373 } 2374 terminate(reason) { 2375 (0, _util.unreachable)("Abstract method `terminate` called"); 2376 } 2377} 2378class LocalPdfManager extends BasePdfManager { 2379 constructor(args) { 2380 super(args); 2381 const stream = new _stream.Stream(args.source); 2382 this.pdfDocument = new _document.PDFDocument(this, stream); 2383 this._loadedStreamPromise = Promise.resolve(stream); 2384 } 2385 async ensure(obj, prop, args) { 2386 const value = obj[prop]; 2387 if (typeof value === "function") {
vendor: 15,485 bytes, lines 2388-2903
2388 return value.apply(obj, args); 2389 } 2390 return value; 2391 } 2392 requestRange(begin, end) { 2393 return Promise.resolve(); 2394 } 2395 requestLoadedStream(noFetch = false) { 2396 return this._loadedStreamPromise; 2397 } 2398 terminate(reason) {} 2399} 2400exports.LocalPdfManager = LocalPdfManager; 2401class NetworkPdfManager extends BasePdfManager { 2402 constructor(args) { 2403 super(args); 2404 this.streamManager = new _chunked_stream.ChunkedStreamManager(args.source, { 2405 msgHandler: args.handler, 2406 length: args.length, 2407 disableAutoFetch: args.disableAutoFetch, 2408 rangeChunkSize: args.rangeChunkSize 2409 }); 2410 this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream()); 2411 } 2412 async ensure(obj, prop, args) { 2413 try { 2414 const value = obj[prop]; 2415 if (typeof value === "function") { 2416 return value.apply(obj, args); 2417 } 2418 return value; 2419 } catch (ex) { 2420 if (!(ex instanceof _core_utils.MissingDataException)) { 2421 throw ex; 2422 } 2423 await this.requestRange(ex.begin, ex.end); 2424 return this.ensure(obj, prop, args); 2425 } 2426 } 2427 requestRange(begin, end) { 2428 return this.streamManager.requestRange(begin, end); 2429 } 2430 requestLoadedStream(noFetch = false) { 2431 return this.streamManager.requestAllChunks(noFetch); 2432 } 2433 sendProgressiveData(chunk) { 2434 this.streamManager.onReceiveData({ 2435 chunk 2436 }); 2437 } 2438 terminate(reason) { 2439 this.streamManager.abort(reason); 2440 } 2441} 2442exports.NetworkPdfManager = NetworkPdfManager; 2443 2444/***/ }), 2445/* 7 */ 2446/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2447 2448 2449 2450Object.defineProperty(exports, "__esModule", ({ 2451 value: true 2452})); 2453exports.ChunkedStreamManager = exports.ChunkedStream = void 0; 2454var _core_utils = __w_pdfjs_require__(3); 2455var _util = __w_pdfjs_require__(2); 2456var _stream = __w_pdfjs_require__(8); 2457class ChunkedStream extends _stream.Stream { 2458 constructor(length, chunkSize, manager) { 2459 super(new Uint8Array(length), 0, length, null); 2460 this.chunkSize = chunkSize; 2461 this._loadedChunks = new Set(); 2462 this.numChunks = Math.ceil(length / chunkSize); 2463 this.manager = manager; 2464 this.progressiveDataLength = 0; 2465 this.lastSuccessfulEnsureByteChunk = -1; 2466 } 2467 getMissingChunks() { 2468 const chunks = []; 2469 for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) { 2470 if (!this._loadedChunks.has(chunk)) { 2471 chunks.push(chunk); 2472 } 2473 } 2474 return chunks; 2475 } 2476 get numChunksLoaded() { 2477 return this._loadedChunks.size; 2478 } 2479 get isDataLoaded() { 2480 return this.numChunksLoaded === this.numChunks; 2481 } 2482 onReceiveData(begin, chunk) { 2483 const chunkSize = this.chunkSize; 2484 if (begin % chunkSize !== 0) { 2485 throw new Error(`Bad begin offset: ${begin}`); 2486 } 2487 const end = begin + chunk.byteLength; 2488 if (end % chunkSize !== 0 && end !== this.bytes.length) { 2489 throw new Error(`Bad end offset: ${end}`); 2490 } 2491 this.bytes.set(new Uint8Array(chunk), begin); 2492 const beginChunk = Math.floor(begin / chunkSize); 2493 const endChunk = Math.floor((end - 1) / chunkSize) + 1; 2494 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 2495 this._loadedChunks.add(curChunk); 2496 } 2497 } 2498 onReceiveProgressiveData(data) { 2499 let position = this.progressiveDataLength; 2500 const beginChunk = Math.floor(position / this.chunkSize); 2501 this.bytes.set(new Uint8Array(data), position); 2502 position += data.byteLength; 2503 this.progressiveDataLength = position; 2504 const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize); 2505 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 2506 this._loadedChunks.add(curChunk); 2507 } 2508 } 2509 ensureByte(pos) { 2510 if (pos < this.progressiveDataLength) { 2511 return; 2512 } 2513 const chunk = Math.floor(pos / this.chunkSize); 2514 if (chunk > this.numChunks) { 2515 return; 2516 } 2517 if (chunk === this.lastSuccessfulEnsureByteChunk) { 2518 return; 2519 } 2520 if (!this._loadedChunks.has(chunk)) { 2521 throw new _core_utils.MissingDataException(pos, pos + 1); 2522 } 2523 this.lastSuccessfulEnsureByteChunk = chunk; 2524 } 2525 ensureRange(begin, end) { 2526 if (begin >= end) { 2527 return; 2528 } 2529 if (end <= this.progressiveDataLength) { 2530 return; 2531 } 2532 const beginChunk = Math.floor(begin / this.chunkSize); 2533 if (beginChunk > this.numChunks) { 2534 return; 2535 } 2536 const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks); 2537 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 2538 if (!this._loadedChunks.has(chunk)) { 2539 throw new _core_utils.MissingDataException(begin, end); 2540 } 2541 } 2542 } 2543 nextEmptyChunk(beginChunk) { 2544 const numChunks = this.numChunks; 2545 for (let i = 0; i < numChunks; ++i) { 2546 const chunk = (beginChunk + i) % numChunks; 2547 if (!this._loadedChunks.has(chunk)) { 2548 return chunk; 2549 } 2550 } 2551 return null; 2552 } 2553 hasChunk(chunk) { 2554 return this._loadedChunks.has(chunk); 2555 } 2556 getByte() { 2557 const pos = this.pos; 2558 if (pos >= this.end) { 2559 return -1; 2560 } 2561 if (pos >= this.progressiveDataLength) { 2562 this.ensureByte(pos); 2563 } 2564 return this.bytes[this.pos++]; 2565 } 2566 getBytes(length) { 2567 const bytes = this.bytes; 2568 const pos = this.pos; 2569 const strEnd = this.end; 2570 if (!length) { 2571 if (strEnd > this.progressiveDataLength) { 2572 this.ensureRange(pos, strEnd); 2573 } 2574 return bytes.subarray(pos, strEnd); 2575 } 2576 let end = pos + length; 2577 if (end > strEnd) { 2578 end = strEnd; 2579 } 2580 if (end > this.progressiveDataLength) { 2581 this.ensureRange(pos, end); 2582 } 2583 this.pos = end; 2584 return bytes.subarray(pos, end); 2585 } 2586 getByteRange(begin, end) { 2587 if (begin < 0) { 2588 begin = 0; 2589 } 2590 if (end > this.end) { 2591 end = this.end; 2592 } 2593 if (end > this.progressiveDataLength) { 2594 this.ensureRange(begin, end); 2595 } 2596 return this.bytes.subarray(begin, end); 2597 } 2598 makeSubStream(start, length, dict = null) { 2599 if (length) { 2600 if (start + length > this.progressiveDataLength) { 2601 this.ensureRange(start, start + length); 2602 } 2603 } else if (start >= this.progressiveDataLength) { 2604 this.ensureByte(start); 2605 } 2606 function ChunkedStreamSubstream() {} 2607 ChunkedStreamSubstream.prototype = Object.create(this); 2608 ChunkedStreamSubstream.prototype.getMissingChunks = function () { 2609 const chunkSize = this.chunkSize; 2610 const beginChunk = Math.floor(this.start / chunkSize); 2611 const endChunk = Math.floor((this.end - 1) / chunkSize) + 1; 2612 const missingChunks = []; 2613 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 2614 if (!this._loadedChunks.has(chunk)) { 2615 missingChunks.push(chunk); 2616 } 2617 } 2618 return missingChunks; 2619 }; 2620 Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", { 2621 get() { 2622 if (this.numChunksLoaded === this.numChunks) { 2623 return true; 2624 } 2625 return this.getMissingChunks().length === 0; 2626 }, 2627 configurable: true 2628 }); 2629 const subStream = new ChunkedStreamSubstream(); 2630 subStream.pos = subStream.start = start; 2631 subStream.end = start + length || this.end; 2632 subStream.dict = dict; 2633 return subStream; 2634 } 2635 getBaseStreams() { 2636 return [this]; 2637 } 2638} 2639exports.ChunkedStream = ChunkedStream; 2640class ChunkedStreamManager { 2641 constructor(pdfNetworkStream, args) { 2642 this.length = args.length; 2643 this.chunkSize = args.rangeChunkSize; 2644 this.stream = new ChunkedStream(this.length, this.chunkSize, this); 2645 this.pdfNetworkStream = pdfNetworkStream; 2646 this.disableAutoFetch = args.disableAutoFetch; 2647 this.msgHandler = args.msgHandler; 2648 this.currRequestId = 0; 2649 this._chunksNeededByRequest = new Map(); 2650 this._requestsByChunk = new Map(); 2651 this._promisesByRequest = new Map(); 2652 this.progressiveDataLength = 0; 2653 this.aborted = false; 2654 this._loadedStreamCapability = new _util.PromiseCapability(); 2655 } 2656 sendRequest(begin, end) { 2657 const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end); 2658 if (!rangeReader.isStreamingSupported) { 2659 rangeReader.onProgress = this.onProgress.bind(this); 2660 } 2661 let chunks = [], 2662 loaded = 0; 2663 return new Promise((resolve, reject) => { 2664 const readChunk = ({ 2665 value, 2666 done 2667 }) => { 2668 try { 2669 if (done) { 2670 const chunkData = (0, _core_utils.arrayBuffersToBytes)(chunks); 2671 chunks = null; 2672 resolve(chunkData); 2673 return; 2674 } 2675 loaded += value.byteLength; 2676 if (rangeReader.isStreamingSupported) { 2677 this.onProgress({ 2678 loaded 2679 }); 2680 } 2681 chunks.push(value); 2682 rangeReader.read().then(readChunk, reject); 2683 } catch (e) { 2684 reject(e); 2685 } 2686 }; 2687 rangeReader.read().then(readChunk, reject); 2688 }).then(data => { 2689 if (this.aborted) { 2690 return; 2691 } 2692 this.onReceiveData({ 2693 chunk: data, 2694 begin 2695 }); 2696 }); 2697 } 2698 requestAllChunks(noFetch = false) { 2699 if (!noFetch) { 2700 const missingChunks = this.stream.getMissingChunks(); 2701 this._requestChunks(missingChunks); 2702 } 2703 return this._loadedStreamCapability.promise; 2704 } 2705 _requestChunks(chunks) { 2706 const requestId = this.currRequestId++; 2707 const chunksNeeded = new Set(); 2708 this._chunksNeededByRequest.set(requestId, chunksNeeded); 2709 for (const chunk of chunks) { 2710 if (!this.stream.hasChunk(chunk)) { 2711 chunksNeeded.add(chunk); 2712 } 2713 } 2714 if (chunksNeeded.size === 0) { 2715 return Promise.resolve(); 2716 } 2717 const capability = new _util.PromiseCapability(); 2718 this._promisesByRequest.set(requestId, capability); 2719 const chunksToRequest = []; 2720 for (const chunk of chunksNeeded) { 2721 let requestIds = this._requestsByChunk.get(chunk); 2722 if (!requestIds) { 2723 requestIds = []; 2724 this._requestsByChunk.set(chunk, requestIds); 2725 chunksToRequest.push(chunk); 2726 } 2727 requestIds.push(requestId); 2728 } 2729 if (chunksToRequest.length > 0) { 2730 const groupedChunksToRequest = this.groupChunks(chunksToRequest); 2731 for (const groupedChunk of groupedChunksToRequest) { 2732 const begin = groupedChunk.beginChunk * this.chunkSize; 2733 const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length); 2734 this.sendRequest(begin, end).catch(capability.reject); 2735 } 2736 } 2737 return capability.promise.catch(reason => { 2738 if (this.aborted) { 2739 return; 2740 } 2741 throw reason; 2742 }); 2743 } 2744 getStream() { 2745 return this.stream; 2746 } 2747 requestRange(begin, end) { 2748 end = Math.min(end, this.length); 2749 const beginChunk = this.getBeginChunk(begin); 2750 const endChunk = this.getEndChunk(end); 2751 const chunks = []; 2752 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 2753 chunks.push(chunk); 2754 } 2755 return this._requestChunks(chunks); 2756 } 2757 requestRanges(ranges = []) { 2758 const chunksToRequest = []; 2759 for (const range of ranges) { 2760 const beginChunk = this.getBeginChunk(range.begin); 2761 const endChunk = this.getEndChunk(range.end); 2762 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 2763 if (!chunksToRequest.includes(chunk)) { 2764 chunksToRequest.push(chunk); 2765 } 2766 } 2767 } 2768 chunksToRequest.sort(function (a, b) { 2769 return a - b; 2770 }); 2771 return this._requestChunks(chunksToRequest); 2772 } 2773 groupChunks(chunks) { 2774 const groupedChunks = []; 2775 let beginChunk = -1; 2776 let prevChunk = -1; 2777 for (let i = 0, ii = chunks.length; i < ii; ++i) { 2778 const chunk = chunks[i]; 2779 if (beginChunk < 0) { 2780 beginChunk = chunk; 2781 } 2782 if (prevChunk >= 0 && prevChunk + 1 !== chunk) { 2783 groupedChunks.push({ 2784 beginChunk, 2785 endChunk: prevChunk + 1 2786 }); 2787 beginChunk = chunk; 2788 } 2789 if (i + 1 === chunks.length) { 2790 groupedChunks.push({ 2791 beginChunk, 2792 endChunk: chunk + 1 2793 }); 2794 } 2795 prevChunk = chunk; 2796 } 2797 return groupedChunks; 2798 } 2799 onProgress(args) { 2800 this.msgHandler.send("DocProgress", { 2801 loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded, 2802 total: this.length 2803 }); 2804 } 2805 onReceiveData(args) { 2806 const chunk = args.chunk; 2807 const isProgressive = args.begin === undefined; 2808 const begin = isProgressive ? this.progressiveDataLength : args.begin; 2809 const end = begin + chunk.byteLength; 2810 const beginChunk = Math.floor(begin / this.chunkSize); 2811 const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize); 2812 if (isProgressive) { 2813 this.stream.onReceiveProgressiveData(chunk); 2814 this.progressiveDataLength = end; 2815 } else { 2816 this.stream.onReceiveData(begin, chunk); 2817 } 2818 if (this.stream.isDataLoaded) { 2819 this._loadedStreamCapability.resolve(this.stream); 2820 } 2821 const loadedRequests = []; 2822 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 2823 const requestIds = this._requestsByChunk.get(curChunk); 2824 if (!requestIds) { 2825 continue; 2826 } 2827 this._requestsByChunk.delete(curChunk); 2828 for (const requestId of requestIds) { 2829 const chunksNeeded = this._chunksNeededByRequest.get(requestId); 2830 if (chunksNeeded.has(curChunk)) { 2831 chunksNeeded.delete(curChunk); 2832 } 2833 if (chunksNeeded.size > 0) { 2834 continue; 2835 } 2836 loadedRequests.push(requestId); 2837 } 2838 } 2839 if (!this.disableAutoFetch && this._requestsByChunk.size === 0) { 2840 let nextEmptyChunk; 2841 if (this.stream.numChunksLoaded === 1) { 2842 const lastChunk = this.stream.numChunks - 1; 2843 if (!this.stream.hasChunk(lastChunk)) { 2844 nextEmptyChunk = lastChunk; 2845 } 2846 } else { 2847 nextEmptyChunk = this.stream.nextEmptyChunk(endChunk); 2848 } 2849 if (Number.isInteger(nextEmptyChunk)) { 2850 this._requestChunks([nextEmptyChunk]); 2851 } 2852 } 2853 for (const requestId of loadedRequests) { 2854 const capability = this._promisesByRequest.get(requestId); 2855 this._promisesByRequest.delete(requestId); 2856 capability.resolve(); 2857 } 2858 this.msgHandler.send("DocProgress", { 2859 loaded: this.stream.numChunksLoaded * this.chunkSize, 2860 total: this.length 2861 }); 2862 } 2863 onError(err) { 2864 this._loadedStreamCapability.reject(err); 2865 } 2866 getBeginChunk(begin) { 2867 return Math.floor(begin / this.chunkSize); 2868 } 2869 getEndChunk(end) { 2870 return Math.floor((end - 1) / this.chunkSize) + 1; 2871 } 2872 abort(reason) { 2873 this.aborted = true; 2874 this.pdfNetworkStream?.cancelAllRequests(reason); 2875 for (const capability of this._promisesByRequest.values()) { 2876 capability.reject(reason); 2877 } 2878 } 2879} 2880exports.ChunkedStreamManager = ChunkedStreamManager; 2881 2882/***/ }), 2883/* 8 */ 2884/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2885 2886 2887 2888Object.defineProperty(exports, "__esModule", ({ 2889 value: true 2890})); 2891exports.StringStream = exports.Stream = exports.NullStream = void 0; 2892var _base_stream = __w_pdfjs_require__(5); 2893var _util = __w_pdfjs_require__(2); 2894class Stream extends _base_stream.BaseStream { 2895 constructor(arrayBuffer, start, length, dict) { 2896 super(); 2897 this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer); 2898 this.start = start || 0; 2899 this.pos = this.start; 2900 this.end = start + length || this.bytes.length; 2901 this.dict = dict; 2902 } 2903 get length() {
2904 return this.end - this.start; 2905 } 2906 get isEmpty() { 2907 return this.length === 0; 2908 } 2909 getByte() { 2910 if (this.pos >= this.end) { 2911 return -1; 2912 } 2913 return this.bytes[this.pos++]; 2914 } 2915 getBytes(length) { 2916 const bytes = this.bytes; 2917 const pos = this.pos; 2918 const strEnd = this.end; 2919 if (!length) { 2920 return bytes.subarray(pos, strEnd); 2921 } 2922 let end = pos + length; 2923 if (end > strEnd) { 2924 end = strEnd; 2925 } 2926 this.pos = end; 2927 return bytes.subarray(pos, end); 2928 } 2929 getByteRange(begin, end) { 2930 if (begin < 0) { 2931 begin = 0; 2932 } 2933 if (end > this.end) { 2934 end = this.end; 2935 } 2936 return this.bytes.subarray(begin, end); 2937 } 2938 reset() { 2939 this.pos = this.start; 2940 } 2941 moveStart() { 2942 this.start = this.pos; 2943 } 2944 makeSubStream(start, length, dict = null) { 2945 return new Stream(this.bytes.buffer, start, length, dict); 2946 } 2947} 2948exports.Stream = Stream; 2949class StringStream extends Stream { 2950 constructor(str) { 2951 super((0, _util.stringToBytes)(str)); 2952 } 2953} 2954exports.StringStream = StringStream; 2955class NullStream extends Stream { 2956 constructor() { 2957 super(new Uint8Array(0)); 2958 } 2959} 2960exports.NullStream = NullStream; 2961 2962/***/ }), 2963/* 9 */ 2964/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 2965 2966 2967 2968Object.defineProperty(exports, "__esModule", ({ 2969 value: true 2970})); 2971exports.Page = exports.PDFDocument = void 0; 2972var _util = __w_pdfjs_require__(2); 2973var _annotation = __w_pdfjs_require__(10); 2974var _core_utils = __w_pdfjs_require__(3); 2975var _primitives = __w_pdfjs_require__(4); 2976var _xfa_fonts = __w_pdfjs_require__(51); 2977var _base_stream = __w_pdfjs_require__(5); 2978var _crypto = __w_pdfjs_require__(74); 2979var _catalog = __w_pdfjs_require__(66); 2980var _cleanup_helper = __w_pdfjs_require__(68); 2981var _dataset_reader = __w_pdfjs_require__(102); 2982var _parser = __w_pdfjs_require__(16); 2983var _stream = __w_pdfjs_require__(8); 2984var _object_loader = __w_pdfjs_require__(76); 2985var _operator_list = __w_pdfjs_require__(64); 2986var _evaluator = __w_pdfjs_require__(13); 2987var _decode_stream = __w_pdfjs_require__(18); 2988var _struct_tree = __w_pdfjs_require__(72); 2989var _writer = __w_pdfjs_require__(73); 2990var _factory = __w_pdfjs_require__(77); 2991var _xref = __w_pdfjs_require__(103); 2992const DEFAULT_USER_UNIT = 1.0; 2993const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792]; 2994class Page { 2995 constructor({ 2996 pdfManager, 2997 xref, 2998 pageIndex, 2999 pageDict, 3000 ref, 3001 globalIdFactory, 3002 fontCache, 3003 builtInCMapCache, 3004 standardFontDataCache, 3005 globalImageCache, 3006 systemFontCache, 3007 nonBlendModesSet, 3008 xfaFactory 3009 }) { 3010 this.pdfManager = pdfManager; 3011 this.pageIndex = pageIndex; 3012 this.pageDict = pageDict; 3013 this.xref = xref; 3014 this.ref = ref; 3015 this.fontCache = fontCache; 3016 this.builtInCMapCache = builtInCMapCache; 3017 this.standardFontDataCache = standardFontDataCache; 3018 this.globalImageCache = globalImageCache; 3019 this.systemFontCache = systemFontCache; 3020 this.nonBlendModesSet = nonBlendModesSet; 3021 this.evaluatorOptions = pdfManager.evaluatorOptions; 3022 this.resourcesPromise = null; 3023 this.xfaFactory = xfaFactory; 3024 const idCounters = { 3025 obj: 0 3026 }; 3027 this._localIdFactory = class extends globalIdFactory { 3028 static createObjId() { 3029 return `p${pageIndex}_${++idCounters.obj}`; 3030 } 3031 static getPageObjId() { 3032 return `p${ref.toString()}`; 3033 } 3034 }; 3035 } 3036 _getInheritableProperty(key, getArray = false) { 3037 const value = (0, _core_utils.getInheritableProperty)({ 3038 dict: this.pageDict, 3039 key, 3040 getArray, 3041 stopWhenFound: false 3042 }); 3043 if (!Array.isArray(value)) { 3044 return value; 3045 } 3046 if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) { 3047 return value[0]; 3048 } 3049 return _primitives.Dict.merge({ 3050 xref: this.xref, 3051 dictArray: value 3052 }); 3053 } 3054 get content() { 3055 return this.pageDict.getArray("Contents"); 3056 } 3057 get resources() { 3058 const resources = this._getInheritableProperty("Resources"); 3059 return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty); 3060 } 3061 _getBoundingBox(name) { 3062 if (this.xfaData) { 3063 return this.xfaData.bbox; 3064 } 3065 let box = this._getInheritableProperty(name, true); 3066 if (Array.isArray(box) && box.length === 4) { 3067 box = _util.Util.normalizeRect(box); 3068 if (box[2] - box[0] > 0 && box[3] - box[1] > 0) { 3069 return box; 3070 } 3071 (0, _util.warn)(`Empty, or invalid, /${name} entry.`); 3072 } 3073 return null; 3074 } 3075 get mediaBox() { 3076 return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX); 3077 } 3078 get cropBox() { 3079 return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox); 3080 } 3081 get userUnit() { 3082 let obj = this.pageDict.get("UserUnit"); 3083 if (typeof obj !== "number" || obj <= 0) { 3084 obj = DEFAULT_USER_UNIT; 3085 } 3086 return (0, _util.shadow)(this, "userUnit", obj); 3087 } 3088 get view() { 3089 const { 3090 cropBox, 3091 mediaBox 3092 } = this; 3093 if (cropBox !== mediaBox && !(0, _util.isArrayEqual)(cropBox, mediaBox)) { 3094 const box = _util.Util.intersect(cropBox, mediaBox); 3095 if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) { 3096 return (0, _util.shadow)(this, "view", box); 3097 } 3098 (0, _util.warn)("Empty /CropBox and /MediaBox intersection."); 3099 } 3100 return (0, _util.shadow)(this, "view", mediaBox); 3101 } 3102 get rotate() { 3103 let rotate = this._getInheritableProperty("Rotate") || 0; 3104 if (rotate % 90 !== 0) { 3105 rotate = 0; 3106 } else if (rotate >= 360) {
3107 rotate %= 360; 3108 } else if (rotate < 0) { 3109 rotate = (rotate % 360 + 360) % 360; 3110 } 3111 return (0, _util.shadow)(this, "rotate", rotate); 3112 } 3113 _onSubStreamError(reason, objId) { 3114 if (this.evaluatorOptions.ignoreErrors) { 3115 (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`); 3116 return; 3117 } 3118 throw reason; 3119 } 3120 getContentStream() { 3121 return this.pdfManager.ensure(this, "content").then(content => { 3122 if (content instanceof _base_stream.BaseStream) { 3123 return content; 3124 } 3125 if (Array.isArray(content)) { 3126 return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this)); 3127 } 3128 return new _stream.NullStream(); 3129 }); 3130 } 3131 get xfaData() { 3132 return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? { 3133 bbox: this.xfaFactory.getBoundingBox(this.pageIndex) 3134 } : null); 3135 } 3136 #replaceIdByRef(annotations, deletedAnnotations, existingAnnotations) { 3137 for (const annotation of annotations) { 3138 if (annotation.id) { 3139 const ref = _primitives.Ref.fromString(annotation.id); 3140 if (!ref) { 3141 (0, _util.warn)(`A non-linked annotation cannot be modified: ${annotation.id}`); 3142 continue; 3143 } 3144 if (annotation.deleted) { 3145 deletedAnnotations.put(ref); 3146 continue; 3147 } 3148 existingAnnotations?.put(ref); 3149 annotation.ref = ref; 3150 delete annotation.id; 3151 } 3152 } 3153 } 3154 async saveNewAnnotations(handler, task, annotations, imagePromises) { 3155 if (this.xfaFactory) { 3156 throw new Error("XFA: Cannot save new annotations."); 3157 } 3158 const partialEvaluator = new _evaluator.PartialEvaluator({ 3159 xref: this.xref, 3160 handler, 3161 pageIndex: this.pageIndex, 3162 idFactory: this._localIdFactory, 3163 fontCache: this.fontCache, 3164 builtInCMapCache: this.builtInCMapCache, 3165 standardFontDataCache: this.standardFontDataCache, 3166 globalImageCache: this.globalImageCache, 3167 systemFontCache: this.systemFontCache, 3168 options: this.evaluatorOptions 3169 }); 3170 const deletedAnnotations = new _primitives.RefSet(); 3171 const existingAnnotations = new _primitives.RefSet(); 3172 this.#replaceIdByRef(annotations, deletedAnnotations, existingAnnotations); 3173 const pageDict = this.pageDict; 3174 const annotationsArray = this.annotations.filter(a => !(a instanceof _primitives.Ref && deletedAnnotations.has(a))); 3175 const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations, imagePromises); 3176 for (const { 3177 ref 3178 } of newData.annotations) { 3179 if (ref instanceof _primitives.Ref && !existingAnnotations.has(ref)) { 3180 annotationsArray.push(ref); 3181 } 3182 } 3183 const savedDict = pageDict.get("Annots"); 3184 pageDict.set("Annots", annotationsArray); 3185 const buffer = []; 3186 await (0, _writer.writeObject)(this.ref, pageDict, buffer, this.xref); 3187 if (savedDict) { 3188 pageDict.set("Annots", savedDict); 3189 } 3190 const objects = newData.dependencies; 3191 objects.push({ 3192 ref: this.ref, 3193 data: buffer.join("") 3194 }, ...newData.annotations); 3195 return objects; 3196 } 3197 save(handler, task, annotationStorage) { 3198 const partialEvaluator = new _evaluator.PartialEvaluator({ 3199 xref: this.xref, 3200 handler, 3201 pageIndex: this.pageIndex, 3202 idFactory: this._localIdFactory, 3203 fontCache: this.fontCache, 3204 builtInCMapCache: this.builtInCMapCache, 3205 standardFontDataCache: this.standardFontDataCache, 3206 globalImageCache: this.globalImageCache, 3207 systemFontCache: this.systemFontCache, 3208 options: this.evaluatorOptions 3209 }); 3210 return this._parsedAnnotations.then(function (annotations) { 3211 const newRefsPromises = []; 3212 for (const annotation of annotations) { 3213 if (!annotation.mustBePrinted(annotationStorage)) { 3214 continue; 3215 } 3216 newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) { 3217 (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); 3218 return null; 3219 })); 3220 } 3221 return Promise.all(newRefsPromises).then(function (newRefs) { 3222 return newRefs.filter(newRef =>
3222 !!newRef); 3223 }); 3224 }); 3225 } 3226 loadResources(keys) { 3227 if (!this.resourcesPromise) { 3228 this.resourcesPromise = this.pdfManager.ensure(this, "resources"); 3229 } 3230 return this.resourcesPromise.then(() => { 3231 const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref); 3232 return objectLoader.load(); 3233 }); 3234 } 3235 getOperatorList({ 3236 handler, 3237 sink, 3238 task, 3239 intent, 3240 cacheKey, 3241 annotationStorage = null 3242 }) { 3243 const contentStreamPromise = this.getContentStream(); 3244 const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]); 3245 const partialEvaluator = new _evaluator.PartialEvaluator({ 3246 xref: this.xref, 3247 handler, 3248 pageIndex: this.pageIndex, 3249 idFactory: this._localIdFactory, 3250 fontCache: this.fontCache, 3251 builtInCMapCache: this.builtInCMapCache, 3252 standardFontDataCache: this.standardFontDataCache, 3253 globalImageCache: this.globalImageCache, 3254 systemFontCache: this.systemFontCache, 3255 options: this.evaluatorOptions 3256 }); 3257 const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null; 3258 let deletedAnnotations = null; 3259 let newAnnotationsPromise = Promise.resolve(null); 3260 if (newAnnotationsByPage) { 3261 const newAnnotations = newAnnotationsByPage.get(this.pageIndex); 3262 if (newAnnotations) { 3263 const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals"); 3264 let imagePromises; 3265 const missingBitmaps = new Set(); 3266 for (const { 3267 bitmapId, 3268 bitmap 3269 } of newAnnotations) { 3270 if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) { 3271 missingBitmaps.add(bitmapId); 3272 } 3273 } 3274 const { 3275 isOffscreenCanvasSupported 3276 } = this.evaluatorOptions; 3277 if (missingBitmaps.size > 0) { 3278 const annotationWithBitmaps = newAnnotations.slice(); 3279 for (const [key, annotation] of annotationStorage) { 3280 if (!key.startsWith(_util.AnnotationEditorPrefix)) { 3281 continue; 3282 } 3283 if (annotation.bitmap && missingBitmaps.has(annotation.bitmapId)) { 3284 annotationWithBitmaps.push(annotation); 3285 } 3286 } 3287 imagePromises = _annotation.AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported); 3288 } else { 3289 imagePromises = _annotation.AnnotationFactory.generateImages(newAnnotations, this.xref, isOffscreenCanvasSupported); 3290 } 3291 deletedAnnotations = new _primitives.RefSet(); 3292 this.#replaceIdByRef(newAnnotations, deletedAnnotations, null); 3293 newAnnotationsPromise = annotationGlobalsPromise.then(annotationGlobals => { 3294 if (!annotationGlobals) { 3295 return null; 3296 } 3297 return _annotation.AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnotations, imagePromises); 3298 }); 3299 } 3300 } 3301 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 3302 const pageListPromise = dataPromises.then(([contentStream]) => { 3303 const opList = new _operator_list.OperatorList(intent, sink); 3304 handler.send("StartRenderPage", { 3305 transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet), 3306 pageIndex: this.pageIndex, 3307 cacheKey 3308 }); 3309 return partialEvaluator.getOperatorList({ 3310 stream: contentStream, 3311 task, 3312 resources: this.resources, 3313 operatorList: opList 3314 }).then(function () { 3315 return opList; 3316 }); 3317 }); 3318 return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) { 3319 if (newAnnotations) { 3320 annotations = annotations.filter(a => !(a.ref && deletedAnnotations.has(a.ref))); 3321 for (let i = 0, ii = newAnnotations.length; i < ii; i++) { 3322 const newAnnotation = newAnnotations[i]; 3323 if (newAnnotation.refToReplace) { 3324 const j = annotations.findIndex(a => a.ref && (0, _primitives.isRefsEqual)(a.ref, newAnnotation.refToReplace)); 3325 if (j >= 0) { 3326 annotations.splice(j, 1, newAnnotation); 3327 newAnnotations.splice(i--, 1); 3328 ii--; 3329 } 3330 } 3331 } 3332 annotations = annotations.concat(newAnnotations); 3333 } 3334 if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) { 3335 pageOpList.flush(true); 3336 return { 3337 length: pageOpList.totalLength 3338 }; 3339 } 3340 const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS), 3341 intentAny = !!(intent & _util.RenderingIntentFlag.ANY), 3342 intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY), 3343 intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT); 3344 const opListPromises = []; 3345 for (const annotation of annotations) { 3346 if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage, renderForms) || intentPrint && annotation.mustBePrinted(annotationStorage)) { 3347 opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) { 3348 (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); 3349 return { 3350 opList: null, 3351 separateForm: false,
3352 separateCanvas: false 3353 }; 3354 })); 3355 } 3356 } 3357 return Promise.all(opListPromises).then(function (opLists) { 3358 let form = false, 3359 canvas = false; 3360 for (const { 3361 opList, 3362 separateForm, 3363 separateCanvas 3364 } of opLists) { 3365 pageOpList.addOpList(opList); 3366 form ||= separateForm; 3367 canvas ||= separateCanvas; 3368 } 3369 pageOpList.flush(true, { 3370 form, 3371 canvas 3372 }); 3373 return { 3374 length: pageOpList.totalLength 3375 }; 3376 }); 3377 }); 3378 } 3379 extractTextContent({ 3380 handler, 3381 task, 3382 includeMarkedContent, 3383 disableNormalization, 3384 sink 3385 }) { 3386 const contentStreamPromise = this.getContentStream(); 3387 const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]); 3388 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 3389 return dataPromises.then(([contentStream]) => { 3390 const partialEvaluator = new _evaluator.PartialEvaluator({ 3391 xref: this.xref, 3392 handler, 3393 pageIndex: this.pageIndex, 3394 idFactory: this._localIdFactory, 3395 fontCache: this.fontCache, 3396 builtInCMapCache: this.builtInCMapCache, 3397 standardFontDataCache: this.standardFontDataCache, 3398 globalImageCache: this.globalImageCache, 3399 systemFontCache: this.systemFontCache, 3400 options: this.evaluatorOptions 3401 }); 3402 return partialEvaluator.getTextContent({ 3403 stream: contentStream, 3404 task, 3405 resources: this.resources, 3406 includeMarkedContent, 3407 disableNormalization, 3408 sink,
3409 viewBox: this.view 3410 }); 3411 }); 3412 } 3413 async getStructTree() { 3414 const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot"); 3415 if (!structTreeRoot) { 3416 return null; 3417 } 3418 await this._parsedAnnotations; 3419 const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]); 3420 return structTree.serializable; 3421 } 3422 _parseStructTree(structTreeRoot) { 3423 const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict); 3424 tree.parse(this.ref); 3425 return tree; 3426 } 3427 async getAnnotationsData(handler, task, intent) { 3428 const annotations = await this._parsedAnnotations; 3429 if (annotations.length === 0) { 3430 return annotations; 3431 } 3432 const annotationsData = [], 3433 textContentPromises = []; 3434 let partialEvaluator; 3435 const intentAny = !!(intent & _util.RenderingIntentFlag.ANY), 3436 intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY), 3437 intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT); 3438 for (const annotation of annotations) { 3439 const isVisible = intentAny || intentDisplay && annotation.viewable; 3440 if (isVisible || intentPrint && annotation.printable) { 3441 annotationsData.push(annotation.data); 3442 } 3443 if (annotation.hasTextContent && isVisible) { 3444 partialEvaluator ||= new _evaluator.PartialEvaluator({ 3445 xref: this.xref, 3446 handler, 3447 pageIndex: this.pageIndex, 3448 idFactory: this._localIdFactory, 3449 fontCache: this.fontCache, 3450 builtInCMapCache: this.builtInCMapCache, 3451 standardFontDataCache: this.standardFontDataCache, 3452 globalImageCache: this.globalImageCache, 3453 systemFontCache: this.systemFontCache, 3454 options: this.evaluatorOptions 3455 }); 3456 textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, [-Infinity, -Infinity, Infinity, Infinity]).catch(function (reason) { 3457 (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`); 3458 })); 3459 } 3460 } 3461 await Promise.all(textContentPromises); 3462 return annotationsData; 3463 } 3464 get annotations() { 3465 const annots = this._getInheritableProperty("Annots"); 3466 return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []); 3467 } 3468 get _parsedAnnotations() { 3469 const promise = this.pdfManager.ensure(this, "annotations").then(async annots => { 3470 if (annots.length === 0) { 3471 return annots; 3472 } 3473 const annotationGlobals = await this.pdfManager.ensureDoc("annotationGlobals"); 3474 if (!annotationGlobals) { 3475 return []; 3476 } 3477 const annotationPromises = []; 3478 for (const annotationRef of annots) { 3479 annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, annotationGlobals, this._localIdFactory, false, this.ref).catch(function (reason) { 3480 (0, _util.warn)(`_parsedAnnotations: "${reason}".`); 3481 return null; 3482 })); 3483 } 3484 const sortedAnnotations = []; 3485 let popupAnnotations; 3486 for (const annotation of await Promise.all(annotationPromises)) { 3487 if (!annotation) { 3488 continue; 3489 } 3490 if (annotation instanceof _annotation.PopupAnnotation) { 3491 (popupAnnotations ||= []).push(annotation); 3492 continue; 3493 } 3494 sortedAnnotations.push(annotation); 3495 } 3496 if (popupAnnotations) { 3497 sortedAnnotations.push(...popupAnnotations); 3498 } 3499 return sortedAnnotations; 3500 }); 3501 return (0, _util.shadow)(this, "_parsedAnnotations", promise); 3502 } 3503 get jsActions() { 3504 const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType); 3505 return (0, _util.shadow)(this, "jsActions", actions); 3506 } 3507} 3508exports.Page = Page; 3509const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]); 3510const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]); 3511const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]); 3512const FINGERPRINT_FIRST_BYTES = 1024; 3513const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; 3514function find(stream, signature, limit = 1024, backwards = false) { 3515 const signatureLength = signature.length; 3516 const scanBytes = stream.peekBytes(limit); 3517 const scanLength = scanBytes.length - signatureLength; 3518 if (scanLength <= 0) { 3519 return false;
vendor: 4,214 bytes, lines 3520-3673
3520 } 3521 if (backwards) { 3522 const signatureEnd = signatureLength - 1; 3523 let pos = scanBytes.length - 1; 3524 while (pos >= signatureEnd) { 3525 let j = 0; 3526 while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) { 3527 j++; 3528 } 3529 if (j >= signatureLength) { 3530 stream.pos += pos - signatureEnd; 3531 return true; 3532 } 3533 pos--; 3534 } 3535 } else { 3536 let pos = 0; 3537 while (pos <= scanLength) { 3538 let j = 0; 3539 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 3540 j++; 3541 } 3542 if (j >= signatureLength) { 3543 stream.pos += pos; 3544 return true; 3545 } 3546 pos++; 3547 } 3548 } 3549 return false; 3550} 3551class PDFDocument { 3552 constructor(pdfManager, stream) { 3553 if (stream.length <= 0) { 3554 throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes."); 3555 } 3556 this.pdfManager = pdfManager; 3557 this.stream = stream; 3558 this.xref = new _xref.XRef(stream, pdfManager); 3559 this._pagePromises = new Map(); 3560 this._version = null; 3561 const idCounters = { 3562 font: 0 3563 }; 3564 this._globalIdFactory = class { 3565 static getDocId() { 3566 return `g_${pdfManager.docId}`; 3567 } 3568 static createFontId() { 3569 return `f${++idCounters.font}`; 3570 } 3571 static createObjId() { 3572 (0, _util.unreachable)("Abstract method `createObjId` called."); 3573 } 3574 static getPageObjId() { 3575 (0, _util.unreachable)("Abstract method `getPageObjId` called."); 3576 } 3577 }; 3578 } 3579 parse(recoveryMode) { 3580 this.xref.parse(recoveryMode); 3581 this.catalog = new _catalog.Catalog(this.pdfManager, this.xref); 3582 } 3583 get linearization() { 3584 let linearization = null; 3585 try { 3586 linearization = _parser.Linearization.create(this.stream); 3587 } catch (err) { 3588 if (err instanceof _core_utils.MissingDataException) { 3589 throw err; 3590 } 3591 (0, _util.info)(err); 3592 } 3593 return (0, _util.shadow)(this, "linearization", linearization); 3594 } 3595 get startXRef() { 3596 const stream = this.stream; 3597 let startXRef = 0; 3598 if (this.linearization) { 3599 stream.reset(); 3600 if (find(stream, ENDOBJ_SIGNATURE)) { 3601 startXRef = stream.pos + 6 - stream.start; 3602 } 3603 } else { 3604 const step = 1024; 3605 const startXRefLength = STARTXREF_SIGNATURE.length; 3606 let found = false, 3607 pos = stream.end; 3608 while (!found && pos > 0) { 3609 pos -= step - startXRefLength; 3610 if (pos < 0) { 3611 pos = 0; 3612 } 3613 stream.pos = pos; 3614 found = find(stream, STARTXREF_SIGNATURE, step, true); 3615 } 3616 if (found) { 3617 stream.skip(9); 3618 let ch; 3619 do { 3620 ch = stream.getByte(); 3621 } while ((0, _core_utils.isWhiteSpace)(ch)); 3622 let str = ""; 3623 while (ch >= 0x20 && ch <= 0x39) { 3624 str += String.fromCharCode(ch); 3625 ch = stream.getByte(); 3626 } 3627 startXRef = parseInt(str, 10); 3628 if (isNaN(startXRef)) { 3629 startXRef = 0; 3630 } 3631 } 3632 } 3633 return (0, _util.shadow)(this, "startXRef", startXRef); 3634 } 3635 checkHeader() { 3636 const stream = this.stream; 3637 stream.reset(); 3638 if (!find(stream, PDF_HEADER_SIGNATURE)) { 3639 return; 3640 } 3641 stream.moveStart(); 3642 stream.skip(PDF_HEADER_SIGNATURE.length); 3643 let version = "", 3644 ch; 3645 while ((ch = stream.getByte()) > 0x20 && version.length < 7) { 3646 version += String.fromCharCode(ch); 3647 } 3648 if (_core_utils.PDF_VERSION_REGEXP.test(version)) { 3649 this._version = version; 3650 } else { 3651 (0, _util.warn)(`Invalid PDF header version: ${version}`); 3652 } 3653 } 3654 parseStartXRef() { 3655 this.xref.setStartXRef(this.startXRef); 3656 } 3657 get numPages() { 3658 let num = 0; 3659 if (this.catalog.hasActualNumPages) { 3660 num = this.catalog.numPages; 3661 } else if (this.xfaFactory) { 3662 num = this.xfaFactory.getNumPages(); 3663 } else if (this.linearization) { 3664 num = this.linearization.numPages; 3665 } else { 3666 num = this.catalog.numPages; 3667 } 3668 return (0, _util.shadow)(this, "numPages", num); 3669 } 3670 _hasOnlyDocumentSignatures(fields, recursionDepth = 0) { 3671 const RECURSION_LIMIT = 10; 3672 if (!Array.isArray(fields)) { 3673 return false;
3674 } 3675 return fields.every(field => { 3676 field = this.xref.fetchIfRef(field); 3677 if (!(field instanceof _primitives.Dict)) { 3678 return false; 3679 } 3680 if (field.has("Kids")) { 3681 if (++recursionDepth > RECURSION_LIMIT) { 3682 (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached"); 3683 return false; 3684 } 3685 return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth); 3686 } 3687 const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig"); 3688 const rectangle = field.get("Rect"); 3689 const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0); 3690 return isSignature && isInvisible; 3691 }); 3692 } 3693 get _xfaStreams() { 3694 const acroForm = this.catalog.acroForm; 3695 if (!acroForm) { 3696 return null; 3697 } 3698 const xfa = acroForm.get("XFA"); 3699 const entries = { 3700 "xdp:xdp": "", 3701 template: "", 3702 datasets: "", 3703 config: "", 3704 connectionSet: "", 3705 localeSet: "", 3706 stylesheet: "", 3707 "/xdp:xdp": "" 3708 }; 3709 if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) { 3710 entries["xdp:xdp"] = xfa; 3711 return entries; 3712 } 3713 if (!Array.isArray(xfa) || xfa.length === 0) { 3714 return null; 3715 } 3716 for (let i = 0, ii = xfa.length; i < ii; i += 2) { 3717 let name; 3718 if (i === 0) { 3719 name = "xdp:xdp"; 3720 } else if (i === ii - 2) { 3721 name = "/xdp:xdp"; 3722 } else { 3723 name = xfa[i]; 3724 } 3725 if (!entries.hasOwnProperty(name)) { 3726 continue; 3727 } 3728 const data = this.xref.fetchIfRef(xfa[i + 1]); 3729 if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) { 3730 continue; 3731 } 3732 entries[name] = data; 3733 } 3734 return entries; 3735 } 3736 get xfaDatasets() { 3737 const streams = this._xfaStreams; 3738 if (!streams) { 3739 return (0, _util.shadow)(this, "xfaDatasets", null); 3740 } 3741 for (const key of ["datasets", "xdp:xdp"]) { 3742 const stream = streams[key]; 3743 if (!stream) { 3744 continue; 3745 } 3746 try { 3747 const str = (0, _util.stringToUTF8String)(stream.getString()); 3748 const data = { 3749 [key]: str 3750 }; 3751 return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data)); 3752 } catch { 3753 (0, _util.warn)("XFA - Invalid utf-8 string."); 3754 break; 3755 } 3756 } 3757 return (0, _util.shadow)(this, "xfaDatasets", null); 3758 } 3759 get xfaData() { 3760 const streams = this._xfaStreams; 3761 if (!streams) { 3762 return null; 3763 } 3764 const data = Object.create(null); 3765 for (const [key, stream] of Object.entries(streams)) { 3766 if (!stream) { 3767 continue; 3768 } 3769 try { 3770 data[key] = (0, _util.stringToUTF8String)(stream.getString()); 3771 } catch { 3772 (0, _util.warn)("XFA - Invalid utf-8 string."); 3773 return null; 3774 } 3775 } 3776 return data; 3777 } 3778 get xfaFactory() { 3779 let data; 3780 if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) { 3781 data = this.xfaData; 3782 } 3783 return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null); 3784 } 3785 get isPureXfa() { 3786 return this.xfaFactory ? this.xfaFactory.isValid() : false; 3787 } 3788 get htmlForXfa() { 3789 return this.xfaFactory ? this.xfaFactory.getPages() : null; 3790 } 3791 async loadXfaImages() { 3792 const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages"); 3793 if (!xfaImagesDict) { 3794 return; 3795 } 3796 const keys = xfaImagesDict.getKeys(); 3797 const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref); 3798 await objectLoader.load(); 3799 const xfaImages = new Map(); 3800 for (const key of keys) { 3801 const stream = xfaImagesDict.get(key); 3802 if (stream instanceof _base_stream.BaseStream) { 3803 xfaImages.set(key, stream.getBytes()); 3804 } 3805 } 3806 this.xfaFactory.setImages(xfaImages); 3807 } 3808 async loadXfaFonts(handler, task) { 3809 const acroForm = await this.pdfManager.ensureCatalog("acroForm"); 3810 if (!acroForm) { 3811 return; 3812 } 3813 const resources = await acroForm.getAsync("DR"); 3814 if (!(resources instanceof _primitives.Dict)) { 3815 return; 3816 } 3817 const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref); 3818 await objectLoader.load(); 3819 const fontRes = resources.get("Font"); 3820 if (!(fontRes instanceof _primitives.Dict)) { 3821 return; 3822 } 3823 const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions); 3824 options.useSystemFonts = false;
3825 const partialEvaluator = new _evaluator.PartialEvaluator({ 3826 xref: this.xref, 3827 handler, 3828 pageIndex: -1, 3829 idFactory: this._globalIdFactory, 3830 fontCache: this.catalog.fontCache, 3831 builtInCMapCache: this.catalog.builtInCMapCache, 3832 standardFontDataCache: this.catalog.standardFontDataCache, 3833 options 3834 }); 3835 const operatorList = new _operator_list.OperatorList(); 3836 const pdfFonts = []; 3837 const initialState = { 3838 get font() { 3839 return pdfFonts.at(-1); 3840 }, 3841 set font(font) { 3842 pdfFonts.push(font); 3843 }, 3844 clone() { 3845 return this; 3846 } 3847 }; 3848 const fonts = new Map(); 3849 fontRes.forEach((fontName, font) => { 3850 fonts.set(fontName, font); 3851 }); 3852 const promises = []; 3853 for (const [fontName, font] of fonts) { 3854 const descriptor = font.get("FontDescriptor"); 3855 if (!(descriptor instanceof _primitives.Dict)) { 3856 continue; 3857 } 3858 let fontFamily = descriptor.get("FontFamily"); 3859 fontFamily = fontFamily.replaceAll(/[ ]+(\d)/g, "$1"); 3860 const fontWeight = descriptor.get("FontWeight"); 3861 const italicAngle = -descriptor.get("ItalicAngle"); 3862 const cssFontInfo = { 3863 fontFamily, 3864 fontWeight, 3865 italicAngle 3866 }; 3867 if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) { 3868 continue; 3869 } 3870 promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) { 3871 (0, _util.warn)(`loadXfaFonts: "${reason}".`); 3872 return null; 3873 })); 3874 } 3875 await Promise.all(promises); 3876 const missingFonts = this.xfaFactory.setFonts(pdfFonts); 3877 if (!missingFonts) { 3878 return; 3879 } 3880 options.ignoreErrors = true; 3881 promises.length = 0; 3882 pdfFonts.length = 0; 3883 const reallyMissingFonts = new Set(); 3884 for (const missing of missingFonts) { 3885 if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) { 3886 reallyMissingFonts.add(missing); 3887 } 3888 } 3889 if (reallyMissingFonts.size) { 3890 missingFonts.push("PdfJS-Fallback"); 3891 } 3892 for (const missing of missingFonts) { 3893 if (reallyMissingFonts.has(missing)) { 3894 continue; 3895 } 3896 for (const fontInfo of [{ 3897 name: "Regular", 3898 fontWeight: 400, 3899 italicAngle: 0 3900 }, { 3901 name: "Bold", 3902 fontWeight: 700, 3903 italicAngle: 0 3904 }, { 3905 name: "Italic", 3906 fontWeight: 400, 3907 italicAngle: 12 3908 }, { 3909 name: "BoldItalic", 3910 fontWeight: 700, 3911 italicAngle: 12 3912 }]) { 3913 const name = `${missing}-${fontInfo.name}`; 3914 const dict = (0, _xfa_fonts.getXfaFontDict)(name); 3915 promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, { 3916 fontFamily: missing, 3917 fontWeight: fontInfo.fontWeight, 3918 italicAngle: fontInfo.italicAngle 3919 }).catch(function (reason) { 3920 (0, _util.warn)(`loadXfaFonts: "${reason}".`); 3921 return null; 3922 })); 3923 } 3924 } 3925 await Promise.all(promises); 3926 this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts); 3927 } 3928 async serializeXfaData(annotationStorage) { 3929 return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null; 3930 } 3931 get version() {
3932 return this.catalog.version || this._version; 3933 } 3934 get formInfo() { 3935 const formInfo = { 3936 hasFields: false, 3937 hasAcroForm: false, 3938 hasXfa: false, 3939 hasSignatures: false 3940 }; 3941 const acroForm = this.catalog.acroForm; 3942 if (!acroForm) { 3943 return (0, _util.shadow)(this, "formInfo", formInfo); 3944 } 3945 try { 3946 const fields = acroForm.get("Fields"); 3947 const hasFields = Array.isArray(fields) && fields.length > 0; 3948 formInfo.hasFields = hasFields; 3949 const xfa = acroForm.get("XFA"); 3950 formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty; 3951 const sigFlags = acroForm.get("SigFlags"); 3952 const hasSignatures = !!(sigFlags & 0x1); 3953 const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields); 3954 formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures; 3955 formInfo.hasSignatures = hasSignatures; 3956 } catch (ex) { 3957 if (ex instanceof _core_utils.MissingDataException) { 3958 throw ex; 3959 } 3960 (0, _util.warn)(`Cannot fetch form information: "${ex}".`); 3961 } 3962 return (0, _util.shadow)(this, "formInfo", formInfo); 3963 } 3964 get documentInfo() { 3965 const docInfo = { 3966 PDFFormatVersion: this.version, 3967 Language: this.catalog.lang, 3968 EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null, 3969 IsLinearized: !!this.linearization, 3970 IsAcroFormPresent: this.formInfo.hasAcroForm, 3971 IsXFAPresent: this.formInfo.hasXfa, 3972 IsCollectionPresent: !!this.catalog.collection, 3973 IsSignaturesPresent: this.formInfo.hasSignatures 3974 }; 3975 let infoDict; 3976 try { 3977 infoDict = this.xref.trailer.get("Info"); 3978 } catch (err) { 3979 if (err instanceof _core_utils.MissingDataException) { 3980 throw err; 3981 } 3982 (0, _util.info)("The document information dictionary is invali
3982d."); 3983 } 3984 if (!(infoDict instanceof _primitives.Dict)) { 3985 return (0, _util.shadow)(this, "documentInfo", docInfo); 3986 } 3987 for (const key of infoDict.getKeys()) { 3988 const value = infoDict.get(key); 3989 switch (key) { 3990 case "Title": 3991 case "Author": 3992 case "Subject": 3993 case "Keywords": 3994 case "Creator": 3995 case "Producer": 3996 case "CreationDate": 3997 case "ModDate": 3998 if (typeof value === "string") { 3999 docInfo[key] = (0, _util.stringToPDFString)(value); 4000 continue; 4001 } 4002 break; 4003 case "Trapped": 4004 if (value instanceof _primitives.Name) { 4005 docInfo[key] = value; 4006 continue; 4007 } 4008 break; 4009 default: 4010 let customValue; 4011 switch (typeof value) { 4012 case "string": 4013 customValue = (0, _util.stringToPDFString)(value); 4014 break; 4015 case "number": 4016 case "boolean": 4017 customValue = value; 4018 break; 4019 default: 4020 if (value instanceof _primitives.Name) { 4021 customValue = value; 4022 } 4023 break; 4024 } 4025 if (customValue === undefined) { 4026 (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`); 4027 continue; 4028 } 4029 if (!docInfo.Custom) { 4030 docInfo.Custom = Object.create(null); 4031 } 4032 docInfo.Custom[key] = customValue; 4033 continue; 4034 } 4035 (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`); 4036 } 4037 return (0, _util.shadow)(this, "documentInfo", docInfo); 4038 } 4039 get fingerprints() { 4040 function validate(data) { 4041 return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT; 4042 } 4043 function hexString(hash) { 4044 const buf = []; 4045 for (const num of hash) { 4046 const hex = num.toString(16); 4047 buf.push(hex.padStart(2, "0")); 4048 } 4049 return buf.join(""); 4050 } 4051 const idArray = this.xref.trailer.get("ID"); 4052 let hashOriginal, hashModified; 4053 if (Array.isArray(idArray) && validate(idArray[0])) { 4054 hashOriginal = (0, _util.stringToBytes)(idArray[0]); 4055 if (idArray[1] !== idArray[0] && validate(idArray[1])) { 4056 hashModified = (0, _util.stringToBytes)(idArray[1]); 4057 } 4058 } else { 4059 hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); 4060 } 4061 return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]); 4062 } 4063 async _getLinearizationPage(pageIndex) { 4064 const { 4065 catalog, 4066 linearization, 4067 xref 4068 } = this; 4069 const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0); 4070 try { 4071 const obj = await xref.fetchAsync(ref); 4072 if (obj instanceof _primitives.Dict) { 4073 let type = obj.getRaw("Type"); 4074 if (type instanceof _primitives.Ref) { 4075 type = await xref.fetchAsync(type); 4076 } 4077 if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) { 4078 if (!catalog.pageKidsCountCache.has(ref)) { 4079 catalog.pageKidsCountCache.put(ref, 1); 4080 } 4081 if (!catalog.pageIndexCache.has(ref)) { 4082 catalog.pageIndexCache.put(ref, 0); 4083 } 4084 return [obj, ref]; 4085 } 4086 } 4087 throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary."); 4088 } catch (reason) { 4089 (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`); 4090 return catalog.getPageDict(pageIndex); 4091 } 4092 } 4093 getPage(pageIndex) { 4094 const cachedPromise = this._pagePromises.get(pageIndex); 4095 if (cachedPromise) { 4096 return cachedPromise; 4097 } 4098 const { 4099 catalog, 4100 linearization, 4101 xfaFactory 4102 } = this; 4103 let promise; 4104 if (xfaFactory) { 4105 promise = Promise.resolve([_primitives.Dict.empty, null]); 4106 } else if (linearization?.pageFirst === pageIndex) { 4107 promise = this._getLinearizationPage(pageIndex); 4108 } else { 4109 promise = catalog.getPageDict(pageIndex); 4110 } 4111 promise = promise.then(([pageDict, ref]) => { 4112 return new Page({ 4113 pdfManager: this.pdfManager, 4114 xref: this.xref, 4115 pageIndex, 4116 pageDict, 4117 ref, 4118 globalIdFactory: this._globalIdFactory, 4119 fontCache: catalog.fontCache, 4120 builtInCMapCache: catalog.builtInCMapCache, 4121 standardFontDataCache: catalog.standardFontDataCache, 4122 globalImageCache: catalog.globalImageCache, 4123 systemFontCache: catalog.systemFontCache, 4124 nonBlendModesSet: catalog.nonBlendModesSet, 4125 xfaFactory 4126 }); 4127 }); 4128 this._pagePromises.set(pageIndex, promise); 4129 return promise; 4130 } 4131 async checkFirstPage(recoveryMode = false) { 4132 if (recoveryMode) { 4133 return; 4134 } 4135 try { 4136 await this.getPage(0); 4137 } catch (reason) { 4138 if (reason instanceof _core_utils.XRefEntryException) { 4139 this._pagePromises.delete(0); 4140 await this.cleanup(); 4141 throw new _core_utils.XRefParseException(); 4142 } 4143 } 4144 } 4145 async checkLastPage(recoveryMode = false) { 4146 const { 4147 catalog, 4148 pdfManager 4149 } = this; 4150 catalog.setActualNumPages(); 4151 let numPages; 4152 try { 4153 await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]); 4154 if (this.xfaFactory) { 4155 return; 4156 } else if (this.linearization) { 4157 numPages = this.linearization.numPages; 4158 } else { 4159 numPages = catalog.numPages; 4160 } 4161 if (!Number.isInteger(numPages)) { 4162 throw new _util.FormatError("Page count is not an integer."); 4163 } else if (numPages <= 1) { 4164 return; 4165 } 4166 await this.getPage(numPages - 1); 4167 } catch (reason) { 4168 this._pagePromises.delete(numPages - 1); 4169 await this.cleanup(); 4170 if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) { 4171 throw new _core_utils.XRefParseException(); 4172 } 4173 (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`); 4174 let pagesTree;
4175 try { 4176 pagesTree = await catalog.getAllPageDicts(recoveryMode); 4177 } catch (reasonAll) { 4178 if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) { 4179 throw new _core_utils.XRefParseException(); 4180 } 4181 catalog.setActualNumPages(1); 4182 return; 4183 } 4184 for (const [pageIndex, [pageDict, ref]] of pagesTree) { 4185 let promise; 4186 if (pageDict instanceof Error) { 4187 promise = Promise.reject(pageDict); 4188 promise.catch(() => {}); 4189 } else { 4190 promise = Promise.resolve(new Page({ 4191 pdfManager, 4192 xref: this.xref, 4193 pageIndex, 4194 pageDict, 4195 ref, 4196 globalIdFactory: this._globalIdFactory, 4197 fontCache: catalog.fontCache, 4198 builtInCMapCache: catalog.builtInCMapCache, 4199 standardFontDataCache: catalog.standardFontDataCache, 4200 globalImageCache: catalog.globalImageCache, 4201 systemFontCache: catalog.systemFontCache, 4202 nonBlendModesSet: catalog.nonBlendModesSet, 4203 xfaFactory: null 4204 })); 4205 } 4206 this._pagePromises.set(pageIndex, promise); 4207 } 4208 catalog.setActualNumPages(pagesTree.size); 4209 } 4210 } 4211 fontFallback(id, handler) { 4212 return this.catalog.fontFallback(id, handler); 4213 } 4214 async cleanup(manuallyTriggered = false) { 4215 return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)(); 4216 } 4217 #collectFieldObjects(name, fieldRef, promises, annotationGlobals) { 4218 const field = this.xref.fetchIfRef(fieldRef); 4219 if (field.has("T")) { 4220 const partName = (0, _util.stringToPDFString)(field.get("T")); 4221 name = name === "" ? partName : `${name}.${partName}`; 4222 } 4223 if (!promises.has(name)) { 4224 promises.set(name, []); 4225 } 4226 promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, annotationGlobals, this._localIdFactory, true, null).then(annotation => annotation?.getFieldObject()).catch(function (reason) { 4227 (0, _util.warn)(`#collectFieldObjects: "${reason}".`); 4228 return null; 4229 })); 4230 if (field.has("Kids")) { 4231 for (const kid of field.get("Kids")) { 4232 this.#collectFieldObjects(name, kid, promises, annotationGlobals); 4233 } 4234 } 4235 } 4236 get fieldObjects() { 4237 if (!this.formInfo.hasFields) { 4238 return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null)); 4239 } 4240 const promise = this.pdfManager.ensureDoc("annotationGlobals").then(async annotationGlobals => { 4241 if (!annotationGlobals) { 4242 return null; 4243 } 4244 const allFields = Object.create(null); 4245 const fieldPromises = new Map(); 4246 for (const fieldRef of this.catalog.acroForm.get("Fields")) { 4247 this.#collectFieldObjects("", fieldRef, fieldPromises, annotationGlobals); 4248 } 4249 const allPromises = []; 4250 for (const [name, promises] of fieldPromises) { 4251 allPromises.push(Promise.all(promises).then(fields => { 4252 fields = fields.filter(field => !!field); 4253 if (fields.length > 0) { 4254 allFields[name] = fields; 4255 } 4256 })); 4257 } 4258 await Promise.all(allPromises); 4259 return allFields; 4260 }); 4261 return (0, _util.shadow)(this, "fieldObjects", promise); 4262 } 4263 get hasJSActions() { 4264 const promise = this.pdfManager.ensureDoc("_parseHasJSActions"); 4265 return (0, _util.shadow)(this, "hasJSActions", promise); 4266 } 4267 async _parseHasJSActions() { 4268 const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]); 4269 if (catalogJsActions) { 4270 return true; 4271 } 4272 if (fieldObjects) { 4273 return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null)); 4274 } 4275 return false; 4276 } 4277 get calculationOrderIds() { 4278 const acroForm = this.catalog.acroForm; 4279 if (!acroForm?.has("CO")) { 4280 return (0, _util.shadow)(this, "calculationOrderIds", null); 4281 } 4282 const calculationOrder = acroForm.get("CO"); 4283 if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) { 4284 return (0, _util.shadow)(this, "calculationOrderIds", null); 4285 } 4286 const ids = []; 4287 for (const id of calculationOrder) { 4288 if (id instanceof _primitives.Ref) { 4289 ids.push(id.toString()); 4290 } 4291 } 4292 if (ids.length === 0) { 4293 return (0, _util.shadow)(this, "calculationOrderIds", null); 4294 } 4295 return (0, _util.shadow)(this, "calculationOrderIds", ids); 4296 } 4297 get annotationGlobals() { 4298 return (0, _util.shadow)(this, "annotationGlobals", _annotation.AnnotationFactory.createGlobals(this.pdfManager)); 4299 } 4300} 4301exports.PDFDocument = PDFDocument; 4302 4303/***/ }), 4304/* 10 */ 4305/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 4306 4307 4308 4309Object.defineProperty(exports, "__esModule", ({ 4310 value: true 4311})); 4312exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exp
4312orts.AnnotationBorderStyle = exports.Annotation = void 0; 4313exports.getQuadPoints = getQuadPoints; 4314var _util = __w_pdfjs_require__(2); 4315var _core_utils = __w_pdfjs_require__(3); 4316var _default_appearance = __w_pdfjs_require__(11); 4317var _primitives = __w_pdfjs_require__(4); 4318var _stream = __w_pdfjs_require__(8); 4319var _base_stream = __w_pdfjs_require__(5); 4320var _bidi = __w_pdfjs_require__(60); 4321var _catalog = __w_pdfjs_require__(66); 4322var _colorspace = __w_pdfjs_require__(12); 4323var _file_spec = __w_pdfjs_require__(69); 4324var _jpeg_stream = __w_pdfjs_require__(26); 4325var _object_loader = __w_pdfjs_require__(76); 4326var _operator_list = __w_pdfjs_require__(64); 4327var _writer = __w_pdfjs_require__(73); 4328var _factory = __w_pdfjs_require__(77); 4329class AnnotationFactory { 4330 static createGlobals(pdfManager) { 4331 return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xfaDatasets"), pdfManager.ensureCatalog("structTreeRoot"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments")]).then(([acroForm, xfaDatasets, structTreeRoot, baseUrl, attachments]) => { 4332 return { 4333 pdfManager, 4334 acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty, 4335 xfaDatasets, 4336 structTreeRoot, 4337 baseUrl, 4338 attachments 4339 }; 4340 }, reason => { 4341 (0, _util.warn)(`createGlobals: "${reason}".`); 4342 return null; 4343 }); 4344 } 4345 static async create(xref, ref, annotationGlobals, idFactory, collectFields, pageRef) { 4346 const pageIndex = collectFields ? await this._getPageIndex(xref, ref, annotationGlobals.pdfManager) : null; 4347 return annotationGlobals.pdfManager.ensure(this, "_create", [xref, ref, annotationGlobals, idFactory, collectFields, pageIndex, pageRef]); 4348 } 4349 static _create(xref, ref, annotationGlobals, idFactory, collectFields = false, pageIndex = null, pageRef = null) { 4350 const dict = xref.fetchIfRef(ref); 4351 if (!(dict instanceof _primitives.Dict)) { 4352 return undefined; 4353 } 4354 const { 4355 acroForm, 4356 pdfManager 4357 } = annotationGlobals; 4358 const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`; 4359 let subtype = dict.get("Subtype"); 4360 subtype = subtype instanceof _primitives.Name ? subtype.name : null; 4361 const parameters = { 4362 xref, 4363 ref, 4364 dict, 4365 subtype, 4366 id, 4367 annotationGlobals, 4368 collectFields, 4369 needAppearances: !collectFields && acroForm.get("NeedAppearances") === true, 4370 pageIndex, 4371 evaluatorOptions: pdfManager.evaluatorOptions, 4372 pageRef 4373 }; 4374 switch (subtype) { 4375 case "Link": 4376 return new LinkAnnotation(parameters); 4377 case "Text": 4378 return new TextAnnotation(parameters); 4379 case "Widget": 4380 let fieldType = (0, _core_utils.getInheritableProperty)({ 4381 dict, 4382 key: "FT" 4383 }); 4384 fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null; 4385 switch (fieldType) { 4386 case "Tx": 4387 return new TextWidgetAnnotation(parameters); 4388 case "Btn": 4389 return new ButtonWidgetAnnotation(parameters); 4390 case "Ch": 4391 return new ChoiceWidgetAnnotation(parameters); 4392 case "Sig": 4393 return new SignatureWidgetAnnotation(parameters); 4394 } 4395 (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type."); 4396 return new WidgetAnnotation(parameters); 4397 case "Popup": 4398 return new PopupAnnotation(parameters); 4399 case "FreeText": 4400 return new FreeTextAnnotation(parameters); 4401 case "Line": 4402 return new LineAnnotation(parameters); 4403 case "Square": 4404 return new SquareAnnotation(parameters); 4405 case "Circle": 4406 return new CircleAnnotation(parameters); 4407 case "PolyLine": 4408 return new PolylineAnnotation(parameters); 4409 case "Polygon": 4410 return new PolygonAnnotation(parameters); 4411 case "Caret": 4412 return new CaretAnnotation(parameters); 4413 case "Ink": 4414 return new InkAnnotation(parameters); 4415 case "Highlight": 4416 return new HighlightAnnotation(parameters); 4417 case "Underline": 4418 return new UnderlineAnnotation(parameters); 4419 case "Squiggly": 4420 return new SquigglyAnnotation(parameters); 4421 case "StrikeOut": 4422 return new StrikeOutAnnotation(parameters); 4423 case "Stamp": 4424 return new StampAnnotation(parameters); 4425 case "FileAttachment": 4426 return new FileAttachmentAnnotation(parameters); 4427 default: 4428 if (!collectFields) { 4429 if (!subtype) { 4430 (0, _util.warn)("Annotation is missing the required /Subtype."); 4431 } else { 4432 (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation."); 4433 } 4434 } 4435 return new Annotation(parameters); 4436 } 4437 } 4438 static async _getPageIndex(xref, ref, pdfManager) { 4439 try { 4440 const annotDict = await xref.fetchIfRefAsync(ref); 4441 if (!(annotDict instanceof _primitives.Dict)) { 4442 return -1; 4443 } 4444 const pageRef = annotDict.getRaw("P"); 4445 if (pageRef instanceof _primitives.Ref) { 4446 try { 4447 const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]); 4448 return pageIndex; 4449 } catch (ex) { 4450 (0, _util.info)(`_getPageIndex -- not a valid page reference: "${ex}".`); 4451 } 4452 } 4453 if (annotDict.has("Kids")) { 4454 return -1; 4455 } 4456 const numPages = await pdfManager.ensureDoc("numPages"); 4457 for (let pageIndex = 0; pageIndex < numPages; pageIndex++) { 4458 const page = await pdfManager.getPage(pageIndex); 4459 const annotations = await pdfManager.ensure(page, "annotations"); 4460 for (const annotRef of annotations) { 4461 if (annotRef instanceof _primitives.Ref && (0, _primitives.isRefsEqual)(annotRef, ref)) { 4462 return pageIndex; 4463 } 4464 } 4465 } 4466 } catch (ex) { 4467 (0, _util.warn)(`_getPageIndex: "${ex}".`); 4468 } 4469 return -1; 4470 } 4471 static generateImages(annotations, xref, isOffscreenCanvasSupported) { 4472 if (!isOffscreenCanvasSupported) { 4473 (0, _util.warn)("generateImages: OffscreenCanvas is not supported, cannot save or print some annotations with images."); 4474 return null; 4475 } 4476 let imagePromises; 4477 for (const { 4478 bitmapId, 4479 bitmap 4480 } of annotations) { 4481 if (!bitmap) { 4482 continue; 4483 } 4484 imagePromises ||= new Map(); 4485 imagePromises.set(bitmapId, StampAnnotation.createImage(bitmap, xref)); 4486 } 4487 return imagePromises; 4488 } 4489 static async saveNewAnnotations(evaluator, task, annotations, imagePromises) { 4490 const xref = evaluator.xref; 4491 let baseFontRef; 4492 const dependencies = []; 4493 const promises = []; 4494 const { 4495 isOffscreenCanvasSupported 4496 } = evaluator.options; 4497 for (const annotation of annotations) { 4498 if (annotation.deleted) { 4499 continue; 4500 } 4501 switch (annotation.annotationType) { 4502 case _util.AnnotationEditorType.FREETEXT: 4503 if (!baseFontRef) { 4504 const baseFont = new _primitives.Dict(xref); 4505 baseFont.set("BaseFont", _primitives.Name.get("Helvetica")); 4506 baseFont.set("Type", _primitives.Name.get("Font")); 4507 baseFont.set("Subtype", _primitives.Name.get("Type1")); 4508 baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); 4509 const buffer = []; 4510 baseFontRef = xref.getNewTemporaryRef(); 4511 await (0, _writer.writeObject)(baseFontRef, baseFont, buffer, xref); 4512 dependencies.push({ 4513 ref: baseFontRef, 4514 data: buffer.join("") 4515 }); 4516 } 4517 promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, { 4518 evaluator, 4519 task, 4520 baseFontRef 4521 })); 4522 break; 4523 case _util.AnnotationEditorType.INK: 4524 promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies)); 4525 break; 4526 case _util.AnnotationEditorType.STAMP: 4527 if (!isOffscreenCanvasSupported) { 4528 break; 4529 } 4530 const image = await imagePromises.get(annotation.bitmapId); 4531 if (image.imageStream) { 4532 const { 4533 imageStream, 4534 smaskStream 4535 } = image; 4536 const buffer = []; 4537 if (smaskStream) { 4538 const smaskRef = xref.getNewTemporaryRef(); 4539 await (0, _writer.writeObject)(smaskRef, smaskStream, buffer, xref); 4540 dependencies.push({ 4541 ref: smaskRef, 4542 data: buffer.join("") 4543 }); 4544 imageStream.dict.set("SMask", smaskRef); 4545 buffer.length = 0; 4546 } 4547 const imageRef = image.imageRef = xref.getNewTemporaryRef(); 4548 await (0, _writer.writeObject)(imageRef, imageStream, buffer, xref); 4549 dependencies.push({ 4550 ref: imageRef, 4551 data: buffer.join("") 4552 }); 4553 image.imageStream = image.smaskStream = null; 4554 } 4555 promises.push(StampAnnotation.createNewAnnotation(xref, annotation, dependencies, { 4556 image 4557 })); 4558 break; 4559 } 4560 } 4561 return { 4562 annotations: await Promise.all(promises), 4563 dependencies 4564 }; 4565 } 4566 static async printNewAnnotations(annotationGlobals, evaluator, task, annotations, imagePromises) { 4567 if (!annotations) { 4568 return null; 4569 } 4570 const { 4571 options, 4572 xref 4573 } = evaluator; 4574 const promises = []; 4575 for (const annotation of annotations) { 4576 if (annotation.deleted) { 4577 continue; 4578 } 4579 switch (annotation.annotationType) { 4580 case _util.AnnotationEditorType.FREETEXT: 4581 promises.push(FreeTextAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, { 4582 evaluator, 4583 task, 4584 evaluatorOptions: options 4585 })); 4586 break; 4587 case _util.AnnotationEditorType.INK: 4588 promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, { 4589 evaluatorOptions: options 4590 })); 4591 break; 4592 case _util.AnnotationEditorType.STAMP: 4593 if (!options.isOffscreenCanvasSupported) { 4594 break; 4595 } 4596 const image = await imagePromises.get(annotation.bitmapId); 4597 if (image.imageStream) { 4598 const { 4599 imageStream, 4600 smaskStream 4601 } = image; 4602 if (smaskStream) { 4603 imageStream.dict.set("SMask", smaskStream); 4604 } 4605 image.imageRef = new _jpeg_stream.JpegStream(imageStream, imageStream.length); 4606 image.imageStream = image.smaskStream = null; 4607 } 4608 promises.push(StampAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, { 4609 image, 4610 evaluatorOptions: options 4611 })); 4612 break; 4613 } 4614 } 4615 return Promise.all(promises); 4616 } 4617} 4618exports.AnnotationFactory = AnnotationFactory; 4619function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) { 4620 if (!Array.isArray(color)) { 4621 return defaultColor; 4622 } 4623 const rgbColor = defaultColor || new Uint8ClampedArray(3); 4624 switch (color.length) { 4625 case 0: 4626 return null; 4627 case 1: 4628 _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0); 4629 return rgbColor; 4630 case 3: 4631 _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0); 4632 return rgbColor; 4633 case 4: 4634 _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0); 4635 return rgbColor; 4636 default: 4637 return defaultColor; 4638 } 4639} 4640function getPdfColorArray(color) { 4641 return Array.from(color, c => c / 255); 4642} 4643function getQuadPoints(dict, rect) { 4644 const quadPoints = dict.getArray("QuadPoints"); 4645 if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) { 4646 return null; 4647 } 4648 const quadPointsLists = []; 4649 for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) { 4650 let minX = Infinity, 4651 maxX = -Infinity, 4652 minY = Infinity, 4653 maxY = -Infinity; 4654 for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) { 4655 const x = quadPoints[j]; 4656 const y = quadPoints[j + 1]; 4657 minX = Math.min(x, minX); 4658 maxX = Math.max(x, maxX); 4659 minY = Math.min(y, minY); 4660 maxY = Math.max(y, maxY); 4661 } 4662 if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) { 4663 return null; 4664 } 4665 quadPointsLists.push([{ 4666 x: minX, 4667 y: maxY 4668 }, {
4669 x: maxX, 4670 y: maxY 4671 }, { 4672 x: minX, 4673 y: minY 4674 }, { 4675 x: maxX, 4676 y: minY 4677 }]); 4678 } 4679 return quadPointsLists; 4680} 4681function getTransformMatrix(rect, bbox, matrix) { 4682 const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix); 4683 if (minX === maxX || minY === maxY) { 4684 return [1, 0, 0, 1, rect[0], rect[1]]; 4685 } 4686 const xRatio = (rect[2] - rect[0]) / (maxX - minX); 4687 const yRatio = (rect[3] - rect[1]) / (maxY - minY); 4688 return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio]; 4689} 4690class Annotation { 4691 constructor(params) { 4692 const { 4693 dict, 4694 xref, 4695 annotationGlobals 4696 } = params; 4697 this.setTitle(dict.get("T")); 4698 this.setContents(dict.get("Contents")); 4699 this.setModificationDate(dict.get("M")); 4700 this.setFlags(dict.get("F")); 4701 this.setRectangle(dict.getArray("Rect")); 4702 this.setColor(dict.getArray("C")); 4703 this.setBorderStyle(dict); 4704 this.setAppearance(dict); 4705 this.setOptionalContent(dict); 4706 const MK = dict.get("MK"); 4707 this.setBorderAndBackgroundColors(MK); 4708 this.setRotation(MK, dict); 4709 this.ref = params.ref instanceof _primitives.Ref ? params.ref : null; 4710 this._streams = []; 4711 if (this.appearance) { 4712 this._streams.push(this.appearance); 4713 } 4714 const isLocked = !!(this.flags & _util.AnnotationFlag.LOCKED); 4715 const isContentLocked = !!(this.flags & _util.AnnotationFlag.LOCKEDCONTENTS); 4716 if (annotationGlobals.structTreeRoot) { 4717 let structParent = dict.get("StructParent"); 4718 structParent = Number.isInteger(structParent) && structParent >= 0 ? structParent : -1; 4719 annotationGlobals.structTreeRoot.addAnnotationIdToPage(params.pageRef, structParent); 4720 } 4721 this.data = { 4722 annotationFlags: this.flags, 4723 borderStyle: this.borderStyle, 4724 color: this.color, 4725 backgroundColor: this.backgroundColor, 4726 borderColor: this.borderColor, 4727 rotation: this.rotation, 4728 contentsObj: this._contents, 4729 hasAppearance: !!this.appearance, 4730 id: params.id, 4731 modificationDate: this.modificationDate, 4732 rect: this.rectangle, 4733 subtype: params.subtype, 4734 hasOwnCanvas: false, 4735 noRotate: !!(this.flags & _util.AnnotationFlag.NOROTATE), 4736 noHTML: isLocked && isContentLocked 4737 }; 4738 if (params.collectFields) { 4739 const kids = dict.get("Kids"); 4740 if (Array.isArray(kids)) { 4741 const kidIds = []; 4742 for (const kid of kids) { 4743 if (kid instanceof _primitives.Ref) { 4744 kidIds.push(kid.toString()); 4745 } 4746 } 4747 if (kidIds.length !== 0) { 4748 this.data.kidIds = kidIds; 4749 } 4750 } 4751 this.data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType); 4752 this.data.fieldName = this._constructFieldName(dict); 4753 this.data.pageIndex = params.pageIndex; 4754 } 4755 this._isOffscreenCanvasSupported = params.evaluatorOptions.isOffscreenCanvasSupported; 4756 this._fallbackFontDict = null; 4757 this._needAppearances = false; 4758 } 4759 _hasFlag(flags, flag) { 4760 return !!(flags & flag); 4761 } 4762 _isViewable(flags) { 4763 return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW); 4764 } 4765 _isPrintable(flags) { 4766 return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE); 4767 } 4768 mustBeViewed(annotationStorage, _renderForms) { 4769 const noView = annotationStorage?.get(this.data.id)?.noView; 4770 if (noView !== undefined) { 4771 return !noView; 4772 } 4773 return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN); 4774 } 4775 mustBePrinted(annotationStorage) { 4776 const noPrint = annotationStorage?.get(this.data.id)?.noPrint; 4777 if (noPrint !== undefined) { 4778 return !noPrint; 4779 } 4780 return this.printable; 4781 } 4782 get viewable() { 4783 if (this.data.quadPoints === null) { 4784 return false; 4785 } 4786 if (this.flags === 0) { 4787 return true; 4788 } 4789 return this._isViewable(this.flags); 4790 } 4791 get printable() { 4792 if (this.data.quadPoints === null) { 4793 return false;
4794 } 4795 if (this.flags === 0) { 4796 return false; 4797 } 4798 return this._isPrintable(this.flags); 4799 } 4800 _parseStringHelper(data) { 4801 const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : ""; 4802 const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr"; 4803 return { 4804 str, 4805 dir 4806 }; 4807 } 4808 setDefaultAppearance(params) { 4809 const { 4810 dict, 4811 annotationGlobals 4812 } = params; 4813 const defaultAppearance = (0, _core_utils.getInheritableProperty)({ 4814 dict, 4815 key: "DA" 4816 }) || annotationGlobals.acroForm.get("DA"); 4817 this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : ""; 4818 this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance); 4819 } 4820 setTitle(title) { 4821 this._title = this._parseStringHelper(title); 4822 } 4823 setContents(contents) { 4824 this._contents = this._parseStringHelper(contents); 4825 } 4826 setModificationDate(modificationDate) { 4827 this.modificationDate = typeof modificationDate === "string" ? modificationDate : null; 4828 } 4829 setFlags(flags) { 4830 this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0; 4831 } 4832 hasFlag(flag) { 4833 return this._hasFlag(this.flags, flag); 4834 } 4835 setRectangle(rectangle) { 4836 this.rectangle = Array.isArray(rectangle) && rectangle.length === 4 ? _util.Util.normalizeRect(rectangle) : [0, 0, 0, 0]; 4837 } 4838 setColor(color) { 4839 this.color = getRgbColor(color); 4840 } 4841 setLineEndings(lineEndings) { 4842 this.lineEndings = ["None", "None"]; 4843 if (Array.isArray(lineEndings) && lineEndings.length === 2) { 4844 for (let i = 0; i < 2; i++) { 4845 const obj = lineEndings[i]; 4846 if (obj instanceof _primitives.Name) { 4847 switch (obj.name) { 4848 case "None": 4849 continue; 4850 case "Square": 4851 case "Circle": 4852 case "Diamond": 4853 case "OpenArrow": 4854 case "ClosedArrow": 4855 case "Butt": 4856 case "ROpenArrow": 4857 case "RClosedArrow": 4858 case "Slash": 4859 this.lineEndings[i] = obj.name; 4860 continue; 4861 } 4862 } 4863 (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`); 4864 } 4865 } 4866 } 4867 setRotation(mk, dict) { 4868 this.rotation = 0; 4869 let angle = mk instanceof _primitives.Dict ? mk.get("R") || 0 : dict.get("Rotate") || 0; 4870 if (Number.isInteger(angle) && angle !== 0) { 4871 angle %= 360; 4872 if (angle < 0) { 4873 angle += 360; 4874 } 4875 if (angle % 90 === 0) { 4876 this.rotation = angle; 4877 } 4878 } 4879 } 4880 setBorderAndBackgroundColors(mk) { 4881 if (mk instanceof _primitives.Dict) { 4882 this.borderColor = getRgbColor(mk.getArray("BC"), null); 4883 this.backgroundColor = getRgbColor(mk.getArray("BG"), null); 4884 } else { 4885 this.borderColor = this.backgroundColor = null; 4886 } 4887 } 4888 setBorderStyle(borderStyle) { 4889 this.borderStyle = new AnnotationBorderStyle(); 4890 if (!(borderStyle instanceof _primitives.Dict)) { 4891 return; 4892 } 4893 if (borderStyle.has("BS")) { 4894 const dict = borderStyle.get("BS"); 4895 const dictType = dict.get("Type"); 4896 if (!dictType || (0, _primitives.isName)(dictType, "Border")) { 4897 this.borderStyle.setWidth(dict.get("W"), this.rectangle); 4898 this.borderStyle.setStyle(dict.get("S")); 4899 this.borderStyle.setDashArray(dict.getArray("D")); 4900 } 4901 } else if (borderStyle.has("Border")) { 4902 const array = borderStyle.getArray("Border"); 4903 if (Array.isArray(array) && array.length >= 3) { 4904 this.borderStyle.setHorizontalCornerRadius(array[0]); 4905 this.borderStyle.setVerticalCornerRadius(array[1]); 4906 this.borderStyle.setWidth(array[2], this.rectangle); 4907 if (array.length === 4) { 4908 this.borderStyle.setDashArray(array[3], true); 4909 } 4910 } 4911 } else { 4912 this.borderStyle.setWidth(0); 4913 } 4914 } 4915 setAppearance(dict) { 4916 this.appearance = null; 4917 const appearanceStates = dict.get("AP"); 4918 if (!(appearanceStates instanceof _primitives.Dict)) { 4919 return; 4920 } 4921 const normalAppearanceState = appearanceStates.get("N"); 4922 if (normalAppearanceState instanceof _base_stream.BaseStream) { 4923 this.appearance = normalAppearanceState; 4924 return; 4925 } 4926 if (!(normalAppearanceState instanceof _primitives.Dict)) { 4927 return; 4928 } 4929 const as = dict.get("AS"); 4930 if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) { 4931 return; 4932 } 4933 const appearance = normalAppearanceState.get(as.name); 4934 if (appearance instanceof _base_stream.BaseStream) { 4935 this.appearance = appearance; 4936 } 4937 } 4938 setOptionalContent(dict) { 4939 this.oc = null; 4940 const oc = dict.get("OC"); 4941 if (oc instanceof _primitives.Name) {
4942 (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented."); 4943 } else if (oc instanceof _primitives.Dict) { 4944 this.oc = oc; 4945 } 4946 } 4947 loadResources(keys, appearance) { 4948 return appearance.dict.getAsync("Resources").then(resources => { 4949 if (!resources) { 4950 return undefined; 4951 } 4952 const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref); 4953 return objectLoader.load().then(function () { 4954 return resources; 4955 }); 4956 }); 4957 } 4958 async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) { 4959 const data = this.data; 4960 let appearance = this.appearance; 4961 const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY); 4962 if (!appearance) { 4963 if (!isUsingOwnCanvas) { 4964 return { 4965 opList: new _operator_list.OperatorList(), 4966 separateForm: false, 4967 separateCanvas: false 4968 }; 4969 } 4970 appearance = new _stream.StringStream(""); 4971 appearance.dict = new _primitives.Dict(); 4972 } 4973 const appearanceDict = appearance.dict; 4974 const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance); 4975 const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1]; 4976 const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0]; 4977 const transform = getTransformMatrix(data.rect, bbox, matrix); 4978 const opList = new _operator_list.OperatorList(); 4979 let optionalContent; 4980 if (this.oc) { 4981 optionalContent = await evaluator.parseMarkedContentProps(this.oc, null); 4982 } 4983 if (optionalContent !== undefined) { 4984 opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 4985 } 4986 opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]); 4987 await evaluator.getOperatorList({ 4988 stream: appearance, 4989 task, 4990 resources, 4991 operatorList: opList, 4992 fallbackFontDict: this._fallbackFontDict 4993 }); 4994 opList.addOp(_util.OPS.endAnnotation, []); 4995 if (optionalContent !== undefined) { 4996 opList.addOp(_util.OPS.endMarkedContent, []); 4997 } 4998 this.reset(); 4999 return { 5000 opList, 5001 separateForm: false, 5002 separateCanvas: isUsingOwnCanvas 5003 }; 5004 } 5005 async save(evaluator, task, annotationStorage) { 5006 return null; 5007 } 5008 get hasTextContent() { 5009 return false; 5010 } 5011 async extractTextContent(evaluator, task, viewBox) { 5012 if (!this.appearance) { 5013 return; 5014 } 5015 const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance); 5016 const text = []; 5017 const buffer = []; 5018 let firstPosition = null; 5019 const sink = { 5020 desiredSize: Math.Infinity, 5021 ready: true, 5022 enqueue(chunk, size) { 5023 for (const item of chunk.items) { 5024 if (item.str === undefined) { 5025 continue; 5026 } 5027 firstPosition ||= item.transform.slice(-2); 5028 buffer.push(item.str); 5029 if (item.hasEOL) { 5030 text.push(buffer.join("")); 5031 buffer.length = 0; 5032 } 5033 } 5034 } 5035 }; 5036 await evaluator.getTextContent({ 5037 stream: this.appearance, 5038 task, 5039 resources, 5040 includeMarkedContent: true, 5041 sink, 5042 viewBox 5043 }); 5044 this.reset(); 5045 if (buffer.length) { 5046 text.push(buffer.join("")); 5047 } 5048 if (text.length > 1 || text[0]) { 5049 const appearanceDict = this.appearance.dict; 5050 const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1]; 5051 const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0]; 5052 const rect = this.data.rect; 5053 const transform = getTransformMatrix(rect, bbox, matrix); 5054 transform[4] -= rect[0]; 5055 transform[5] -= rect[1]; 5056 firstPosition = _util.Util.applyTransform(firstPosition, transform); 5057 firstPosition = _util.Util.applyTransform(firstPosition, matrix); 5058 this.data.textPosition = firstPosition; 5059 this.data.textContent = text; 5060 } 5061 } 5062 getFieldObject() { 5063 if (this.data.kidIds) { 5064 return { 5065 id: this.data.id, 5066 actions: this.data.actions, 5067 name: this.data.fieldName, 5068 strokeColor: this.data.borderColor, 5069 fillColor: this.data.backgroundColor, 5070 type: "", 5071 kidIds: this.data.kidIds, 5072 page: this.data.pageIndex, 5073 rotation: this.rotation 5074 }; 5075 } 5076 return null; 5077 } 5078 reset() { 5079 for (const stream of this._streams) { 5080 stream.reset(); 5081 } 5082 } 5083 _constructFieldName(dict) { 5084 if (!dict.has("T") && !dict.has("Parent")) { 5085 (0, _util.warn)("Unknown field name, falling back to empty field name."); 5086 return ""; 5087 } 5088 if (!dict.has("Parent")) { 5089 return (0, _util.stringToPDFString)(dict.get("T")); 5090 } 5091 const fieldName = []; 5092 if (dict.has("T")) { 5093 fieldName.unshift((0, _util.stringToPDFString)(dict.get("T"))); 5094 } 5095 let loopDict = dict; 5096 const visited = new _primitives.RefSet(); 5097 if (dict.objId) { 5098 visited.put(dict.objId); 5099 } 5100 while (loopDict.has("Parent")) { 5101 loopDict = loopDict.get("Parent"); 5102 if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) { 5103 break; 5104 } 5105 if (loopDict.objId) { 5106 visited.put(loopDict.objId); 5107 } 5108 if (loopDict.has("T")) { 5109 fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T"))); 5110 } 5111 } 5112 return fieldName.join("."); 5113 } 5114} 5115exports.Annotation = Annotation; 5116class AnnotationBorderStyle { 5117 constructor() { 5118 this.width = 1; 5119 this.style = _util.AnnotationBorderStyleType.SOLID; 5120 this.dashArray = [3]; 5121 this.horizontalCornerRadius = 0; 5122 this.verticalCornerRadius = 0; 5123 } 5124 setWidth(width, rect = [0, 0, 0, 0]) { 5125 if (width instanceof _primitives.Name) { 5126 this.width = 0; 5127 return; 5128 } 5129 if (typeof width === "number") { 5130 if (width > 0) { 5131 const maxWidth = (rect[2] - rect[0]) / 2; 5132 const maxHeight = (rect[3] - rect[1]) / 2; 5133 if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) { 5134 (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`); 5135 width = 1; 5136 } 5137 } 5138 this.width = width; 5139 } 5140 } 5141 setStyle(style) { 5142 if (!(style instanceof _primitives.Name)) { 5143 return; 5144 } 5145 switch (style.name) { 5146 case "S": 5147 this.style = _util.AnnotationBorderStyleType.SOLID; 5148 break; 5149 case "D": 5150 this.style = _util.AnnotationBorderStyleType.DASHED; 5151 break; 5152 case "B": 5153 this.style = _util.AnnotationBorderStyleType.BEVELED; 5154 break; 5155 case "I": 5156 this.style = _util.AnnotationBorderStyleType.INSET; 5157 break; 5158 case "U": 5159 this.style = _util.AnnotationBorderStyleType.UNDERLINE; 5160 break; 5161 default: 5162 break; 5163 } 5164 } 5165 setDashArray(dashArray, forceStyle = false) { 5166 if (Array.isArray(dashArray) && dashArray.length > 0) { 5167 let isValid = true; 5168 let allZeros = true; 5169 for (const element of dashArray) { 5170 const validNumber = +element >= 0; 5171 if (!validNumber) { 5172 isValid = false;
5173 break; 5174 } else if (element > 0) { 5175 allZeros = false; 5176 } 5177 } 5178 if (isValid && !allZeros) { 5179 this.dashArray = dashArray; 5180 if (forceStyle) { 5181 this.setStyle(_primitives.Name.get("D")); 5182 } 5183 } else { 5184 this.width = 0; 5185 } 5186 } else if (dashArray) { 5187 this.width = 0; 5188 } 5189 } 5190 setHorizontalCornerRadius(radius) { 5191 if (Number.isInteger(radius)) { 5192 this.horizontalCornerRadius = radius; 5193 } 5194 } 5195 setVerticalCornerRadius(radius) { 5196 if (Number.isInteger(radius)) { 5197 this.verticalCornerRadius = radius; 5198 } 5199 } 5200} 5201exports.AnnotationBorderStyle = AnnotationBorderStyle; 5202class MarkupAnnotation extends Annotation { 5203 constructor(params) { 5204 super(params); 5205 const { 5206 dict 5207 } = params; 5208 if (dict.has("IRT")) { 5209 const rawIRT = dict.getRaw("IRT"); 5210 this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null; 5211 const rt = dict.get("RT"); 5212 this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY; 5213 } 5214 let popupRef = null; 5215 if (this.data.replyType === _util.AnnotationReplyType.GROUP) { 5216 const parent = dict.get("IRT"); 5217 this.setTitle(parent.get("T")); 5218 this.data.titleObj = this._title; 5219 this.setContents(parent.get("Contents")); 5220 this.data.contentsObj = this._contents; 5221 if (!parent.has("CreationDate")) { 5222 this.data.creationDate = null; 5223 } else { 5224 this.setCreationDate(parent.get("CreationDate")); 5225 this.data.creationDate = this.creationDate; 5226 } 5227 if (!parent.has("M")) { 5228 this.data.modificationDate = null; 5229 } else { 5230 this.setModificationDate(parent.get("M")); 5231 this.data.modificationDate = this.modificationDate; 5232 } 5233 popupRef = parent.getRaw("Popup"); 5234 if (!parent.has("C")) { 5235 this.data.color = null; 5236 } else { 5237 this.setColor(parent.getArray("C")); 5238 this.data.color = this.color; 5239 } 5240 } else { 5241 this.data.titleObj = this._title; 5242 this.setCreationDate(dict.get("CreationDate")); 5243 this.data.creationDate = this.creationDate; 5244 popupRef = dict.getRaw("Popup"); 5245 if (!dict.has("C")) { 5246 this.data.color = null; 5247 } 5248 } 5249 this.data.popupRef = popupRef instanceof _primitives.Ref ? popupRef.toString() : null; 5250 if (dict.has("RC")) { 5251 this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC")); 5252 } 5253 } 5254 setCreationDate(creationDate) { 5255 this.creationDate = typeof creationDate === "string" ? creationDate : null; 5256 } 5257 _setDefaultAppearance({ 5258 xref, 5259 extra, 5260 strokeColor, 5261 fillColor, 5262 blendMode, 5263 strokeAlpha, 5264 fillAlpha, 5265 pointsCallback 5266 }) { 5267 let minX = Number.MAX_VALUE; 5268 let minY = Number.MAX_VALUE; 5269 let maxX = Number.MIN_VALUE; 5270 let maxY = Number.MIN_VALUE; 5271 const buffer = ["q"]; 5272 if (extra) { 5273 buffer.push(extra); 5274 } 5275 if (strokeColor) { 5276 buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`); 5277 } 5278 if (fillColor) { 5279 buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`); 5280 } 5281 let pointsArray = this.data.quadPoints; 5282 if (!pointsArray) { 5283 pointsArray = [[{ 5284 x: this.rectangle[0], 5285 y: this.rectangle[3] 5286 }, { 5287 x: this.rectangle[2], 5288 y: this.rectangle[3] 5289 }, { 5290 x: this.rectangle[0], 5291 y: this.rectangle[1] 5292 }, { 5293 x: this.rectangle[2], 5294 y: this.rectangle[1] 5295 }]]; 5296 } 5297 for (const points of pointsArray) { 5298 const [mX, MX, mY, MY] = pointsCallback(buffer, points); 5299 minX = Math.min(minX, mX); 5300 maxX = Math.max(maxX, MX); 5301 minY = Math.min(minY, mY); 5302 maxY = Math.max(maxY, MY); 5303 } 5304 buffer.push("Q"); 5305 const formDict = new _primitives.Dict(xref); 5306 const appearanceStreamDict = new _primitives.Dict(xref); 5307 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 5308 const appearanceStream = new _stream.StringStream(buffer.join(" ")); 5309 appearanceStream.dict = appearanceStreamDict; 5310 formDict.set("Fm0", appearanceStream); 5311 const gsDict = new _primitives.Dict(xref); 5312 if (blendMode) { 5313 gsDict.set("BM", _primitives.Name.get(blendMode)); 5314 } 5315 if (typeof strokeAlpha === "number") { 5316 gsDict.set("CA", strokeAlpha); 5317 } 5318 if (typeof fillAlpha === "number") { 5319 gsDict.set("ca", fillAlpha); 5320 } 5321 const stateDict = new _primitives.Dict(xref); 5322 stateDict.set("GS0", gsDict); 5323 const resources = new _primitives.Dict(xref); 5324 resources.set("ExtGState", stateDict); 5325 resources.set("XObject", formDict); 5326 const appearanceDict = new _primitives.Dict(xref); 5327 appearanceDict.set("Resources", resources); 5328 const bbox = this.data.rect = [minX, minY, maxX, maxY]; 5329 appearanceDict.set("BBox", bbox); 5330 this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do"); 5331 this.appearance.dict = appearanceDict; 5332 this._streams.push(this.appearance, appearanceStream); 5333 } 5334 static async createNewAnnotation(xref, annotation, dependencies, params) { 5335 const annotationRef = annotation.ref ||= xref.getNewTemporaryRef(); 5336 const ap = await this.createNewAppearanceStream(annotation, xref, params); 5337 const buffer = []; 5338 let annotationDict; 5339 if (ap) { 5340 const apRef = xref.getNewTemporaryRef(); 5341 annotationDict = this.createNewDict(annotation, xref, { 5342 apRef 5343 }); 5344 await (0, _writer.writeObject)(apRef, ap, buffer, xref); 5345 dependencies.push({ 5346 ref: apRef, 5347 data: buffer.join("") 5348 }); 5349 } else { 5350 annotationDict = this.createNewDict(annotation, xref, {}); 5351 } 5352 if (Number.isInteger(annotation.parentTreeId)) { 5353 annotationDict.set("StructParent", annotation.parentTreeId); 5354 } 5355 buffer.length = 0; 5356 await (0, _writer.writeObject)(annotationRef, annotationDict, buffer, xref); 5357 return { 5358 ref: annotationRef, 5359 data: buffer.join("") 5360 }; 5361 } 5362 static async createNewPrintAnnotation(annotationGlobals, xref, annotation, params) { 5363 const ap = await this.createNewAppearanceStream(annotation, xref, params); 5364 const annotationDict = this.createNewDict(annotation, xref, { 5365 ap 5366 }); 5367 const newAnnotation = new this.prototype.constructor({ 5368 dict: annotationDict, 5369 xref, 5370 annotationGlobals, 5371 evaluatorOptions: params.evaluatorOptions 5372 }); 5373 if (annotation.ref) { 5374 newAnnotation.ref = newAnnotation.refToReplace = annotation.ref; 5375 } 5376 return newAnnotation; 5377 } 5378} 5379exports.MarkupAnnotation = MarkupAnnotation; 5380class WidgetAnnotation extends Annotation { 5381 constructor(params) { 5382 super(params); 5383 const { 5384 dict, 5385 xref, 5386 annotationGlobals 5387 } = params; 5388 const data = this.data; 5389 this._needAppearances = params.needAppearances; 5390 data.annotationType = _util.AnnotationType.WIDGET; 5391 if (data.fieldName === undefined) { 5392 data.fieldName = this._constructFieldName(dict); 5393 } 5394 if (data.actions === undefined) { 5395 data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType); 5396 } 5397 let fieldValue = (0, _core_utils.getInheritableProperty)({ 5398 dict, 5399 key: "V", 5400 getArray: true 5401 }); 5402 data.fieldValue = this._decodeFormValue(fieldValue); 5403 const defaultFieldValue = (0, _core_utils.getInheritableProperty)({ 5404 dict, 5405 key: "DV", 5406 getArray: true 5407 }); 5408 data.defaultFieldValue = this._decodeFormValue(defaultFieldValue); 5409 if (fieldValue === undefined && annotationGlobals.xfaDatasets) { 5410 const path = this._title.str; 5411 if (path) { 5412 this._hasValueFromXFA = true; 5413 data.fieldValue = fieldValue = annotationGlobals.xfaDatasets.getValue(path); 5414 } 5415 } 5416 if (fieldValue === undefined && data.defaultFieldValue !== null) { 5417 data.fieldValue = data.defaultFieldValue; 5418 } 5419 data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || ""); 5420 this.setDefaultAppearance(params); 5421 data.hasAppearance ||= this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null; 5422 const fieldType = (0, _core_utils.getInheritableProperty)({ 5423 dict, 5424 key: "FT" 5425 }); 5426 data.fieldType = fieldType instanceof _primitives.Name ? fieldType.n
5426ame : null; 5427 const localResources = (0, _core_utils.getInheritableProperty)({ 5428 dict, 5429 key: "DR" 5430 }); 5431 const acroFormResources = annotationGlobals.acroForm.get("DR"); 5432 const appearanceResources = this.appearance?.dict.get("Resources"); 5433 this._fieldResources = { 5434 localResources, 5435 acroFormResources, 5436 appearanceResources, 5437 mergedResources: _primitives.Dict.merge({ 5438 xref, 5439 dictArray: [localResources, appearanceResources, acroFormResources], 5440 mergeSubDicts: true 5441 }) 5442 }; 5443 data.fieldFlags = (0, _core_utils.getInheritableProperty)({ 5444 dict, 5445 key: "Ff" 5446 }); 5447 if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) { 5448 data.fieldFlags = 0; 5449 } 5450 data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY); 5451 data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED); 5452 data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN) || this._hasFlag(data.annotationFlags, _util.AnnotationFlag.NOVIEW); 5453 } 5454 _decodeFormValue(formValue) { 5455 if (Array.isArray(formValue)) { 5456 return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item)); 5457 } else if (formValue instanceof _primitives.Name) { 5458 return (0, _util.stringToPDFString)(formValue.name); 5459 } else if (typeof formValue === "string") { 5460 return (0, _util.stringToPDFString)(formValue); 5461 } 5462 return null; 5463 } 5464 hasFieldFlag(flag) { 5465 return !!(this.data.fieldFlags & flag); 5466 } 5467 _isViewable(flags) { 5468 return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE); 5469 } 5470 mustBeViewed(annotationStorage, renderForms) { 5471 if (renderForms) { 5472 return this.viewable; 5473 } 5474 return super.mustBeViewed(annotationStorage, renderForms) && !this._hasFlag(this.flags, _util.AnnotationFlag.NOVIEW); 5475 } 5476 getRotationMatrix(annotationStorage) { 5477 let rotation = annotationStorage?.get(this.data.id)?.rotation; 5478 if (rotation === undefined) { 5479 rotation = this.rotation; 5480 } 5481 if (rotation === 0) { 5482 return _util.IDENTITY_MATRIX; 5483 } 5484 const width = this.data.rect[2] - this.data.rect[0]; 5485 const height = this.data.rect[3] - this.data.rect[1]; 5486 return (0, _core_utils.getRotationMatrix)(rotation, width, height); 5487 } 5488 getBorderAndBackgroundAppearances(annotationStorage) { 5489 let rotation = annotationStorage?.get(this.data.id)?.rotation; 5490 if (rotation === undefined) { 5491 rotation = this.rotation; 5492 } 5493 if (!this.backgroundColor && !this.borderColor) { 5494 return ""; 5495 } 5496 const width = this.data.rect[2] - this.data.rect[0]; 5497 const height = this.data.rect[3] - this.data.rect[1]; 5498 const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`; 5499 let str = ""; 5500 if (this.backgroundColor) { 5501 str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `; 5502 } 5503 if (this.borderColor) { 5504 const borderWidth = this.borderStyle.width || 1; 5505 str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `; 5506 } 5507 return str; 5508 } 5509 async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) { 5510 if (renderForms && !(this instanceof SignatureWidgetAnnotation) && !this.data.noHTML && !this.data.hasOwnCanvas) { 5511 return { 5512 opList: new _operator_list.OperatorList(), 5513 separateForm: true, 5514 separateCanvas: false 5515 }; 5516 } 5517 if (!this._hasText) { 5518 return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 5519 } 5520 const content = await this._getAppearance(evaluator, task, intent, annotationStorage); 5521 if (this.appearance && content === null) { 5522 return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 5523 } 5524 const opList = new _operator_list.OperatorList(); 5525 if (!this._defaultAppearance || content === null) { 5526 return { 5527 opList, 5528 separateForm: false, 5529 separateCanvas: false 5530 }; 5531 } 5532 const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY); 5533 const matrix = [1, 0, 0, 1, 0, 0]; 5534 const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]; 5535 const transform = getTransformMatrix(this.data.rect, bbox, matrix); 5536 let optionalContent; 5537 if (this.oc) { 5538 optionalContent = await evaluator.parseMarkedContentProps(this.oc, null); 5539 } 5540 if (optionalContent !== undefined) { 5541 opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 5542 } 5543 opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), isUsingOwnCanvas]); 5544 const stream = new _stream.StringStream(content); 5545 await evaluator.getOperatorList({ 5546 stream, 5547 task, 5548 resources: this._fieldResources.mergedResources, 5549 operatorList: opList 5550 }); 5551 opList.addOp(_util.OPS.endAnnotation, []); 5552 if (optionalContent !== undefined) { 5553 opList.addOp(_util.OPS.endMarkedContent, []); 5554 } 5555 return { 5556 opList, 5557 separateForm: false, 5558 separateCanvas: isUsingOwnCanvas 5559 }; 5560 } 5561 _getMKDict(rotation) { 5562 const mk = new _primitives.Dict(null); 5563 if (rotation) { 5564 mk.set("R", rotation); 5565 } 5566 if (this.borderColor) { 5567 mk.set("BC", getPdfColorArray(this.borderColor)); 5568 } 5569 if (this.backgroundColor) { 5570 mk.set("BG", getPdfColorArray(this.backgroundColor)); 5571 } 5572 return mk.size > 0 ? mk : null; 5573 } 5574 amendSavedDict(annotationStorage, dict) {} 5575 async save(evaluator, task, annotationStorage) { 5576 const storageEntry = annotationStorage?.get(this.data.id); 5577 let value = storageEntry?.value, 5578 rotation = storageEntry?.rotation; 5579 if (value === this.data.fieldValue || value === undefined) { 5580 if (!this._hasValueFromXFA && rotation === undefined) { 5581 return null; 5582 } 5583 value ||= this.data.fieldValue; 5584 } 5585 if (rotation === undefined && !this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && value.length === this.data.fieldValue.length && value.every((x, i) => x === this.data.fieldValue[i])) { 5586 return null; 5587 } 5588 if (rotation === undefined) { 5589 rotation = this.rotation; 5590 } 5591 let appearance = null; 5592 if (!this._needAppearances) { 5593 appearance = await this._getAppearance(evaluator, task, _util.RenderingIntentFlag.SAVE, annotationStorage); 5594 if (appearance === null) { 5595 return null; 5596 } 5597 } else {} 5598 let needAppearances = false;
5599 if (appearance?.needAppearances) { 5600 needAppearances = true; 5601 appearance = null; 5602 } 5603 const { 5604 xref 5605 } = evaluator; 5606 const originalDict = xref.fetchIfRef(this.ref); 5607 if (!(originalDict instanceof _primitives.Dict)) { 5608 return null; 5609 } 5610 const dict = new _primitives.Dict(xref); 5611 for (const key of originalDict.getKeys()) { 5612 if (key !== "AP") { 5613 dict.set(key, originalDict.getRaw(key)); 5614 } 5615 } 5616 const xfa = { 5617 path: this.data.fieldName, 5618 value 5619 }; 5620 const encoder = val => { 5621 return (0, _core_utils.isAscii)(val) ? val : (0, _core_utils.stringToUTF16String)(val, true); 5622 }; 5623 dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value)); 5624 this.amendSavedDict(annotationStorage, dict); 5625 const maybeMK = this._getMKDict(rotation); 5626 if (maybeMK) { 5627 dict.set("MK", maybeMK); 5628 } 5629 const buffer = []; 5630 const changes = [{ 5631 ref: this.ref, 5632 data: "", 5633 xfa, 5634 needAppearances 5635 }]; 5636 if (appearance !== null) { 5637 const newRef = xref.getNewTemporaryRef(); 5638 const AP = new _primitives.Dict(xref); 5639 dict.set("AP", AP); 5640 AP.set("N", newRef); 5641 const resources = this._getSaveFieldResources(xref); 5642 const appearanceStream = new _stream.StringStream(appearance); 5643 const appearanceDict = appearanceStream.dict = new _primitives.Dict(xref); 5644 appearanceDict.set("Subtype", _primitives.Name.get("Form")); 5645 appearanceDict.set("Resources", resources); 5646 appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]); 5647 const rotationMatrix = this.getRotationMatrix(annotationStorage); 5648 if (rotationMatrix !== _util.IDENTITY_MATRIX) { 5649 appearanceDict.set("Matrix", rotationMatrix); 5650 } 5651 await (0, _writer.writeObject)(newRef, appearanceStream, buffer, xref); 5652 changes.push({ 5653 ref: newRef, 5654 data: buffer.join(""), 5655 xfa: null, 5656 needAppearances: false 5657 }); 5658 buffer.length = 0; 5659 } 5660 dict.set("M", `D:${(0, _util.getModificationDate)()}`); 5661 await (0, _writer.writeObject)(this.ref, dict, buffer, xref); 5662 changes[0].data = buffer.join(""); 5663 return changes; 5664 } 5665 async _getAppearance(evaluator, task, intent, annotationStorage) { 5666 const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD); 5667 if (isPassword) { 5668 return null; 5669 } 5670 const storageEntry = annotationStorage?.get(this.data.id); 5671 let value, rotation; 5672 if (storageEntry) { 5673 value = storageEntry.formattedValue || storageEntry.value; 5674 rotation = storageEntry.rotation; 5675 } 5676 if (rotation === undefined && value === undefined && !this._needAppearances) { 5677 if (!this._hasValueFromXFA || this.appearance) { 5678 return null; 5679 } 5680 } 5681 const colors = this.getBorderAndBackgroundAppearances(annotationStorage); 5682 if (value === undefined) { 5683 value = this.data.fieldValue; 5684 if (!value) { 5685 return `/Tx BMC q ${colors}Q EMC`; 5686 } 5687 } 5688 if (Array.isArray(value) && value.length === 1) { 5689 value = value[0]; 5690 } 5691 (0, _util.assert)(typeof value === "string", "Expected `value` to be a string."); 5692 value = value.trim(); 5693 if (this.data.combo) { 5694 const option = this.data.options.find(({ 5695 exportValue 5696 }) => value === exportValue); 5697 value = option?.displayValue || value; 5698 } 5699 if (value === "") { 5700 return `/Tx BMC q ${colors}Q EMC`; 5701 } 5702 if (rotation === undefined) { 5703 rotation = this.rotation; 5704 } 5705 let lineCount = -1; 5706 let lines; 5707 if (this.data.multiLine) { 5708 lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC")); 5709 lineCount = lines.length; 5710 } else { 5711 lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")]; 5712 } 5713 const defaultPadding = 1; 5714 const defaultHPadding = 2; 5715 let totalHeight = this.data.rect[3] - this.data.rect[1]; 5716 let totalWidth = this.data.rect[2] - this.data.rect[0]; 5717 if (rotation === 90 || rotation === 270) { 5718 [totalWidth, totalHeight] = [totalHeight, totalWidth]; 5719 } 5720 if (!this._defaultAppearance) { 5721 this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g"); 5722 } 5723 let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources); 5724 let defaultAppearance, fontSize, lineHeight; 5725 const encodedLines = []; 5726 let encodingError = false;
vendor: 5,582 bytes, lines 5727-5847
5727 for (const line of lines) { 5728 const encodedString = font.encodeString(line); 5729 if (encodedString.length > 1) { 5730 encodingError = true; 5731 } 5732 encodedLines.push(encodedString.join("")); 5733 } 5734 if (encodingError && intent & _util.RenderingIntentFlag.SAVE) { 5735 return { 5736 needAppearances: true 5737 }; 5738 } 5739 if (encodingError && this._isOffscreenCanvasSupported) { 5740 const fontFamily = this.data.comb ? "monospace" : "sans-serif"; 5741 const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(evaluator.xref, fontFamily); 5742 const resources = fakeUnicodeFont.createFontResources(lines.join("")); 5743 const newFont = resources.getRaw("Font"); 5744 if (this._fieldResources.mergedResources.has("Font")) { 5745 const oldFont = this._fieldResources.mergedResources.get("Font"); 5746 for (const key of newFont.getKeys()) { 5747 oldFont.set(key, newFont.getRaw(key)); 5748 } 5749 } else { 5750 this._fieldResources.mergedResources.set("Font", newFont); 5751 } 5752 const fontName = fakeUnicodeFont.fontName.name; 5753 font = await WidgetAnnotation._getFontData(evaluator, task, { 5754 fontName, 5755 fontSize: 0 5756 }, resources); 5757 for (let i = 0, ii = encodedLines.length; i < ii; i++) { 5758 encodedLines[i] = (0, _core_utils.stringToUTF16String)(lines[i]); 5759 } 5760 const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData); 5761 this.data.defaultAppearanceData.fontSize = 0; 5762 this.data.defaultAppearanceData.fontName = fontName; 5763 [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount); 5764 this.data.defaultAppearanceData = savedDefaultAppearance; 5765 } else { 5766 if (!this._isOffscreenCanvasSupported) { 5767 (0, _util.warn)("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly."); 5768 } 5769 [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount); 5770 } 5771 let descent = font.descent; 5772 if (isNaN(descent)) { 5773 descent = _util.BASELINE_FACTOR * lineHeight; 5774 } else { 5775 descent = Math.max(_util.BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize); 5776 } 5777 const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding); 5778 const alignment = this.data.textAlignment; 5779 if (this.data.multiLine) { 5780 return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage); 5781 } 5782 if (this.data.comb) { 5783 return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage); 5784 } 5785 const bottomPadding = defaultVPadding + descent; 5786 if (alignment === 0 || alignment > 2) { 5787 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(defaultHPadding)} ${(0, _core_utils.numberToString)(bottomPadding)} Tm (${(0, _core_utils.escapeString)(encodedLines[0])}) Tj` + " ET Q EMC"; 5788 } 5789 const prevInfo = { 5790 shift: 0 5791 }; 5792 const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding); 5793 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC"; 5794 } 5795 static async _getFontData(evaluator, task, appearanceData, resources) { 5796 const operatorList = new _operator_list.OperatorList(); 5797 const initialState = { 5798 font: null, 5799 clone() { 5800 return this; 5801 } 5802 }; 5803 const { 5804 fontName, 5805 fontSize 5806 } = appearanceData; 5807 await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null); 5808 return initialState.font; 5809 } 5810 _getTextWidth(text, font) { 5811 return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000; 5812 } 5813 _computeFontSize(height, width, text, font, lineCount) { 5814 let { 5815 fontSize 5816 } = this.data.defaultAppearanceData; 5817 let lineHeight = (fontSize || 12) * _util.LINE_FACTOR, 5818 numberOfLines = Math.round(height / lineHeight); 5819 if (!fontSize) { 5820 const roundWithTwoDigits = x => Math.floor(x * 100) / 100; 5821 if (lineCount === -1) { 5822 const textWidth = this._getTextWidth(text, font); 5823 fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, textWidth > width ? width / textWidth : Infinity)); 5824 numberOfLines = 1; 5825 } else { 5826 const lines = text.split(/\r\n?|\n/); 5827 const cachedLines = []; 5828 for (const line of lines) { 5829 const encoded = font.encodeString(line).join(""); 5830 const glyphs = font.charsToGlyphs(encoded); 5831 const positions = font.getCharPositions(encoded); 5832 cachedLines.push({ 5833 line: encoded, 5834 glyphs, 5835 positions 5836 }); 5837 } 5838 const isTooBig = fsize => { 5839 let totalHeight = 0; 5840 for (const cache of cachedLines) { 5841 const chunks = this._splitLine(null, font, fsize, width, cache); 5842 totalHeight += chunks.length * fsize; 5843 if (totalHeight > height) { 5844 return true; 5845 } 5846 } 5847 return false;
5848 }; 5849 numberOfLines = Math.max(numberOfLines, lineCount); 5850 while (true) { 5851 lineHeight = height / numberOfLines; 5852 fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR); 5853 if (isTooBig(fontSize)) { 5854 numberOfLines++; 5855 continue; 5856 } 5857 break; 5858 } 5859 } 5860 const { 5861 fontName, 5862 fontColor 5863 } = this.data.defaultAppearanceData; 5864 this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({ 5865 fontSize, 5866 fontName, 5867 fontColor 5868 }); 5869 } 5870 return [this._defaultAppearance, fontSize, height / numberOfLines]; 5871 } 5872 _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) { 5873 let shift; 5874 if (alignment === 1) { 5875 const width = this._getTextWidth(text, font) * fontSize; 5876 shift = (totalWidth - width) / 2; 5877 } else if (alignment === 2) { 5878 const width = this._getTextWidth(text, font) * fontSize; 5879 shift = totalWidth - width - hPadding; 5880 } else { 5881 shift = hPadding; 5882 } 5883 const shiftStr = (0, _core_utils.numberToString)(shift - prevInfo.shift); 5884 prevInfo.shift = shift; 5885 vPadding = (0, _core_utils.numberToString)(vPadding); 5886 return `${shiftStr} ${vPadding} Td (${(0, _core_utils.escapeString)(text)}) Tj`; 5887 } 5888 _getSaveFieldResources(xref) { 5889 const { 5890 localResources, 5891 appearanceResources, 5892 acroFormResources 5893 } = this._fieldResources; 5894 const fontName = this.data.defaultAppearanceData?.fontName; 5895 if (!fontName) { 5896 return localResources || _primitives.Dict.empty; 5897 } 5898 for (const resources of [localResources, appearanceResources]) { 5899 if (resources instanceof _primitives.Dict) { 5900 const localFont = resources.get("Font"); 5901 if (localFont instanceof _primitives.Dict && localFont.has(fontName)) { 5902 return resources; 5903 } 5904 } 5905 } 5906 if (acroFormResources instanceof _primitives.Dict) { 5907 const acroFormFont = acroFormResources.get("Font"); 5908 if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) { 5909 const subFontDict = new _primitives.Dict(xref); 5910 subFontDict.set(fontName, acroFormFont.getRaw(fontName)); 5911 const subResourcesDict = new _primitives.Dict(xref); 5912 subResourcesDict.set("Font", subFontDict); 5913 return _primitives.Dict.merge({ 5914 xref, 5915 dictArray: [subResourcesDict, localResources], 5916 mergeSubDicts: true 5917 }); 5918 } 5919 } 5920 return localResources || _primitives.Dict.empty; 5921 } 5922 getFieldObject() { 5923 return null; 5924 } 5925} 5926class TextWidgetAnnotation extends WidgetAnnotation { 5927 constructor(params) { 5928 super(params); 5929 this.data.hasOwnCanvas = this.data.readOnly && !this.data.noHTML; 5930 this._hasText = true; 5931 const dict = params.dict; 5932 if (typeof this.data.fieldValue !== "string") { 5933 this.data.fieldValue = ""; 5934 } 5935 let alignment = (0, _core_utils.getInheritableProperty)({ 5936 dict, 5937 key: "Q" 5938 }); 5939 if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) { 5940 alignment = null; 5941 } 5942 this.data.textAlignment = alignment; 5943 let maximumLength = (0, _core_utils.getInheritableProperty)({ 5944 dict, 5945 key: "MaxLen" 5946 }); 5947 if (!Number.isInteger(maximumLength) || maximumLength < 0) { 5948 maximumLength = 0; 5949 } 5950 this.data.maxLen = maximumLength; 5951 this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE); 5952 this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0; 5953 this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL); 5954 } 5955 get hasTextContent() { 5956 return !!this.appearance && !this._needAppearances; 5957 } 5958 _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) { 5959 const combWidth = width / this.data.maxLen;
vendor: 4,595 bytes, lines 5960-6070
5960 const colors = this.getBorderAndBackgroundAppearances(annotationStorage); 5961 const buf = []; 5962 const positions = font.getCharPositions(text); 5963 for (const [start, end] of positions) { 5964 buf.push(`(${(0, _core_utils.escapeString)(text.substring(start, end))}) Tj`); 5965 } 5966 const renderedComb = buf.join(` ${(0, _core_utils.numberToString)(combWidth)} 0 Td `); 5967 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(hPadding)} ${(0, _core_utils.numberToString)(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC"; 5968 } 5969 _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) { 5970 const buf = []; 5971 const totalWidth = width - 2 * hPadding; 5972 const prevInfo = { 5973 shift: 0 5974 }; 5975 for (let i = 0, ii = lines.length; i < ii; i++) { 5976 const line = lines[i]; 5977 const chunks = this._splitLine(line, font, fontSize, totalWidth); 5978 for (let j = 0, jj = chunks.length; j < jj; j++) { 5979 const chunk = chunks[j]; 5980 const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight; 5981 buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift)); 5982 } 5983 } 5984 const colors = this.getBorderAndBackgroundAppearances(annotationStorage); 5985 const renderedText = buf.join("\n"); 5986 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${(0, _core_utils.numberToString)(height)} Tm ${renderedText}` + " ET Q EMC"; 5987 } 5988 _splitLine(line, font, fontSize, width, cache = {}) { 5989 line = cache.line || line; 5990 const glyphs = cache.glyphs || font.charsToGlyphs(line); 5991 if (glyphs.length <= 1) { 5992 return [line]; 5993 } 5994 const positions = cache.positions || font.getCharPositions(line); 5995 const scale = fontSize / 1000; 5996 const chunks = []; 5997 let lastSpacePosInStringStart = -1, 5998 lastSpacePosInStringEnd = -1, 5999 lastSpacePos = -1, 6000 startChunk = 0, 6001 currentWidth = 0; 6002 for (let i = 0, ii = glyphs.length; i < ii; i++) { 6003 const [start, end] = positions[i]; 6004 const glyph = glyphs[i]; 6005 const glyphWidth = glyph.width * scale; 6006 if (glyph.unicode === " ") { 6007 if (currentWidth + glyphWidth > width) { 6008 chunks.push(line.substring(startChunk, start)); 6009 startChunk = start; 6010 currentWidth = glyphWidth; 6011 lastSpacePosInStringStart = -1; 6012 lastSpacePos = -1; 6013 } else { 6014 currentWidth += glyphWidth; 6015 lastSpacePosInStringStart = start; 6016 lastSpacePosInStringEnd = end; 6017 lastSpacePos = i; 6018 } 6019 } else if (currentWidth + glyphWidth > width) { 6020 if (lastSpacePosInStringStart !== -1) { 6021 chunks.push(line.substring(startChunk, lastSpacePosInStringEnd)); 6022 startChunk = lastSpacePosInStringEnd; 6023 i = lastSpacePos + 1; 6024 lastSpacePosInStringStart = -1; 6025 currentWidth = 0; 6026 } else { 6027 chunks.push(line.substring(startChunk, start)); 6028 startChunk = start; 6029 currentWidth = glyphWidth; 6030 } 6031 } else { 6032 currentWidth += glyphWidth; 6033 } 6034 } 6035 if (startChunk < line.length) { 6036 chunks.push(line.substring(startChunk, line.length)); 6037 } 6038 return chunks; 6039 } 6040 getFieldObject() { 6041 return { 6042 id: this.data.id, 6043 value: this.data.fieldValue, 6044 defaultValue: this.data.defaultFieldValue || "", 6045 multiline: this.data.multiLine, 6046 password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD), 6047 charLimit: this.data.maxLen, 6048 comb: this.data.comb, 6049 editable: !this.data.readOnly, 6050 hidden: this.data.hidden, 6051 name: this.data.fieldName, 6052 rect: this.data.rect, 6053 actions: this.data.actions, 6054 page: this.data.pageIndex, 6055 strokeColor: this.data.borderColor, 6056 fillColor: this.data.backgroundColor, 6057 rotation: this.rotation, 6058 type: "text" 6059 }; 6060 } 6061} 6062class ButtonWidgetAnnotation extends WidgetAnnotation { 6063 constructor(params) { 6064 super(params); 6065 this.checkedAppearance = null; 6066 this.uncheckedAppearance = null; 6067 this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 6068 this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 6069 this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 6070 this.data.isTooltipOnly = false;
6071 if (this.data.checkBox) { 6072 this._processCheckBox(params); 6073 } else if (this.data.radioButton) { 6074 this._processRadioButton(params); 6075 } else if (this.data.pushButton) { 6076 this.data.hasOwnCanvas = true; 6077 this._processPushButton(params); 6078 } else { 6079 (0, _util.warn)("Invalid field flags for button widget annotation"); 6080 } 6081 } 6082 async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) { 6083 if (this.data.pushButton) { 6084 return super.getOperatorList(evaluator, task, intent, false, annotationStorage); 6085 } 6086 let value = null; 6087 let rotation = null; 6088 if (annotationStorage) { 6089 const storageEntry = annotationStorage.get(this.data.id); 6090 value = storageEntry ? storageEntry.value : null; 6091 rotation = storageEntry ? storageEntry.rotation : null; 6092 } 6093 if (value === null && this.appearance) { 6094 return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 6095 } 6096 if (value === null || value === undefined) { 6097 value = this.data.checkBox ? this.data.fieldValue === this.data.exportValue : this.data.fieldValue === this.data.buttonValue; 6098 } 6099 const appearance = value ? this.checkedAppearance : this.uncheckedAppearance; 6100 if (appearance) { 6101 const savedAppearance = this.appearance; 6102 const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX; 6103 if (rotation) { 6104 appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage)); 6105 } 6106 this.appearance = appearance; 6107 const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage); 6108 this.appearance = savedAppearance; 6109 appearance.dict.set("Matrix", savedMatrix); 6110 return operatorList; 6111 } 6112 return { 6113 opList: new _operator_list.OperatorList(), 6114 separateForm: false, 6115 separateCanvas: false 6116 }; 6117 } 6118 async save(evaluator, task, annotationStorage) { 6119 if (this.data.checkBox) { 6120 return this._saveCheckbox(evaluator, task, annotationStorage); 6121 } 6122 if (this.data.radioButton) { 6123 return this._saveRadioButton(evaluator, task, annotationStorage); 6124 } 6125 return null; 6126 } 6127 async _saveCheckbox(evaluator, task, annotationStorage) { 6128 if (!annotationStorage) { 6129 return null; 6130 } 6131 const storageEntry = annotationStorage.get(this.data.id); 6132 let rotation = storageEntry?.rotation, 6133 value = storageEntry?.value; 6134 if (rotation === undefined) { 6135 if (value === undefined) { 6136 return null; 6137 } 6138 const defaultValue = this.data.fieldValue === this.data.exportValue; 6139 if (defaultValue === value) { 6140 return null; 6141 } 6142 } 6143 const dict = evaluator.xref.fetchIfRef(this.ref); 6144 if (!(dict instanceof _primitives.Dict)) { 6145 return null; 6146 } 6147 if (rotation === undefined) { 6148 rotation = this.rotation; 6149 } 6150 if (value === undefined) { 6151 value = this.data.fieldValue === this.data.exportValue; 6152 } 6153 const xfa = { 6154 path: this.data.fieldName, 6155 value: value ? this.data.exportValue : "" 6156 }; 6157 const name = _primitives.Name.get(value ? this.data.exportValue : "Off"); 6158 dict.set("V", name); 6159 dict.set("AS", name); 6160 dict.set("M", `D:${(0, _util.getModificationDate)()}`); 6161 const maybeMK = this._getMKDict(rotation); 6162 if (maybeMK) { 6163 dict.set("MK", maybeMK); 6164 } 6165 const buffer = []; 6166 await (0, _writer.writeObject)(this.ref, dict, buffer, evaluator.xref); 6167 return [{ 6168 ref: this.ref, 6169 data: buffer.join(""), 6170 xfa 6171 }]; 6172 } 6173 async _saveRadioButton(evaluator, task, annotationStorage) { 6174 if (!annotationStorage) { 6175 return null; 6176 } 6177 const storageEntry = annotationStorage.get(this.data.id); 6178 let rotation = storageEntry?.rotation, 6179 value = storageEntry?.value; 6180 if (rotation === undefined) { 6181 if (value === undefined) { 6182 return null; 6183 } 6184 const defaultValue = this.data.fieldValue === this.data.buttonValue; 6185 if (defaultValue === value) { 6186 return null; 6187 } 6188 } 6189 const dict = evaluator.xref.fetchIfRef(this.ref); 6190 if (!(dict instanceof _primitives.Dict)) { 6191 return null; 6192 } 6193 if (value === undefined) { 6194 value = this.data.fieldValue === this.data.buttonValue; 6195 } 6196 if (rotation === undefined) { 6197 rotation = this.rotation; 6198 } 6199 const xfa = { 6200 path: this.data.fieldName, 6201 value: value ? this.data.buttonValue : "" 6202 }; 6203 const name = _primitives.Name.get(value ? this.data.buttonValue : "Off"); 6204 const buffer = []; 6205 let parentData = null; 6206 if (value) { 6207 if (this.parent instanceof _primitives.Ref) { 6208 const parent = evaluator.xref.fetch(this.parent); 6209 parent.set("V", name); 6210 await (0, _writer.writeObject)(this.parent, parent, buffer, evaluator.xref); 6211 parentData = buffer.join(""); 6212 buffer.length = 0; 6213 } else if (this.parent instanceof _primitives.Dict) { 6214 this.parent.set("V", name); 6215 } 6216 } 6217 dict.set("AS", name); 6218 dict.set("M", `D:${(0, _util.getModificationDate)()}`); 6219 const maybeMK = this._getMKDict(rotation); 6220 if (maybeMK) { 6221 dict.set("MK", maybeMK); 6222 } 6223 await (0, _writer.writeObject)(this.ref, dict, buffer, evaluator.xref); 6224 const newRefs = [{ 6225 ref: this.ref, 6226 data: buffer.join(""), 6227 xfa 6228 }]; 6229 if (parentData) { 6230 newRefs.push({ 6231 ref: this.parent, 6232 data: parentData, 6233 xfa: null 6234 }); 6235 } 6236 return newRefs; 6237 } 6238 _getDefaultCheckedAppearance(params, type) { 6239 const width = this.data.rect[2] - this.data.rect[0]; 6240 const height = this.data.rect[3] - this.data.rect[1]; 6241 const bbox = [0, 0, width, height]; 6242 const FONT_RATIO = 0.8; 6243 const fontSize = Math.min(width, height) * FONT_RATIO; 6244 let metrics, char; 6245 if (type === "check") { 6246 metrics = { 6247 width: 0.755 * fontSize, 6248 height: 0.705 * fontSize 6249 }; 6250 char = "\x33";
vendor: 13,875 bytes, lines 6251-6634
6251 } else if (type === "disc") { 6252 metrics = { 6253 width: 0.791 * fontSize, 6254 height: 0.705 * fontSize 6255 }; 6256 char = "\x6C"; 6257 } else { 6258 (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`); 6259 } 6260 const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2); 6261 const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2); 6262 const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`; 6263 const appearanceStreamDict = new _primitives.Dict(params.xref); 6264 appearanceStreamDict.set("FormType", 1); 6265 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 6266 appearanceStreamDict.set("Type", _primitives.Name.get("XObject")); 6267 appearanceStreamDict.set("BBox", bbox); 6268 appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]); 6269 appearanceStreamDict.set("Length", appearance.length); 6270 const resources = new _primitives.Dict(params.xref); 6271 const font = new _primitives.Dict(params.xref); 6272 font.set("PdfJsZaDb", this.fallbackFontDict); 6273 resources.set("Font", font); 6274 appearanceStreamDict.set("Resources", resources); 6275 this.checkedAppearance = new _stream.StringStream(appearance); 6276 this.checkedAppearance.dict = appearanceStreamDict; 6277 this._streams.push(this.checkedAppearance); 6278 } 6279 _processCheckBox(params) { 6280 const customAppearance = params.dict.get("AP"); 6281 if (!(customAppearance instanceof _primitives.Dict)) { 6282 return; 6283 } 6284 const normalAppearance = customAppearance.get("N"); 6285 if (!(normalAppearance instanceof _primitives.Dict)) { 6286 return; 6287 } 6288 const asValue = this._decodeFormValue(params.dict.get("AS")); 6289 if (typeof asValue === "string") { 6290 this.data.fieldValue = asValue; 6291 } 6292 const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes"; 6293 const exportValues = normalAppearance.getKeys(); 6294 if (exportValues.length === 0) { 6295 exportValues.push("Off", yes); 6296 } else if (exportValues.length === 1) { 6297 if (exportValues[0] === "Off") { 6298 exportValues.push(yes); 6299 } else { 6300 exportValues.unshift("Off"); 6301 } 6302 } else if (exportValues.includes(yes)) { 6303 exportValues.length = 0; 6304 exportValues.push("Off", yes); 6305 } else { 6306 const otherYes = exportValues.find(v => v !== "Off"); 6307 exportValues.length = 0; 6308 exportValues.push("Off", otherYes); 6309 } 6310 if (!exportValues.includes(this.data.fieldValue)) { 6311 this.data.fieldValue = "Off"; 6312 } 6313 this.data.exportValue = exportValues[1]; 6314 const checkedAppearance = normalAppearance.get(this.data.exportValue); 6315 this.checkedAppearance = checkedAppearance instanceof _base_stream.BaseStream ? checkedAppearance : null; 6316 const uncheckedAppearance = normalAppearance.get("Off"); 6317 this.uncheckedAppearance = uncheckedAppearance instanceof _base_stream.BaseStream ? uncheckedAppearance : null; 6318 if (this.checkedAppearance) { 6319 this._streams.push(this.checkedAppearance); 6320 } else { 6321 this._getDefaultCheckedAppearance(params, "check"); 6322 } 6323 if (this.uncheckedAppearance) { 6324 this._streams.push(this.uncheckedAppearance); 6325 } 6326 this._fallbackFontDict = this.fallbackFontDict; 6327 if (this.data.defaultFieldValue === null) { 6328 this.data.defaultFieldValue = "Off"; 6329 } 6330 } 6331 _processRadioButton(params) { 6332 this.data.fieldValue = this.data.buttonValue = null; 6333 const fieldParent = params.dict.get("Parent"); 6334 if (fieldParent instanceof _primitives.Dict) { 6335 this.parent = params.dict.getRaw("Parent"); 6336 const fieldParentValue = fieldParent.get("V"); 6337 if (fieldParentValue instanceof _primitives.Name) { 6338 this.data.fieldValue = this._decodeFormValue(fieldParentValue); 6339 } 6340 } 6341 const appearanceStates = params.dict.get("AP"); 6342 if (!(appearanceStates instanceof _primitives.Dict)) { 6343 return; 6344 } 6345 const normalAppearance = appearanceStates.get("N"); 6346 if (!(normalAppearance instanceof _primitives.Dict)) { 6347 return; 6348 } 6349 for (const key of normalAppearance.getKeys()) { 6350 if (key !== "Off") { 6351 this.data.buttonValue = this._decodeFormValue(key); 6352 break; 6353 } 6354 } 6355 const checkedAppearance = normalAppearance.get(this.data.buttonValue); 6356 this.checkedAppearance = checkedAppearance instanceof _base_stream.BaseStream ? checkedAppearance : null; 6357 const uncheckedAppearance = normalAppearance.get("Off"); 6358 this.uncheckedAppearance = uncheckedAppearance instanceof _base_stream.BaseStream ? uncheckedAppearance : null; 6359 if (this.checkedAppearance) { 6360 this._streams.push(this.checkedAppearance); 6361 } else { 6362 this._getDefaultCheckedAppearance(params, "disc"); 6363 } 6364 if (this.uncheckedAppearance) { 6365 this._streams.push(this.uncheckedAppearance); 6366 } 6367 this._fallbackFontDict = this.fallbackFontDict; 6368 if (this.data.defaultFieldValue === null) { 6369 this.data.defaultFieldValue = "Off"; 6370 } 6371 } 6372 _processPushButton(params) { 6373 const { 6374 dict, 6375 annotationGlobals 6376 } = params; 6377 if (!dict.has("A") && !dict.has("AA") && !this.data.alternativeText) { 6378 (0, _util.warn)("Push buttons without action dictionaries are not supported"); 6379 return; 6380 } 6381 this.data.isTooltipOnly = !dict.has("A") && !dict.has("AA"); 6382 _catalog.Catalog.parseDestDictionary({ 6383 destDict: dict, 6384 resultObj: this.data, 6385 docBaseUrl: annotationGlobals.baseUrl, 6386 docAttachments: annotationGlobals.attachments 6387 }); 6388 } 6389 getFieldObject() { 6390 let type = "button"; 6391 let exportValues; 6392 if (this.data.checkBox) { 6393 type = "checkbox"; 6394 exportValues = this.data.exportValue; 6395 } else if (this.data.radioButton) { 6396 type = "radiobutton"; 6397 exportValues = this.data.buttonValue; 6398 } 6399 return { 6400 id: this.data.id, 6401 value: this.data.fieldValue || "Off", 6402 defaultValue: this.data.defaultFieldValue, 6403 exportValues, 6404 editable: !this.data.readOnly, 6405 name: this.data.fieldName, 6406 rect: this.data.rect, 6407 hidden: this.data.hidden, 6408 actions: this.data.actions, 6409 page: this.data.pageIndex, 6410 strokeColor: this.data.borderColor, 6411 fillColor: this.data.backgroundColor, 6412 rotation: this.rotation, 6413 type 6414 }; 6415 } 6416 get fallbackFontDict() { 6417 const dict = new _primitives.Dict(); 6418 dict.set("BaseFont", _primitives.Name.get("ZapfDingbats")); 6419 dict.set("Type", _primitives.Name.get("FallbackType")); 6420 dict.set("Subtype", _primitives.Name.get("FallbackType")); 6421 dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding")); 6422 return (0, _util.shadow)(this, "fallbackFontDict", dict); 6423 } 6424} 6425class ChoiceWidgetAnnotation extends WidgetAnnotation { 6426 constructor(params) { 6427 super(params); 6428 const { 6429 dict, 6430 xref 6431 } = params; 6432 this.indices = dict.getArray("I"); 6433 this.hasIndices = Array.isArray(this.indices) && this.indices.length > 0; 6434 this.data.options = []; 6435 const options = (0, _core_utils.getInheritableProperty)({ 6436 dict, 6437 key: "Opt" 6438 }); 6439 if (Array.isArray(options)) { 6440 for (let i = 0, ii = options.length; i < ii; i++) { 6441 const option = xref.fetchIfRef(options[i]); 6442 const isOptionArray = Array.isArray(option); 6443 this.data.options[i] = { 6444 exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option), 6445 displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option) 6446 }; 6447 } 6448 } 6449 if (!this.hasIndices) { 6450 if (typeof this.data.fieldValue === "string") { 6451 this.data.fieldValue = [this.data.fieldValue]; 6452 } else if (!this.data.fieldValue) { 6453 this.data.fieldValue = []; 6454 } 6455 } else { 6456 this.data.fieldValue = []; 6457 const ii = this.data.options.length; 6458 for (const i of this.indices) { 6459 if (Number.isInteger(i) && i >= 0 && i < ii) { 6460 this.data.fieldValue.push(this.data.options[i].exportValue); 6461 } 6462 } 6463 } 6464 this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO); 6465 this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT); 6466 this._hasText = true; 6467 } 6468 getFieldObject() { 6469 const type = this.data.combo ? "combobox" : "listbox"; 6470 const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null; 6471 return { 6472 id: this.data.id, 6473 value, 6474 defaultValue: this.data.defaultFieldValue, 6475 editable: !this.data.readOnly, 6476 name: this.data.fieldName, 6477 rect: this.data.rect, 6478 numItems: this.data.fieldValue.length, 6479 multipleSelection: this.data.multiSelect, 6480 hidden: this.data.hidden, 6481 actions: this.data.actions, 6482 items: this.data.options, 6483 page: this.data.pageIndex, 6484 strokeColor: this.data.borderColor, 6485 fillColor: this.data.backgroundColor, 6486 rotation: this.rotation, 6487 type 6488 }; 6489 } 6490 amendSavedDict(annotationStorage, dict) { 6491 if (!this.hasIndices) { 6492 return; 6493 } 6494 let values = annotationStorage?.get(this.data.id)?.value; 6495 if (!Array.isArray(values)) { 6496 values = [values]; 6497 } 6498 const indices = []; 6499 const { 6500 options 6501 } = this.data; 6502 for (let i = 0, j = 0, ii = options.length; i < ii; i++) { 6503 if (options[i].exportValue === values[j]) { 6504 indices.push(i); 6505 j += 1; 6506 } 6507 } 6508 dict.set("I", indices); 6509 } 6510 async _getAppearance(evaluator, task, intent, annotationStorage) { 6511 if (this.data.combo) { 6512 return super._getAppearance(evaluator, task, intent, annotationStorage); 6513 } 6514 let exportedValue, rotation; 6515 const storageEntry = annotationStorage?.get(this.data.id); 6516 if (storageEntry) { 6517 rotation = storageEntry.rotation; 6518 exportedValue = storageEntry.value; 6519 } 6520 if (rotation === undefined && exportedValue === undefined && !this._needAppearances) { 6521 return null; 6522 } 6523 if (exportedValue === undefined) { 6524 exportedValue = this.data.fieldValue; 6525 } else if (!Array.isArray(exportedValue)) { 6526 exportedValue = [exportedValue]; 6527 } 6528 const defaultPadding = 1; 6529 const defaultHPadding = 2; 6530 let totalHeight = this.data.rect[3] - this.data.rect[1]; 6531 let totalWidth = this.data.rect[2] - this.data.rect[0]; 6532 if (rotation === 90 || rotation === 270) { 6533 [totalWidth, totalHeight] = [totalHeight, totalWidth]; 6534 } 6535 const lineCount = this.data.options.length; 6536 const valueIndices = []; 6537 for (let i = 0; i < lineCount; i++) { 6538 const { 6539 exportValue 6540 } = this.data.options[i]; 6541 if (exportedValue.includes(exportValue)) { 6542 valueIndices.push(i); 6543 } 6544 } 6545 if (!this._defaultAppearance) { 6546 this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g"); 6547 } 6548 const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources); 6549 let defaultAppearance; 6550 let { 6551 fontSize 6552 } = this.data.defaultAppearanceData; 6553 if (!fontSize) { 6554 const lineHeight = (totalHeight - defaultPadding) / lineCount; 6555 let lineWidth = -1; 6556 let value; 6557 for (const { 6558 displayValue 6559 } of this.data.options) { 6560 const width = this._getTextWidth(displayValue, font); 6561 if (width > lineWidth) { 6562 lineWidth = width; 6563 value = displayValue; 6564 } 6565 } 6566 [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1); 6567 } else { 6568 defaultAppearance = this._defaultAppearance; 6569 } 6570 const lineHeight = fontSize * _util.LINE_FACTOR; 6571 const vPadding = (lineHeight - fontSize) / 2; 6572 const numberOfVisibleLines = Math.floor(totalHeight / lineHeight); 6573 let firstIndex = 0; 6574 if (valueIndices.length > 0) { 6575 const minIndex = Math.min(...valueIndices); 6576 const maxIndex = Math.max(...valueIndices); 6577 firstIndex = Math.max(0, maxIndex - numberOfVisibleLines + 1); 6578 if (firstIndex > minIndex) { 6579 firstIndex = minIndex; 6580 } 6581 } 6582 const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount); 6583 const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`]; 6584 if (valueIndices.length) { 6585 buf.push("0.600006 0.756866 0.854904 rg"); 6586 for (const index of valueIndices) { 6587 if (firstIndex <= index && index < end) { 6588 buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`); 6589 } 6590 } 6591 } 6592 buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`); 6593 const prevInfo = { 6594 shift: 0 6595 }; 6596 for (let i = firstIndex; i < end; i++) { 6597 const { 6598 displayValue 6599 } = this.data.options[i]; 6600 const vpadding = i === firstIndex ? vPadding : 0; 6601 buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding)); 6602 } 6603 buf.push("ET Q EMC"); 6604 return buf.join("\n"); 6605 } 6606} 6607class SignatureWidgetAnnotation extends WidgetAnnotation { 6608 constructor(params) { 6609 super(params); 6610 this.data.fieldValue = null; 6611 this.data.hasOwnCanvas = this.data.noRotate; 6612 } 6613 getFieldObject() { 6614 return { 6615 id: this.data.id, 6616 value: null, 6617 page: this.data.pageIndex, 6618 type: "signature" 6619 }; 6620 } 6621} 6622class TextAnnotation extends MarkupAnnotation { 6623 constructor(params) { 6624 const DEFAULT_ICON_SIZE = 22; 6625 super(params); 6626 this.data.noRotate = true; 6627 this.data.hasOwnCanvas = this.data.noRotate; 6628 const { 6629 dict 6630 } = params; 6631 this.data.annotationType = _util.AnnotationType.TEXT; 6632 if (this.data.hasAppearance) { 6633 this.data.name = "NoIcon"; 6634 } else {
6635 this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE; 6636 this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE; 6637 this.data.name = dict.has("Name") ? dict.get("Name").name : "Note"; 6638 } 6639 if (dict.has("State")) { 6640 this.data.state = dict.get("State") || null; 6641 this.data.stateModel = dict.get("StateModel") || null; 6642 } else { 6643 this.data.state = null; 6644 this.data.stateModel = null; 6645 } 6646 } 6647} 6648class LinkAnnotation extends Annotation { 6649 constructor(params) { 6650 super(params); 6651 const { 6652 dict, 6653 annotationGlobals 6654 } = params; 6655 this.data.annotationType = _util.AnnotationType.LINK; 6656 const quadPoints = getQuadPoints(dict, this.rectangle); 6657 if (quadPoints) { 6658 this.data.quadPoints = quadPoints; 6659 } 6660 this.data.borderColor ||= this.data.color; 6661 _catalog.Catalog.parseDestDictionary({ 6662 destDict: dict, 6663 resultObj: this.data, 6664 docBaseUrl: annotationGlobals.baseUrl, 6665 docAttachments: annotationGlobals.attachments 6666 }); 6667 } 6668} 6669class PopupAnnotation extends Annotation { 6670 constructor(params) { 6671 super(params); 6672 const { 6673 dict 6674 } = params; 6675 this.data.annotationType = _util.AnnotationType.POPUP; 6676 if (this.data.rect[0] === this.data.rect[2] || this.data.rect[1] === this.data.rect[3]) { 6677 this.data.rect = null; 6678 } 6679 let parentItem = dict.get("Parent"); 6680 if (!parentItem) { 6681 (0, _util.warn)("Popup annotation has a missing or invalid parent annotation."); 6682 return; 6683 } 6684 const parentRect = parentItem.getArray("Rect"); 6685 this.data.parentRect = Array.isArray(parentRect) && parentRect.length === 4 ? _util.Util.normalizeRect(parentRect) : null; 6686 const rt = parentItem.get("RT"); 6687 if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) { 6688 parentItem = parentItem.get("IRT"); 6689 } 6690 if (!parentItem.has("M")) { 6691 this.data.modificationDate = null; 6692 } else { 6693 this.setModificationDate(parentItem.get("M")); 6694 this.data.modificationDate = this.modificationDate; 6695 } 6696 if (!parentItem.has("C")) { 6697 this.data.color = null; 6698 } else { 6699 this.setColor(parentItem.getArray("C")); 6700 this.data.color = this.color; 6701 } 6702 if (!this.viewable) { 6703 const parentFlags = parentItem.get("F"); 6704 if (this._isViewable(parentFlags)) { 6705 this.setFlags(parentFlags); 6706 } 6707 } 6708 this.setTitle(parentItem.get("T")); 6709 this.data.titleObj = this._title; 6710 this.setContents(parentItem.get("Contents")); 6711 this.data.contentsObj = this._contents; 6712 if (parentItem.has("RC")) { 6713 this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC")); 6714 } 6715 this.data.open = !!dict.get("Open"); 6716 } 6717} 6718exports.PopupAnnotation = PopupAnnotation; 6719class FreeTextAnnotation extends MarkupAnnotation { 6720 constructor(params) { 6721 super(params); 6722 this.data.hasOwnCanvas = true; 6723 const { 6724 evaluatorOptions, 6725 xref 6726 } = params; 6727 this.data.annotationType = _util.AnnotationType.FREETEXT; 6728 this.setDefaultAppearance(params); 6729 if (this.appearance) { 6730 const { 6731 fontColor, 6732 fontSize 6733 } = (0, _default_appearance.parseAppearanceStream)(this.appearance, evaluatorOptions, xref); 6734 this.data.defaultAppearanceData.fontColor = fontColor; 6735 this.data.defaultAppearanceData.fontSize = fontSize || 10; 6736 } else if (this._isOffscreenCanvasSupported) { 6737 const strokeAlpha = params.dict.get("CA"); 6738 const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(xref, "sans-serif"); 6739 this.data.defaultAppearanceData.fontSize ||= 10; 6740 const { 6741 fontColor, 6742 fontSize 6743 } = this.data.defaultAppearanceData; 6744 this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontSize, fontColor, strokeAlpha); 6745 this._streams.push(this.appearance, _default_appearance.FakeUnicodeFont.toUnicodeStream); 6746 } else { 6747 (0, _util.warn)("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly."); 6748 } 6749 } 6750 get hasTextContent() { 6751 return !!this.appearance; 6752 } 6753 static createNewDict(annotation, xref, { 6754 apRef, 6755 ap 6756 }) { 6757 const { 6758 color, 6759 fontSize, 6760 rect, 6761 rotation, 6762 user, 6763 value 6764 } = annotation; 6765 const freetext = new _primitives.Dict(xref); 6766 freetext.set("Type", _primitives.Name.get("Annot")); 6767 freetext.set("Subtype", _primitives.Name.get("FreeText")); 6768 freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`); 6769 freetext.set("Rect", rect); 6770 const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`; 6771 freetext.set("DA", da); 6772 freetext.set("Contents", (0, _core_utils.isAscii)(value) ? value : (0, _core_utils.stringToUTF16String)(value, true)); 6773 freetext.set("F", 4); 6774 freetext.set("Border", [0, 0, 0]); 6775 freetext.set("Rotate", rotation); 6776 if (user) { 6777 freetext.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true)); 6778 } 6779 if (apRef || ap) { 6780 const n = new _primitives.Dict(xref); 6781 freetext.set("AP", n); 6782 if (apRef) { 6783 n.set("N", apRef); 6784 } else { 6785 n.set("N", ap); 6786 } 6787 } 6788 return freetext; 6789 } 6790 static async createNewAppearanceStream(annotation, xref, params) { 6791 const { 6792 baseFontRef, 6793 evaluator, 6794 task 6795 } = params; 6796 const { 6797 color, 6798 fontSize, 6799 rect, 6800 rotation, 6801 value 6802 } = annotation; 6803 const resources = new _primitives.Dict(xref); 6804 const font = new _primitives.Dict(xref); 6805 if (baseFontRef) { 6806 font.set("Helv", baseFontRef); 6807 } else { 6808 const baseFont = new _primitives.Dict(xref); 6809 baseFont.set("BaseFont", _primitives.Name.get("Helvetica")); 6810 baseFont.set("Type", _primitives.Name.get("Font")); 6811 baseFont.set("Subtype", _primitives.Name.get("Type1")); 6812 baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); 6813 font.set("Helv", baseFont); 6814 } 6815 resources.set("Font", font); 6816 const helv = await WidgetAnnotation._getFontData(evaluator, task, { 6817 fontName: "Helv", 6818 fontSize 6819 }, resources); 6820 const [x1, y1, x2, y2] = rect; 6821 let w = x2 - x1; 6822 let h = y2 - y1; 6823 if (rotation % 180 !== 0) { 6824 [w, h] = [h, w]; 6825 } 6826 const lines = value.split("\n"); 6827 const scale = fontSize / 1000; 6828 let totalWidth = -Infinity; 6829 const encodedLines = []; 6830 for (let line of lines) { 6831 const encoded = helv.encodeString(line); 6832 if (encoded.length > 1) { 6833 return null; 6834 } 6835 line = encoded.join(""); 6836 encodedLines.push(line); 6837 let lineWidth = 0; 6838 const glyphs = helv.charsToGlyphs(line); 6839 for (const glyph of glyphs) { 6840 lineWidth += glyph.width * scale; 6841 } 6842 totalWidth = Math.max(totalWidth, lineWidth); 6843 } 6844 let hscale = 1; 6845 if (totalWidth > w) { 6846 hscale = w / totalWidth; 6847 } 6848 let vscale = 1; 6849 const lineHeight = _util.LINE_FACTOR * fontSize; 6850 const lineAscent = (_util.LINE_FACTOR - _util.LINE_DESCENT_FACTOR) * fontSize; 6851 const totalHeight = lineHeight * lines.length; 6852 if (totalHeight > h) { 6853 vscale = h / totalHeight; 6854 } 6855 const fscale = Math.min(hscale, vscale); 6856 const newFontSize = fontSize * fscale; 6857 let firstPoint, clipBox, matrix; 6858 switch (rotation) { 6859 case 0: 6860 matrix = [1, 0, 0, 1]; 6861 clipBox = [rect[0], rect[1], w, h]; 6862 firstPoint = [rect[0], rect[3] - lineAscent]; 6863 break; 6864 case 90: 6865 matrix = [0, 1, -1, 0]; 6866 clipBox = [rect[1], -rect[2], w, h]; 6867 firstPoint = [rect[1], -rect[0] - lineAscent]; 6868 break; 6869 case 180: 6870 matrix = [-1, 0, 0, -1]; 6871 clipBox = [-rect[2], -rect[3], w, h]; 6872 firstPoint = [-rect[2], -rect[1] - lineAscent]; 6873 break; 6874 case 270: 6875 matrix = [0, -1, 1, 0]; 6876 clipBox = [-rect[3], rect[0], w, h]; 6877 firstPoint = [-rect[3], rect[2] - lineAscent]; 6878 break; 6879 } 6880 const buffer = ["q", `${matrix.join(" ")} 0 0 cm`, `${clipBox.join(" ")} re W n`, `BT`, `${(0, _default_appearance.getPdfColor)(color, true)}`, `0 Tc /Helv ${(0, _core_utils.numberToString)(newFontSize)} Tf`]; 6881 buffer.push(`${firstPoint.join(" ")} Td (${(0, _core_utils.escapeString)(encodedLines[0])}) Tj`); 6882 const vShift = (0, _core_utils.numberToString)(lineHeight); 6883 for (let i = 1, ii = encodedLines.length; i < ii; i++) { 6884 const line = encodedLines[i]; 6885 buffer.push(`0 -${vShift} Td (${(0, _core_utils.escapeString)(line)}) Tj`); 6886 } 6887 buffer.push("ET", "Q"); 6888 const appearance = buffer.join("\n"); 6889 const appearanceStreamDict = new _primitives.Dict(xref); 6890 appearanceStreamDict.set("FormType", 1); 6891 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 6892 appearanceStreamDict.set("Type", _primitives.Name.get("XObject")); 6893 appearanceStreamDict.set("BBox", rect); 6894 appearanceStreamDict.set("Resources", resources); 6895 appearanceStreamDict.set("Matrix", [1, 0, 0, 1, -rect[0], -rect[1]]); 6896 const ap = new _stream.StringStream(appearance); 6897 ap.dict = appearanceStreamDict; 6898 return ap; 6899 } 6900} 6901class LineAnnotation extends MarkupAnnotation { 6902 constructor(params) { 6903 super(params); 6904 const { 6905 dict, 6906 xref 6907 } = params; 6908 this.data.annotationType = _util.AnnotationType.LINE; 6909 this.data.hasOwnCanvas = this.data.noRotate; 6910 const lineCoordinates = dict.getArray("L"); 6911 this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates); 6912 this.setLineEndings(dict.getArray("LE")); 6913 this.data.lineEndings = this.lineEndings; 6914 if (!this.appearance) { 6915 const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0]; 6916 const strokeAlpha = dict.get("CA");
6917 const interiorColor = getRgbColor(dict.getArray("IC"), null); 6918 const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null; 6919 const fillAlpha = fillColor ? strokeAlpha : null; 6920 const borderWidth = this.borderStyle.width || 1, 6921 borderAdjust = 2 * borderWidth; 6922 const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust]; 6923 if (!_util.Util.intersect(this.rectangle, bbox)) { 6924 this.rectangle = bbox; 6925 } 6926 this._setDefaultAppearance({ 6927 xref, 6928 extra: `${borderWidth} w`, 6929 strokeColor, 6930 fillColor, 6931 strokeAlpha, 6932 fillAlpha, 6933 pointsCallback: (buffer, points) => { 6934 buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S"); 6935 return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth]; 6936 } 6937 }); 6938 } 6939 } 6940} 6941class SquareAnnotation extends MarkupAnnotation { 6942 constructor(params) { 6943 super(params); 6944 const { 6945 dict, 6946 xref 6947 } = params; 6948 this.data.annotationType = _util.AnnotationType.SQUARE; 6949 this.data.hasOwnCanvas = this.data.noRotate; 6950 if (!this.appearance) { 6951 const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0]; 6952 const strokeAlpha = dict.get("CA"); 6953 const interiorColor = getRgbColor(dict.getArray("IC"), null); 6954 const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null; 6955 const fillAlpha = fillColor ? strokeAlpha : null; 6956 if (this.borderStyle.width === 0 && !fillColor) { 6957 return; 6958 } 6959 this._setDefaultAppearance({ 6960 xref, 6961 extra: `${this.borderStyle.width} w`, 6962 strokeColor, 6963 fillColor, 6964 strokeAlpha, 6965 fillAlpha, 6966 pointsCallback: (buffer, points) => { 6967 const x = points[2].x + this.borderStyle.width / 2; 6968 const y = points[2].y + this.borderStyle.width / 2; 6969 const width = points[3].x - points[2].x - this.borderStyle.width; 6970 const height = points[1].y - points[3].y - this.borderStyle.width; 6971 buffer.push(`${x} ${y} ${width} ${height} re`); 6972 if (fillColor) { 6973 buffer.push("B"); 6974 } else { 6975 buffer.push("S"); 6976 } 6977 return [points[0].x, points[1].x, points[3].y, points[1].y]; 6978 } 6979 }); 6980 } 6981 } 6982} 6983class CircleAnnotation extends MarkupAnnotation { 6984 constructor(params) { 6985 super(params); 6986 const { 6987 dict, 6988 xref 6989 } = params; 6990 this.data.annotationType = _util.AnnotationType.CIRCLE; 6991 if (!this.appearance) { 6992 const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0]; 6993 const strokeAlpha = dict.get("CA"); 6994 const interiorColor = getRgbColor(dict.getArray("IC"), null); 6995 const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null; 6996 const fillAlpha = fillColor ? strokeAlpha : null; 6997 if (this.borderStyle.width === 0 && !fillColor) { 6998 return; 6999 } 7000 const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4)); 7001 this._setDefaultAppearance({ 7002 xref, 7003 extra: `${this.borderStyle.width} w`, 7004 strokeColor, 7005 fillColor, 7006 strokeAlpha, 7007 fillAlpha, 7008 pointsCallback: (buffer, points) => { 7009 const x0 = points[0].x + this.borderStyle.width / 2; 7010 const y0 = points[0].y - this.borderStyle.width / 2; 7011 const x1 = points[3].x - this.borderStyle.width / 2; 7012 const y1 = points[3].y + this.borderStyle.width / 2; 7013 const xMid = x0 + (x1 - x0) / 2; 7014 const yMid = y0 + (y1 - y0) / 2; 7015 const xOffset = (x1 - x0) / 2 * controlPointsDistance; 7016 const yOffset = (y1 - y0) / 2 * controlPointsDistance; 7017 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"); 7018 if (fillColor) { 7019 buffer.push("B"); 7020 } else { 7021 buffer.push("S"); 7022 } 7023 return [points[0].x, points[1].x, points[3].y, points[1].y]; 7024 } 7025 }); 7026 } 7027 } 7028} 7029class PolylineAnnotation extends MarkupAnnotation { 7030 constructor(params) { 7031 super(params); 7032 const { 7033 dict, 7034 xref 7035 } = params; 7036 this.data.annotationType = _util.AnnotationType.POLYLINE; 7037 this.data.hasOwnCanvas = this.data.noRotate; 7038 this.data.vertices = []; 7039 if (!(this instanceof PolygonAnnotation)) { 7040 this.setLineEndings(dict.getArray("LE")); 7041 this.data.lineEndings = this.lineEndings; 7042 } 7043 const rawVertices = dict.getArray("Vertices"); 7044 if (!Array.isArray(rawVertices)) { 7045 return; 7046 } 7047 for (let i = 0, ii = rawVertices.length; i < ii; i += 2) { 7048 this.data.vertices.push({ 7049 x: rawVertices[i], 7050 y: rawVertices[i + 1] 7051 }); 7052 } 7053 if (!this.appearance) { 7054 const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0]; 7055 const strokeAlpha = dict.get("CA"); 7056 const borderWidth = this.borderStyle.width || 1, 7057 borderAdjust = 2 * borderWidth; 7058 const bbox = [Infinity, Infinity, -Infinity, -Infinity]; 7059 for (const vertex of this.data.vertices) { 7060 bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust); 7061 bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust); 7062 bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust); 7063 bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust); 7064 } 7065 if (!_util.Util.intersect(this.rectangle, bbox)) { 7066 this.rectangle = bbox; 7067 } 7068 this._setDefaultAppearance({ 7069 xref, 7070 extra: `${borderWidth} w`, 7071 strokeColor, 7072 strokeAlpha, 7073 pointsCallback: (buffer, points) => { 7074 const vertices = this.data.vertices; 7075 for (let i = 0, ii = vertices.length; i < ii; i++) { 7076 buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`); 7077 } 7078 buffer.push("S"); 7079 return [points[0].x, points[1].x, points[3].y, points[1].y]; 7080 } 7081 }); 7082 } 7083 } 7084} 7085class PolygonAnnotation extends PolylineAnnotation { 7086 constructor(params) { 7087 super(params); 7088 this.data.annotationType = _util.AnnotationType.POLYGON; 7089 } 7090} 7091class CaretAnnotation extends MarkupAnnotation { 7092 constructor(params) { 7093 super(params); 7094 this.data.annotationType = _util.AnnotationType.CARET; 7095 } 7096} 7097class InkAnnotation extends MarkupAnnotation { 7098 constructor(params) { 7099 super(params); 7100 this.data.hasOwnCanvas = this.data.noRotate; 7101 const { 7102 dict, 7103 xref 7104 } = params; 7105 this.data.annotationType = _util.AnnotationType.INK; 7106 this.data.inkLists = []; 7107 const rawInkLists = dict.getArray("InkList"); 7108 if (!Array.isArray(rawInkLists)) { 7109 return; 7110 } 7111 for (let i = 0, ii = rawInkLists.length; i < ii; ++i) { 7112 this.data.inkLists.push([]); 7113 for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) { 7114 this.data.inkLists[i].push({ 7115 x: xref.fetchIfRef(rawInkLists[i][j]), 7116 y: xref.fetchIfRef(rawInkLists[i][j + 1]) 7117 }); 7118 } 7119 } 7120 if (!this.appearance) { 7121 const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0]; 7122 const strokeAlpha = dict.get("CA"); 7123 const borderWidth = this.borderStyle.width || 1, 7124 borderAdjust = 2 * borderWidth; 7125 const bbox = [Infinity, Infinity, -Infinity, -Infinity]; 7126 for (const inkLists of this.data.inkLists) { 7127 for (const vertex of inkLists) { 7128 bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust); 7129 bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust); 7130 bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust); 7131 bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust); 7132 } 7133 } 7134 if (!_util.Util.intersect(this.rectangle, bbox)) { 7135 this.rectangle = bbox; 7136 } 7137 this._setDefaultAppearance({ 7138 xref, 7139 extra: `${borderWidth} w`, 7140 strokeColor, 7141 strokeAlpha, 7142 pointsCallback: (buffer, points) => { 7143 for (const inkList of this.data.inkLists) { 7144 for (let i = 0, ii = inkList.length; i < ii; i++) { 7145 buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`); 7146 } 7147 buffer.push("S"); 7148 } 7149 return [points[0].x, points[1].x, points[3].y, points[1].y]; 7150 } 7151 }); 7152 } 7153 } 7154 static createNewDict(annotation, xref, { 7155 apRef, 7156 ap 7157 }) { 7158 const { 7159 color, 7160 opacity, 7161 paths, 7162 rect, 7163 rotation, 7164 thickness 7165 } = annotation; 7166 const ink = new _primitives.Dict(xref); 7167 ink.set("Type", _primitives.Name.get("Annot")); 7168 ink.set("Subtype", _primitives.Name.get("Ink")); 7169 ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`); 7170 ink.set("Rect", rect); 7171 ink.set("InkList", paths.map(p => p.points)); 7172 ink.set("F", 4); 7173 ink.set("Rotate", rotation); 7174 const bs = new _primitives.Dict(xref); 7175 ink.set("BS", bs); 7176 bs.set("W", thickness); 7177 ink.set("C", Array.from(color, c => c / 255)); 7178 ink.set("CA", opacity); 7179 const n = new _primitives.Dict(xref); 7180 ink.set("AP", n); 7181 if (apRef) { 7182 n.set("N", apRef); 7183 } else { 7184 n.set("N", ap); 7185 } 7186 return ink; 7187 } 7188 static async createNewAppearanceStream(annotation, xref, params) { 7189 const { 7190 color, 7191 rect, 7192 paths, 7193 thickness, 7194 opacity 7195 } = annotation; 7196 const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`]; 7197 if (opacity !== 1) { 7198 appearanceBuffer.push("/R0 gs"); 7199 } 7200 const buffer = []; 7201 for (const { 7202 bezier 7203 } of paths) { 7204 buffer.length = 0; 7205 buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`); 7206 for (let i = 2, ii = bezier.length; i < ii; i += 6) { 7207 const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" "); 7208 buffer.push(`${curve} c`); 7209 } 7210 buffer.push("S"); 7211 appearanceBuffer.push(buffer.join("\n")); 7212 } 7213 const appearance = appearanceBuffer.join("\n"); 7214 const appearanceStreamDict = new _primitives.Dict(xref); 7215 appearanceStreamDict.set("FormType", 1); 7216 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 7217 appearanceStreamDict.set("Type", _primitives.Name.get("XObject")); 7218 appearanceStreamDict.set("BBox", rect); 7219 appearanceStreamDict.set("Length", appearance.length); 7220 if (opacity !== 1) { 7221 const resources = new _primitives.Dict(xref); 7222 const extGState = new _primitives.Dict(xref); 7223 const r0 = new _primitives.Dict(xref); 7224 r0.set("CA", opacity);
7225 r0.set("Type", _primitives.Name.get("ExtGState")); 7226 extGState.set("R0", r0); 7227 resources.set("ExtGState", extGState); 7228 appearanceStreamDict.set("Resources", resources); 7229 } 7230 const ap = new _stream.StringStream(appearance); 7231 ap.dict = appearanceStreamDict; 7232 return ap; 7233 } 7234} 7235class HighlightAnnotation extends MarkupAnnotation { 7236 constructor(params) { 7237 super(params); 7238 const { 7239 dict, 7240 xref 7241 } = params; 7242 this.data.annotationType = _util.AnnotationType.HIGHLIGHT; 7243 const quadPoints = this.data.quadPoints = getQuadPoints(dict, null); 7244 if (quadPoints) { 7245 const resources = this.appearance?.dict.get("Resources"); 7246 if (!this.appearance || !resources?.has("ExtGState")) { 7247 if (this.appearance) { 7248 (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream."); 7249 } 7250 const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0]; 7251 const fillAlpha = dict.get("CA"); 7252 this._setDefaultAppearance({ 7253 xref, 7254 fillColor, 7255 blendMode: "Multiply", 7256 fillAlpha, 7257 pointsCallback: (buffer, points) => { 7258 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"); 7259 return [points[0].x, points[1].x, points[3].y, points[1].y]; 7260 } 7261 }); 7262 } 7263 } else { 7264 this.data.popupRef = null; 7265 } 7266 } 7267} 7268class UnderlineAnnotation extends MarkupAnnotation { 7269 constructor(params) { 7270 super(params); 7271 const { 7272 dict, 7273 xref 7274 } = params; 7275 this.data.annotationType = _util.AnnotationType.UNDERLINE; 7276 const quadPoints = this.data.quadPoints = getQuadPoints(dict, null); 7277 if (quadPoints) { 7278 if (!this.appearance) { 7279 const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0]; 7280 const strokeAlpha = dict.get("CA"); 7281 this._setDefaultAppearance({ 7282 xref, 7283 extra: "[] 0 d 0.571 w", 7284 strokeColor, 7285 strokeAlpha, 7286 pointsCallback: (buffer, points) => { 7287 buffer.push(`${points[2].x} ${points[2].y + 1.3} m`, `${points[3].x} ${points[3].y + 1.3} l`, "S"); 7288 return [points[0].x, points[1].x, points[3].y, points[1].y]; 7289 } 7290 }); 7291 } 7292 } else { 7293 this.data.popupRef = null; 7294 } 7295 } 7296} 7297class SquigglyAnnotation extends MarkupAnnotation { 7298 constructor(params) { 7299 super(params); 7300 const { 7301 dict, 7302 xref 7303 } = params; 7304 this.data.annotationType = _util.AnnotationType.SQUIGGLY; 7305 const quadPoints = this.data.quadPoints = getQuadPoints(dict, null); 7306 if (quadPoints) { 7307 if (!this.appearance) { 7308 const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0]; 7309 const strokeAlpha = dict.get("CA"); 7310 this._setDefaultAppearance({ 7311 xref, 7312 extra: "[] 0 d 1 w", 7313 strokeColor, 7314 strokeAlpha, 7315 pointsCallback: (buffer, points) => { 7316 const dy = (points[0].y - points[2].y) / 6; 7317 let shift = dy; 7318 let x = points[2].x; 7319 const y = points[2].y; 7320 const xEnd = points[3].x; 7321 buffer.push(`${x} ${y + shift} m`); 7322 do { 7323 x += 2; 7324 shift = shift === 0 ? dy : 0; 7325 buffer.push(`${x} ${y + shift} l`); 7326 } while (x < xEnd); 7327 buffer.push("S"); 7328 return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy]; 7329 } 7330 }); 7331 } 7332 } else { 7333 this.data.popupRef = null; 7334 } 7335 } 7336} 7337class StrikeOutAnnotation extends MarkupAnnotation { 7338 constructor(params) { 7339 super(params); 7340 const { 7341 dict, 7342 xref 7343 } = params; 7344 this.data.annotationType = _util.AnnotationType.STRIKEOUT; 7345 const quadPoints = this.data.quadPoints = getQuadPoints(dict, null); 7346 if (quadPoints) { 7347 if (!this.appearance) { 7348 const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0]; 7349 const strokeAlpha = dict.get("CA"); 7350 this._setDefaultAppearance({ 7351 xref, 7352 extra: "[] 0 d 1 w", 7353 strokeColor, 7354 strokeAlpha, 7355 pointsCallback: (buffer, points) => { 7356 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"); 7357 return [points[0].x, points[1].x, points[3].y, points[1].y]; 7358 } 7359 }); 7360 } 7361 } else { 7362 this.data.popupRef = null; 7363 } 7364 } 7365} 7366class StampAnnotation extends MarkupAnnotation { 7367 constructor(params) { 7368 super(params); 7369 this.data.annotationType = _util.AnnotationType.STAMP; 7370 this.data.hasOwnCanvas = this.data.noRotate; 7371 } 7372 static async createImage(bitmap, xref) { 7373 const { 7374 width, 7375 height 7376 } = bitmap; 7377 const canvas = new OffscreenCanvas(width, height); 7378 const ctx = canvas.getContext("2d", { 7379 alpha: true 7380 }); 7381 ctx.drawImage(bitmap, 0, 0); 7382 const data = ctx.getImageData(0, 0, width, height).data; 7383 const buf32 = new Uint32Array(data.buffer); 7384 const hasAlpha = buf32.some(_util.FeatureTest.isLittleEndian ? x => x >>> 24 !== 0xff : x => (x & 0xff) !== 0xff); 7385 if (hasAlpha) { 7386 ctx.fillStyle = "white"; 7387 ctx.fillRect(0, 0, width, height); 7388 ctx.drawImage(bitmap, 0, 0); 7389 } 7390 const jpegBufferPromise = canvas.convertToBlob({ 7391 type: "image/jpeg", 7392 quality: 1 7393 }).then(blob => { 7394 return blob.arrayBuffer(); 7395 }); 7396 const xobjectName = _primitives.Name.get("XObject"); 7397 const imageName = _primitives.Name.get("Image"); 7398 const image = new _primitives.Dict(xref); 7399 image.set("Type", xobjectName); 7400 image.set("Subtype", imageName); 7401 image.set("BitsPerComponent", 8); 7402 image.set("ColorSpace", _primitives.Name.get("DeviceRGB")); 7403 image.set("Filter", _primitives.Name.get("DCTDecode")); 7404 image.set("BBox", [0, 0, width, height]); 7405 image.set("Width", width); 7406 image.set("Height", height); 7407 let smaskStream = null; 7408 if (hasAlpha) {
7409 const alphaBuffer = new Uint8Array(buf32.length); 7410 if (_util.FeatureTest.isLittleEndian) { 7411 for (let i = 0, ii = buf32.length; i < ii; i++) { 7412 alphaBuffer[i] = buf32[i] >>> 24; 7413 } 7414 } else { 7415 for (let i = 0, ii = buf32.length; i < ii; i++) { 7416 alphaBuffer[i] = buf32[i] & 0xff; 7417 } 7418 } 7419 const smask = new _primitives.Dict(xref); 7420 smask.set("Type", xobjectName); 7421 smask.set("Subtype", imageName); 7422 smask.set("BitsPerComponent", 8); 7423 smask.set("ColorSpace", _primitives.Name.get("DeviceGray")); 7424 smask.set("Width", width); 7425 smask.set("Height", height); 7426 smaskStream = new _stream.Stream(alphaBuffer, 0, 0, smask); 7427 } 7428 const imageStream = new _stream.Stream(await jpegBufferPromise, 0, 0, image); 7429 return { 7430 imageStream, 7431 smaskStream, 7432 width, 7433 height 7434 }; 7435 } 7436 static createNewDict(annotation, xref, { 7437 apRef, 7438 ap 7439 }) { 7440 const { 7441 rect, 7442 rotation, 7443 user 7444 } = annotation; 7445 const stamp = new _primitives.Dict(xref); 7446 stamp.set("Type", _primitives.Name.get("Annot")); 7447 stamp.set("Subtype", _primitives.Name.get("Stamp")); 7448 stamp.set("CreationDate", `D:${(0, _util.getModificationDate)()}`); 7449 stamp.set("Rect", rect); 7450 stamp.set("F", 4); 7451 stamp.set("Border", [0, 0, 0]); 7452 stamp.set("Rotate", rotation); 7453 if (user) { 7454 stamp.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true)); 7455 } 7456 if (apRef || ap) { 7457 const n = new _primitives.Dict(xref); 7458 stamp.set("AP", n); 7459 if (apRef) { 7460 n.set("N", apRef); 7461 } else { 7462 n.set("N", ap); 7463 } 7464 } 7465 return stamp; 7466 } 7467 static async createNewAppearanceStream(annotation, xref, params) { 7468 const { 7469 rotation 7470 } = annotation; 7471 const { 7472 imageRef, 7473 width, 7474 height 7475 } = params.image; 7476 const resources = new _primitives.Dict(xref); 7477 const xobject = new _primitives.Dict(xref); 7478 resources.set("XObject", xobject); 7479 xobject.set("Im0", imageRef); 7480 const appearance = `q ${width} 0 0 ${height} 0 0 cm /Im0 Do Q`; 7481 const appearanceStreamDict = new _primitives.Dict(xref); 7482 appearanceStreamDict.set("FormType", 1); 7483 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 7484 appearanceStreamDict.set("Type", _primitives.Name.get("XObject")); 7485 appearanceStreamDict.set("BBox", [0, 0, width, height]); 7486 appearanceStreamDict.set("Resources", resources); 7487 if (rotation) { 7488 const matrix = (0, _core_utils.getRotationMatrix)(rotation, width, height); 7489 appearanceStreamDict.set("Matrix", matrix); 7490 } 7491 const ap = new _stream.StringStream(appearance); 7492 ap.dict = appearanceStreamDict; 7493 return ap; 7494 } 7495} 7496class FileAttachmentAnnotation extends MarkupAnnotation { 7497 constructor(params) { 7498 super(params); 7499 const { 7500 dict, 7501 xref 7502 } = params; 7503 const file = new _file_spec.FileSpec(dict.get("FS"), xref); 7504 this.data.annotationType = _util.AnnotationType.FILEATTACHMENT; 7505 this.data.hasOwnCanvas = this.data.noRotate; 7506 this.data.file = file.serializable; 7507 const name = dict.get("Name"); 7508 this.data.name = name instanceof _primitives.Name ? (0, _util.stringToPDFString)(name.name) : "PushPin"; 7509 const fillAlpha = dict.get("ca"); 7510 this.data.fillAlpha = typeof fillAlpha === "number" && fillAlpha >= 0 && fillAlpha <= 1 ? fillAlpha : null; 7511 } 7512} 7513 7514/***/ }), 7515/* 11 */ 7516/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 7517 7518 7519 7520Object.defineProperty(exports, "__esModule", ({ 7521 value: true 7522})); 7523exports.FakeUnicodeFont = void 0; 7524exports.createDefaultAppearance = createDefaultAppearance; 7525exports.getPdfColor = getPdfColor; 7526exports.parseAppearanceStream = parseAppearanceStream; 7527exports.parseDefaultAppearance = parseDefaultAppearance; 7528var _primitives = __w_pdfjs_require__(4); 7529var _core_utils = __w_pdfjs_require__(3); 7530var _util = __w_pdfjs_require__(2); 7531var _colorspace = __w_pdfjs_require__(12); 7532var _evaluator = __w_pdfjs_require__(13); 7533var _image_utils = __w_pdfjs_require__(59); 7534var _function = __w_pdfjs_require__(57); 7535var _stream = __w_pdfjs_require__(8); 7536class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor { 7537 constructor(str) { 7538 super(new _stream.StringStream(str)); 7539 } 7540 parse() { 7541 const operation = { 7542 fn: 0, 7543 args: [] 7544 }; 7545 const result = { 7546 fontSize: 0, 7547 fontName: "", 7548 fontColor: new Uint8ClampedArray(3) 7549 }; 7550 try { 7551 while (true) { 7552 operation.args.length = 0; 7553 if (!this.read(operation)) { 7554 break; 7555 } 7556 if (this.savedStatesDepth !== 0) { 7557 continue; 7558 } 7559 const { 7560 fn, 7561 args 7562 } = operation; 7563 switch (fn | 0) { 7564 case _util.OPS.setFont: 7565 const [fontName, fontSize] = args; 7566 if (fontName instanceof _primitives.Name) { 7567 result.fontName = fontName.name; 7568 } 7569 if (typeof fontSize === "number" && fontSize > 0) { 7570 result.fontSize = fontSize; 7571 } 7572 break; 7573 case _util.OPS.setFillRGBColor: 7574 _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0); 7575 break; 7576 case _util.OPS.setFillGray: 7577 _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0); 7578 break; 7579 case _util.OPS.setFillCMYKColor: 7580 _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0); 7581 break; 7582 } 7583 } 7584 } catch (reason) { 7585 (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`); 7586 } 7587 return result; 7588 } 7589} 7590function parseDefaultAppearance(str) { 7591 return new DefaultAppearanceEvaluator(str).parse(); 7592} 7593class AppearanceStreamEvaluator extends _evaluator.EvaluatorPreprocessor { 7594 constructor(stream, evaluatorOptions, xref) { 7595 super(stream); 7596 this.stream = stream; 7597 this.evaluatorOptions = evaluatorOptions; 7598 this.xref = xref; 7599 this.resources = stream.dict?.get("Resources"); 7600 } 7601 parse() { 7602 const operation = { 7603 fn: 0, 7604 args: [] 7605 }; 7606 let result = { 7607 scaleFactor: 1, 7608 fontSize: 0, 7609 fontName: "", 7610 fontColor: new Uint8ClampedArray(3), 7611 fillColorSpace: _colorspace.ColorSpace.singletons.gray 7612 }; 7613 let breakLoop = false;
7614 const stack = []; 7615 try { 7616 while (true) { 7617 operation.args.length = 0; 7618 if (breakLoop || !this.read(operation)) { 7619 break; 7620 } 7621 const { 7622 fn, 7623 args 7624 } = operation; 7625 switch (fn | 0) { 7626 case _util.OPS.save: 7627 stack.push({ 7628 scaleFactor: result.scaleFactor, 7629 fontSize: result.fontSize, 7630 fontName: result.fontName, 7631 fontColor: result.fontColor.slice(), 7632 fillColorSpace: result.fillColorSpace 7633 }); 7634 break; 7635 case _util.OPS.restore: 7636 result = stack.pop() || result; 7637 break; 7638 case _util.OPS.setTextMatrix: 7639 result.scaleFactor *= Math.hypot(args[0], args[1]); 7640 break; 7641 case _util.OPS.setFont: 7642 const [fontName, fontSize] = args; 7643 if (fontName instanceof _primitives.Name) { 7644 result.fontName = fontName.name; 7645 } 7646 if (typeof fontSize === "number" && fontSize > 0) { 7647 result.fontSize = fontSize * result.scaleFactor; 7648 } 7649 break; 7650 case _util.OPS.setFillColorSpace: 7651 result.fillColorSpace = _colorspace.ColorSpace.parse({ 7652 cs: args[0], 7653 xref: this.xref, 7654 resources: this.resources, 7655 pdfFunctionFactory: this._pdfFunctionFactory, 7656 localColorSpaceCache: this._localColorSpaceCache 7657 }); 7658 break; 7659 case _util.OPS.setFillColor: 7660 const cs = result.fillColorSpace; 7661 cs.getRgbItem(args, 0, result.fontColor, 0); 7662 break; 7663 case _util.OPS.setFillRGBColor: 7664 _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0); 7665 break; 7666 case _util.OPS.setFillGray: 7667 _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0); 7668 break; 7669 case _util.OPS.setFillCMYKColor: 7670 _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0); 7671 break; 7672 case _util.OPS.showText: 7673 case _util.OPS.showSpacedText: 7674 case _util.OPS.nextLineShowText: 7675 case _util.OPS.nextLineSetSpacingShowText: 7676 breakLoop = true; 7677 break; 7678 } 7679 } 7680 } catch (reason) { 7681 (0, _util.warn)(`parseAppearanceStream - ignoring errors: "${reason}".`); 7682 } 7683 this.stream.reset(); 7684 delete result.scaleFactor; 7685 delete result.fillColorSpace; 7686 return result; 7687 } 7688 get _localColorSpaceCache() { 7689 return (0, _util.shadow)(this, "_localColorSpaceCache", new _image_utils.LocalColorSpaceCache()); 7690 } 7691 get _pdfFunctionFactory() { 7692 const pdfFunctionFactory = new _function.PDFFunctionFactory({ 7693 xref: this.xref, 7694 isEvalSupported: this.evaluatorOptions.isEvalSupported 7695 }); 7696 return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory); 7697 } 7698} 7699function parseAppearanceStream(stream, evaluatorOptions, xref) { 7700 return new AppearanceStreamEvaluator(stream, evaluatorOptions, xref).parse(); 7701} 7702function getPdfColor(color, isFill) { 7703 if (color[0] === color[1] && color[1] === color[2]) { 7704 const gray = color[0] / 255; 7705 return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`; 7706 } 7707 return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`; 7708} 7709function createDefaultAppearance({ 7710 fontSize, 7711 fontName, 7712 fontColor 7713}) { 7714 return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`; 7715} 7716class FakeUnicodeFont { 7717 constructor(xref, fontFamily) { 7718 this.xref = xref; 7719 this.widths = null; 7720 this.firstChar = Infinity; 7721 this.lastChar = -Infinity; 7722 this.fontFamily = fontFamily; 7723 const canvas = new OffscreenCanvas(1, 1); 7724 this.ctxMeasure = canvas.getContext("2d"); 7725 if (!FakeUnicodeFont._fontNameId) { 7726 FakeUnicodeFont._fontNameId = 1; 7727 } 7728 this.fontName = _primitives.Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`); 7729 } 7730 get toUnicodeRef() { 7731 if (!FakeUnicodeFont._toUnicodeRef) { 7732 const toUnicode = `/CIDInit /ProcSet findresource begin 773312 dict begin 7734begincmap 7735/CIDSystemInfo 7736<< /Registry (Adobe) 7737/Ordering (UCS) /Supplement 0 >> def 7738/CMapName /Adobe-Identity-UCS def 7739/CMapType 2 def 77401 begincodespacerange 7741<0000> <FFFF> 7742endcodespacerange 77431 beginbfrange 7744<0000> <FFFF> <0000> 7745endbfrange 7746endcmap CMapName currentdict /CMap defineresource pop end end`; 7747 const toUnicodeStream = FakeUnicodeFont.toUnicodeStream = new _stream.StringStream(toUnicode); 7748 const toUnicodeDict = new _primitives.Dict(this.xref); 7749 toUnicodeStream.dict = toUnicodeDict; 7750 toUnicodeDict.set("Length", toUnicode.length); 7751 FakeUnicodeFont._toUnicodeRef = this.xref.getNewPersistentRef(toUnicodeStream); 7752 } 7753 return FakeUnicodeFont._toUnicodeRef; 7754 } 7755 get fontDescriptorRef() { 7756 if (!FakeUnicodeFont._fontDescriptorRef) { 7757 const fontDescriptor = new _primitives.Dict(this.xref); 7758 fontDescriptor.set("Type", _primitives.Name.get("FontDescriptor")); 7759 fontDescriptor.set("FontName", this.fontName); 7760 fontDescriptor.set("FontFamily", "MyriadPro Regular"); 7761 fontDescriptor.set("FontBBox", [0, 0, 0, 0]); 7762 fontDescriptor.set("FontStretch", _primitives.Name.get("Normal")); 7763 fontDescriptor.set("FontWeight", 400); 7764 fontDescriptor.set("ItalicAngle", 0); 7765 FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor); 7766 } 7767 return FakeUnicodeFont._fontDescriptorRef; 7768 } 7769 get descendantFontRef() { 7770 const descendantFont = new _primitives.Dict(this.xref); 7771 descendantFont.set("BaseFont", this.fontName); 7772 descendantFont.set("Type", _primitives.Name.get("Font")); 7773 descendantFont.set("Subtype", _primitives.Name.get("CIDFontType0")); 7774 descendantFont.set("CIDToGIDMap", _primitives.Name.get("Identity")); 7775 descendantFont.set("FirstChar", this.firstChar); 7776 descendantFont.set("LastChar", this.lastChar); 7777 descendantFont.set("FontDescriptor", this.fontDescriptorRef); 7778 descendantFont.set("DW", 1000); 7779 const widths = []; 7780 const chars = [...this.widths.entries()].sort();
vendor: 4,311 bytes, lines 7781-7897
7781 let currentChar = null; 7782 let currentWidths = null; 7783 for (const [char, width] of chars) { 7784 if (!currentChar) { 7785 currentChar = char; 7786 currentWidths = [width]; 7787 continue; 7788 } 7789 if (char === currentChar + currentWidths.length) { 7790 currentWidths.push(width); 7791 } else { 7792 widths.push(currentChar, currentWidths); 7793 currentChar = char; 7794 currentWidths = [width]; 7795 } 7796 } 7797 if (currentChar) { 7798 widths.push(currentChar, currentWidths); 7799 } 7800 descendantFont.set("W", widths); 7801 const cidSystemInfo = new _primitives.Dict(this.xref); 7802 cidSystemInfo.set("Ordering", "Identity"); 7803 cidSystemInfo.set("Registry", "Adobe"); 7804 cidSystemInfo.set("Supplement", 0); 7805 descendantFont.set("CIDSystemInfo", cidSystemInfo); 7806 return this.xref.getNewPersistentRef(descendantFont); 7807 } 7808 get baseFontRef() { 7809 const baseFont = new _primitives.Dict(this.xref); 7810 baseFont.set("BaseFont", this.fontName); 7811 baseFont.set("Type", _primitives.Name.get("Font")); 7812 baseFont.set("Subtype", _primitives.Name.get("Type0")); 7813 baseFont.set("Encoding", _primitives.Name.get("Identity-H")); 7814 baseFont.set("DescendantFonts", [this.descendantFontRef]); 7815 baseFont.set("ToUnicode", this.toUnicodeRef); 7816 return this.xref.getNewPersistentRef(baseFont); 7817 } 7818 get resources() { 7819 const resources = new _primitives.Dict(this.xref); 7820 const font = new _primitives.Dict(this.xref); 7821 font.set(this.fontName.name, this.baseFontRef); 7822 resources.set("Font", font); 7823 return resources; 7824 } 7825 _createContext() { 7826 this.widths = new Map(); 7827 this.ctxMeasure.font = `1000px ${this.fontFamily}`; 7828 return this.ctxMeasure; 7829 } 7830 createFontResources(text) { 7831 const ctx = this._createContext(); 7832 for (const line of text.split(/\r\n?|\n/)) { 7833 for (const char of line.split("")) { 7834 const code = char.charCodeAt(0); 7835 if (this.widths.has(code)) { 7836 continue; 7837 } 7838 const metrics = ctx.measureText(char); 7839 const width = Math.ceil(metrics.width); 7840 this.widths.set(code, width); 7841 this.firstChar = Math.min(code, this.firstChar); 7842 this.lastChar = Math.max(code, this.lastChar); 7843 } 7844 } 7845 return this.resources; 7846 } 7847 createAppearance(text, rect, rotation, fontSize, bgColor, strokeAlpha) { 7848 const ctx = this._createContext(); 7849 const lines = []; 7850 let maxWidth = -Infinity; 7851 for (const line of text.split(/\r\n?|\n/)) { 7852 lines.push(line); 7853 const lineWidth = ctx.measureText(line).width; 7854 maxWidth = Math.max(maxWidth, lineWidth); 7855 for (const char of line.split("")) { 7856 const code = char.charCodeAt(0); 7857 let width = this.widths.get(code); 7858 if (width === undefined) { 7859 const metrics = ctx.measureText(char); 7860 width = Math.ceil(metrics.width); 7861 this.widths.set(code, width); 7862 this.firstChar = Math.min(code, this.firstChar); 7863 this.lastChar = Math.max(code, this.lastChar); 7864 } 7865 } 7866 } 7867 maxWidth *= fontSize / 1000; 7868 const [x1, y1, x2, y2] = rect; 7869 let w = x2 - x1; 7870 let h = y2 - y1; 7871 if (rotation % 180 !== 0) { 7872 [w, h] = [h, w]; 7873 } 7874 let hscale = 1; 7875 if (maxWidth > w) { 7876 hscale = w / maxWidth; 7877 } 7878 let vscale = 1; 7879 const lineHeight = _util.LINE_FACTOR * fontSize; 7880 const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize; 7881 const maxHeight = lineHeight * lines.length; 7882 if (maxHeight > h) { 7883 vscale = h / maxHeight; 7884 } 7885 const fscale = Math.min(hscale, vscale); 7886 const newFontSize = fontSize * fscale; 7887 const buffer = ["q", `0 0 ${(0, _core_utils.numberToString)(w)} ${(0, _core_utils.numberToString)(h)} re W n`, `BT`, `1 0 0 1 0 ${(0, _core_utils.numberToString)(h + lineDescent)} Tm 0 Tc ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${(0, _core_utils.numberToString)(newFontSize)} Tf`]; 7888 const { 7889 resources 7890 } = this; 7891 strokeAlpha = typeof strokeAlpha === "number" && strokeAlpha >= 0 && strokeAlpha <= 1 ? strokeAlpha : 1; 7892 if (strokeAlpha !== 1) { 7893 buffer.push("/R0 gs"); 7894 const extGState = new _primitives.Dict(this.xref); 7895 const r0 = new _primitives.Dict(this.xref); 7896 r0.set("ca", strokeAlpha); 7897 r0.set("CA", strokeAlpha);
7898 r0.set("Type", _primitives.Name.get("ExtGState")); 7899 extGState.set("R0", r0); 7900 resources.set("ExtGState", extGState); 7901 } 7902 const vShift = (0, _core_utils.numberToString)(lineHeight); 7903 for (const line of lines) { 7904 buffer.push(`0 -${vShift} Td <${(0, _core_utils.stringToUTF16HexString)(line)}> Tj`); 7905 } 7906 buffer.push("ET", "Q"); 7907 const appearance = buffer.join("\n"); 7908 const appearanceStreamDict = new _primitives.Dict(this.xref); 7909 appearanceStreamDict.set("Subtype", _primitives.Name.get("Form")); 7910 appearanceStreamDict.set("Type", _primitives.Name.get("XObject")); 7911 appearanceStreamDict.set("BBox", [0, 0, w, h]); 7912 appearanceStreamDict.set("Length", appearance.length); 7913 appearanceStreamDict.set("Resources", resources); 7914 if (rotation) { 7915 const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h); 7916 appearanceStreamDict.set("Matrix", matrix); 7917 } 7918 const ap = new _stream.StringStream(appearance); 7919 ap.dict = appearanceStreamDict; 7920 return ap; 7921 } 7922} 7923exports.FakeUnicodeFont = FakeUnicodeFont; 7924 7925/***/ }), 7926/* 12 */ 7927/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 7928 7929 7930 7931Object.defineProperty(exports, "__esModule", ({ 7932 value: true 7933})); 7934exports.ColorSpace = void 0; 7935var _util = __w_pdfjs_require__(2); 7936var _primitives = __w_pdfjs_require__(4); 7937var _base_stream = __w_pdfjs_require__(5); 7938var _core_utils = __w_pdfjs_require__(3); 7939function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) { 7940 const COMPONENTS = 3; 7941 alpha01 = alpha01 !== 1 ? 0 : alpha01; 7942 const xRatio = w1 / w2; 7943 const yRatio = h1 / h2; 7944 let newIndex = 0, 7945 oldIndex; 7946 const xScaled = new Uint16Array(w2); 7947 const w1Scanline = w1 * COMPONENTS; 7948 for (let i = 0; i < w2; i++) { 7949 xScaled[i] = Math.floor(i * xRatio) * COMPONENTS; 7950 } 7951 for (let i = 0; i < h2; i++) { 7952 const py = Math.floor(i * yRatio) * w1Scanline; 7953 for (let j = 0; j < w2; j++) { 7954 oldIndex = py + xScaled[j]; 7955 dest[newIndex++] = src[oldIndex++]; 7956 dest[newIndex++] = src[oldIndex++]; 7957 dest[newIndex++] = src[oldIndex++]; 7958 newIndex += alpha01; 7959 } 7960 } 7961} 7962class ColorSpace { 7963 constructor(name, numComps) { 7964 if (this.constructor === ColorSpace) { 7965 (0, _util.unreachable)("Cannot initialize ColorSpace."); 7966 } 7967 this.name = name; 7968 this.numComps = numComps; 7969 } 7970 getRgb(src, srcOffset) { 7971 const rgb = new Uint8ClampedArray(3); 7972 this.getRgbItem(src, srcOffset, rgb, 0); 7973 return rgb; 7974 } 7975 getRgbItem(src, srcOffset, dest, destOffset) { 7976 (0, _util.unreachable)("Should not call ColorSpace.getRgbItem"); 7977 } 7978 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 7979 (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer"); 7980 } 7981 getOutputLength(inputLength, alpha01) { 7982 (0, _util.unreachable)("Should not call ColorSpace.getOutputLength"); 7983 } 7984 isPassthrough(bits) { 7985 return false; 7986 } 7987 isDefaultDecode(decodeMap, bpc) { 7988 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 7989 } 7990 fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) { 7991 const count = originalWidth * originalHeight; 7992 let rgbBuf = null; 7993 const numComponentColors = 1 << bpc; 7994 const needsResizing = originalHeight !== height || originalWidth !== width; 7995 if (this.isPassthrough(bpc)) { 7996 rgbBuf = comps; 7997 } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") { 7998 const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors); 7999 for (let i = 0; i < numComponentColors; i++) { 8000 allColors[i] = i; 8001 } 8002 const colorMap = new Uint8ClampedArray(numComponentColors * 3); 8003 this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0); 8004 if (!needsResizing) { 8005 let destPos = 0; 8006 for (let i = 0; i < count; ++i) { 8007 const key = comps[i] * 3; 8008 dest[destPos++] = colorMap[key]; 8009 dest[destPos++] = colorMap[key + 1]; 8010 dest[destPos++] = colorMap[key + 2]; 8011 destPos += alpha01; 8012 } 8013 } else { 8014 rgbBuf = new Uint8Array(count * 3); 8015 let rgbPos = 0; 8016 for (let i = 0; i < count; ++i) {
8017 const key = comps[i] * 3; 8018 rgbBuf[rgbPos++] = colorMap[key]; 8019 rgbBuf[rgbPos++] = colorMap[key + 1]; 8020 rgbBuf[rgbPos++] = colorMap[key + 2]; 8021 } 8022 } 8023 } else if (!needsResizing) { 8024 this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01); 8025 } else { 8026 rgbBuf = new Uint8ClampedArray(count * 3); 8027 this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0); 8028 } 8029 if (rgbBuf) { 8030 if (needsResizing) { 8031 resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01); 8032 } else { 8033 let destPos = 0, 8034 rgbPos = 0; 8035 for (let i = 0, ii = width * actualHeight; i < ii; i++) { 8036 dest[destPos++] = rgbBuf[rgbPos++]; 8037 dest[destPos++] = rgbBuf[rgbPos++]; 8038 dest[destPos++] = rgbBuf[rgbPos++]; 8039 destPos += alpha01; 8040 } 8041 } 8042 } 8043 } 8044 get usesZeroToOneRange() { 8045 return (0, _util.shadow)(this, "usesZeroToOneRange", true); 8046 } 8047 static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) { 8048 if (!localColorSpaceCache) { 8049 throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.'); 8050 } 8051 if (!parsedColorSpace) { 8052 throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.'); 8053 } 8054 let csName, csRef; 8055 if (cacheKey instanceof _primitives.Ref) { 8056 csRef = cacheKey; 8057 cacheKey = xref.fetch(cacheKey); 8058 } 8059 if (cacheKey instanceof _primitives.Name) { 8060 csName = cacheKey.name; 8061 } 8062 if (csName || csRef) { 8063 localColorSpaceCache.set(csName, csRef, parsedColorSpace); 8064 } 8065 } 8066 static getCached(cacheKey, xref, localColorSpaceCache) { 8067 if (!localColorSpaceCache) { 8068 throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.'); 8069 } 8070 if (cacheKey instanceof _primitives.Ref) { 8071 const localColorSpace = localColorSpaceCache.getByRef(cacheKey); 8072 if (localColorSpace) { 8073 return localColorSpace; 8074 } 8075 try { 8076 cacheKey = xref.fetch(cacheKey); 8077 } catch (ex) { 8078 if (ex instanceof _core_utils.MissingDataException) { 8079 throw ex; 8080 } 8081 } 8082 } 8083 if (cacheKey instanceof _primitives.Name) { 8084 const localColorSpace = localColorSpaceCache.getByName(cacheKey.name); 8085 if (localColorSpace) { 8086 return localColorSpace; 8087 } 8088 } 8089 return null; 8090 } 8091 static async parseAsync({ 8092 cs, 8093 xref, 8094 resources = null, 8095 pdfFunctionFactory, 8096 localColorSpaceCache 8097 }) { 8098 const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory); 8099 this._cache(cs, xref, localColorSpaceCache, parsedColorSpace); 8100 return parsedColorSpace; 8101 } 8102 static parse({ 8103 cs, 8104 xref, 8105 resources = null, 8106 pdfFunctionFactory, 8107 localColorSpaceCache 8108 }) { 8109 const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache); 8110 if (cachedColorSpace) { 8111 return cachedColorSpace; 8112 } 8113 const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory); 8114 this._cache(cs, xref, localColorSpaceCache, parsedColorSpace); 8115 return parsedColorSpace; 8116 } 8117 static _parse(cs, xref, resources = null, pdfFunctionFactory) { 8118 cs = xref.fetchIfRef(cs); 8119 if (cs instanceof _primitives.Name) { 8120 switch (cs.name) { 8121 case "G": 8122 case "DeviceGray": 8123 return this.singletons.gray; 8124 case "RGB": 8125 case "DeviceRGB": 8126 return this.singletons.rgb; 8127 case "CMYK": 8128 case "DeviceCMYK": 8129 return this.singletons.cmyk; 8130 case "Pattern": 8131 return new PatternCS(null); 8132 default: 8133 if (resources instanceof _primitives.Dict) { 8134 const colorSpaces = resources.get("ColorSpace"); 8135 if (colorSpaces instanceof _primitives.Dict) { 8136 const resourcesCS = colorSpaces.get(cs.name); 8137 if (resourcesCS) { 8138 if (resourcesCS instanceof _primitives.Name) { 8139 return this._parse(resourcesCS, xref, resources, pdfFunctionFactory); 8140 } 8141 cs = resourcesCS; 8142 break; 8143 } 8144 } 8145 } 8146 throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`); 8147 } 8148 } 8149 if (Array.isArray(cs)) { 8150 const mode = xref.fetchIfRef(cs[0]).name; 8151 let params, numComps, baseCS, whitePoint, blackPoint, gamma; 8152 switch (mode) { 8153 case "G": 8154 case "DeviceGray": 8155 return this.singletons.gray; 8156 case "RGB": 8157 case "DeviceRGB": 8158 return this.singletons.rgb; 8159 case "CMYK": 8160 case "DeviceCMYK": 8161 return this.singletons.cmyk; 8162 case "CalGray": 8163 params = xref.fetchIfRef(cs[1]); 8164 whitePoint = params.getArray("WhitePoint"); 8165 blackPoint = params.getArray("BlackPoint"); 8166 gamma = params.get("Gamma"); 8167 return new CalGrayCS(whitePoint, blackPoint, gamma); 8168 case "CalRGB": 8169 params = xref.fetchIfRef(cs[1]); 8170 whitePoint = params.getArray("WhitePoint"); 8171 blackPoint = params.getArray("BlackPoint"); 8172 gamma = params.getArray("Gamma"); 8173 const matrix = params.getArray("Matrix"); 8174 return new CalRGBCS(whitePoint, blackPoint, gamma, matrix); 8175 case "ICCBased": 8176 const stream = xref.fetchIfRef(cs[1]); 8177 const dict = stream.dict; 8178 numComps = dict.get("N"); 8179 const alt = dict.get("Alternate"); 8180 if (alt) { 8181 const altCS = this._parse(alt, xref, resources, pdfFunctionFactory); 8182 if (altCS.numComps === numComps) { 8183 return altCS; 8184 } 8185 (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry."); 8186 } 8187 if (numComps === 1) { 8188 return this.singletons.gray; 8189 } else if (numComps === 3) { 8190 return this.singletons.rgb; 8191 } else if (numComps === 4) { 8192 return this.singletons.cmyk; 8193 } 8194 break; 8195 case "Pattern": 8196 baseCS = cs[1] || null; 8197 if (baseCS) { 8198 baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory); 8199 } 8200 return new PatternCS(baseCS); 8201 case "I": 8202 case "Indexed": 8203 baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory); 8204 const hiVal = xref.fetchIfRef(cs[2]) + 1; 8205 const lookup = xref.fetchIfRef(cs[3]); 8206 return new IndexedCS(baseCS, hiVal, lookup); 8207 case "Separation": 8208 case "DeviceN": 8209 const name = xref.fetchIfRef(cs[1]); 8210 numComps = Array.isArray(name) ? name.length : 1; 8211 baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory); 8212 const tintFn = pdfFunctionFactory.create(cs[3]); 8213 return new AlternateCS(numComps, baseCS, tintFn); 8214 case "Lab": 8215 params = xref.fetchIfRef(cs[1]); 8216 whitePoint = params.getArray("WhitePoint"); 8217 blackPoint = params.getArray("BlackPoint"); 8218 const range = params.getArray("Range");
8219 return new LabCS(whitePoint, blackPoint, range); 8220 default: 8221 throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`); 8222 } 8223 } 8224 throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`); 8225 } 8226 static isDefaultDecode(decode, numComps) { 8227 if (!Array.isArray(decode)) { 8228 return true; 8229 } 8230 if (numComps * 2 !== decode.length) { 8231 (0, _util.warn)("The decode map is not the correct length"); 8232 return true; 8233 } 8234 for (let i = 0, ii = decode.length; i < ii; i += 2) { 8235 if (decode[i] !== 0 || decode[i + 1] !== 1) { 8236 return false; 8237 } 8238 } 8239 return true; 8240 } 8241 static get singletons() { 8242 return (0, _util.shadow)(this, "singletons", { 8243 get gray() { 8244 return (0, _util.shadow)(this, "gray", new DeviceGrayCS()); 8245 }, 8246 get rgb() { 8247 return (0, _util.shadow)(this, "rgb", new DeviceRgbCS()); 8248 }, 8249 get cmyk() { 8250 return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS()); 8251 } 8252 }); 8253 } 8254} 8255exports.ColorSpace = ColorSpace; 8256class AlternateCS extends ColorSpace { 8257 constructor(numComps, base, tintFn) { 8258 super("Alternate", numComps); 8259 this.base = base; 8260 this.tintFn = tintFn; 8261 this.tmpBuf = new Float32Array(base.numComps); 8262 } 8263 getRgbItem(src, srcOffset, dest, destOffset) { 8264 const tmpBuf = this.tmpBuf; 8265 this.tintFn(src, srcOffset, tmpBuf, 0); 8266 this.base.getRgbItem(tmpBuf, 0, dest, destOffset); 8267 } 8268 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8269 const tintFn = this.tintFn; 8270 const base = this.base; 8271 const scale = 1 / ((1 << bits) - 1); 8272 const baseNumComps = base.numComps; 8273 const usesZeroToOneRange = base.usesZeroToOneRange; 8274 const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0; 8275 let pos = isPassthrough ? destOffset : 0; 8276 const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count); 8277 const numComps = this.numComps; 8278 const scaled = new Float32Array(numComps); 8279 const tinted = new Float32Array(baseNumComps); 8280 let i, j; 8281 for (i = 0; i < count; i++) { 8282 for (j = 0; j < numComps; j++) { 8283 scaled[j] = src[srcOffset++] * scale; 8284 } 8285 tintFn(scaled, 0, tinted, 0); 8286 if (usesZeroToOneRange) { 8287 for (j = 0; j < baseNumComps; j++) { 8288 baseBuf[pos++] = tinted[j] * 255; 8289 } 8290 } else { 8291 base.getRgbItem(tinted, 0, baseBuf, pos); 8292 pos += baseNumComps; 8293 } 8294 } 8295 if (!isPassthrough) { 8296 base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01); 8297 } 8298 } 8299 getOutputLength(inputLength, alpha01) { 8300 return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01); 8301 } 8302} 8303class PatternCS extends ColorSpace { 8304 constructor(baseCS) { 8305 super("Pattern", null); 8306 this.base = baseCS; 8307 } 8308 isDefaultDecode(decodeMap, bpc) { 8309 (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode"); 8310 } 8311} 8312class IndexedCS extends ColorSpace { 8313 constructor(base, highVal, lookup) { 8314 super("Indexed", 1); 8315 this.base = base; 8316 this.highVal = highVal; 8317 const length = base.numComps * highVal; 8318 this.lookup = new Uint8Array(length); 8319 if (lookup instanceof _base_stream.BaseStream) { 8320 const bytes = lookup.getBytes(length); 8321 this.lookup.set(bytes); 8322 } else if (typeof lookup === "string") { 8323 for (let i = 0; i < length; ++i) { 8324 this.lookup[i] = lookup.charCodeAt(i) & 0xff; 8325 } 8326 } else { 8327 throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`); 8328 } 8329 } 8330 getRgbItem(src, srcOffset, dest, destOffset) { 8331 const numComps = this.base.numComps; 8332 const start = src[srcOffset] * numComps; 8333 this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0); 8334 } 8335 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8336 const base = this.base; 8337 const numComps = base.numComps; 8338 const outputDelta = base.getOutputLength(numComps, alpha01); 8339 const lookup = this.lookup; 8340 for (let i = 0; i < count; ++i) {
vendor: 19,197 bytes, lines 8341-8853
8341 const lookupPos = src[srcOffset++] * numComps; 8342 base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01); 8343 destOffset += outputDelta; 8344 } 8345 } 8346 getOutputLength(inputLength, alpha01) { 8347 return this.base.getOutputLength(inputLength * this.base.numComps, alpha01); 8348 } 8349 isDefaultDecode(decodeMap, bpc) { 8350 if (!Array.isArray(decodeMap)) { 8351 return true; 8352 } 8353 if (decodeMap.length !== 2) { 8354 (0, _util.warn)("Decode map length is not correct"); 8355 return true; 8356 } 8357 if (!Number.isInteger(bpc) || bpc < 1) { 8358 (0, _util.warn)("Bits per component is not correct"); 8359 return true; 8360 } 8361 return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1; 8362 } 8363} 8364class DeviceGrayCS extends ColorSpace { 8365 constructor() { 8366 super("DeviceGray", 1); 8367 } 8368 getRgbItem(src, srcOffset, dest, destOffset) { 8369 const c = src[srcOffset] * 255; 8370 dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c; 8371 } 8372 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8373 const scale = 255 / ((1 << bits) - 1); 8374 let j = srcOffset, 8375 q = destOffset; 8376 for (let i = 0; i < count; ++i) { 8377 const c = scale * src[j++]; 8378 dest[q++] = c; 8379 dest[q++] = c; 8380 dest[q++] = c; 8381 q += alpha01; 8382 } 8383 } 8384 getOutputLength(inputLength, alpha01) { 8385 return inputLength * (3 + alpha01); 8386 } 8387} 8388class DeviceRgbCS extends ColorSpace { 8389 constructor() { 8390 super("DeviceRGB", 3); 8391 } 8392 getRgbItem(src, srcOffset, dest, destOffset) { 8393 dest[destOffset] = src[srcOffset] * 255; 8394 dest[destOffset + 1] = src[srcOffset + 1] * 255; 8395 dest[destOffset + 2] = src[srcOffset + 2] * 255; 8396 } 8397 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8398 if (bits === 8 && alpha01 === 0) { 8399 dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset); 8400 return; 8401 } 8402 const scale = 255 / ((1 << bits) - 1); 8403 let j = srcOffset, 8404 q = destOffset; 8405 for (let i = 0; i < count; ++i) { 8406 dest[q++] = scale * src[j++]; 8407 dest[q++] = scale * src[j++]; 8408 dest[q++] = scale * src[j++]; 8409 q += alpha01; 8410 } 8411 } 8412 getOutputLength(inputLength, alpha01) { 8413 return inputLength * (3 + alpha01) / 3 | 0; 8414 } 8415 isPassthrough(bits) { 8416 return bits === 8; 8417 } 8418} 8419class DeviceCmykCS extends ColorSpace { 8420 constructor() { 8421 super("DeviceCMYK", 4); 8422 } 8423 #toRgb(src, srcOffset, srcScale, dest, destOffset) { 8424 const c = src[srcOffset] * srcScale; 8425 const m = src[srcOffset + 1] * srcScale; 8426 const y = src[srcOffset + 2] * srcScale; 8427 const k = src[srcOffset + 3] * srcScale; 8428 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); 8429 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); 8430 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); 8431 } 8432 getRgbItem(src, srcOffset, dest, destOffset) { 8433 this.#toRgb(src, srcOffset, 1, dest, destOffset); 8434 } 8435 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8436 const scale = 1 / ((1 << bits) - 1); 8437 for (let i = 0; i < count; i++) { 8438 this.#toRgb(src, srcOffset, scale, dest, destOffset); 8439 srcOffset += 4; 8440 destOffset += 3 + alpha01; 8441 } 8442 } 8443 getOutputLength(inputLength, alpha01) { 8444 return inputLength / 4 * (3 + alpha01) | 0; 8445 } 8446} 8447class CalGrayCS extends ColorSpace { 8448 constructor(whitePoint, blackPoint, gamma) { 8449 super("CalGray", 1); 8450 if (!whitePoint) { 8451 throw new _util.FormatError("WhitePoint missing - required for color space CalGray"); 8452 } 8453 [this.XW, this.YW, this.ZW] = whitePoint; 8454 [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0]; 8455 this.G = gamma || 1; 8456 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 8457 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`); 8458 } 8459 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 8460 (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`); 8461 this.XB = this.YB = this.ZB = 0; 8462 } 8463 if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) { 8464 (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`); 8465 } 8466 if (this.G < 1) { 8467 (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`); 8468 this.G = 1; 8469 } 8470 } 8471 #toRgb(src, srcOffset, dest, destOffset, scale) { 8472 const A = src[srcOffset] * scale; 8473 const AG = A ** this.G; 8474 const L = this.YW * AG; 8475 const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0); 8476 dest[destOffset] = val; 8477 dest[destOffset + 1] = val; 8478 dest[destOffset + 2] = val; 8479 } 8480 getRgbItem(src, srcOffset, dest, destOffset) { 8481 this.#toRgb(src, srcOffset, dest, destOffset, 1); 8482 } 8483 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8484 const scale = 1 / ((1 << bits) - 1); 8485 for (let i = 0; i < count; ++i) { 8486 this.#toRgb(src, srcOffset, dest, destOffset, scale); 8487 srcOffset += 1; 8488 destOffset += 3 + alpha01; 8489 } 8490 } 8491 getOutputLength(inputLength, alpha01) { 8492 return inputLength * (3 + alpha01); 8493 } 8494} 8495class CalRGBCS extends ColorSpace { 8496 static #BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]); 8497 static #BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]); 8498 static #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]); 8499 static #FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]); 8500 static #tempNormalizeMatrix = new Float32Array(3); 8501 static #tempConvertMatrix1 = new Float32Array(3); 8502 static #tempConvertMatrix2 = new Float32Array(3); 8503 static #DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0; 8504 constructor(whitePoint, blackPoint, gamma, matrix) { 8505 super("CalRGB", 3); 8506 if (!whitePoint) { 8507 throw new _util.FormatError("WhitePoint missing - required for color space CalRGB"); 8508 } 8509 const [XW, YW, ZW] = this.whitePoint = whitePoint; 8510 const [XB, YB, ZB] = this.blackPoint = blackPoint || new Float32Array(3); 8511 [this.GR, this.GG, this.GB] = gamma || new Float32Array([1, 1, 1]); 8512 [this.MXA, this.MYA, this.MZA, this.MXB, this.MYB, this.MZB, this.MXC, this.MYC, this.MZC] = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); 8513 if (XW < 0 || ZW < 0 || YW !== 1) { 8514 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`); 8515 } 8516 if (XB < 0 || YB < 0 || ZB < 0) { 8517 (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default."); 8518 this.blackPoint = new Float32Array(3); 8519 } 8520 if (this.GR < 0 || this.GG < 0 || this.GB < 0) { 8521 (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`); 8522 this.GR = this.GG = this.GB = 1; 8523 } 8524 } 8525 #matrixProduct(a, b, result) { 8526 result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 8527 result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2]; 8528 result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2]; 8529 } 8530 #toFlat(sourceWhitePoint, LMS, result) { 8531 result[0] = LMS[0] * 1 / sourceWhitePoint[0]; 8532 result[1] = LMS[1] * 1 / sourceWhitePoint[1]; 8533 result[2] = LMS[2] * 1 / sourceWhitePoint[2]; 8534 } 8535 #toD65(sourceWhitePoint, LMS, result) { 8536 const D65X = 0.95047; 8537 const D65Y = 1; 8538 const D65Z = 1.08883; 8539 result[0] = LMS[0] * D65X / sourceWhitePoint[0]; 8540 result[1] = LMS[1] * D65Y / sourceWhitePoint[1]; 8541 result[2] = LMS[2] * D65Z / sourceWhitePoint[2]; 8542 } 8543 #sRGBTransferFunction(color) { 8544 if (color <= 0.0031308) { 8545 return this.#adjustToRange(0, 1, 12.92 * color); 8546 } 8547 if (color >= 0.99554525) { 8548 return 1; 8549 } 8550 return this.#adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055); 8551 } 8552 #adjustToRange(min, max, value) { 8553 return Math.max(min, Math.min(max, value)); 8554 } 8555 #decodeL(L) { 8556 if (L < 0) { 8557 return -this.#decodeL(-L); 8558 } 8559 if (L > 8.0) { 8560 return ((L + 16) / 116) ** 3; 8561 } 8562 return L * CalRGBCS.#DECODE_L_CONSTANT; 8563 } 8564 #compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) { 8565 if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) { 8566 result[0] = XYZ_Flat[0]; 8567 result[1] = XYZ_Flat[1]; 8568 result[2] = XYZ_Flat[2]; 8569 return; 8570 } 8571 const zeroDecodeL = this.#decodeL(0); 8572 const X_DST = zeroDecodeL; 8573 const X_SRC = this.#decodeL(sourceBlackPoint[0]); 8574 const Y_DST = zeroDecodeL; 8575 const Y_SRC = this.#decodeL(sourceBlackPoint[1]); 8576 const Z_DST = zeroDecodeL; 8577 const Z_SRC = this.#decodeL(sourceBlackPoint[2]); 8578 const X_Scale = (1 - X_DST) / (1 - X_SRC); 8579 const X_Offset = 1 - X_Scale; 8580 const Y_Scale = (1 - Y_DST) / (1 - Y_SRC); 8581 const Y_Offset = 1 - Y_Scale; 8582 const Z_Scale = (1 - Z_DST) / (1 - Z_SRC); 8583 const Z_Offset = 1 - Z_Scale; 8584 result[0] = XYZ_Flat[0] * X_Scale + X_Offset; 8585 result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset; 8586 result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset; 8587 } 8588 #normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) { 8589 if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) { 8590 result[0] = XYZ_In[0]; 8591 result[1] = XYZ_In[1]; 8592 result[2] = XYZ_In[2]; 8593 return; 8594 } 8595 const LMS = result; 8596 this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 8597 const LMS_Flat = CalRGBCS.#tempNormalizeMatrix; 8598 this.#toFlat(sourceWhitePoint, LMS, LMS_Flat); 8599 this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result); 8600 } 8601 #normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) { 8602 const LMS = result; 8603 this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 8604 const LMS_D65 = CalRGBCS.#tempNormalizeMatrix; 8605 this.#toD65(sourceWhitePoint, LMS, LMS_D65); 8606 this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result); 8607 } 8608 #toRgb(src, srcOffset, dest, destOffset, scale) { 8609 const A = this.#adjustToRange(0, 1, src[srcOffset] * scale); 8610 const B = this.#adjustToRange(0, 1, src[srcOffset + 1] * scale); 8611 const C = this.#adjustToRange(0, 1, src[srcOffset + 2] * scale); 8612 const AGR = A === 1 ? 1 : A ** this.GR; 8613 const BGG = B === 1 ? 1 : B ** this.GG; 8614 const CGB = C === 1 ? 1 : C ** this.GB; 8615 const X = this.MXA * AGR + this.MXB * BGG + this.MXC * CGB; 8616 const Y = this.MYA * AGR + this.MYB * BGG + this.MYC * CGB; 8617 const Z = this.MZA * AGR + this.MZB * BGG + this.MZC * CGB; 8618 const XYZ = CalRGBCS.#tempConvertMatrix1; 8619 XYZ[0] = X; 8620 XYZ[1] = Y; 8621 XYZ[2] = Z; 8622 const XYZ_Flat = CalRGBCS.#tempConvertMatrix2; 8623 this.#normalizeWhitePointToFlat(this.whitePoint, XYZ, XYZ_Flat); 8624 const XYZ_Black = CalRGBCS.#tempConvertMatrix1; 8625 this.#compensateBlackPoint(this.blackPoint, XYZ_Flat, XYZ_Black); 8626 const XYZ_D65 = CalRGBCS.#tempConvertMatrix2; 8627 this.#normalizeWhitePointToD65(CalRGBCS.#FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65); 8628 const SRGB = CalRGBCS.#tempConvertMatrix1; 8629 this.#matrixProduct(CalRGBCS.#SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB); 8630 dest[destOffset] = this.#sRGBTransferFunction(SRGB[0]) * 255; 8631 dest[destOffset + 1] = this.#sRGBTransferFunction(SRGB[1]) * 255; 8632 dest[destOffset + 2] = this.#sRGBTransferFunction(SRGB[2]) * 255; 8633 } 8634 getRgbItem(src, srcOffset, dest, destOffset) { 8635 this.#toRgb(src, srcOffset, dest, destOffset, 1); 8636 } 8637 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8638 const scale = 1 / ((1 << bits) - 1); 8639 for (let i = 0; i < count; ++i) { 8640 this.#toRgb(src, srcOffset, dest, destOffset, scale); 8641 srcOffset += 3; 8642 destOffset += 3 + alpha01; 8643 } 8644 } 8645 getOutputLength(inputLength, alpha01) { 8646 return inputLength * (3 + alpha01) / 3 | 0; 8647 } 8648} 8649class LabCS extends ColorSpace { 8650 constructor(whitePoint, blackPoint, range) { 8651 super("Lab", 3); 8652 if (!whitePoint) { 8653 throw new _util.FormatError("WhitePoint missing - required for color space Lab"); 8654 } 8655 [this.XW, this.YW, this.ZW] = whitePoint; 8656 [this.amin, this.amax, this.bmin, this.bmax] = range || [-100, 100, -100, 100]; 8657 [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0]; 8658 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 8659 throw new _util.FormatError("Invalid WhitePoint components, no fallback available"); 8660 } 8661 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 8662 (0, _util.info)("Invalid BlackPoint, falling back to default"); 8663 this.XB = this.YB = this.ZB = 0; 8664 } 8665 if (this.amin > this.amax || this.bmin > this.bmax) { 8666 (0, _util.info)("Invalid Range, falling back to defaults"); 8667 this.amin = -100; 8668 this.amax = 100; 8669 this.bmin = -100; 8670 this.bmax = 100; 8671 } 8672 } 8673 #fn_g(x) { 8674 return x >= 6 / 29 ? x ** 3 : 108 / 841 * (x - 4 / 29); 8675 } 8676 #decode(value, high1, low2, high2) { 8677 return low2 + value * (high2 - low2) / high1; 8678 } 8679 #toRgb(src, srcOffset, maxVal, dest, destOffset) { 8680 let Ls = src[srcOffset]; 8681 let as = src[srcOffset + 1]; 8682 let bs = src[srcOffset + 2]; 8683 if (maxVal !== false) { 8684 Ls = this.#decode(Ls, maxVal, 0, 100); 8685 as = this.#decode(as, maxVal, this.amin, this.amax); 8686 bs = this.#decode(bs, maxVal, this.bmin, this.bmax); 8687 } 8688 if (as > this.amax) { 8689 as = this.amax; 8690 } else if (as < this.amin) { 8691 as = this.amin; 8692 } 8693 if (bs > this.bmax) { 8694 bs = this.bmax; 8695 } else if (bs < this.bmin) { 8696 bs = this.bmin; 8697 } 8698 const M = (Ls + 16) / 116; 8699 const L = M + as / 500; 8700 const N = M - bs / 200; 8701 const X = this.XW * this.#fn_g(L); 8702 const Y = this.YW * this.#fn_g(M); 8703 const Z = this.ZW * this.#fn_g(N); 8704 let r, g, b; 8705 if (this.ZW < 1) { 8706 r = X * 3.1339 + Y * -1.617 + Z * -0.4906; 8707 g = X * -0.9785 + Y * 1.916 + Z * 0.0333; 8708 b = X * 0.072 + Y * -0.229 + Z * 1.4057; 8709 } else { 8710 r = X * 3.2406 + Y * -1.5372 + Z * -0.4986; 8711 g = X * -0.9689 + Y * 1.8758 + Z * 0.0415; 8712 b = X * 0.0557 + Y * -0.204 + Z * 1.057; 8713 } 8714 dest[destOffset] = Math.sqrt(r) * 255; 8715 dest[destOffset + 1] = Math.sqrt(g) * 255; 8716 dest[destOffset + 2] = Math.sqrt(b) * 255; 8717 } 8718 getRgbItem(src, srcOffset, dest, destOffset) { 8719 this.#toRgb(src, srcOffset, false, dest, destOffset); 8720 } 8721 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8722 const maxVal = (1 << bits) - 1; 8723 for (let i = 0; i < count; i++) { 8724 this.#toRgb(src, srcOffset, maxVal, dest, destOffset); 8725 srcOffset += 3; 8726 destOffset += 3 + alpha01; 8727 } 8728 } 8729 getOutputLength(inputLength, alpha01) { 8730 return inputLength * (3 + alpha01) / 3 | 0; 8731 } 8732 isDefaultDecode(decodeMap, bpc) { 8733 return true; 8734 } 8735 get usesZeroToOneRange() { 8736 return (0, _util.shadow)(this, "usesZeroToOneRange", false); 8737 } 8738} 8739 8740/***/ }), 8741/* 13 */ 8742/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 8743 8744 8745 8746Object.defineProperty(exports, "__esModule", ({ 8747 value: true 8748})); 8749exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0; 8750var _util = __w_pdfjs_require__(2); 8751var _cmap = __w_pdfjs_require__(14); 8752var _primitives = __w_pdfjs_require__(4); 8753var _fonts = __w_pdfjs_require__(34); 8754var _encodings = __w_pdfjs_require__(37); 8755var _standard_fonts = __w_pdfjs_require__(41); 8756var _pattern = __w_pdfjs_require__(50); 8757var _xfa_fonts = __w_pdfjs_require__(51); 8758var _to_unicode_map = __w_pdfjs_require__(42); 8759var _function = __w_pdfjs_require__(57); 8760var _parser = __w_pdfjs_require__(16); 8761var _image_utils = __w_pdfjs_require__(59); 8762var _stream = __w_pdfjs_require__(8); 8763var _base_stream = __w_pdfjs_require__(5); 8764var _bidi = __w_pdfjs_require__(60); 8765var _colorspace = __w_pdfjs_require__(12); 8766var _decode_stream = __w_pdfjs_require__(18); 8767var _fonts_utils = __w_pdfjs_require__(38); 8768var _font_substitutions = __w_pdfjs_require__(61); 8769var _glyphlist = __w_pdfjs_require__(39); 8770var _metrics = __w_pdfjs_require__(45); 8771var _unicode = __w_pdfjs_require__(40); 8772var _image_resizer = __w_pdfjs_require__(62); 8773var _murmurhash = __w_pdfjs_require__(63); 8774var _operator_list = __w_pdfjs_require__(64); 8775var _image = __w_pdfjs_require__(65); 8776const DefaultPartialEvaluatorOptions = Object.freeze({ 8777 maxImageSize: -1, 8778 disableFontFace: false, 8779 ignoreErrors: false, 8780 isEvalSupported: true, 8781 isOffscreenCanvasSupported: false, 8782 canvasMaxAreaInBytes: -1, 8783 fontExtraProperties: false, 8784 useSystemFonts: true, 8785 cMapUrl: null, 8786 standardFontDataUrl: null 8787}); 8788const PatternType = { 8789 TILING: 1, 8790 SHADING: 2 8791}; 8792const TEXT_CHUNK_BATCH_SIZE = 10; 8793const deferred = Promise.resolve(); 8794function normalizeBlendMode(value, parsingArray = false) { 8795 if (Array.isArray(value)) { 8796 for (const val of value) { 8797 const maybeBM = normalizeBlendMode(val, true); 8798 if (maybeBM) { 8799 return maybeBM; 8800 } 8801 } 8802 (0, _util.warn)(`Unsupported blend mode Array: ${value}`); 8803 return "source-over"; 8804 } 8805 if (!(value instanceof _primitives.Name)) { 8806 if (parsingArray) { 8807 return null; 8808 } 8809 return "source-over"; 8810 } 8811 switch (value.name) { 8812 case "Normal": 8813 case "Compatible": 8814 return "source-over"; 8815 case "Multiply": 8816 return "multiply"; 8817 case "Screen": 8818 return "screen"; 8819 case "Overlay": 8820 return "overlay"; 8821 case "Darken": 8822 return "darken"; 8823 case "Lighten": 8824 return "lighten"; 8825 case "ColorDodge": 8826 return "color-dodge"; 8827 case "ColorBurn": 8828 return "color-burn"; 8829 case "HardLight": 8830 return "hard-light"; 8831 case "SoftLight": 8832 return "soft-light"; 8833 case "Difference": 8834 return "difference"; 8835 case "Exclusion": 8836 return "exclusion"; 8837 case "Hue": 8838 return "hue"; 8839 case "Saturation": 8840 return "saturation"; 8841 case "Color": 8842 return "color"; 8843 case "Luminosity": 8844 return "luminosity"; 8845 } 8846 if (parsingArray) { 8847 return null; 8848 } 8849 (0, _util.warn)(`Unsupported blend mode: ${value.name}`); 8850 return "source-over"; 8851} 8852function incrementCachedImageMaskCount(data) { 8853 if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0]?.count > 0) {
8854 data.args[0].count++; 8855 } 8856} 8857class TimeSlotManager { 8858 static TIME_SLOT_DURATION_MS = 20; 8859 static CHECK_TIME_EVERY = 100; 8860 constructor() { 8861 this.reset(); 8862 } 8863 check() { 8864 if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) { 8865 return false; 8866 } 8867 this.checked = 0; 8868 return this.endTime <= Date.now(); 8869 } 8870 reset() { 8871 this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS; 8872 this.checked = 0; 8873 } 8874} 8875class PartialEvaluator { 8876 constructor({ 8877 xref, 8878 handler, 8879 pageIndex, 8880 idFactory, 8881 fontCache, 8882 builtInCMapCache, 8883 standardFontDataCache, 8884 globalImageCache, 8885 systemFontCache, 8886 options = null 8887 }) { 8888 this.xref = xref; 8889 this.handler = handler; 8890 this.pageIndex = pageIndex; 8891 this.idFactory = idFactory; 8892 this.fontCache = fontCache; 8893 this.builtInCMapCache = builtInCMapCache; 8894 this.standardFontDataCache = standardFontDataCache; 8895 this.globalImageCache = globalImageCache; 8896 this.systemFontCache = systemFontCache; 8897 this.options = options || DefaultPartialEvaluatorOptions; 8898 this.parsingType3Font = false; 8899 this._regionalImageCache = new _image_utils.RegionalImageCache(); 8900 this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this); 8901 _image_resizer.ImageResizer.setMaxArea(this.options.canvasMaxAreaInBytes); 8902 } 8903 get _pdfFunctionFactory() { 8904 const pdfFunctionFactory = new _function.PDFFunctionFactory({ 8905 xref: this.xref, 8906 isEvalSupported: this.options.isEvalSupported 8907 }); 8908 return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory); 8909 } 8910 clone(newOptions = null) { 8911 const newEvaluator = Object.create(this); 8912 newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions); 8913 return newEvaluator; 8914 } 8915 hasBlendModes(resources, nonBlendModesSet) { 8916 if (!(resources instanceof _primitives.Dict)) { 8917 return false; 8918 } 8919 if (resources.objId && nonBlendModesSet.has(resources.objId)) { 8920 return false; 8921 } 8922 const processed = new _primitives.RefSet(nonBlendModesSet); 8923 if (resources.objId) { 8924 processed.put(resources.objId); 8925 } 8926 const nodes = [resources], 8927 xref = this.xref; 8928 while (nodes.length) { 8929 const node = nodes.shift();
8930 const graphicStates = node.get("ExtGState"); 8931 if (graphicStates instanceof _primitives.Dict) { 8932 for (let graphicState of graphicStates.getRawValues()) { 8933 if (graphicState instanceof _primitives.Ref) { 8934 if (processed.has(graphicState)) { 8935 continue; 8936 } 8937 try { 8938 graphicState = xref.fetch(graphicState); 8939 } catch (ex) { 8940 processed.put(graphicState); 8941 (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`); 8942 continue; 8943 } 8944 } 8945 if (!(graphicState instanceof _primitives.Dict)) { 8946 continue; 8947 } 8948 if (graphicState.objId) { 8949 processed.put(graphicState.objId); 8950 } 8951 const bm = graphicState.get("BM"); 8952 if (bm instanceof _primitives.Name) { 8953 if (bm.name !== "Normal") { 8954 return true; 8955 } 8956 continue; 8957 } 8958 if (bm !== undefined && Array.isArray(bm)) { 8959 for (const element of bm) { 8960 if (element instanceof _primitives.Name && element.name !== "Normal") { 8961 return true; 8962 } 8963 } 8964 } 8965 } 8966 } 8967 const xObjects = node.get("XObject"); 8968 if (!(xObjects instanceof _primitives.Dict)) { 8969 continue; 8970 } 8971 for (let xObject of xObjects.getRawValues()) { 8972 if (xObject instanceof _primitives.Ref) { 8973 if (processed.has(xObject)) { 8974 continue; 8975 } 8976 try { 8977 xObject = xref.fetch(xObject); 8978 } catch (ex) { 8979 processed.put(xObject); 8980 (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`); 8981 continue; 8982 } 8983 } 8984 if (!(xObject instanceof _base_stream.BaseStream)) { 8985 continue; 8986 } 8987 if (xObject.dict.objId) { 8988 processed.put(xObject.dict.objId); 8989 } 8990 const xResources = xObject.dict.get("Resources"); 8991 if (!(xResources instanceof _primitives.Dict)) { 8992 continue; 8993 } 8994 if (xResources.objId && processed.has(xResources.objId)) { 8995 continue; 8996 } 8997 nodes.push(xResources); 8998 if (xResources.objId) { 8999 processed.put(xResources.objId); 9000 } 9001 } 9002 } 9003 for (const ref of processed) { 9004 nonBlendModesSet.put(ref); 9005 } 9006 return false; 9007 } 9008 async fetchBuiltInCMap(name) { 9009 const cachedData = this.builtInCMapCache.get(name); 9010 if (cachedData) { 9011 return cachedData; 9012 } 9013 let data; 9014 if (this.options.cMapUrl !== null) { 9015 const url = `${this.options.cMapUrl}${name}.bcmap`; 9016 const response = await fetch(url); 9017 if (!response.ok) { 9018 throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`); 9019 } 9020 data = { 9021 cMapData: new Uint8Array(await response.arrayBuffer()), 9022 compressionType: _util.CMapCompressionType.BINARY 9023 }; 9024 } else { 9025 data = await this.handler.sendWithPromise("FetchBuiltInCMap", { 9026 name 9027 }); 9028 } 9029 if (data.compressionType !== _util.CMapCompressionType.NONE) { 9030 this.builtInCMapCache.set(name, data); 9031 } 9032 return data; 9033 } 9034 async fetchStandardFontData(name) { 9035 const cachedData = this.standardFontDataCache.get(name); 9036 if (cachedData) { 9037 return new _stream.Stream(cachedData); 9038 } 9039 if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") { 9040 return null; 9041 } 9042 const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(), 9043 filename = standardFontNameToFileName[name]; 9044 let data; 9045 if (this.options.standardFontDataUrl !== null) { 9046 const url = `${this.options.standardFontDataUrl}${filename}`; 9047 const response = await fetch(url); 9048 if (!response.ok) { 9049 (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`); 9050 } else { 9051 data = await response.arrayBuffer(); 9052 } 9053 } else {
9054 try { 9055 data = await this.handler.sendWithPromise("FetchStandardFontData", { 9056 filename 9057 }); 9058 } catch (e) { 9059 (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`); 9060 } 9061 } 9062 if (!data) { 9063 return null; 9064 } 9065 this.standardFontDataCache.set(name, data); 9066 return new _stream.Stream(data); 9067 } 9068 async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) { 9069 const dict = xobj.dict; 9070 const matrix = dict.getArray("Matrix"); 9071 let bbox = dict.getArray("BBox"); 9072 bbox = Array.isArray(bbox) && bbox.length === 4 ? _util.Util.normalizeRect(bbox) : null; 9073 let optionalContent, groupOptions; 9074 if (dict.has("OC")) { 9075 optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources); 9076 } 9077 if (optionalContent !== undefined) { 9078 operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 9079 } 9080 const group = dict.get("Group"); 9081 if (group) { 9082 groupOptions = { 9083 matrix, 9084 bbox, 9085 smask, 9086 isolated: false, 9087 knockout: false 9088 }; 9089 const groupSubtype = group.get("S"); 9090 let colorSpace = null; 9091 if ((0, _primitives.isName)(groupSubtype, "Transparency")) { 9092 groupOptions.isolated = group.get("I") || false; 9093 groupOptions.knockout = group.get("K") || false; 9094 if (group.has("CS")) { 9095 const cs = group.getRaw("CS"); 9096 const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache); 9097 if (cachedColorSpace) { 9098 colorSpace = cachedColorSpace; 9099 } else { 9100 colorSpace = await this.parseColorSpace({ 9101 cs, 9102 resources, 9103 localColorSpaceCache 9104 }); 9105 } 9106 } 9107 } 9108 if (smask?.backdrop) { 9109 colorSpace ||= _colorspace.ColorSpace.singletons.rgb; 9110 smask.backdrop = colorSpace.getRgb(smask.backdrop, 0); 9111 } 9112 operatorList.addOp(_util.OPS.beginGroup, [groupOptions]); 9113 } 9114 const args = group ? [matrix, null] : [matrix, bbox]; 9115 operatorList.addOp(_util.OPS.paintFormXObjectBegin, args); 9116 return this.getOperatorList({ 9117 stream: xobj, 9118 task, 9119 resources: dict.get("Resources") || resources, 9120 operatorList, 9121 initialState 9122 }).then(function () { 9123 operatorList.addOp(_util.OPS.paintFormXObjectEnd, []); 9124 if (group) { 9125 operatorList.addOp(_util.OPS.endGroup, [groupOptions]); 9126 } 9127 if (optionalContent !== undefined) { 9128 operatorList.addOp(_util.OPS.endMarkedContent, []); 9129 } 9130 }); 9131 } 9132 _sendImgData(objId, imgData, cacheGlobally = false) { 9133 const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null; 9134 if (this.parsingType3Font || cacheGlobally) { 9135 return this.handler.send("commonobj", [objId, "Image", imgData], transfers); 9136 } 9137 return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers); 9138 } 9139 async buildPaintImageXObject({ 9140 resources, 9141 image, 9142 isInline = false, 9143 operatorList, 9144 cacheKey, 9145 localImageCache, 9146 localColorSpaceCache 9147 }) { 9148 const dict = image.dict; 9149 const imageRef = dict.objId; 9150 const w = dict.get("W", "Width"); 9151 const h = dict.get("H", "Height"); 9152 if (!(w && typeof w === "number") || !(h && typeof h === "number")) { 9153 (0, _util.warn)("Image dimensions are missing, or not numbers."); 9154 return; 9155 } 9156 const maxImageSize = this.options.maxImageSize; 9157 if (maxImageSize !== -1 && w * h > maxImageSize) { 9158 const msg = "Image exceeded maximum allowed size and was removed."; 9159 if (this.options.ignoreErrors) { 9160 (0, _util.warn)(msg); 9161 return; 9162 } 9163 throw new Error(msg); 9164 } 9165 let optionalContent; 9166 if (dict.has("OC")) { 9167 optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources); 9168 } 9169 const imageMask = dict.get("IM", "ImageMask") || false; 9170 let imgData, args; 9171 if (imageMask) { 9172 const interpolate = dict.get("I", "Interpolate"); 9173 const bitStrideLength = w + 7 >> 3; 9174 const imgArray = image.getBytes(bitStrideLength * h); 9175 const decode = dict.getArray("D", "Decode"); 9176 if (this.parsingType3Font) { 9177 imgData = _image.PDFImage.createRawMask({ 9178 imgArray, 9179 width: w, 9180 height: h,
9181 imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream, 9182 inverseDecode: decode?.[0] > 0, 9183 interpolate 9184 }); 9185 imgData.cached = !!cacheKey; 9186 args = [imgData]; 9187 operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent); 9188 if (cacheKey) { 9189 const cacheData = { 9190 fn: _util.OPS.paintImageMaskXObject, 9191 args, 9192 optionalContent 9193 }; 9194 localImageCache.set(cacheKey, imageRef, cacheData); 9195 if (imageRef) { 9196 this._regionalImageCache.set(null, imageRef, cacheData); 9197 } 9198 } 9199 return; 9200 } 9201 imgData = await _image.PDFImage.createMask({ 9202 imgArray, 9203 width: w, 9204 height: h, 9205 imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream, 9206 inverseDecode: decode?.[0] > 0, 9207 interpolate, 9208 isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported 9209 }); 9210 if (imgData.isSingleOpaquePixel) { 9211 operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent); 9212 if (cacheKey) { 9213 const cacheData = { 9214 fn: _util.OPS.paintSolidColorImageMask, 9215 args: [], 9216 optionalContent 9217 }; 9218 localImageCache.set(cacheKey, imageRef, cacheData); 9219 if (imageRef) { 9220 this._regionalImageCache.set(null, imageRef, cacheData); 9221 } 9222 } 9223 return; 9224 } 9225 const objId = `mask_${this.idFactory.createObjId()}`; 9226 operatorList.addDependency(objId); 9227 this._sendImgData(objId, imgData); 9228 args = [{ 9229 data: objId, 9230 width: imgData.width, 9231 height: imgData.height, 9232 interpolate: imgData.interpolate, 9233 count: 1 9234 }]; 9235 operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent); 9236 if (cacheKey) { 9237 const cacheData = { 9238 fn: _util.OPS.paintImageMaskXObject, 9239 args, 9240 optionalContent 9241 }; 9242 localImageCache.set(cacheKey, imageRef, cacheData); 9243 if (imageRef) { 9244 this._regionalImageCache.set(null, imageRef, cacheData); 9245 } 9246 } 9247 return; 9248 } 9249 const SMALL_IMAGE_DIMENSIONS = 200; 9250 if (isInline && !dict.has("SMask") && !dict.has("Mask") && w + h < SMALL_IMAGE_DIMENSIONS) { 9251 const imageObj = new _image.PDFImage({ 9252 xref: this.xref, 9253 res: resources, 9254 image, 9255 isInline, 9256 pdfFunctionFactory: this._pdfFunctionFactory, 9257 localColorSpaceCache 9258 }); 9259 imgData = await imageObj.createImageData(true, false); 9260 operatorList.isOffscreenCanvasSupported = this.options.isOffscreenCanvasSupported; 9261 operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent); 9262 return; 9263 } 9264 let objId = `img_${this.idFactory.createObjId()}`, 9265 cacheGlobally = false; 9266 if (this.parsingType3Font) { 9267 objId = `${this.idFactory.getDocId()}_type3_${objId}`; 9268 } else if (imageRef) { 9269 cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex); 9270 if (cacheGlobally) { 9271 objId = `${this.idFactory.getDocId()}_${objId}`; 9272 } 9273 } 9274 operatorList.addDependency(objId); 9275 args = [objId, w, h]; 9276 _image.PDFImage.buildImage({ 9277 xref: this.xref, 9278 res: resources, 9279 image, 9280 isInline, 9281 pdfFunctionFactory: this._pdfFunctionFactory, 9282 localColorSpaceCache 9283 }).then(async imageObj => { 9284 imgData = await imageObj.createImageData(false, this.options.isOffscreenCanvasSupported); 9285 if (cacheKey && imageRef && cacheGlobally) { 9286 const length = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length; 9287 this.globalImageCache.addByteSize(imageRef, length); 9288 } 9289 return this._sendImgData(objId, imgData, cacheGlobally); 9290 }).catch(reason => { 9291 (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`); 9292 return this._sendImgData(objId, null, cacheGlobally); 9293 }); 9294 operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent); 9295 if (cacheKey) { 9296 const cacheData = { 9297 fn: _util.OPS.paintImageXObject, 9298 args, 9299 optionalContent 9300 }; 9301 localImageCache.set(cacheKey, imageRef, cacheData); 9302 if (imageRef) { 9303 this._regionalImageCache.set(null, imageRef, cacheData); 9304 if (cacheGlobally) { 9305 (0, _util.assert)(!isInline, "Cannot cache an inline image globally."); 9306 this.globalImageCache.setData(imageRef, { 9307 objId, 9308 fn: _util.OPS.paintImageXObject, 9309 args, 9310 optionalContent, 9311 byteSize: 0 9312 }); 9313 } 9314 } 9315 } 9316 } 9317 handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) { 9318 const smaskContent = smask.get("G"); 9319 const smaskOptions = { 9320 subtype: smask.get("S").name, 9321 backdrop: smask.get("BC") 9322 }; 9323 const transferObj = smask.get("TR"); 9324 if ((0, _function.isPDFFunction)(transferObj)) { 9325 const transferFn = this._pdfFunctionFactory.create(transferObj); 9326 const transferMap = new Uint8Array(256); 9327 const tmp = new Float32Array(1); 9328 for (let i = 0; i < 256; i++) { 9329 tmp[0] = i / 255; 9330 transferFn(tmp, 0, tmp, 0); 9331 transferMap[i] = tmp[0] * 255 | 0; 9332 } 9333 smaskOptions.transferMap = transferMap; 9334 } 9335 return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache); 9336 } 9337 handleTransferFunction(tr) { 9338 let transferArray; 9339 if (Array.isArray(tr)) { 9340 transferArray = tr; 9341 } else if ((0, _function.isPDFFunction)(tr)) { 9342 transferArray = [tr]; 9343 } else { 9344 return null; 9345 } 9346 const transferMaps = []; 9347 let numFns = 0, 9348 numEffectfulFns = 0; 9349 for (const entry of transferArray) { 9350 const transferObj = this.xref.fetchIfRef(entry); 9351 numFns++; 9352 if ((0, _primitives.isName)(transferObj, "Identity")) { 9353 transferMaps.push(null); 9354 continue; 9355 } else if (!(0, _function.isPDFFunction)(transferObj)) { 9356 return null; 9357 } 9358 const transferFn = this._pdfFunctionFactory.create(transferObj); 9359 const transferMap = new Uint8Array(256), 9360 tmp = new Float32Array(1); 9361 for (let j = 0; j < 256; j++) { 9362 tmp[0] = j / 255; 9363 transferFn(tmp, 0, tmp, 0); 9364 transferMap[j] = tmp[0] * 255 | 0; 9365 } 9366 transferMaps.push(transferMap); 9367 numEffectfulFns++; 9368 } 9369 if (!(numFns === 1 || numFns === 4)) { 9370 return null; 9371 } 9372 if (numEffectfulFns === 0) { 9373 return null; 9374 } 9375 return transferMaps; 9376 } 9377 handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) { 9378 const tilingOpList = new _operator_list.OperatorList(); 9379 const patternResources = _primitives.Dict.merge({ 9380 xref: this.xref, 9381 dictArray: [patternDict.get("Resources"), resources] 9382 }); 9383 return this.getOperatorList({ 9384 stream: pattern, 9385 task,
9386 resources: patternResources, 9387 operatorList: tilingOpList 9388 }).then(function () { 9389 const operatorListIR = tilingOpList.getIR(); 9390 const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color); 9391 operatorList.addDependencies(tilingOpList.dependencies); 9392 operatorList.addOp(fn, tilingPatternIR); 9393 if (patternDict.objId) { 9394 localTilingPatternCache.set(null, patternDict.objId, { 9395 operatorListIR, 9396 dict: patternDict 9397 }); 9398 } 9399 }).catch(reason => { 9400 if (reason instanceof _util.AbortException) { 9401 return; 9402 } 9403 if (this.options.ignoreErrors) { 9404 (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`); 9405 return; 9406 } 9407 throw reason; 9408 }); 9409 } 9410 handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) { 9411 const fontName = fontArgs?.[0] instanceof _primitives.Name ? fontArgs[0].name : null; 9412 return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => { 9413 if (!translated.font.isType3Font) { 9414 return translated; 9415 } 9416 return translated.loadType3Data(this, resources, task).then(function () { 9417 operatorList.addDependencies(translated.type3Dependencies); 9418 return translated; 9419 }).catch(reason => { 9420 return new TranslatedFont({ 9421 loadedName: "g_font_error", 9422 font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`), 9423 dict: translated.font, 9424 evaluatorOptions: this.options 9425 }); 9426 }); 9427 }).then(translated => { 9428 state.font = translated.font; 9429 translated.send(this.handler); 9430 return translated.loadedName; 9431 }); 9432 }
9433 handleText(chars, state) { 9434 const font = state.font; 9435 const glyphs = font.charsToGlyphs(chars); 9436 if (font.data) { 9437 const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); 9438 if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) { 9439 PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options); 9440 } 9441 } 9442 return glyphs; 9443 } 9444 ensureStateFont(state) { 9445 if (state.font) { 9446 return; 9447 } 9448 const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator."); 9449 if (this.options.ignoreErrors) { 9450 (0, _util.warn)(`ensureStateFont: "${reason}".`); 9451 return; 9452 } 9453 throw reason; 9454 } 9455 async setGState({ 9456 resources, 9457 gState, 9458 operatorList, 9459 cacheKey, 9460 task, 9461 stateManager, 9462 localGStateCache, 9463 localColorSpaceCache 9464 }) { 9465 const gStateRef = gState.objId; 9466 let isSimpleGState = true; 9467 const gStateObj = []; 9468 let promise = Promise.resolve(); 9469 for (const key of gState.getKeys()) { 9470 const value = gState.get(key); 9471 switch (key) { 9472 case "Type": 9473 break; 9474 case "LW": 9475 case "LC": 9476 case "LJ": 9477 case "ML": 9478 case "D": 9479 case "RI": 9480 case "FL": 9481 case "CA": 9482 case "ca": 9483 gStateObj.push([key, value]); 9484 break; 9485 case "Font": 9486 isSimpleGState = false; 9487 promise = promise.then(() => { 9488 return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) { 9489 operatorList.addDependency(loadedName); 9490 gStateObj.push([key, [loadedName, value[1]]]); 9491 }); 9492 }); 9493 break; 9494 case "BM": 9495 gStateObj.push([key, normalizeBlendMode(value)]); 9496 break; 9497 case "SMask": 9498 if ((0, _primitives.isName)(value, "None")) { 9499 gStateObj.push([key, false]); 9500 break; 9501 } 9502 if (value instanceof _primitives.Dict) { 9503 isSimpleGState = false; 9504 promise = promise.then(() => { 9505 return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache); 9506 }); 9507 gStateObj.push([key, true]); 9508 } else { 9509 (0, _util.warn)("Unsupported SMask type"); 9510 } 9511 break; 9512 case "TR": 9513 const transferMaps = this.handleTransferFunction(value); 9514 gStateObj.push([key, transferMaps]); 9515 break; 9516 case "OP": 9517 case "op": 9518 case "OPM": 9519 case "BG": 9520 case "BG2": 9521 case "UCR": 9522 case "UCR2": 9523 case "TR2": 9524 case "HT": 9525 case "SM": 9526 case "SA": 9527 case "AIS": 9528 case "TK": 9529 (0, _util.info)("graphic state operator " + key); 9530 break; 9531 default: 9532 (0, _util.info)("Unknown graphic state operator " + key); 9533 break; 9534 } 9535 } 9536 return promise.then(function () { 9537 if (gStateObj.length > 0) { 9538 operatorList.addOp(_util.OPS.setGState, [gStateObj]); 9539 } 9540 if (isSimpleGState) { 9541 localGStateCache.set(cacheKey, gStateRef, gStateObj); 9542 } 9543 }); 9544 } 9545 loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) { 9546 const errorFont = async () => { 9547 return new TranslatedFont({ 9548 loadedName: "g_font_error", 9549 font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`), 9550 dict: font, 9551 evaluatorOptions: this.options 9552 }); 9553 }; 9554 let fontRef; 9555 if (font) { 9556 if (font instanceof _primitives.Ref) { 9557 fontRef = font; 9558 } 9559 } else { 9560 const fontRes = resources.get("Font"); 9561 if (fontRes) { 9562 fontRef = fontRes.getRaw(fontName); 9563 } 9564 } 9565 if (fontRef) { 9566 if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) { 9567 return errorFont(); 9568 } 9569 if (this.fontCache.has(fontRef)) { 9570 return this.fontCache.get(fontRef); 9571 } 9572 font = this.xref.fetchIfRef(fontRef); 9573 } 9574 if (!(font instanceof _primitives.Dict)) { 9575 if (!this.options.ignoreErrors && !this.parsingType3Font) { 9576 (0, _util.warn)(`Font "${fontName}" is not available.`); 9577 return errorFont(); 9578 } 9579 (0, _util.warn)(`Font "${fontName}" is not available -- attempting to fallback to a default font.`);
9580 font = fallbackFontDict || PartialEvaluator.fallbackFontDict; 9581 } 9582 if (font.cacheKey && this.fontCache.has(font.cacheKey)) { 9583 return this.fontCache.get(font.cacheKey); 9584 } 9585 const fontCapability = new _util.PromiseCapability(); 9586 let preEvaluatedFont; 9587 try { 9588 preEvaluatedFont = this.preEvaluateFont(font); 9589 preEvaluatedFont.cssFontInfo = cssFontInfo; 9590 } catch (reason) { 9591 (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`); 9592 return errorFont(); 9593 } 9594 const { 9595 descriptor, 9596 hash 9597 } = preEvaluatedFont; 9598 const fontRefIsRef = fontRef instanceof _primitives.Ref; 9599 let fontID; 9600 if (hash && descriptor instanceof _primitives.Dict) { 9601 const fontAliases = descriptor.fontAliases ||= Object.create(null); 9602 if (fontAliases[hash]) { 9603 const aliasFontRef = fontAliases[hash].aliasRef; 9604 if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) { 9605 this.fontCache.putAlias(fontRef, aliasFontRef); 9606 return this.fontCache.get(fontRef); 9607 } 9608 } else { 9609 fontAliases[hash] = { 9610 fontID: this.idFactory.createFontId() 9611 }; 9612 } 9613 if (fontRefIsRef) { 9614 fontAliases[hash].aliasRef = fontRef; 9615 } 9616 fontID = fontAliases[hash].fontID; 9617 } else { 9618 fontID = this.idFactory.createFontId(); 9619 } 9620 (0, _util.assert)(fontID?.startsWith("f"), 'The "fontID" must be (correctly) defined.'); 9621 if (fontRefIsRef) { 9622 this.fontCache.put(fontRef, fontCapability.promise); 9623 } else { 9624 font.cacheKey = `cacheKey_${fontID}`; 9625 this.fontCache.put(font.cacheKey, fontCapability.promise); 9626 } 9627 font.loadedName = `${this.idFactory.getDocId()}_${fontID}`; 9628 this.translateFont(preEvaluatedFont).then(translatedFont => { 9629 fontCapability.resolve(new TranslatedFont({ 9630 loadedName: font.loadedName, 9631 font: translatedFont, 9632 dict: font, 9633 evaluatorOptions: this.options 9634 })); 9635 }).catch(reason => { 9636 (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`); 9637 fontCapability.resolve(new TranslatedFont({ 9638 loadedName: font.loadedName, 9639 font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), 9640 dict: font, 9641 evaluatorOptions: this.options 9642 })); 9643 }); 9644 return fontCapability.promise; 9645 } 9646 buildPath(operatorList, fn, args, parsingText = false) { 9647 const lastIndex = operatorList.length - 1; 9648 if (!args) { 9649 args = []; 9650 } 9651 if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) { 9652 if (parsingText) { 9653 (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`); 9654 operatorList.addOp(_util.OPS.save, null); 9655 } 9656 let minMax; 9657 switch (fn) { 9658 case _util.OPS.rectangle: 9659 const x = args[0] + args[2]; 9660 const y = args[1] + args[3]; 9661 minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)]; 9662 break; 9663 case _util.OPS.moveTo: 9664 case _util.OPS.lineTo: 9665 minMax = [args[0], args[0], args[1], args[1]]; 9666 break; 9667 default: 9668 minMax = [Infinity, -Infinity, Infinity, -Infinity]; 9669 break; 9670 } 9671 operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]); 9672 if (parsingText) { 9673 operatorList.addOp(_util.OPS.restore, null); 9674 } 9675 } else { 9676 const opArgs = operatorList.argsArray[lastIndex]; 9677 opArgs[0].push(fn); 9678 opArgs[1].push(...args); 9679 const minMax = opArgs[2]; 9680 switch (fn) { 9681 case _util.OPS.rectangle: 9682 const x = args[0] + args[2]; 9683 const y = args[1] + args[3]; 9684 minMax[0] = Math.min(minMax[0], args[0], x); 9685 minMax[1] = Math.max(minMax[1], args[0], x); 9686 minMax[2] = Math.min(minMax[2], args[1], y); 9687 minMax[3] = Math.max(minMax[3], args[1], y); 9688 break; 9689 case _util.OPS.moveTo: 9690 case _util.OPS.lineTo: 9691 minMax[0] = Math.min(minMax[0], args[0]); 9692 minMax[1] = Math.max(minMax[1], args[0]); 9693 minMax[2] = Math.min(minMax[2], args[1]); 9694 minMax[3] = Math.max(minMax[3], args[1]); 9695 break; 9696 } 9697 } 9698 } 9699 parseColorSpace({ 9700 cs, 9701 resources, 9702 localColorSpaceCache 9703 }) { 9704 return _colorspace.ColorSpace.parseAsync({ 9705 cs, 9706 xref: this.xref, 9707 resources, 9708 pdfFunctionFactory: this._pdfFunctionFactory, 9709 localColorSpaceCache 9710 }).catch(reason => { 9711 if (reason instanceof _util.AbortException) { 9712 return null; 9713 } 9714 if (this.options.ignoreErrors) { 9715 (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`); 9716 return null; 9717 } 9718 throw reason; 9719 }); 9720 } 9721 parseShading({ 9722 shading, 9723 resources, 9724 localColorSpaceCache, 9725 localShadingPatternCache 9726 }) { 9727 let id = localShadingPatternCache.get(shading); 9728 if (!id) { 9729 var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this._pdfFunctionFactory, localColorSpaceCache); 9730 const patternIR = shadingFill.getIR(); 9731 id = `pattern_${this.idFactory.createObjId()}`; 9732 if (this.parsingType3Font) { 9733 id = `${this.idFactory.getDocId()}_type3_${id}`; 9734 } 9735 localShadingPatternCache.set(shading, id); 9736 if (this.parsingType3Font) { 9737 this.handler.send("commonobj", [id, "Pattern", patternIR]); 9738 } else { 9739 this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]); 9740 } 9741 } 9742 return id; 9743 } 9744 handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) { 9745 const patternName = args.pop(); 9746 if (patternName instanceof _primitives.Name) { 9747 const rawPattern = patterns.getRaw(patternName.name); 9748 const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern); 9749 if (localTilingPattern) { 9750 try { 9751 const color = cs.base ? cs.base.getRgb(args, 0) : null; 9752 const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color); 9753 operatorList.addOp(fn, tilingPatternIR); 9754 return undefined; 9755 } catch {} 9756 } 9757 const pattern = this.xref.fetchIfRef(rawPattern); 9758 if (pattern) { 9759 const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern; 9760 const typeNum = dict.get("PatternType"); 9761 if (typeNum === PatternType.TILING) { 9762 const color = cs.base ? cs.base.getRgb(args, 0) : null; 9763 return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache); 9764 } else if (typeNum === PatternType.SHADING) { 9765 const shading = dict.get("Shading"); 9766 const matrix = dict.getArray("Matrix"); 9767 const objId = this.parseShading({ 9768 shading, 9769 resources, 9770 localColorSpaceCache, 9771 localShadingPatternCache 9772 }); 9773 operatorList.addOp(fn, ["Shading", objId, matrix]); 9774 return undefined; 9775 } 9776 throw new _util.FormatError(`Unknown PatternType: ${typeNum}`); 9777 } 9778 } 9779 throw new _util.FormatError(`Unknown PatternName: ${patternName}`); 9780 } 9781 _parseVisibilityExpression(array, nestingCounter, currentResult) { 9782 const MAX_NESTING = 10; 9783 if (++nestingCounter > MAX_NESTING) { 9784 (0, _util.warn)("Visibility expression is too deeply nested"); 9785 return; 9786 } 9787 const length = array.length; 9788 const operator = this.xref.fetchIfRef(array[0]); 9789 if (length < 2 || !(operator instanceof _primitives.Name)) { 9790 (0, _util.warn)("Invalid visibility expression"); 9791 return; 9792 } 9793 switch (operator.name) { 9794 case "And": 9795 case "Or": 9796 case "Not": 9797 currentResult.push(operator.name); 9798 break; 9799 default: 9800 (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`); 9801 return; 9802 } 9803 for (let i = 1; i < length; i++) { 9804 const raw = array[i]; 9805 const object = this.xref.fetchIfRef(raw); 9806 if (Array.isArray(object)) { 9807 const nestedResult = []; 9808 currentResult.push(nestedResult); 9809 this._parseVisibilityExpression(object, nestingCounter, nestedResult); 9810 } else if (raw instanceof _primitives.Ref) { 9811 currentResult.push(raw.toString()); 9812 } 9813 } 9814 } 9815 async parseMarkedContentProps(contentProperties, resources) { 9816 let optionalContent; 9817 if (contentProperties instanceof _primitives.Name) { 9818 const properties = resources.get("Properties"); 9819 optionalContent = properties.get(contentProperties.name); 9820 } else if (contentProperties instanceof _primitives.Dict) { 9821 optionalContent = contentProperties; 9822 } else { 9823 throw new _util.FormatError("Optional content properties malformed."); 9824 } 9825 const optionalContentType = optionalContent.get("Type")?.name; 9826 if (optionalContentType === "OCG") { 9827 return { 9828 type: optionalContentType, 9829 id: optionalContent.objId 9830 }; 9831 } else if (optionalContentType === "OCMD") { 9832 const expression = optionalContent.get("VE"); 9833 if (Array.isArray(expression)) { 9834 const result = []; 9835 this._parseVisibilityExpression(expression, 0, result); 9836 if (result.length > 0) { 9837 return { 9838 type: "OCMD", 9839 expression: result 9840 }; 9841 } 9842 } 9843 const optionalContentGroups = optionalContent.get("OCGs"); 9844 if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) { 9845 const groupIds = []; 9846 if (Array.isArray(optionalContentGroups)) { 9847 for (const ocg of optionalContentGroups) { 9848 groupIds.push(ocg.toString()); 9849 } 9850 } else { 9851 groupIds.push(optionalContentGroups.objId); 9852 } 9853 return { 9854 type: optionalContentType, 9855 ids: groupIds, 9856 policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null, 9857 expression: null 9858 }; 9859 } else if (optionalContentGroups instanceof _primitives.Ref) { 9860 return { 9861 type: optionalContentType, 9862 id: optionalContentGroups.toString() 9863 }; 9864 } 9865 } 9866 return null; 9867 } 9868 getOperatorList({ 9869 stream, 9870 task, 9871 resources, 9872 operatorList, 9873 initialState = null, 9874 fallbackFontDict = null 9875 }) { 9876 resources ||= _primitives.Dict.empty; 9877 initialState ||= new EvalState(); 9878 if (!operatorList) { 9879 throw new Error('getOperatorList: missing "operatorList" parameter'); 9880 } 9881 const self = this; 9882 const xref = this.xref; 9883 let parsingText = false;
9884 const localImageCache = new _image_utils.LocalImageCache(); 9885 const localColorSpaceCache = new _image_utils.LocalColorSpaceCache(); 9886 const localGStateCache = new _image_utils.LocalGStateCache(); 9887 const localTilingPatternCache = new _image_utils.LocalTilingPatternCache(); 9888 const localShadingPatternCache = new Map(); 9889 const xobjs = resources.get("XObject") || _primitives.Dict.empty; 9890 const patterns = resources.get("Pattern") || _primitives.Dict.empty; 9891 const stateManager = new StateManager(initialState); 9892 const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 9893 const timeSlotManager = new TimeSlotManager(); 9894 function closePendingRestoreOPS(argument) { 9895 for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) { 9896 operatorList.addOp(_util.OPS.restore, []); 9897 } 9898 } 9899 return new Promise(function promiseBody(resolve, reject) { 9900 const next = function (promise) { 9901 Promise.all([promise, operatorList.ready]).then(function () { 9902 try { 9903 promiseBody(resolve, reject); 9904 } catch (ex) { 9905 reject(ex); 9906 } 9907 }, reject); 9908 }; 9909 task.ensureNotTerminated(); 9910 timeSlotManager.reset(); 9911 const operation = {}; 9912 let stop, i, ii, cs, name, isValidName; 9913 while (!(stop = timeSlotManager.check())) { 9914 operation.args = null; 9915 if (!preprocessor.read(operation)) { 9916 break; 9917 } 9918 let args = operation.args; 9919 let fn = operation.fn; 9920 switch (fn | 0) { 9921 case _util.OPS.paintXObject: 9922 isValidName = args[0] instanceof _primitives.Name; 9923 name = args[0].name; 9924 if (isValidName) { 9925 const localImage = localImageCache.getByName(name); 9926 if (localImage) { 9927 operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent); 9928 incrementCachedImageMaskCount(localImage); 9929 args = null; 9930 continue; 9931 } 9932 } 9933 next(new Promise(function (resolveXObject, rejectXObject) { 9934 if (!isValidName) { 9935 throw new _util.FormatError("XObject must be referred to by name."); 9936 } 9937 let xobj = xobjs.getRaw(name); 9938 if (xobj instanceof _primitives.Ref) { 9939 const localImage = localImageCache.getByRef(xobj) || self._regionalImageCache.getByRef(xobj); 9940 if (localImage) { 9941 operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent); 9942 incrementCachedImageMaskCount(localImage); 9943 resolveXObject(); 9944 return; 9945 } 9946 const globalImage = self.globalImageCache.getData(xobj, self.pageIndex); 9947 if (globalImage) { 9948 operatorList.addDependency(globalImage.objId); 9949 operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent); 9950 resolveXObject(); 9951 return; 9952 } 9953 xobj = xref.fetch(xobj); 9954 } 9955 if (!(xobj instanceof _base_stream.BaseStream)) { 9956 throw new _util.FormatError("XObject should be a stream"); 9957 } 9958 const type = xobj.dict.get("Subtype"); 9959 if (!(type instanceof _primitives.Name)) { 9960 throw new _util.FormatError("XObject should have a Name subtype"); 9961 } 9962 if (type.name === "Form") { 9963 stateManager.save(); 9964 self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () { 9965 stateManager.restore(); 9966 resolveXObject(); 9967 }, rejectXObject); 9968 return; 9969 } else if (type.name === "Image") { 9970 self.buildPaintImageXObject({ 9971 resources, 9972 image: xobj, 9973 operatorList, 9974 cacheKey: name, 9975 localImageCache, 9976 localColorSpaceCache 9977 }).then(resolveXObject, rejectXObject); 9978 return; 9979 } else if (type.name === "PS") { 9980 (0, _util.info)("Ignored XObject subtype PS"); 9981 } else { 9982 throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`); 9983 } 9984 resolveXObject(); 9985 }).catch(function (reason) { 9986 if (reason instanceof _util.AbortException) { 9987 return; 9988 } 9989 if (self.options.ignoreErrors) { 9990 (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`); 9991 return; 9992 } 9993 throw reason; 9994 })); 9995 return; 9996 case _util.OPS.setFont: 9997 var fontSize = args[1]; 9998 next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) { 9999 operatorList.addDependency(loadedName); 10000 operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]); 10001 })); 10002 return; 10003 case _util.OPS.beginText: 10004 parsingText = true; 10005 break; 10006 case _util.OPS.endText: 10007 parsingText = false;
10008 break; 10009 case _util.OPS.endInlineImage: 10010 var cacheKey = args[0].cacheKey; 10011 if (cacheKey) { 10012 const localImage = localImageCache.getByName(cacheKey); 10013 if (localImage) { 10014 operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent); 10015 incrementCachedImageMaskCount(localImage); 10016 args = null; 10017 continue; 10018 } 10019 } 10020 next(self.buildPaintImageXObject({ 10021 resources, 10022 image: args[0], 10023 isInline: true, 10024 operatorList, 10025 cacheKey, 10026 localImageCache, 10027 localColorSpaceCache 10028 })); 10029 return; 10030 case _util.OPS.showText: 10031 if (!stateManager.state.font) { 10032 self.ensureStateFont(stateManager.state); 10033 continue; 10034 } 10035 args[0] = self.handleText(args[0], stateManager.state); 10036 break; 10037 case _util.OPS.showSpacedText: 10038 if (!stateManager.state.font) { 10039 self.ensureStateFont(stateManager.state); 10040 continue; 10041 } 10042 var combinedGlyphs = []; 10043 var state = stateManager.state; 10044 for (const arrItem of args[0]) { 10045 if (typeof arrItem === "string") { 10046 combinedGlyphs.push(...self.handleText(arrItem, state)); 10047 } else if (typeof arrItem === "number") { 10048 combinedGlyphs.push(arrItem); 10049 } 10050 } 10051 args[0] = combinedGlyphs; 10052 fn = _util.OPS.showText; 10053 break; 10054 case _util.OPS.nextLineShowText: 10055 if (!stateManager.state.font) { 10056 self.ensureStateFont(stateManager.state); 10057 continue; 10058 } 10059 operatorList.addOp(_util.OPS.nextLine); 10060 args[0] = self.handleText(args[0], stateManager.state); 10061 fn = _util.OPS.showText; 10062 break; 10063 case _util.OPS.nextLineSetSpacingShowText: 10064 if (!stateManager.state.font) { 10065 self.ensureStateFont(stateManager.state); 10066 continue; 10067 } 10068 operatorList.addOp(_util.OPS.nextLine); 10069 operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]); 10070 operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]); 10071 args[0] = self.handleText(args[0], stateManager.state); 10072 fn = _util.OPS.showText; 10073 break; 10074 case _util.OPS.setTextRenderingMode: 10075 stateManager.state.textRenderingMode = args[0]; 10076 break; 10077 case _util.OPS.setFillColorSpace: 10078 { 10079 const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache); 10080 if (cachedColorSpace) { 10081 stateManager.state.fillColorSpace = cachedColorSpace; 10082 continue; 10083 } 10084 next(self.parseColorSpace({ 10085 cs: args[0], 10086 resources, 10087 localColorSpaceCache 10088 }).then(function (colorSpace) { 10089 if (colorSpace) { 10090 stateManager.state.fillColorSpace = colorSpace; 10091 } 10092 })); 10093 return; 10094 } 10095 case _util.OPS.setStrokeColorSpace: 10096 { 10097 const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache); 10098 if (cachedColorSpace) { 10099 stateManager.state.strokeColorSpace = cachedColorSpace; 10100 continue; 10101 } 10102 next(self.parseColorSpace({ 10103 cs: args[0], 10104 resources, 10105 localColorSpaceCache 10106 }).then(function (colorSpace) { 10107 if (colorSpace) { 10108 stateManager.state.strokeColorSpace = colorSpace; 10109 } 10110 })); 10111 return; 10112 } 10113 case _util.OPS.setFillColor: 10114 cs = stateManager.state.fillColorSpace; 10115 args = cs.getRgb(args, 0); 10116 fn = _util.OPS.setFillRGBColor; 10117 break; 10118 case _util.OPS.setStrokeColor: 10119 cs = stateManager.state.strokeColorSpace; 10120 args = cs.getRgb(args, 0); 10121 fn = _util.OPS.setStrokeRGBColor; 10122 break; 10123 case _util.OPS.setFillGray: 10124 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 10125 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 10126 fn = _util.OPS.setFillRGBColor; 10127 break; 10128 case _util.OPS.setStrokeGray: 10129 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 10130 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 10131 fn = _util.OPS.setStrokeRGBColor; 10132 break; 10133 case _util.OPS.setFillCMYKColor: 10134 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk; 10135 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 10136 fn = _util.OPS.setFillRGBColor; 10137 break; 10138 case _util.OPS.setStrokeCMYKColor: 10139 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk; 10140 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 10141 fn = _util.OPS.setStrokeRGBColor; 10142 break; 10143 case _util.OPS.setFillRGBColor: 10144 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb; 10145 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 10146 break; 10147 case _util.OPS.setStrokeRGBColor: 10148 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb; 10149 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 10150 break; 10151 case _util.OPS.setFillColorN: 10152 cs = stateManager.state.fillColorSpace; 10153 if (cs.name === "Pattern") { 10154 next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); 10155 return; 10156 } 10157 args = cs.getRgb(args, 0); 10158 fn = _util.OPS.setFillRGBColor; 10159 break; 10160 case _util.OPS.setStrokeColorN: 10161 cs = stateManager.state.strokeColorSpace; 10162 if (cs.name === "Pattern") { 10163 next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); 10164 return; 10165 } 10166 args = cs.getRgb(args, 0); 10167 fn = _util.OPS.setStrokeRGBColor; 10168 break; 10169 case _util.OPS.shadingFill: 10170 var shadingRes = resources.get("Shading"); 10171 if (!shadingRes) { 10172 throw new _util.FormatError("No shading resource found"); 10173 } 10174 var shading = shadingRes.get(args[0].name); 10175 if (!shading) { 10176 throw new _util.FormatError("No shading object found"); 10177 } 10178 const patternId = self.parseShading({ 10179 shading, 10180 resources, 10181 localColorSpaceCache, 10182 localShadingPatternCache 10183 }); 10184 args = [patternId]; 10185 fn = _util.OPS.shadingFill; 10186 break; 10187 case _util.OPS.setGState: 10188 isValidName = args[0] instanceof _primitives.Name; 10189 name = args[0].name; 10190 if (isValidName) { 10191 const localGStateObj = localGStateCache.getByName(name); 10192 if (localGStateObj) { 10193 if (localGStateObj.length > 0) { 10194 operatorList.addOp(_util.OPS.setGState, [localGStateObj]); 10195 } 10196 args = null; 10197 continue; 10198 } 10199 } 10200 next(new Promise(function (resolveGState, rejectGState) { 10201 if (!isValidName) { 10202 throw new _util.FormatError("GState must be referred to by name."); 10203 }
10204 const extGState = resources.get("ExtGState"); 10205 if (!(extGState instanceof _primitives.Dict)) { 10206 throw new _util.FormatError("ExtGState should be a dictionary."); 10207 } 10208 const gState = extGState.get(name); 10209 if (!(gState instanceof _primitives.Dict)) { 10210 throw new _util.FormatError("GState should be a dictionary."); 10211 } 10212 self.setGState({ 10213 resources, 10214 gState, 10215 operatorList, 10216 cacheKey: name, 10217 task, 10218 stateManager, 10219 localGStateCache, 10220 localColorSpaceCache 10221 }).then(resolveGState, rejectGState); 10222 }).catch(function (reason) { 10223 if (reason instanceof _util.AbortException) { 10224 return; 10225 } 10226 if (self.options.ignoreErrors) { 10227 (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`); 10228 return; 10229 } 10230 throw reason; 10231 })); 10232 return; 10233 case _util.OPS.moveTo: 10234 case _util.OPS.lineTo: 10235 case _util.OPS.curveTo: 10236 case _util.OPS.curveTo2: 10237 case _util.OPS.curveTo3: 10238 case _util.OPS.closePath: 10239 case _util.OPS.rectangle: 10240 self.buildPath(operatorList, fn, args, parsingText); 10241 continue; 10242 case _util.OPS.markPoint: 10243 case _util.OPS.markPointProps: 10244 case _util.OPS.beginCompat: 10245 case _util.OPS.endCompat: 10246 continue; 10247 case _util.OPS.beginMarkedContentProps: 10248 if (!(args[0] instanceof _primitives.Name)) { 10249 (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`); 10250 continue; 10251 } 10252 if (args[0].name === "OC") { 10253 next(self.parseMarkedContentProps(args[1], resources).then(data => { 10254 operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]); 10255 }).catch(reason => { 10256 if (reason instanceof _util.AbortException) { 10257 return; 10258 } 10259 if (self.options.ignoreErrors) { 10260 (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`); 10261 return; 10262 } 10263 throw reason; 10264 })); 10265 return; 10266 } 10267 args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null]; 10268 break; 10269 case _util.OPS.beginMarkedContent: 10270 case _util.OPS.endMarkedContent: 10271 default: 10272 if (args !== null) { 10273 for (i = 0, ii = args.length; i < ii; i++) { 10274 if (args[i] instanceof _primitives.Dict) { 10275 break; 10276 } 10277 } 10278 if (i < ii) { 10279 (0, _util.warn)("getOperatorList - ignoring operator: " + fn); 10280 continue; 10281 } 10282 } 10283 } 10284 operatorList.addOp(fn, args); 10285 } 10286 if (stop) { 10287 next(deferred); 10288 return; 10289 } 10290 closePendingRestoreOPS(); 10291 resolve(); 10292 }).catch(reason => { 10293 if (reason instanceof _util.AbortException) { 10294 return; 10295 } 10296 if (this.options.ignoreErrors) { 10297 (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 10298 closePendingRestoreOPS(); 10299 return; 10300 } 10301 throw reason; 10302 }); 10303 } 10304 getTextContent({ 10305 stream, 10306 task, 10307 resources, 10308 stateManager = null, 10309 includeMarkedContent = false, 10310 sink, 10311 seenStyles = new Set(), 10312 viewBox, 10313 markedContentData = null, 10314 disableNormalization = false 10315 }) { 10316 resources ||= _primitives.Dict.empty; 10317 stateManager ||= new StateManager(new TextState()); 10318 if (includeMarkedContent) { 10319 markedContentData ||= { 10320 level: 0 10321 }; 10322 } 10323 const textContent = { 10324 items: [], 10325 styles: Object.create(null) 10326 }; 10327 const textContentItem = { 10328 initialized: false, 10329 str: [], 10330 totalWidth: 0, 10331 totalHeight: 0, 10332 width: 0, 10333 height: 0, 10334 vertical: false, 10335 prevTransform: null, 10336 textAdvanceScale: 0, 10337 spaceInFlowMin: 0, 10338 spaceInFlowMax: 0, 10339 trackingSpaceMin: Infinity,
vendor: 3,080 bytes, lines 10340-10425
10340 negativeSpaceMax: -Infinity, 10341 notASpace: -Infinity, 10342 transform: null, 10343 fontName: null, 10344 hasEOL: false 10345 }; 10346 const twoLastChars = [" ", " "]; 10347 let twoLastCharsPos = 0; 10348 function saveLastChar(char) { 10349 const nextPos = (twoLastCharsPos + 1) % 2; 10350 const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " "; 10351 twoLastChars[twoLastCharsPos] = char; 10352 twoLastCharsPos = nextPos; 10353 return ret; 10354 } 10355 function shouldAddWhitepsace() { 10356 return twoLastChars[twoLastCharsPos] !== " " && twoLastChars[(twoLastCharsPos + 1) % 2] === " "; 10357 } 10358 function resetLastChars() { 10359 twoLastChars[0] = twoLastChars[1] = " "; 10360 twoLastCharsPos = 0; 10361 } 10362 const TRACKING_SPACE_FACTOR = 0.102; 10363 const NOT_A_SPACE_FACTOR = 0.03; 10364 const NEGATIVE_SPACE_FACTOR = -0.2; 10365 const SPACE_IN_FLOW_MIN_FACTOR = 0.102; 10366 const SPACE_IN_FLOW_MAX_FACTOR = 0.6; 10367 const VERTICAL_SHIFT_RATIO = 0.25; 10368 const self = this; 10369 const xref = this.xref; 10370 const showSpacedTextBuffer = []; 10371 let xobjs = null; 10372 const emptyXObjectCache = new _image_utils.LocalImageCache(); 10373 const emptyGStateCache = new _image_utils.LocalGStateCache(); 10374 const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 10375 let textState; 10376 function pushWhitespace({ 10377 width = 0, 10378 height = 0, 10379 transform = textContentItem.prevTransform, 10380 fontName = textContentItem.fontName 10381 }) { 10382 textContent.items.push({ 10383 str: " ", 10384 dir: "ltr", 10385 width, 10386 height, 10387 transform, 10388 fontName, 10389 hasEOL: false 10390 }); 10391 } 10392 function getCurrentTextTransform() { 10393 const font = textState.font; 10394 const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise]; 10395 if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) { 10396 const glyphHeight = font.bbox[3] - font.bbox[1]; 10397 if (glyphHeight > 0) { 10398 tsm[3] *= glyphHeight * textState.fontMatrix[3]; 10399 } 10400 } 10401 return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm)); 10402 } 10403 function ensureTextContentItem() { 10404 if (textContentItem.initialized) { 10405 return textContentItem; 10406 } 10407 const { 10408 font, 10409 loadedName 10410 } = textState; 10411 if (!seenStyles.has(loadedName)) { 10412 seenStyles.add(loadedName); 10413 textContent.styles[loadedName] = { 10414 fontFamily: font.fallbackName, 10415 ascent: font.ascent, 10416 descent: font.descent, 10417 vertical: font.vertical 10418 }; 10419 } 10420 textContentItem.fontName = loadedName; 10421 const trm = textContentItem.transform = getCurrentTextTransform(); 10422 if (!font.vertical) { 10423 textContentItem.width = textContentItem.totalWidth = 0; 10424 textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]); 10425 textContentItem.vertical = false;
vendor: 1,088 bytes, lines 10426-10449
10426 } else { 10427 textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]); 10428 textContentItem.height = textContentItem.totalHeight = 0; 10429 textContentItem.vertical = true; 10430 } 10431 const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]); 10432 const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]); 10433 textContentItem.textAdvanceScale = scaleCtmX * scaleLineX; 10434 const { 10435 fontSize 10436 } = textState; 10437 textContentItem.trackingSpaceMin = fontSize * TRACKING_SPACE_FACTOR; 10438 textContentItem.notASpace = fontSize * NOT_A_SPACE_FACTOR; 10439 textContentItem.negativeSpaceMax = fontSize * NEGATIVE_SPACE_FACTOR; 10440 textContentItem.spaceInFlowMin = fontSize * SPACE_IN_FLOW_MIN_FACTOR; 10441 textContentItem.spaceInFlowMax = fontSize * SPACE_IN_FLOW_MAX_FACTOR; 10442 textContentItem.hasEOL = false; 10443 textContentItem.initialized = true; 10444 return textContentItem; 10445 } 10446 function updateAdvanceScale() { 10447 if (!textContentItem.initialized) { 10448 return; 10449 }
vendor: 13,483 bytes, lines 10450-10827
10450 const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]); 10451 const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]); 10452 const scaleFactor = scaleCtmX * scaleLineX; 10453 if (scaleFactor === textContentItem.textAdvanceScale) { 10454 return; 10455 } 10456 if (!textContentItem.vertical) { 10457 textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale; 10458 textContentItem.width = 0; 10459 } else { 10460 textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale; 10461 textContentItem.height = 0; 10462 } 10463 textContentItem.textAdvanceScale = scaleFactor; 10464 } 10465 function runBidiTransform(textChunk) { 10466 let text = textChunk.str.join(""); 10467 if (!disableNormalization) { 10468 text = (0, _util.normalizeUnicode)(text); 10469 } 10470 const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical); 10471 return { 10472 str: bidiResult.str, 10473 dir: bidiResult.dir, 10474 width: Math.abs(textChunk.totalWidth), 10475 height: Math.abs(textChunk.totalHeight), 10476 transform: textChunk.transform, 10477 fontName: textChunk.fontName, 10478 hasEOL: textChunk.hasEOL 10479 }; 10480 } 10481 function handleSetFont(fontName, fontRef) { 10482 return self.loadFont(fontName, fontRef, resources).then(function (translated) { 10483 if (!translated.font.isType3Font) { 10484 return translated; 10485 } 10486 return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () { 10487 return translated; 10488 }); 10489 }).then(function (translated) { 10490 textState.loadedName = translated.loadedName; 10491 textState.font = translated.font; 10492 textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX; 10493 }); 10494 } 10495 function applyInverseRotation(x, y, matrix) { 10496 const scale = Math.hypot(matrix[0], matrix[1]); 10497 return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale]; 10498 } 10499 function compareWithLastPosition(glyphWidth) { 10500 const currentTransform = getCurrentTextTransform(); 10501 let posX = currentTransform[4]; 10502 let posY = currentTransform[5]; 10503 if (textState.font?.vertical) { 10504 if (posX < viewBox[0] || posX > viewBox[2] || posY + glyphWidth < viewBox[1] || posY > viewBox[3]) { 10505 return false; 10506 } 10507 } else if (posX + glyphWidth < viewBox[0] || posX > viewBox[2] || posY < viewBox[1] || posY > viewBox[3]) { 10508 return false; 10509 } 10510 if (!textState.font || !textContentItem.prevTransform) { 10511 return true; 10512 } 10513 let lastPosX = textContentItem.prevTransform[4]; 10514 let lastPosY = textContentItem.prevTransform[5]; 10515 if (lastPosX === posX && lastPosY === posY) { 10516 return true; 10517 } 10518 let rotate = -1; 10519 if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) { 10520 rotate = currentTransform[0] > 0 ? 0 : 180; 10521 } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) { 10522 rotate = currentTransform[1] > 0 ? 90 : 270; 10523 } 10524 switch (rotate) { 10525 case 0: 10526 break; 10527 case 90: 10528 [posX, posY] = [posY, posX]; 10529 [lastPosX, lastPosY] = [lastPosY, lastPosX]; 10530 break; 10531 case 180: 10532 [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY]; 10533 break; 10534 case 270: 10535 [posX, posY] = [-posY, -posX]; 10536 [lastPosX, lastPosY] = [-lastPosY, -lastPosX]; 10537 break; 10538 default: 10539 [posX, posY] = applyInverseRotation(posX, posY, currentTransform); 10540 [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform); 10541 } 10542 if (textState.font.vertical) { 10543 const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale; 10544 const advanceX = posX - lastPosX; 10545 const textOrientation = Math.sign(textContentItem.height); 10546 if (advanceY < textOrientation * textContentItem.negativeSpaceMax) { 10547 if (Math.abs(advanceX) > 0.5 * textContentItem.width) { 10548 appendEOL(); 10549 return true; 10550 } 10551 resetLastChars(); 10552 flushTextContentItem(); 10553 return true; 10554 } 10555 if (Math.abs(advanceX) > textContentItem.width) { 10556 appendEOL(); 10557 return true; 10558 } 10559 if (advanceY <= textOrientation * textContentItem.notASpace) { 10560 resetLastChars(); 10561 } 10562 if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) { 10563 if (shouldAddWhitepsace()) { 10564 resetLastChars(); 10565 flushTextContentItem(); 10566 pushWhitespace({ 10567 height: Math.abs(advanceY) 10568 }); 10569 } else { 10570 textContentItem.height += advanceY; 10571 } 10572 } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) { 10573 if (textContentItem.str.length === 0) { 10574 resetLastChars(); 10575 pushWhitespace({ 10576 height: Math.abs(advanceY) 10577 }); 10578 } else { 10579 textContentItem.height += advanceY; 10580 } 10581 } 10582 if (Math.abs(advanceX) > textContentItem.width * VERTICAL_SHIFT_RATIO) { 10583 flushTextContentItem(); 10584 } 10585 return true; 10586 } 10587 const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale; 10588 const advanceY = posY - lastPosY; 10589 const textOrientation = Math.sign(textContentItem.width); 10590 if (advanceX < textOrientation * textContentItem.negativeSpaceMax) { 10591 if (Math.abs(advanceY) > 0.5 * textContentItem.height) { 10592 appendEOL(); 10593 return true; 10594 } 10595 resetLastChars(); 10596 flushTextContentItem(); 10597 return true; 10598 } 10599 if (Math.abs(advanceY) > textContentItem.height) { 10600 appendEOL(); 10601 return true; 10602 } 10603 if (advanceX <= textOrientation * textContentItem.notASpace) { 10604 resetLastChars(); 10605 } 10606 if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) { 10607 if (shouldAddWhitepsace()) { 10608 resetLastChars(); 10609 flushTextContentItem(); 10610 pushWhitespace({ 10611 width: Math.abs(advanceX) 10612 }); 10613 } else { 10614 textContentItem.width += advanceX; 10615 } 10616 } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) { 10617 if (textContentItem.str.length === 0) { 10618 resetLastChars(); 10619 pushWhitespace({ 10620 width: Math.abs(advanceX) 10621 }); 10622 } else { 10623 textContentItem.width += advanceX; 10624 } 10625 } 10626 if (Math.abs(advanceY) > textContentItem.height * VERTICAL_SHIFT_RATIO) { 10627 flushTextContentItem(); 10628 } 10629 return true; 10630 } 10631 function buildTextContentItem({ 10632 chars, 10633 extraSpacing 10634 }) { 10635 const font = textState.font; 10636 if (!chars) { 10637 const charSpacing = textState.charSpacing + extraSpacing; 10638 if (charSpacing) { 10639 if (!font.vertical) { 10640 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 10641 } else { 10642 textState.translateTextMatrix(0, -charSpacing); 10643 } 10644 } 10645 return; 10646 } 10647 const glyphs = font.charsToGlyphs(chars); 10648 const scale = textState.fontMatrix[0] * textState.fontSize; 10649 for (let i = 0, ii = glyphs.length; i < ii; i++) { 10650 const glyph = glyphs[i]; 10651 const { 10652 category 10653 } = glyph; 10654 if (category.isInvisibleFormatMark) { 10655 continue; 10656 } 10657 let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0); 10658 let glyphWidth = glyph.width; 10659 if (font.vertical) { 10660 glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth; 10661 } 10662 let scaledDim = glyphWidth * scale; 10663 if (category.isWhitespace) { 10664 if (!font.vertical) { 10665 charSpacing += scaledDim + textState.wordSpacing; 10666 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 10667 } else { 10668 charSpacing += -scaledDim + textState.wordSpacing; 10669 textState.translateTextMatrix(0, -charSpacing); 10670 } 10671 saveLastChar(" "); 10672 continue; 10673 } 10674 if (!category.isZeroWidthDiacritic && !compareWithLastPosition(scaledDim)) { 10675 if (!font.vertical) { 10676 textState.translateTextMatrix(scaledDim * textState.textHScale, 0); 10677 } else { 10678 textState.translateTextMatrix(0, scaledDim); 10679 } 10680 continue; 10681 } 10682 const textChunk = ensureTextContentItem(); 10683 if (category.isZeroWidthDiacritic) { 10684 scaledDim = 0; 10685 } 10686 if (!font.vertical) { 10687 scaledDim *= textState.textHScale; 10688 textState.translateTextMatrix(scaledDim, 0); 10689 textChunk.width += scaledDim; 10690 } else { 10691 textState.translateTextMatrix(0, scaledDim); 10692 scaledDim = Math.abs(scaledDim); 10693 textChunk.height += scaledDim; 10694 } 10695 if (scaledDim) { 10696 textChunk.prevTransform = getCurrentTextTransform(); 10697 } 10698 const glyphUnicode = glyph.unicode; 10699 if (saveLastChar(glyphUnicode)) { 10700 textChunk.str.push(" "); 10701 } 10702 textChunk.str.push(glyphUnicode); 10703 if (charSpacing) { 10704 if (!font.vertical) { 10705 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 10706 } else { 10707 textState.translateTextMatrix(0, -charSpacing); 10708 } 10709 } 10710 } 10711 } 10712 function appendEOL() { 10713 resetLastChars(); 10714 if (textContentItem.initialized) { 10715 textContentItem.hasEOL = true; 10716 flushTextContentItem(); 10717 } else { 10718 textContent.items.push({ 10719 str: "", 10720 dir: "ltr", 10721 width: 0, 10722 height: 0, 10723 transform: getCurrentTextTransform(), 10724 fontName: textState.loadedName, 10725 hasEOL: true 10726 }); 10727 } 10728 } 10729 function addFakeSpaces(width, transf, textOrientation) { 10730 if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) { 10731 if (textContentItem.initialized) { 10732 resetLastChars(); 10733 textContentItem.str.push(" "); 10734 } 10735 return false; 10736 } 10737 const fontName = textContentItem.fontName; 10738 let height = 0; 10739 if (textContentItem.vertical) { 10740 height = width; 10741 width = 0; 10742 } 10743 flushTextContentItem(); 10744 resetLastChars(); 10745 pushWhitespace({ 10746 width: Math.abs(width), 10747 height: Math.abs(height), 10748 transform: transf || getCurrentTextTransform(), 10749 fontName 10750 }); 10751 return true; 10752 } 10753 function flushTextContentItem() { 10754 if (!textContentItem.initialized || !textContentItem.str) { 10755 return; 10756 } 10757 if (!textContentItem.vertical) { 10758 textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale; 10759 } else { 10760 textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale; 10761 } 10762 textContent.items.push(runBidiTransform(textContentItem)); 10763 textContentItem.initialized = false; 10764 textContentItem.str.length = 0; 10765 } 10766 function enqueueChunk(batch = false) { 10767 const length = textContent.items.length; 10768 if (length === 0) { 10769 return; 10770 } 10771 if (batch && length < TEXT_CHUNK_BATCH_SIZE) { 10772 return; 10773 } 10774 sink.enqueue(textContent, length); 10775 textContent.items = []; 10776 textContent.styles = Object.create(null); 10777 } 10778 const timeSlotManager = new TimeSlotManager(); 10779 return new Promise(function promiseBody(resolve, reject) { 10780 const next = function (promise) { 10781 enqueueChunk(true); 10782 Promise.all([promise, sink.ready]).then(function () { 10783 try { 10784 promiseBody(resolve, reject); 10785 } catch (ex) { 10786 reject(ex); 10787 } 10788 }, reject); 10789 }; 10790 task.ensureNotTerminated(); 10791 timeSlotManager.reset(); 10792 const operation = {}; 10793 let stop, 10794 args = []; 10795 while (!(stop = timeSlotManager.check())) { 10796 args.length = 0; 10797 operation.args = args; 10798 if (!preprocessor.read(operation)) { 10799 break; 10800 } 10801 const previousState = textState; 10802 textState = stateManager.state; 10803 const fn = operation.fn; 10804 args = operation.args; 10805 switch (fn | 0) { 10806 case _util.OPS.setFont: 10807 var fontNameArg = args[0].name, 10808 fontSizeArg = args[1]; 10809 if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) { 10810 break; 10811 } 10812 flushTextContentItem(); 10813 textState.fontName = fontNameArg; 10814 textState.fontSize = fontSizeArg; 10815 next(handleSetFont(fontNameArg, null)); 10816 return; 10817 case _util.OPS.setTextRise: 10818 textState.textRise = args[0]; 10819 break; 10820 case _util.OPS.setHScale: 10821 textState.textHScale = args[0] / 100; 10822 break; 10823 case _util.OPS.setLeading: 10824 textState.leading = args[0]; 10825 break; 10826 case _util.OPS.moveText: 10827 textState.translateTextLineMatrix(args[0], args[1]);
10828 textState.textMatrix = textState.textLineMatrix.slice(); 10829 break; 10830 case _util.OPS.setLeadingMoveText: 10831 textState.leading = -args[1]; 10832 textState.translateTextLineMatrix(args[0], args[1]); 10833 textState.textMatrix = textState.textLineMatrix.slice(); 10834 break; 10835 case _util.OPS.nextLine: 10836 textState.carriageReturn(); 10837 break; 10838 case _util.OPS.setTextMatrix: 10839 textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 10840 textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 10841 updateAdvanceScale(); 10842 break; 10843 case _util.OPS.setCharSpacing: 10844 textState.charSpacing = args[0]; 10845 break; 10846 case _util.OPS.setWordSpacing: 10847 textState.wordSpacing = args[0]; 10848 break; 10849 case _util.OPS.beginText: 10850 textState.textMatrix = _util.IDENTITY_MATRIX.slice(); 10851 textState.textLineMatr
vendor: 4,360 bytes, lines 10851-10962
10851ix = _util.IDENTITY_MATRIX.slice(); 10852 break; 10853 case _util.OPS.showSpacedText: 10854 if (!stateManager.state.font) { 10855 self.ensureStateFont(stateManager.state); 10856 continue; 10857 } 10858 const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000; 10859 const elements = args[0]; 10860 for (let i = 0, ii = elements.length; i < ii; i++) { 10861 const item = elements[i]; 10862 if (typeof item === "string") { 10863 showSpacedTextBuffer.push(item); 10864 } else if (typeof item === "number" && item !== 0) { 10865 const str = showSpacedTextBuffer.join(""); 10866 showSpacedTextBuffer.length = 0; 10867 buildTextContentItem({ 10868 chars: str, 10869 extraSpacing: item * spaceFactor 10870 }); 10871 } 10872 } 10873 if (showSpacedTextBuffer.length > 0) { 10874 const str = showSpacedTextBuffer.join(""); 10875 showSpacedTextBuffer.length = 0; 10876 buildTextContentItem({ 10877 chars: str, 10878 extraSpacing: 0 10879 }); 10880 } 10881 break; 10882 case _util.OPS.showText: 10883 if (!stateManager.state.font) { 10884 self.ensureStateFont(stateManager.state); 10885 continue; 10886 } 10887 buildTextContentItem({ 10888 chars: args[0], 10889 extraSpacing: 0 10890 }); 10891 break; 10892 case _util.OPS.nextLineShowText: 10893 if (!stateManager.state.font) { 10894 self.ensureStateFont(stateManager.state); 10895 continue; 10896 } 10897 textState.carriageReturn(); 10898 buildTextContentItem({ 10899 chars: args[0], 10900 extraSpacing: 0 10901 }); 10902 break; 10903 case _util.OPS.nextLineSetSpacingShowText: 10904 if (!stateManager.state.font) { 10905 self.ensureStateFont(stateManager.state); 10906 continue; 10907 } 10908 textState.wordSpacing = args[0]; 10909 textState.charSpacing = args[1]; 10910 textState.carriageReturn(); 10911 buildTextContentItem({ 10912 chars: args[2], 10913 extraSpacing: 0 10914 }); 10915 break; 10916 case _util.OPS.paintXObject: 10917 flushTextContentItem(); 10918 if (!xobjs) { 10919 xobjs = resources.get("XObject") || _primitives.Dict.empty; 10920 } 10921 var isValidName = args[0] instanceof _primitives.Name; 10922 var name = args[0].name; 10923 if (isValidName && emptyXObjectCache.getByName(name)) { 10924 break; 10925 } 10926 next(new Promise(function (resolveXObject, rejectXObject) { 10927 if (!isValidName) { 10928 throw new _util.FormatError("XObject must be referred to by name."); 10929 } 10930 let xobj = xobjs.getRaw(name); 10931 if (xobj instanceof _primitives.Ref) { 10932 if (emptyXObjectCache.getByRef(xobj)) { 10933 resolveXObject(); 10934 return; 10935 } 10936 const globalImage = self.globalImageCache.getData(xobj, self.pageIndex); 10937 if (globalImage) { 10938 resolveXObject(); 10939 return; 10940 } 10941 xobj = xref.fetch(xobj); 10942 } 10943 if (!(xobj instanceof _base_stream.BaseStream)) { 10944 throw new _util.FormatError("XObject should be a stream"); 10945 } 10946 const type = xobj.dict.get("Subtype"); 10947 if (!(type instanceof _primitives.Name)) { 10948 throw new _util.FormatError("XObject should have a Name subtype"); 10949 } 10950 if (type.name !== "Form") { 10951 emptyXObjectCache.set(name, xobj.dict.objId, true); 10952 resolveXObject(); 10953 return; 10954 } 10955 const currentState = stateManager.state.clone(); 10956 const xObjStateManager = new StateManager(currentState); 10957 const matrix = xobj.dict.getArray("Matrix"); 10958 if (Array.isArray(matrix) && matrix.length === 6) { 10959 xObjStateManager.transform(matrix); 10960 } 10961 enqueueChunk(); 10962 const sinkWrapper = {
10963 enqueueInvoked: false, 10964 enqueue(chunk, size) { 10965 this.enqueueInvoked = true; 10966 sink.enqueue(chunk, size); 10967 }, 10968 get desiredSize() { 10969 return sink.desiredSize; 10970 }, 10971 get ready() { 10972 return sink.ready; 10973 } 10974 }; 10975 self.getTextContent({ 10976 stream: xobj, 10977 task, 10978 resources: xobj.dict.get("Resources") || resources, 10979 stateManager: xObjStateManager, 10980 includeMarkedContent, 10981 sink: sinkWrapper, 10982 seenStyles, 10983 viewBox, 10984 markedContentData, 10985 disableNormalization 10986 }).then(function () { 10987 if (!sinkWrapper.enqueueInvoked) { 10988 emptyXObjectCache.set(name, xobj.dict.objId, true); 10989 } 10990 resolveXObject(); 10991 }, rejectXObject); 10992 }).catch(function (reason) { 10993 if (reason instanceof _util.AbortException) { 10994 return; 10995 } 10996 if (self.options.ignoreErrors) { 10997 (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`); 10998 return; 10999 } 11000 throw reason; 11001 })); 11002 return; 11003 case _util.OPS.setGState: 11004 isValidName = args[0] instanceof _primitives.Name; 11005 name = args[0].name; 11006 if (isValidName && emptyGStateCache.getByName(name)) { 11007 break; 11008 } 11009 next(new Promise(function (resolveGState, rejectGState) { 11010 if (!isValidName) { 11011 throw new _util.FormatError("GState must be referred to by name."); 11012 } 11013 const extGState = resources.get("ExtGState"); 11014 if (!(extGState instanceof _primitives.Dict)) { 11015 throw new _util.FormatError("ExtGState should be a dictionary."); 11016 } 11017 const gState = extGState.get(name); 11018 if (!(gState instanceof _primitives.Dict)) { 11019 throw new _util.FormatError("GState should be a dictionary."); 11020 } 11021 const gStateFont = gState.get("Font"); 11022 if (!gStateFont) { 11023 emptyGStateCache.set(name, gState.objId, true); 11024 resolveGState(); 11025 return; 11026 } 11027 flushTextContentItem(); 11028 textState.fontName = null; 11029 textState.fontSize = gStateFont[1]; 11030 handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState); 11031 }).catch(function (reason) { 11032 if (reason instanceof _util.AbortException) { 11033 return; 11034 } 11035 if (self.options.ignoreErrors) { 11036 (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`); 11037 return; 11038 } 11039 throw reason; 11040 })); 11041 return; 11042 case _util.OPS.beginMarkedContent: 11043 flushTextContentItem(); 11044 if (includeMarkedContent) { 11045 markedContentData.level++; 11046 textContent.items.push({ 11047 type: "beginMarkedContent", 11048 tag: args[0] instanceof _primitives.Name ? args[0].name : null 11049 }); 11050 } 11051 break; 11052 case _util.OPS.beginMarkedContentProps: 11053 flushTextContentItem(); 11054 if (includeMarkedContent) { 11055 markedContentData.level++; 11056 let mcid = null; 11057 if (args[1] instanceof _primitives.Dict) { 11058 mcid = args[1].get("MCID"); 11059 } 11060 textContent.items.push({ 11061 type: "beginMarkedContentProps", 11062 id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mc${mcid}` : null, 11063 tag: args[0] instanceof _primitives.Name ? args[0].name : null 11064 }); 11065 } 11066 break; 11067 case _util.OPS.endMarkedContent: 11068 flushTextContentItem(); 11069 if (includeMarkedContent) { 11070 if (markedContentData.level === 0) { 11071 break; 11072 } 11073 markedContentData.level--; 11074 textContent.items.push({ 11075 type: "endMarkedContent" 11076 }); 11077 } 11078 break; 11079 case _util.OPS.restore: 11080 if (previousState && (previousState.font !== textState.font || previousState.fontSize !== textState.fontSize || previousState.fontName !== textState.fontName)) { 11081 flushTextContentItem(); 11082 } 11083 break; 11084 } 11085 if (textContent.items.length >= sink.desiredSize) { 11086 stop = true; 11087 break; 11088 } 11089 } 11090 if (stop) { 11091 next(deferred); 11092 return; 11093 } 11094 flushTextContentItem(); 11095 enqueueChunk(); 11096 resolve(); 11097 }).catch(reason => { 11098 if (reason instanceof _util.AbortException) { 11099 return; 11100 } 11101 if (this.options.ignoreErrors) { 11102 (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 11103 flushTextContentItem(); 11104 enqueueChunk(); 11105 return; 11106 } 11107 throw reason; 11108 }); 11109 } 11110 extractDataStructures(dict, baseDict, properties) { 11111 const xref = this.xref;
11112 let cidToGidBytes; 11113 const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode")); 11114 if (properties.composite) { 11115 const cidSystemInfo = dict.get("CIDSystemInfo"); 11116 if (cidSystemInfo instanceof _primitives.Dict) { 11117 properties.cidSystemInfo = { 11118 registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")), 11119 ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")), 11120 supplement: cidSystemInfo.get("Supplement") 11121 }; 11122 } 11123 try { 11124 const cidToGidMap = dict.get("CIDToGIDMap"); 11125 if (cidToGidMap instanceof _base_stream.BaseStream) { 11126 cidToGidBytes = cidToGidMap.getBytes(); 11127 } 11128 } catch (ex) { 11129 if (!this.options.ignoreErrors) { 11130 throw ex; 11131 } 11132 (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`); 11133 } 11134 } 11135 const differences = []; 11136 let baseEncodingName = null; 11137 let encoding; 11138 if (dict.has("Encoding")) { 11139 encoding = dict.get("Encoding"); 11140 if (encoding instanceof _primitives.Dict) { 11141 baseEncodingName = encoding.get("BaseEncoding"); 11142 baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null; 11143 if (encoding.has("Differences")) { 11144 const diffEncoding = encoding.get("Differences"); 11145 let index = 0; 11146 for (const entry of diffEncoding) { 11147 const data = xref.fetchIfRef(entry); 11148 if (typeof data === "number") { 11149 index = data; 11150 } else if (data instanceof _primitives.Name) { 11151 differences[index++] = data.name; 11152 } else { 11153 throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`); 11154 } 11155 } 11156 } 11157 } else if (encoding instanceof _primitives.Name) { 11158 baseEncodingName = encoding.name; 11159 } else { 11160 const msg = "Encoding is not a Name nor a Dict"; 11161 if (!this.options.ignoreErrors) { 11162 throw new _util.FormatError(msg); 11163 } 11164 (0, _util.warn)(msg); 11165 } 11166 if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") { 11167 baseEncodingName = null; 11168 } 11169 } 11170 const nonEmbeddedFont = !properties.file || properties.isInternalFont, 11171 isSymbolsFontName = (0, _standard_fonts.getSymbolsFonts)()[properties.name]; 11172 if (baseEncodingName && nonEmbeddedFont && isSymbolsFontName) { 11173 baseEncodingName = null; 11174 } 11175 if (baseEncodingName) { 11176 properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName); 11177 } else { 11178 const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic); 11179 const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic); 11180 encoding = _encodings.StandardEncoding; 11181 if (properties.type === "TrueType" && !isNonsymbolicFont) { 11182 encoding = _encodings.WinAnsiEncoding; 11183 } 11184 if (isSymbolicFont || isSymbolsFontName) { 11185 encoding = _encodings.MacRomanEncoding; 11186 if (nonEmbeddedFont) { 11187 if (/Symbol/i.test(properties.name)) { 11188 encoding = _encodings.SymbolSetEncoding; 11189 } else if (/Dingbats/i.test(properties.name)) { 11190 encoding = _encodings.ZapfDingbatsEncoding; 11191 } else if (/Wingdings/i.test(properties.name)) { 11192 encoding = _encodings.WinAnsiEncoding; 11193 } 11194 } 11195 } 11196 properties.defaultEncoding = encoding; 11197 } 11198 properties.differences = differences; 11199 properties.baseEncodingName = baseEncodingName; 11200 properties.hasEncoding = !!baseEncodingName || differences.length > 0; 11201 properties.dict = dict; 11202 return toUnicodePromise.then(readToUnicode => { 11203 properties.toUnicode = readToUnicode; 11204 return this.buildToUnicode(properties); 11205 }).then(builtToUnicode => { 11206 properties.toUnicode = builtToUnicode; 11207 if (cidToGidBytes) { 11208 properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode); 11209 } 11210 return properties; 11211 }); 11212 } 11213 _simpleFontToUnicode(properties, forceGlyphs = false) { 11214 (0, _util.assert)(!properties.composite, "Must be a simple font."); 11215 const toUnicode = []; 11216 const encoding = properties.defaultEncoding.slice(); 11217 const baseEncodingName = properties.baseEncodingName; 11218 const differences = properties.differences; 11219 for (const charcode in differences) { 11220 const glyphName = differences[charcode]; 11221 if (glyphName === ".notdef") { 11222 continue; 11223 } 11224 encoding[charcode] = glyphName; 11225 } 11226 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 11227 for (const charcode in encoding) { 11228 let glyphName = encoding[charcode]; 11229 if (glyphName === "") { 11230 continue; 11231 } 11232 let unicode = glyphsUnicodeMap[glyphName]; 11233 if (unicode !== undefined) { 11234 toUnicode[charcode] = String.fromCharCode(unicode); 11235 continue; 11236 } 11237 let code = 0; 11238 switch (glyphName[0]) { 11239 case "G": 11240 if (glyphName.length === 3) { 11241 code = parseInt(glyphName.substring(1), 16); 11242 } 11243 break; 11244 case "g": 11245 if (glyphName.length === 5) { 11246 code = parseInt(glyphName.substring(1), 16); 11247 } 11248 break; 11249 case "C": 11250 case "c": 11251 if (glyphName.length >= 3 && glyphName.length <= 4) { 11252 const codeStr = glyphName.substring(1); 11253 if (forceGlyphs) { 11254 code = parseInt(codeStr, 16); 11255 break; 11256 } 11257 code = +codeStr; 11258 if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) { 11259 return this._simpleFontToUnicode(properties, true); 11260 } 11261 } 11262 break; 11263 case "u": 11264 unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 11265 if (unicode !== -1) { 11266 code = unicode; 11267 } 11268 break; 11269 default: 11270 switch (glyphName) { 11271 case "f_h": 11272 case "f_t": 11273 case "T_h": 11274 toUnicode[charcode] = glyphName.replaceAll("_", ""); 11275 continue; 11276 } 11277 break; 11278 } 11279 if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) { 11280 if (baseEncodingName && code === +charcode) { 11281 const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName); 11282 if (baseEncoding && (glyphName = baseEncoding[charcode])) { 11283 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 11284 continue; 11285 } 11286 } 11287 toUnicode[charcode] = String.fromCodePoint(code); 11288 } 11289 } 11290 return toUnicode; 11291 } 11292 async buildToUnicode(properties) { 11293 properties.hasIncludedToUnicodeMap = properties.toUnicode?.length > 0; 11294 if (properties.hasIncludedToUnicodeMap) { 11295 if (!properties.composite && properties.hasEncoding) { 11296 properties.fallbackToUnicode = this._simpleFontToUnicode(properties); 11297 } 11298 return properties.toUnicode; 11299 } 11300 if (!properties.composite) { 11301 return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties)); 11302 } 11303 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"))) { 11304 const { 11305 registry, 11306 ordering 11307 } = properties.cidSystemInfo; 11308 const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`); 11309 const ucs2CMap = await _cmap.CMapFactory.create({ 11310 encoding: ucs2CMapName, 11311 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 11312 useCMap: null 11313 }); 11314 const toUnicode = [], 11315 buf = [];
11316 properties.cMap.forEach(function (charcode, cid) { 11317 if (cid > 0xffff) { 11318 throw new _util.FormatError("Max size of CID is 65,535"); 11319 } 11320 const ucs2 = ucs2CMap.lookup(cid); 11321 if (ucs2) { 11322 buf.length = 0; 11323 for (let i = 0, ii = ucs2.length; i < ii; i += 2) { 11324 buf.push((ucs2.charCodeAt(i) << 8) + ucs2.charCodeAt(i + 1)); 11325 } 11326 toUnicode[charcode] = String.fromCharCode(...buf); 11327 } 11328 }); 11329 return new _to_unicode_map.ToUnicodeMap(toUnicode); 11330 } 11331 return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar); 11332 } 11333 readToUnicode(cmapObj) { 11334 if (!cmapObj) { 11335 return Promise.resolve(null); 11336 } 11337 if (cmapObj instanceof _primitives.Name) { 11338 return _cmap.CMapFactory.create({ 11339 encoding: cmapObj, 11340 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 11341 useCMap: null 11342 }).then(function (cmap) { 11343 if (cmap instanceof _cmap.IdentityCMap) { 11344 return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff); 11345 } 11346 return new _to_unicode_map.ToUnicodeMap(cmap.getMap()); 11347 }); 11348 } else if (cmapObj instanceof _base_stream.BaseStream) { 11349 return _cmap.CMapFactory.create({ 11350 encoding: cmapObj, 11351 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 11352 useCMap: null 11353 }).then(function (cmap) { 11354 if (cmap instanceof _cmap.IdentityCMap) { 11355 return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff); 11356 } 11357 const map = new Array(cmap.length); 11358 cmap.forEach(function (charCode, token) { 11359 if (typeof token === "number") { 11360 map[charCode] = String.fromCodePoint(token); 11361 return; 11362 } 11363 const str = []; 11364 for (let k = 0; k < token.length; k += 2) {
11365 const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 11366 if ((w1 & 0xf800) !== 0xd800) { 11367 str.push(w1); 11368 continue; 11369 } 11370 k += 2; 11371 const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 11372 str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000); 11373 } 11374 map[charCode] = String.fromCodePoint(...str); 11375 }); 11376 return new _to_unicode_map.ToUnicodeMap(map); 11377 }, reason => { 11378 if (reason instanceof _util.AbortException) { 11379 return null; 11380 } 11381 if (this.options.ignoreErrors) { 11382 (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`); 11383 return null; 11384 } 11385 throw reason; 11386 }); 11387 } 11388 return Promise.resolve(null); 11389 } 11390 readCidToGidMap(glyphsData, toUnicode) { 11391 const result = []; 11392 for (let j = 0, jj = glyphsData.length; j < jj; j++) { 11393 const glyphID = glyphsData[j++] << 8 | glyphsData[j]; 11394 const code = j >> 1; 11395 if (glyphID === 0 && !toUnicode.has(code)) { 11396 continue; 11397 } 11398 result[code] = glyphID; 11399 } 11400 return result; 11401 } 11402 extractWidths(dict, descriptor, properties) { 11403 const xref = this.xref; 11404 let glyphsWidths = []; 11405 let defaultWidth = 0; 11406 const glyphsVMetrics = []; 11407 let defaultVMetrics; 11408 let i, ii, j, jj, start, code, widths; 11409 if (properties.composite) { 11410 defaultWidth = dict.has("DW") ? dict.get("DW") : 1000; 11411 widths = dict.get("W"); 11412 if (widths) { 11413 for (i = 0, ii = widths.length; i < ii; i++) { 11414 start = xref.fetchIfRef(widths[i++]); 11415 code = xref.fetchIfRef(widths[i]); 11416 if (Array.isArray(code)) { 11417 for (j = 0, jj = code.length; j < jj; j++) { 11418 glyphsWidths[start++] = xref.fetchIfRef(code[j]); 11419 } 11420 } else { 11421 const width = xref.fetchIfRef(widths[++i]); 11422 for (j = start; j <= code; j++) { 11423 glyphsWidths[j] = width; 11424 } 11425 } 11426 } 11427 } 11428 if (properties.vertical) { 11429 let vmetrics = dict.getArray("DW2") || [880, -1000]; 11430 defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]]; 11431 vmetrics = dict.get("W2"); 11432 if (vmetrics) { 11433 for (i = 0, ii = vmetrics.length; i < ii; i++) { 11434 start = xref.fetchIfRef(vmetrics[i++]); 11435 code = xref.fetchIfRef(vmetrics[i]); 11436 if (Array.isArray(code)) { 11437 for (j = 0, jj = code.length; j < jj; j++) { 11438 glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])]; 11439 } 11440 } else { 11441 const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])]; 11442 for (j = start; j <= code; j++) { 11443 glyphsVMetrics[j] = vmetric; 11444 } 11445 } 11446 } 11447 } 11448 } 11449 } else { 11450 const firstChar = properties.firstChar; 11451 widths = dict.get("Widths"); 11452 if (widths) { 11453 j = firstChar; 11454 for (i = 0, ii = widths.length; i < ii; i++) { 11455 glyphsWidths[j++] = xref.fetchIfRef(widths[i]); 11456 } 11457 defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0; 11458 } else { 11459 const baseFontName = dict.get("BaseFont"); 11460 if (baseFontName instanceof _primitives.Name) { 11461 const metrics = this.getBaseFontMetrics(baseFontName.name); 11462 glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties); 11463 defaultWidth = metrics.defaultWidth; 11464 } 11465 } 11466 } 11467 let isMonospace = true; 11468 let firstWidth = defaultWidth; 11469 for (const glyph in glyphsWidths) { 11470 const glyphWidth = glyphsWidths[glyph]; 11471 if (!glyphWidth) { 11472 continue; 11473 } 11474 if (!firstWidth) { 11475 firstWidth = glyphWidth; 11476 continue; 11477 } 11478 if (firstWidth !== glyphWidth) { 11479 isMonospace = false; 11480 break; 11481 } 11482 } 11483 if (isMonospace) { 11484 properties.flags |= _fonts_utils.FontFlags.FixedPitch; 11485 } else { 11486 properties.flags &= ~_fonts_utils.FontFlags.FixedPitch; 11487 } 11488 properties.defaultWidth = defaultWidth; 11489 properties.widths = glyphsWidths; 11490 properties.defaultVMetrics = defaultVMetrics; 11491 properties.vmetrics = glyphsVMetrics; 11492 } 11493 isSerifFont(baseFontName) { 11494 const fontNameWoStyle = baseFontName.split("-")[0]; 11495 return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle); 11496 } 11497 getBaseFontMetrics(name) { 11498 let defaultWidth = 0; 11499 let widths = Object.create(null); 11500 let monospace = false;
11501 const stdFontMap = (0, _standard_fonts.getStdFontMap)(); 11502 let lookupName = stdFontMap[name] || name; 11503 const Metrics = (0, _metrics.getMetrics)(); 11504 if (!(lookupName in Metrics)) { 11505 lookupName = this.isSerifFont(name) ? "Times-Roman" : "Helvetica"; 11506 } 11507 const glyphWidths = Metrics[lookupName]; 11508 if (typeof glyphWidths === "number") { 11509 defaultWidth = glyphWidths; 11510 monospace = true; 11511 } else { 11512 widths = glyphWidths(); 11513 } 11514 return { 11515 defaultWidth, 11516 monospace, 11517 widths 11518 }; 11519 } 11520 buildCharCodeToWidth(widthsByGlyphName, properties) { 11521 const widths = Object.create(null); 11522 const differences = properties.differences; 11523 const encoding = properties.defaultEncoding; 11524 for (let charCode = 0; charCode < 256; charCode++) { 11525 if (charCode in differences && widthsByGlyphName[differences[charCode]]) { 11526 widths[charCode] = widthsByGlyphName[differences[charCode]]; 11527 continue; 11528 } 11529 if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) { 11530 widths[charCode] = widthsByGlyphName[encoding[charCode]]; 11531 continue; 11532 } 11533 } 11534 return widths; 11535 } 11536 preEvaluateFont(dict) { 11537 const baseDict = dict; 11538 let type = dict.get("Subtype"); 11539 if (!(type instanceof _primitives.Name)) { 11540 throw new _util.FormatError("invalid font Subtype"); 11541 } 11542 let composite = false; 11543 let hash, toUnicode; 11544 if (type.name === "Type0") { 11545 const df = dict.get("DescendantFonts"); 11546 if (!df) { 11547 throw new _util.FormatError("Descendant fonts are not specified"); 11548 } 11549 dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df; 11550 if (!(dict instanceof _primitives.Dict)) { 11551 throw new _util.FormatError("Descendant font is not a dictionary."); 11552 } 11553 type = dict.get("Subtype"); 11554 if (!(type instanceof _primitives.Name)) { 11555 throw new _util.FormatError("invalid font Subtype"); 11556 } 11557 composite = true; 11558 } 11559 const firstChar = dict.get("FirstChar") || 0, 11560 lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff); 11561 const descriptor = dict.get("FontDescriptor"); 11562 if (descriptor) { 11563 hash = new _murmurhash.MurmurHash3_64(); 11564 const encoding = baseDict.getRaw("Encoding"); 11565 if (encoding instanceof _primitives.Name) { 11566 hash.update(encoding.name); 11567 } else if (encoding instanceof _primitives.Ref) { 11568 hash.update(encoding.toString()); 11569 } else if (encoding instanceof _primitives.Dict) { 11570 for (const entry of encoding.getRawValues()) { 11571 if (entry instanceof _primitives.Name) { 11572 hash.update(entry.name); 11573 } else if (entry instanceof _primitives.Ref) { 11574 hash.update(entry.toString()); 11575 } else if (Array.isArray(entry)) { 11576 const diffLength = entry.length, 11577 diffBuf = new Array(diffLength); 11578 for (let j = 0; j < diffLength; j++) { 11579 const diffEntry = entry[j]; 11580 if (diffEntry instanceof _primitives.Name) { 11581 diffBuf[j] = diffEntry.name; 11582 } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) { 11583 diffBuf[j] = diffEntry.toString(); 11584 } 11585 } 11586 hash.update(diffBuf.join()); 11587 } 11588 } 11589 } 11590 hash.update(`${firstChar}-${lastChar}`); 11591 toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); 11592 if (toUnicode instanceof _base_stream.BaseStream) { 11593 const stream = toUnicode.str || toUnicode; 11594 const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start); 11595 hash.update(uint8array); 11596 } else if (toUnicode instanceof _primitives.Name) { 11597 hash.update(toUnicode.name); 11598 } 11599 const widths = dict.get("Widths") || baseDict.get("Widths"); 11600 if (Array.isArray(widths)) { 11601 const widthsBuf = []; 11602 for (const entry of widths) { 11603 if (typeof entry === "number" || entry instanceof _primitives.Ref) { 11604 widthsBuf.push(entry.toString()); 11605 } 11606 } 11607 hash.update(widthsBuf.join()); 11608 } 11609 if (composite) { 11610 hash.update("compositeFont");
11611 const compositeWidths = dict.get("W") || baseDict.get("W"); 11612 if (Array.isArray(compositeWidths)) { 11613 const widthsBuf = []; 11614 for (const entry of compositeWidths) { 11615 if (typeof entry === "number" || entry instanceof _primitives.Ref) { 11616 widthsBuf.push(entry.toString()); 11617 } else if (Array.isArray(entry)) { 11618 const subWidthsBuf = []; 11619 for (const element of entry) { 11620 if (typeof element === "number" || element instanceof _primitives.Ref) { 11621 subWidthsBuf.push(element.toString()); 11622 } 11623 } 11624 widthsBuf.push(`[${subWidthsBuf.join()}]`); 11625 } 11626 } 11627 hash.update(widthsBuf.join()); 11628 } 11629 const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap"); 11630 if (cidToGidMap instanceof _primitives.Name) { 11631 hash.update(cidToGidMap.name); 11632 } else if (cidToGidMap instanceof _primitives.Ref) { 11633 hash.update(cidToGidMap.toString()); 11634 } else if (cidToGidMap instanceof _base_stream.BaseStream) { 11635 hash.update(cidToGidMap.peekBytes()); 11636 } 11637 } 11638 } 11639 return { 11640 descriptor, 11641 dict, 11642 baseDict, 11643 composite, 11644 type: type.name, 11645 firstChar, 11646 lastChar, 11647 toUnicode, 11648 hash: hash ? hash.hexdigest() : "" 11649 }; 11650 } 11651 async translateFont({ 11652 descriptor, 11653 dict, 11654 baseDict, 11655 composite, 11656 type, 11657 firstChar, 11658 lastChar, 11659 toUnicode, 11660 cssFontInfo 11661 }) { 11662 const isType3Font = type === "Type3"; 11663 let properties; 11664 if (!descriptor) { 11665 if (isType3Font) { 11666 descriptor = new _primitives.Dict(null); 11667 descriptor.set("FontName", _primitives.Name.get(type)); 11668 descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]); 11669 } else { 11670 let baseFontName = dict.get("BaseFont"); 11671 if (!(baseFontName instanceof _primitives.Name)) { 11672 throw new _util.FormatError("Base font is not specified"); 11673 } 11674 baseFontName = baseFontName.name.replaceAll(/[,_]/g, "-"); 11675 const metrics = this.getBaseFontMetrics(baseFontName); 11676 const fontNameWoStyle = baseFontName.split("-")[0]; 11677 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); 11678 properties = { 11679 type, 11680 name: baseFontName, 11681 loadedName: baseDict.loadedName, 11682 systemFontInfo: null, 11683 widths: metrics.widths, 11684 defaultWidth: metrics.defaultWidth, 11685 isSimulatedFlags: true, 11686 flags, 11687 firstChar, 11688 lastChar, 11689 toUnicode, 11690 xHeight: 0, 11691 capHeight: 0, 11692 italicAngle: 0, 11693 isType3Font 11694 }; 11695 const widths = dict.get("Widths"); 11696 const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName); 11697 let file = null; 11698 if (standardFontName) { 11699 file = await this.fetchStandardFontData(standardFontName); 11700 properties.isInternalFont = !!file; 11701 } 11702 if (!properties.isInternalFont && this.options.useSystemFonts) { 11703 properties.systemFontInfo = (0, _font_substitutions.getFontSubstitution)(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, baseFontName, standardFontName); 11704 } 11705 return this.extractDataStructures(dict, dict, properties).then(newProperties => { 11706 if (widths) { 11707 const glyphWidths = []; 11708 let j = firstChar; 11709 for (const width of widths) { 11710 glyphWidths[j++] = this.xref.fetchIfRef(width); 11711 } 11712 newProperties.widths = glyphWidths; 11713 } else { 11714 newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties); 11715 } 11716 return new _fonts.Font(baseFontName, file, newProperties); 11717 }); 11718 } 11719 } 11720 let fontName = descriptor.get("FontName"); 11721 let baseFont = dict.get("BaseFont"); 11722 if (typeof fontName === "string") { 11723 fontName = _primitives.Name.get(fontName); 11724 } 11725 if (typeof baseFont === "string") { 11726 baseFont = _primitives.Name.get(baseFont); 11727 } 11728 const fontNameStr = fontName?.name; 11729 const baseFontStr = baseFont?.name; 11730 if (!isType3Font && fontNameStr !== baseFontStr) { 11731 (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`); 11732 if (fontNameStr && baseFontStr && (baseFontStr.startsWith(fontNameStr) || !(0, _standard_fonts.isKnownFontName)(fontNameStr) && (0, _standard_fonts.isKnownFontName)(baseFontStr))) { 11733 fontName = null; 11734 } 11735 } 11736 fontName ||= baseFont; 11737 if (!(fontName instanceof _primitives.Name)) { 11738 throw new _util.FormatError("invalid font name"); 11739 } 11740 let fontFile, subtype, length1, length2, length3; 11741 try { 11742 fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3"); 11743 } catch (ex) { 11744 if (!this.options.ignoreErrors) { 11745 throw ex; 11746 } 11747 (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`); 11748 fontFile = new _stream.NullStream(); 11749 } 11750 let isInternalFont = false;
11751 let glyphScaleFactors = null; 11752 let systemFontInfo = null; 11753 if (fontFile) { 11754 if (fontFile.dict) { 11755 const subtypeEntry = fontFile.dict.get("Subtype"); 11756 if (subtypeEntry instanceof _primitives.Name) { 11757 subtype = subtypeEntry.name; 11758 } 11759 length1 = fontFile.dict.get("Length1"); 11760 length2 = fontFile.dict.get("Length2"); 11761 length3 = fontFile.dict.get("Length3"); 11762 } 11763 } else if (cssFontInfo) { 11764 const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name); 11765 if (standardFontName) { 11766 cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`; 11767 cssFontInfo.metrics = standardFontName.metrics || null; 11768 glyphScaleFactors = standardFontName.factors || null; 11769 fontFile = await this.fetchStandardFontData(standardFontName.name); 11770 isInternalFont = !!fontFile; 11771 baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name); 11772 composite = true; 11773 } 11774 } else if (!isType3Font) { 11775 const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name); 11776 if (standardFontName) { 11777 fontFile = await this.fetchStandardFontData(standardFontName); 11778 isInternalFont = !!fontFile; 11779 } 11780 if (!isInternalFont && this.options.useSystemFonts) { 11781 systemFontInfo = (0, _font_substitutions.getFontSubstitution)(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, fontName.name, standardFontName); 11782 } 11783 } 11784 properties = { 11785 type, 11786 name: fontName.name, 11787 subtype, 11788 file: fontFile, 11789 length1, 11790 length2, 11791 length3, 11792 isInternalFont, 11793 loadedName: baseDict.loadedName, 11794 composite, 11795 fixedPitch: false, 11796 fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX, 11797 firstChar, 11798 lastChar, 11799 toUnicode, 11800 bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"), 11801 ascent: descriptor.get("Ascent"), 11802 descent: descriptor.get("Descent"), 11803 xHeight: descriptor.get("XHeight") || 0, 11804 capHeight: descriptor.get("CapHeight") || 0, 11805 flags: descriptor.get("Flags"), 11806 italicAngle: descriptor.get("ItalicAngle") || 0, 11807 isType3Font, 11808 cssFontInfo, 11809 scaleFactors: glyphScaleFactors, 11810 systemFontInfo 11811 }; 11812 if (composite) { 11813 const cidEncoding = baseDict.get("Encoding"); 11814 if (cidEncoding instanceof _primitives.Name) { 11815 properties.cidEncoding = cidEncoding.name; 11816 } 11817 const cMap = await _cmap.CMapFactory.create({ 11818 encoding: cidEncoding, 11819 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 11820 useCMap: null 11821 }); 11822 properties.cMap = cMap; 11823 properties.vertical = properties.cMap.vertical; 11824 } 11825 return this.extractDataStructures(dict, baseDict, properties).then(newProperties => { 11826 this.extractWidths(dict, descriptor, newProperties); 11827 return new _fonts.Font(fontName.name, fontFile, newProperties); 11828 }); 11829 } 11830 static buildFontPaths(font, glyphs, handler, evaluatorOptions) { 11831 function buildPath(fontChar) { 11832 const glyphName = `${font.loadedName}_path_${fontChar}`; 11833 try { 11834 if (font.renderer.hasBuiltPath(fontChar)) { 11835 return; 11836 } 11837 handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]); 11838 } catch (reason) { 11839 if (evaluatorOptions.ignoreErrors) { 11840 (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`); 11841 return; 11842 } 11843 throw reason; 11844 } 11845 } 11846 for (const glyph of glyphs) { 11847 buildPath(glyph.fontChar); 11848 const accent = glyph.accent; 11849 if (accent?.fontChar) { 11850 buildPath(accent.fontChar); 11851 } 11852 } 11853 } 11854 static get fallbackFontDict() { 11855 const dict = new _primitives.Dict(); 11856 dict.set("BaseFont", _primitives.Name.get("Helvetica")); 11857 dict.set("Type", _primitives.Name.get("FallbackType")); 11858 dict.set("Subtype", _primitives.Name.get("FallbackType")); 11859 dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); 11860 return (0, _util.shadow)(this, "fallbackFontDict", dict); 11861 } 11862}
11863exports.PartialEvaluator = PartialEvaluator; 11864class TranslatedFont { 11865 constructor({ 11866 loadedName, 11867 font, 11868 dict, 11869 evaluatorOptions 11870 }) { 11871 this.loadedName = loadedName; 11872 this.font = font; 11873 this.dict = dict; 11874 this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions; 11875 this.type3Loaded = null; 11876 this.type3Dependencies = font.isType3Font ? new Set() : null; 11877 this.sent = false; 11878 } 11879 send(handler) { 11880 if (this.sent) { 11881 return; 11882 } 11883 this.sent = true; 11884 handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]); 11885 } 11886 fallback(handler) { 11887 if (!this.font.data) { 11888 return; 11889 } 11890 this.font.disableFontFace = true; 11891 PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions); 11892 } 11893 loadType3Data(evaluator, resources, task) { 11894 if (this.type3Loaded) { 11895 return this.type3Loaded; 11896 } 11897 if (!this.font.isType3Font) { 11898 throw new Error("Must be a Type3 font."); 11899 } 11900 const type3Evaluator = evaluator.clone({ 11901 ignoreErrors: false 11902 }); 11903 type3Evaluator.parsingType3Font = true; 11904 const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs); 11905 if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) { 11906 type3FontRefs.put(this.dict.objId); 11907 } 11908 type3Evaluator.type3FontRefs = type3FontRefs; 11909 const translatedFont = this.font, 11910 type3Dependencies = this.type3Dependencies; 11911 let loadCharProcsPromise = Promise.resolve(); 11912 const charProcs = this.dict.get("CharProcs"); 11913 const fontResources = this.dict.get("Resources") || resources; 11914 const charProcOperatorList = Object.create(null); 11915 const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]), 11916 width = fontBBox[2] - fontBBox[0], 11917 height = fontBBox[3] - fontBBox[1]; 11918 const fontBBoxSize = Math.hypot(width, height); 11919 for (const key of charProcs.getKeys()) { 11920 loadCharProcsPromise = loadCharProcsPromise.then(() => { 11921 const glyphStream = charProcs.get(key); 11922 const operatorList = new _operator_list.OperatorList(); 11923 return type3Evaluator.getOperatorList({ 11924 stream: glyphStream, 11925 task, 11926 resources: fontResources, 11927 operatorList 11928 }).then(() => { 11929 if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) { 11930 this._removeType3ColorOperators(operatorList, fontBBoxSize); 11931 } 11932 charProcOperatorList[key] = operatorList.getIR(); 11933 for (const dependency of operatorList.dependencies) { 11934 type3Dependencies.add(dependency); 11935 } 11936 }).catch(function (reason) { 11937 (0, _util.warn)(`Type3 font resource "${key}" is not available.`); 11938 const dummyOperatorList = new _operator_list.OperatorList(); 11939 charProcOperatorList[key] = dummyOperatorList.getIR(); 11940 }); 11941 }); 11942 } 11943 this.type3Loaded = loadCharProcsPromise.then(() => { 11944 translatedFont.charProcOperatorList = charProcOperatorList; 11945 if (this._bbox) { 11946 translatedFont.isCharBBox = true; 11947 translatedFont.bbox = this._bbox; 11948 } 11949 }); 11950 return this.type3Loaded; 11951 } 11952 _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) { 11953 const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)), 11954 width = charBBox[2] - charBBox[0], 11955 height = charBBox[3] - charBBox[1]; 11956 const charBBoxSize = Math.hypot(width, height); 11957 if (width === 0 || height === 0) { 11958 operatorList.fnArray.splice(0, 1); 11959 operatorList.argsArray.splice(0, 1); 11960 } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) { 11961 if (!this._bbox) { 11962 this._bbox = [Infinity, Infinity, -Infinity, -Infinity]; 11963 } 11964 this._bbox[0] = Math.min(this._bbox[0], charBBox[0]); 11965 this._bbox[1] = Math.min(this._bbox[1], charBBox[1]); 11966 this._bbox[2] = Math.max(this._bbox[2], charBBox[2]); 11967 this._bbox[3] = Math.max(this._bbox[3], charBBox[3]); 11968 } 11969 let i = 0, 11970 ii = operatorList.length; 11971 while (i < ii) { 11972 switch (operatorList.fnArray[i]) { 11973 case _util.OPS.setCharWidthAndBounds: 11974 break; 11975 case _util.OPS.setStrokeColorSpace: 11976 case _util.OPS.setFillColorSpace: 11977 case _util.OPS.setStrokeColor: 11978 case _util.OPS.setStrokeColorN: 11979 case _util.OPS.setFillColor: 11980 case _util.OPS.setFillColorN: 11981 case _util.OPS.setStrokeGray: 11982 case _util.OPS.setFillGray: 11983 case _util.OPS.setStrokeRGBColor: 11984 case _util.OPS.setFillRGBColor: 11985 case _util.OPS.setStrokeCMYKColor: 11986 case _util.OPS.setFillCMYKColor: 11987 case _util.OPS.shadingFill: 11988 case _util.OPS.setRenderingIntent: 11989 operatorList.fnArray.splice(i, 1); 11990 operatorList.argsArray.splice(i, 1); 11991 ii--; 11992 continue; 11993 case _util.OPS.setGState: 11994 const [gStateObj] = operatorList.argsArray[i]; 11995 let j = 0, 11996 jj = gStateObj.length; 11997 while (j < jj) { 11998 const [gStateKey] = gStateObj[j]; 11999 switch (gStateKey) { 12000 case "TR": 12001 case "TR2": 12002 case "HT": 12003 case "BG": 12004 case "BG2": 12005 case "UCR": 12006 case "UCR2": 12007 gStateObj.splice(j, 1); 12008 jj--; 12009 continue; 12010 } 12011 j++; 12012 } 12013 break; 12014 } 12015 i++; 12016 } 12017 } 12018} 12019class StateManager { 12020 constructor(initialState = new EvalState()) { 12021 this.state = initialState; 12022 this.stateStack = []; 12023 } 12024 save() { 12025 const old = this.state; 12026 this.stateStack.push(this.state); 12027 this.state = old.clone(); 12028 }
vendor: 9,918 bytes, lines 12029-12486
12029 restore() { 12030 const prev = this.stateStack.pop(); 12031 if (prev) { 12032 this.state = prev; 12033 } 12034 } 12035 transform(args) { 12036 this.state.ctm = _util.Util.transform(this.state.ctm, args); 12037 } 12038} 12039class TextState { 12040 constructor() { 12041 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 12042 this.fontName = null; 12043 this.fontSize = 0; 12044 this.loadedName = null; 12045 this.font = null; 12046 this.fontMatrix = _util.FONT_IDENTITY_MATRIX; 12047 this.textMatrix = _util.IDENTITY_MATRIX.slice(); 12048 this.textLineMatrix = _util.IDENTITY_MATRIX.slice(); 12049 this.charSpacing = 0; 12050 this.wordSpacing = 0; 12051 this.leading = 0; 12052 this.textHScale = 1; 12053 this.textRise = 0; 12054 } 12055 setTextMatrix(a, b, c, d, e, f) { 12056 const m = this.textMatrix; 12057 m[0] = a; 12058 m[1] = b; 12059 m[2] = c; 12060 m[3] = d; 12061 m[4] = e; 12062 m[5] = f; 12063 } 12064 setTextLineMatrix(a, b, c, d, e, f) { 12065 const m = this.textLineMatrix; 12066 m[0] = a; 12067 m[1] = b; 12068 m[2] = c; 12069 m[3] = d; 12070 m[4] = e; 12071 m[5] = f; 12072 } 12073 translateTextMatrix(x, y) { 12074 const m = this.textMatrix; 12075 m[4] = m[0] * x + m[2] * y + m[4]; 12076 m[5] = m[1] * x + m[3] * y + m[5]; 12077 } 12078 translateTextLineMatrix(x, y) { 12079 const m = this.textLineMatrix; 12080 m[4] = m[0] * x + m[2] * y + m[4]; 12081 m[5] = m[1] * x + m[3] * y + m[5]; 12082 } 12083 carriageReturn() { 12084 this.translateTextLineMatrix(0, -this.leading); 12085 this.textMatrix = this.textLineMatrix.slice(); 12086 } 12087 clone() { 12088 const clone = Object.create(this); 12089 clone.textMatrix = this.textMatrix.slice(); 12090 clone.textLineMatrix = this.textLineMatrix.slice(); 12091 clone.fontMatrix = this.fontMatrix.slice(); 12092 return clone; 12093 } 12094} 12095class EvalState { 12096 constructor() { 12097 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 12098 this.font = null; 12099 this.textRenderingMode = _util.TextRenderingMode.FILL; 12100 this.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 12101 this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 12102 } 12103 clone() { 12104 return Object.create(this); 12105 } 12106} 12107class EvaluatorPreprocessor { 12108 static get opMap() { 12109 return (0, _util.shadow)(this, "opMap", { 12110 w: { 12111 id: _util.OPS.setLineWidth, 12112 numArgs: 1, 12113 variableArgs: false 12114 }, 12115 J: { 12116 id: _util.OPS.setLineCap, 12117 numArgs: 1, 12118 variableArgs: false 12119 }, 12120 j: { 12121 id: _util.OPS.setLineJoin, 12122 numArgs: 1, 12123 variableArgs: false 12124 }, 12125 M: { 12126 id: _util.OPS.setMiterLimit, 12127 numArgs: 1, 12128 variableArgs: false 12129 }, 12130 d: { 12131 id: _util.OPS.setDash, 12132 numArgs: 2, 12133 variableArgs: false 12134 }, 12135 ri: { 12136 id: _util.OPS.setRenderingIntent, 12137 numArgs: 1, 12138 variableArgs: false 12139 }, 12140 i: { 12141 id: _util.OPS.setFlatness, 12142 numArgs: 1, 12143 variableArgs: false 12144 }, 12145 gs: { 12146 id: _util.OPS.setGState, 12147 numArgs: 1, 12148 variableArgs: false 12149 }, 12150 q: { 12151 id: _util.OPS.save, 12152 numArgs: 0, 12153 variableArgs: false 12154 }, 12155 Q: { 12156 id: _util.OPS.restore, 12157 numArgs: 0, 12158 variableArgs: false 12159 }, 12160 cm: { 12161 id: _util.OPS.transform, 12162 numArgs: 6, 12163 variableArgs: false 12164 }, 12165 m: { 12166 id: _util.OPS.moveTo, 12167 numArgs: 2, 12168 variableArgs: false 12169 }, 12170 l: { 12171 id: _util.OPS.lineTo, 12172 numArgs: 2, 12173 variableArgs: false 12174 }, 12175 c: { 12176 id: _util.OPS.curveTo, 12177 numArgs: 6, 12178 variableArgs: false 12179 }, 12180 v: { 12181 id: _util.OPS.curveTo2, 12182 numArgs: 4, 12183 variableArgs: false 12184 }, 12185 y: { 12186 id: _util.OPS.curveTo3, 12187 numArgs: 4, 12188 variableArgs: false 12189 }, 12190 h: { 12191 id: _util.OPS.closePath, 12192 numArgs: 0, 12193 variableArgs: false 12194 }, 12195 re: { 12196 id: _util.OPS.rectangle, 12197 numArgs: 4, 12198 variableArgs: false 12199 }, 12200 S: { 12201 id: _util.OPS.stroke, 12202 numArgs: 0, 12203 variableArgs: false 12204 }, 12205 s: { 12206 id: _util.OPS.closeStroke, 12207 numArgs: 0, 12208 variableArgs: false 12209 }, 12210 f: { 12211 id: _util.OPS.fill, 12212 numArgs: 0, 12213 variableArgs: false 12214 }, 12215 F: { 12216 id: _util.OPS.fill, 12217 numArgs: 0, 12218 variableArgs: false 12219 }, 12220 "f*": { 12221 id: _util.OPS.eoFill, 12222 numArgs: 0, 12223 variableArgs: false 12224 }, 12225 B: { 12226 id: _util.OPS.fillStroke, 12227 numArgs: 0, 12228 variableArgs: false 12229 }, 12230 "B*": { 12231 id: _util.OPS.eoFillStroke, 12232 numArgs: 0, 12233 variableArgs: false 12234 }, 12235 b: { 12236 id: _util.OPS.closeFillStroke, 12237 numArgs: 0, 12238 variableArgs: false 12239 }, 12240 "b*": { 12241 id: _util.OPS.closeEOFillStroke, 12242 numArgs: 0, 12243 variableArgs: false 12244 }, 12245 n: { 12246 id: _util.OPS.endPath, 12247 numArgs: 0, 12248 variableArgs: false 12249 }, 12250 W: { 12251 id: _util.OPS.clip, 12252 numArgs: 0, 12253 variableArgs: false 12254 }, 12255 "W*": { 12256 id: _util.OPS.eoClip, 12257 numArgs: 0, 12258 variableArgs: false 12259 }, 12260 BT: { 12261 id: _util.OPS.beginText, 12262 numArgs: 0, 12263 variableArgs: false 12264 }, 12265 ET: { 12266 id: _util.OPS.endText, 12267 numArgs: 0, 12268 variableArgs: false 12269 }, 12270 Tc: { 12271 id: _util.OPS.setCharSpacing, 12272 numArgs: 1, 12273 variableArgs: false 12274 }, 12275 Tw: { 12276 id: _util.OPS.setWordSpacing, 12277 numArgs: 1, 12278 variableArgs: false 12279 }, 12280 Tz: { 12281 id: _util.OPS.setHScale, 12282 numArgs: 1, 12283 variableArgs: false 12284 }, 12285 TL: { 12286 id: _util.OPS.setLeading, 12287 numArgs: 1, 12288 variableArgs: false 12289 }, 12290 Tf: { 12291 id: _util.OPS.setFont, 12292 numArgs: 2, 12293 variableArgs: false 12294 }, 12295 Tr: { 12296 id: _util.OPS.setTextRenderingMode, 12297 numArgs: 1, 12298 variableArgs: false 12299 }, 12300 Ts: { 12301 id: _util.OPS.setTextRise, 12302 numArgs: 1, 12303 variableArgs: false 12304 }, 12305 Td: { 12306 id: _util.OPS.moveText, 12307 numArgs: 2, 12308 variableArgs: false 12309 }, 12310 TD: { 12311 id: _util.OPS.setLeadingMoveText, 12312 numArgs: 2, 12313 variableArgs: false 12314 }, 12315 Tm: { 12316 id: _util.OPS.setTextMatrix, 12317 numArgs: 6, 12318 variableArgs: false 12319 }, 12320 "T*": { 12321 id: _util.OPS.nextLine, 12322 numArgs: 0, 12323 variableArgs: false 12324 }, 12325 Tj: { 12326 id: _util.OPS.showText, 12327 numArgs: 1, 12328 variableArgs: false 12329 }, 12330 TJ: { 12331 id: _util.OPS.showSpacedText, 12332 numArgs: 1, 12333 variableArgs: false 12334 }, 12335 "'": { 12336 id: _util.OPS.nextLineShowText, 12337 numArgs: 1, 12338 variableArgs: false 12339 }, 12340 '"': { 12341 id: _util.OPS.nextLineSetSpacingShowText, 12342 numArgs: 3, 12343 variableArgs: false 12344 }, 12345 d0: { 12346 id: _util.OPS.setCharWidth, 12347 numArgs: 2, 12348 variableArgs: false 12349 }, 12350 d1: { 12351 id: _util.OPS.setCharWidthAndBounds, 12352 numArgs: 6, 12353 variableArgs: false 12354 }, 12355 CS: { 12356 id: _util.OPS.setStrokeColorSpace, 12357 numArgs: 1, 12358 variableArgs: false 12359 }, 12360 cs: { 12361 id: _util.OPS.setFillColorSpace, 12362 numArgs: 1, 12363 variableArgs: false 12364 }, 12365 SC: { 12366 id: _util.OPS.setStrokeColor, 12367 numArgs: 4, 12368 variableArgs: true 12369 }, 12370 SCN: { 12371 id: _util.OPS.setStrokeColorN, 12372 numArgs: 33, 12373 variableArgs: true 12374 }, 12375 sc: { 12376 id: _util.OPS.setFillColor, 12377 numArgs: 4, 12378 variableArgs: true 12379 }, 12380 scn: { 12381 id: _util.OPS.setFillColorN, 12382 numArgs: 33, 12383 variableArgs: true 12384 }, 12385 G: { 12386 id: _util.OPS.setStrokeGray, 12387 numArgs: 1, 12388 variableArgs: false 12389 }, 12390 g: { 12391 id: _util.OPS.setFillGray, 12392 numArgs: 1, 12393 variableArgs: false 12394 }, 12395 RG: { 12396 id: _util.OPS.setStrokeRGBColor, 12397 numArgs: 3, 12398 variableArgs: false 12399 }, 12400 rg: { 12401 id: _util.OPS.setFillRGBColor, 12402 numArgs: 3, 12403 variableArgs: false 12404 }, 12405 K: { 12406 id: _util.OPS.setStrokeCMYKColor, 12407 numArgs: 4, 12408 variableArgs: false 12409 }, 12410 k: { 12411 id: _util.OPS.setFillCMYKColor, 12412 numArgs: 4, 12413 variableArgs: false 12414 }, 12415 sh: { 12416 id: _util.OPS.shadingFill, 12417 numArgs: 1, 12418 variableArgs: false 12419 }, 12420 BI: { 12421 id: _util.OPS.beginInlineImage, 12422 numArgs: 0, 12423 variableArgs: false 12424 }, 12425 ID: { 12426 id: _util.OPS.beginImageData, 12427 numArgs: 0, 12428 variableArgs: false 12429 }, 12430 EI: { 12431 id: _util.OPS.endInlineImage, 12432 numArgs: 1, 12433 variableArgs: false 12434 }, 12435 Do: { 12436 id: _util.OPS.paintXObject, 12437 numArgs: 1, 12438 variableArgs: false 12439 }, 12440 MP: { 12441 id: _util.OPS.markPoint, 12442 numArgs: 1, 12443 variableArgs: false 12444 }, 12445 DP: { 12446 id: _util.OPS.markPointProps, 12447 numArgs: 2, 12448 variableArgs: false 12449 }, 12450 BMC: { 12451 id: _util.OPS.beginMarkedContent, 12452 numArgs: 1, 12453 variableArgs: false 12454 }, 12455 BDC: { 12456 id: _util.OPS.beginMarkedContentProps, 12457 numArgs: 2, 12458 variableArgs: false 12459 }, 12460 EMC: { 12461 id: _util.OPS.endMarkedContent, 12462 numArgs: 0, 12463 variableArgs: false 12464 }, 12465 BX: { 12466 id: _util.OPS.beginCompat, 12467 numArgs: 0, 12468 variableArgs: false 12469 }, 12470 EX: { 12471 id: _util.OPS.endCompat, 12472 numArgs: 0, 12473 variableArgs: false 12474 }, 12475 BM: null, 12476 BD: null, 12477 true: null, 12478 fa: null, 12479 fal: null, 12480 fals: null, 12481 false: null, 12482 nu: null, 12483 nul: null, 12484 null: null 12485 }); 12486 }
12487 static MAX_INVALID_PATH_OPS = 10; 12488 constructor(stream, xref, stateManager = new StateManager()) { 12489 this.parser = new _parser.Parser({ 12490 lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap), 12491 xref 12492 }); 12493 this.stateManager = stateManager; 12494 this.nonProcessedArgs = []; 12495 this._isPathOp = false; 12496 this._numInvalidPathOPS = 0; 12497 } 12498 get savedStatesDepth() { 12499 return this.stateManager.stateStack.length; 12500 } 12501 read(operation) { 12502 let args = operation.args; 12503 while (true) { 12504 const obj = this.parser.getObj(); 12505 if (obj instanceof _primitives.Cmd) { 12506 const cmd = obj.cmd; 12507 const opSpec = EvaluatorPreprocessor.opMap[cmd]; 12508 if (!opSpec) { 12509 (0, _util.warn)(`Unknown command "${cmd}".`); 12510 continue; 12511 } 12512 const fn = opSpec.id; 12513 const numArgs = opSpec.numArgs; 12514 let argsLength = args !== null ? args.length : 0; 12515 if (!this._isPathOp) { 12516 this._numInvalidPathOPS = 0; 12517 } 12518 this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath; 12519 if (!opSpec.variableArgs) { 12520 if (argsLength !== numArgs) { 12521 const nonProcessedArgs = this.nonProcessedArgs; 12522 while (argsLength > numArgs) { 12523 nonProcessedArgs.push(args.shift()); 12524 argsLength--; 12525 } 12526 while (argsLength < numArgs && nonProcessedArgs.length !== 0) { 12527 if (args === null) { 12528 args = []; 12529 } 12530 args.unshift(nonProcessedArgs.pop()); 12531 argsLength++; 12532 } 12533 } 12534 if (argsLength < numArgs) { 12535 const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`; 12536 if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) { 12537 throw new _util.FormatError(`Invalid ${partialMsg}`); 12538 } 12539 (0, _util.warn)(`Skipping ${partialMsg}`); 12540 if (args !== null) { 12541 args.length = 0; 12542 } 12543 continue; 12544 } 12545 } else if (argsLength > numArgs) { 12546 (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`); 12547 } 12548 this.preprocessCommand(fn, args); 12549 operation.fn = fn; 12550 operation.args = args; 12551 return true; 12552 } 12553 if (obj === _primitives.EOF) { 12554 return false; 12555 } 12556 if (obj !== null) { 12557 if (args === null) { 12558 args = []; 12559 } 12560 args.push(obj); 12561 if (args.length > 33) { 12562 throw new _util.FormatError("Too many arguments"); 12563 } 12564 } 12565 } 12566 } 12567 preprocessCommand(fn, args) { 12568 switch (fn | 0) { 12569 case _util.OPS.save: 12570 this.stateManager.save(); 12571 break; 12572 case _util.OPS.restore: 12573 this.stateManager.restore(); 12574 break; 12575 case _util.OPS.transform: 12576 this.stateManager.transform(args); 12577 break; 12578 } 12579 } 12580} 12581exports.EvaluatorPreprocessor = EvaluatorPreprocessor; 12582 12583/***/ }), 12584/* 14 */ 12585/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 12586 12587 12588 12589Object.defineProperty(exports, "__esModule", ({ 12590 value: true 12591})); 12592exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0; 12593var _util = __w_pdfjs_require__(2); 12594var _primitives = __w_pdfjs_require__(4); 12595var _base_stream = __w_pdfjs_require__(5); 12596var _binary_cmap = __w_pdfjs_require__(15); 12597var _parser = __w_pdfjs_require__(16); 12598var _core_utils = __w_pdfjs_require__(3); 12599var _stream = __w_pdfjs_require__(8);
vendor: 6,255 bytes, lines 12599-12739
12599 12600const 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"]; 12601const MAX_MAP_RANGE = 2 ** 24 - 1; 12602class CMap { 12603 constructor(builtInCMap = false) { 12604 this.codespaceRanges = [[], [], [], []]; 12605 this.numCodespaceRanges = 0; 12606 this._map = []; 12607 this.name = ""; 12608 this.vertical = false; 12609 this.useCMap = null; 12610 this.builtInCMap = builtInCMap; 12611 } 12612 addCodespaceRange(n, low, high) { 12613 this.codespaceRanges[n - 1].push(low, high); 12614 this.numCodespaceRanges++; 12615 } 12616 mapCidRange(low, high, dstLow) { 12617 if (high - low > MAX_MAP_RANGE) { 12618 throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE."); 12619 } 12620 while (low <= high) { 12621 this._map[low++] = dstLow++; 12622 } 12623 } 12624 mapBfRange(low, high, dstLow) { 12625 if (high - low > MAX_MAP_RANGE) { 12626 throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE."); 12627 } 12628 const lastByte = dstLow.length - 1; 12629 while (low <= high) { 12630 this._map[low++] = dstLow; 12631 const nextCharCode = dstLow.charCodeAt(lastByte) + 1; 12632 if (nextCharCode > 0xff) { 12633 dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00"; 12634 continue; 12635 } 12636 dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode); 12637 } 12638 } 12639 mapBfRangeToArray(low, high, array) { 12640 if (high - low > MAX_MAP_RANGE) { 12641 throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE."); 12642 } 12643 const ii = array.length; 12644 let i = 0; 12645 while (low <= high && i < ii) { 12646 this._map[low] = array[i++]; 12647 ++low; 12648 } 12649 } 12650 mapOne(src, dst) { 12651 this._map[src] = dst; 12652 } 12653 lookup(code) { 12654 return this._map[code]; 12655 } 12656 contains(code) { 12657 return this._map[code] !== undefined; 12658 } 12659 forEach(callback) { 12660 const map = this._map; 12661 const length = map.length; 12662 if (length <= 0x10000) { 12663 for (let i = 0; i < length; i++) { 12664 if (map[i] !== undefined) { 12665 callback(i, map[i]); 12666 } 12667 } 12668 } else { 12669 for (const i in map) { 12670 callback(i, map[i]); 12671 } 12672 } 12673 } 12674 charCodeOf(value) { 12675 const map = this._map; 12676 if (map.length <= 0x10000) { 12677 return map.indexOf(value); 12678 } 12679 for (const charCode in map) { 12680 if (map[charCode] === value) { 12681 return charCode | 0; 12682 } 12683 } 12684 return -1; 12685 } 12686 getMap() { 12687 return this._map; 12688 } 12689 readCharCode(str, offset, out) { 12690 let c = 0; 12691 const codespaceRanges = this.codespaceRanges; 12692 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 12693 c = (c << 8 | str.charCodeAt(offset + n)) >>> 0; 12694 const codespaceRange = codespaceRanges[n]; 12695 for (let k = 0, kk = codespaceRange.length; k < kk;) { 12696 const low = codespaceRange[k++]; 12697 const high = codespaceRange[k++]; 12698 if (c >= low && c <= high) { 12699 out.charcode = c; 12700 out.length = n + 1; 12701 return; 12702 } 12703 } 12704 } 12705 out.charcode = 0; 12706 out.length = 1; 12707 } 12708 getCharCodeLength(charCode) { 12709 const codespaceRanges = this.codespaceRanges; 12710 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 12711 const codespaceRange = codespaceRanges[n]; 12712 for (let k = 0, kk = codespaceRange.length; k < kk;) { 12713 const low = codespaceRange[k++]; 12714 const high = codespaceRange[k++]; 12715 if (charCode >= low && charCode <= high) { 12716 return n + 1; 12717 } 12718 } 12719 } 12720 return 1; 12721 } 12722 get length() { 12723 return this._map.length; 12724 } 12725 get isIdentityCMap() { 12726 if (!(this.name === "Identity-H" || this.name === "Identity-V")) { 12727 return false; 12728 } 12729 if (this._map.length !== 0x10000) { 12730 return false; 12731 } 12732 for (let i = 0; i < 0x10000; i++) { 12733 if (this._map[i] !== i) { 12734 return false; 12735 } 12736 } 12737 return true; 12738 } 12739}
12740exports.CMap = CMap; 12741class IdentityCMap extends CMap { 12742 constructor(vertical, n) { 12743 super(); 12744 this.vertical = vertical; 12745 this.addCodespaceRange(n, 0, 0xffff); 12746 } 12747 mapCidRange(low, high, dstLow) { 12748 (0, _util.unreachable)("should not call mapCidRange"); 12749 } 12750 mapBfRange(low, high, dstLow) { 12751 (0, _util.unreachable)("should not call mapBfRange"); 12752 } 12753 mapBfRangeToArray(low, high, array) { 12754 (0, _util.unreachable)("should not call mapBfRangeToArray"); 12755 } 12756 mapOne(src, dst) { 12757 (0, _util.unreachable)("should not call mapCidOne"); 12758 } 12759 lookup(code) { 12760 return Number.isInteger(code) && code <= 0xffff ? code : undefined; 12761 } 12762 contains(code) { 12763 return Number.isInteger(code) && code <= 0xffff; 12764 } 12765 forEach(callback) { 12766 for (let i = 0; i <= 0xffff; i++) { 12767 callback(i, i); 12768 } 12769 } 12770 charCodeOf(value) { 12771 return Number.isInteger(value) && value <= 0xffff ? value : -1; 12772 } 12773 getMap() { 12774 const map = new Array(0x10000); 12775 for (let i = 0; i <= 0xffff; i++) { 12776 map[i] = i; 12777 } 12778 return map; 12779 } 12780 get length() { 12781 return 0x10000; 12782 } 12783 get isIdentityCMap() { 12784 (0, _util.unreachable)("should not access .isIdentityCMap"); 12785 } 12786} 12787exports.IdentityCMap = IdentityCMap; 12788function strToInt(str) { 12789 let a = 0; 12790 for (let i = 0; i < str.length; i++) { 12791 a = a << 8 | str.charCodeAt(i); 12792 } 12793 return a >>> 0; 12794} 12795function expectString(obj) { 12796 if (typeof obj !== "string") { 12797 throw new _util.FormatError("Malformed CMap: expected string."); 12798 } 12799} 12800function expectInt(obj) { 12801 if (!Number.isInteger(obj)) { 12802 throw new _util.FormatError("Malformed CMap: expected int."); 12803 } 12804} 12805function parseBfChar(cMap, lexer) { 12806 while (true) { 12807 let obj = lexer.getObj(); 12808 if (obj === _primitives.EOF) { 12809 break; 12810 } 12811 if ((0, _primitives.isCmd)(obj, "endbfchar")) { 12812 return; 12813 } 12814 expectString(obj); 12815 const src = strToInt(obj); 12816 obj = lexer.getObj(); 12817 expectString(obj); 12818 const dst = obj; 12819 cMap.mapOne(src, dst); 12820 } 12821} 12822function parseBfRange(cMap, lexer) { 12823 while (true) { 12824 let obj = lexer.getObj(); 12825 if (obj === _primitives.EOF) { 12826 break; 12827 } 12828 if ((0, _primitives.isCmd)(obj, "endbfrange")) { 12829 return; 12830 } 12831 expectString(obj); 12832 const low = strToInt(obj); 12833 obj = lexer.getObj(); 12834 expectString(obj); 12835 const high = strToInt(obj); 12836 obj = lexer.getObj(); 12837 if (Number.isInteger(obj) || typeof obj === "string") { 12838 const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj; 12839 cMap.mapBfRange(low, high, dstLow); 12840 } else if ((0, _primitives.isCmd)(obj, "[")) { 12841 obj = lexer.getObj(); 12842 const array = []; 12843 while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) { 12844 array.push(obj); 12845 obj = lexer.getObj(); 12846 } 12847 cMap.mapBfRangeToArray(low, high, array); 12848 } else { 12849 break; 12850 } 12851 } 12852 throw new _util.FormatError("Invalid bf range."); 12853} 12854function parseCidChar(cMap, lexer) { 12855 while (true) { 12856 let obj = lexer.getObj(); 12857 if (obj === _primitives.EOF) { 12858 break; 12859 } 12860 if ((0, _primitives.isCmd)(obj, "endcidchar")) { 12861 return; 12862 } 12863 expectString(obj); 12864 const src = strToInt(obj); 12865 obj = lexer.getObj(); 12866 expectInt(obj); 12867 const dst = obj; 12868 cMap.mapOne(src, dst); 12869 } 12870} 12871function parseCidRange(cMap, lexer) { 12872 while (true) { 12873 let obj = lexer.getObj(); 12874 if (obj === _primitives.EOF) { 12875 break; 12876 } 12877 if ((0, _primitives.isCmd)(obj, "endcidrange")) { 12878 return; 12879 } 12880 expectString(obj); 12881 const low = strToInt(obj); 12882 obj = lexer.getObj(); 12883 expectString(obj); 12884 const high = strToInt(obj); 12885 obj = lexer.getObj(); 12886 expectInt(obj); 12887 const dstLow = obj; 12888 cMap.mapCidRange(low, high, dstLow); 12889 } 12890} 12891function parseCodespaceRange(cMap, lexer) { 12892 while (true) { 12893 let obj = lexer.getObj(); 12894 if (obj === _primitives.EOF) { 12895 break; 12896 } 12897 if ((0, _primitives.isCmd)(obj, "endcodespacerange")) { 12898 return; 12899 } 12900 if (typeof obj !== "string") { 12901 break; 12902 } 12903 const low = strToInt(obj); 12904 obj = lexer.getObj(); 12905 if (typeof obj !== "string") { 12906 break; 12907 } 12908 const high = strToInt(obj); 12909 cMap.addCodespaceRange(obj.length, low, high); 12910 } 12911 throw new _util.FormatError("Invalid codespace range."); 12912} 12913function parseWMode(cMap, lexer) { 12914 const obj = lexer.getObj(); 12915 if (Number.isInteger(obj)) { 12916 cMap.vertical = !!obj; 12917 } 12918} 12919function parseCMapName(cMap, lexer) { 12920 const obj = lexer.getObj(); 12921 if (obj instanceof _primitives.Name) { 12922 cMap.name = obj.name; 12923 } 12924} 12925async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) { 12926 let previous, embeddedUseCMap; 12927 objLoop: while (true) { 12928 try { 12929 const obj = lexer.getObj(); 12930 if (obj === _primitives.EOF) { 12931 break; 12932 } else if (obj instanceof _primitives.Name) { 12933 if (obj.name === "WMode") { 12934 parseWMode(cMap, lexer); 12935 } else if (obj.name === "CMapName") {
vendor: 12,473 bytes, lines 12936-13341
12936 parseCMapName(cMap, lexer); 12937 } 12938 previous = obj; 12939 } else if (obj instanceof _primitives.Cmd) { 12940 switch (obj.cmd) { 12941 case "endcmap": 12942 break objLoop; 12943 case "usecmap": 12944 if (previous instanceof _primitives.Name) { 12945 embeddedUseCMap = previous.name; 12946 } 12947 break; 12948 case "begincodespacerange": 12949 parseCodespaceRange(cMap, lexer); 12950 break; 12951 case "beginbfchar": 12952 parseBfChar(cMap, lexer); 12953 break; 12954 case "begincidchar": 12955 parseCidChar(cMap, lexer); 12956 break; 12957 case "beginbfrange": 12958 parseBfRange(cMap, lexer); 12959 break; 12960 case "begincidrange": 12961 parseCidRange(cMap, lexer); 12962 break; 12963 } 12964 } 12965 } catch (ex) { 12966 if (ex instanceof _core_utils.MissingDataException) { 12967 throw ex; 12968 } 12969 (0, _util.warn)("Invalid cMap data: " + ex); 12970 continue; 12971 } 12972 } 12973 if (!useCMap && embeddedUseCMap) { 12974 useCMap = embeddedUseCMap; 12975 } 12976 if (useCMap) { 12977 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 12978 } 12979 return cMap; 12980} 12981async function extendCMap(cMap, fetchBuiltInCMap, useCMap) { 12982 cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap); 12983 if (cMap.numCodespaceRanges === 0) { 12984 const useCodespaceRanges = cMap.useCMap.codespaceRanges; 12985 for (let i = 0; i < useCodespaceRanges.length; i++) { 12986 cMap.codespaceRanges[i] = useCodespaceRanges[i].slice(); 12987 } 12988 cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges; 12989 } 12990 cMap.useCMap.forEach(function (key, value) { 12991 if (!cMap.contains(key)) { 12992 cMap.mapOne(key, cMap.useCMap.lookup(key)); 12993 } 12994 }); 12995 return cMap; 12996} 12997async function createBuiltInCMap(name, fetchBuiltInCMap) { 12998 if (name === "Identity-H") { 12999 return new IdentityCMap(false, 2); 13000 } else if (name === "Identity-V") { 13001 return new IdentityCMap(true, 2); 13002 } 13003 if (!BUILT_IN_CMAPS.includes(name)) { 13004 throw new Error("Unknown CMap name: " + name); 13005 } 13006 if (!fetchBuiltInCMap) { 13007 throw new Error("Built-in CMap parameters are not provided."); 13008 } 13009 const { 13010 cMapData, 13011 compressionType 13012 } = await fetchBuiltInCMap(name); 13013 const cMap = new CMap(true); 13014 if (compressionType === _util.CMapCompressionType.BINARY) { 13015 return new _binary_cmap.BinaryCMapReader().process(cMapData, cMap, useCMap => { 13016 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 13017 }); 13018 } 13019 if (compressionType === _util.CMapCompressionType.NONE) { 13020 const lexer = new _parser.Lexer(new _stream.Stream(cMapData)); 13021 return parseCMap(cMap, lexer, fetchBuiltInCMap, null); 13022 } 13023 throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`); 13024} 13025class CMapFactory { 13026 static async create({ 13027 encoding, 13028 fetchBuiltInCMap, 13029 useCMap 13030 }) { 13031 if (encoding instanceof _primitives.Name) { 13032 return createBuiltInCMap(encoding.name, fetchBuiltInCMap); 13033 } else if (encoding instanceof _base_stream.BaseStream) { 13034 const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap); 13035 if (parsedCMap.isIdentityCMap) { 13036 return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap); 13037 } 13038 return parsedCMap; 13039 } 13040 throw new Error("Encoding required."); 13041 } 13042} 13043exports.CMapFactory = CMapFactory; 13044 13045/***/ }), 13046/* 15 */ 13047/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 13048 13049 13050 13051Object.defineProperty(exports, "__esModule", ({ 13052 value: true 13053})); 13054exports.BinaryCMapReader = void 0; 13055var _util = __w_pdfjs_require__(2); 13056function hexToInt(a, size) { 13057 let n = 0; 13058 for (let i = 0; i <= size; i++) { 13059 n = n << 8 | a[i]; 13060 } 13061 return n >>> 0; 13062} 13063function hexToStr(a, size) { 13064 if (size === 1) { 13065 return String.fromCharCode(a[0], a[1]); 13066 } 13067 if (size === 3) { 13068 return String.fromCharCode(a[0], a[1], a[2], a[3]); 13069 } 13070 return String.fromCharCode(...a.subarray(0, size + 1)); 13071} 13072function addHex(a, b, size) { 13073 let c = 0; 13074 for (let i = size; i >= 0; i--) { 13075 c += a[i] + b[i]; 13076 a[i] = c & 255; 13077 c >>= 8; 13078 } 13079} 13080function incHex(a, size) { 13081 let c = 1; 13082 for (let i = size; i >= 0 && c > 0; i--) { 13083 c += a[i]; 13084 a[i] = c & 255; 13085 c >>= 8; 13086 } 13087} 13088const MAX_NUM_SIZE = 16; 13089const MAX_ENCODED_NUM_SIZE = 19; 13090class BinaryCMapStream { 13091 constructor(data) { 13092 this.buffer = data; 13093 this.pos = 0; 13094 this.end = data.length; 13095 this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE); 13096 } 13097 readByte() { 13098 if (this.pos >= this.end) { 13099 return -1; 13100 } 13101 return this.buffer[this.pos++]; 13102 } 13103 readNumber() { 13104 let n = 0; 13105 let last; 13106 do { 13107 const b = this.readByte(); 13108 if (b < 0) { 13109 throw new _util.FormatError("unexpected EOF in bcmap"); 13110 } 13111 last = !(b & 0x80); 13112 n = n << 7 | b & 0x7f; 13113 } while (!last); 13114 return n; 13115 } 13116 readSigned() { 13117 const n = this.readNumber(); 13118 return n & 1 ? ~(n >>> 1) : n >>> 1; 13119 } 13120 readHex(num, size) { 13121 num.set(this.buffer.subarray(this.pos, this.pos + size + 1)); 13122 this.pos += size + 1; 13123 } 13124 readHexNumber(num, size) { 13125 let last; 13126 const stack = this.tmpBuf; 13127 let sp = 0; 13128 do { 13129 const b = this.readByte(); 13130 if (b < 0) { 13131 throw new _util.FormatError("unexpected EOF in bcmap"); 13132 } 13133 last = !(b & 0x80); 13134 stack[sp++] = b & 0x7f; 13135 } while (!last); 13136 let i = size, 13137 buffer = 0, 13138 bufferSize = 0; 13139 while (i >= 0) { 13140 while (bufferSize < 8 && stack.length > 0) { 13141 buffer |= stack[--sp] << bufferSize; 13142 bufferSize += 7; 13143 } 13144 num[i] = buffer & 255; 13145 i--; 13146 buffer >>= 8; 13147 bufferSize -= 8; 13148 } 13149 } 13150 readHexSigned(num, size) { 13151 this.readHexNumber(num, size); 13152 const sign = num[size] & 1 ? 255 : 0; 13153 let c = 0; 13154 for (let i = 0; i <= size; i++) { 13155 c = (c & 1) << 8 | num[i]; 13156 num[i] = c >> 1 ^ sign; 13157 } 13158 } 13159 readString() { 13160 const len = this.readNumber(), 13161 buf = new Array(len); 13162 for (let i = 0; i < len; i++) { 13163 buf[i] = this.readNumber(); 13164 } 13165 return String.fromCharCode(...buf); 13166 } 13167} 13168class BinaryCMapReader { 13169 async process(data, cMap, extend) { 13170 const stream = new BinaryCMapStream(data); 13171 const header = stream.readByte(); 13172 cMap.vertical = !!(header & 1); 13173 let useCMap = null; 13174 const start = new Uint8Array(MAX_NUM_SIZE); 13175 const end = new Uint8Array(MAX_NUM_SIZE); 13176 const char = new Uint8Array(MAX_NUM_SIZE); 13177 const charCode = new Uint8Array(MAX_NUM_SIZE); 13178 const tmp = new Uint8Array(MAX_NUM_SIZE); 13179 let code; 13180 let b; 13181 while ((b = stream.readByte()) >= 0) { 13182 const type = b >> 5; 13183 if (type === 7) { 13184 switch (b & 0x1f) { 13185 case 0: 13186 stream.readString(); 13187 break; 13188 case 1: 13189 useCMap = stream.readString(); 13190 break; 13191 } 13192 continue; 13193 } 13194 const sequence = !!(b & 0x10); 13195 const dataSize = b & 15; 13196 if (dataSize + 1 > MAX_NUM_SIZE) { 13197 throw new Error("BinaryCMapReader.process: Invalid dataSize."); 13198 } 13199 const ucs2DataSize = 1; 13200 const subitemsCount = stream.readNumber(); 13201 switch (type) { 13202 case 0: 13203 stream.readHex(start, dataSize); 13204 stream.readHexNumber(end, dataSize); 13205 addHex(end, start, dataSize); 13206 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 13207 for (let i = 1; i < subitemsCount; i++) { 13208 incHex(end, dataSize); 13209 stream.readHexNumber(start, dataSize); 13210 addHex(start, end, dataSize); 13211 stream.readHexNumber(end, dataSize); 13212 addHex(end, start, dataSize); 13213 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 13214 } 13215 break; 13216 case 1: 13217 stream.readHex(start, dataSize); 13218 stream.readHexNumber(end, dataSize); 13219 addHex(end, start, dataSize); 13220 stream.readNumber(); 13221 for (let i = 1; i < subitemsCount; i++) { 13222 incHex(end, dataSize); 13223 stream.readHexNumber(start, dataSize); 13224 addHex(start, end, dataSize); 13225 stream.readHexNumber(end, dataSize); 13226 addHex(end, start, dataSize); 13227 stream.readNumber(); 13228 } 13229 break; 13230 case 2: 13231 stream.readHex(char, dataSize); 13232 code = stream.readNumber(); 13233 cMap.mapOne(hexToInt(char, dataSize), code); 13234 for (let i = 1; i < subitemsCount; i++) { 13235 incHex(char, dataSize); 13236 if (!sequence) { 13237 stream.readHexNumber(tmp, dataSize); 13238 addHex(char, tmp, dataSize); 13239 } 13240 code = stream.readSigned() + (code + 1); 13241 cMap.mapOne(hexToInt(char, dataSize), code); 13242 } 13243 break; 13244 case 3: 13245 stream.readHex(start, dataSize); 13246 stream.readHexNumber(end, dataSize); 13247 addHex(end, start, dataSize); 13248 code = stream.readNumber(); 13249 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 13250 for (let i = 1; i < subitemsCount; i++) { 13251 incHex(end, dataSize); 13252 if (!sequence) { 13253 stream.readHexNumber(start, dataSize); 13254 addHex(start, end, dataSize); 13255 } else { 13256 start.set(end); 13257 } 13258 stream.readHexNumber(end, dataSize); 13259 addHex(end, start, dataSize); 13260 code = stream.readNumber(); 13261 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 13262 } 13263 break; 13264 case 4: 13265 stream.readHex(char, ucs2DataSize); 13266 stream.readHex(charCode, dataSize); 13267 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 13268 for (let i = 1; i < subitemsCount; i++) { 13269 incHex(char, ucs2DataSize); 13270 if (!sequence) { 13271 stream.readHexNumber(tmp, ucs2DataSize); 13272 addHex(char, tmp, ucs2DataSize); 13273 } 13274 incHex(charCode, dataSize); 13275 stream.readHexSigned(tmp, dataSize); 13276 addHex(charCode, tmp, dataSize); 13277 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 13278 } 13279 break; 13280 case 5: 13281 stream.readHex(start, ucs2DataSize); 13282 stream.readHexNumber(end, ucs2DataSize); 13283 addHex(end, start, ucs2DataSize); 13284 stream.readHex(charCode, dataSize); 13285 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 13286 for (let i = 1; i < subitemsCount; i++) { 13287 incHex(end, ucs2DataSize); 13288 if (!sequence) { 13289 stream.readHexNumber(start, ucs2DataSize); 13290 addHex(start, end, ucs2DataSize); 13291 } else { 13292 start.set(end); 13293 } 13294 stream.readHexNumber(end, ucs2DataSize); 13295 addHex(end, start, ucs2DataSize); 13296 stream.readHex(charCode, dataSize); 13297 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 13298 } 13299 break; 13300 default: 13301 throw new Error(`BinaryCMapReader.process - unknown type: ${type}`); 13302 } 13303 } 13304 if (useCMap) { 13305 return extend(useCMap); 13306 } 13307 return cMap; 13308 } 13309} 13310exports.BinaryCMapReader = BinaryCMapReader; 13311 13312/***/ }), 13313/* 16 */ 13314/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 13315 13316 13317 13318Object.defineProperty(exports, "__esModule", ({ 13319 value: true 13320})); 13321exports.Parser = exports.Linearization = exports.Lexer = void 0; 13322var _util = __w_pdfjs_require__(2); 13323var _primitives = __w_pdfjs_require__(4); 13324var _core_utils = __w_pdfjs_require__(3); 13325var _stream = __w_pdfjs_require__(8); 13326var _ascii_85_stream = __w_pdfjs_require__(17); 13327var _ascii_hex_stream = __w_pdfjs_require__(19); 13328var _ccitt_stream = __w_pdfjs_require__(20); 13329var _flate_stream = __w_pdfjs_require__(22); 13330var _jbig2_stream = __w_pdfjs_require__(23); 13331var _jpeg_stream = __w_pdfjs_require__(26); 13332var _jpx_stream = __w_pdfjs_require__(29); 13333var _lzw_stream = __w_pdfjs_require__(31); 13334var _predictor_stream = __w_pdfjs_require__(32); 13335var _run_length_stream = __w_pdfjs_require__(33); 13336const MAX_LENGTH_TO_CACHE = 1000; 13337function getInlineImageCacheKey(bytes) { 13338 const strBuf = [], 13339 ii = bytes.length; 13340 let i = 0; 13341 while (i < ii - 1) {
13342 strBuf.push(bytes[i++] << 8 | bytes[i++]); 13343 } 13344 if (i < ii) { 13345 strBuf.push(bytes[i]); 13346 } 13347 return ii + "_" + String.fromCharCode.apply(null, strBuf); 13348} 13349class Parser { 13350 constructor({ 13351 lexer, 13352 xref, 13353 allowStreams = false, 13354 recoveryMode = false 13355 }) { 13356 this.lexer = lexer; 13357 this.xref = xref; 13358 this.allowStreams = allowStreams; 13359 this.recoveryMode = recoveryMode; 13360 this.imageCache = Object.create(null); 13361 this._imageId = 0; 13362 this.refill(); 13363 } 13364 refill() { 13365 this.buf1 = this.lexer.getObj(); 13366 this.buf2 = this.lexer.getObj(); 13367 } 13368 shift() { 13369 if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") { 13370 this.buf1 = this.buf2; 13371 this.buf2 = null; 13372 } else { 13373 this.buf1 = this.buf2; 13374 this.buf2 = this.lexer.getObj(); 13375 } 13376 } 13377 tryShift() { 13378 try { 13379 this.shift(); 13380 return true; 13381 } catch (e) { 13382 if (e instanceof _core_utils.MissingDataException) { 13383 throw e; 13384 } 13385 return false; 13386 } 13387 } 13388 getObj(cipherTransform = null) { 13389 const buf1 = this.buf1; 13390 this.shift(); 13391 if (buf1 instanceof _primitives.Cmd) { 13392 switch (buf1.cmd) { 13393 case "BI": 13394 return this.makeInlineImage(cipherTransform); 13395 case "[": 13396 const array = []; 13397 while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) { 13398 array.push(this.getObj(cipherTransform)); 13399 } 13400 if (this.buf1 === _primitives.EOF) { 13401 if (this.recoveryMode) { 13402 return array; 13403 } 13404 throw new _core_utils.ParserEOFException("End of file inside array."); 13405 } 13406 this.shift(); 13407 return array; 13408 case "<<": 13409 const dict = new _primitives.Dict(this.xref); 13410 while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) { 13411 if (!(this.buf1 instanceof _primitives.Name)) { 13412 (0, _util.info)("Malformed dictionary: key must be a name object"); 13413 this.shift(); 13414 continue; 13415 } 13416 const key = this.buf1.name; 13417 this.shift(); 13418 if (this.buf1 === _primitives.EOF) { 13419 break; 13420 } 13421 dict.set(key, this.getObj(cipherTransform)); 13422 } 13423 if (this.buf1 === _primitives.EOF) { 13424 if (this.recoveryMode) { 13425 return dict; 13426 } 13427 throw new _core_utils.ParserEOFException("End of file inside dictionary."); 13428 } 13429 if ((0, _primitives.isCmd)(this.buf2, "stream")) { 13430 return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict; 13431 } 13432 this.shift(); 13433 return dict; 13434 default: 13435 return buf1; 13436 } 13437 } 13438 if (Number.isInteger(buf1)) { 13439 if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) { 13440 const ref = _primitives.Ref.get(buf1, this.buf1); 13441 this.shift(); 13442 this.shift(); 13443 return ref; 13444 } 13445 return buf1; 13446 } 13447 if (typeof buf1 === "string") { 13448 if (cipherTransform) { 13449 return cipherTransform.decryptString(buf1); 13450 } 13451 return buf1; 13452 } 13453 return buf1; 13454 } 13455 findDefaultInlineStreamEnd(stream) { 13456 const E = 0x45, 13457 I = 0x49, 13458 SPACE = 0x20, 13459 LF = 0xa, 13460 CR = 0xd, 13461 NUL = 0x0; 13462 const { 13463 knownCommands 13464 } = this.lexer, 13465 startPos = stream.pos, 13466 n = 15; 13467 let state = 0, 13468 ch, 13469 maybeEIPos; 13470 while ((ch = stream.getByte()) !== -1) { 13471 if (state === 0) { 13472 state = ch === E ? 1 : 0; 13473 } else if (state === 1) { 13474 state = ch === I ? 2 : 0; 13475 } else { 13476 if (ch === SPACE || ch === LF || ch === CR) { 13477 maybeEIPos = stream.pos; 13478 const followingBytes = stream.peekBytes(n); 13479 const ii = followingBytes.length; 13480 if (ii === 0) { 13481 break; 13482 } 13483 for (let i = 0; i < ii; i++) { 13484 ch = followingBytes[i]; 13485 if (ch === NUL && followingBytes[i + 1] !== NUL) { 13486 continue; 13487 } 13488 if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) { 13489 state = 0; 13490 break; 13491 } 13492 } 13493 if (state !== 2) { 13494 continue; 13495 } 13496 if (!knownCommands) { 13497 (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined."); 13498 continue; 13499 }
vendor: 4,296 bytes, lines 13500-13659
13500 const tmpLexer = new Lexer(new _stream.Stream(followingBytes.slice()), knownCommands); 13501 tmpLexer._hexStringWarn = () => {}; 13502 let numArgs = 0; 13503 while (true) { 13504 const nextObj = tmpLexer.getObj(); 13505 if (nextObj === _primitives.EOF) { 13506 state = 0; 13507 break; 13508 } 13509 if (nextObj instanceof _primitives.Cmd) { 13510 const knownCommand = knownCommands[nextObj.cmd]; 13511 if (!knownCommand) { 13512 state = 0; 13513 break; 13514 } else if (knownCommand.variableArgs ? numArgs <= knownCommand.numArgs : numArgs === knownCommand.numArgs) { 13515 break; 13516 } 13517 numArgs = 0; 13518 continue; 13519 } 13520 numArgs++; 13521 } 13522 if (state === 2) { 13523 break; 13524 } 13525 } else { 13526 state = 0; 13527 } 13528 } 13529 } 13530 if (ch === -1) { 13531 (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker"); 13532 if (maybeEIPos) { 13533 (0, _util.warn)('... trying to recover by using the last "EI" occurrence.'); 13534 stream.skip(-(stream.pos - maybeEIPos)); 13535 } 13536 } 13537 let endOffset = 4; 13538 stream.skip(-endOffset); 13539 ch = stream.peekByte(); 13540 stream.skip(endOffset); 13541 if (!(0, _core_utils.isWhiteSpace)(ch)) { 13542 endOffset--; 13543 } 13544 return stream.pos - endOffset - startPos; 13545 } 13546 findDCTDecodeInlineStreamEnd(stream) { 13547 const startPos = stream.pos; 13548 let foundEOI = false, 13549 b, 13550 markerLength; 13551 while ((b = stream.getByte()) !== -1) { 13552 if (b !== 0xff) { 13553 continue; 13554 } 13555 switch (stream.getByte()) { 13556 case 0x00: 13557 break; 13558 case 0xff: 13559 stream.skip(-1); 13560 break; 13561 case 0xd9: 13562 foundEOI = true; 13563 break; 13564 case 0xc0: 13565 case 0xc1: 13566 case 0xc2: 13567 case 0xc3: 13568 case 0xc5: 13569 case 0xc6: 13570 case 0xc7: 13571 case 0xc9: 13572 case 0xca: 13573 case 0xcb: 13574 case 0xcd: 13575 case 0xce: 13576 case 0xcf: 13577 case 0xc4: 13578 case 0xcc: 13579 case 0xda: 13580 case 0xdb: 13581 case 0xdc: 13582 case 0xdd: 13583 case 0xde: 13584 case 0xdf: 13585 case 0xe0: 13586 case 0xe1: 13587 case 0xe2: 13588 case 0xe3: 13589 case 0xe4: 13590 case 0xe5: 13591 case 0xe6: 13592 case 0xe7: 13593 case 0xe8: 13594 case 0xe9: 13595 case 0xea: 13596 case 0xeb: 13597 case 0xec: 13598 case 0xed: 13599 case 0xee: 13600 case 0xef: 13601 case 0xfe: 13602 markerLength = stream.getUint16(); 13603 if (markerLength > 2) { 13604 stream.skip(markerLength - 2); 13605 } else { 13606 stream.skip(-2); 13607 } 13608 break; 13609 } 13610 if (foundEOI) { 13611 break; 13612 } 13613 } 13614 const length = stream.pos - startPos; 13615 if (b === -1) { 13616 (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead."); 13617 stream.skip(-length); 13618 return this.findDefaultInlineStreamEnd(stream); 13619 } 13620 this.inlineStreamSkipEI(stream); 13621 return length; 13622 } 13623 findASCII85DecodeInlineStreamEnd(stream) { 13624 const TILDE = 0x7e, 13625 GT = 0x3e; 13626 const startPos = stream.pos; 13627 let ch; 13628 while ((ch = stream.getByte()) !== -1) { 13629 if (ch === TILDE) { 13630 const tildePos = stream.pos; 13631 ch = stream.peekByte(); 13632 while ((0, _core_utils.isWhiteSpace)(ch)) { 13633 stream.skip(); 13634 ch = stream.peekByte(); 13635 } 13636 if (ch === GT) { 13637 stream.skip(); 13638 break; 13639 } 13640 if (stream.pos > tildePos) { 13641 const maybeEI = stream.peekBytes(2); 13642 if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) { 13643 break; 13644 } 13645 } 13646 } 13647 } 13648 const length = stream.pos - startPos; 13649 if (ch === -1) { 13650 (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead."); 13651 stream.skip(-length); 13652 return this.findDefaultInlineStreamEnd(stream); 13653 } 13654 this.inlineStreamSkipEI(stream); 13655 return length; 13656 } 13657 findASCIIHexDecodeInlineStreamEnd(stream) { 13658 const GT = 0x3e; 13659 const startPos = stream.pos;
vendor: 4,859 bytes, lines 13660-13813
13660 let ch; 13661 while ((ch = stream.getByte()) !== -1) { 13662 if (ch === GT) { 13663 break; 13664 } 13665 } 13666 const length = stream.pos - startPos; 13667 if (ch === -1) { 13668 (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead."); 13669 stream.skip(-length); 13670 return this.findDefaultInlineStreamEnd(stream); 13671 } 13672 this.inlineStreamSkipEI(stream); 13673 return length; 13674 } 13675 inlineStreamSkipEI(stream) { 13676 const E = 0x45, 13677 I = 0x49; 13678 let state = 0, 13679 ch; 13680 while ((ch = stream.getByte()) !== -1) { 13681 if (state === 0) { 13682 state = ch === E ? 1 : 0; 13683 } else if (state === 1) { 13684 state = ch === I ? 2 : 0; 13685 } else if (state === 2) { 13686 break; 13687 } 13688 } 13689 } 13690 makeInlineImage(cipherTransform) { 13691 const lexer = this.lexer; 13692 const stream = lexer.stream; 13693 const dictMap = Object.create(null); 13694 let dictLength; 13695 while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) { 13696 if (!(this.buf1 instanceof _primitives.Name)) { 13697 throw new _util.FormatError("Dictionary key must be a name object"); 13698 } 13699 const key = this.buf1.name; 13700 this.shift(); 13701 if (this.buf1 === _primitives.EOF) { 13702 break; 13703 } 13704 dictMap[key] = this.getObj(cipherTransform); 13705 } 13706 if (lexer.beginInlineImagePos !== -1) { 13707 dictLength = stream.pos - lexer.beginInlineImagePos; 13708 } 13709 const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter); 13710 let filterName; 13711 if (filter instanceof _primitives.Name) { 13712 filterName = filter.name; 13713 } else if (Array.isArray(filter)) { 13714 const filterZero = this.xref.fetchIfRef(filter[0]); 13715 if (filterZero instanceof _primitives.Name) { 13716 filterName = filterZero.name; 13717 } 13718 } 13719 const startPos = stream.pos; 13720 let length; 13721 switch (filterName) { 13722 case "DCT": 13723 case "DCTDecode": 13724 length = this.findDCTDecodeInlineStreamEnd(stream); 13725 break; 13726 case "A85": 13727 case "ASCII85Decode": 13728 length = this.findASCII85DecodeInlineStreamEnd(stream); 13729 break; 13730 case "AHx": 13731 case "ASCIIHexDecode": 13732 length = this.findASCIIHexDecodeInlineStreamEnd(stream); 13733 break; 13734 default: 13735 length = this.findDefaultInlineStreamEnd(stream); 13736 } 13737 let cacheKey; 13738 if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) { 13739 const initialStreamPos = stream.pos; 13740 stream.pos = lexer.beginInlineImagePos; 13741 cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length)); 13742 stream.pos = initialStreamPos; 13743 const cacheEntry = this.imageCache[cacheKey]; 13744 if (cacheEntry !== undefined) { 13745 this.buf2 = _primitives.Cmd.get("EI"); 13746 this.shift(); 13747 cacheEntry.reset(); 13748 return cacheEntry; 13749 } 13750 } 13751 const dict = new _primitives.Dict(this.xref); 13752 for (const key in dictMap) { 13753 dict.set(key, dictMap[key]); 13754 } 13755 let imageStream = stream.makeSubStream(startPos, length, dict); 13756 if (cipherTransform) { 13757 imageStream = cipherTransform.createStream(imageStream, length); 13758 } 13759 imageStream = this.filter(imageStream, dict, length); 13760 imageStream.dict = dict; 13761 if (cacheKey !== undefined) { 13762 imageStream.cacheKey = `inline_img_${++this._imageId}`; 13763 this.imageCache[cacheKey] = imageStream; 13764 } 13765 this.buf2 = _primitives.Cmd.get("EI"); 13766 this.shift(); 13767 return imageStream; 13768 } 13769 _findStreamLength(startPos, signature) { 13770 const { 13771 stream 13772 } = this.lexer; 13773 stream.pos = startPos; 13774 const SCAN_BLOCK_LENGTH = 2048; 13775 const signatureLength = signature.length; 13776 while (stream.pos < stream.end) { 13777 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 13778 const scanLength = scanBytes.length - signatureLength; 13779 if (scanLength <= 0) { 13780 break; 13781 } 13782 let pos = 0; 13783 while (pos < scanLength) { 13784 let j = 0; 13785 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 13786 j++; 13787 } 13788 if (j >= signatureLength) { 13789 stream.pos += pos; 13790 return stream.pos - startPos; 13791 } 13792 pos++; 13793 } 13794 stream.pos += scanLength; 13795 } 13796 return -1; 13797 } 13798 makeStream(dict, cipherTransform) { 13799 const lexer = this.lexer; 13800 let stream = lexer.stream; 13801 lexer.skipToNextLine(); 13802 const startPos = stream.pos - 1; 13803 let length = dict.get("Length"); 13804 if (!Number.isInteger(length)) { 13805 (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`); 13806 length = 0; 13807 } 13808 stream.pos = startPos + length; 13809 lexer.nextChar(); 13810 if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) { 13811 this.shift(); 13812 } else { 13813 const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
13814 let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE); 13815 if (actualLength < 0) { 13816 const MAX_TRUNCATION = 1; 13817 for (let i = 1; i <= MAX_TRUNCATION; i++) { 13818 const end = ENDSTREAM_SIGNATURE.length - i; 13819 const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end); 13820 const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE); 13821 if (maybeLength >= 0) { 13822 const lastByte = stream.peekBytes(end + 1)[end]; 13823 if (!(0, _core_utils.isWhiteSpace)(lastByte)) { 13824 break; 13825 } 13826 (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command."); 13827 actualLength = maybeLength; 13828 break; 13829 } 13830 } 13831 if (actualLength < 0) { 13832 throw new _util.FormatError("Missing endstream command."); 13833 } 13834 } 13835 length = actualLength; 13836 lexer.nextChar(); 13837 this.shift(); 13838 this.shift(); 13839 } 13840 this.shift(); 13841 stream = stream.makeSubStream(startPos, length, dict); 13842 if (cipherTransform) { 13843 stream = cipherTransform.createStream(stream, length); 13844 } 13845 stream = this.filter(stream, dict, length); 13846 stream.dict = dict; 13847 return stream; 13848 } 13849 filter(stream, dict, length) { 13850 let filter = dict.get("F", "Filter"); 13851 let params = dict.get("DP", "DecodeParms"); 13852 if (filter instanceof _primitives.Name) { 13853 if (Array.isArray(params)) { 13854 (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name."); 13855 } 13856 return this.makeFilter(stream, filter.name, length, params); 13857 } 13858 let maybeLength = length; 13859 if (Array.isArray(filter)) { 13860 const filterArray = filter; 13861 const paramsArray = params; 13862 for (let i = 0, ii = filterArray.length; i < ii; ++i) { 13863 filter = this.xref.fetchIfRef(filterArray[i]); 13864 if (!(filter instanceof _primitives.Name)) { 13865 throw new _util.FormatError(`Bad filter name "${filter}"`); 13866 } 13867 params = null; 13868 if (Array.isArray(paramsArray) && i in paramsArray) { 13869 params = this.xref.fetchIfRef(paramsArray[i]); 13870 } 13871 stream = this.makeFilter(stream, filter.name, maybeLength, params); 13872 maybeLength = null; 13873 } 13874 } 13875 return stream; 13876 } 13877 makeFilter(stream, name, maybeLength, params) { 13878 if (maybeLength === 0) { 13879 (0, _util.warn)(`Empty "${name}" stream.`); 13880 return new _stream.NullStream(); 13881 } 13882 try { 13883 switch (name) { 13884 case "Fl": 13885 case "FlateDecode": 13886 if (params) { 13887 return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params); 13888 } 13889 return new _flate_stream.FlateStream(stream, maybeLength); 13890 case "LZW": 13891 case "LZWDecode": 13892 let earlyChange = 1; 13893 if (params) { 13894 if (params.has("EarlyChange")) { 13895 earlyChange = params.get("EarlyChange"); 13896 } 13897 return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params); 13898 } 13899 return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange); 13900 case "DCT": 13901 case "DCTDecode": 13902 return new _jpeg_stream.JpegStream(stream, maybeLength, params); 13903 case "JPX": 13904 case "JPXDecode": 13905 return new _jpx_stream.JpxStream(stream, maybeLength, params); 13906 case "A85": 13907 case "ASCII85Decode": 13908 return new _ascii_85_stream.Ascii85Stream(stream, maybeLength); 13909 case "AHx": 13910 case "ASCIIHexDecode": 13911 return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength); 13912 case "CCF": 13913 case "CCITTFaxDecode": 13914 return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params); 13915 case "RL": 13916 case "RunLengthDecode": 13917 return new _run_length_stream.RunLengthStream(stream, maybeLength); 13918 case "JBIG2Decode": 13919 return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params); 13920 } 13921 (0, _util.warn)(`Filter "${name}" is not supported.`); 13922 return stream; 13923 } catch (ex) { 13924 if (ex instanceof _core_utils.MissingDataException) { 13925 throw ex; 13926 } 13927 (0, _util.warn)(`Invalid stream: "${ex}"`); 13928 return new _stream.NullStream(); 13929 } 13930 } 13931} 13932exports.Parser = Parser; 13933const 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]; 13934function toHexDigit(ch) { 13935 if (ch >= 0x30 && ch <= 0x39) { 13936 return ch & 0x0f; 13937 } 13938 if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 13939 return (ch & 0x0f) + 9; 13940 } 13941 return -1; 13942} 13943class Lexer { 13944 constructor(stream, knownCommands = null) { 13945 this.stream = stream; 13946 this.nextChar(); 13947 this.strBuf = []; 13948 this.knownCommands = knownCommands; 13949 this._hexStringNumWarn = 0; 13950 this.beginInlineImagePos = -1; 13951 } 13952 nextChar() { 13953 return this.currentChar = this.stream.getByte(); 13954 } 13955 peekChar() { 13956 return this.stream.peekByte(); 13957 } 13958 getNumber() {
vendor: 4,524 bytes, lines 13959-14130
13959 let ch = this.currentChar; 13960 let eNotation = false; 13961 let divideBy = 0; 13962 let sign = 1; 13963 if (ch === 0x2d) { 13964 sign = -1; 13965 ch = this.nextChar(); 13966 if (ch === 0x2d) { 13967 ch = this.nextChar(); 13968 } 13969 } else if (ch === 0x2b) { 13970 ch = this.nextChar(); 13971 } 13972 if (ch === 0x0a || ch === 0x0d) { 13973 do { 13974 ch = this.nextChar(); 13975 } while (ch === 0x0a || ch === 0x0d); 13976 } 13977 if (ch === 0x2e) { 13978 divideBy = 10; 13979 ch = this.nextChar(); 13980 } 13981 if (ch < 0x30 || ch > 0x39) { 13982 const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`; 13983 if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) { 13984 (0, _util.info)(`Lexer.getNumber - "${msg}".`); 13985 return 0; 13986 } 13987 throw new _util.FormatError(msg); 13988 } 13989 let baseValue = ch - 0x30; 13990 let powerValue = 0; 13991 let powerValueSign = 1; 13992 while ((ch = this.nextChar()) >= 0) { 13993 if (ch >= 0x30 && ch <= 0x39) { 13994 const currentDigit = ch - 0x30; 13995 if (eNotation) { 13996 powerValue = powerValue * 10 + currentDigit; 13997 } else { 13998 if (divideBy !== 0) { 13999 divideBy *= 10; 14000 } 14001 baseValue = baseValue * 10 + currentDigit; 14002 } 14003 } else if (ch === 0x2e) { 14004 if (divideBy === 0) { 14005 divideBy = 1; 14006 } else { 14007 break; 14008 } 14009 } else if (ch === 0x2d) { 14010 (0, _util.warn)("Badly formatted number: minus sign in the middle"); 14011 } else if (ch === 0x45 || ch === 0x65) { 14012 ch = this.peekChar(); 14013 if (ch === 0x2b || ch === 0x2d) { 14014 powerValueSign = ch === 0x2d ? -1 : 1; 14015 this.nextChar(); 14016 } else if (ch < 0x30 || ch > 0x39) { 14017 break; 14018 } 14019 eNotation = true; 14020 } else { 14021 break; 14022 } 14023 } 14024 if (divideBy !== 0) { 14025 baseValue /= divideBy; 14026 } 14027 if (eNotation) { 14028 baseValue *= 10 ** (powerValueSign * powerValue); 14029 } 14030 return sign * baseValue; 14031 } 14032 getString() { 14033 let numParen = 1; 14034 let done = false; 14035 const strBuf = this.strBuf; 14036 strBuf.length = 0; 14037 let ch = this.nextChar(); 14038 while (true) { 14039 let charBuffered = false; 14040 switch (ch | 0) { 14041 case -1: 14042 (0, _util.warn)("Unterminated string"); 14043 done = true; 14044 break; 14045 case 0x28: 14046 ++numParen; 14047 strBuf.push("("); 14048 break; 14049 case 0x29: 14050 if (--numParen === 0) { 14051 this.nextChar(); 14052 done = true; 14053 } else { 14054 strBuf.push(")"); 14055 } 14056 break; 14057 case 0x5c: 14058 ch = this.nextChar(); 14059 switch (ch) { 14060 case -1: 14061 (0, _util.warn)("Unterminated string"); 14062 done = true; 14063 break; 14064 case 0x6e: 14065 strBuf.push("\n"); 14066 break; 14067 case 0x72: 14068 strBuf.push("\r"); 14069 break; 14070 case 0x74: 14071 strBuf.push("\t"); 14072 break; 14073 case 0x62: 14074 strBuf.push("\b"); 14075 break; 14076 case 0x66: 14077 strBuf.push("\f"); 14078 break; 14079 case 0x5c: 14080 case 0x28: 14081 case 0x29: 14082 strBuf.push(String.fromCharCode(ch)); 14083 break; 14084 case 0x30: 14085 case 0x31: 14086 case 0x32: 14087 case 0x33: 14088 case 0x34: 14089 case 0x35: 14090 case 0x36: 14091 case 0x37: 14092 let x = ch & 0x0f; 14093 ch = this.nextChar(); 14094 charBuffered = true; 14095 if (ch >= 0x30 && ch <= 0x37) { 14096 x = (x << 3) + (ch & 0x0f); 14097 ch = this.nextChar(); 14098 if (ch >= 0x30 && ch <= 0x37) { 14099 charBuffered = false; 14100 x = (x << 3) + (ch & 0x0f); 14101 } 14102 } 14103 strBuf.push(String.fromCharCode(x)); 14104 break; 14105 case 0x0d: 14106 if (this.peekChar() === 0x0a) { 14107 this.nextChar(); 14108 } 14109 break; 14110 case 0x0a: 14111 break; 14112 default: 14113 strBuf.push(String.fromCharCode(ch)); 14114 break; 14115 } 14116 break; 14117 default: 14118 strBuf.push(String.fromCharCode(ch)); 14119 break; 14120 } 14121 if (done) { 14122 break; 14123 } 14124 if (!charBuffered) { 14125 ch = this.nextChar(); 14126 } 14127 } 14128 return strBuf.join(""); 14129 } 14130 getName() {
14131 let ch, previousCh; 14132 const strBuf = this.strBuf; 14133 strBuf.length = 0; 14134 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 14135 if (ch === 0x23) { 14136 ch = this.nextChar(); 14137 if (specialChars[ch]) { 14138 (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number."); 14139 strBuf.push("#"); 14140 break; 14141 } 14142 const x = toHexDigit(ch); 14143 if (x !== -1) { 14144 previousCh = ch; 14145 ch = this.nextChar(); 14146 const x2 = toHexDigit(ch); 14147 if (x2 === -1) { 14148 (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number."); 14149 strBuf.push("#", String.fromCharCode(previousCh)); 14150 if (specialChars[ch]) { 14151 break; 14152 } 14153 strBuf.push(String.fromCharCode(ch)); 14154 continue; 14155 } 14156 strBuf.push(String.fromCharCode(x << 4 | x2)); 14157 } else { 14158 strBuf.push("#", String.fromCharCode(ch)); 14159 } 14160 } else { 14161 strBuf.push(String.fromCharCode(ch)); 14162 } 14163 } 14164 if (strBuf.length > 127) { 14165 (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`); 14166 } 14167 return _primitives.Name.get(strBuf.join("")); 14168 } 14169 _hexStringWarn(ch) { 14170 const MAX_HEX_STRING_NUM_WARN = 5; 14171 if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) { 14172 (0, _util.warn)("getHexString - ignoring additional invalid characters."); 14173 return; 14174 } 14175 if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) { 14176 return; 14177 } 14178 (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`); 14179 } 14180 getHexString() { 14181 const strBuf = this.strBuf; 14182 strBuf.length = 0; 14183 let ch = this.currentChar; 14184 let isFirstHex = true; 14185 let firstDigit, secondDigit; 14186 this._hexStringNumWarn = 0; 14187 while (true) { 14188 if (ch < 0) { 14189 (0, _util.warn)("Unterminated hex string"); 14190 break; 14191 } else if (ch === 0x3e) { 14192 this.nextChar(); 14193 break; 14194 } else if (specialChars[ch] === 1) { 14195 ch = this.nextChar(); 14196 continue; 14197 } else { 14198 if (isFirstHex) { 14199 firstDigit = toHexDigit(ch); 14200 if (firstDigit === -1) { 14201 this._hexStringWarn(ch); 14202 ch = this.nextChar(); 14203 continue; 14204 } 14205 } else { 14206 secondDigit = toHexDigit(ch); 14207 if (secondDigit === -1) { 14208 this._hexStringWarn(ch); 14209 ch = this.nextChar(); 14210 continue; 14211 } 14212 strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit)); 14213 } 14214 isFirstHex = !isFirstHex; 14215 ch = this.nextChar(); 14216 } 14217 } 14218 return strBuf.join(""); 14219 } 14220 getObj() {
vendor: 3,751 bytes, lines 14221-14356
14221 let comment = false; 14222 let ch = this.currentChar; 14223 while (true) { 14224 if (ch < 0) { 14225 return _primitives.EOF; 14226 } 14227 if (comment) { 14228 if (ch === 0x0a || ch === 0x0d) { 14229 comment = false; 14230 } 14231 } else if (ch === 0x25) { 14232 comment = true; 14233 } else if (specialChars[ch] !== 1) { 14234 break; 14235 } 14236 ch = this.nextChar(); 14237 } 14238 switch (ch | 0) { 14239 case 0x30: 14240 case 0x31: 14241 case 0x32: 14242 case 0x33: 14243 case 0x34: 14244 case 0x35: 14245 case 0x36: 14246 case 0x37: 14247 case 0x38: 14248 case 0x39: 14249 case 0x2b: 14250 case 0x2d: 14251 case 0x2e: 14252 return this.getNumber(); 14253 case 0x28: 14254 return this.getString(); 14255 case 0x2f: 14256 return this.getName(); 14257 case 0x5b: 14258 this.nextChar(); 14259 return _primitives.Cmd.get("["); 14260 case 0x5d: 14261 this.nextChar(); 14262 return _primitives.Cmd.get("]"); 14263 case 0x3c: 14264 ch = this.nextChar(); 14265 if (ch === 0x3c) { 14266 this.nextChar(); 14267 return _primitives.Cmd.get("<<"); 14268 } 14269 return this.getHexString(); 14270 case 0x3e: 14271 ch = this.nextChar(); 14272 if (ch === 0x3e) { 14273 this.nextChar(); 14274 return _primitives.Cmd.get(">>"); 14275 } 14276 return _primitives.Cmd.get(">"); 14277 case 0x7b: 14278 this.nextChar(); 14279 return _primitives.Cmd.get("{"); 14280 case 0x7d: 14281 this.nextChar(); 14282 return _primitives.Cmd.get("}"); 14283 case 0x29: 14284 this.nextChar(); 14285 throw new _util.FormatError(`Illegal character: ${ch}`); 14286 } 14287 let str = String.fromCharCode(ch); 14288 if (ch < 0x20 || ch > 0x7f) { 14289 const nextCh = this.peekChar(); 14290 if (nextCh >= 0x20 && nextCh <= 0x7f) { 14291 this.nextChar(); 14292 return _primitives.Cmd.get(str); 14293 } 14294 } 14295 const knownCommands = this.knownCommands; 14296 let knownCommandFound = knownCommands?.[str] !== undefined; 14297 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 14298 const possibleCommand = str + String.fromCharCode(ch); 14299 if (knownCommandFound && knownCommands[possibleCommand] === undefined) { 14300 break; 14301 } 14302 if (str.length === 128) { 14303 throw new _util.FormatError(`Command token too long: ${str.length}`); 14304 } 14305 str = possibleCommand; 14306 knownCommandFound = knownCommands?.[str] !== undefined; 14307 } 14308 if (str === "true") { 14309 return true; 14310 } 14311 if (str === "false") { 14312 return false; 14313 } 14314 if (str === "null") { 14315 return null; 14316 } 14317 if (str === "BI") { 14318 this.beginInlineImagePos = this.stream.pos; 14319 } 14320 return _primitives.Cmd.get(str); 14321 } 14322 skipToNextLine() { 14323 let ch = this.currentChar; 14324 while (ch >= 0) { 14325 if (ch === 0x0d) { 14326 ch = this.nextChar(); 14327 if (ch === 0x0a) { 14328 this.nextChar(); 14329 } 14330 break; 14331 } else if (ch === 0x0a) { 14332 this.nextChar(); 14333 break; 14334 } 14335 ch = this.nextChar(); 14336 } 14337 } 14338} 14339exports.Lexer = Lexer; 14340class Linearization { 14341 static create(stream) { 14342 function getInt(linDict, name, allowZeroValue = false) { 14343 const obj = linDict.get(name); 14344 if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { 14345 return obj; 14346 } 14347 throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid."); 14348 } 14349 function getHints(linDict) { 14350 const hints = linDict.get("H"); 14351 let hintsLength; 14352 if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { 14353 for (let index = 0; index < hintsLength; index++) { 14354 const hint = hints[index]; 14355 if (!(Number.isInteger(hint) && hint > 0)) { 14356 throw new Error(`Hint (${index}
14356) in the linearization dictionary is invalid.`); 14357 } 14358 } 14359 return hints; 14360 } 14361 throw new Error("Hint array in the linearization dictionary is invalid."); 14362 } 14363 const parser = new Parser({ 14364 lexer: new Lexer(stream), 14365 xref: null 14366 }); 14367 const obj1 = parser.getObj(); 14368 const obj2 = parser.getObj(); 14369 const obj3 = parser.getObj(); 14370 const linDict = parser.getObj(); 14371 let obj, length; 14372 if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) { 14373 return null; 14374 } else if ((length = getInt(linDict, "L")) !== stream.length) { 14375 throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length."); 14376 } 14377 return { 14378 length, 14379 hints: getHints(linDict), 14380 objectNumberFirst: getInt(linDict, "O"), 14381 endFirst: getInt(linDict, "E"), 14382 numPages: getInt(linDict, "N"), 14383 mainXRefEntriesOffset: getInt(linDict, "T"), 14384 pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0 14385 }; 14386 } 14387} 14388exports.Linearization = Linearization; 14389 14390/***/ }), 14391/* 17 */ 14392/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 14393 14394 14395 14396Object.defineProperty(exports, "__esModule", ({ 14397 value: true 14398})); 14399exports.Ascii85Stream = void 0; 14400var _decode_stream = __w_pdfjs_require__(18); 14401var _core_utils = __w_pdfjs_require__(3); 14402class Ascii85Stream extends _decode_stream.DecodeStream { 14403 constructor(str, maybeLength) { 14404 if (maybeLength) { 14405 maybeLength *= 0.8; 14406 } 14407 super(maybeLength); 14408 this.str = str; 14409 this.dict = str.dict; 14410 this.input = new Uint8Array(5); 14411 } 14412 readBlock() { 14413 const TILDA_CHAR = 0x7e; 14414 const Z_LOWER_CHAR = 0x7a; 14415 const EOF = -1; 14416 const str = this.str; 14417 let c = str.getByte(); 14418 while ((0, _core_utils.isWhiteSpace)(c)) { 14419 c = str.getByte(); 14420 } 14421 if (c === EOF || c === TILDA_CHAR) { 14422 this.eof = true; 14423 return; 14424 } 14425 const bufferLength = this.bufferLength; 14426 let buffer, i; 14427 if (c === Z_LOWER_CHAR) { 14428 buffer = this.ensureBuffer(bufferLength + 4); 14429 for (i = 0; i < 4; ++i) { 14430 buffer[bufferLength + i] = 0; 14431 } 14432 this.bufferLength += 4; 14433 } else { 14434 const input = this.input; 14435 input[0] = c; 14436 for (i = 1; i < 5; ++i) { 14437 c = str.getByte(); 14438 while ((0, _core_utils.isWhiteSpace)(c)) { 14439 c = str.getByte(); 14440 } 14441 input[i] = c; 14442 if (c === EOF || c === TILDA_CHAR) { 14443 break; 14444 } 14445 } 14446 buffer = this.ensureBuffer(bufferLength + i - 1); 14447 this.bufferLength += i - 1; 14448 if (i < 5) { 14449 for (; i < 5; ++i) { 14450 input[i] = 0x21 + 84; 14451 } 14452 this.eof = true; 14453 } 14454 let t = 0; 14455 for (i = 0; i < 5; ++i) { 14456 t = t * 85 + (input[i] - 0x21); 14457 } 14458 for (i = 3; i >= 0; --i) { 14459 buffer[bufferLength + i] = t & 0xff; 14460 t >>= 8; 14461 } 14462 } 14463 } 14464} 14465exports.Ascii85Stream = Ascii85Stream; 14466 14467/***/ }), 14468/* 18 */ 14469/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 14470 14471 14472 14473Object.defineProperty(exports, "__esModule", ({ 14474 value: true 14475})); 14476exports.StreamsSequenceStream = exports.DecodeStream = void 0; 14477var _base_stream = __w_pdfjs_require__(5); 14478var _stream = __w_pdfjs_require__(8); 14479const emptyBuffer = new Uint8Array(0); 14480class DecodeStream extends _base_stream.BaseStream { 14481 constructor(maybeMinBufferLength) { 14482 super(); 14483 this._rawMinBufferLength = maybeMinBufferLength || 0; 14484 this.pos = 0; 14485 this.bufferLength = 0; 14486 this.eof = false; 14487 this.buffer = emptyBuffer; 14488 this.minBufferLength = 512; 14489 if (maybeMinBufferLength) { 14490 while (this.minBufferLength < maybeMinBufferLength) { 14491 this.minBufferLength *= 2; 14492 } 14493 } 14494 } 14495 get isEmpty() { 14496 while (!this.eof && this.bufferLength === 0) { 14497 this.readBlock(); 14498 } 14499 return this.bufferLength === 0; 14500 } 14501 ensureBuffer(requested) { 14502 const buffer = this.buffer; 14503 if (requested <= buffer.byteLength) { 14504 return buffer; 14505 } 14506 let size = this.minBufferLength; 14507 while (size < requested) { 14508 size *= 2; 14509 } 14510 const buffer2 = new Uint8Array(size); 14511 buffer2.set(buffer); 14512 return this.buffer = buffer2; 14513 } 14514 getByte() { 14515 const pos = this.pos; 14516 while (this.bufferLength <= pos) { 14517 if (this.eof) { 14518 return -1; 14519 } 14520 this.readBlock(); 14521 } 14522 return this.buffer[this.pos++]; 14523 } 14524 getBytes(length) { 14525 const pos = this.pos; 14526 let end; 14527 if (length) { 14528 this.ensureBuffer(pos + length); 14529 end = pos + length; 14530 while (!this.eof && this.bufferLength < end) { 14531 this.readBlock(); 14532 } 14533 const bufEnd = this.bufferLength; 14534 if (end > bufEnd) { 14535 end = bufEnd; 14536 } 14537 } else { 14538 while (!this.eof) { 14539 this.readBlock(); 14540 } 14541 end = this.bufferLength; 14542 } 14543 this.pos = end; 14544 return this.buffer.subarray(pos, end); 14545 } 14546 reset() { 14547 this.pos = 0; 14548 } 14549 makeSubStream(start, length, dict = null) { 14550 if (length === undefined) { 14551 while (!this.eof) { 14552 this.readBlock(); 14553 } 14554 } else { 14555 const end = start + length; 14556 while (this.bufferLength <= end && !this.eof) { 14557 this.readBlock(); 14558 } 14559 } 14560 return new _stream.Stream(this.buffer, start, length, dict); 14561 } 14562 getBaseStreams() { 14563 return this.str ? this.str.getBaseStreams() : null; 14564 } 14565} 14566exports.DecodeStream = DecodeStream; 14567class StreamsSequenceStream extends DecodeStream { 14568 constructor(streams, onError = null) { 14569 let maybeLength = 0; 14570 for (const stream of streams) { 14571 maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length; 14572 } 14573 super(maybeLength); 14574 this.streams = streams; 14575 this._onError = onError; 14576 } 14577 readBlock() { 14578 const streams = this.streams; 14579 if (streams.length === 0) { 14580 this.eof = true; 14581 return; 14582 } 14583 const stream = streams.shift();
vendor: 4,192 bytes, lines 14584-14745
14584 let chunk; 14585 try { 14586 chunk = stream.getBytes(); 14587 } catch (reason) { 14588 if (this._onError) { 14589 this._onError(reason, stream.dict?.objId); 14590 return; 14591 } 14592 throw reason; 14593 } 14594 const bufferLength = this.bufferLength; 14595 const newLength = bufferLength + chunk.length; 14596 const buffer = this.ensureBuffer(newLength); 14597 buffer.set(chunk, bufferLength); 14598 this.bufferLength = newLength; 14599 } 14600 getBaseStreams() { 14601 const baseStreamsBuf = []; 14602 for (const stream of this.streams) { 14603 const baseStreams = stream.getBaseStreams(); 14604 if (baseStreams) { 14605 baseStreamsBuf.push(...baseStreams); 14606 } 14607 } 14608 return baseStreamsBuf.length > 0 ? baseStreamsBuf : null; 14609 } 14610} 14611exports.StreamsSequenceStream = StreamsSequenceStream; 14612 14613/***/ }), 14614/* 19 */ 14615/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 14616 14617 14618 14619Object.defineProperty(exports, "__esModule", ({ 14620 value: true 14621})); 14622exports.AsciiHexStream = void 0; 14623var _decode_stream = __w_pdfjs_require__(18); 14624class AsciiHexStream extends _decode_stream.DecodeStream { 14625 constructor(str, maybeLength) { 14626 if (maybeLength) { 14627 maybeLength *= 0.5; 14628 } 14629 super(maybeLength); 14630 this.str = str; 14631 this.dict = str.dict; 14632 this.firstDigit = -1; 14633 } 14634 readBlock() { 14635 const UPSTREAM_BLOCK_SIZE = 8000; 14636 const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE); 14637 if (!bytes.length) { 14638 this.eof = true; 14639 return; 14640 } 14641 const maxDecodeLength = bytes.length + 1 >> 1; 14642 const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); 14643 let bufferLength = this.bufferLength; 14644 let firstDigit = this.firstDigit; 14645 for (const ch of bytes) { 14646 let digit; 14647 if (ch >= 0x30 && ch <= 0x39) { 14648 digit = ch & 0x0f; 14649 } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 14650 digit = (ch & 0x0f) + 9; 14651 } else if (ch === 0x3e) { 14652 this.eof = true; 14653 break; 14654 } else { 14655 continue; 14656 } 14657 if (firstDigit < 0) { 14658 firstDigit = digit; 14659 } else { 14660 buffer[bufferLength++] = firstDigit << 4 | digit; 14661 firstDigit = -1; 14662 } 14663 } 14664 if (firstDigit >= 0 && this.eof) { 14665 buffer[bufferLength++] = firstDigit << 4; 14666 firstDigit = -1; 14667 } 14668 this.firstDigit = firstDigit; 14669 this.bufferLength = bufferLength; 14670 } 14671} 14672exports.AsciiHexStream = AsciiHexStream; 14673 14674/***/ }), 14675/* 20 */ 14676/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 14677 14678 14679 14680Object.defineProperty(exports, "__esModule", ({ 14681 value: true 14682})); 14683exports.CCITTFaxStream = void 0; 14684var _ccitt = __w_pdfjs_require__(21); 14685var _decode_stream = __w_pdfjs_require__(18); 14686var _primitives = __w_pdfjs_require__(4); 14687class CCITTFaxStream extends _decode_stream.DecodeStream { 14688 constructor(str, maybeLength, params) { 14689 super(maybeLength); 14690 this.str = str; 14691 this.dict = str.dict; 14692 if (!(params instanceof _primitives.Dict)) { 14693 params = _primitives.Dict.empty; 14694 } 14695 const source = { 14696 next() { 14697 return str.getByte(); 14698 } 14699 }; 14700 this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, { 14701 K: params.get("K"), 14702 EndOfLine: params.get("EndOfLine"), 14703 EncodedByteAlign: params.get("EncodedByteAlign"), 14704 Columns: params.get("Columns"), 14705 Rows: params.get("Rows"), 14706 EndOfBlock: params.get("EndOfBlock"), 14707 BlackIs1: params.get("BlackIs1") 14708 }); 14709 } 14710 readBlock() { 14711 while (!this.eof) { 14712 const c = this.ccittFaxDecoder.readNextChar(); 14713 if (c === -1) { 14714 this.eof = true; 14715 return; 14716 } 14717 this.ensureBuffer(this.bufferLength + 1); 14718 this.buffer[this.bufferLength++] = c; 14719 } 14720 } 14721} 14722exports.CCITTFaxStream = CCITTFaxStream; 14723 14724/***/ }), 14725/* 21 */ 14726/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 14727 14728 14729 14730Object.defineProperty(exports, "__esModule", ({ 14731 value: true 14732})); 14733exports.CCITTFaxDecoder = void 0; 14734var _util = __w_pdfjs_require__(2); 14735const ccittEOL = -2; 14736const ccittEOF = -1; 14737const twoDimPass = 0; 14738const twoDimHoriz = 1; 14739const twoDimVert0 = 2; 14740const twoDimVertR1 = 3; 14741const twoDimVertL1 = 4; 14742const twoDimVertR2 = 5; 14743const twoDimVertL2 = 6; 14744const twoDimVertR3 = 7; 14745const twoDimVertL3 = 8;
14746const 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]]; 14747const 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]]; 14748const 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]];
14749const 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]]; 14750const 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]]; 14751const 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]]; 14752class CCITTFaxDecoder { 14753 constructor(source, options = {}) { 14754 if (!source || typeof source
vendor: 6,358 bytes, lines 14754-14936
14754.next !== "function") { 14755 throw new Error('CCITTFaxDecoder - invalid "source" parameter.'); 14756 } 14757 this.source = source; 14758 this.eof = false; 14759 this.encoding = options.K || 0; 14760 this.eoline = options.EndOfLine || false; 14761 this.byteAlign = options.EncodedByteAlign || false; 14762 this.columns = options.Columns || 1728; 14763 this.rows = options.Rows || 0; 14764 this.eoblock = options.EndOfBlock ?? true; 14765 this.black = options.BlackIs1 || false; 14766 this.codingLine = new Uint32Array(this.columns + 1); 14767 this.refLine = new Uint32Array(this.columns + 2); 14768 this.codingLine[0] = this.columns; 14769 this.codingPos = 0; 14770 this.row = 0; 14771 this.nextLine2D = this.encoding < 0; 14772 this.inputBits = 0; 14773 this.inputBuf = 0; 14774 this.outputBits = 0; 14775 this.rowsDone = false; 14776 let code1; 14777 while ((code1 = this._lookBits(12)) === 0) { 14778 this._eatBits(1); 14779 } 14780 if (code1 === 1) { 14781 this._eatBits(12); 14782 } 14783 if (this.encoding > 0) { 14784 this.nextLine2D = !this._lookBits(1); 14785 this._eatBits(1); 14786 } 14787 } 14788 readNextChar() { 14789 if (this.eof) { 14790 return -1; 14791 } 14792 const refLine = this.refLine; 14793 const codingLine = this.codingLine; 14794 const columns = this.columns; 14795 let refPos, blackPixels, bits, i; 14796 if (this.outputBits === 0) { 14797 if (this.rowsDone) { 14798 this.eof = true; 14799 } 14800 if (this.eof) { 14801 return -1; 14802 } 14803 this.err = false; 14804 let code1, code2, code3; 14805 if (this.nextLine2D) { 14806 for (i = 0; codingLine[i] < columns; ++i) { 14807 refLine[i] = codingLine[i]; 14808 } 14809 refLine[i++] = columns; 14810 refLine[i] = columns; 14811 codingLine[0] = 0; 14812 this.codingPos = 0; 14813 refPos = 0; 14814 blackPixels = 0; 14815 while (codingLine[this.codingPos] < columns) { 14816 code1 = this._getTwoDimCode(); 14817 switch (code1) { 14818 case twoDimPass: 14819 this._addPixels(refLine[refPos + 1], blackPixels); 14820 if (refLine[refPos + 1] < columns) { 14821 refPos += 2; 14822 } 14823 break; 14824 case twoDimHoriz: 14825 code1 = code2 = 0; 14826 if (blackPixels) { 14827 do { 14828 code1 += code3 = this._getBlackCode(); 14829 } while (code3 >= 64); 14830 do { 14831 code2 += code3 = this._getWhiteCode(); 14832 } while (code3 >= 64); 14833 } else { 14834 do { 14835 code1 += code3 = this._getWhiteCode(); 14836 } while (code3 >= 64); 14837 do { 14838 code2 += code3 = this._getBlackCode(); 14839 } while (code3 >= 64); 14840 } 14841 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 14842 if (codingLine[this.codingPos] < columns) { 14843 this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1); 14844 } 14845 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 14846 refPos += 2; 14847 } 14848 break; 14849 case twoDimVertR3: 14850 this._addPixels(refLine[refPos] + 3, blackPixels); 14851 blackPixels ^= 1; 14852 if (codingLine[this.codingPos] < columns) { 14853 ++refPos; 14854 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 14855 refPos += 2; 14856 } 14857 } 14858 break; 14859 case twoDimVertR2: 14860 this._addPixels(refLine[refPos] + 2, blackPixels); 14861 blackPixels ^= 1; 14862 if (codingLine[this.codingPos] < columns) { 14863 ++refPos; 14864 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 14865 refPos += 2; 14866 } 14867 } 14868 break; 14869 case twoDimVertR1: 14870 this._addPixels(refLine[refPos] + 1, blackPixels); 14871 blackPixels ^= 1; 14872 if (codingLine[this.codingPos] < columns) { 14873 ++refPos; 14874 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 14875 refPos += 2; 14876 } 14877 } 14878 break; 14879 case twoDimVert0: 14880 this._addPixels(refLine[refPos], blackPixels); 14881 blackPixels ^= 1; 14882 if (codingLine[this.codingPos] < columns) { 14883 ++refPos; 14884 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 14885 refPos += 2; 14886 } 14887 } 14888 break; 14889 case twoDimVertL3: 14890 this._addPixelsNeg(refLine[refPos] - 3, blackPixels); 14891 blackPixels ^= 1; 14892 if (codingLine[this.codingPos] < columns) { 14893 if (refPos > 0) { 14894 --refPos; 14895 } else { 14896 ++refPos; 14897 } 14898 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 14899 refPos += 2; 14900 } 14901 } 14902 break; 14903 case twoDimVertL2: 14904 this._addPixelsNeg(refLine[refPos] - 2, blackPixels); 14905 blackPixels ^= 1; 14906 if (codingLine[this.codingPos] < columns) { 14907 if (refPos > 0) { 14908 --refPos; 14909 } else { 14910 ++refPos; 14911 } 14912 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 14913 refPos += 2; 14914 } 14915 } 14916 break; 14917 case twoDimVertL1: 14918 this._addPixelsNeg(refLine[refPos] - 1, blackPixels); 14919 blackPixels ^= 1; 14920 if (codingLine[this.codingPos] < columns) { 14921 if (refPos > 0) { 14922 --refPos; 14923 } else { 14924 ++refPos; 14925 } 14926 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 14927 refPos += 2; 14928 } 14929 } 14930 break; 14931 case ccittEOF: 14932 this._addPixels(columns, 0); 14933 this.eof = true; 14934 break; 14935 default: 14936
vendor: 11,359 bytes, lines 14936-15259
14936(0, _util.info)("bad 2d code"); 14937 this._addPixels(columns, 0); 14938 this.err = true; 14939 } 14940 } 14941 } else { 14942 codingLine[0] = 0; 14943 this.codingPos = 0; 14944 blackPixels = 0; 14945 while (codingLine[this.codingPos] < columns) { 14946 code1 = 0; 14947 if (blackPixels) { 14948 do { 14949 code1 += code3 = this._getBlackCode(); 14950 } while (code3 >= 64); 14951 } else { 14952 do { 14953 code1 += code3 = this._getWhiteCode(); 14954 } while (code3 >= 64); 14955 } 14956 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 14957 blackPixels ^= 1; 14958 } 14959 } 14960 let gotEOL = false; 14961 if (this.byteAlign) { 14962 this.inputBits &= ~7; 14963 } 14964 if (!this.eoblock && this.row === this.rows - 1) { 14965 this.rowsDone = true; 14966 } else { 14967 code1 = this._lookBits(12); 14968 if (this.eoline) { 14969 while (code1 !== ccittEOF && code1 !== 1) { 14970 this._eatBits(1); 14971 code1 = this._lookBits(12); 14972 } 14973 } else { 14974 while (code1 === 0) { 14975 this._eatBits(1); 14976 code1 = this._lookBits(12); 14977 } 14978 } 14979 if (code1 === 1) { 14980 this._eatBits(12); 14981 gotEOL = true; 14982 } else if (code1 === ccittEOF) { 14983 this.eof = true; 14984 } 14985 } 14986 if (!this.eof && this.encoding > 0 && !this.rowsDone) { 14987 this.nextLine2D = !this._lookBits(1); 14988 this._eatBits(1); 14989 } 14990 if (this.eoblock && gotEOL && this.byteAlign) { 14991 code1 = this._lookBits(12); 14992 if (code1 === 1) { 14993 this._eatBits(12); 14994 if (this.encoding > 0) { 14995 this._lookBits(1); 14996 this._eatBits(1); 14997 } 14998 if (this.encoding >= 0) { 14999 for (i = 0; i < 4; ++i) { 15000 code1 = this._lookBits(12); 15001 if (code1 !== 1) { 15002 (0, _util.info)("bad rtc code: " + code1); 15003 } 15004 this._eatBits(12); 15005 if (this.encoding > 0) { 15006 this._lookBits(1); 15007 this._eatBits(1); 15008 } 15009 } 15010 } 15011 this.eof = true; 15012 } 15013 } else if (this.err && this.eoline) { 15014 while (true) { 15015 code1 = this._lookBits(13); 15016 if (code1 === ccittEOF) { 15017 this.eof = true; 15018 return -1; 15019 } 15020 if (code1 >> 1 === 1) { 15021 break; 15022 } 15023 this._eatBits(1); 15024 } 15025 this._eatBits(12); 15026 if (this.encoding > 0) { 15027 this._eatBits(1); 15028 this.nextLine2D = !(code1 & 1); 15029 } 15030 } 15031 this.outputBits = codingLine[0] > 0 ? codingLine[this.codingPos = 0] : codingLine[this.codingPos = 1]; 15032 this.row++; 15033 } 15034 let c; 15035 if (this.outputBits >= 8) { 15036 c = this.codingPos & 1 ? 0 : 0xff; 15037 this.outputBits -= 8; 15038 if (this.outputBits === 0 && codingLine[this.codingPos] < columns) { 15039 this.codingPos++; 15040 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 15041 } 15042 } else { 15043 bits = 8; 15044 c = 0; 15045 do { 15046 if (typeof this.outputBits !== "number") { 15047 throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.'); 15048 } 15049 if (this.outputBits > bits) { 15050 c <<= bits; 15051 if (!(this.codingPos & 1)) { 15052 c |= 0xff >> 8 - bits; 15053 } 15054 this.outputBits -= bits; 15055 bits = 0; 15056 } else { 15057 c <<= this.outputBits; 15058 if (!(this.codingPos & 1)) { 15059 c |= 0xff >> 8 - this.outputBits; 15060 } 15061 bits -= this.outputBits; 15062 this.outputBits = 0; 15063 if (codingLine[this.codingPos] < columns) { 15064 this.codingPos++; 15065 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 15066 } else if (bits > 0) { 15067 c <<= bits; 15068 bits = 0; 15069 } 15070 } 15071 } while (bits); 15072 } 15073 if (this.black) { 15074 c ^= 0xff; 15075 } 15076 return c; 15077 } 15078 _addPixels(a1, blackPixels) { 15079 const codingLine = this.codingLine; 15080 let codingPos = this.codingPos; 15081 if (a1 > codingLine[codingPos]) { 15082 if (a1 > this.columns) { 15083 (0, _util.info)("row is wrong length"); 15084 this.err = true; 15085 a1 = this.columns; 15086 } 15087 if (codingPos & 1 ^ blackPixels) { 15088 ++codingPos; 15089 } 15090 codingLine[codingPos] = a1; 15091 } 15092 this.codingPos = codingPos; 15093 } 15094 _addPixelsNeg(a1, blackPixels) { 15095 const codingLine = this.codingLine; 15096 let codingPos = this.codingPos; 15097 if (a1 > codingLine[codingPos]) { 15098 if (a1 > this.columns) { 15099 (0, _util.info)("row is wrong length"); 15100 this.err = true; 15101 a1 = this.columns; 15102 } 15103 if (codingPos & 1 ^ blackPixels) { 15104 ++codingPos; 15105 } 15106 codingLine[codingPos] = a1; 15107 } else if (a1 < codingLine[codingPos]) { 15108 if (a1 < 0) { 15109 (0, _util.info)("invalid code"); 15110 this.err = true; 15111 a1 = 0; 15112 } 15113 while (codingPos > 0 && a1 < codingLine[codingPos - 1]) { 15114 --codingPos; 15115 } 15116 codingLine[codingPos] = a1; 15117 } 15118 this.codingPos = codingPos; 15119 } 15120 _findTableCode(start, end, table, limit) { 15121 const limitValue = limit || 0; 15122 for (let i = start; i <= end; ++i) { 15123 let code = this._lookBits(i); 15124 if (code === ccittEOF) { 15125 return [true, 1, false]; 15126 } 15127 if (i < end) { 15128 code <<= end - i; 15129 } 15130 if (!limitValue || code >= limitValue) { 15131 const p = table[code - limitValue]; 15132 if (p[0] === i) { 15133 this._eatBits(i); 15134 return [true, p[1], true]; 15135 } 15136 } 15137 } 15138 return [false, 0, false]; 15139 } 15140 _getTwoDimCode() { 15141 let code = 0; 15142 let p; 15143 if (this.eoblock) { 15144 code = this._lookBits(7); 15145 p = twoDimTable[code]; 15146 if (p?.[0] > 0) { 15147 this._eatBits(p[0]); 15148 return p[1]; 15149 } 15150 } else { 15151 const result = this._findTableCode(1, 7, twoDimTable); 15152 if (result[0] && result[2]) { 15153 return result[1]; 15154 } 15155 } 15156 (0, _util.info)("Bad two dim code"); 15157 return ccittEOF; 15158 } 15159 _getWhiteCode() { 15160 let code = 0; 15161 let p; 15162 if (this.eoblock) { 15163 code = this._lookBits(12); 15164 if (code === ccittEOF) { 15165 return 1; 15166 } 15167 p = code >> 5 === 0 ? whiteTable1[code] : whiteTable2[code >> 3]; 15168 if (p[0] > 0) { 15169 this._eatBits(p[0]); 15170 return p[1]; 15171 } 15172 } else { 15173 let result = this._findTableCode(1, 9, whiteTable2); 15174 if (result[0]) { 15175 return result[1]; 15176 } 15177 result = this._findTableCode(11, 12, whiteTable1); 15178 if (result[0]) { 15179 return result[1]; 15180 } 15181 } 15182 (0, _util.info)("bad white code"); 15183 this._eatBits(1); 15184 return 1; 15185 } 15186 _getBlackCode() { 15187 let code, p; 15188 if (this.eoblock) { 15189 code = this._lookBits(13); 15190 if (code === ccittEOF) { 15191 return 1; 15192 } 15193 if (code >> 7 === 0) { 15194 p = blackTable1[code]; 15195 } else if (code >> 9 === 0 && code >> 7 !== 0) { 15196 p = blackTable2[(code >> 1) - 64]; 15197 } else { 15198 p = blackTable3[code >> 7]; 15199 } 15200 if (p[0] > 0) { 15201 this._eatBits(p[0]); 15202 return p[1]; 15203 } 15204 } else { 15205 let result = this._findTableCode(2, 6, blackTable3); 15206 if (result[0]) { 15207 return result[1]; 15208 } 15209 result = this._findTableCode(7, 12, blackTable2, 64); 15210 if (result[0]) { 15211 return result[1]; 15212 } 15213 result = this._findTableCode(10, 13, blackTable1); 15214 if (result[0]) { 15215 return result[1]; 15216 } 15217 } 15218 (0, _util.info)("bad black code"); 15219 this._eatBits(1); 15220 return 1; 15221 } 15222 _lookBits(n) { 15223 let c; 15224 while (this.inputBits < n) { 15225 if ((c = this.source.next()) === -1) { 15226 if (this.inputBits === 0) { 15227 return ccittEOF; 15228 } 15229 return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n; 15230 } 15231 this.inputBuf = this.inputBuf << 8 | c; 15232 this.inputBits += 8; 15233 } 15234 return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n; 15235 } 15236 _eatBits(n) { 15237 if ((this.inputBits -= n) < 0) { 15238 this.inputBits = 0; 15239 } 15240 } 15241} 15242exports.CCITTFaxDecoder = CCITTFaxDecoder; 15243 15244/***/ }), 15245/* 22 */ 15246/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 15247 15248 15249 15250Object.defineProperty(exports, "__esModule", ({ 15251 value: true 15252})); 15253exports.FlateStream = void 0; 15254var _decode_stream = __w_pdfjs_require__(18); 15255var _util = __w_pdfjs_require__(2); 15256const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); 15257const 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]); 15258const 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]); 15259const 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,
152590x900f6, 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]; 15260const 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]; 15261class FlateStream extends _decode_stream.DecodeStream { 15262 constructor(str, maybeLength) { 15263 super(maybeLength); 15264 this.str = str; 15265 this.dict = str.dict; 15266 const cmf = str.getByte(); 15267 const flg = str.getByte(); 15268 if (cmf === -1 || flg === -1) { 15269 throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`); 15270 } 15271 if ((cmf & 0x0f) !== 0x08) { 15272 throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`); 15273 } 15274 if (((cmf << 8) + flg) % 31 !== 0) { 15275 throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`); 15276 } 15277 if (flg & 0x20) { 15278 throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`); 15279 } 15280 this.codeSize = 0; 15281 this.codeBuf = 0; 15282 } 15283 getBits(bits) { 15284 const str = this.str; 15285 let codeSize = this.codeSize; 15286 let codeBuf = this.codeBuf; 15287 let b; 15288 while (codeSize < bits) { 15289 if ((b = str.getByte()) === -1) { 15290 throw new _util.FormatError("Bad encoding in flate stream"); 15291 } 15292 codeBuf |= b << codeSize; 15293 codeSize += 8; 15294 } 15295 b = codeBuf & (1 << bits) - 1; 15296 this.codeBuf = codeBuf >> bits; 15297 this.codeSize = codeSize -= bits; 15298 return b; 15299 } 15300 getCode(table) { 15301 const str = this.str; 15302 const codes = table[0]; 15303 const maxLen = table[1];
vendor: 5,129 bytes, lines 15304-15472
15304 let codeSize = this.codeSize; 15305 let codeBuf = this.codeBuf; 15306 let b; 15307 while (codeSize < maxLen) { 15308 if ((b = str.getByte()) === -1) { 15309 break; 15310 } 15311 codeBuf |= b << codeSize; 15312 codeSize += 8; 15313 } 15314 const code = codes[codeBuf & (1 << maxLen) - 1]; 15315 const codeLen = code >> 16; 15316 const codeVal = code & 0xffff; 15317 if (codeLen < 1 || codeSize < codeLen) { 15318 throw new _util.FormatError("Bad encoding in flate stream"); 15319 } 15320 this.codeBuf = codeBuf >> codeLen; 15321 this.codeSize = codeSize - codeLen; 15322 return codeVal; 15323 } 15324 generateHuffmanTable(lengths) { 15325 const n = lengths.length; 15326 let maxLen = 0; 15327 let i; 15328 for (i = 0; i < n; ++i) { 15329 if (lengths[i] > maxLen) { 15330 maxLen = lengths[i]; 15331 } 15332 } 15333 const size = 1 << maxLen; 15334 const codes = new Int32Array(size); 15335 for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) { 15336 for (let val = 0; val < n; ++val) { 15337 if (lengths[val] === len) { 15338 let code2 = 0; 15339 let t = code; 15340 for (i = 0; i < len; ++i) { 15341 code2 = code2 << 1 | t & 1; 15342 t >>= 1; 15343 } 15344 for (i = code2; i < size; i += skip) { 15345 codes[i] = len << 16 | val; 15346 } 15347 ++code; 15348 } 15349 } 15350 } 15351 return [codes, maxLen]; 15352 } 15353 readBlock() { 15354 let buffer, len; 15355 const str = this.str; 15356 let hdr = this.getBits(3); 15357 if (hdr & 1) { 15358 this.eof = true; 15359 } 15360 hdr >>= 1; 15361 if (hdr === 0) { 15362 let b; 15363 if ((b = str.getByte()) === -1) { 15364 throw new _util.FormatError("Bad block header in flate stream"); 15365 } 15366 let blockLen = b; 15367 if ((b = str.getByte()) === -1) { 15368 throw new _util.FormatError("Bad block header in flate stream"); 15369 } 15370 blockLen |= b << 8; 15371 if ((b = str.getByte()) === -1) { 15372 throw new _util.FormatError("Bad block header in flate stream"); 15373 } 15374 let check = b; 15375 if ((b = str.getByte()) === -1) { 15376 throw new _util.FormatError("Bad block header in flate stream"); 15377 } 15378 check |= b << 8; 15379 if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) { 15380 throw new _util.FormatError("Bad uncompressed block length in flate stream"); 15381 } 15382 this.codeBuf = 0; 15383 this.codeSize = 0; 15384 const bufferLength = this.bufferLength, 15385 end = bufferLength + blockLen; 15386 buffer = this.ensureBuffer(end); 15387 this.bufferLength = end; 15388 if (blockLen === 0) { 15389 if (str.peekByte() === -1) { 15390 this.eof = true; 15391 } 15392 } else { 15393 const block = str.getBytes(blockLen); 15394 buffer.set(block, bufferLength); 15395 if (block.length < blockLen) { 15396 this.eof = true; 15397 } 15398 } 15399 return; 15400 } 15401 let litCodeTable; 15402 let distCodeTable; 15403 if (hdr === 1) { 15404 litCodeTable = fixedLitCodeTab; 15405 distCodeTable = fixedDistCodeTab; 15406 } else if (hdr === 2) { 15407 const numLitCodes = this.getBits(5) + 257; 15408 const numDistCodes = this.getBits(5) + 1; 15409 const numCodeLenCodes = this.getBits(4) + 4; 15410 const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); 15411 let i; 15412 for (i = 0; i < numCodeLenCodes; ++i) { 15413 codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); 15414 } 15415 const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); 15416 len = 0; 15417 i = 0; 15418 const codes = numLitCodes + numDistCodes; 15419 const codeLengths = new Uint8Array(codes); 15420 let bitsLength, bitsOffset, what; 15421 while (i < codes) { 15422 const code = this.getCode(codeLenCodeTab); 15423 if (code === 16) { 15424 bitsLength = 2; 15425 bitsOffset = 3; 15426 what = len; 15427 } else if (code === 17) { 15428 bitsLength = 3; 15429 bitsOffset = 3; 15430 what = len = 0; 15431 } else if (code === 18) { 15432 bitsLength = 7; 15433 bitsOffset = 11; 15434 what = len = 0; 15435 } else { 15436 codeLengths[i++] = len = code; 15437 continue; 15438 } 15439 let repeatLength = this.getBits(bitsLength) + bitsOffset; 15440 while (repeatLength-- > 0) { 15441 codeLengths[i++] = what; 15442 } 15443 } 15444 litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); 15445 distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); 15446 } else { 15447 throw new _util.FormatError("Unknown block type in flate stream"); 15448 } 15449 buffer = this.buffer; 15450 let limit = buffer ? buffer.length : 0; 15451 let pos = this.bufferLength; 15452 while (true) { 15453 let code1 = this.getCode(litCodeTable); 15454 if (code1 < 256) { 15455 if (pos + 1 >= limit) { 15456 buffer = this.ensureBuffer(pos + 1); 15457 limit = buffer.length; 15458 } 15459 buffer[pos++] = code1; 15460 continue; 15461 } 15462 if (code1 === 256) { 15463 this.bufferLength = pos; 15464 return; 15465 } 15466 code1 -= 257; 15467 code1 = lengthDecode[code1]; 15468 let code2 = code1 >> 16; 15469 if (code2 > 0) { 15470 code2 = this.getBits(code2); 15471 } 15472 len = (code1 & 0xffff) + code2;
15473 code1 = this.getCode(distCodeTable); 15474 code1 = distDecode[code1]; 15475 code2 = code1 >> 16; 15476 if (code2 > 0) { 15477 code2 = this.getBits(code2); 15478 } 15479 const dist = (code1 & 0xffff) + code2; 15480 if (pos + len >= limit) { 15481 buffer = this.ensureBuffer(pos + len); 15482 limit = buffer.length; 15483 } 15484 for (let k = 0; k < len; ++k, ++pos) { 15485 buffer[pos] = buffer[pos - dist]; 15486 } 15487 } 15488 } 15489} 15490exports.FlateStream = FlateStream; 15491 15492/***/ }), 15493/* 23 */ 15494/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 15495 15496 15497 15498Object.defineProperty(exports, "__esModule", ({ 15499 value: true 15500})); 15501exports.Jbig2Stream = void 0; 15502var _base_stream = __w_pdfjs_require__(5); 15503var _decode_stream = __w_pdfjs_require__(18); 15504var _primitives = __w_pdfjs_require__(4); 15505var _jbig = __w_pdfjs_require__(24); 15506var _util = __w_pdfjs_require__(2); 15507class Jbig2Stream extends _decode_stream.DecodeStream { 15508 constructor(stream, maybeLength, params) { 15509 super(maybeLength); 15510 this.stream = stream; 15511 this.dict = stream.dict; 15512 this.maybeLength = maybeLength; 15513 this.params = params; 15514 } 15515 get bytes() { 15516 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 15517 } 15518 ensureBuffer(requested) {} 15519 readBlock() { 15520 if (this.eof) { 15521 return; 15522 } 15523 const jbig2Image = new _jbig.Jbig2Image(); 15524 const chunks = []; 15525 if (this.params instanceof _primitives.Dict) { 15526 const globalsStream = this.params.get("JBIG2Globals"); 15527 if (globalsStream instanceof _base_stream.BaseStream) { 15528 const globals = globalsStream.getBytes(); 15529 chunks.push({ 15530 data: globals, 15531 start: 0, 15532 end: globals.length 15533 }); 15534 } 15535 } 15536 chunks.push({ 15537 data: this.bytes, 15538 start: 0, 15539 end: this.bytes.length 15540 }); 15541 const data = jbig2Image.parseChunks(chunks); 15542 const dataLength = data.length; 15543 for (let i = 0; i < dataLength; i++) { 15544 data[i] ^= 0xff; 15545 } 15546 this.buffer = data; 15547 this.bufferLength = dataLength; 15548 this.eof = true; 15549 } 15550} 15551exports.Jbig2Stream = Jbig2Stream; 15552 15553/***/ }), 15554/* 24 */ 15555/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 15556 15557 15558 15559Object.defineProperty(exports, "__esModule", ({ 15560 value: true 15561})); 15562exports.Jbig2Image = void 0; 15563var _util = __w_pdfjs_require__(2); 15564var _core_utils = __w_pdfjs_require__(3); 15565var _arithmetic_decoder = __w_pdfjs_require__(25); 15566var _ccitt = __w_pdfjs_require__(21); 15567class Jbig2Error extends _util.BaseException { 15568 constructor(msg) { 15569 super(`JBIG2 error: ${msg}`, "Jbig2Error"); 15570 } 15571} 15572class ContextCache { 15573 getContexts(id) { 15574 if (id in this) { 15575 return this[id]; 15576 } 15577 return this[id] = new Int8Array(1 << 16); 15578 } 15579} 15580class DecodingContext { 15581 constructor(data, start, end) { 15582 this.data = data; 15583 this.start = start; 15584 this.end = end; 15585 } 15586 get decoder() { 15587 const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end); 15588 return (0, _util.shadow)(this, "decoder", decoder); 15589 } 15590 get contextCache() { 15591 const cache = new ContextCache(); 15592 return (0, _util.shadow)(this, "contextCache", cache); 15593 } 15594} 15595const MAX_INT_32 = 2 ** 31 - 1; 15596const MIN_INT_32 = -(2 ** 31); 15597function decodeInteger(contextCache, procedure, decoder) { 15598 const contexts = contextCache.getContexts(procedure); 15599 let prev = 1; 15600 function readBits(length) { 15601 let v = 0; 15602 for (let i = 0; i < length; i++) { 15603 const bit = decoder.readBit(contexts, prev); 15604 prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256; 15605 v = v << 1 | bit; 15606 } 15607 return v >>> 0; 15608 } 15609 const sign = readBits(1); 15610 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); 15611 let signedValue; 15612 if (sign === 0) { 15613 signedValue = value; 15614 } else if (value > 0) { 15615 signedValue = -value; 15616 } 15617 if (signedValue >= MIN_INT_32 && signedValue <= MAX_INT_32) { 15618 return signedValue; 15619 } 15620 return null; 15621}
vendor: 45,316 bytes, lines 15622-16963
15622function decodeIAID(contextCache, decoder, codeLength) { 15623 const contexts = contextCache.getContexts("IAID"); 15624 let prev = 1; 15625 for (let i = 0; i < codeLength; i++) { 15626 const bit = decoder.readBit(contexts, prev); 15627 prev = prev << 1 | bit; 15628 } 15629 if (codeLength < 31) { 15630 return prev & (1 << codeLength) - 1; 15631 } 15632 return prev & 0x7fffffff; 15633} 15634const 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"]; 15635const CodingTemplates = [[{ 15636 x: -1, 15637 y: -2 15638}, { 15639 x: 0, 15640 y: -2 15641}, { 15642 x: 1, 15643 y: -2 15644}, { 15645 x: -2, 15646 y: -1 15647}, { 15648 x: -1, 15649 y: -1 15650}, { 15651 x: 0, 15652 y: -1 15653}, { 15654 x: 1, 15655 y: -1 15656}, { 15657 x: 2, 15658 y: -1 15659}, { 15660 x: -4, 15661 y: 0 15662}, { 15663 x: -3, 15664 y: 0 15665}, { 15666 x: -2, 15667 y: 0 15668}, { 15669 x: -1, 15670 y: 0 15671}], [{ 15672 x: -1, 15673 y: -2 15674}, { 15675 x: 0, 15676 y: -2 15677}, { 15678 x: 1, 15679 y: -2 15680}, { 15681 x: 2, 15682 y: -2 15683}, { 15684 x: -2, 15685 y: -1 15686}, { 15687 x: -1, 15688 y: -1 15689}, { 15690 x: 0, 15691 y: -1 15692}, { 15693 x: 1, 15694 y: -1 15695}, { 15696 x: 2, 15697 y: -1 15698}, { 15699 x: -3, 15700 y: 0 15701}, { 15702 x: -2, 15703 y: 0 15704}, { 15705 x: -1, 15706 y: 0 15707}], [{ 15708 x: -1, 15709 y: -2 15710}, { 15711 x: 0, 15712 y: -2 15713}, { 15714 x: 1, 15715 y: -2 15716}, { 15717 x: -2, 15718 y: -1 15719}, { 15720 x: -1, 15721 y: -1 15722}, { 15723 x: 0, 15724 y: -1 15725}, { 15726 x: 1, 15727 y: -1 15728}, { 15729 x: -2, 15730 y: 0 15731}, { 15732 x: -1, 15733 y: 0 15734}], [{ 15735 x: -3, 15736 y: -1 15737}, { 15738 x: -2, 15739 y: -1 15740}, { 15741 x: -1, 15742 y: -1 15743}, { 15744 x: 0, 15745 y: -1 15746}, { 15747 x: 1, 15748 y: -1 15749}, { 15750 x: -4, 15751 y: 0 15752}, { 15753 x: -3, 15754 y: 0 15755}, { 15756 x: -2, 15757 y: 0 15758}, { 15759 x: -1, 15760 y: 0 15761}]]; 15762const RefinementTemplates = [{ 15763 coding: [{ 15764 x: 0, 15765 y: -1 15766 }, { 15767 x: 1, 15768 y: -1 15769 }, { 15770 x: -1, 15771 y: 0 15772 }], 15773 reference: [{ 15774 x: 0, 15775 y: -1 15776 }, { 15777 x: 1, 15778 y: -1 15779 }, { 15780 x: -1, 15781 y: 0 15782 }, { 15783 x: 0, 15784 y: 0 15785 }, { 15786 x: 1, 15787 y: 0 15788 }, { 15789 x: -1, 15790 y: 1 15791 }, { 15792 x: 0, 15793 y: 1 15794 }, { 15795 x: 1, 15796 y: 1 15797 }] 15798}, { 15799 coding: [{ 15800 x: -1, 15801 y: -1 15802 }, { 15803 x: 0, 15804 y: -1 15805 }, { 15806 x: 1, 15807 y: -1 15808 }, { 15809 x: -1, 15810 y: 0 15811 }], 15812 reference: [{ 15813 x: 0, 15814 y: -1 15815 }, { 15816 x: -1, 15817 y: 0 15818 }, { 15819 x: 0, 15820 y: 0 15821 }, { 15822 x: 1, 15823 y: 0 15824 }, { 15825 x: 0, 15826 y: 1 15827 }, { 15828 x: 1, 15829 y: 1 15830 }] 15831}]; 15832const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195]; 15833const RefinementReusedContexts = [0x0020, 0x0008]; 15834function decodeBitmapTemplate0(width, height, decodingContext) { 15835 const decoder = decodingContext.decoder; 15836 const contexts = decodingContext.contextCache.getContexts("GB"); 15837 const bitmap = []; 15838 let contextLabel, i, j, pixel, row, row1, row2; 15839 const OLD_PIXEL_MASK = 0x7bf7; 15840 for (i = 0; i < height; i++) { 15841 row = bitmap[i] = new Uint8Array(width); 15842 row1 = i < 1 ? row : bitmap[i - 1]; 15843 row2 = i < 2 ? row : bitmap[i - 2]; 15844 contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4; 15845 for (j = 0; j < width; j++) { 15846 row[j] = pixel = decoder.readBit(contexts, contextLabel); 15847 contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel; 15848 } 15849 } 15850 return bitmap; 15851} 15852function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) { 15853 if (mmr) { 15854 const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 15855 return decodeMMRBitmap(input, width, height, false); 15856 } 15857 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) { 15858 return decodeBitmapTemplate0(width, height, decodingContext); 15859 } 15860 const useskip = !!skip; 15861 const template = CodingTemplates[templateIndex].concat(at); 15862 template.sort(function (a, b) { 15863 return a.y - b.y || a.x - b.x; 15864 }); 15865 const templateLength = template.length; 15866 const templateX = new Int8Array(templateLength); 15867 const templateY = new Int8Array(templateLength); 15868 const changingTemplateEntries = []; 15869 let reuseMask = 0, 15870 minX = 0, 15871 maxX = 0, 15872 minY = 0; 15873 let c, k; 15874 for (k = 0; k < templateLength; k++) { 15875 templateX[k] = template[k].x; 15876 templateY[k] = template[k].y; 15877 minX = Math.min(minX, template[k].x); 15878 maxX = Math.max(maxX, template[k].x); 15879 minY = Math.min(minY, template[k].y); 15880 if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) { 15881 reuseMask |= 1 << templateLength - 1 - k; 15882 } else { 15883 changingTemplateEntries.push(k); 15884 } 15885 } 15886 const changingEntriesLength = changingTemplateEntries.length; 15887 const changingTemplateX = new Int8Array(changingEntriesLength); 15888 const changingTemplateY = new Int8Array(changingEntriesLength); 15889 const changingTemplateBit = new Uint16Array(changingEntriesLength); 15890 for (c = 0; c < changingEntriesLength; c++) { 15891 k = changingTemplateEntries[c]; 15892 changingTemplateX[c] = template[k].x; 15893 changingTemplateY[c] = template[k].y; 15894 changingTemplateBit[c] = 1 << templateLength - 1 - k; 15895 } 15896 const sbb_left = -minX; 15897 const sbb_top = -minY; 15898 const sbb_right = width - maxX; 15899 const pseudoPixelContext = ReusedContexts[templateIndex]; 15900 let row = new Uint8Array(width); 15901 const bitmap = []; 15902 const decoder = decodingContext.decoder; 15903 const contexts = decodingContext.contextCache.getContexts("GB"); 15904 let ltp = 0, 15905 j, 15906 i0, 15907 j0, 15908 contextLabel = 0, 15909 bit, 15910 shift; 15911 for (let i = 0; i < height; i++) { 15912 if (prediction) { 15913 const sltp = decoder.readBit(contexts, pseudoPixelContext); 15914 ltp ^= sltp; 15915 if (ltp) { 15916 bitmap.push(row); 15917 continue; 15918 } 15919 } 15920 row = new Uint8Array(row); 15921 bitmap.push(row); 15922 for (j = 0; j < width; j++) { 15923 if (useskip && skip[i][j]) { 15924 row[j] = 0; 15925 continue; 15926 } 15927 if (j >= sbb_left && j < sbb_right && i >= sbb_top) { 15928 contextLabel = contextLabel << 1 & reuseMask; 15929 for (k = 0; k < changingEntriesLength; k++) { 15930 i0 = i + changingTemplateY[k]; 15931 j0 = j + changingTemplateX[k]; 15932 bit = bitmap[i0][j0]; 15933 if (bit) { 15934 bit = changingTemplateBit[k]; 15935 contextLabel |= bit; 15936 } 15937 } 15938 } else { 15939 contextLabel = 0; 15940 shift = templateLength - 1; 15941 for (k = 0; k < templateLength; k++, shift--) { 15942 j0 = j + templateX[k]; 15943 if (j0 >= 0 && j0 < width) { 15944 i0 = i + templateY[k]; 15945 if (i0 >= 0) { 15946 bit = bitmap[i0][j0]; 15947 if (bit) { 15948 contextLabel |= bit << shift; 15949 } 15950 } 15951 } 15952 } 15953 } 15954 const pixel = decoder.readBit(contexts, contextLabel); 15955 row[j] = pixel; 15956 } 15957 } 15958 return bitmap; 15959} 15960function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) { 15961 let codingTemplate = RefinementTemplates[templateIndex].coding; 15962 if (templateIndex === 0) { 15963 codingTemplate = codingTemplate.concat([at[0]]); 15964 } 15965 const codingTemplateLength = codingTemplate.length; 15966 const codingTemplateX = new Int32Array(codingTemplateLength); 15967 const codingTemplateY = new Int32Array(codingTemplateLength); 15968 let k; 15969 for (k = 0; k < codingTemplateLength; k++) { 15970 codingTemplateX[k] = codingTemplate[k].x; 15971 codingTemplateY[k] = codingTemplate[k].y; 15972 } 15973 let referenceTemplate = RefinementTemplates[templateIndex].reference; 15974 if (templateIndex === 0) { 15975 referenceTemplate = referenceTemplate.concat([at[1]]); 15976 } 15977 const referenceTemplateLength = referenceTemplate.length; 15978 const referenceTemplateX = new Int32Array(referenceTemplateLength); 15979 const referenceTemplateY = new Int32Array(referenceTemplateLength); 15980 for (k = 0; k < referenceTemplateLength; k++) { 15981 referenceTemplateX[k] = referenceTemplate[k].x; 15982 referenceTemplateY[k] = referenceTemplate[k].y; 15983 } 15984 const referenceWidth = referenceBitmap[0].length; 15985 const referenceHeight = referenceBitmap.length; 15986 const pseudoPixelContext = RefinementReusedContexts[templateIndex]; 15987 const bitmap = []; 15988 const decoder = decodingContext.decoder; 15989 const contexts = decodingContext.contextCache.getContexts("GR"); 15990 let ltp = 0; 15991 for (let i = 0; i < height; i++) { 15992 if (prediction) { 15993 const sltp = decoder.readBit(contexts, pseudoPixelContext); 15994 ltp ^= sltp; 15995 if (ltp) { 15996 throw new Jbig2Error("prediction is not supported"); 15997 } 15998 } 15999 const row = new Uint8Array(width); 16000 bitmap.push(row); 16001 for (let j = 0; j < width; j++) { 16002 let i0, j0; 16003 let contextLabel = 0; 16004 for (k = 0; k < codingTemplateLength; k++) { 16005 i0 = i + codingTemplateY[k]; 16006 j0 = j + codingTemplateX[k]; 16007 if (i0 < 0 || j0 < 0 || j0 >= width) { 16008 contextLabel <<= 1; 16009 } else { 16010 contextLabel = contextLabel << 1 | bitmap[i0][j0]; 16011 } 16012 } 16013 for (k = 0; k < referenceTemplateLength; k++) { 16014 i0 = i + referenceTemplateY[k] - offsetY; 16015 j0 = j + referenceTemplateX[k] - offsetX; 16016 if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) { 16017 contextLabel <<= 1; 16018 } else { 16019 contextLabel = contextLabel << 1 | referenceBitmap[i0][j0]; 16020 } 16021 } 16022 const pixel = decoder.readBit(contexts, contextLabel); 16023 row[j] = pixel; 16024 } 16025 } 16026 return bitmap; 16027} 16028function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) { 16029 if (huffman && refinement) { 16030 throw new Jbig2Error("symbol refinement with Huffman is not supported"); 16031 } 16032 const newSymbols = []; 16033 let currentHeight = 0; 16034 let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols); 16035 const decoder = decodingContext.decoder; 16036 const contextCache = decodingContext.contextCache; 16037 let tableB1, symbolWidths; 16038 if (huffman) { 16039 tableB1 = getStandardTable(1); 16040 symbolWidths = []; 16041 symbolCodeLength = Math.max(symbolCodeLength, 1); 16042 } 16043 while (newSymbols.length < numberOfNewSymbols) { 16044 const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder); 16045 currentHeight += deltaHeight; 16046 let currentWidth = 0, 16047 totalWidth = 0; 16048 const firstSymbol = huffman ? symbolWidths.length : 0; 16049 while (true) { 16050 const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder); 16051 if (deltaWidth === null) { 16052 break; 16053 } 16054 currentWidth += deltaWidth; 16055 totalWidth += currentWidth; 16056 let bitmap; 16057 if (refinement) { 16058 const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder); 16059 if (numberOfInstances > 1) { 16060 bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput); 16061 } else { 16062 const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength); 16063 const rdx = decodeInteger(contextCache, "IARDX", decoder); 16064 const rdy = decodeInteger(contextCache, "IARDY", decoder); 16065 const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length]; 16066 bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext); 16067 } 16068 newSymbols.push(bitmap); 16069 } else if (huffman) { 16070 symbolWidths.push(currentWidth); 16071 } else { 16072 bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext); 16073 newSymbols.push(bitmap); 16074 } 16075 } 16076 if (huffman && !refinement) { 16077 const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput); 16078 huffmanInput.byteAlign(); 16079 let collectiveBitmap; 16080 if (bitmapSize === 0) { 16081 collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight); 16082 } else { 16083 const originalEnd = huffmanInput.end; 16084 const bitmapEnd = huffmanInput.position + bitmapSize; 16085 huffmanInput.end = bitmapEnd; 16086 collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false); 16087 huffmanInput.end = originalEnd; 16088 huffmanInput.position = bitmapEnd; 16089 } 16090 const numberOfSymbolsDecoded = symbolWidths.length; 16091 if (firstSymbol === numberOfSymbolsDecoded - 1) { 16092 newSymbols.push(collectiveBitmap); 16093 } else { 16094 let i, 16095 y, 16096 xMin = 0, 16097 xMax, 16098 bitmapWidth, 16099 symbolBitmap; 16100 for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) { 16101 bitmapWidth = symbolWidths[i]; 16102 xMax = xMin + bitmapWidth; 16103 symbolBitmap = []; 16104 for (y = 0; y < currentHeight; y++) { 16105 symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 16106 } 16107 newSymbols.push(symbolBitmap); 16108 xMin = xMax; 16109 } 16110 } 16111 } 16112 } 16113 const exportedSymbols = [], 16114 flags = []; 16115 let currentFlag = false, 16116 i, 16117 ii; 16118 const totalSymbolsLength = symbols.length + numberOfNewSymbols; 16119 while (flags.length < totalSymbolsLength) { 16120 let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder); 16121 while (runLength--) { 16122 flags.push(currentFlag); 16123 } 16124 currentFlag = !currentFlag; 16125 } 16126 for (i = 0, ii = symbols.length; i < ii; i++) { 16127 if (flags[i]) { 16128 exportedSymbols.push(symbols[i]); 16129 } 16130 } 16131 for (let j = 0; j < numberOfNewSymbols; i++, j++) { 16132 if (flags[i]) { 16133 exportedSymbols.push(newSymbols[j]); 16134 } 16135 } 16136 return exportedSymbols; 16137} 16138function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) { 16139 if (huffman && refinement) { 16140 throw new Jbig2Error("refinement with Huffman is not supported"); 16141 } 16142 const bitmap = []; 16143 let i, row; 16144 for (i = 0; i < height; i++) { 16145 row = new Uint8Array(width); 16146 if (defaultPixelValue) { 16147 for (let j = 0; j < width; j++) { 16148 row[j] = defaultPixelValue; 16149 } 16150 } 16151 bitmap.push(row); 16152 } 16153 const decoder = decodingContext.decoder; 16154 const contextCache = decodingContext.contextCache; 16155 let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder); 16156 let firstS = 0; 16157 i = 0; 16158 while (i < numberOfSymbolInstances) { 16159 const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder); 16160 stripT += deltaT; 16161 const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder); 16162 firstS += deltaFirstS; 16163 let currentS = firstS; 16164 do { 16165 let currentT = 0; 16166 if (stripSize > 1) { 16167 currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder); 16168 } 16169 const t = stripSize * stripT + currentT; 16170 const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength); 16171 const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder)); 16172 let symbolBitmap = inputSymbols[symbolId]; 16173 let symbolWidth = symbolBitmap[0].length; 16174 let symbolHeight = symbolBitmap.length; 16175 if (applyRefinement) { 16176 const rdw = decodeInteger(contextCache, "IARDW", decoder); 16177 const rdh = decodeInteger(contextCache, "IARDH", decoder); 16178 const rdx = decodeInteger(contextCache, "IARDX", decoder); 16179 const rdy = decodeInteger(contextCache, "IARDY", decoder); 16180 symbolWidth += rdw; 16181 symbolHeight += rdh; 16182 symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext); 16183 } 16184 const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1); 16185 const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0); 16186 let s2, t2, symbolRow; 16187 if (transposed) { 16188 for (s2 = 0; s2 < symbolHeight; s2++) { 16189 row = bitmap[offsetS + s2]; 16190 if (!row) { 16191 continue; 16192 } 16193 symbolRow = symbolBitmap[s2]; 16194 const maxWidth = Math.min(width - offsetT, symbolWidth); 16195 switch (combinationOperator) { 16196 case 0: 16197 for (t2 = 0; t2 < maxWidth; t2++) { 16198 row[offsetT + t2] |= symbolRow[t2]; 16199 } 16200 break; 16201 case 2: 16202 for (t2 = 0; t2 < maxWidth; t2++) { 16203 row[offsetT + t2] ^= symbolRow[t2]; 16204 } 16205 break; 16206 default: 16207 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 16208 } 16209 } 16210 currentS += symbolHeight - 1; 16211 } else { 16212 for (t2 = 0; t2 < symbolHeight; t2++) { 16213 row = bitmap[offsetT + t2]; 16214 if (!row) { 16215 continue; 16216 } 16217 symbolRow = symbolBitmap[t2]; 16218 switch (combinationOperator) { 16219 case 0: 16220 for (s2 = 0; s2 < symbolWidth; s2++) { 16221 row[offsetS + s2] |= symbolRow[s2]; 16222 } 16223 break; 16224 case 2: 16225 for (s2 = 0; s2 < symbolWidth; s2++) { 16226 row[offsetS + s2] ^= symbolRow[s2]; 16227 } 16228 break; 16229 default: 16230 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 16231 } 16232 } 16233 currentS += symbolWidth - 1; 16234 } 16235 i++; 16236 const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder); 16237 if (deltaS === null) { 16238 break; 16239 } 16240 currentS += deltaS + dsOffset; 16241 } while (true); 16242 } 16243 return bitmap; 16244} 16245function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) { 16246 const at = []; 16247 if (!mmr) { 16248 at.push({ 16249 x: -patternWidth, 16250 y: 0 16251 }); 16252 if (template === 0) { 16253 at.push({ 16254 x: -3, 16255 y: -1 16256 }, { 16257 x: 2, 16258 y: -2 16259 }, { 16260 x: -2, 16261 y: -2 16262 }); 16263 } 16264 } 16265 const collectiveWidth = (maxPatternIndex + 1) * patternWidth; 16266 const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext); 16267 const patterns = []; 16268 for (let i = 0; i <= maxPatternIndex; i++) { 16269 const patternBitmap = []; 16270 const xMin = patternWidth * i; 16271 const xMax = xMin + patternWidth; 16272 for (let y = 0; y < patternHeight; y++) { 16273 patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 16274 } 16275 patterns.push(patternBitmap); 16276 } 16277 return patterns; 16278} 16279function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) { 16280 const skip = null; 16281 if (enableSkip) { 16282 throw new Jbig2Error("skip is not supported"); 16283 } 16284 if (combinationOperator !== 0) { 16285 throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`); 16286 } 16287 const regionBitmap = []; 16288 let i, j, row; 16289 for (i = 0; i < regionHeight; i++) { 16290 row = new Uint8Array(regionWidth); 16291 if (defaultPixelValue) { 16292 for (j = 0; j < regionWidth; j++) { 16293 row[j] = defaultPixelValue; 16294 } 16295 } 16296 regionBitmap.push(row); 16297 } 16298 const numberOfPatterns = patterns.length; 16299 const pattern0 = patterns[0]; 16300 const patternWidth = pattern0[0].length, 16301 patternHeight = pattern0.length; 16302 const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns); 16303 const at = []; 16304 if (!mmr) { 16305 at.push({ 16306 x: template <= 1 ? 3 : 2, 16307 y: -1 16308 }); 16309 if (template === 0) { 16310 at.push({ 16311 x: -3, 16312 y: -1 16313 }, { 16314 x: 2, 16315 y: -2 16316 }, { 16317 x: -2, 16318 y: -2 16319 }); 16320 } 16321 } 16322 const grayScaleBitPlanes = []; 16323 let mmrInput, bitmap; 16324 if (mmr) { 16325 mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 16326 } 16327 for (i = bitsPerValue - 1; i >= 0; i--) { 16328 if (mmr) { 16329 bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true); 16330 } else { 16331 bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext); 16332 } 16333 grayScaleBitPlanes[i] = bitmap; 16334 } 16335 let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow; 16336 for (mg = 0; mg < gridHeight; mg++) { 16337 for (ng = 0; ng < gridWidth; ng++) { 16338 bit = 0; 16339 patternIndex = 0; 16340 for (j = bitsPerValue - 1; j >= 0; j--) { 16341 bit ^= grayScaleBitPlanes[j][mg][ng]; 16342 patternIndex |= bit << j; 16343 } 16344 patternBitmap = patterns[patternIndex]; 16345 x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8; 16346 y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8; 16347 if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) { 16348 for (i = 0; i < patternHeight; i++) { 16349 regionRow = regionBitmap[y + i]; 16350 patternRow = patternBitmap[i]; 16351 for (j = 0; j < patternWidth; j++) { 16352 regionRow[x + j] |= patternRow[j]; 16353 } 16354 } 16355 } else { 16356 let regionX, regionY; 16357 for (i = 0; i < patternHeight; i++) { 16358 regionY = y + i; 16359 if (regionY < 0 || regionY >= regionHeight) { 16360 continue; 16361 } 16362 regionRow = regionBitmap[regionY]; 16363 patternRow = patternBitmap[i]; 16364 for (j = 0; j < patternWidth; j++) { 16365 regionX = x + j; 16366 if (regionX >= 0 && regionX < regionWidth) { 16367 regionRow[regionX] |= patternRow[j]; 16368 } 16369 } 16370 } 16371 } 16372 } 16373 } 16374 return regionBitmap; 16375} 16376function readSegmentHeader(data, start) { 16377 const segmentHeader = {}; 16378 segmentHeader.number = (0, _core_utils.readUint32)(data, start); 16379 const flags = data[start + 4]; 16380 const segmentType = flags & 0x3f; 16381 if (!SegmentTypes[segmentType]) { 16382 throw new Jbig2Error("invalid segment type: " + segmentType); 16383 } 16384 segmentHeader.type = segmentType; 16385 segmentHeader.typeName = SegmentTypes[segmentType]; 16386 segmentHeader.deferredNonRetain = !!(flags & 0x80); 16387 const pageAssociationFieldSize = !!(flags & 0x40); 16388 const referredFlags = data[start + 5]; 16389 let referredToCount = referredFlags >> 5 & 7; 16390 const retainBits = [referredFlags & 31]; 16391 let position = start + 6; 16392 if (referredFlags === 7) { 16393 referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff; 16394 position += 3; 16395 let bytes = referredToCount + 7 >> 3; 16396 retainBits[0] = data[position++]; 16397 while (--bytes > 0) { 16398 retainBits.push(data[position++]); 16399 } 16400 } else if (referredFlags === 5 || referredFlags === 6) { 16401 throw new Jbig2Error("invalid referred-to flags"); 16402 } 16403 segmentHeader.retainBits = retainBits; 16404 let referredToSegmentNumberSize = 4; 16405 if (segmentHeader.number <= 256) { 16406 referredToSegmentNumberSize = 1; 16407 } else if (segmentHeader.number <= 65536) { 16408 referredToSegmentNumberSize = 2; 16409 } 16410 const referredTo = []; 16411 let i, ii; 16412 for (i = 0; i < referredToCount; i++) { 16413 let number; 16414 if (referredToSegmentNumberSize === 1) { 16415 number = data[position]; 16416 } else if (referredToSegmentNumberSize === 2) { 16417 number = (0, _core_utils.readUint16)(data, position); 16418 } else { 16419 number = (0, _core_utils.readUint32)(data, position); 16420 } 16421 referredTo.push(number); 16422 position += referredToSegmentNumberSize; 16423 } 16424 segmentHeader.referredTo = referredTo; 16425 if (!pageAssociationFieldSize) { 16426 segmentHeader.pageAssociation = data[position++]; 16427 } else { 16428 segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position); 16429 position += 4; 16430 } 16431 segmentHeader.length = (0, _core_utils.readUint32)(data, position); 16432 position += 4; 16433 if (segmentHeader.length === 0xffffffff) { 16434 if (segmentType === 38) { 16435 const genericRegionInfo = readRegionSegmentInformation(data, position); 16436 const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength]; 16437 const genericRegionMmr = !!(genericRegionSegmentFlags & 1); 16438 const searchPatternLength = 6; 16439 const searchPattern = new Uint8Array(searchPatternLength); 16440 if (!genericRegionMmr) { 16441 searchPattern[0] = 0xff; 16442 searchPattern[1] = 0xac; 16443 } 16444 searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff; 16445 searchPattern[3] = genericRegionInfo.height >> 16 & 0xff; 16446 searchPattern[4] = genericRegionInfo.height >> 8 & 0xff; 16447 searchPattern[5] = genericRegionInfo.height & 0xff; 16448 for (i = position, ii = data.length; i < ii; i++) { 16449 let j = 0; 16450 while (j < searchPatternLength && searchPattern[j] === data[i + j]) { 16451 j++; 16452 } 16453 if (j === searchPatternLength) { 16454 segmentHeader.length = i + searchPatternLength; 16455 break; 16456 } 16457 } 16458 if (segmentHeader.length === 0xffffffff) { 16459 throw new Jbig2Error("segment end was not found"); 16460 } 16461 } else { 16462 throw new Jbig2Error("invalid unknown segment length"); 16463 } 16464 } 16465 segmentHeader.headerEnd = position; 16466 return segmentHeader; 16467} 16468function readSegments(header, data, start, end) { 16469 const segments = []; 16470 let position = start; 16471 while (position < end) { 16472 const segmentHeader = readSegmentHeader(data, position); 16473 position = segmentHeader.headerEnd; 16474 const segment = { 16475 header: segmentHeader, 16476 data 16477 }; 16478 if (!header.randomAccess) { 16479 segment.start = position; 16480 position += segmentHeader.length; 16481 segment.end = position; 16482 } 16483 segments.push(segment); 16484 if (segmentHeader.type === 51) { 16485 break; 16486 } 16487 } 16488 if (header.randomAccess) { 16489 for (let i = 0, ii = segments.length; i < ii; i++) { 16490 segments[i].start = position; 16491 position += segments[i].header.length; 16492 segments[i].end = position; 16493 } 16494 } 16495 return segments; 16496} 16497function readRegionSegmentInformation(data, start) { 16498 return { 16499 width: (0, _core_utils.readUint32)(data, start), 16500 height: (0, _core_utils.readUint32)(data, start + 4), 16501 x: (0, _core_utils.readUint32)(data, start + 8), 16502 y: (0, _core_utils.readUint32)(data, start + 12), 16503 combinationOperator: data[start + 16] & 7 16504 }; 16505} 16506const RegionSegmentInformationFieldLength = 17; 16507function processSegment(segment, visitor) { 16508 const header = segment.header; 16509 const data = segment.data, 16510 end = segment.end; 16511 let position = segment.start; 16512 let args, at, i, atLength; 16513 switch (header.type) { 16514 case 0: 16515 const dictionary = {}; 16516 const dictionaryFlags = (0, _core_utils.readUint16)(data, position); 16517 dictionary.huffman = !!(dictionaryFlags & 1); 16518 dictionary.refinement = !!(dictionaryFlags & 2); 16519 dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3; 16520 dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3; 16521 dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1; 16522 dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1; 16523 dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256); 16524 dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512); 16525 dictionary.template = dictionaryFlags >> 10 & 3; 16526 dictionary.refinementTemplate = dictionaryFlags >> 12 & 1; 16527 position += 2; 16528 if (!dictionary.huffman) { 16529 atLength = dictionary.template === 0 ? 4 : 1; 16530 at = []; 16531 for (i = 0; i < atLength; i++) { 16532 at.push({ 16533 x: (0, _core_utils.readInt8)(data, position), 16534 y: (0, _core_utils.readInt8)(data, position + 1) 16535 }); 16536 position += 2; 16537 } 16538 dictionary.at = at; 16539 } 16540 if (dictionary.refinement && !dictionary.refinementTemplate) { 16541 at = []; 16542 for (i = 0; i < 2; i++) { 16543 at.push({ 16544 x: (0, _core_utils.readInt8)(data, position), 16545 y: (0, _core_utils.readInt8)(data, position + 1) 16546 }); 16547 position += 2; 16548 } 16549 dictionary.refinementAt = at; 16550 } 16551 dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position); 16552 position += 4; 16553 dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position); 16554 position += 4; 16555 args = [dictionary, header.number, header.referredTo, data, position, end]; 16556 break; 16557 case 6: 16558 case 7: 16559 const textRegion = {}; 16560 textRegion.info = readRegionSegmentInformation(data, position); 16561 position += RegionSegmentInformationFieldLength; 16562 const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position); 16563 position += 2; 16564 textRegion.huffman = !!(textRegionSegmentFlags & 1); 16565 textRegion.refinement = !!(textRegionSegmentFlags & 2); 16566 textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3; 16567 textRegion.stripSize = 1 << textRegion.logStripSize; 16568 textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3; 16569 textRegion.transposed = !!(textRegionSegmentFlags & 64); 16570 textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3; 16571 textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1; 16572 textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27; 16573 textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1; 16574 if (textRegion.huffman) { 16575 const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position); 16576 position += 2; 16577 textRegion.huffmanFS = textRegionHuffmanFlags & 3; 16578 textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3; 16579 textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3; 16580 textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3; 16581 textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3; 16582 textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3; 16583 textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3; 16584 textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000); 16585 } 16586 if (textRegion.refinement && !textRegion.refinementTemplate) { 16587 at = []; 16588 for (i = 0; i < 2; i++) { 16589 at.push({ 16590 x: (0, _core_utils.readInt8)(data, position), 16591 y: (0, _core_utils.readInt8)(data, position + 1) 16592 }); 16593 position += 2; 16594 } 16595 textRegion.refinementAt = at; 16596 } 16597 textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position); 16598 position += 4; 16599 args = [textRegion, header.referredTo, data, position, end]; 16600 break; 16601 case 16: 16602 const patternDictionary = {}; 16603 const patternDictionaryFlags = data[position++]; 16604 patternDictionary.mmr = !!(patternDictionaryFlags & 1); 16605 patternDictionary.template = patternDictionaryFlags >> 1 & 3; 16606 patternDictionary.patternWidth = data[position++]; 16607 patternDictionary.patternHeight = data[position++]; 16608 patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position); 16609 position += 4; 16610 args = [patternDictionary, header.number, data, position, end]; 16611 break; 16612 case 22: 16613 case 23: 16614 const halftoneRegion = {}; 16615 halftoneRegion.info = readRegionSegmentInformation(data, position); 16616 position += RegionSegmentInformationFieldLength; 16617 const halftoneRegionFlags = data[position++]; 16618 halftoneRegion.mmr = !!(halftoneRegionFlags & 1); 16619 halftoneRegion.template = halftoneRegionFlags >> 1 & 3; 16620 halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8); 16621 halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7; 16622 halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1; 16623 halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position); 16624 position += 4; 16625 halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position); 16626 position += 4; 16627 halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 16628 position += 4; 16629 halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 16630 position += 4; 16631 halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position); 16632 position += 2; 16633 halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position); 16634 position += 2; 16635 args = [halftoneRegion, header.referredTo, data, position, end]; 16636 break; 16637 case 38: 16638 case 39: 16639 const genericRegion = {}; 16640 genericRegion.info = readRegionSegmentInformation(data, position); 16641 position += RegionSegmentInformationFieldLength; 16642 const genericRegionSegmentFlags = data[position++]; 16643 genericRegion.mmr = !!(genericRegionSegmentFlags & 1); 16644 genericRegion.template = genericRegionSegmentFlags >> 1 & 3; 16645 genericRegion.prediction = !!(genericRegionSegmentFlags & 8); 16646 if (!genericRegion.mmr) { 16647 atLength = genericRegion.template === 0 ? 4 : 1; 16648 at = []; 16649 for (i = 0; i < atLength; i++) { 16650 at.push({ 16651 x: (0, _core_utils.readInt8)(data, position), 16652 y: (0, _core_utils.readInt8)(data, position + 1) 16653 }); 16654 position += 2; 16655 } 16656 genericRegion.at = at; 16657 } 16658 args = [genericRegion, data, position, end]; 16659 break; 16660 case 48: 16661 const pageInfo = { 16662 width: (0, _core_utils.readUint32)(data, position), 16663 height: (0, _core_utils.readUint32)(data, position + 4), 16664 resolutionX: (0, _core_utils.readUint32)(data, position + 8), 16665 resolutionY: (0, _core_utils.readUint32)(data, position + 12) 16666 }; 16667 if (pageInfo.height === 0xffffffff) { 16668 delete pageInfo.height; 16669 } 16670 const pageSegmentFlags = data[position + 16]; 16671 (0, _core_utils.readUint16)(data, position + 17); 16672 pageInfo.lossless = !!(pageSegmentFlags & 1); 16673 pageInfo.refinement = !!(pageSegmentFlags & 2); 16674 pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1; 16675 pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3; 16676 pageInfo.requiresBuffer = !!(pageSegmentFlags & 32); 16677 pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64); 16678 args = [pageInfo]; 16679 break; 16680 case 49: 16681 break; 16682 case 50: 16683 break; 16684 case 51: 16685 break; 16686 case 53: 16687 args = [header.number, data, position, end]; 16688 break; 16689 case 62: 16690 break; 16691 default: 16692 throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`); 16693 } 16694 const callbackName = "on" + header.typeName; 16695 if (callbackName in visitor) { 16696 visitor[callbackName].apply(visitor, args); 16697 } 16698} 16699function processSegments(segments, visitor) { 16700 for (let i = 0, ii = segments.length; i < ii; i++) { 16701 processSegment(segments[i], visitor); 16702 } 16703} 16704function parseJbig2Chunks(chunks) { 16705 const visitor = new SimpleSegmentVisitor(); 16706 for (let i = 0, ii = chunks.length; i < ii; i++) { 16707 const chunk = chunks[i]; 16708 const segments = readSegments({}, chunk.data, chunk.start, chunk.end); 16709 processSegments(segments, visitor); 16710 } 16711 return visitor.buffer; 16712} 16713function parseJbig2(data) { 16714 throw new Error("Not implemented: parseJbig2"); 16715} 16716class SimpleSegmentVisitor { 16717 onPageInformation(info) { 16718 this.currentPageInfo = info; 16719 const rowSize = info.width + 7 >> 3; 16720 const buffer = new Uint8ClampedArray(rowSize * info.height); 16721 if (info.defaultPixelValue) { 16722 buffer.fill(0xff); 16723 } 16724 this.buffer = buffer; 16725 } 16726 drawBitmap(regionInfo, bitmap) { 16727 const pageInfo = this.currentPageInfo; 16728 const width = regionInfo.width, 16729 height = regionInfo.height; 16730 const rowSize = pageInfo.width + 7 >> 3; 16731 const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator; 16732 const buffer = this.buffer; 16733 const mask0 = 128 >> (regionInfo.x & 7); 16734 let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3); 16735 let i, j, mask, offset; 16736 switch (combinationOperator) { 16737 case 0: 16738 for (i = 0; i < height; i++) { 16739 mask = mask0; 16740 offset = offset0; 16741 for (j = 0; j < width; j++) { 16742 if (bitmap[i][j]) { 16743 buffer[offset] |= mask; 16744 } 16745 mask >>= 1; 16746 if (!mask) { 16747 mask = 128; 16748 offset++; 16749 } 16750 } 16751 offset0 += rowSize; 16752 } 16753 break; 16754 case 2: 16755 for (i = 0; i < height; i++) { 16756 mask = mask0; 16757 offset = offset0; 16758 for (j = 0; j < width; j++) { 16759 if (bitmap[i][j]) { 16760 buffer[offset] ^= mask; 16761 } 16762 mask >>= 1; 16763 if (!mask) { 16764 mask = 128; 16765 offset++; 16766 } 16767 } 16768 offset0 += rowSize; 16769 } 16770 break; 16771 default: 16772 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 16773 } 16774 } 16775 onImmediateGenericRegion(region, data, start, end) { 16776 const regionInfo = region.info; 16777 const decodingContext = new DecodingContext(data, start, end); 16778 const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext); 16779 this.drawBitmap(regionInfo, bitmap); 16780 } 16781 onImmediateLosslessGenericRegion() { 16782 this.onImmediateGenericRegion(...arguments); 16783 } 16784 onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) { 16785 let huffmanTables, huffmanInput; 16786 if (dictionary.huffman) { 16787 huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables); 16788 huffmanInput = new Reader(data, start, end); 16789 } 16790 let symbols = this.symbols; 16791 if (!symbols) { 16792 this.symbols = symbols = {}; 16793 } 16794 const inputSymbols = []; 16795 for (const referredSegment of referredSegments) { 16796 const referredSymbols = symbols[referredSegment]; 16797 if (referredSymbols) { 16798 inputSymbols.push(...referredSymbols); 16799 } 16800 } 16801 const decodingContext = new DecodingContext(data, start, end); 16802 symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput); 16803 } 16804 onImmediateTextRegion(region, referredSegments, data, start, end) { 16805 const regionInfo = region.info; 16806 let huffmanTables, huffmanInput; 16807 const symbols = this.symbols; 16808 const inputSymbols = []; 16809 for (const referredSegment of referredSegments) { 16810 const referredSymbols = symbols[referredSegment]; 16811 if (referredSymbols) { 16812 inputSymbols.push(...referredSymbols); 16813 } 16814 } 16815 const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length); 16816 if (region.huffman) { 16817 huffmanInput = new Reader(data, start, end); 16818 huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput); 16819 } 16820 const decodingContext = new DecodingContext(data, start, end); 16821 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); 16822 this.drawBitmap(regionInfo, bitmap); 16823 } 16824 onImmediateLosslessTextRegion() { 16825 this.onImmediateTextRegion(...arguments); 16826 } 16827 onPatternDictionary(dictionary, currentSegment, data, start, end) { 16828 let patterns = this.patterns; 16829 if (!patterns) { 16830 this.patterns = patterns = {}; 16831 } 16832 const decodingContext = new DecodingContext(data, start, end); 16833 patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext); 16834 } 16835 onImmediateHalftoneRegion(region, referredSegments, data, start, end) { 16836 const patterns = this.patterns[referredSegments[0]]; 16837 const regionInfo = region.info; 16838 const decodingContext = new DecodingContext(data, start, end); 16839 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); 16840 this.drawBitmap(regionInfo, bitmap); 16841 } 16842 onImmediateLosslessHalftoneRegion() { 16843 this.onImmediateHalftoneRegion(...arguments); 16844 } 16845 onTables(currentSegment, data, start, end) { 16846 let customTables = this.customTables; 16847 if (!customTables) { 16848 this.customTables = customTables = {}; 16849 } 16850 customTables[currentSegment] = decodeTablesSegment(data, start, end); 16851 } 16852} 16853class HuffmanLine { 16854 constructor(lineData) { 16855 if (lineData.length === 2) { 16856 this.isOOB = true; 16857 this.rangeLow = 0; 16858 this.prefixLength = lineData[0]; 16859 this.rangeLength = 0; 16860 this.prefixCode = lineData[1]; 16861 this.isLowerRange = false; 16862 } else { 16863 this.isOOB = false; 16864 this.rangeLow = lineData[0]; 16865 this.prefixLength = lineData[1]; 16866 this.rangeLength = lineData[2]; 16867 this.prefixCode = lineData[3]; 16868 this.isLowerRange = lineData[4] === "lower"; 16869 } 16870 } 16871} 16872class HuffmanTreeNode { 16873 constructor(line) { 16874 this.children = []; 16875 if (line) { 16876 this.isLeaf = true; 16877 this.rangeLength = line.rangeLength; 16878 this.rangeLow = line.rangeLow; 16879 this.isLowerRange = line.isLowerRange; 16880 this.isOOB = line.isOOB; 16881 } else { 16882 this.isLeaf = false; 16883 } 16884 } 16885 buildTree(line, shift) { 16886 const bit = line.prefixCode >> shift & 1; 16887 if (shift <= 0) { 16888 this.children[bit] = new HuffmanTreeNode(line); 16889 } else { 16890 let node = this.children[bit]; 16891 if (!node) { 16892 this.children[bit] = node = new HuffmanTreeNode(null); 16893 } 16894 node.buildTree(line, shift - 1); 16895 } 16896 } 16897 decodeNode(reader) { 16898 if (this.isLeaf) { 16899 if (this.isOOB) { 16900 return null; 16901 } 16902 const htOffset = reader.readBits(this.rangeLength); 16903 return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset); 16904 } 16905 const node = this.children[reader.readBit()]; 16906 if (!node) { 16907 throw new Jbig2Error("invalid Huffman data"); 16908 } 16909 return node.decodeNode(reader); 16910 } 16911} 16912class HuffmanTable { 16913 constructor(lines, prefixCodesDone) { 16914 if (!prefixCodesDone) { 16915 this.assignPrefixCodes(lines); 16916 } 16917 this.rootNode = new HuffmanTreeNode(null); 16918 for (let i = 0, ii = lines.length; i < ii; i++) { 16919 const line = lines[i]; 16920 if (line.prefixLength > 0) { 16921 this.rootNode.buildTree(line, line.prefixLength - 1); 16922 } 16923 } 16924 } 16925 decode(reader) { 16926 return this.rootNode.decodeNode(reader); 16927 } 16928 assignPrefixCodes(lines) { 16929 const linesLength = lines.length; 16930 let prefixLengthMax = 0; 16931 for (let i = 0; i < linesLength; i++) { 16932 prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength); 16933 } 16934 const histogram = new Uint32Array(prefixLengthMax + 1); 16935 for (let i = 0; i < linesLength; i++) { 16936 histogram[lines[i].prefixLength]++; 16937 } 16938 let currentLength = 1, 16939 firstCode = 0, 16940 currentCode, 16941 currentTemp, 16942 line; 16943 histogram[0] = 0; 16944 while (currentLength <= prefixLengthMax) { 16945 firstCode = firstCode + histogram[currentLength - 1] << 1; 16946 currentCode = firstCode; 16947 currentTemp = 0; 16948 while (currentTemp < linesLength) { 16949 line = lines[currentTemp]; 16950 if (line.prefixLength === currentLength) { 16951 line.prefixCode = currentCode; 16952 currentCode++; 16953 } 16954 currentTemp++; 16955 } 16956 currentLength++; 16957 } 16958 } 16959} 16960function decodeTablesSegment(data, start, end) { 16961 const flags = data[start]; 16962 const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff; 16963 const highestValue = (0, _core_utils.readUint32)
vendor: 11,262 bytes, lines 16963-17263
16963(data, start + 5) & 0xffffffff; 16964 const reader = new Reader(data, start + 9, end); 16965 const prefixSizeBits = (flags >> 1 & 7) + 1; 16966 const rangeSizeBits = (flags >> 4 & 7) + 1; 16967 const lines = []; 16968 let prefixLength, 16969 rangeLength, 16970 currentRangeLow = lowestValue; 16971 do { 16972 prefixLength = reader.readBits(prefixSizeBits); 16973 rangeLength = reader.readBits(rangeSizeBits); 16974 lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0])); 16975 currentRangeLow += 1 << rangeLength; 16976 } while (currentRangeLow < highestValue); 16977 prefixLength = reader.readBits(prefixSizeBits); 16978 lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"])); 16979 prefixLength = reader.readBits(prefixSizeBits); 16980 lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0])); 16981 if (flags & 1) { 16982 prefixLength = reader.readBits(prefixSizeBits); 16983 lines.push(new HuffmanLine([prefixLength, 0])); 16984 } 16985 return new HuffmanTable(lines, false); 16986} 16987const standardTablesCache = {}; 16988function getStandardTable(number) { 16989 let table = standardTablesCache[number]; 16990 if (table) { 16991 return table; 16992 } 16993 let lines; 16994 switch (number) { 16995 case 1: 16996 lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]]; 16997 break; 16998 case 2: 16999 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]]; 17000 break; 17001 case 3: 17002 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]]; 17003 break; 17004 case 4: 17005 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]]; 17006 break; 17007 case 5: 17008 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]]; 17009 break; 17010 case 6: 17011 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]]; 17012 break; 17013 case 7: 17014 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]]; 17015 break; 17016 case 8: 17017 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]]; 17018 break; 17019 case 9: 17020 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]]; 17021 break; 17022 case 10: 17023 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]]; 17024 break; 17025 case 11: 17026 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]]; 17027 break; 17028 case 12: 17029 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]]; 17030 break; 17031 case 13: 17032 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]]; 17033 break; 17034 case 14: 17035 lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]]; 17036 break; 17037 case 15: 17038 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]]; 17039 break; 17040 default: 17041 throw new Jbig2Error(`standard table B.${number} does not exist`); 17042 } 17043 for (let i = 0, ii = lines.length; i < ii; i++) { 17044 lines[i] = new HuffmanLine(lines[i]); 17045 } 17046 table = new HuffmanTable(lines, true); 17047 standardTablesCache[number] = table; 17048 return table; 17049} 17050class Reader { 17051 constructor(data, start, end) { 17052 this.data = data; 17053 this.start = start; 17054 this.end = end; 17055 this.position = start; 17056 this.shift = -1; 17057 this.currentByte = 0; 17058 } 17059 readBit() { 17060 if (this.shift < 0) { 17061 if (this.position >= this.end) { 17062 throw new Jbig2Error("end of data while reading bit"); 17063 } 17064 this.currentByte = this.data[this.position++]; 17065 this.shift = 7; 17066 } 17067 const bit = this.currentByte >> this.shift & 1; 17068 this.shift--; 17069 return bit; 17070 } 17071 readBits(numBits) { 17072 let result = 0, 17073 i; 17074 for (i = numBits - 1; i >= 0; i--) { 17075 result |= this.readBit() << i; 17076 } 17077 return result; 17078 } 17079 byteAlign() { 17080 this.shift = -1; 17081 } 17082 next() { 17083 if (this.position >= this.end) { 17084 return -1; 17085 } 17086 return this.data[this.position++]; 17087 } 17088} 17089function getCustomHuffmanTable(index, referredTo, customTables) { 17090 let currentIndex = 0; 17091 for (let i = 0, ii = referredTo.length; i < ii; i++) { 17092 const table = customTables[referredTo[i]]; 17093 if (table) { 17094 if (index === currentIndex) { 17095 return table; 17096 } 17097 currentIndex++; 17098 } 17099 } 17100 throw new Jbig2Error("can't find custom Huffman table"); 17101} 17102function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) { 17103 const codes = []; 17104 for (let i = 0; i <= 34; i++) { 17105 const codeLength = reader.readBits(4); 17106 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 17107 } 17108 const runCodesTable = new HuffmanTable(codes, false); 17109 codes.length = 0; 17110 for (let i = 0; i < numberOfSymbols;) { 17111 const codeLength = runCodesTable.decode(reader); 17112 if (codeLength >= 32) { 17113 let repeatedLength, numberOfRepeats, j; 17114 switch (codeLength) { 17115 case 32: 17116 if (i === 0) { 17117 throw new Jbig2Error("no previous value in symbol ID table"); 17118 } 17119 numberOfRepeats = reader.readBits(2) + 3; 17120 repeatedLength = codes[i - 1].prefixLength; 17121 break; 17122 case 33: 17123 numberOfRepeats = reader.readBits(3) + 3; 17124 repeatedLength = 0; 17125 break; 17126 case 34: 17127 numberOfRepeats = reader.readBits(7) + 11; 17128 repeatedLength = 0; 17129 break; 17130 default: 17131 throw new Jbig2Error("invalid code length in symbol ID table"); 17132 } 17133 for (j = 0; j < numberOfRepeats; j++) { 17134 codes.push(new HuffmanLine([i, repeatedLength, 0, 0])); 17135 i++; 17136 } 17137 } else { 17138 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 17139 i++; 17140 } 17141 } 17142 reader.byteAlign(); 17143 const symbolIDTable = new HuffmanTable(codes, false); 17144 let customIndex = 0, 17145 tableFirstS, 17146 tableDeltaS, 17147 tableDeltaT; 17148 switch (textRegion.huffmanFS) { 17149 case 0: 17150 case 1: 17151 tableFirstS = getStandardTable(textRegion.huffmanFS + 6); 17152 break; 17153 case 3: 17154 tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables); 17155 customIndex++; 17156 break; 17157 default: 17158 throw new Jbig2Error("invalid Huffman FS selector"); 17159 } 17160 switch (textRegion.huffmanDS) { 17161 case 0: 17162 case 1: 17163 case 2: 17164 tableDeltaS = getStandardTable(textRegion.huffmanDS + 8); 17165 break; 17166 case 3: 17167 tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables); 17168 customIndex++; 17169 break; 17170 default: 17171 throw new Jbig2Error("invalid Huffman DS selector"); 17172 } 17173 switch (textRegion.huffmanDT) { 17174 case 0: 17175 case 1: 17176 case 2: 17177 tableDeltaT = getStandardTable(textRegion.huffmanDT + 11); 17178 break; 17179 case 3: 17180 tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables); 17181 customIndex++; 17182 break; 17183 default: 17184 throw new Jbig2Error("invalid Huffman DT selector"); 17185 } 17186 if (textRegion.refinement) { 17187 throw new Jbig2Error("refinement with Huffman is not supported"); 17188 } 17189 return { 17190 symbolIDTable, 17191 tableFirstS, 17192 tableDeltaS, 17193 tableDeltaT 17194 }; 17195} 17196function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) { 17197 let customIndex = 0, 17198 tableDeltaHeight, 17199 tableDeltaWidth; 17200 switch (dictionary.huffmanDHSelector) { 17201 case 0: 17202 case 1: 17203 tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4); 17204 break; 17205 case 3: 17206 tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables); 17207 customIndex++; 17208 break; 17209 default: 17210 throw new Jbig2Error("invalid Huffman DH selector"); 17211 } 17212 switch (dictionary.huffmanDWSelector) { 17213 case 0: 17214 case 1: 17215 tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2); 17216 break; 17217 case 3: 17218 tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables); 17219 customIndex++; 17220 break; 17221 default: 17222 throw new Jbig2Error("invalid Huffman DW selector"); 17223 } 17224 let tableBitmapSize, tableAggregateInstances; 17225 if (dictionary.bitmapSizeSelector) { 17226 tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables); 17227 customIndex++; 17228 } else { 17229 tableBitmapSize = getStandardTable(1); 17230 } 17231 if (dictionary.aggregationInstancesSelector) { 17232 tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables); 17233 } else { 17234 tableAggregateInstances = getStandardTable(1); 17235 } 17236 return { 17237 tableDeltaHeight, 17238 tableDeltaWidth, 17239 tableBitmapSize, 17240 tableAggregateInstances 17241 }; 17242} 17243function readUncompressedBitmap(reader, width, height) { 17244 const bitmap = []; 17245 for (let y = 0; y < height; y++) { 17246 const row = new Uint8Array(width); 17247 bitmap.push(row); 17248 for (let x = 0; x < width; x++) { 17249 row[x] = reader.readBit(); 17250 } 17251 reader.byteAlign(); 17252 } 17253 return bitmap; 17254} 17255function decodeMMRBitmap(input, width, height, endOfBlock) { 17256 const params = { 17257 K: -1, 17258 Columns: width, 17259 Rows: height, 17260 BlackIs1: true, 17261 EndOfBlock: endOfBlock 17262 }; 17263 const decoder = new
vendor: 6,434 bytes, lines 17263-17655
17263_ccitt.CCITTFaxDecoder(input, params); 17264 const bitmap = []; 17265 let currentByte, 17266 eof = false; 17267 for (let y = 0; y < height; y++) { 17268 const row = new Uint8Array(width); 17269 bitmap.push(row); 17270 let shift = -1; 17271 for (let x = 0; x < width; x++) { 17272 if (shift < 0) { 17273 currentByte = decoder.readNextChar(); 17274 if (currentByte === -1) { 17275 currentByte = 0; 17276 eof = true; 17277 } 17278 shift = 7; 17279 } 17280 row[x] = currentByte >> shift & 1; 17281 shift--; 17282 } 17283 } 17284 if (endOfBlock && !eof) { 17285 const lookForEOFLimit = 5; 17286 for (let i = 0; i < lookForEOFLimit; i++) { 17287 if (decoder.readNextChar() === -1) { 17288 break; 17289 } 17290 } 17291 } 17292 return bitmap; 17293} 17294class Jbig2Image { 17295 parseChunks(chunks) { 17296 return parseJbig2Chunks(chunks); 17297 } 17298 parse(data) { 17299 throw new Error("Not implemented: Jbig2Image.parse"); 17300 } 17301} 17302exports.Jbig2Image = Jbig2Image; 17303 17304/***/ }), 17305/* 25 */ 17306/***/ ((__unused_webpack_module, exports) => { 17307 17308 17309 17310Object.defineProperty(exports, "__esModule", ({ 17311 value: true 17312})); 17313exports.ArithmeticDecoder = void 0; 17314const QeTable = [{ 17315 qe: 0x5601, 17316 nmps: 1, 17317 nlps: 1, 17318 switchFlag: 1 17319}, { 17320 qe: 0x3401, 17321 nmps: 2, 17322 nlps: 6, 17323 switchFlag: 0 17324}, { 17325 qe: 0x1801, 17326 nmps: 3, 17327 nlps: 9, 17328 switchFlag: 0 17329}, { 17330 qe: 0x0ac1, 17331 nmps: 4, 17332 nlps: 12, 17333 switchFlag: 0 17334}, { 17335 qe: 0x0521, 17336 nmps: 5, 17337 nlps: 29, 17338 switchFlag: 0 17339}, { 17340 qe: 0x0221, 17341 nmps: 38, 17342 nlps: 33, 17343 switchFlag: 0 17344}, { 17345 qe: 0x5601, 17346 nmps: 7, 17347 nlps: 6, 17348 switchFlag: 1 17349}, { 17350 qe: 0x5401, 17351 nmps: 8, 17352 nlps: 14, 17353 switchFlag: 0 17354}, { 17355 qe: 0x4801, 17356 nmps: 9, 17357 nlps: 14, 17358 switchFlag: 0 17359}, { 17360 qe: 0x3801, 17361 nmps: 10, 17362 nlps: 14, 17363 switchFlag: 0 17364}, { 17365 qe: 0x3001, 17366 nmps: 11, 17367 nlps: 17, 17368 switchFlag: 0 17369}, { 17370 qe: 0x2401, 17371 nmps: 12, 17372 nlps: 18, 17373 switchFlag: 0 17374}, { 17375 qe: 0x1c01, 17376 nmps: 13, 17377 nlps: 20, 17378 switchFlag: 0 17379}, { 17380 qe: 0x1601, 17381 nmps: 29, 17382 nlps: 21, 17383 switchFlag: 0 17384}, { 17385 qe: 0x5601, 17386 nmps: 15, 17387 nlps: 14, 17388 switchFlag: 1 17389}, { 17390 qe: 0x5401, 17391 nmps: 16, 17392 nlps: 14, 17393 switchFlag: 0 17394}, { 17395 qe: 0x5101, 17396 nmps: 17, 17397 nlps: 15, 17398 switchFlag: 0 17399}, { 17400 qe: 0x4801, 17401 nmps: 18, 17402 nlps: 16, 17403 switchFlag: 0 17404}, { 17405 qe: 0x3801, 17406 nmps: 19, 17407 nlps: 17, 17408 switchFlag: 0 17409}, { 17410 qe: 0x3401, 17411 nmps: 20, 17412 nlps: 18, 17413 switchFlag: 0 17414}, { 17415 qe: 0x3001, 17416 nmps: 21, 17417 nlps: 19, 17418 switchFlag: 0 17419}, { 17420 qe: 0x2801, 17421 nmps: 22, 17422 nlps: 19, 17423 switchFlag: 0 17424}, { 17425 qe: 0x2401, 17426 nmps: 23, 17427 nlps: 20, 17428 switchFlag: 0 17429}, { 17430 qe: 0x2201, 17431 nmps: 24, 17432 nlps: 21, 17433 switchFlag: 0 17434}, { 17435 qe: 0x1c01, 17436 nmps: 25, 17437 nlps: 22, 17438 switchFlag: 0 17439}, { 17440 qe: 0x1801, 17441 nmps: 26, 17442 nlps: 23, 17443 switchFlag: 0 17444}, { 17445 qe: 0x1601, 17446 nmps: 27, 17447 nlps: 24, 17448 switchFlag: 0 17449}, { 17450 qe: 0x1401, 17451 nmps: 28, 17452 nlps: 25, 17453 switchFlag: 0 17454}, { 17455 qe: 0x1201, 17456 nmps: 29, 17457 nlps: 26, 17458 switchFlag: 0 17459}, { 17460 qe: 0x1101, 17461 nmps: 30, 17462 nlps: 27, 17463 switchFlag: 0 17464}, { 17465 qe: 0x0ac1, 17466 nmps: 31, 17467 nlps: 28, 17468 switchFlag: 0 17469}, { 17470 qe: 0x09c1, 17471 nmps: 32, 17472 nlps: 29, 17473 switchFlag: 0 17474}, { 17475 qe: 0x08a1, 17476 nmps: 33, 17477 nlps: 30, 17478 switchFlag: 0 17479}, { 17480 qe: 0x0521, 17481 nmps: 34, 17482 nlps: 31, 17483 switchFlag: 0 17484}, { 17485 qe: 0x0441, 17486 nmps: 35, 17487 nlps: 32, 17488 switchFlag: 0 17489}, { 17490 qe: 0x02a1, 17491 nmps: 36, 17492 nlps: 33, 17493 switchFlag: 0 17494}, { 17495 qe: 0x0221, 17496 nmps: 37, 17497 nlps: 34, 17498 switchFlag: 0 17499}, { 17500 qe: 0x0141, 17501 nmps: 38, 17502 nlps: 35, 17503 switchFlag: 0 17504}, { 17505 qe: 0x0111, 17506 nmps: 39, 17507 nlps: 36, 17508 switchFlag: 0 17509}, { 17510 qe: 0x0085, 17511 nmps: 40, 17512 nlps: 37, 17513 switchFlag: 0 17514}, { 17515 qe: 0x0049, 17516 nmps: 41, 17517 nlps: 38, 17518 switchFlag: 0 17519}, { 17520 qe: 0x0025, 17521 nmps: 42, 17522 nlps: 39, 17523 switchFlag: 0 17524}, { 17525 qe: 0x0015, 17526 nmps: 43, 17527 nlps: 40, 17528 switchFlag: 0 17529}, { 17530 qe: 0x0009, 17531 nmps: 44, 17532 nlps: 41, 17533 switchFlag: 0 17534}, { 17535 qe: 0x0005, 17536 nmps: 45, 17537 nlps: 42, 17538 switchFlag: 0 17539}, { 17540 qe: 0x0001, 17541 nmps: 45, 17542 nlps: 43, 17543 switchFlag: 0 17544}, { 17545 qe: 0x5601, 17546 nmps: 46, 17547 nlps: 46, 17548 switchFlag: 0 17549}]; 17550class ArithmeticDecoder { 17551 constructor(data, start, end) { 17552 this.data = data; 17553 this.bp = start; 17554 this.dataEnd = end; 17555 this.chigh = data[start]; 17556 this.clow = 0; 17557 this.byteIn(); 17558 this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f; 17559 this.clow = this.clow << 7 & 0xffff; 17560 this.ct -= 7; 17561 this.a = 0x8000; 17562 } 17563 byteIn() { 17564 const data = this.data; 17565 let bp = this.bp; 17566 if (data[bp] === 0xff) { 17567 if (data[bp + 1] > 0x8f) { 17568 this.clow += 0xff00; 17569 this.ct = 8; 17570 } else { 17571 bp++; 17572 this.clow += data[bp] << 9; 17573 this.ct = 7; 17574 this.bp = bp; 17575 } 17576 } else { 17577 bp++; 17578 this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00; 17579 this.ct = 8; 17580 this.bp = bp; 17581 } 17582 if (this.clow > 0xffff) { 17583 this.chigh += this.clow >> 16; 17584 this.clow &= 0xffff; 17585 } 17586 } 17587 readBit(contexts, pos) { 17588 let cx_index = contexts[pos] >> 1, 17589 cx_mps = contexts[pos] & 1; 17590 const qeTableIcx = QeTable[cx_index]; 17591 const qeIcx = qeTableIcx.qe; 17592 let d; 17593 let a = this.a - qeIcx; 17594 if (this.chigh < qeIcx) { 17595 if (a < qeIcx) { 17596 a = qeIcx; 17597 d = cx_mps; 17598 cx_index = qeTableIcx.nmps; 17599 } else { 17600 a = qeIcx; 17601 d = 1 ^ cx_mps; 17602 if (qeTableIcx.switchFlag === 1) { 17603 cx_mps = d; 17604 } 17605 cx_index = qeTableIcx.nlps; 17606 } 17607 } else { 17608 this.chigh -= qeIcx; 17609 if ((a & 0x8000) !== 0) { 17610 this.a = a; 17611 return cx_mps; 17612 } 17613 if (a < qeIcx) { 17614 d = 1 ^ cx_mps; 17615 if (qeTableIcx.switchFlag === 1) { 17616 cx_mps = d; 17617 } 17618 cx_index = qeTableIcx.nlps; 17619 } else { 17620 d = cx_mps; 17621 cx_index = qeTableIcx.nmps; 17622 } 17623 } 17624 do { 17625 if (this.ct === 0) { 17626 this.byteIn(); 17627 } 17628 a <<= 1; 17629 this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1; 17630 this.clow = this.clow << 1 & 0xffff; 17631 this.ct--; 17632 } while ((a & 0x8000) === 0); 17633 this.a = a; 17634 contexts[pos] = cx_index << 1 | cx_mps; 17635 return d; 17636 } 17637} 17638exports.ArithmeticDecoder = ArithmeticDecoder; 17639 17640/***/ }), 17641/* 26 */ 17642/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 17643 17644 17645 17646Object.defineProperty(exports, "__esModule", ({ 17647 value: true 17648})); 17649exports.JpegStream = void 0; 17650var _decode_stream = __w_pdfjs_require__(18); 17651var _primitives = __w_pdfjs_require__(4); 17652var _jpg = __w_pdfjs_require__(27); 17653var _util = __w_pdfjs_require__(2); 17654class JpegStream extends _decode_stream.DecodeStream { 17655 constructor(stream, maybeLength, params) {
17656 let ch; 17657 while ((ch = stream.getByte()) !== -1) { 17658 if (ch === 0xff) { 17659 stream.skip(-1); 17660 break; 17661 } 17662 } 17663 super(maybeLength); 17664 this.stream = stream; 17665 this.dict = stream.dict; 17666 this.maybeLength = maybeLength; 17667 this.params = params; 17668 } 17669 get bytes() { 17670 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 17671 } 17672 ensureBuffer(requested) {} 17673 readBlock() { 17674 if (this.eof) { 17675 return; 17676 } 17677 const jpegOptions = { 17678 decodeTransform: undefined, 17679 colorTransform: undefined 17680 }; 17681 const decodeArr = this.dict.getArray("D", "Decode"); 17682 if ((this.forceRGBA || this.forceRGB) && Array.isArray(decodeArr)) { 17683 const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8; 17684 const decodeArrLength = decodeArr.length; 17685 const transform = new Int32Array(decodeArrLength); 17686 let transformNeeded = false; 17687 const maxValue = (1 << bitsPerComponent) - 1; 17688 for (let i = 0; i < decodeArrLength; i += 2) { 17689 transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0; 17690 transform[i + 1] = decodeArr[i] * maxValue | 0; 17691 if (transform[i] !== 256 || transform[i + 1] !== 0) { 17692 transformNeeded = true; 17693 } 17694 } 17695 if (transformNeeded) { 17696 jpegOptions.decodeTransform = transform; 17697 } 17698 } 17699 if (this.params instanceof _primitives.Dict) { 17700 const colorTransform = this.params.get("ColorTransform"); 17701 if (Number.isInteger(colorTransform)) { 17702 jpegOptions.colorTransform = colorTransform; 17703 } 17704 } 17705 const jpegImage = new _jpg.JpegImage(jpegOptions); 17706 jpegImage.parse(this.bytes); 17707 const data = jpegImage.getData({ 17708 width: this.drawWidth, 17709 height: this.drawHeight, 17710 forceRGBA: this.forceRGBA, 17711 forceRGB: this.forceRGB, 17712 isSourcePDF: true 17713 }); 17714 this.buffer = data; 17715 this.bufferLength = data.length; 17716 this.eof = true; 17717 } 17718} 17719exports.JpegStream = JpegStream; 17720 17721/***/ }), 17722/* 27 */ 17723/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 17724 17725 17726 17727Object.defineProperty(exports, "__esModule", ({ 17728 value: true 17729})); 17730exports.JpegImage = void 0; 17731var _util = __w_pdfjs_require__(2); 17732var _image_utils = __w_pdfjs_require__(28); 17733var _core_utils = __w_pdfjs_require__(3); 17734class JpegError extends _util.BaseException { 17735 constructor(msg) { 17736 super(`JPEG error: ${msg}`, "JpegError"); 17737 } 17738} 17739class DNLMarkerError extends _util.BaseException { 17740 constructor(message, scanLines) { 17741 super(message, "DNLMarkerError"); 17742 this.scanLines = scanLines; 17743 } 17744} 17745class EOIMarkerError extends _util.BaseException { 17746 constructor(msg) { 17747 super(msg, "EOIMarkerError"); 17748 } 17749} 17750const 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]); 17751const dctCos1 = 4017; 17752const dctSin1 = 799; 17753const dctCos3 = 3406; 17754const dctSin3 = 2276; 17755const dctCos6 = 1567; 17756const dctSin6 = 3784; 17757const dctSqrt2 = 5793; 17758const dctSqrt1d2 = 2896; 17759function buildHuffmanTable(codeLengths, values) { 17760 let k = 0, 17761 i, 17762 j, 17763 length = 16; 17764 while (length > 0 && !codeLengths[length - 1]) { 17765 length--; 17766 } 17767 const code = [{ 17768 children: [], 17769 index: 0 17770 }]; 17771 let p = code[0], 17772 q; 17773 for (i = 0; i < length; i++) { 17774 for (j = 0; j < codeLengths[i]; j++) { 17775 p = code.pop(); 17776 p.children[p.index] = values[k]; 17777 while (p.index > 0) { 17778 p = code.pop(); 17779 } 17780 p.index++; 17781 code.push(p); 17782 while (code.length <= i) { 17783 code.push(q = { 17784 children: [], 17785 index: 0 17786 }); 17787 p.children[p.index] = q.children; 17788 p = q; 17789 } 17790 k++; 17791 } 17792 if (i + 1 < length) { 17793 code.push(q = { 17794 children: [], 17795 index: 0 17796 }); 17797 p.children[p.index] = q.children; 17798 p = q; 17799 } 17800 } 17801 return code[0].children; 17802} 17803function getBlockBufferOffset(component, row, col) { 17804 return 64 * ((component.blocksPerLine + 1) * row + col); 17805} 17806function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) { 17807 const mcusPerLine = frame.mcusPerLine;
vendor: 7,835 bytes, lines 17808-18063
17808 const progressive = frame.progressive; 17809 const startOffset = offset; 17810 let bitsData = 0, 17811 bitsCount = 0; 17812 function readBit() { 17813 if (bitsCount > 0) { 17814 bitsCount--; 17815 return bitsData >> bitsCount & 1; 17816 } 17817 bitsData = data[offset++]; 17818 if (bitsData === 0xff) { 17819 const nextByte = data[offset++]; 17820 if (nextByte) { 17821 if (nextByte === 0xdc && parseDNLMarker) { 17822 offset += 2; 17823 const scanLines = (0, _core_utils.readUint16)(data, offset); 17824 offset += 2; 17825 if (scanLines > 0 && scanLines !== frame.scanLines) { 17826 throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines); 17827 } 17828 } else if (nextByte === 0xd9) { 17829 if (parseDNLMarker) { 17830 const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0); 17831 if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) { 17832 throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines); 17833 } 17834 } 17835 throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data"); 17836 } 17837 throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`); 17838 } 17839 } 17840 bitsCount = 7; 17841 return bitsData >>> 7; 17842 } 17843 function decodeHuffman(tree) { 17844 let node = tree; 17845 while (true) { 17846 node = node[readBit()]; 17847 switch (typeof node) { 17848 case "number": 17849 return node; 17850 case "object": 17851 continue; 17852 } 17853 throw new JpegError("invalid huffman sequence"); 17854 } 17855 } 17856 function receive(length) { 17857 let n = 0; 17858 while (length > 0) { 17859 n = n << 1 | readBit(); 17860 length--; 17861 } 17862 return n; 17863 } 17864 function receiveAndExtend(length) { 17865 if (length === 1) { 17866 return readBit() === 1 ? 1 : -1; 17867 } 17868 const n = receive(length); 17869 if (n >= 1 << length - 1) { 17870 return n; 17871 } 17872 return n + (-1 << length) + 1; 17873 } 17874 function decodeBaseline(component, blockOffset) { 17875 const t = decodeHuffman(component.huffmanTableDC); 17876 const diff = t === 0 ? 0 : receiveAndExtend(t); 17877 component.blockData[blockOffset] = component.pred += diff; 17878 let k = 1; 17879 while (k < 64) { 17880 const rs = decodeHuffman(component.huffmanTableAC); 17881 const s = rs & 15, 17882 r = rs >> 4; 17883 if (s === 0) { 17884 if (r < 15) { 17885 break; 17886 } 17887 k += 16; 17888 continue; 17889 } 17890 k += r; 17891 const z = dctZigZag[k]; 17892 component.blockData[blockOffset + z] = receiveAndExtend(s); 17893 k++; 17894 } 17895 } 17896 function decodeDCFirst(component, blockOffset) { 17897 const t = decodeHuffman(component.huffmanTableDC); 17898 const diff = t === 0 ? 0 : receiveAndExtend(t) << successive; 17899 component.blockData[blockOffset] = component.pred += diff; 17900 } 17901 function decodeDCSuccessive(component, blockOffset) { 17902 component.blockData[blockOffset] |= readBit() << successive; 17903 } 17904 let eobrun = 0; 17905 function decodeACFirst(component, blockOffset) { 17906 if (eobrun > 0) { 17907 eobrun--; 17908 return; 17909 } 17910 let k = spectralStart; 17911 const e = spectralEnd; 17912 while (k <= e) { 17913 const rs = decodeHuffman(component.huffmanTableAC); 17914 const s = rs & 15, 17915 r = rs >> 4; 17916 if (s === 0) { 17917 if (r < 15) { 17918 eobrun = receive(r) + (1 << r) - 1; 17919 break; 17920 } 17921 k += 16; 17922 continue; 17923 } 17924 k += r; 17925 const z = dctZigZag[k]; 17926 component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive); 17927 k++; 17928 } 17929 } 17930 let successiveACState = 0, 17931 successiveACNextValue; 17932 function decodeACSuccessive(component, blockOffset) { 17933 let k = spectralStart; 17934 const e = spectralEnd; 17935 let r = 0; 17936 let s; 17937 let rs; 17938 while (k <= e) { 17939 const offsetZ = blockOffset + dctZigZag[k]; 17940 const sign = component.blockData[offsetZ] < 0 ? -1 : 1; 17941 switch (successiveACState) { 17942 case 0: 17943 rs = decodeHuffman(component.huffmanTableAC); 17944 s = rs & 15; 17945 r = rs >> 4; 17946 if (s === 0) { 17947 if (r < 15) { 17948 eobrun = receive(r) + (1 << r); 17949 successiveACState = 4; 17950 } else { 17951 r = 16; 17952 successiveACState = 1; 17953 } 17954 } else { 17955 if (s !== 1) { 17956 throw new JpegError("invalid ACn encoding"); 17957 } 17958 successiveACNextValue = receiveAndExtend(s); 17959 successiveACState = r ? 2 : 3; 17960 } 17961 continue; 17962 case 1: 17963 case 2: 17964 if (component.blockData[offsetZ]) { 17965 component.blockData[offsetZ] += sign * (readBit() << successive); 17966 } else { 17967 r--; 17968 if (r === 0) { 17969 successiveACState = successiveACState === 2 ? 3 : 0; 17970 } 17971 } 17972 break; 17973 case 3: 17974 if (component.blockData[offsetZ]) { 17975 component.blockData[offsetZ] += sign * (readBit() << successive); 17976 } else { 17977 component.blockData[offsetZ] = successiveACNextValue << successive; 17978 successiveACState = 0; 17979 } 17980 break; 17981 case 4: 17982 if (component.blockData[offsetZ]) { 17983 component.blockData[offsetZ] += sign * (readBit() << successive); 17984 } 17985 break; 17986 } 17987 k++; 17988 } 17989 if (successiveACState === 4) { 17990 eobrun--; 17991 if (eobrun === 0) { 17992 successiveACState = 0; 17993 } 17994 } 17995 } 17996 let blockRow = 0; 17997 function decodeMcu(component, decode, mcu, row, col) { 17998 const mcuRow = mcu / mcusPerLine | 0; 17999 const mcuCol = mcu % mcusPerLine; 18000 blockRow = mcuRow * component.v + row; 18001 const blockCol = mcuCol * component.h + col; 18002 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 18003 decode(component, blockOffset); 18004 } 18005 function decodeBlock(component, decode, mcu) { 18006 blockRow = mcu / component.blocksPerLine | 0; 18007 const blockCol = mcu % component.blocksPerLine; 18008 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 18009 decode(component, blockOffset); 18010 } 18011 const componentsLength = components.length; 18012 let component, i, j, k, n; 18013 let decodeFn; 18014 if (progressive) { 18015 if (spectralStart === 0) { 18016 decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; 18017 } else { 18018 decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; 18019 } 18020 } else { 18021 decodeFn = decodeBaseline; 18022 } 18023 let mcu = 0, 18024 fileMarker; 18025 const mcuExpected = componentsLength === 1 ? components[0].blocksPerLine * components[0].blocksPerColumn : mcusPerLine * frame.mcusPerColumn; 18026 let h, v; 18027 while (mcu <= mcuExpected) { 18028 const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected; 18029 if (mcuToRead > 0) { 18030 for (i = 0; i < componentsLength; i++) { 18031 components[i].pred = 0; 18032 } 18033 eobrun = 0; 18034 if (componentsLength === 1) { 18035 component = components[0]; 18036 for (n = 0; n < mcuToRead; n++) { 18037 decodeBlock(component, decodeFn, mcu); 18038 mcu++; 18039 } 18040 } else { 18041 for (n = 0; n < mcuToRead; n++) { 18042 for (i = 0; i < componentsLength; i++) { 18043 component = components[i]; 18044 h = component.h; 18045 v = component.v; 18046 for (j = 0; j < v; j++) { 18047 for (k = 0; k < h; k++) { 18048 decodeMcu(component, decodeFn, mcu, j, k); 18049 } 18050 } 18051 } 18052 mcu++; 18053 } 18054 } 18055 } 18056 bitsCount = 0; 18057 fileMarker = findNextFileMarker(data, offset); 18058 if (!fileMarker) { 18059 break; 18060 } 18061 if (fileMarker.invalid) { 18062 const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive"; 18063 (0, _util.warn)
vendor: 6,321 bytes, lines 18063-18295
18063(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`); 18064 offset = fileMarker.offset; 18065 } 18066 if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) { 18067 offset += 2; 18068 } else { 18069 break; 18070 } 18071 } 18072 return offset - startOffset; 18073} 18074function quantizeAndInverse(component, blockBufferOffset, p) { 18075 const qt = component.quantizationTable, 18076 blockData = component.blockData; 18077 let v0, v1, v2, v3, v4, v5, v6, v7; 18078 let p0, p1, p2, p3, p4, p5, p6, p7; 18079 let t; 18080 if (!qt) { 18081 throw new JpegError("missing required Quantization Table."); 18082 } 18083 for (let row = 0; row < 64; row += 8) { 18084 p0 = blockData[blockBufferOffset + row]; 18085 p1 = blockData[blockBufferOffset + row + 1]; 18086 p2 = blockData[blockBufferOffset + row + 2]; 18087 p3 = blockData[blockBufferOffset + row + 3]; 18088 p4 = blockData[blockBufferOffset + row + 4]; 18089 p5 = blockData[blockBufferOffset + row + 5]; 18090 p6 = blockData[blockBufferOffset + row + 6]; 18091 p7 = blockData[blockBufferOffset + row + 7]; 18092 p0 *= qt[row]; 18093 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 18094 t = dctSqrt2 * p0 + 512 >> 10; 18095 p[row] = t; 18096 p[row + 1] = t; 18097 p[row + 2] = t; 18098 p[row + 3] = t; 18099 p[row + 4] = t; 18100 p[row + 5] = t; 18101 p[row + 6] = t; 18102 p[row + 7] = t; 18103 continue; 18104 } 18105 p1 *= qt[row + 1]; 18106 p2 *= qt[row + 2]; 18107 p3 *= qt[row + 3]; 18108 p4 *= qt[row + 4]; 18109 p5 *= qt[row + 5]; 18110 p6 *= qt[row + 6]; 18111 p7 *= qt[row + 7]; 18112 v0 = dctSqrt2 * p0 + 128 >> 8; 18113 v1 = dctSqrt2 * p4 + 128 >> 8; 18114 v2 = p2; 18115 v3 = p6; 18116 v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8; 18117 v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8; 18118 v5 = p3 << 4; 18119 v6 = p5 << 4; 18120 v0 = v0 + v1 + 1 >> 1; 18121 v1 = v0 - v1; 18122 t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8; 18123 v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8; 18124 v3 = t; 18125 v4 = v4 + v6 + 1 >> 1; 18126 v6 = v4 - v6; 18127 v7 = v7 + v5 + 1 >> 1; 18128 v5 = v7 - v5; 18129 v0 = v0 + v3 + 1 >> 1; 18130 v3 = v0 - v3; 18131 v1 = v1 + v2 + 1 >> 1; 18132 v2 = v1 - v2; 18133 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12; 18134 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 18135 v7 = t; 18136 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 18137 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 18138 v6 = t; 18139 p[row] = v0 + v7; 18140 p[row + 7] = v0 - v7; 18141 p[row + 1] = v1 + v6; 18142 p[row + 6] = v1 - v6; 18143 p[row + 2] = v2 + v5; 18144 p[row + 5] = v2 - v5; 18145 p[row + 3] = v3 + v4; 18146 p[row + 4] = v3 - v4; 18147 } 18148 for (let col = 0; col < 8; ++col) { 18149 p0 = p[col]; 18150 p1 = p[col + 8]; 18151 p2 = p[col + 16]; 18152 p3 = p[col + 24]; 18153 p4 = p[col + 32]; 18154 p5 = p[col + 40]; 18155 p6 = p[col + 48]; 18156 p7 = p[col + 56]; 18157 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 18158 t = dctSqrt2 * p0 + 8192 >> 14; 18159 if (t < -2040) { 18160 t = 0; 18161 } else if (t >= 2024) { 18162 t = 255; 18163 } else { 18164 t = t + 2056 >> 4; 18165 } 18166 blockData[blockBufferOffset + col] = t; 18167 blockData[blockBufferOffset + col + 8] = t; 18168 blockData[blockBufferOffset + col + 16] = t; 18169 blockData[blockBufferOffset + col + 24] = t; 18170 blockData[blockBufferOffset + col + 32] = t; 18171 blockData[blockBufferOffset + col + 40] = t; 18172 blockData[blockBufferOffset + col + 48] = t; 18173 blockData[blockBufferOffset + col + 56] = t; 18174 continue; 18175 } 18176 v0 = dctSqrt2 * p0 + 2048 >> 12; 18177 v1 = dctSqrt2 * p4 + 2048 >> 12; 18178 v2 = p2; 18179 v3 = p6; 18180 v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12; 18181 v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12; 18182 v5 = p3; 18183 v6 = p5; 18184 v0 = (v0 + v1 + 1 >> 1) + 4112; 18185 v1 = v0 - v1; 18186 t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12; 18187 v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12; 18188 v3 = t; 18189 v4 = v4 + v6 + 1 >> 1; 18190 v6 = v4 - v6; 18191 v7 = v7 + v5 + 1 >> 1; 18192 v5 = v7 - v5; 18193 v0 = v0 + v3 + 1 >> 1; 18194 v3 = v0 - v3; 18195 v1 = v1 + v2 + 1 >> 1; 18196 v2 = v1 - v2; 18197 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12; 18198 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 18199 v7 = t; 18200 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 18201 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 18202 v6 = t; 18203 p0 = v0 + v7; 18204 p7 = v0 - v7; 18205 p1 = v1 + v6; 18206 p6 = v1 - v6; 18207 p2 = v2 + v5; 18208 p5 = v2 - v5; 18209 p3 = v3 + v4; 18210 p4 = v3 - v4; 18211 if (p0 < 16) { 18212 p0 = 0; 18213 } else if (p0 >= 4080) { 18214 p0 = 255; 18215 } else { 18216 p0 >>= 4; 18217 } 18218 if (p1 < 16) { 18219 p1 = 0; 18220 } else if (p1 >= 4080) { 18221 p1 = 255; 18222 } else { 18223 p1 >>= 4; 18224 } 18225 if (p2 < 16) { 18226 p2 = 0; 18227 } else if (p2 >= 4080) { 18228 p2 = 255; 18229 } else { 18230 p2 >>= 4; 18231 } 18232 if (p3 < 16) { 18233 p3 = 0; 18234 } else if (p3 >= 4080) { 18235 p3 = 255; 18236 } else { 18237 p3 >>= 4; 18238 } 18239 if (p4 < 16) { 18240 p4 = 0; 18241 } else if (p4 >= 4080) { 18242 p4 = 255; 18243 } else { 18244 p4 >>= 4; 18245 } 18246 if (p5 < 16) { 18247 p5 = 0; 18248 } else if (p5 >= 4080) { 18249 p5 = 255; 18250 } else { 18251 p5 >>= 4; 18252 } 18253 if (p6 < 16) { 18254 p6 = 0; 18255 } else if (p6 >= 4080) { 18256 p6 = 255; 18257 } else { 18258 p6 >>= 4; 18259 } 18260 if (p7 < 16) { 18261 p7 = 0; 18262 } else if (p7 >= 4080) { 18263 p7 = 255; 18264 } else { 18265 p7 >>= 4; 18266 } 18267 blockData[blockBufferOffset + col] = p0; 18268 blockData[blockBufferOffset + col + 8] = p1; 18269 blockData[blockBufferOffset + col + 16] = p2; 18270 blockData[blockBufferOffset + col + 24] = p3; 18271 blockData[blockBufferOffset + col + 32] = p4; 18272 blockData[blockBufferOffset + col + 40] = p5; 18273 blockData[blockBufferOffset + col + 48] = p6; 18274 blockData[blockBufferOffset + col + 56] = p7; 18275 } 18276} 18277function buildComponentData(frame, component) { 18278 const blocksPerLine = component.blocksPerLine; 18279 const blocksPerColumn = component.blocksPerColumn; 18280 const computationBuffer = new Int16Array(64); 18281 for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) { 18282 for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) { 18283 const offset = getBlockBufferOffset(component, blockRow, blockCol); 18284 quantizeAndInverse(component, offset, computationBuffer); 18285 } 18286 } 18287 return component.blockData; 18288} 18289function findNextFileMarker(data, currentPos, startPos = currentPos) { 18290 const maxPos = data.length - 1; 18291 let newPos = startPos < currentPos ? startPos : currentPos; 18292 if (currentPos >= maxPos) { 18293 return null; 18294 } 18295 const currentMarker =
18295(0, _core_utils.readUint16)(data, currentPos); 18296 if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) { 18297 return { 18298 invalid: null, 18299 marker: currentMarker, 18300 offset: currentPos 18301 }; 18302 } 18303 let newMarker = (0, _core_utils.readUint16)(data, newPos); 18304 while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) { 18305 if (++newPos >= maxPos) { 18306 return null; 18307 } 18308 newMarker = (0, _core_utils.readUint16)(data, newPos); 18309 } 18310 return { 18311 invalid: currentMarker.toString(16), 18312 marker: newMarker, 18313 offset: newPos 18314 }; 18315} 18316class JpegImage { 18317 constructor({ 18318 decodeTransform = null, 18319 colorTransform = -1 18320 } = {}) { 18321 this._decodeTransform = decodeTransform; 18322 this._colorTransform = colorTransform; 18323 } 18324 parse(data, { 18325 dnlScanLines = null 18326 } = {}) { 18327 function readDataBlock() { 18328 const length = (0, _core_utils.readUint16)(data, offset); 18329 offset += 2; 18330 let endOffset = offset + length - 2; 18331 const fileMarker = findNextFileMarker(data, endOffset, offset); 18332 if (fileMarker?.invalid) { 18333 (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid); 18334 endOffset = fileMarker.offset; 18335 } 18336 const array = data.subarray(offset, endOffset); 18337 offset += array.length; 18338 return array; 18339 } 18340 function prepareComponents(frame) { 18341 const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH); 18342 const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV); 18343 for (const component of frame.components) { 18344 const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH); 18345 const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV); 18346 const blocksPerLineForMcu = mcusPerLine * component.h; 18347 const blocksPerColumnForMcu = mcusPerColumn * component.v; 18348 const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1); 18349 component.blockData = new Int16Array(blocksBufferSize); 18350 component.blocksPerLine = blocksPerLine; 18351 component.blocksPerColumn = blocksPerColumn; 18352 } 18353 frame.mcusPerLine = mcusPerLine; 18354 frame.mcusPerColumn = mcusPerColumn; 18355 } 18356 let offset = 0; 18357 let jfif = null; 18358 let adobe = null; 18359 let frame, resetInterval; 18360 let numSOSMarkers = 0; 18361 const quantizationTables = []; 18362 const huffmanTablesAC = [], 18363 huffmanTablesDC = []; 18364 let fileMarker = (0, _core_utils.readUint16)(data, offset); 18365 offset += 2; 18366 if (fileMarker !== 0xffd8) { 18367 throw new JpegError("SOI not found"); 18368 } 18369 fileMarker = (0, _core_utils.readUint16)(data, offset); 18370 offset += 2; 18371 markerLoop: while (fileMarker !== 0xffd9) { 18372 let i, j, l; 18373 switch (fileMarker) { 18374 case 0xffe0: 18375 case 0xffe1: 18376 case 0xffe2: 18377 case 0xffe3: 18378 case 0xffe4: 18379 case 0xffe5: 18380 case 0xffe6: 18381 case 0xffe7: 18382 case 0xffe8: 18383 case 0xffe9: 18384 case 0xffea: 18385 case 0xffeb: 18386 case 0xffec: 18387 case 0xffed: 18388 case 0xffee: 18389 case 0xffef: 18390 case 0xfffe: 18391 const appData = readDataBlock(); 18392 if (fileMarker === 0xffe0) { 18393 if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) { 18394 jfif = { 18395 version: { 18396 major: appData[5], 18397 minor: appData[6] 18398 }, 18399 densityUnits: appData[7], 18400 xDensity: appData[8] << 8 | appData[9], 18401 yDensity: appData[10] << 8 | appData[11], 18402 thumbWidth: appData[12],
vendor: 11,160 bytes, lines 18403-18692
18403 thumbHeight: appData[13], 18404 thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) 18405 }; 18406 } 18407 } 18408 if (fileMarker === 0xffee) { 18409 if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) { 18410 adobe = { 18411 version: appData[5] << 8 | appData[6], 18412 flags0: appData[7] << 8 | appData[8], 18413 flags1: appData[9] << 8 | appData[10], 18414 transformCode: appData[11] 18415 }; 18416 } 18417 } 18418 break; 18419 case 0xffdb: 18420 const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset); 18421 offset += 2; 18422 const quantizationTablesEnd = quantizationTablesLength + offset - 2; 18423 let z; 18424 while (offset < quantizationTablesEnd) { 18425 const quantizationTableSpec = data[offset++]; 18426 const tableData = new Uint16Array(64); 18427 if (quantizationTableSpec >> 4 === 0) { 18428 for (j = 0; j < 64; j++) { 18429 z = dctZigZag[j]; 18430 tableData[z] = data[offset++]; 18431 } 18432 } else if (quantizationTableSpec >> 4 === 1) { 18433 for (j = 0; j < 64; j++) { 18434 z = dctZigZag[j]; 18435 tableData[z] = (0, _core_utils.readUint16)(data, offset); 18436 offset += 2; 18437 } 18438 } else { 18439 throw new JpegError("DQT - invalid table spec"); 18440 } 18441 quantizationTables[quantizationTableSpec & 15] = tableData; 18442 } 18443 break; 18444 case 0xffc0: 18445 case 0xffc1: 18446 case 0xffc2: 18447 if (frame) { 18448 throw new JpegError("Only single frame JPEGs supported"); 18449 } 18450 offset += 2; 18451 frame = {}; 18452 frame.extended = fileMarker === 0xffc1; 18453 frame.progressive = fileMarker === 0xffc2; 18454 frame.precision = data[offset++]; 18455 const sofScanLines = (0, _core_utils.readUint16)(data, offset); 18456 offset += 2; 18457 frame.scanLines = dnlScanLines || sofScanLines; 18458 frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset); 18459 offset += 2; 18460 frame.components = []; 18461 frame.componentIds = {}; 18462 const componentsCount = data[offset++]; 18463 let maxH = 0, 18464 maxV = 0; 18465 for (i = 0; i < componentsCount; i++) { 18466 const componentId = data[offset]; 18467 const h = data[offset + 1] >> 4; 18468 const v = data[offset + 1] & 15; 18469 if (maxH < h) { 18470 maxH = h; 18471 } 18472 if (maxV < v) { 18473 maxV = v; 18474 } 18475 const qId = data[offset + 2]; 18476 l = frame.components.push({ 18477 h, 18478 v, 18479 quantizationId: qId, 18480 quantizationTable: null 18481 }); 18482 frame.componentIds[componentId] = l - 1; 18483 offset += 3; 18484 } 18485 frame.maxH = maxH; 18486 frame.maxV = maxV; 18487 prepareComponents(frame); 18488 break; 18489 case 0xffc4: 18490 const huffmanLength = (0, _core_utils.readUint16)(data, offset); 18491 offset += 2; 18492 for (i = 2; i < huffmanLength;) { 18493 const huffmanTableSpec = data[offset++]; 18494 const codeLengths = new Uint8Array(16); 18495 let codeLengthSum = 0; 18496 for (j = 0; j < 16; j++, offset++) { 18497 codeLengthSum += codeLengths[j] = data[offset]; 18498 } 18499 const huffmanValues = new Uint8Array(codeLengthSum); 18500 for (j = 0; j < codeLengthSum; j++, offset++) { 18501 huffmanValues[j] = data[offset]; 18502 } 18503 i += 17 + codeLengthSum; 18504 (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues); 18505 } 18506 break; 18507 case 0xffdd: 18508 offset += 2; 18509 resetInterval = (0, _core_utils.readUint16)(data, offset); 18510 offset += 2; 18511 break; 18512 case 0xffda: 18513 const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines; 18514 offset += 2; 18515 const selectorsCount = data[offset++], 18516 components = []; 18517 for (i = 0; i < selectorsCount; i++) { 18518 const index = data[offset++]; 18519 const componentIndex = frame.componentIds[index]; 18520 const component = frame.components[componentIndex]; 18521 component.index = index; 18522 const tableSpec = data[offset++]; 18523 component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; 18524 component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; 18525 components.push(component); 18526 } 18527 const spectralStart = data[offset++], 18528 spectralEnd = data[offset++], 18529 successiveApproximation = data[offset++]; 18530 try { 18531 const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker); 18532 offset += processed; 18533 } catch (ex) { 18534 if (ex instanceof DNLMarkerError) { 18535 (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`); 18536 return this.parse(data, { 18537 dnlScanLines: ex.scanLines 18538 }); 18539 } else if (ex instanceof EOIMarkerError) { 18540 (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`); 18541 break markerLoop; 18542 } 18543 throw ex; 18544 } 18545 break; 18546 case 0xffdc: 18547 offset += 4; 18548 break; 18549 case 0xffff: 18550 if (data[offset] !== 0xff) { 18551 offset--; 18552 } 18553 break; 18554 default: 18555 const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3); 18556 if (nextFileMarker?.invalid) { 18557 (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid); 18558 offset = nextFileMarker.offset; 18559 break; 18560 } 18561 if (!nextFileMarker || offset >= data.length - 1) { 18562 (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9)."); 18563 break markerLoop; 18564 } 18565 throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16)); 18566 } 18567 fileMarker = (0, _core_utils.readUint16)(data, offset); 18568 offset += 2; 18569 } 18570 this.width = frame.samplesPerLine; 18571 this.height = frame.scanLines; 18572 this.jfif = jfif; 18573 this.adobe = adobe; 18574 this.components = []; 18575 for (const component of frame.components) { 18576 const quantizationTable = quantizationTables[component.quantizationId]; 18577 if (quantizationTable) { 18578 component.quantizationTable = quantizationTable; 18579 } 18580 this.components.push({ 18581 index: component.index, 18582 output: buildComponentData(frame, component), 18583 scaleX: component.h / frame.maxH, 18584 scaleY: component.v / frame.maxV, 18585 blocksPerLine: component.blocksPerLine, 18586 blocksPerColumn: component.blocksPerColumn 18587 }); 18588 } 18589 this.numComponents = this.components.length; 18590 return undefined; 18591 } 18592 _getLinearizedBlockData(width, height, isSourcePDF = false) { 18593 const scaleX = this.width / width, 18594 scaleY = this.height / height; 18595 let component, componentScaleX, componentScaleY, blocksPerScanline; 18596 let x, y, i, j, k; 18597 let index; 18598 let offset = 0; 18599 let output; 18600 const numComponents = this.components.length; 18601 const dataLength = width * height * numComponents; 18602 const data = new Uint8ClampedArray(dataLength); 18603 const xScaleBlockOffset = new Uint32Array(width); 18604 const mask3LSB = 0xfffffff8; 18605 let lastComponentScaleX; 18606 for (i = 0; i < numComponents; i++) { 18607 component = this.components[i]; 18608 componentScaleX = component.scaleX * scaleX; 18609 componentScaleY = component.scaleY * scaleY; 18610 offset = i; 18611 output = component.output; 18612 blocksPerScanline = component.blocksPerLine + 1 << 3; 18613 if (componentScaleX !== lastComponentScaleX) { 18614 for (x = 0; x < width; x++) { 18615 j = 0 | x * componentScaleX; 18616 xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7; 18617 } 18618 lastComponentScaleX = componentScaleX; 18619 } 18620 for (y = 0; y < height; y++) { 18621 j = 0 | y * componentScaleY; 18622 index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3; 18623 for (x = 0; x < width; x++) { 18624 data[offset] = output[index + xScaleBlockOffset[x]]; 18625 offset += numComponents; 18626 } 18627 } 18628 } 18629 let transform = this._decodeTransform; 18630 if (!isSourcePDF && numComponents === 4 && !transform) { 18631 transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]); 18632 } 18633 if (transform) { 18634 for (i = 0; i < dataLength;) { 18635 for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) { 18636 data[i] = (data[i] * transform[k] >> 8) + transform[k + 1]; 18637 } 18638 } 18639 } 18640 return data; 18641 } 18642 get _isColorConversionNeeded() { 18643 if (this.adobe) { 18644 return !!this.adobe.transformCode; 18645 } 18646 if (this.numComponents === 3) { 18647 if (this._colorTransform === 0) { 18648 return false; 18649 } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) { 18650 return false; 18651 } 18652 return true; 18653 } 18654 if (this._colorTransform === 1) { 18655 return true; 18656 } 18657 return false; 18658 } 18659 _convertYccToRgb(data) { 18660 let Y, Cb, Cr; 18661 for (let i = 0, length = data.length; i < length; i += 3) { 18662 Y = data[i]; 18663 Cb = data[i + 1]; 18664 Cr = data[i + 2]; 18665 data[i] = Y - 179.456 + 1.402 * Cr; 18666 data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr; 18667 data[i + 2] = Y - 226.816 + 1.772 * Cb; 18668 } 18669 return data; 18670 } 18671 _convertYccToRgba(data, out) { 18672 for (let i = 0, j = 0, length = data.length; i < length; i += 3, j += 4) { 18673 const Y = data[i]; 18674 const Cb = data[i + 1]; 18675 const Cr = data[i + 2]; 18676 out[j] = Y - 179.456 + 1.402 * Cr; 18677 out[j + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr; 18678 out[j + 2] = Y - 226.816 + 1.772 * Cb; 18679 out[j + 3] = 255; 18680 } 18681 return out; 18682 } 18683 _convertYcckToRgb(data) { 18684 let Y, Cb, Cr, k; 18685 let offset = 0; 18686 for (let i = 0, length = data.length; i < length; i += 4) { 18687 Y = data[i]; 18688 Cb = data[i + 1]; 18689 Cr = data[i + 2]; 18690 k = data[i + 3]; 18691 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); 18692 data[offset++] = 107.268039397724 + Cb * (2.19927104525741e
18692-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); 18693 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); 18694 } 18695 return data.subarray(0, offset); 18696 } 18697 _convertYcckToRgba(data) { 18698 for (let i = 0, length = data.length; i < length; i += 4) { 18699 const Y = data[i]; 18700 const Cb = data[i + 1]; 18701 const Cr = data[i + 2]; 18702 const k = data[i + 3]; 18703 data[i] = -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); 18704 data[i + 1] = 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); 18705 data[i + 2] = -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); 18706 data[i + 3] = 255; 18707 } 18708 return data; 18709 } 18710 _convertYcckToCmyk(data) { 18711 let Y, Cb, Cr; 18712 for (let i = 0, length = data.length; i < length; i += 4) { 18713 Y = data[i]; 18714 Cb = data[i + 1]; 18715 Cr = data[i + 2]; 18716 data[i] = 434.456 - Y - 1.402 * Cr; 18717 data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr; 18718 data[i + 2] = 481.816 - Y - 1.772 * Cb; 18719 } 18720 return data; 18721 } 18722 _convertCmykToRgb(data) {
vendor: 7,572 bytes, lines 18723-18892
18723 let c, m, y, k; 18724 let offset = 0; 18725 for (let i = 0, length = data.length; i < length; i += 4) { 18726 c = data[i]; 18727 m = data[i + 1]; 18728 y = data[i + 2]; 18729 k = data[i + 3]; 18730 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); 18731 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); 18732 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); 18733 } 18734 return data.subarray(0, offset); 18735 } 18736 _convertCmykToRgba(data) { 18737 for (let i = 0, length = data.length; i < length; i += 4) { 18738 const c = data[i]; 18739 const m = data[i + 1]; 18740 const y = data[i + 2]; 18741 const k = data[i + 3]; 18742 data[i] = 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); 18743 data[i + 1] = 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); 18744 data[i + 2] = 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); 18745 data[i + 3] = 255; 18746 } 18747 return data; 18748 } 18749 getData({ 18750 width, 18751 height, 18752 forceRGBA = false, 18753 forceRGB = false, 18754 isSourcePDF = false 18755 }) { 18756 if (this.numComponents > 4) { 18757 throw new JpegError("Unsupported color mode"); 18758 } 18759 const data = this._getLinearizedBlockData(width, height, isSourcePDF); 18760 if (this.numComponents === 1 && (forceRGBA || forceRGB)) { 18761 const len = data.length * (forceRGBA ? 4 : 3); 18762 const rgbaData = new Uint8ClampedArray(len); 18763 let offset = 0; 18764 if (forceRGBA) { 18765 (0, _image_utils.grayToRGBA)(data, new Uint32Array(rgbaData.buffer)); 18766 } else { 18767 for (const grayColor of data) { 18768 rgbaData[offset++] = grayColor; 18769 rgbaData[offset++] = grayColor; 18770 rgbaData[offset++] = grayColor; 18771 } 18772 } 18773 return rgbaData; 18774 } else if (this.numComponents === 3 && this._isColorConversionNeeded) { 18775 if (forceRGBA) { 18776 const rgbaData = new Uint8ClampedArray(data.length / 3 * 4); 18777 return this._convertYccToRgba(data, rgbaData); 18778 } 18779 return this._convertYccToRgb(data); 18780 } else if (this.numComponents === 4) { 18781 if (this._isColorConversionNeeded) { 18782 if (forceRGBA) { 18783 return this._convertYcckToRgba(data); 18784 } 18785 if (forceRGB) { 18786 return this._convertYcckToRgb(data); 18787 } 18788 return this._convertYcckToCmyk(data); 18789 } else if (forceRGBA) { 18790 return this._convertCmykToRgba(data); 18791 } else if (forceRGB) { 18792 return this._convertCmykToRgb(data); 18793 } 18794 } 18795 return data; 18796 } 18797} 18798exports.JpegImage = JpegImage; 18799 18800/***/ }), 18801/* 28 */ 18802/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 18803 18804 18805 18806Object.defineProperty(exports, "__esModule", ({ 18807 value: true 18808})); 18809exports.convertBlackAndWhiteToRGBA = convertBlackAndWhiteToRGBA; 18810exports.convertToRGBA = convertToRGBA; 18811exports.grayToRGBA = grayToRGBA; 18812var _util = __w_pdfjs_require__(2); 18813function convertToRGBA(params) { 18814 switch (params.kind) { 18815 case _util.ImageKind.GRAYSCALE_1BPP: 18816 return convertBlackAndWhiteToRGBA(params); 18817 case _util.ImageKind.RGB_24BPP: 18818 return convertRGBToRGBA(params); 18819 } 18820 return null; 18821} 18822function convertBlackAndWhiteToRGBA({ 18823 src, 18824 srcPos = 0, 18825 dest, 18826 width, 18827 height, 18828 nonBlackColor = 0xffffffff, 18829 inverseDecode = false 18830}) { 18831 const black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff; 18832 const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor]; 18833 const widthInSource = width >> 3; 18834 const widthRemainder = width & 7; 18835 const srcLength = src.length; 18836 dest = new Uint32Array(dest.buffer); 18837 let destPos = 0; 18838 for (let i = 0; i < height; i++) { 18839 for (const max = srcPos + widthInSource; srcPos < max; srcPos++) { 18840 const elem = srcPos < srcLength ? src[srcPos] : 255; 18841 dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping; 18842 dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping; 18843 dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping; 18844 dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping; 18845 dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping; 18846 dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping; 18847 dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping; 18848 dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping; 18849 } 18850 if (widthRemainder === 0) { 18851 continue; 18852 } 18853 const elem = srcPos < srcLength ? src[srcPos++] : 255; 18854 for (let j = 0; j < widthRemainder; j++) { 18855 dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping; 18856 } 18857 } 18858 return { 18859 srcPos, 18860 destPos 18861 }; 18862} 18863function convertRGBToRGBA({ 18864 src, 18865 srcPos = 0, 18866 dest, 18867 destPos = 0, 18868 width, 18869 height 18870}) { 18871 let i = 0; 18872 const len32 = src.length >> 2; 18873 const src32 = new Uint32Array(src.buffer, srcPos, len32); 18874 if (_util.FeatureTest.isLittleEndian) { 18875 for (; i < len32 - 2; i += 3, destPos += 4) { 18876 const s1 = src32[i]; 18877 const s2 = src32[i + 1]; 18878 const s3 = src32[i + 2]; 18879 dest[destPos] = s1 | 0xff000000; 18880 dest[destPos + 1] = s1 >>> 24 | s2 << 8 | 0xff000000; 18881 dest[destPos + 2] = s2 >>> 16 | s3 << 16 | 0xff000000; 18882 dest[destPos + 3] = s3 >>> 8 | 0xff000000; 18883 } 18884 for (let j = i * 4, jj = src.length; j < jj; j += 3) { 18885 dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | 0xff000000; 18886 } 18887 } else { 18888 for (; i < len32 - 2; i += 3, destPos += 4) { 18889 const s1 = src32[i]; 18890 const s2 = src32[i + 1]; 18891 const s3 = src32[i + 2]; 18892 dest[destPos] = s1 | 0xff;
18893 dest[destPos + 1] = s1 << 24 | s2 >>> 8 | 0xff; 18894 dest[destPos + 2] = s2 << 16 | s3 >>> 16 | 0xff; 18895 dest[destPos + 3] = s3 << 8 | 0xff; 18896 } 18897 for (let j = i * 4, jj = src.length; j < jj; j += 3) { 18898 dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | 0xff; 18899 } 18900 } 18901 return { 18902 srcPos, 18903 destPos 18904 }; 18905} 18906function grayToRGBA(src, dest) { 18907 if (_util.FeatureTest.isLittleEndian) { 18908 for (let i = 0, ii = src.length; i < ii; i++) { 18909 dest[i] = src[i] * 0x10101 | 0xff000000; 18910 } 18911 } else { 18912 for (let i = 0, ii = src.length; i < ii; i++) { 18913 dest[i] = src[i] * 0x1010100 | 0x000000ff; 18914 } 18915 } 18916} 18917 18918/***/ }), 18919/* 29 */ 18920/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 18921 18922 18923 18924Object.defineProperty(exports, "__esModule", ({ 18925 value: true 18926})); 18927exports.JpxStream = void 0; 18928var _decode_stream = __w_pdfjs_require__(18); 18929var _jpx = __w_pdfjs_require__(30); 18930var _util = __w_pdfjs_require__(2); 18931class JpxStream extends _decode_stream.DecodeStream { 18932 constructor(stream, maybeLength, params) { 18933 super(maybeLength); 18934 this.stream = stream; 18935 this.dict = stream.dict; 18936 this.maybeLength = maybeLength; 18937 this.params = params; 18938 } 18939 get bytes() { 18940 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 18941 } 18942 ensureBuffer(requested) {} 18943 readBlock() { 18944 if (this.eof) { 18945 return; 18946 } 18947 const jpxImage = new _jpx.JpxImage(); 18948 jpxImage.parse(this.bytes); 18949 const width = jpxImage.width; 18950 const height = jpxImage.height; 18951 const componentsCount = jpxImage.componentsCount; 18952 const tileCount = jpxImage.tiles.length; 18953 if (tileCount === 1) { 18954 this.buffer = jpxImage.tiles[0].items; 18955 } else { 18956 const data = new Uint8ClampedArray(width * height * componentsCount); 18957 for (let k = 0; k < tileCount; k++) { 18958 const tileComponents = jpxImage.tiles[k]; 18959 const tileWidth = tileComponents.width; 18960 const tileHeight = tileComponents.height; 18961 const tileLeft = tileComponents.left; 18962 const tileTop = tileComponents.top; 18963 const src = tileComponents.items; 18964 let srcPosition = 0; 18965 let dataPosition = (width * tileTop + tileLeft) * componentsCount; 18966 const imgRowSize = width * componentsCount; 18967 const tileRowSize = tileWidth * componentsCount; 18968 for (let j = 0; j < tileHeight; j++) { 18969 const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize); 18970 data.set(rowBytes, dataPosition); 18971 srcPosition += tileRowSize; 18972 dataPosition += imgRowSize; 18973 } 18974 } 18975 this.buffer = data; 18976 } 18977 this.bufferLength = this.buffer.length; 18978 this.eof = true; 18979 } 18980} 18981exports.JpxStream = JpxStream; 18982 18983/***/ }), 18984/* 30 */ 18985/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 18986 18987 18988 18989Object.defineProperty(exports, "__esModule", ({ 18990 value: true 18991})); 18992exports.JpxImage = void 0; 18993var _util = __w_pdfjs_require__(2); 18994var _core_utils = __w_pdfjs_require__(3); 18995var _arithmetic_decoder = __w_pdfjs_require__(25); 18996class JpxError extends _util.BaseException { 18997 constructor(msg) { 18998 super(`JPX error: ${msg}`, "JpxError"); 18999 } 19000} 19001const SubbandsGainLog2 = { 19002 LL: 0, 19003 LH: 1, 19004 HL: 1, 19005 HH: 2 19006}; 19007class JpxImage { 19008 constructor() { 19009 this.failOnCorruptedImage = false; 19010 } 19011 parse(data) { 19012 const head = (0, _core_utils.readUint16)(data, 0); 19013 if (head === 0xff4f) { 19014 this.parseCodestream(data, 0, data.length); 19015 return; 19016 } 19017 const length = data.length; 19018 let position = 0; 19019 while (position < length) { 19020 let headerSize = 8; 19021 let lbox = (0, _core_utils.readUint32)(data, position); 19022 const tbox = (0, _core_utils.readUint32)(data, position + 4); 19023 position += headerSize; 19024 if (lbox === 1) { 19025 lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4); 19026 position += 8; 19027 headerSize += 8; 19028 } 19029 if (lbox === 0) { 19030 lbox = length - position + headerSize; 19031 } 19032 if (lbox < headerSize) { 19033 throw new JpxError("Invalid box field size"); 19034 } 19035 const dataLength = lbox - headerSize; 19036 let jumpDataLength = true; 19037 switch (tbox) { 19038 case 0x6a703268: 19039 jumpDataLength = false;
19040 break; 19041 case 0x636f6c72: 19042 const method = data[position]; 19043 if (method === 1) { 19044 const colorspace = (0, _core_utils.readUint32)(data, position + 3); 19045 switch (colorspace) { 19046 case 16: 19047 case 17: 19048 case 18: 19049 break; 19050 default: 19051 (0, _util.warn)("Unknown colorspace " + colorspace); 19052 break; 19053 } 19054 } else if (method === 2) { 19055 (0, _util.info)("ICC profile not supported"); 19056 } 19057 break; 19058 case 0x6a703263: 19059 this.parseCodestream(data, position, position + dataLength); 19060 break; 19061 case 0x6a502020: 19062 if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) { 19063 (0, _util.warn)("Invalid JP2 signature"); 19064 } 19065 break; 19066 case 0x6a501a1a: 19067 case 0x66747970: 19068 case 0x72726571: 19069 case 0x72657320: 19070 case 0x69686472: 19071 break; 19072 default: 19073 const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff); 19074 (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`); 19075 break; 19076 } 19077 if (jumpDataLength) { 19078 position += dataLength; 19079 } 19080 } 19081 } 19082 parseImageProperties(stream) { 19083 let newByte = stream.getByte(); 19084 while (newByte >= 0) { 19085 const oldByte = newByte; 19086 newByte = stream.getByte(); 19087 const code = oldByte << 8 | newByte; 19088 if (code === 0xff51) { 19089 stream.skip(4); 19090 const Xsiz = stream.getInt32() >>> 0; 19091 const Ysiz = stream.getInt32() >>> 0; 19092 const XOsiz = stream.getInt32() >>> 0; 19093 const YOsiz = stream.getInt32() >>> 0; 19094 stream.skip(16); 19095 const Csiz = stream.getUint16(); 19096 this.width = Xsiz - XOsiz; 19097 this.height = Ysiz - YOsiz; 19098 this.componentsCount = Csiz; 19099 this.bitsPerComponent = 8; 19100 return; 19101 } 19102 } 19103 throw new JpxError("No size marker found in JPX stream"); 19104 } 19105 parseCodestream(data, start, end) { 19106 const context = {}; 19107 let doNotRecover = false; 19108 try { 19109 let position = start; 19110 while (position + 1 < end) { 19111 const code = (0, _core_utils.readUint16)(data, position); 19112 position += 2; 19113 let length = 0, 19114 j, 19115 sqcd, 19116 spqcds, 19117 spqcdSize, 19118 scalarExpounded, 19119 tile; 19120 switch (code) { 19121 case 0xff4f: 19122 context.mainHeader = true; 19123 break; 19124 case 0xffd9: 19125 break; 19126 case 0xff51: 19127 length = (0, _core_utils.readUint16)(data, position); 19128 const siz = {}; 19129 siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4); 19130 siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8); 19131 siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12); 19132 siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16); 19133 siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20); 19134 siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24); 19135 siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28); 19136 siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32); 19137 const componentsCount = (0, _core_utils.readUint16)(data, position + 36); 19138 siz.Csiz = componentsCount; 19139 const components = []; 19140 j = position + 38; 19141 for (let i = 0; i < componentsCount; i++) { 19142 const component = { 19143 precision: (data[j] & 0x7f) + 1, 19144 isSigned: !!(data[j] & 0x80), 19145 XRsiz: data[j + 1], 19146 YRsiz: data[j + 2] 19147 }; 19148 j += 3; 19149 calculateComponentDimensions(component, siz); 19150 components.push(component); 19151 } 19152 context.SIZ = siz; 19153 context.components = components; 19154 calculateTileGrids(context, components); 19155 context.QCC = []; 19156 context.COC = []; 19157 break; 19158 case 0xff5c: 19159 length = (0, _core_utils.readUint16)(data, position); 19160 const qcd = {}; 19161 j = position + 2; 19162 sqcd = data[j++]; 19163 switch (sqcd & 0x1f) { 19164 case 0: 19165 spqcdSize = 8; 19166 scalarExpounded = true; 19167 break; 19168 case 1: 19169 spqcdSize = 16; 19170 scalarExpounded = false;
19171 break; 19172 case 2: 19173 spqcdSize = 16; 19174 scalarExpounded = true; 19175 break; 19176 default: 19177 throw new Error("Invalid SQcd value " + sqcd); 19178 } 19179 qcd.noQuantization = spqcdSize === 8; 19180 qcd.scalarExpounded = scalarExpounded; 19181 qcd.guardBits = sqcd >> 5; 19182 spqcds = []; 19183 while (j < length + position) { 19184 const spqcd = {}; 19185 if (spqcdSize === 8) { 19186 spqcd.epsilon = data[j++] >> 3; 19187 spqcd.mu = 0; 19188 } else { 19189 spqcd.epsilon = data[j] >> 3; 19190 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 19191 j += 2; 19192 } 19193 spqcds.push(spqcd); 19194 } 19195 qcd.SPqcds = spqcds; 19196 if (context.mainHeader) { 19197 context.QCD = qcd; 19198 } else { 19199 context.currentTile.QCD = qcd; 19200 context.currentTile.QCC = []; 19201 } 19202 break; 19203 case 0xff5d: 19204 length = (0, _core_utils.readUint16)(data, position); 19205 const qcc = {}; 19206 j = position + 2; 19207 let cqcc; 19208 if (context.SIZ.Csiz < 257) { 19209 cqcc = data[j++]; 19210 } else { 19211 cqcc = (0, _core_utils.readUint16)(data, j); 19212 j += 2; 19213 } 19214 sqcd = data[j++]; 19215 switch (sqcd & 0x1f) { 19216 case 0: 19217 spqcdSize = 8; 19218 scalarExpounded = true; 19219 break; 19220 case 1: 19221 spqcdSize = 16; 19222 scalarExpounded = false; 19223 break; 19224 case 2: 19225 spqcdSize = 16; 19226 scalarExpounded = true; 19227 break; 19228 default: 19229 throw new Error("Invalid SQcd value " + sqcd); 19230 } 19231 qcc.noQuantization = spqcdSize === 8; 19232 qcc.scalarExpounded = scalarExpounded; 19233 qcc.guardBits = sqcd >> 5; 19234 spqcds = []; 19235 while (j < length + position) { 19236 const spqcd = {}; 19237 if (spqcdSize === 8) { 19238 spqcd.epsilon = data[j++] >> 3; 19239 spqcd.mu = 0; 19240 } else { 19241 spqcd.epsilon = data[j] >> 3; 19242 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 19243 j += 2; 19244 } 19245 spqcds.push(spqcd); 19246 } 19247 qcc.SPqcds = spqcds; 19248 if (context.mainHeader) { 19249 context.QCC[cqcc] = qcc; 19250 } else { 19251 context.currentTile.QCC[cqcc] = qcc; 19252 } 19253 break; 19254 case 0xff52: 19255 length = (0, _core_utils.readUint16)(data, position); 19256 const cod = {}; 19257 j = position + 2; 19258 const scod = data[j++]; 19259 cod.entropyCoderWithCustomPrecincts = !!(scod & 1); 19260 cod.sopMarkerUsed = !!(scod & 2); 19261 cod.ephMarkerUsed = !!(scod & 4); 19262 cod.progressionOrder = data[j++]; 19263 cod.layersCount = (0, _core_utils.readUint16)(data, j); 19264 j += 2; 19265 cod.multipleComponentTransform = data[j++]; 19266 cod.decompositionLevelsCount = data[j++]; 19267 cod.xcb = (data[j++] & 0xf) + 2; 19268 cod.ycb = (data[j++] & 0xf) + 2; 19269 const blockStyle = data[j++]; 19270 cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1); 19271 cod.resetContextProbabilities = !!(blockStyle & 2); 19272 cod.terminationOnEachCodingPass = !!(blockStyle & 4); 19273 cod.verticallyStripe = !!(blockStyle & 8); 19274 cod.predictableTermination = !!(blockStyle & 16); 19275 cod.segmentationSymbolUsed = !!(blockStyle & 32); 19276 cod.reversibleTransformation = data[j++]; 19277 if (cod.entropyCoderWithCustomPrecincts) { 19278 const precinctsSizes = []; 19279 while (j < length + position) { 19280 const precinctsSize = data[j++]; 19281 precinctsSizes.push({ 19282 PPx: precinctsSize & 0xf, 19283 PPy: precinctsSize >> 4 19284 }); 19285 } 19286 cod.precinctsSizes = precinctsSizes; 19287 } 19288 const unsupported = []; 19289 if (cod.selectiveArithmeticCodingBypass) { 19290 unsupported.push("selectiveArithmeticCodingBypass"); 19291 } 19292 if (cod.terminationOnEachCodingPass) { 19293 unsupported.push("terminationOnEachCodingPass"); 19294 } 19295 if (cod.verticallyStripe) { 19296 unsupported.push("verticallyStripe"); 19297 } 19298 if (cod.predictableTermination) { 19299 unsupported.push("predictableTermination"); 19300 } 19301 if (unsupported.length > 0) { 19302 doNotRecover = true; 19303 (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`); 19304 } 19305 if (context.mainHeader) { 19306 context.COD = cod; 19307 } else { 19308 context.currentTile.COD = cod; 19309 context.currentTile.COC = []; 19310 } 19311 break; 19312 case 0xff90: 19313 length = (0, _core_utils.readUint16)(data, position); 19314 tile = {}; 19315 tile.index = (0, _core_utils.readUint16)(data, position + 2); 19316 tile.length = (0, _core_utils.readUint32)(data, position + 4); 19317 tile.dataEnd = tile.length + position - 2; 19318 tile.partIndex = data[position + 8]; 19319 tile.partsCount = data[position + 9]; 19320 context.mainHeader = false;
19321 if (tile.partIndex === 0) { 19322 tile.COD = context.COD; 19323 tile.COC = context.COC.slice(0); 19324 tile.QCD = context.QCD; 19325 tile.QCC = context.QCC.slice(0); 19326 } 19327 context.currentTile = tile; 19328 break; 19329 case 0xff93: 19330 tile = context.currentTile; 19331 if (tile.partIndex === 0) { 19332 initializeTile(context, tile.index); 19333 buildPackets(context); 19334 } 19335 length = tile.dataEnd - position; 19336 parseTilePackets(context, data, position, length); 19337 break; 19338 case 0xff53: 19339 (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented."); 19340 case 0xff55: 19341 case 0xff57: 19342 case 0xff58: 19343 case 0xff64: 19344 length = (0, _core_utils.readUint16)(data, position); 19345 break; 19346 default: 19347 throw new Error("Unknown codestream code: " + code.toString(16)); 19348 } 19349 position += length; 19350 } 19351 } catch (e) { 19352 if (doNotRecover || this.failOnCorruptedImage) { 19353 throw new JpxError(e.message); 19354 } else { 19355 (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`); 19356 } 19357 } 19358 this.tiles = transformComponents(context); 19359 this.width = context.SIZ.Xsiz - context.SIZ.XOsiz; 19360 this.height = context.SIZ.Ysiz - context.SIZ.YOsiz; 19361 this.componentsCount = context.SIZ.Csiz; 19362 } 19363} 19364exports.JpxImage = JpxImage; 19365function calculateComponentDimensions(component, siz) { 19366 component.x0 = Math.ceil(siz.XOsiz / component.XRsiz); 19367 component.x1 = Math.ceil(siz.Xsiz / component.XRsiz); 19368 component.y0 = Math.ceil(siz.YOsiz / component.YRsiz); 19369 component.y1 = Math.ceil(siz.Ysiz / component.YRsiz); 19370 component.width = component.x1 - component.x0; 19371 component.height = component.y1 - component.y0; 19372} 19373function calculateTileGrids(context, components) { 19374 const siz = context.SIZ; 19375 const tiles = []; 19376 let tile; 19377 const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz); 19378 const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz); 19379 for (let q = 0; q < numYtiles; q++) { 19380 for (let p = 0; p < numXtiles; p++) { 19381 tile = {}; 19382 tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz); 19383 tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz); 19384 tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz); 19385 tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz); 19386 tile.width = tile.tx1 - tile.tx0; 19387 tile.height = tile.ty1 - tile.ty0; 19388 tile.components = []; 19389 tiles.push(tile); 19390 } 19391 } 19392 context.tiles = tiles; 19393 const componentsCount = siz.Csiz; 19394 for (let i = 0, ii = componentsCount; i < ii; i++) { 19395 const component = components[i]; 19396 for (let j = 0, jj = tiles.length; j < jj; j++) { 19397 const tileComponent = {}; 19398 tile = tiles[j]; 19399 tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz); 19400 tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz); 19401 tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz); 19402 tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz); 19403 tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0; 19404 tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0; 19405 tile.components[i] = tileComponent; 19406 } 19407 } 19408} 19409function getBlocksDimensions(context, component, r) { 19410 const codOrCoc = component.codingStyleParameters; 19411 const result = {}; 19412 if (!codOrCoc.entropyCoderWithCustomPrecincts) { 19413 result.PPx = 15; 19414 result.PPy = 15; 19415 } else { 19416 result.PPx = codOrCoc.precinctsSizes[r].PPx; 19417 result.PPy = codOrCoc.precinctsSizes[r].PPy; 19418 } 19419 result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx); 19420 result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy); 19421 return result; 19422} 19423function buildPrecincts(context, resolution, dimensions) { 19424 const precinctWidth = 1 << dimensions.PPx; 19425 const precinctHeight = 1 << dimensions.PPy; 19426 const isZeroRes = resolution.resLevel === 0; 19427 const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1); 19428 const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1); 19429 const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0; 19430 const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0; 19431 const numprecincts = numprecinctswide * numprecinctshigh; 19432 resolution.precinctParameters = { 19433 precinctWidth, 19434 precinctHeight, 19435 numprecinctswide, 19436 numprecinctshigh, 19437 numprecincts, 19438 precinctWidthInSubband, 19439 precinctHeightInSubband 19440 }; 19441} 19442function buildCodeblocks(context, subband, dimensions) { 19443 const xcb_ = dimensions.xcb_; 19444 const ycb_ = dimensions.ycb_; 19445 const codeblockWidth = 1 << xcb_; 19446 const codeblockHeight = 1 << ycb_; 19447 const cbx0 = subband.tbx0 >> xcb_; 19448 const cby0 = subband.tby0 >> ycb_; 19449 const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_; 19450 const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_; 19451 const precinctParameters = subband.resolution.precinctParameters; 19452 const codeblocks = []; 19453 const precincts = []; 19454 let i, j, codeblock, precinctNumber; 19455 for (j = cby0; j < cby1; j++) { 19456 for (i = cbx0; i < cbx1; i++) { 19457 codeblock = { 19458 cbx: i, 19459 cby: j, 19460 tbx0: codeblockWidth * i, 19461 tby0: codeblockHeight * j, 19462 tbx1: codeblockWidth * (i + 1), 19463 tby1: codeblockHeight * (j + 1) 19464 }; 19465 codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0); 19466 codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0); 19467 codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1); 19468 codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1); 19469 const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband); 19470 const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband); 19471 precinctNumber = pi + pj * precinctParameters.numprecinctswide; 19472 codeblock.precinctNumber = precinctNumber; 19473 codeblock.subbandType = subband.type; 19474 codeblock.Lblock = 3; 19475 if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) { 19476 continue; 19477 } 19478 codeblocks.push(codeblock); 19479 let precinct = precincts[precinctNumber]; 19480 if (precinct !== undefined) { 19481 if (i < precinct.cbxMin) { 19482 precinct.cbxMin = i; 19483 } else if (i > precinct.cbxMax) { 19484 precinct.cbxMax = i; 19485 } 19486 if (j < precinct.cbyMin) { 19487 precinct.cbxMin = j; 19488 } else if (j >
19488 precinct.cbyMax) { 19489 precinct.cbyMax = j; 19490 } 19491 } else { 19492 precincts[precinctNumber] = precinct = { 19493 cbxMin: i, 19494 cbyMin: j, 19495 cbxMax: i, 19496 cbyMax: j 19497 }; 19498 } 19499 codeblock.precinct = precinct; 19500 } 19501 } 19502 subband.codeblockParameters = { 19503 codeblockWidth: xcb_, 19504 codeblockHeight: ycb_, 19505 numcodeblockwide: cbx1 - cbx0 + 1, 19506 numcodeblockhigh: cby1 - cby0 + 1 19507 }; 19508 subband.codeblocks = codeblocks; 19509 subband.precincts = precincts; 19510} 19511function createPacket(resolution, precinctNumber, layerNumber) { 19512 const precinctCodeblocks = []; 19513 const subbands = resolution.subbands; 19514 for (let i = 0, ii = subbands.length; i < ii; i++) { 19515 const subband = subbands[i]; 19516 const codeblocks = subband.codeblocks; 19517 for (let j = 0, jj = codeblocks.length; j < jj; j++) { 19518 const codeblock = codeblocks[j]; 19519 if (codeblock.precinctNumber !== precinctNumber) { 19520 continue; 19521 } 19522 precinctCodeblocks.push(codeblock); 19523 } 19524 } 19525 return { 19526 layerNumber, 19527 codeblocks: precinctCodeblocks 19528 }; 19529} 19530function LayerResolutionComponentPositionIterator(context) { 19531 const siz = context.SIZ; 19532 const tileIndex = context.currentTile.index; 19533 const tile = context.tiles[tileIndex]; 19534 const layersCount = tile.codingStyleDefaultParameters.layersCount; 19535 const componentsCount = siz.Csiz; 19536 let maxDecompositionLevelsCount = 0; 19537 for (let q = 0; q < componentsCount; q++) { 19538 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 19539 } 19540 let l = 0, 19541 r = 0, 19542 i = 0, 19543 k = 0; 19544 this.nextPacket = function JpxImage_nextPacket() { 19545 for (; l < layersCount; l++) { 19546 for (; r <= maxDecompositionLevelsCount; r++) { 19547 for (; i < componentsCount; i++) { 19548 const component = tile.components[i]; 19549 if (r > component.codingStyleParameters.decompositionLevelsCount) { 19550 continue; 19551 } 19552 const resolution = component.resolutions[r]; 19553 const numprecincts = resolution.precinctParameters.numprecincts; 19554 for (; k < numprecincts;) { 19555 const packet = createPacket(resolution, k, l); 19556 k++; 19557 return packet; 19558 } 19559 k = 0; 19560 } 19561 i = 0; 19562 } 19563 r = 0; 19564 } 19565 throw new JpxError("Out of packets"); 19566 }; 19567} 19568function ResolutionLayerComponentPositionIterator(context) { 19569 const siz = context.SIZ; 19570 const tileIndex = context.currentTile.index; 19571 const tile = context.tiles[tileIndex]; 19572 const layersCount = tile.codingStyleDefaultParameters.layersCount; 19573 const componentsCount = siz.Csiz; 19574 let maxDecompositionLevelsCount = 0; 19575 for (let q = 0; q < componentsCount; q++) { 19576 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 19577 } 19578 let r = 0, 19579 l = 0, 19580 i = 0, 19581 k = 0; 19582 this.nextPacket = function JpxImage_nextPacket() { 19583 for (; r <= maxDecompositionLevelsCount; r++) { 19584 for (; l < layersCount; l++) { 19585 for (; i < componentsCount; i++) { 19586 const component = tile.components[i]; 19587 if (r > component.codingStyleParameters.decompositionLevelsCount) { 19588 continue; 19589 } 19590 const resolution = component.resolutions[r]; 19591 const numprecincts = resolution.precinctParameters.numprecincts; 19592 for (; k < numprecincts;) { 19593 const packet = createPacket(resolution, k, l); 19594 k++; 19595 return packet; 19596 } 19597 k = 0; 19598 } 19599 i = 0; 19600 } 19601 l = 0; 19602 } 19603 throw new JpxError("Out of packets"); 19604 }; 19605} 19606function ResolutionPositionComponentLayerIterator(context) { 19607 const siz = context.SIZ; 19608 const tileIndex = context.currentTile.index; 19609 const tile = context.tiles[tileIndex]; 19610 const layersCount = tile.codingStyleDefaultParameters.layersCount; 19611 const componentsCount = siz.Csiz; 19612 let l, r, c, p; 19613 let maxDecompositionLevelsCount = 0; 19614 for (c = 0; c < componentsCount; c++) { 19615 const component = tile.components[c]; 19616 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount); 19617 } 19618 const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1); 19619 for (r = 0; r <= maxDecompositionLevelsCount; ++r) { 19620 let maxNumPrecincts = 0; 19621 for (c = 0; c < componentsCount; ++c) { 19622 const resolutions = tile.components[c].resolutions; 19623 if (r < resolutions.length) { 19624 maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts); 19625 } 19626 } 19627 maxNumPrecinctsInLevel[r] = maxNumPrecincts; 19628 } 19629 l = 0; 19630 r = 0; 19631 c = 0; 19632 p = 0; 19633 this.nextPacket = function JpxImage_nextPacket() { 19634 for (; r <= maxDecompositionLevelsCount; r++) { 19635 for (; p < maxNumPrecinctsInLevel[r]; p++) { 19636 for (; c < componentsCount; c++) { 19637 const component = tile.components[c]; 19638 if (r > component.codingStyleParameters.decompositionLevelsCount) { 19639 continue; 19640 } 19641 const resolution = component.resolutions[r]; 19642 const numprecincts = resolution.precinctParameters.numprecincts; 19643 if (p >= numprecincts) { 19644 continue; 19645 } 19646 for (; l < layersCount;) { 19647 const packet = createPacket(resolution, p, l); 19648 l++; 19649 return packet; 19650 } 19651 l = 0; 19652 } 19653 c = 0; 19654 } 19655 p = 0; 19656 } 19657 throw new JpxError("Out of packets"); 19658 }; 19659} 19660function PositionComponentResolutionLayerIterator(context) { 19661 const siz = context.SIZ; 19662 const tileIndex = context.currentTile.index; 19663 const tile = context.tiles[tileIndex]; 19664 const layersCount = tile.codingStyleDefaultParameters.layersCount; 19665 const componentsCount = siz.Csiz; 19666 const precinctsSizes = getPrecinctSizesInImageScale(tile); 19667 const precinctsIterationSizes = precinctsSizes; 19668 let l = 0, 19669 r = 0, 19670 c = 0, 19671 px = 0, 19672 py = 0; 19673 this.nextPacket = function JpxImage_nextPacket() { 19674 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 19675 for (; px < precinctsIterationSizes.maxNumWide; px++) { 19676 for (; c < componentsCount; c++) { 19677 const component = tile.components[c]; 19678 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 19679 for (; r <= decompositionLevelsCount; r++) { 19680 const resolution = component.resolutions[r]; 19681 const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
19682 const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 19683 if (k === null) { 19684 continue; 19685 } 19686 for (; l < layersCount;) { 19687 const packet = createPacket(resolution, k, l); 19688 l++; 19689 return packet; 19690 } 19691 l = 0; 19692 } 19693 r = 0; 19694 } 19695 c = 0; 19696 } 19697 px = 0; 19698 } 19699 throw new JpxError("Out of packets"); 19700 }; 19701} 19702function ComponentPositionResolutionLayerIterator(context) { 19703 const siz = context.SIZ; 19704 const tileIndex = context.currentTile.index; 19705 const tile = context.tiles[tileIndex]; 19706 const layersCount = tile.codingStyleDefaultParameters.layersCount; 19707 const componentsCount = siz.Csiz; 19708 const precinctsSizes = getPrecinctSizesInImageScale(tile); 19709 let l = 0, 19710 r = 0, 19711 c = 0, 19712 px = 0, 19713 py = 0; 19714 this.nextPacket = function JpxImage_nextPacket() { 19715 for (; c < componentsCount; ++c) { 19716 const component = tile.components[c]; 19717 const precinctsIterationSizes = precinctsSizes.components[c]; 19718 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 19719 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 19720 for (; px < precinctsIterationSizes.maxNumWide; px++) { 19721 for (; r <= decompositionLevelsCount; r++) { 19722 const resolution = component.resolutions[r]; 19723 const sizeInImageScale = precinctsIterationSizes.resolutions[r]; 19724 const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 19725 if (k === null) { 19726 continue; 19727 } 19728 for (; l < layersCount;) { 19729 const packet = createPacket(resolution, k, l); 19730 l++; 19731 return packet; 19732 } 19733 l = 0; 19734 } 19735 r = 0; 19736 } 19737 px = 0; 19738 } 19739 py = 0; 19740 } 19741 throw new JpxError("Out of packets"); 19742 }; 19743} 19744function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) { 19745 const posX = pxIndex * precinctIterationSizes.minWidth; 19746 const posY = pyIndex * precinctIterationSizes.minHeight; 19747 if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) { 19748 return null; 19749 } 19750 const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide; 19751 return posX / sizeInImageScale.height + startPrecinctRowIndex; 19752} 19753function getPrecinctSizesInImageScale(tile) { 19754 const componentsCount = tile.components.length; 19755 let minWidth = Number.MAX_VALUE; 19756 let minHeight = Number.MAX_VALUE; 19757 let maxNumWide = 0; 19758 let maxNumHigh = 0; 19759 const sizePerComponent = new Array(componentsCount); 19760 for (let c = 0; c < componentsCount; c++) { 19761 const component = tile.components[c]; 19762 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 19763 const sizePerResolution = new Array(decompositionLevelsCount + 1); 19764 let minWidthCurrentComponent = Number.MAX_VALUE; 19765 let minHeightCurrentComponent = Number.MAX_VALUE; 19766 let maxNumWideCurrentComponent = 0; 19767 let maxNumHighCurrentComponent = 0; 19768 let scale = 1; 19769 for (let r = decompositionLevelsCount; r >= 0; --r) { 19770 const resolution = component.resolutions[r]; 19771 const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth; 19772 const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight; 19773 minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution); 19774 minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution); 19775 maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide); 19776 maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh); 19777 sizePerResolution[r] = { 19778 width: widthCurrentResolution, 19779 height: heightCurrentResolution 19780 }; 19781 scale <<= 1; 19782 } 19783 minWidth = Math.min(minWidth, minWidthCurrentComponent); 19784 minHeight = Math.min(minHeight, minHeightCurrentComponent); 19785 maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent); 19786 maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent); 19787 sizePerComponent[c] = { 19788 resolutions: sizePerResolution, 19789 minWidth: minWidthCurrentComponent, 19790 minHeight: minHeightCurrentComponent, 19791 maxNumWide: maxNumWideCurrentComponent, 19792 maxNumHigh: maxNumHighCurrentComponent 19793 }; 19794 } 19795 return { 19796 components: sizePerComponent, 19797 minWidth, 19798 minHeight, 19799 maxNumWide, 19800 maxNumHigh 19801 }; 19802} 19803function buildPackets(context) { 19804 const siz = context.SIZ; 19805 const tileIndex = context.currentTile.index; 19806 const tile = context.tiles[tileIndex]; 19807 const componentsCount = siz.Csiz; 19808 for (let c = 0; c < componentsCount; c++) { 19809 const component = tile.components[c]; 19810 const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 19811 const resolutions = []; 19812 const subbands = []; 19813 for (let r = 0; r <= decompositionLevelsCount; r++) { 19814 const blocksDimensions = getBlocksDimensions(context, component, r); 19815 const resolution = {}; 19816 const scale = 1 << decompositionLevelsCount - r;
19817 resolution.trx0 = Math.ceil(component.tcx0 / scale); 19818 resolution.try0 = Math.ceil(component.tcy0 / scale); 19819 resolution.trx1 = Math.ceil(component.tcx1 / scale); 19820 resolution.try1 = Math.ceil(component.tcy1 / scale); 19821 resolution.resLevel = r; 19822 buildPrecincts(context, resolution, blocksDimensions); 19823 resolutions.push(resolution); 19824 let subband; 19825 if (r === 0) { 19826 subband = {}; 19827 subband.type = "LL"; 19828 subband.tbx0 = Math.ceil(component.tcx0 / scale); 19829 subband.tby0 = Math.ceil(component.tcy0 / scale); 19830 subband.tbx1 = Math.ceil(component.tcx1 / scale); 19831 subband.tby1 = Math.ceil(component.tcy1 / scale); 19832 subband.resolution = resolution; 19833 buildCodeblocks(context, subband, blocksDimensions); 19834 subbands.push(subband); 19835 resolution.subbands = [subband]; 19836 } else { 19837 const bscale = 1 << decompositionLevelsCount - r + 1; 19838 const resolutionSubbands = []; 19839 subband = {}; 19840 subband.type = "HL"; 19841 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 19842 subband.tby0 = Math.ceil(component.tcy0 / bscale); 19843 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 19844 subband.tby1 = Math.ceil(component.tcy1 / bscale); 19845 subband.resolution = resolution; 19846 buildCodeblocks(context, subband, blocksDimensions); 19847 subbands.push(subband); 19848 resolutionSubbands.push(subband); 19849 subband = {}; 19850 subband.type = "LH"; 19851 subband.tbx0 = Math.ceil(component.tcx0 / bscale); 19852 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 19853 subband.tbx1 = Math.ceil(component.tcx1 / bscale); 19854 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 19855 subband.resolution = resolution; 19856 buildCodeblocks(context, subband, blocksDimensions); 19857 subbands.push(subband); 19858 resolutionSubbands.push(subband); 19859 subband = {}; 19860 subband.type = "HH"; 19861 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 19862 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 19863 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 19864 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 19865 subband.resolution = resolution; 19866 buildCodeblocks(context, subband, blocksDimensions); 19867 subbands.push(subband); 19868 resolutionSubbands.push(subband); 19869 resolution.subbands = resolutionSubbands; 19870 } 19871 } 19872 component.resolutions = resolutions; 19873 component.subbands = subbands; 19874 } 19875 const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder; 19876 switch (progressionOrder) { 19877 case 0: 19878 tile.packetsIterator = new LayerResolutionComponentPositionIterator(context); 19879 break; 19880 case 1: 19881 tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context); 19882 break; 19883 case 2: 19884 tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context); 19885 break; 19886 case 3: 19887 tile.packetsIterator = new PositionComponentResolutionLayerIterator(context); 19888 break; 19889 case 4: 19890 tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context); 19891 break; 19892 default: 19893 throw new JpxError(`Unsupported progression order ${progressionOrder}`); 19894 } 19895} 19896function parseTilePackets(context, data, offset, dataLength) { 19897 let position = 0; 19898 let buffer, 19899 bufferSize = 0, 19900 skipNextBit = false; 19901 function readBits(count) { 19902 while (bufferSize < count) { 19903 const b = data[offset + position]; 19904 position++; 19905 if (skipNextBit) { 19906 buffer = buffer << 7 | b; 19907 bufferSize += 7; 19908 skipNextBit = false; 19909 } else { 19910 buffer = buffer << 8 | b; 19911 bufferSize += 8; 19912 } 19913 if (b === 0xff) { 19914 skipNextBit = true; 19915 } 19916 } 19917 bufferSize -= count; 19918 return buffer >>> bufferSize & (1 << count) - 1; 19919 } 19920 function skipMarkerIfEqual(value) { 19921 if (data[offset + position - 1] === 0xff && data[offset + position] === value) { 19922 skipBytes(1); 19923 return true; 19924 } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) { 19925 skipBytes(2); 19926 return true; 19927 } 19928 return false;
19929 } 19930 function skipBytes(count) { 19931 position += count; 19932 } 19933 function alignToByte() { 19934 bufferSize = 0; 19935 if (skipNextBit) { 19936 position++; 19937 skipNextBit = false; 19938 } 19939 } 19940 function readCodingpasses() { 19941 if (readBits(1) === 0) { 19942 return 1; 19943 } 19944 if (readBits(1) === 0) { 19945 return 2; 19946 } 19947 let value = readBits(2); 19948 if (value < 3) { 19949 return value + 3; 19950 } 19951 value = readBits(5); 19952 if (value < 31) { 19953 return value + 6; 19954 } 19955 value = readBits(7); 19956 return value + 37; 19957 } 19958 const tileIndex = context.currentTile.index; 19959 const tile = context.tiles[tileIndex]; 19960 const sopMarkerUsed = context.COD.sopMarkerUsed; 19961 const ephMarkerUsed = context.COD.ephMarkerUsed; 19962 const packetsIterator = tile.packetsIterator; 19963 while (position < dataLength) { 19964 alignToByte(); 19965 if (sopMarkerUsed && skipMarkerIfEqual(0x91)) { 19966 skipBytes(4); 19967 } 19968 const packet = packetsIterator.nextPacket(); 19969 if (!readBits(1)) { 19970 continue; 19971 } 19972 const layerNumber = packet.layerNumber, 19973 queue = []; 19974 let codeblock; 19975 for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) { 19976 codeblock = packet.codeblocks[i]; 19977 let precinct = codeblock.precinct; 19978 const codeblockColumn = codeblock.cbx - precinct.cbxMin; 19979 const codeblockRow = codeblock.cby - precinct.cbyMin; 19980 let codeblockIncluded = false; 19981 let firstTimeInclusion = false; 19982 let valueReady, zeroBitPlanesTree; 19983 if (codeblock.included !== undefined) { 19984 codeblockIncluded = !!readBits(1); 19985 } else { 19986 precinct = codeblock.precinct; 19987 let inclusionTree; 19988 if (precinct.inclusionTree !== undefined) { 19989 inclusionTree = precinct.inclusionTree; 19990 } else { 19991 const width = precinct.cbxMax - precinct.cbxMin + 1; 19992 const height = precinct.cbyMax - precinct.cbyMin + 1; 19993 inclusionTree = new InclusionTree(width, height, layerNumber); 19994 zeroBitPlanesTree = new TagTree(width, height); 19995 precinct.inclusionTree = inclusionTree; 19996 precinct.zeroBitPlanesTree = zeroBitPlanesTree; 19997 for (let l = 0; l < layerNumber; l++) { 19998 if (readBits(1) !== 0) { 19999 throw new JpxError("Invalid tag tree"); 20000 } 20001 } 20002 } 20003 if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) { 20004 while (true) { 20005 if (readBits(1)) { 20006 valueReady = !inclusionTree.nextLevel(); 20007 if (valueReady) { 20008 codeblock.included = true; 20009 codeblockIncluded = firstTimeInclusion = true; 20010 break; 20011 } 20012 } else { 20013 inclusionTree.incrementValue(layerNumber); 20014 break; 20015 } 20016 } 20017 } 20018 } 20019 if (!codeblockIncluded) { 20020 continue; 20021 } 20022 if (firstTimeInclusion) { 20023 zeroBitPlanesTree = precinct.zeroBitPlanesTree; 20024 zeroBitPlanesTree.reset(codeblockColumn, codeblockRow); 20025 while (true) { 20026 if (readBits(1)) { 20027 valueReady = !zeroBitPlanesTree.nextLevel(); 20028 if (valueReady) { 20029 break; 20030 } 20031 } else { 20032 zeroBitPlanesTree.incrementValue(); 20033 } 20034 } 20035 codeblock.zeroBitPlanes = zeroBitPlanesTree.value; 20036 } 20037 const codingpasses = readCodingpasses(); 20038 while (readBits(1)) { 20039 codeblock.Lblock++; 20040 } 20041 const codingpassesLog2 = (0, _core_utils.log2)(codingpasses); 20042 const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock; 20043 const codedDataLength = readBits(bits); 20044 queue.push({ 20045 codeblock, 20046 codingpasses, 20047 dataLength: codedDataLength 20048 }); 20049 } 20050 alignToByte(); 20051 if (ephMarkerUsed) { 20052 skipMarkerIfEqual(0x92); 20053 } 20054 while (queue.length > 0) { 20055 const packetItem = queue.shift(); 20056 codeblock = packetItem.codeblock; 20057 if (codeblock.data === undefined) { 20058 codeblock.data = []; 20059 } 20060 codeblock.data.push({ 20061 data, 20062 start: offset + position, 20063 end: offset + position + packetItem.dataLength, 20064 codingpasses: packetItem.codingpasses 20065 }); 20066 position += packetItem.dataLength; 20067 } 20068 } 20069 return position; 20070} 20071function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) { 20072 const x0 = subband.tbx0; 20073 const y0 = subband.tby0; 20074 const width = subband.tbx1 - subband.tbx0; 20075 const codeblocks = subband.codeblocks; 20076 const right = subband.type.charAt(0) === "H" ? 1 : 0; 20077 const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0; 20078 for (let i = 0, ii = codeblocks.length; i < ii; ++i) { 20079 const codeblock = codeblocks[i]; 20080 const blockWidth = codeblock.tbx1_ - codeblock.tbx0_; 20081 const blockHeight = codeblock.tby1_ - codeblock.tby0_; 20082 if (blockWidth === 0 || blockHeight === 0) { 20083 continue; 20084 } 20085 if (codeblock.data === undefined) { 20086 continue; 20087 } 20088 const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
20089 let currentCodingpassType = 2; 20090 const data = codeblock.data; 20091 let totalLength = 0, 20092 codingpasses = 0; 20093 let j, jj, dataItem; 20094 for (j = 0, jj = data.length; j < jj; j++) { 20095 dataItem = data[j]; 20096 totalLength += dataItem.end - dataItem.start; 20097 codingpasses += dataItem.codingpasses; 20098 } 20099 const encodedData = new Uint8Array(totalLength); 20100 let position = 0; 20101 for (j = 0, jj = data.length; j < jj; j++) { 20102 dataItem = data[j]; 20103 const chunk = dataItem.data.subarray(dataItem.start, dataItem.end); 20104 encodedData.set(chunk, position); 20105 position += chunk.length; 20106 } 20107 const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength); 20108 bitModel.setDecoder(decoder); 20109 for (j = 0; j < codingpasses; j++) { 20110 switch (currentCodingpassType) { 20111 case 0: 20112 bitModel.runSignificancePropagationPass(); 20113 break; 20114 case 1: 20115 bitModel.runMagnitudeRefinementPass(); 20116 break; 20117 case 2: 20118 bitModel.runCleanupPass(); 20119 if (segmentationSymbolUsed) { 20120 bitModel.checkSegmentationSymbol(); 20121 } 20122 break; 20123 } 20124 if (resetContextProbabilities) { 20125 bitModel.reset(); 20126 } 20127 currentCodingpassType = (currentCodingpassType + 1) % 3; 20128 } 20129 let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width; 20130 const sign = bitModel.coefficentsSign; 20131 const magnitude = bitModel.coefficentsMagnitude; 20132 const bitsDecoded = bitModel.bitsDecoded; 20133 const magnitudeCorrection = reversible ? 0 : 0.5; 20134 let k, n, nb; 20135 position = 0; 20136 const interleave = subband.type !== "LL"; 20137 for (j = 0; j < blockHeight; j++) { 20138 const row = offset / width | 0; 20139 const levelOffset = 2 * row * (levelWidth - width) + right + bottom; 20140 for (k = 0; k < blockWidth; k++) { 20141 n = magnitude[position]; 20142 if (n !== 0) { 20143 n = (n + magnitudeCorrection) * delta; 20144 if (sign[position] !== 0) { 20145 n = -n; 20146 } 20147 nb = bitsDecoded[position]; 20148 const pos = interleave ? levelOffset + (offset << 1) : offset; 20149 coefficients[pos] = reversible && nb >= mb ? n : n * (1 << mb - nb); 20150 } 20151 offset++; 20152 position++; 20153 } 20154 offset += width - blockWidth; 20155 } 20156 } 20157} 20158function transformTile(context, tile, c) { 20159 const component = tile.components[c]; 20160 const codingStyleParameters = component.codingStyleParameters; 20161 const quantizationParameters = component.quantizationParameters; 20162 const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount; 20163 const spqcds = quantizationParameters.SPqcds; 20164 const scalarExpounded = quantizationParameters.scalarExpounded; 20165 const guardBits = quantizationParameters.guardBits; 20166 const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed; 20167 const resetContextProbabilities = codingStyleParameters.resetContextProbabilities; 20168 const precision = context.components[c].precision; 20169 const reversible = codingStyleParameters.reversibleTransformation; 20170 const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform(); 20171 const subbandCoefficients = []; 20172 let b = 0; 20173 for (let i = 0; i <= decompositionLevelsCount; i++) { 20174 const resolution = component.resolutions[i]; 20175 const width = resolution.trx1 - resolution.trx0; 20176 const height = resolution.try1 - resolution.try0; 20177 const coefficients = new Float32Array(width * height); 20178 for (let j = 0, jj = resolution.subbands.length; j < jj; j++) { 20179 let mu, epsilon; 20180 if (!scalarExpounded) { 20181 mu = spqcds[0].mu; 20182 epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0); 20183 } else { 20184 mu = spqcds[b].mu; 20185 epsilon = spqcds[b].epsilon; 20186 b++; 20187 } 20188 const subband = resolution.subbands[j]; 20189 const gainLog2 = SubbandsGainLog2[subband.type]; 20190 const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048); 20191 const mb = guardBits + epsilon - 1; 20192 copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities); 20193 } 20194 subbandCoefficients.push({ 20195 width, 20196 height, 20197 items: coefficients 20198 }); 20199 } 20200 const result = transform.calculate(subbandCoefficients, component.tc
20200x0, component.tcy0); 20201 return { 20202 left: component.tcx0, 20203 top: component.tcy0, 20204 width: result.width, 20205 height: result.height, 20206 items: result.items 20207 }; 20208} 20209function transformComponents(context) { 20210 const siz = context.SIZ; 20211 const components = context.components; 20212 const componentsCount = siz.Csiz; 20213 const resultImages = []; 20214 for (let i = 0, ii = context.tiles.length; i < ii; i++) { 20215 const tile = context.tiles[i]; 20216 const transformedTiles = []; 20217 for (let c = 0; c < componentsCount; c++) { 20218 transformedTiles[c] = transformTile(context, tile, c); 20219 } 20220 const tile0 = transformedTiles[0]; 20221 const out = new Uint8ClampedArray(tile0.items.length * componentsCount); 20222 const result = { 20223 left: tile0.left, 20224 top: tile0.top, 20225 width: tile0.width, 20226 height: tile0.height, 20227 items: out 20228 }; 20229 let shift, offset; 20230 let pos = 0, 20231 j, 20232 jj, 20233 y0, 20234 y1, 20235 y2; 20236 if (tile.codingStyleDefaultParameters.multipleComponentTransform) { 20237 const fourComponents = componentsCount === 4; 20238 const y0items = transformedTiles[0].items; 20239 const y1items = transformedTiles[1].items; 20240 const y2items = transformedTiles[2].items; 20241 const y3items = fourComponents ? transformedTiles[3].items : null; 20242 shift = components[0].precision - 8; 20243 offset = (128 << shift) + 0.5; 20244 const component0 = tile.components[0]; 20245 const alpha01 = componentsCount - 3; 20246 jj = y0items.length; 20247 if (!component0.codingStyleParameters.reversibleTransformation) { 20248 for (j = 0; j < jj; j++, pos += alpha01) { 20249 y0 = y0items[j] + offset; 20250 y1 = y1items[j]; 20251 y2 = y2items[j]; 20252 out[pos++] = y0 + 1.402 * y2 >> shift; 20253 out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift; 20254 out[pos++] = y0 + 1.772 * y1 >> shift; 20255 } 20256 } else { 20257 for (j = 0; j < jj; j++, pos += alpha01) { 20258 y0 = y0items[j] + offset; 20259 y1 = y1items[j]; 20260 y2 = y2items[j]; 20261 const g = y0 - (y2 + y1 >> 2); 20262 out[pos++] = g + y2 >> shift; 20263 out[pos++] = g >> shift; 20264 out[pos++] = g + y1 >> shift; 20265 } 20266 } 20267 if (fourComponents) { 20268 for (j = 0, pos = 3; j < jj; j++, pos += 4) { 20269 out[pos] = y3items[j] + offset >> shift; 20270 } 20271 } 20272 } else { 20273 for (let c = 0; c < componentsCount; c++) { 20274 const items = transformedTiles[c].items; 20275 shift = components[c].precision - 8; 20276 offset = (128 << shift) + 0.5; 20277 for (pos = c, j = 0, jj = items.length; j < jj; j++) { 20278 out[pos] = items[j] + offset >> shift; 20279 pos += componentsCount; 20280 } 20281 } 20282 } 20283 resultImages.push(result); 20284 } 20285 return resultImages; 20286} 20287function initializeTile(context, tileIndex) { 20288 const siz = context.SIZ; 20289 const componentsCount = siz.Csiz; 20290 const tile = context.tiles[tileIndex]; 20291 for (let c = 0; c < componentsCount; c++) { 20292 const component = tile.components[c]; 20293 const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD; 20294 component.quantizationParameters = qcdOrQcc; 20295 const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD; 20296 component.codingStyleParameters = codOrCoc; 20297 } 20298 tile.codingStyleDefaultParameters = context.currentTile.COD; 20299} 20300class TagTree { 20301 constructor(width, height) { 20302 const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 20303 this.levels = []; 20304 for (let i = 0; i < levelsLength; i++) { 20305 const level = { 20306 width, 20307 height, 20308 items: [] 20309 }; 20310 this.levels.push(level); 20311 width = Math.ceil(width / 2); 20312 height = Math.ceil(height / 2); 20313 } 20314 } 20315 reset(i, j) {
20316 let currentLevel = 0, 20317 value = 0, 20318 level; 20319 while (currentLevel < this.levels.length) { 20320 level = this.levels[currentLevel]; 20321 const index = i + j * level.width; 20322 if (level.items[index] !== undefined) { 20323 value = level.items[index]; 20324 break; 20325 } 20326 level.index = index; 20327 i >>= 1; 20328 j >>= 1; 20329 currentLevel++; 20330 } 20331 currentLevel--; 20332 level = this.levels[currentLevel]; 20333 level.items[level.index] = value; 20334 this.currentLevel = currentLevel; 20335 delete this.value; 20336 } 20337 incrementValue() { 20338 const level = this.levels[this.currentLevel]; 20339 level.items[level.index]++; 20340 } 20341 nextLevel() { 20342 let currentLevel = this.currentLevel; 20343 let level = this.levels[currentLevel]; 20344 const value = level.items[level.index]; 20345 currentLevel--; 20346 if (currentLevel < 0) { 20347 this.value = value; 20348 return false; 20349 } 20350 this.currentLevel = currentLevel; 20351 level = this.levels[currentLevel]; 20352 level.items[level.index] = value; 20353 return true; 20354 } 20355} 20356class InclusionTree { 20357 constructor(width, height, defaultValue) { 20358 const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 20359 this.levels = []; 20360 for (let i = 0; i < levelsLength; i++) { 20361 const items = new Uint8Array(width * height); 20362 for (let j = 0, jj = items.length; j < jj; j++) { 20363 items[j] = defaultValue; 20364 } 20365 const level = { 20366 width, 20367 height, 20368 items 20369 }; 20370 this.levels.push(level); 20371 width = Math.ceil(width / 2); 20372 height = Math.ceil(height / 2); 20373 } 20374 } 20375 reset(i, j, stopValue) { 20376 let currentLevel = 0; 20377 while (currentLevel < this.levels.length) { 20378 const level = this.levels[currentLevel]; 20379 const index = i + j * level.width; 20380 level.index = index; 20381 const value = level.items[index]; 20382 if (value === 0xff) { 20383 break; 20384 } 20385 if (value > stopValue) { 20386 this.currentLevel = currentLevel; 20387 this.propagateValues(); 20388 return false; 20389 } 20390 i >>= 1; 20391 j >>= 1; 20392 currentLevel++; 20393 } 20394 this.currentLevel = currentLevel - 1; 20395 return true; 20396 } 20397 incrementValue(stopValue) { 20398 const level = this.levels[this.currentLevel]; 20399 level.items[level.index] = stopValue + 1; 20400 this.propagateValues(); 20401 } 20402 propagateValues() { 20403 let levelIndex = this.currentLevel; 20404 let level = this.levels[levelIndex]; 20405 const currentValue = level.items[level.index]; 20406 while (--levelIndex >= 0) { 20407 level = this.levels[levelIndex]; 20408 level.items[level.index] = currentValue; 20409 } 20410 } 20411 nextLevel() {
20412 let currentLevel = this.currentLevel; 20413 let level = this.levels[currentLevel]; 20414 const value = level.items[level.index]; 20415 level.items[level.index] = 0xff; 20416 currentLevel--; 20417 if (currentLevel < 0) { 20418 return false; 20419 } 20420 this.currentLevel = currentLevel; 20421 level = this.levels[currentLevel]; 20422 level.items[level.index] = value; 20423 return true; 20424 } 20425} 20426class BitModel { 20427 static UNIFORM_CONTEXT = 17; 20428 static RUNLENGTH_CONTEXT = 18; 20429 static 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]); 20430 static 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]); 20431 static 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]); 20432 constructor(width, height, subband, zeroBitPlanes, mb) { 20433 this.width = width; 20434 this.height = height; 20435 let contextLabelTable; 20436 if (subband === "HH") { 20437 contextLabelTable = BitModel.HHContextLabel; 20438 } else if (subband === "HL") { 20439 contextLabelTable = BitModel.HLContextLabel; 20440 } else { 20441 contextLabelTable = BitModel.LLAndLHContextsLabel; 20442 } 20443 this.contextLabelTable = contextLabelTable; 20444 const coefficientCount = width * height; 20445 this.neighborsSignificance = new Uint8Array(coefficientCount); 20446 this.coefficentsSign = new Uint8Array(coefficientCount); 20447 let coefficentsMagnitude; 20448 if (mb > 14) { 20449 coefficentsMagnitude = new Uint32Array(coefficientCount); 20450 } else if (mb > 6) { 20451 coefficentsMagnitude = new Uint16Array(coefficientCount); 20452 } else { 20453 coefficentsMagnitude = new Uint8Array(coefficientCount); 20454 } 20455 this.coefficentsMagnitude = coefficentsMagnitude; 20456 this.processingFlags = new Uint8Array(coefficientCount); 20457 const bitsDecoded = new Uint8Array(coefficientCount); 20458 if (zeroBitPlanes !== 0) { 20459 for (let i = 0; i < coefficientCount; i++) { 20460 bitsDecoded[i] = zeroBitPlanes; 20461 } 20462 } 20463 this.bitsDecoded = bitsDecoded; 20464 this.reset(); 20465 } 20466 setDecoder(decoder) { 20467 this.decoder = decoder; 20468 } 20469 reset() { 20470 this.contexts = new Int8Array(19); 20471 this.contexts[0] = 4 << 1 | 0; 20472 this.contexts[BitModel.UNIFORM_CONTEXT] = 46 << 1 | 0; 20473 this.contexts[BitModel.RUNLENGTH_CONTEXT] = 3 << 1 | 0; 20474 } 20475 setNeighborsSignificance(row, column, index) { 20476 const neighborsSignificance = this.neighborsSignificance; 20477 const width = this.width, 20478 height = this.height; 20479 const left = column > 0; 20480 const right = column + 1 < width; 20481 let i; 20482 if (row > 0) { 20483 i = index - width; 20484 if (left) { 20485 neighborsSignificance[i - 1] += 0x10; 20486 } 20487 if (right) { 20488 neighborsSignificance[i + 1] += 0x10; 20489 } 20490 neighborsSignificance[i] += 0x04; 20491 } 20492 if (row + 1 < height) { 20493 i = index + width; 20494 if (left) { 20495 neighborsSignificance[i - 1] += 0x10; 20496 } 20497 if (right) { 20498 neighborsSignificance[i + 1] += 0x10; 20499 } 20500 neighborsSignificance[i] += 0x04; 20501 } 20502 if (left) { 20503 neighborsSignificance[index - 1] += 0x01; 20504 } 20505 if (right) { 20506 neighborsSignificance[index + 1] += 0x01; 20507 } 20508 neighborsSignificance[index] |= 0x80; 20509 } 20510 runSignificancePropagationPass() { 20511 const decoder = this.decoder; 20512 const width = this.width, 20513 height = this.height; 20514 const coefficentsMagnitude = this.coefficentsMagnitude; 20515 const coefficentsSign = this.coefficentsSign; 20516 const neighborsSignificance = this.neighborsSignificance; 20517 const processingFlags = this.processingFlags; 20518 const contexts = this.contexts; 20519 const labels = this.contextLabelTable; 20520 const bitsDecoded = this.bitsDecoded; 20521 const processedInverseMask = ~1; 20522 const processedMask = 1; 20523 const firstMagnitudeBitMask = 2; 20524 for (let i0 = 0; i0 < height; i0 += 4) { 20525 for (let j = 0; j < width; j++) { 20526 let index = i0 * width + j; 20527 for (let i1 = 0; i1 < 4; i1++, index += width) { 20528 const i = i0 + i1; 20529 if (i >= height) { 20530 break; 20531 } 20532 processingFlags[index] &= processedInverseMask; 20533 if (coefficentsMagnitude[index] || !neighborsSignificance[index]) { 20534 continue; 20535 } 20536 const contextLabel = labels[neighborsSignificance[index]]; 20537 const decision = decoder.readBit(contexts, contextLabel); 20538 if (decision) { 20539 const sign = this.decodeSignBit(i, j, index); 20540 coefficentsSign[index] = sign; 20541 coefficentsMagnitude[index] = 1; 20542 this.setNeighborsSignificance(i, j, index);
20543 processingFlags[index] |= firstMagnitudeBitMask; 20544 } 20545 bitsDecoded[index]++; 20546 processingFlags[index] |= processedMask; 20547 } 20548 } 20549 } 20550 } 20551 decodeSignBit(row, column, index) { 20552 const width = this.width, 20553 height = this.height; 20554 const coefficentsMagnitude = this.coefficentsMagnitude; 20555 const coefficentsSign = this.coefficentsSign; 20556 let contribution, sign0, sign1, significance1; 20557 let contextLabel, decoded; 20558 significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0; 20559 if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) { 20560 sign1 = coefficentsSign[index + 1]; 20561 if (significance1) { 20562 sign0 = coefficentsSign[index - 1]; 20563 contribution = 1 - sign1 - sign0; 20564 } else { 20565 contribution = 1 - sign1 - sign1; 20566 } 20567 } else if (significance1) { 20568 sign0 = coefficentsSign[index - 1]; 20569 contribution = 1 - sign0 - sign0; 20570 } else { 20571 contribution = 0; 20572 } 20573 const horizontalContribution = 3 * contribution; 20574 significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0; 20575 if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) { 20576 sign1 = coefficentsSign[index + width]; 20577 if (significance1) { 20578 sign0 = coefficentsSign[index - width]; 20579 contribution = 1 - sign1 - sign0 + horizontalContribution; 20580 } else { 20581 contribution = 1 - sign1 - sign1 + horizontalContribution; 20582 } 20583 } else if (significance1) { 20584 sign0 = coefficentsSign[index - width]; 20585 contribution = 1 - sign0 - sign0 + horizontalContribution; 20586 } else { 20587 contribution = horizontalContribution; 20588 } 20589 if (contribution >= 0) { 20590 contextLabel = 9 + contribution; 20591 decoded = this.decoder.readBit(this.contexts, contextLabel); 20592 } else { 20593 contextLabel = 9 - contribution; 20594 decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1; 20595 } 20596 return decoded; 20597 } 20598 runMagnitudeRefinementPass() { 20599 const decoder = this.decoder; 20600 const width = this.width, 20601 height = this.height; 20602 const coefficentsMagnitude = this.coefficentsMagnitude; 20603 const neighborsSignificance = this.neighborsSignificance; 20604 const contexts = this.contexts; 20605 const bitsDecoded = this.bitsDecoded; 20606 const processingFlags = this.processingFlags; 20607 const processedMask = 1; 20608 const firstMagnitudeBitMask = 2; 20609 const length = width * height; 20610 const width4 = width * 4; 20611 for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) { 20612 indexNext = Math.min(length, index0 + width4); 20613 for (let j = 0; j < width; j++) { 20614 for (let index = index0 + j; index < indexNext; index += width) { 20615 if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 20616 continue; 20617 } 20618 let contextLabel = 16; 20619 if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) { 20620 processingFlags[index] ^= firstMagnitudeBitMask; 20621 const significance = neighborsSignificance[index] & 127; 20622 contextLabel = significance === 0 ? 15 : 14; 20623 } 20624 const bit = decoder.readBit(contexts, contextLabel); 20625 coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit; 20626 bitsDecoded[index]++; 20627 processingFlags[index] |= processedMask; 20628 } 20629 } 20630 } 20631 } 20632 runCleanupPass() { 20633 const decoder = this.decoder; 20634 const width = this.width, 20635 height = this.height; 20636 const neighborsSignificance = this.neighborsSignificance; 20637 const coefficentsMagnitude = this.coefficentsMagnitude; 20638 const coefficentsSign = this.coefficentsSign; 20639 const contexts = this.contexts; 20640 const labels = this.contextLabelTable; 20641 const bitsDecoded = this.bitsDecoded; 20642 const processingFlags = this.processingFlags; 20643 const processedMask = 1; 20644 const firstMagnitudeBitMask = 2; 20645 const oneRowDown = width; 20646 const twoRowsDown = width * 2; 20647 const threeRowsDown = width * 3; 20648 let iNext; 20649 for (let i0 = 0; i0 < height; i0 = iNext) { 20650 iNext = Math.min(i0 + 4, height); 20651 const indexBase = i0 * width; 20652 const checkAllEmpty = i0 + 3 < height; 20653 for (let j = 0; j < width; j++) { 20654 const index0 = indexBase + j; 20655 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; 20656 let i1 = 0, 20657 index = index0; 20658 let i = i0, 20659 sign; 20660 if (allEmpty) { 20661 const hasSignificantCoefficent = decoder.readBit(contexts, BitModel.RUNLENGTH_CONTEXT); 20662 if (!hasSignificantCoefficent) { 20663 bitsDecoded[index0]++; 20664 bitsDecoded[index0 + oneRowDown]++; 20665 bitsDecoded[index0 + twoRowsDown]++; 20666 bitsDecoded[index0 + threeRowsDown]++; 20667 continue; 20668 } 20669 i1 = decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT); 20670 if (i1 !== 0) { 20671 i = i0 + i1; 20672 index += i1 * width; 20673 } 20674 sign = this.decodeSignBit(i, j, index); 20675 coefficentsSign[index] = sign; 20676 coefficentsMagnitude[index] = 1; 20677 this.setNeighborsSignificance(i, j, index);
20678 processingFlags[index] |= firstMagnitudeBitMask; 20679 index = index0; 20680 for (let i2 = i0; i2 <= i; i2++, index += width) { 20681 bitsDecoded[index]++; 20682 } 20683 i1++; 20684 } 20685 for (i = i0 + i1; i < iNext; i++, index += width) { 20686 if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 20687 continue; 20688 } 20689 const contextLabel = labels[neighborsSignificance[index]]; 20690 const decision = decoder.readBit(contexts, contextLabel); 20691 if (decision === 1) { 20692 sign = this.decodeSignBit(i, j, index); 20693 coefficentsSign[index] = sign; 20694 coefficentsMagnitude[index] = 1; 20695 this.setNeighborsSignificance(i, j, index); 20696 processingFlags[index] |= firstMagnitudeBitMask; 20697 } 20698 bitsDecoded[index]++; 20699 } 20700 } 20701 } 20702 } 20703 checkSegmentationSymbol() { 20704 const decoder = this.decoder; 20705 const contexts = this.contexts; 20706 const symbol = decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT); 20707 if (symbol !== 0xa) { 20708 throw new JpxError("Invalid segmentation symbol"); 20709 } 20710 } 20711} 20712class Transform { 20713 constructor() { 20714 if (this.constructor === Transform) { 20715 (0, _util.unreachable)("Cannot initialize Transform."); 20716 } 20717 } 20718 calculate(subbands, u0, v0) { 20719 let ll = subbands[0]; 20720 for (let i = 1, ii = subbands.length; i < ii; i++) { 20721 ll = this.iterate(ll, subbands[i], u0, v0); 20722 } 20723 return ll; 20724 } 20725 extend(buffer, offset, size) { 20726 let i1 = offset - 1, 20727 j1 = offset + 1; 20728 let i2 = offset + size - 2, 20729 j2 = offset + size; 20730 buffer[i1--] = buffer[j1++]; 20731 buffer[j2++] = buffer[i2--]; 20732 buffer[i1--] = buffer[j1++]; 20733 buffer[j2++] = buffer[i2--]; 20734 buffer[i1--] = buffer[j1++]; 20735 buffer[j2++] = buffer[i2--]; 20736 buffer[i1] = buffer[j1]; 20737 buffer[j2] = buffer[i2]; 20738 } 20739 filter(x, offset, length) { 20740 (0, _util.unreachable)("Abstract method `filter` called"); 20741 } 20742 iterate(ll, hl_lh_hh, u0, v0) { 20743 const llWidth = ll.width, 20744 llHeight = ll.height; 20745 let llItems = ll.items; 20746 const width = hl_lh_hh.width; 20747 const height = hl_lh_hh.height; 20748 const items = hl_lh_hh.items; 20749 let i, j, k, l, u, v; 20750 for (k = 0, i = 0; i < llHeight; i++) { 20751 l = i * 2 * width; 20752 for (j = 0; j < llWidth; j++, k++, l += 2) { 20753 items[l] = llItems[k]; 20754 } 20755 } 20756 llItems = ll.items = null; 20757 const bufferPadding = 4; 20758 const rowBuffer = new Float32Array(width + 2 * bufferPadding); 20759 if (width === 1) { 20760 if ((u0 & 1) !== 0) { 20761 for (v = 0, k = 0; v < height; v++, k += width) { 20762 items[k] *= 0.5; 20763 } 20764 } 20765 } else { 20766 for (v = 0, k = 0; v < height; v++, k += width) { 20767 rowBuffer.set(items.subarray(k, k + width), bufferPadding); 20768 this.extend(rowBuffer, bufferPadding, width); 20769 this.filter(rowBuffer, bufferPadding, width); 20770 items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k); 20771 } 20772 } 20773 let numBuffers = 16; 20774 const colBuffers = []; 20775 for (i = 0; i < numBuffers; i++) { 20776 colBuffers.push(new Float32Array(height + 2 * bufferPadding)); 20777 } 20778 let b, 20779 currentBuffer = 0; 20780 ll = bufferPadding + height; 20781 if (height === 1) { 20782 if ((v0 & 1) !== 0) { 20783 for (u = 0; u < width; u++) { 20784 items[u] *= 0.5; 20785 } 20786 } 20787 } else { 20788 for (u = 0; u < width; u++) { 20789 if (currentBuffer === 0) { 20790 numBuffers = Math.min(width - u, numBuffers); 20791 for (k = u, l = bufferPadding; l < ll; k += width, l++) { 20792 for (b = 0; b < numBuffers; b++) { 20793 colBuffers[b][l] = items[k + b]; 20794 } 20795 } 20796 currentBuffer = numBuffers; 20797 } 20798 currentBuffer--; 20799 const buffer = colBuffers[currentBuffer]; 20800 this.extend(buffer, bufferPadding, height); 20801 this.filter(buffer, bufferPadding, height); 20802 if (currentBuffer === 0) { 20803 k = u - numBuffers + 1; 20804 for (l = bufferPadding; l < ll; k += width, l++) { 20805 for (b = 0; b < numBuffers; b++) { 20806 items[k + b] = colBuffers[b][l]; 20807 } 20808 } 20809 } 20810 } 20811 } 20812 return { 20813 width, 20814 height, 20815 items 20816 }; 20817 } 20818} 20819class IrreversibleTransform extends Transform { 20820 filter(x, offset, length) { 20821 const len = length >> 1; 20822 offset |= 0; 20823 let j, n, current, next;
20824 const alpha = -1.586134342059924; 20825 const beta = -0.052980118572961; 20826 const gamma = 0.882911075530934; 20827 const delta = 0.443506852043971; 20828 const K = 1.230174104914001; 20829 const K_ = 1 / K; 20830 j = offset - 3; 20831 for (n = len + 4; n--; j += 2) { 20832 x[j] *= K_; 20833 } 20834 j = offset - 2; 20835 current = delta * x[j - 1]; 20836 for (n = len + 3; n--; j += 2) { 20837 next = delta * x[j + 1]; 20838 x[j] = K * x[j] - current - next; 20839 if (n--) { 20840 j += 2; 20841 current = delta * x[j + 1]; 20842 x[j] = K * x[j] - current - next; 20843 } else { 20844 break; 20845 } 20846 } 20847 j = offset - 1; 20848 current = gamma * x[j - 1]; 20849 for (n = len + 2; n--; j += 2) { 20850 next = gamma * x[j + 1]; 20851 x[j] -= current + next; 20852 if (n--) { 20853 j += 2; 20854 current = gamma * x[j + 1]; 20855 x[j] -= current + next; 20856 } else { 20857 break; 20858 } 20859 } 20860 j = offset; 20861 current = beta * x[j - 1]; 20862 for (n = len + 1; n--; j += 2) { 20863 next = beta * x[j + 1]; 20864 x[j] -= current + next; 20865 if (n--) { 20866 j += 2; 20867 current = beta * x[j + 1]; 20868 x[j] -= current + next; 20869 } else { 20870 break; 20871 } 20872 } 20873 if (len !== 0) { 20874 j = offset + 1; 20875 current = alpha * x[j - 1]; 20876 for (n = len; n--; j += 2) { 20877 next = alpha * x[j + 1]; 20878 x[j] -= current + next; 20879 if (n--) { 20880 j += 2; 20881 current = alpha * x[j + 1]; 20882 x[j] -= current + next; 20883 } else { 20884 break; 20885 } 20886 } 20887 } 20888 } 20889} 20890class ReversibleTransform extends Transform { 20891 filter(x, offset, length) { 20892 const len = length >> 1; 20893 offset |= 0; 20894 let j, n; 20895 for (j = offset, n = len + 1; n--; j += 2) { 20896 x[j] -= x[j - 1] + x[j + 1] + 2 >> 2; 20897 } 20898 for (j = offset + 1, n = len; n--; j += 2) { 20899 x[j] += x[j - 1] + x[j + 1] >> 1; 20900 } 20901 } 20902} 20903 20904/***/ }), 20905/* 31 */ 20906/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 20907 20908 20909 20910Object.defineProperty(exports, "__esModule", ({ 20911 value: true 20912})); 20913exports.LZWStream = void 0; 20914var _decode_stream = __w_pdfjs_require__(18); 20915class LZWStream extends _decode_stream.DecodeStream { 20916 constructor(str, maybeLength, earlyChange) { 20917 super(maybeLength); 20918 this.str = str; 20919 this.dict = str.dict; 20920 this.cachedData = 0; 20921 this.bitsCached = 0; 20922 const maxLzwDictionarySize = 4096; 20923 const lzwState = { 20924 earlyChange, 20925 codeLength: 9, 20926 nextCode: 258, 20927 dictionaryValues: new Uint8Array(maxLzwDictionarySize), 20928 dictionaryLengths: new Uint16Array(maxLzwDictionarySize), 20929 dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), 20930 currentSequence: new Uint8Array(maxLzwDictionarySize), 20931 currentSequenceLength: 0 20932 }; 20933 for (let i = 0; i < 256; ++i) { 20934 lzwState.dictionaryValues[i] = i; 20935 lzwState.dictionaryLengths[i] = 1; 20936 } 20937 this.lzwState = lzwState; 20938 } 20939 readBits(n) { 20940 let bitsCached = this.bitsCached; 20941 let cachedData = this.cachedData; 20942 while (bitsCached < n) { 20943 const c = this.str.getByte(); 20944 if (c === -1) { 20945 this.eof = true; 20946 return null; 20947 } 20948 cachedData = cachedData << 8 | c; 20949 bitsCached += 8; 20950 } 20951 this.bitsCached = bitsCached -= n; 20952 this.cachedData = cachedData; 20953 this.lastCode = null; 20954 return cachedData >>> bitsCached & (1 << n) - 1; 20955 } 20956 readBlock() { 20957 const blockSize = 512, 20958 decodedSizeDelta = blockSize; 20959 let estimatedDecodedSize = blockSize * 2; 20960 let i, j, q; 20961 const lzwState = this.lzwState; 20962 if (!lzwState) { 20963 return; 20964 } 20965 const earlyChange = lzwState.earlyChange; 20966 let nextCode = lzwState.nextCode; 20967 const dictionaryValues = lzwState.dictionaryValues; 20968 const dictionaryLengths = lzwState.dictionaryLengths; 20969 const dictionaryPrevCodes = lzwState.dictionaryPrevCodes; 20970 let codeLength = lzwState.codeLength; 20971 let prevCode = lzwState.prevCode; 20972 const currentSequence = lzwState.currentSequence; 20973 let currentSequenceLength = lzwState.currentSequenceLength; 20974 let decodedLength = 0; 20975 let currentBufferLength = this.bufferLength; 20976 let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 20977 for (i = 0; i < blockSize; i++) { 20978 const code = this.readBits(codeLength); 20979 const hasPrev = currentSequenceLength > 0; 20980 if (code < 256) { 20981 currentSequence[0] = code; 20982 currentSequenceLength = 1; 20983 } else if (code >= 258) {
vendor: 28,975 bytes, lines 20984-21860
20984 if (code < nextCode) { 20985 currentSequenceLength = dictionaryLengths[code]; 20986 for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { 20987 currentSequence[j] = dictionaryValues[q]; 20988 q = dictionaryPrevCodes[q]; 20989 } 20990 } else { 20991 currentSequence[currentSequenceLength++] = currentSequence[0]; 20992 } 20993 } else if (code === 256) { 20994 codeLength = 9; 20995 nextCode = 258; 20996 currentSequenceLength = 0; 20997 continue; 20998 } else { 20999 this.eof = true; 21000 delete this.lzwState; 21001 break; 21002 } 21003 if (hasPrev) { 21004 dictionaryPrevCodes[nextCode] = prevCode; 21005 dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; 21006 dictionaryValues[nextCode] = currentSequence[0]; 21007 nextCode++; 21008 codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0; 21009 } 21010 prevCode = code; 21011 decodedLength += currentSequenceLength; 21012 if (estimatedDecodedSize < decodedLength) { 21013 do { 21014 estimatedDecodedSize += decodedSizeDelta; 21015 } while (estimatedDecodedSize < decodedLength); 21016 buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 21017 } 21018 for (j = 0; j < currentSequenceLength; j++) { 21019 buffer[currentBufferLength++] = currentSequence[j]; 21020 } 21021 } 21022 lzwState.nextCode = nextCode; 21023 lzwState.codeLength = codeLength; 21024 lzwState.prevCode = prevCode; 21025 lzwState.currentSequenceLength = currentSequenceLength; 21026 this.bufferLength = currentBufferLength; 21027 } 21028} 21029exports.LZWStream = LZWStream; 21030 21031/***/ }), 21032/* 32 */ 21033/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 21034 21035 21036 21037Object.defineProperty(exports, "__esModule", ({ 21038 value: true 21039})); 21040exports.PredictorStream = void 0; 21041var _decode_stream = __w_pdfjs_require__(18); 21042var _primitives = __w_pdfjs_require__(4); 21043var _util = __w_pdfjs_require__(2); 21044class PredictorStream extends _decode_stream.DecodeStream { 21045 constructor(str, maybeLength, params) { 21046 super(maybeLength); 21047 if (!(params instanceof _primitives.Dict)) { 21048 return str; 21049 } 21050 const predictor = this.predictor = params.get("Predictor") || 1; 21051 if (predictor <= 1) { 21052 return str; 21053 } 21054 if (predictor !== 2 && (predictor < 10 || predictor > 15)) { 21055 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 21056 } 21057 this.readBlock = predictor === 2 ? this.readBlockTiff : this.readBlockPng; 21058 this.str = str; 21059 this.dict = str.dict; 21060 const colors = this.colors = params.get("Colors") || 1; 21061 const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8; 21062 const columns = this.columns = params.get("Columns") || 1; 21063 this.pixBytes = colors * bits + 7 >> 3; 21064 this.rowBytes = columns * colors * bits + 7 >> 3; 21065 return this; 21066 } 21067 readBlockTiff() { 21068 const rowBytes = this.rowBytes; 21069 const bufferLength = this.bufferLength; 21070 const buffer = this.ensureBuffer(bufferLength + rowBytes); 21071 const bits = this.bits; 21072 const colors = this.colors; 21073 const rawBytes = this.str.getBytes(rowBytes); 21074 this.eof = !rawBytes.length; 21075 if (this.eof) { 21076 return; 21077 } 21078 let inbuf = 0, 21079 outbuf = 0; 21080 let inbits = 0, 21081 outbits = 0; 21082 let pos = bufferLength; 21083 let i; 21084 if (bits === 1 && colors === 1) { 21085 for (i = 0; i < rowBytes; ++i) { 21086 let c = rawBytes[i] ^ inbuf; 21087 c ^= c >> 1; 21088 c ^= c >> 2; 21089 c ^= c >> 4; 21090 inbuf = (c & 1) << 7; 21091 buffer[pos++] = c; 21092 } 21093 } else if (bits === 8) { 21094 for (i = 0; i < colors; ++i) { 21095 buffer[pos++] = rawBytes[i]; 21096 } 21097 for (; i < rowBytes; ++i) { 21098 buffer[pos] = buffer[pos - colors] + rawBytes[i]; 21099 pos++; 21100 } 21101 } else if (bits === 16) { 21102 const bytesPerPixel = colors * 2; 21103 for (i = 0; i < bytesPerPixel; ++i) { 21104 buffer[pos++] = rawBytes[i]; 21105 } 21106 for (; i < rowBytes; i += 2) { 21107 const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff); 21108 buffer[pos++] = sum >> 8 & 0xff; 21109 buffer[pos++] = sum & 0xff; 21110 } 21111 } else { 21112 const compArray = new Uint8Array(colors + 1); 21113 const bitMask = (1 << bits) - 1; 21114 let j = 0, 21115 k = bufferLength; 21116 const columns = this.columns; 21117 for (i = 0; i < columns; ++i) { 21118 for (let kk = 0; kk < colors; ++kk) { 21119 if (inbits < bits) { 21120 inbuf = inbuf << 8 | rawBytes[j++] & 0xff; 21121 inbits += 8; 21122 } 21123 compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask; 21124 inbits -= bits; 21125 outbuf = outbuf << bits | compArray[kk]; 21126 outbits += bits; 21127 if (outbits >= 8) { 21128 buffer[k++] = outbuf >> outbits - 8 & 0xff; 21129 outbits -= 8; 21130 } 21131 } 21132 } 21133 if (outbits > 0) { 21134 buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1); 21135 } 21136 } 21137 this.bufferLength += rowBytes; 21138 } 21139 readBlockPng() { 21140 const rowBytes = this.rowBytes; 21141 const pixBytes = this.pixBytes; 21142 const predictor = this.str.getByte(); 21143 const rawBytes = this.str.getBytes(rowBytes); 21144 this.eof = !rawBytes.length; 21145 if (this.eof) { 21146 return; 21147 } 21148 const bufferLength = this.bufferLength; 21149 const buffer = this.ensureBuffer(bufferLength + rowBytes); 21150 let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength); 21151 if (prevRow.length === 0) { 21152 prevRow = new Uint8Array(rowBytes); 21153 } 21154 let i, 21155 j = bufferLength, 21156 up, 21157 c; 21158 switch (predictor) { 21159 case 0: 21160 for (i = 0; i < rowBytes; ++i) { 21161 buffer[j++] = rawBytes[i]; 21162 } 21163 break; 21164 case 1: 21165 for (i = 0; i < pixBytes; ++i) { 21166 buffer[j++] = rawBytes[i]; 21167 } 21168 for (; i < rowBytes; ++i) { 21169 buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff; 21170 j++; 21171 } 21172 break; 21173 case 2: 21174 for (i = 0; i < rowBytes; ++i) { 21175 buffer[j++] = prevRow[i] + rawBytes[i] & 0xff; 21176 } 21177 break; 21178 case 3: 21179 for (i = 0; i < pixBytes; ++i) { 21180 buffer[j++] = (prevRow[i] >> 1) + rawBytes[i]; 21181 } 21182 for (; i < rowBytes; ++i) { 21183 buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff; 21184 j++; 21185 } 21186 break; 21187 case 4: 21188 for (i = 0; i < pixBytes; ++i) { 21189 up = prevRow[i]; 21190 c = rawBytes[i]; 21191 buffer[j++] = up + c; 21192 } 21193 for (; i < rowBytes; ++i) { 21194 up = prevRow[i]; 21195 const upLeft = prevRow[i - pixBytes]; 21196 const left = buffer[j - pixBytes]; 21197 const p = left + up - upLeft; 21198 let pa = p - left; 21199 if (pa < 0) { 21200 pa = -pa; 21201 } 21202 let pb = p - up; 21203 if (pb < 0) { 21204 pb = -pb; 21205 } 21206 let pc = p - upLeft; 21207 if (pc < 0) { 21208 pc = -pc; 21209 } 21210 c = rawBytes[i]; 21211 if (pa <= pb && pa <= pc) { 21212 buffer[j++] = left + c; 21213 } else if (pb <= pc) { 21214 buffer[j++] = up + c; 21215 } else { 21216 buffer[j++] = upLeft + c; 21217 } 21218 } 21219 break; 21220 default: 21221 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 21222 } 21223 this.bufferLength += rowBytes; 21224 } 21225} 21226exports.PredictorStream = PredictorStream; 21227 21228/***/ }), 21229/* 33 */ 21230/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 21231 21232 21233 21234Object.defineProperty(exports, "__esModule", ({ 21235 value: true 21236})); 21237exports.RunLengthStream = void 0; 21238var _decode_stream = __w_pdfjs_require__(18); 21239class RunLengthStream extends _decode_stream.DecodeStream { 21240 constructor(str, maybeLength) { 21241 super(maybeLength); 21242 this.str = str; 21243 this.dict = str.dict; 21244 } 21245 readBlock() { 21246 const repeatHeader = this.str.getBytes(2); 21247 if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { 21248 this.eof = true; 21249 return; 21250 } 21251 let buffer; 21252 let bufferLength = this.bufferLength; 21253 let n = repeatHeader[0]; 21254 if (n < 128) { 21255 buffer = this.ensureBuffer(bufferLength + n + 1); 21256 buffer[bufferLength++] = repeatHeader[1]; 21257 if (n > 0) { 21258 const source = this.str.getBytes(n); 21259 buffer.set(source, bufferLength); 21260 bufferLength += n; 21261 } 21262 } else { 21263 n = 257 - n; 21264 const b = repeatHeader[1]; 21265 buffer = this.ensureBuffer(bufferLength + n + 1); 21266 for (let i = 0; i < n; i++) { 21267 buffer[bufferLength++] = b; 21268 } 21269 } 21270 this.bufferLength = bufferLength; 21271 } 21272} 21273exports.RunLengthStream = RunLengthStream; 21274 21275/***/ }), 21276/* 34 */ 21277/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 21278 21279 21280 21281Object.defineProperty(exports, "__esModule", ({ 21282 value: true 21283})); 21284exports.Font = exports.ErrorFont = void 0; 21285var _util = __w_pdfjs_require__(2); 21286var _cff_parser = __w_pdfjs_require__(35); 21287var _fonts_utils = __w_pdfjs_require__(38); 21288var _unicode = __w_pdfjs_require__(40); 21289var _glyphlist = __w_pdfjs_require__(39); 21290var _encodings = __w_pdfjs_require__(37); 21291var _standard_fonts = __w_pdfjs_require__(41); 21292var _to_unicode_map = __w_pdfjs_require__(42); 21293var _cff_font = __w_pdfjs_require__(43); 21294var _font_renderer = __w_pdfjs_require__(44); 21295var _metrics = __w_pdfjs_require__(45); 21296var _glyf = __w_pdfjs_require__(46); 21297var _cmap = __w_pdfjs_require__(14); 21298var _opentype_file_builder = __w_pdfjs_require__(47); 21299var _core_utils = __w_pdfjs_require__(3); 21300var _stream = __w_pdfjs_require__(8); 21301var _type1_font = __w_pdfjs_require__(48); 21302const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]]; 21303const PDF_GLYPH_SPACE_UNITS = 1000; 21304const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "systemFontInfo", "type", "vertical"]; 21305const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"]; 21306function adjustWidths(properties) { 21307 if (!properties.fontMatrix) { 21308 return; 21309 } 21310 if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) { 21311 return; 21312 } 21313 const scale = 0.001 / properties.fontMatrix[0]; 21314 const glyphsWidths = properties.widths; 21315 for (const glyph in glyphsWidths) { 21316 glyphsWidths[glyph] *= scale; 21317 } 21318 properties.defaultWidth *= scale; 21319} 21320function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) { 21321 if (properties.isInternalFont) { 21322 return; 21323 } 21324 if (properties.hasIncludedToUnicodeMap) { 21325 return; 21326 } 21327 if (properties.hasEncoding) { 21328 return; 21329 } 21330 if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 21331 return; 21332 } 21333 if (!isSymbolicFont) { 21334 return; 21335 } 21336 if (nameRecords.length === 0) { 21337 return; 21338 } 21339 if (properties.defaultEncoding === _encodings.WinAnsiEncoding) { 21340 return; 21341 } 21342 for (const r of nameRecords) { 21343 if (!isWinNameRecord(r)) { 21344 return; 21345 } 21346 } 21347 const encoding = _encodings.WinAnsiEncoding; 21348 const toUnicode = [], 21349 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 21350 for (const charCode in encoding) { 21351 const glyphName = encoding[charCode]; 21352 if (glyphName === "") { 21353 continue; 21354 } 21355 const unicode = glyphsUnicodeMap[glyphName]; 21356 if (unicode === undefined) { 21357 continue; 21358 } 21359 toUnicode[charCode] = String.fromCharCode(unicode); 21360 } 21361 if (toUnicode.length > 0) { 21362 properties.toUnicode.amend(toUnicode); 21363 } 21364} 21365function adjustType1ToUnicode(properties, builtInEncoding) { 21366 if (properties.isInternalFont) { 21367 return; 21368 } 21369 if (properties.hasIncludedToUnicodeMap) { 21370 return; 21371 } 21372 if (builtInEncoding === properties.defaultEncoding) { 21373 return; 21374 } 21375 if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 21376 return; 21377 } 21378 const toUnicode = [], 21379 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 21380 for (const charCode in builtInEncoding) { 21381 if (properties.hasEncoding) { 21382 if (properties.baseEncodingName || properties.differences[charCode] !== undefined) { 21383 continue; 21384 } 21385 } 21386 const glyphName = builtInEncoding[charCode]; 21387 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 21388 if (unicode !== -1) { 21389 toUnicode[charCode] = String.fromCharCode(unicode); 21390 } 21391 } 21392 if (toUnicode.length > 0) { 21393 properties.toUnicode.amend(toUnicode); 21394 } 21395} 21396function amendFallbackToUnicode(properties) { 21397 if (!properties.fallbackToUnicode) { 21398 return; 21399 } 21400 if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 21401 return; 21402 } 21403 const toUnicode = []; 21404 for (const charCode in properties.fallbackToUnicode) { 21405 if (properties.toUnicode.has(charCode)) { 21406 continue; 21407 } 21408 toUnicode[charCode] = properties.fallbackToUnicode[charCode]; 21409 } 21410 if (toUnicode.length > 0) { 21411 properties.toUnicode.amend(toUnicode); 21412 } 21413} 21414class Glyph { 21415 constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 21416 this.originalCharCode = originalCharCode; 21417 this.fontChar = fontChar; 21418 this.unicode = unicode; 21419 this.accent = accent; 21420 this.width = width; 21421 this.vmetric = vmetric; 21422 this.operatorListId = operatorListId; 21423 this.isSpace = isSpace; 21424 this.isInFont = isInFont; 21425 } 21426 get category() { 21427 return (0, _util.shadow)(this, "category", (0, _unicode.getCharUnicodeCategory)(this.unicode), true); 21428 } 21429} 21430function int16(b0, b1) { 21431 return (b0 << 8) + b1; 21432} 21433function writeSignedInt16(bytes, index, value) { 21434 bytes[index + 1] = value; 21435 bytes[index] = value >>> 8; 21436} 21437function signedInt16(b0, b1) { 21438 const value = (b0 << 8) + b1; 21439 return value & 1 << 15 ? value - 0x10000 : value; 21440} 21441function int32(b0, b1, b2, b3) { 21442 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 21443} 21444function string16(value) { 21445 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 21446} 21447function safeString16(value) { 21448 if (value > 0x7fff) { 21449 value = 0x7fff; 21450 } else if (value < -0x8000) { 21451 value = -0x8000; 21452 } 21453 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 21454} 21455function isTrueTypeFile(file) { 21456 const header = file.peekBytes(4); 21457 return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true"; 21458} 21459function isTrueTypeCollectionFile(file) { 21460 const header = file.peekBytes(4); 21461 return (0, _util.bytesToString)(header) === "ttcf"; 21462} 21463function isOpenTypeFile(file) { 21464 const header = file.peekBytes(4); 21465 return (0, _util.bytesToString)(header) === "OTTO"; 21466} 21467function isType1File(file) { 21468 const header = file.peekBytes(2); 21469 if (header[0] === 0x25 && header[1] === 0x21) { 21470 return true; 21471 } 21472 if (header[0] === 0x80 && header[1] === 0x01) { 21473 return true; 21474 } 21475 return false; 21476} 21477function isCFFFile(file) { 21478 const header = file.peekBytes(4); 21479 if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) { 21480 return true; 21481 } 21482 return false; 21483} 21484function getFontFileType(file, { 21485 type, 21486 subtype, 21487 composite 21488}) { 21489 let fileType, fileSubtype; 21490 if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) { 21491 fileType = composite ? "CIDFontType2" : "TrueType"; 21492 } else if (isOpenTypeFile(file)) { 21493 fileType = composite ? "CIDFontType2" : "OpenType"; 21494 } else if (isType1File(file)) { 21495 if (composite) { 21496 fileType = "CIDFontType0"; 21497 } else { 21498 fileType = type === "MMType1" ? "MMType1" : "Type1"; 21499 } 21500 } else if (isCFFFile(file)) { 21501 if (composite) { 21502 fileType = "CIDFontType0"; 21503 fileSubtype = "CIDFontType0C"; 21504 } else { 21505 fileType = type === "MMType1" ? "MMType1" : "Type1"; 21506 fileSubtype = "Type1C"; 21507 } 21508 } else { 21509 (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype."); 21510 fileType = type; 21511 fileSubtype = subtype; 21512 } 21513 return [fileType, fileSubtype]; 21514} 21515function applyStandardFontGlyphMap(map, glyphMap) { 21516 for (const charCode in glyphMap) { 21517 map[+charCode] = glyphMap[charCode]; 21518 } 21519} 21520function buildToFontChar(encoding, glyphsUnicodeMap, differences) { 21521 const toFontChar = []; 21522 let unicode; 21523 for (let i = 0, ii = encoding.length; i < ii; i++) { 21524 unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap); 21525 if (unicode !== -1) { 21526 toFontChar[i] = unicode; 21527 } 21528 } 21529 for (const charCode in differences) { 21530 unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap); 21531 if (unicode !== -1) { 21532 toFontChar[+charCode] = unicode; 21533 } 21534 } 21535 return toFontChar; 21536} 21537function isMacNameRecord(r) { 21538 return r.platform === 1 && r.encoding === 0 && r.language === 0; 21539} 21540function isWinNameRecord(r) { 21541 return r.platform === 3 && r.encoding === 1 && r.language === 0x409; 21542} 21543function convertCidString(charCode, cid, shouldThrow = false) { 21544 switch (cid.length) { 21545 case 1: 21546 return cid.charCodeAt(0); 21547 case 2: 21548 return cid.charCodeAt(0) << 8 | cid.charCodeAt(1); 21549 } 21550 const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`; 21551 if (shouldThrow) { 21552 throw new _util.FormatError(msg); 21553 } 21554 (0, _util.warn)(msg); 21555 return cid; 21556} 21557function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) { 21558 const newMap = Object.create(null); 21559 const toUnicodeExtraMap = new Map(); 21560 const toFontChar = []; 21561 const usedGlyphIds = new Set(); 21562 let privateUseAreaIndex = 0; 21563 const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 21564 let nextAvailableFontCharCode = privateUseOffetStart; 21565 let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 21566 const isInPrivateArea = code => PRIVATE_USE_AREAS[0][0] <= code && code <= PRIVATE_USE_AREAS[0][1] || PRIVATE_USE_AREAS[1][0] <= code && code <= PRIVATE_USE_AREAS[1][1]; 21567 for (let originalCharCode in charCodeToGlyphId) { 21568 originalCharCode |= 0; 21569 let glyphId = charCodeToGlyphId[originalCharCode]; 21570 if (!hasGlyph(glyphId)) { 21571 continue; 21572 } 21573 if (nextAvailableFontCharCode > privateUseOffetEnd) { 21574 privateUseAreaIndex++; 21575 if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) { 21576 (0, _util.warn)("Ran out of space in font private use area."); 21577 break; 21578 } 21579 nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 21580 privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 21581 } 21582 const fontCharCode = nextAvailableFontCharCode++; 21583 if (glyphId === 0) { 21584 glyphId = newGlyphZeroId; 21585 } 21586 let unicode = toUnicode.get(originalCharCode); 21587 if (typeof unicode === "string") { 21588 unicode = unicode.codePointAt(0); 21589 } 21590 if (unicode && !isInPrivateArea(unicode) && !usedGlyphIds.has(glyphId)) { 21591 toUnicodeExtraMap.set(unicode, glyphId); 21592 usedGlyphIds.add(glyphId); 21593 } 21594 newMap[fontCharCode] = glyphId; 21595 toFontChar[originalCharCode] = fontCharCode; 21596 } 21597 return { 21598 toFontChar, 21599 charCodeToGlyphId: newMap, 21600 toUnicodeExtraMap, 21601 nextAvailableFontCharCode 21602 }; 21603} 21604function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) { 21605 const codes = []; 21606 for (const charCode in glyphs) { 21607 if (glyphs[charCode] >= numGlyphs) { 21608 continue; 21609 } 21610 codes.push({ 21611 fontCharCode: charCode | 0, 21612 glyphId: glyphs[charCode] 21613 }); 21614 } 21615 if (toUnicodeExtraMap) { 21616 for (const [unicode, glyphId] of toUnicodeExtraMap) { 21617 if (glyphId >= numGlyphs) { 21618 continue; 21619 } 21620 codes.push({ 21621 fontCharCode: unicode, 21622 glyphId 21623 }); 21624 } 21625 } 21626 if (codes.length === 0) { 21627 codes.push({ 21628 fontCharCode: 0, 21629 glyphId: 0 21630 }); 21631 } 21632 codes.sort(function fontGetRangesSort(a, b) { 21633 return a.fontCharCode - b.fontCharCode; 21634 }); 21635 const ranges = []; 21636 const length = codes.length; 21637 for (let n = 0; n < length;) { 21638 const start = codes[n].fontCharCode; 21639 const codeIndices = [codes[n].glyphId]; 21640 ++n; 21641 let end = start; 21642 while (n < length && end + 1 === codes[n].fontCharCode) { 21643 codeIndices.push(codes[n].glyphId); 21644 ++end; 21645 ++n; 21646 if (end === 0xffff) { 21647 break; 21648 } 21649 } 21650 ranges.push([start, end, codeIndices]); 21651 } 21652 return ranges; 21653} 21654function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) { 21655 const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs); 21656 const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1; 21657 let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8); 21658 let i, ii, j, jj; 21659 for (i = ranges.length - 1; i >= 0; --i) { 21660 if (ranges[i][0] <= 0xffff) { 21661 break; 21662 } 21663 } 21664 const bmpLength = i + 1; 21665 if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) { 21666 ranges[i][1] = 0xfffe; 21667 } 21668 const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0; 21669 const segCount = bmpLength + trailingRangesCount; 21670 const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2); 21671 let startCount = ""; 21672 let endCount = ""; 21673 let idDeltas = ""; 21674 let idRangeOffsets = ""; 21675 let glyphsIds = ""; 21676 let bias = 0; 21677 let range, start, end, codes; 21678 for (i = 0, ii = bmpLength; i < ii; i++) { 21679 range = ranges[i]; 21680 start = range[0]; 21681 end = range[1]; 21682 startCount += string16(start); 21683 endCount += string16(end); 21684 codes = range[2]; 21685 let contiguous = true; 21686 for (j = 1, jj = codes.length; j < jj; ++j) { 21687 if (codes[j] !== codes[j - 1] + 1) { 21688 contiguous = false; 21689 break; 21690 } 21691 } 21692 if (!contiguous) { 21693 const offset = (segCount - i) * 2 + bias * 2; 21694 bias += end - start + 1; 21695 idDeltas += string16(0); 21696 idRangeOffsets += string16(offset); 21697 for (j = 0, jj = codes.length; j < jj; ++j) { 21698 glyphsIds += string16(codes[j]); 21699 } 21700 } else { 21701 const startCode = codes[0]; 21702 idDeltas += string16(startCode - start & 0xffff); 21703 idRangeOffsets += string16(0); 21704 } 21705 } 21706 if (trailingRangesCount > 0) { 21707 endCount += "\xFF\xFF"; 21708 startCount += "\xFF\xFF"; 21709 idDeltas += "\x00\x01"; 21710 idRangeOffsets += "\x00\x00"; 21711 } 21712 const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds; 21713 let format31012 = ""; 21714 let header31012 = ""; 21715 if (numTables > 1) { 21716 cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length); 21717 format31012 = ""; 21718 for (i = 0, ii = ranges.length; i < ii; i++) { 21719 range = ranges[i]; 21720 start = range[0]; 21721 codes = range[2]; 21722 let code = codes[0]; 21723 for (j = 1, jj = codes.length; j < jj; ++j) { 21724 if (codes[j] !== codes[j - 1] + 1) { 21725 end = range[0] + j - 1; 21726 format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code); 21727 start = end + 1; 21728 code = codes[j]; 21729 } 21730 } 21731 format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code); 21732 } 21733 header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12); 21734 } 21735 return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012; 21736} 21737function validateOS2Table(os2, file) { 21738 file.pos = (file.start || 0) + os2.offset; 21739 const version = file.getUint16(); 21740 file.skip(60); 21741 const selection = file.getUint16(); 21742 if (version < 4 && selection & 0x0300) { 21743 return false; 21744 } 21745 const firstChar = file.getUint16(); 21746 const lastChar = file.getUint16(); 21747 if (firstChar > lastChar) { 21748 return false; 21749 } 21750 file.skip(6); 21751 const usWinAscent = file.getUint16(); 21752 if (usWinAscent === 0) { 21753 return false; 21754 } 21755 os2.data[8] = os2.data[9] = 0; 21756 return true; 21757} 21758function createOS2Table(properties, charstrings, override) { 21759 override ||= { 21760 unitsPerEm: 0, 21761 yMax: 0, 21762 yMin: 0, 21763 ascent: 0, 21764 descent: 0 21765 }; 21766 let ulUnicodeRange1 = 0; 21767 let ulUnicodeRange2 = 0; 21768 let ulUnicodeRange3 = 0; 21769 let ulUnicodeRange4 = 0; 21770 let firstCharIndex = null; 21771 let lastCharIndex = 0; 21772 let position = -1; 21773 if (charstrings) { 21774 for (let code in charstrings) { 21775 code |= 0; 21776 if (firstCharIndex > code || !firstCharIndex) { 21777 firstCharIndex = code; 21778 } 21779 if (lastCharIndex < code) { 21780 lastCharIndex = code; 21781 } 21782 position = (0, _unicode.getUnicodeRangeFor)(code, position); 21783 if (position < 32) { 21784 ulUnicodeRange1 |= 1 << position; 21785 } else if (position < 64) { 21786 ulUnicodeRange2 |= 1 << position - 32; 21787 } else if (position < 96) { 21788 ulUnicodeRange3 |= 1 << position - 64; 21789 } else if (position < 123) { 21790 ulUnicodeRange4 |= 1 << position - 96; 21791 } else { 21792 throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage"); 21793 } 21794 } 21795 if (lastCharIndex > 0xffff) { 21796 lastCharIndex = 0xffff; 21797 } 21798 } else { 21799 firstCharIndex = 0; 21800 lastCharIndex = 255; 21801 } 21802 const bbox = properties.bbox || [0, 0, 0, 0]; 21803 const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 21804 const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS; 21805 const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3])); 21806 let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1])); 21807 if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) { 21808 typoDescent = -typoDescent; 21809 } 21810 const winAscent = override.yMax || typoAscent; 21811 const winDescent = -override.yMin || -typoDescent; 21812 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"; 21813} 21814function createPostTable(properties) { 21815 const angle = Math.floor(properties.italicAngle * 2 ** 16); 21816 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"; 21817} 21818function createPostscriptName(name) { 21819 return name.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63); 21820} 21821function createNameTable(name, proto) { 21822 if (!proto) { 21823 proto = [[], []]; 21824 } 21825 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"]; 21826 const stringsUnicode = []; 21827 let i, ii, j, jj, str; 21828 for (i = 0, ii = strings.length; i < ii; i++) { 21829 str = proto[1][i] || strings[i]; 21830 const strBufUnicode = []; 21831 for (j = 0, jj = str.length; j < jj; j++) { 21832 strBufUnicode.push(string16(str.charCodeAt(j))); 21833 } 21834 stringsUnicode.push(strBufUnicode.join("")); 21835 } 21836 const names = [strings, stringsUnicode]; 21837 const platforms = ["\x00\x01", "\x00\x03"]; 21838 const encodings = ["\x00\x00", "\x00\x01"]; 21839 const languages = ["\x00\x00", "\x04\x09"]; 21840 const namesRecordCount = strings.length * platforms.length; 21841 let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6); 21842 let strOffset = 0; 21843 for (i = 0, ii = platforms.length; i < ii; i++) { 21844 const strs = names[i]; 21845 for (j = 0, jj = strs.length; j < jj; j++) { 21846 str = strs[j]; 21847 const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset); 21848 nameTable += nameRecord; 21849 strOffset += str.length; 21850 } 21851 } 21852 nameTable += strings.join("") + stringsUnicode.join(""); 21853 return nameTable; 21854} 21855class Font { 21856 constructor(name, file, properties) { 21857 this.name = name; 21858 this.psName = null; 21859 this.mimetype = null; 21860 this.disableFontFace = false;
21861 this.loadedName = properties.loadedName; 21862 this.isType3Font = properties.isType3Font; 21863 this.missingFile = false; 21864 this.cssFontInfo = properties.cssFontInfo; 21865 this._charsCache = Object.create(null); 21866 this._glyphCache = Object.create(null); 21867 let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif); 21868 if (!isSerifFont && !properties.isSimulatedFlags) { 21869 const baseName = name.replaceAll(/[,_]/g, "-").split("-")[0], 21870 serifFonts = (0, _standard_fonts.getSerifFonts)(); 21871 for (const namePart of baseName.split("+")) { 21872 if (serifFonts[namePart]) { 21873 isSerifFont = true; 21874 break; 21875 } 21876 } 21877 } 21878 this.isSerifFont = isSerifFont; 21879 this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic); 21880 this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch); 21881 let { 21882 type, 21883 subtype 21884 } = properties; 21885 this.type = type; 21886 this.subtype = subtype; 21887 this.systemFontInfo = properties.systemFontInfo; 21888 const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/); 21889 this.isInvalidPDFjsFont = !!matches; 21890 if (this.isInvalidPDFjsFont) { 21891 this.fallbackName = matches[1]; 21892 } else if (this.isMonospace) { 21893 this.fallbackName = "monospace"; 21894 } else if (this.isSerifFont) { 21895 this.fallbackName = "serif"; 21896 } else { 21897 this.fallbackName = "sans-serif"; 21898 } 21899 if (this.systemFontInfo?.guessFallback) { 21900 this.systemFontInfo.guessFallback = false; 21901 this.systemFontInfo.css += `,${this.fallbackName}`; 21902 } 21903 this.differences = properties.differences; 21904 this.widths = properties.widths; 21905 this.defaultWidth = properties.defaultWidth; 21906 this.composite = properties.composite; 21907 this.cMap = properties.cMap; 21908 this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS; 21909 this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; 21910 this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; 21911 this.lineHeight = this.ascent - this.descent; 21912 this.fontMatrix = properties.fontMatrix; 21913 this.bbox = properties.bbox; 21914 this.defaultEncoding = properties.defaultEncoding; 21915 this.toUnicode = properties.toUnicode; 21916 this.toFontChar = []; 21917 if (properties.type === "Type3") { 21918 for (let charCode = 0; charCode < 256; charCode++) { 21919 this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode]; 21920 } 21921 return; 21922 } 21923 this.cidEncoding = properties.cidEncoding || ""; 21924 this.vertical = !!properties.vertical; 21925 if (this.vertical) { 21926 this.vmetrics = properties.vmetrics; 21927 this.defaultVMetrics = properties.defaultVMetrics; 21928 } 21929 if (!file || file.isEmpty) { 21930 if (file) { 21931 (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")"); 21932 } 21933 this.fallbackToSystemFont(properties); 21934 return; 21935 } 21936 [type, subtype] = getFontFileType(file, properties); 21937 if (type !== this.type || subtype !== this.subtype) { 21938 (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`); 21939 } 21940 let data; 21941 try { 21942 switch (type) { 21943 case "MMType1": 21944 (0, _util.info)("MMType1 font (" + name + "), falling back to Type1."); 21945 case "Type1": 21946 case "CIDFontType0": 21947 this.mimetype = "font/opentype"; 21948 const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties); 21949 adjustWidths(properties); 21950 data = this.convert(name, cff, properties); 21951 break; 21952 case "OpenType": 21953 case "TrueType": 21954 case "CIDFontType2": 21955 this.mimetype = "font/opentype"; 21956 data = this.checkAndRepair(name, file, properties); 21957 if (this.isOpenType) { 21958 adjustWidths(properties); 21959 type = "OpenType"; 21960 } 21961 break; 21962 default: 21963 throw new _util.FormatError(`Font ${type} is not supported`); 21964 } 21965 } catch (e) { 21966 (0, _util.warn)(e); 21967 this.fallbackToSystemFont(properties); 21968 return; 21969 } 21970 amendFallbackToUnicode(properties); 21971 this.data = data; 21972 this.type = type; 21973 this.subtype = subtype; 21974 this.fontMatrix = properties.fontMatrix; 21975 this.widths = properties.widths; 21976 this.defaultWidth = properties.defaultWidth; 21977 this.toUnicode = properties.toUnicode; 21978 this.seacMap = properties.seacMap; 21979 } 21980 get renderer() { 21981 const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED); 21982 return (0, _util.shadow)(this, "renderer", renderer); 21983 } 21984 exportData(extraProperties = false) { 21985 const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES; 21986 const data = Object.create(null); 21987 let property, value; 21988 for (property of exportDataProperties) { 21989 value = this[property]; 21990 if (value !== undefined) { 21991 data[property] = value; 21992 } 21993 } 21994 return data; 21995 } 21996 fallbackToSystemFont(properties) { 21997 this.missingFile = true; 21998 const { 21999 name, 22000 type 22001 } = this; 22002 let fontName = (0, _fonts_utils.normalizeFontName)(name); 22003 const stdFontMap = (0, _standard_fonts.getStdFontMap)(), 22004 nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)(); 22005 const isStandardFont = !!stdFontMap[fontName]; 22006 const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); 22007 fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; 22008 const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)(); 22009 const metrics = fontBasicMetricsMap[fontName]; 22010 if (metrics) { 22011 if (isNaN(this.ascent)) { 22012 this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS; 22013 } 22014 if (isNaN(this.descent)) { 22015 this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS; 22016 } 22017 if (isNaN(this.capHeight)) { 22018 this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS; 22019 } 22020 } 22021 this.bold = /bold/gi.test(fontName); 22022 this.italic = /oblique|italic/gi.test(fontName); 22023 this.black = /Black/g.test(name);
vendor: 8,310 bytes, lines 22024-22243
22024 const isNarrow = /Narrow/g.test(name); 22025 this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0; 22026 if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) { 22027 const cidToGidMap = properties.cidToGidMap; 22028 const map = []; 22029 applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)()); 22030 if (/Arial-?Black/i.test(name)) { 22031 applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)()); 22032 } else if (/Calibri/i.test(name)) { 22033 applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)()); 22034 } 22035 if (cidToGidMap) { 22036 for (const charCode in map) { 22037 const cid = map[charCode]; 22038 if (cidToGidMap[cid] !== undefined) { 22039 map[+charCode] = cidToGidMap[cid]; 22040 } 22041 } 22042 if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 22043 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 22044 const cid = map[charCode]; 22045 if (cidToGidMap[cid] === undefined) { 22046 map[+charCode] = unicodeCharCode; 22047 } 22048 }); 22049 } 22050 } 22051 if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) { 22052 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 22053 map[+charCode] = unicodeCharCode; 22054 }); 22055 } 22056 this.toFontChar = map; 22057 this.toUnicode = new _to_unicode_map.ToUnicodeMap(map); 22058 } else if (/Symbol/i.test(fontName)) { 22059 this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 22060 } else if (/Dingbats/i.test(fontName)) { 22061 this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences); 22062 } else if (isStandardFont) { 22063 const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 22064 if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) { 22065 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 22066 map[+charCode] = unicodeCharCode; 22067 }); 22068 } 22069 this.toFontChar = map; 22070 } else { 22071 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 22072 const map = []; 22073 this.toUnicode.forEach((charCode, unicodeCharCode) => { 22074 if (!this.composite) { 22075 const glyphName = this.differences[charCode] || this.defaultEncoding[charCode]; 22076 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 22077 if (unicode !== -1) { 22078 unicodeCharCode = unicode; 22079 } 22080 } 22081 map[+charCode] = unicodeCharCode; 22082 }); 22083 if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { 22084 if (/Tahoma|Verdana/i.test(name)) { 22085 applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)()); 22086 } 22087 } 22088 this.toFontChar = map; 22089 } 22090 amendFallbackToUnicode(properties); 22091 this.loadedName = fontName.split("-")[0]; 22092 } 22093 checkAndRepair(name, font, properties) { 22094 const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "]; 22095 function readTables(file, numTables) { 22096 const tables = Object.create(null); 22097 tables["OS/2"] = null; 22098 tables.cmap = null; 22099 tables.head = null; 22100 tables.hhea = null; 22101 tables.hmtx = null; 22102 tables.maxp = null; 22103 tables.name = null; 22104 tables.post = null; 22105 for (let i = 0; i < numTables; i++) { 22106 const table = readTableEntry(file); 22107 if (!VALID_TABLES.includes(table.tag)) { 22108 continue; 22109 } 22110 if (table.length === 0) { 22111 continue; 22112 } 22113 tables[table.tag] = table; 22114 } 22115 return tables; 22116 } 22117 function readTableEntry(file) { 22118 const tag = file.getString(4); 22119 const checksum = file.getInt32() >>> 0; 22120 const offset = file.getInt32() >>> 0; 22121 const length = file.getInt32() >>> 0; 22122 const previousPosition = file.pos; 22123 file.pos = file.start || 0; 22124 file.skip(offset); 22125 const data = file.getBytes(length); 22126 file.pos = previousPosition; 22127 if (tag === "head") { 22128 data[8] = data[9] = data[10] = data[11] = 0; 22129 data[17] |= 0x20; 22130 } 22131 return { 22132 tag, 22133 checksum, 22134 length, 22135 offset, 22136 data 22137 }; 22138 } 22139 function readOpenTypeHeader(ttf) { 22140 return { 22141 version: ttf.getString(4), 22142 numTables: ttf.getUint16(), 22143 searchRange: ttf.getUint16(), 22144 entrySelector: ttf.getUint16(), 22145 rangeShift: ttf.getUint16() 22146 }; 22147 } 22148 function readTrueTypeCollectionHeader(ttc) { 22149 const ttcTag = ttc.getString(4); 22150 (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font."); 22151 const majorVersion = ttc.getUint16(); 22152 const minorVersion = ttc.getUint16(); 22153 const numFonts = ttc.getInt32() >>> 0; 22154 const offsetTable = []; 22155 for (let i = 0; i < numFonts; i++) { 22156 offsetTable.push(ttc.getInt32() >>> 0); 22157 } 22158 const header = { 22159 ttcTag, 22160 majorVersion, 22161 minorVersion, 22162 numFonts, 22163 offsetTable 22164 }; 22165 switch (majorVersion) { 22166 case 1: 22167 return header; 22168 case 2: 22169 header.dsigTag = ttc.getInt32() >>> 0; 22170 header.dsigLength = ttc.getInt32() >>> 0; 22171 header.dsigOffset = ttc.getInt32() >>> 0; 22172 return header; 22173 } 22174 throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`); 22175 } 22176 function readTrueTypeCollectionData(ttc, fontName) { 22177 const { 22178 numFonts, 22179 offsetTable 22180 } = readTrueTypeCollectionHeader(ttc); 22181 const fontNameParts = fontName.split("+"); 22182 let fallbackData; 22183 for (let i = 0; i < numFonts; i++) { 22184 ttc.pos = (ttc.start || 0) + offsetTable[i]; 22185 const potentialHeader = readOpenTypeHeader(ttc); 22186 const potentialTables = readTables(ttc, potentialHeader.numTables); 22187 if (!potentialTables.name) { 22188 throw new _util.FormatError('TrueType Collection font must contain a "name" table.'); 22189 } 22190 const [nameTable] = readNameTable(potentialTables.name); 22191 for (let j = 0, jj = nameTable.length; j < jj; j++) { 22192 for (let k = 0, kk = nameTable[j].length; k < kk; k++) { 22193 const nameEntry = nameTable[j][k]?.replaceAll(/\s/g, ""); 22194 if (!nameEntry) { 22195 continue; 22196 } 22197 if (nameEntry === fontName) { 22198 return { 22199 header: potentialHeader, 22200 tables: potentialTables 22201 }; 22202 } 22203 if (fontNameParts.length < 2) { 22204 continue; 22205 } 22206 for (const part of fontNameParts) { 22207 if (nameEntry === part) { 22208 fallbackData = { 22209 name: part, 22210 header: potentialHeader, 22211 tables: potentialTables 22212 }; 22213 } 22214 } 22215 } 22216 } 22217 } 22218 if (fallbackData) { 22219 (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`); 22220 return { 22221 header: fallbackData.header, 22222 tables: fallbackData.tables 22223 }; 22224 } 22225 throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`); 22226 } 22227 function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) { 22228 if (!cmap) { 22229 (0, _util.warn)("No cmap table available."); 22230 return { 22231 platformId: -1, 22232 encodingId: -1, 22233 mappings: [], 22234 hasShortCmap: false 22235 }; 22236 } 22237 let segment; 22238 let start = (file.start || 0) + cmap.offset; 22239 file.pos = start; 22240 file.skip(2); 22241 const numTables = file.getUint16(); 22242 let potentialTable; 22243 let canBreak = false;
vendor: 10,086 bytes, lines 22244-22547
22244 for (let i = 0; i < numTables; i++) { 22245 const platformId = file.getUint16(); 22246 const encodingId = file.getUint16(); 22247 const offset = file.getInt32() >>> 0; 22248 let useTable = false; 22249 if (potentialTable?.platformId === platformId && potentialTable?.encodingId === encodingId) { 22250 continue; 22251 } 22252 if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) { 22253 useTable = true; 22254 } else if (platformId === 1 && encodingId === 0) { 22255 useTable = true; 22256 } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) { 22257 useTable = true; 22258 if (!isSymbolicFont) { 22259 canBreak = true; 22260 } 22261 } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { 22262 useTable = true; 22263 let correctlySorted = true; 22264 if (i < numTables - 1) { 22265 const nextBytes = file.peekBytes(2), 22266 nextPlatformId = int16(nextBytes[0], nextBytes[1]); 22267 if (nextPlatformId < platformId) { 22268 correctlySorted = false; 22269 } 22270 } 22271 if (correctlySorted) { 22272 canBreak = true; 22273 } 22274 } 22275 if (useTable) { 22276 potentialTable = { 22277 platformId, 22278 encodingId, 22279 offset 22280 }; 22281 } 22282 if (canBreak) { 22283 break; 22284 } 22285 } 22286 if (potentialTable) { 22287 file.pos = start + potentialTable.offset; 22288 } 22289 if (!potentialTable || file.peekByte() === -1) { 22290 (0, _util.warn)("Could not find a preferred cmap table."); 22291 return { 22292 platformId: -1, 22293 encodingId: -1, 22294 mappings: [], 22295 hasShortCmap: false 22296 }; 22297 } 22298 const format = file.getUint16(); 22299 let hasShortCmap = false; 22300 const mappings = []; 22301 let j, glyphId; 22302 if (format === 0) { 22303 file.skip(2 + 2); 22304 for (j = 0; j < 256; j++) { 22305 const index = file.getByte(); 22306 if (!index) { 22307 continue; 22308 } 22309 mappings.push({ 22310 charCode: j, 22311 glyphId: index 22312 }); 22313 } 22314 hasShortCmap = true; 22315 } else if (format === 2) { 22316 file.skip(2 + 2); 22317 const subHeaderKeys = []; 22318 let maxSubHeaderKey = 0; 22319 for (let i = 0; i < 256; i++) { 22320 const subHeaderKey = file.getUint16() >> 3; 22321 subHeaderKeys.push(subHeaderKey); 22322 maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey); 22323 } 22324 const subHeaders = []; 22325 for (let i = 0; i <= maxSubHeaderKey; i++) { 22326 subHeaders.push({ 22327 firstCode: file.getUint16(), 22328 entryCount: file.getUint16(), 22329 idDelta: signedInt16(file.getByte(), file.getByte()), 22330 idRangePos: file.pos + file.getUint16() 22331 }); 22332 } 22333 for (let i = 0; i < 256; i++) { 22334 if (subHeaderKeys[i] === 0) { 22335 file.pos = subHeaders[0].idRangePos + 2 * i; 22336 glyphId = file.getUint16(); 22337 mappings.push({ 22338 charCode: i, 22339 glyphId 22340 }); 22341 } else { 22342 const s = subHeaders[subHeaderKeys[i]]; 22343 for (j = 0; j < s.entryCount; j++) { 22344 const charCode = (i << 8) + j + s.firstCode; 22345 file.pos = s.idRangePos + 2 * j; 22346 glyphId = file.getUint16(); 22347 if (glyphId !== 0) { 22348 glyphId = (glyphId + s.idDelta) % 65536; 22349 } 22350 mappings.push({ 22351 charCode, 22352 glyphId 22353 }); 22354 } 22355 } 22356 } 22357 } else if (format === 4) { 22358 file.skip(2 + 2); 22359 const segCount = file.getUint16() >> 1; 22360 file.skip(6); 22361 const segments = []; 22362 let segIndex; 22363 for (segIndex = 0; segIndex < segCount; segIndex++) { 22364 segments.push({ 22365 end: file.getUint16() 22366 }); 22367 } 22368 file.skip(2); 22369 for (segIndex = 0; segIndex < segCount; segIndex++) { 22370 segments[segIndex].start = file.getUint16(); 22371 } 22372 for (segIndex = 0; segIndex < segCount; segIndex++) { 22373 segments[segIndex].delta = file.getUint16(); 22374 } 22375 let offsetsCount = 0, 22376 offsetIndex; 22377 for (segIndex = 0; segIndex < segCount; segIndex++) { 22378 segment = segments[segIndex]; 22379 const rangeOffset = file.getUint16(); 22380 if (!rangeOffset) { 22381 segment.offsetIndex = -1; 22382 continue; 22383 } 22384 offsetIndex = (rangeOffset >> 1) - (segCount - segIndex); 22385 segment.offsetIndex = offsetIndex; 22386 offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1); 22387 } 22388 const offsets = []; 22389 for (j = 0; j < offsetsCount; j++) { 22390 offsets.push(file.getUint16()); 22391 } 22392 for (segIndex = 0; segIndex < segCount; segIndex++) { 22393 segment = segments[segIndex]; 22394 start = segment.start; 22395 const end = segment.end; 22396 const delta = segment.delta; 22397 offsetIndex = segment.offsetIndex; 22398 for (j = start; j <= end; j++) { 22399 if (j === 0xffff) { 22400 continue; 22401 } 22402 glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start]; 22403 glyphId = glyphId + delta & 0xffff; 22404 mappings.push({ 22405 charCode: j, 22406 glyphId 22407 }); 22408 } 22409 } 22410 } else if (format === 6) { 22411 file.skip(2 + 2); 22412 const firstCode = file.getUint16(); 22413 const entryCount = file.getUint16(); 22414 for (j = 0; j < entryCount; j++) { 22415 glyphId = file.getUint16(); 22416 const charCode = firstCode + j; 22417 mappings.push({ 22418 charCode, 22419 glyphId 22420 }); 22421 } 22422 } else if (format === 12) { 22423 file.skip(2 + 4 + 4); 22424 const nGroups = file.getInt32() >>> 0; 22425 for (j = 0; j < nGroups; j++) { 22426 const startCharCode = file.getInt32() >>> 0; 22427 const endCharCode = file.getInt32() >>> 0; 22428 let glyphCode = file.getInt32() >>> 0; 22429 for (let charCode = startCharCode; charCode <= endCharCode; charCode++) { 22430 mappings.push({ 22431 charCode, 22432 glyphId: glyphCode++ 22433 }); 22434 } 22435 } 22436 } else { 22437 (0, _util.warn)("cmap table has unsupported format: " + format); 22438 return { 22439 platformId: -1, 22440 encodingId: -1, 22441 mappings: [], 22442 hasShortCmap: false 22443 }; 22444 } 22445 mappings.sort(function (a, b) { 22446 return a.charCode - b.charCode; 22447 }); 22448 for (let i = 1; i < mappings.length; i++) { 22449 if (mappings[i - 1].charCode === mappings[i].charCode) { 22450 mappings.splice(i, 1); 22451 i--; 22452 } 22453 } 22454 return { 22455 platformId: potentialTable.platformId, 22456 encodingId: potentialTable.encodingId, 22457 mappings, 22458 hasShortCmap 22459 }; 22460 } 22461 function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) { 22462 if (!header) { 22463 if (metrics) { 22464 metrics.data = null; 22465 } 22466 return; 22467 } 22468 file.pos = (file.start || 0) + header.offset; 22469 file.pos += 4; 22470 file.pos += 2; 22471 file.pos += 2; 22472 file.pos += 2; 22473 file.pos += 2; 22474 file.pos += 2; 22475 file.pos += 2; 22476 file.pos += 2; 22477 file.pos += 2; 22478 file.pos += 2; 22479 const caretOffset = file.getUint16(); 22480 file.pos += 8; 22481 file.pos += 2; 22482 let numOfMetrics = file.getUint16(); 22483 if (caretOffset !== 0) { 22484 const macStyle = int16(headTable.data[44], headTable.data[45]); 22485 if (!(macStyle & 2)) { 22486 header.data[22] = 0; 22487 header.data[23] = 0; 22488 } 22489 } 22490 if (numOfMetrics > numGlyphs) { 22491 (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`); 22492 numOfMetrics = numGlyphs; 22493 header.data[34] = (numOfMetrics & 0xff00) >> 8; 22494 header.data[35] = numOfMetrics & 0x00ff; 22495 } 22496 const numOfSidebearings = numGlyphs - numOfMetrics; 22497 const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1); 22498 if (numMissing > 0) { 22499 const entries = new Uint8Array(metrics.length + numMissing * 2); 22500 entries.set(metrics.data); 22501 if (dupFirstEntry) { 22502 entries[metrics.length] = metrics.data[2]; 22503 entries[metrics.length + 1] = metrics.data[3]; 22504 } 22505 metrics.data = entries; 22506 } 22507 } 22508 function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) { 22509 const glyphProfile = { 22510 length: 0, 22511 sizeOfInstructions: 0 22512 }; 22513 if (sourceStart < 0 || sourceStart >= source.length || sourceEnd > source.length || sourceEnd - sourceStart <= 12) { 22514 return glyphProfile; 22515 } 22516 const glyf = source.subarray(sourceStart, sourceEnd); 22517 const xMin = signedInt16(glyf[2], glyf[3]); 22518 const yMin = signedInt16(glyf[4], glyf[5]); 22519 const xMax = signedInt16(glyf[6], glyf[7]); 22520 const yMax = signedInt16(glyf[8], glyf[9]); 22521 if (xMin > xMax) { 22522 writeSignedInt16(glyf, 2, xMax); 22523 writeSignedInt16(glyf, 6, xMin); 22524 } 22525 if (yMin > yMax) { 22526 writeSignedInt16(glyf, 4, yMax); 22527 writeSignedInt16(glyf, 8, yMin); 22528 } 22529 const contoursCount = signedInt16(glyf[0], glyf[1]); 22530 if (contoursCount < 0) { 22531 if (contoursCount < -1) { 22532 return glyphProfile; 22533 } 22534 dest.set(glyf, destStart); 22535 glyphProfile.length = glyf.length; 22536 return glyphProfile; 22537 } 22538 let i, 22539 j = 10, 22540 flagsCount = 0; 22541 for (i = 0; i < contoursCount; i++) { 22542 const endPoint = glyf[j] << 8 | glyf[j + 1]; 22543 flagsCount = endPoint + 1; 22544 j += 2; 22545 } 22546 const instructionsStart = j; 22547 const instructionsLength = glyf[j] << 8 | glyf[j + 1];
vendor: 83,969 bytes, lines 22548-24921
22548 glyphProfile.sizeOfInstructions = instructionsLength; 22549 j += 2 + instructionsLength; 22550 const instructionsEnd = j; 22551 let coordinatesLength = 0; 22552 for (i = 0; i < flagsCount; i++) { 22553 const flag = glyf[j++]; 22554 if (flag & 0xc0) { 22555 glyf[j - 1] = flag & 0x3f; 22556 } 22557 let xLength = 2; 22558 if (flag & 2) { 22559 xLength = 1; 22560 } else if (flag & 16) { 22561 xLength = 0; 22562 } 22563 let yLength = 2; 22564 if (flag & 4) { 22565 yLength = 1; 22566 } else if (flag & 32) { 22567 yLength = 0; 22568 } 22569 const xyLength = xLength + yLength; 22570 coordinatesLength += xyLength; 22571 if (flag & 8) { 22572 const repeat = glyf[j++]; 22573 if (repeat === 0) { 22574 glyf[j - 1] ^= 8; 22575 } 22576 i += repeat; 22577 coordinatesLength += repeat * xyLength; 22578 } 22579 } 22580 if (coordinatesLength === 0) { 22581 return glyphProfile; 22582 } 22583 let glyphDataLength = j + coordinatesLength; 22584 if (glyphDataLength > glyf.length) { 22585 return glyphProfile; 22586 } 22587 if (!hintsValid && instructionsLength > 0) { 22588 dest.set(glyf.subarray(0, instructionsStart), destStart); 22589 dest.set([0, 0], destStart + instructionsStart); 22590 dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2); 22591 glyphDataLength -= instructionsLength; 22592 if (glyf.length - glyphDataLength > 3) { 22593 glyphDataLength = glyphDataLength + 3 & ~3; 22594 } 22595 glyphProfile.length = glyphDataLength; 22596 return glyphProfile; 22597 } 22598 if (glyf.length - glyphDataLength > 3) { 22599 glyphDataLength = glyphDataLength + 3 & ~3; 22600 dest.set(glyf.subarray(0, glyphDataLength), destStart); 22601 glyphProfile.length = glyphDataLength; 22602 return glyphProfile; 22603 } 22604 dest.set(glyf, destStart); 22605 glyphProfile.length = glyf.length; 22606 return glyphProfile; 22607 } 22608 function sanitizeHead(head, numGlyphs, locaLength) { 22609 const data = head.data; 22610 const version = int32(data[0], data[1], data[2], data[3]); 22611 if (version >> 16 !== 1) { 22612 (0, _util.info)("Attempting to fix invalid version in head table: " + version); 22613 data[0] = 0; 22614 data[1] = 1; 22615 data[2] = 0; 22616 data[3] = 0; 22617 } 22618 const indexToLocFormat = int16(data[50], data[51]); 22619 if (indexToLocFormat < 0 || indexToLocFormat > 1) { 22620 (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat); 22621 const numGlyphsPlusOne = numGlyphs + 1; 22622 if (locaLength === numGlyphsPlusOne << 1) { 22623 data[50] = 0; 22624 data[51] = 0; 22625 } else if (locaLength === numGlyphsPlusOne << 2) { 22626 data[50] = 0; 22627 data[51] = 1; 22628 } else { 22629 throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat); 22630 } 22631 } 22632 } 22633 function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) { 22634 let itemSize, itemDecode, itemEncode; 22635 if (isGlyphLocationsLong) { 22636 itemSize = 4; 22637 itemDecode = function fontItemDecodeLong(data, offset) { 22638 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 22639 }; 22640 itemEncode = function fontItemEncodeLong(data, offset, value) { 22641 data[offset] = value >>> 24 & 0xff; 22642 data[offset + 1] = value >> 16 & 0xff; 22643 data[offset + 2] = value >> 8 & 0xff; 22644 data[offset + 3] = value & 0xff; 22645 }; 22646 } else { 22647 itemSize = 2; 22648 itemDecode = function fontItemDecode(data, offset) { 22649 return data[offset] << 9 | data[offset + 1] << 1; 22650 }; 22651 itemEncode = function fontItemEncode(data, offset, value) { 22652 data[offset] = value >> 9 & 0xff; 22653 data[offset + 1] = value >> 1 & 0xff; 22654 }; 22655 } 22656 const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs; 22657 const locaDataSize = itemSize * (1 + numGlyphsOut); 22658 const locaData = new Uint8Array(locaDataSize); 22659 locaData.set(loca.data.subarray(0, locaDataSize)); 22660 loca.data = locaData; 22661 const oldGlyfData = glyf.data; 22662 const oldGlyfDataLength = oldGlyfData.length; 22663 const newGlyfData = new Uint8Array(oldGlyfDataLength); 22664 let i, j; 22665 const locaEntries = []; 22666 for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) { 22667 let offset = itemDecode(locaData, j); 22668 if (offset > oldGlyfDataLength) { 22669 offset = oldGlyfDataLength; 22670 } 22671 locaEntries.push({ 22672 index: i, 22673 offset, 22674 endOffset: 0 22675 }); 22676 } 22677 locaEntries.sort((a, b) => { 22678 return a.offset - b.offset; 22679 }); 22680 for (i = 0; i < numGlyphs; i++) { 22681 locaEntries[i].endOffset = locaEntries[i + 1].offset; 22682 } 22683 locaEntries.sort((a, b) => { 22684 return a.index - b.index; 22685 }); 22686 for (i = 0; i < numGlyphs; i++) { 22687 const { 22688 offset, 22689 endOffset 22690 } = locaEntries[i]; 22691 if (offset !== 0 || endOffset !== 0) { 22692 break; 22693 } 22694 const nextOffset = locaEntries[i + 1].offset; 22695 if (nextOffset === 0) { 22696 continue; 22697 } 22698 locaEntries[i].endOffset = nextOffset; 22699 break; 22700 } 22701 const missingGlyphs = Object.create(null); 22702 let writeOffset = 0; 22703 itemEncode(locaData, 0, writeOffset); 22704 for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { 22705 const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid); 22706 const newLength = glyphProfile.length; 22707 if (newLength === 0) { 22708 missingGlyphs[i] = true; 22709 } 22710 if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) { 22711 maxSizeOfInstructions = glyphProfile.sizeOfInstructions; 22712 } 22713 writeOffset += newLength; 22714 itemEncode(locaData, j, writeOffset); 22715 } 22716 if (writeOffset === 0) { 22717 const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]); 22718 for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) { 22719 itemEncode(locaData, j, simpleGlyph.length); 22720 } 22721 glyf.data = simpleGlyph; 22722 } else if (dupFirstEntry) { 22723 const firstEntryLength = itemDecode(locaData, itemSize); 22724 if (newGlyfData.length > firstEntryLength + writeOffset) { 22725 glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset); 22726 } else { 22727 glyf.data = new Uint8Array(firstEntryLength + writeOffset); 22728 glyf.data.set(newGlyfData.subarray(0, writeOffset)); 22729 } 22730 glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset); 22731 itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength); 22732 } else { 22733 glyf.data = newGlyfData.subarray(0, writeOffset); 22734 } 22735 return { 22736 missingGlyphs, 22737 maxSizeOfInstructions 22738 }; 22739 } 22740 function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) { 22741 const start = (font.start || 0) + post.offset; 22742 font.pos = start; 22743 const length = post.length, 22744 end = start + length; 22745 const version = font.getInt32(); 22746 font.skip(28); 22747 let glyphNames; 22748 let valid = true; 22749 let i; 22750 switch (version) { 22751 case 0x00010000: 22752 glyphNames = _fonts_utils.MacStandardGlyphOrdering; 22753 break; 22754 case 0x00020000: 22755 const numGlyphs = font.getUint16(); 22756 if (numGlyphs !== maxpNumGlyphs) { 22757 valid = false; 22758 break; 22759 } 22760 const glyphNameIndexes = []; 22761 for (i = 0; i < numGlyphs; ++i) { 22762 const index = font.getUint16(); 22763 if (index >= 32768) { 22764 valid = false; 22765 break; 22766 } 22767 glyphNameIndexes.push(index); 22768 } 22769 if (!valid) { 22770 break; 22771 } 22772 const customNames = [], 22773 strBuf = []; 22774 while (font.pos < end) { 22775 const stringLength = font.getByte(); 22776 strBuf.length = stringLength; 22777 for (i = 0; i < stringLength; ++i) { 22778 strBuf[i] = String.fromCharCode(font.getByte()); 22779 } 22780 customNames.push(strBuf.join("")); 22781 } 22782 glyphNames = []; 22783 for (i = 0; i < numGlyphs; ++i) { 22784 const j = glyphNameIndexes[i]; 22785 if (j < 258) { 22786 glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]); 22787 continue; 22788 } 22789 glyphNames.push(customNames[j - 258]); 22790 } 22791 break; 22792 case 0x00030000: 22793 break; 22794 default: 22795 (0, _util.warn)("Unknown/unsupported post table version " + version); 22796 valid = false; 22797 if (propertiesObj.defaultEncoding) { 22798 glyphNames = propertiesObj.defaultEncoding; 22799 } 22800 break; 22801 } 22802 propertiesObj.glyphNames = glyphNames; 22803 return valid; 22804 } 22805 function readNameTable(nameTable) { 22806 const start = (font.start || 0) + nameTable.offset; 22807 font.pos = start; 22808 const names = [[], []], 22809 records = []; 22810 const length = nameTable.length, 22811 end = start + length; 22812 const format = font.getUint16(); 22813 const FORMAT_0_HEADER_LENGTH = 6; 22814 if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) { 22815 return [names, records]; 22816 } 22817 const numRecords = font.getUint16(); 22818 const stringsStart = font.getUint16(); 22819 const NAME_RECORD_LENGTH = 12; 22820 let i, ii; 22821 for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) { 22822 const r = { 22823 platform: font.getUint16(), 22824 encoding: font.getUint16(), 22825 language: font.getUint16(), 22826 name: font.getUint16(), 22827 length: font.getUint16(), 22828 offset: font.getUint16() 22829 }; 22830 if (isMacNameRecord(r) || isWinNameRecord(r)) { 22831 records.push(r); 22832 } 22833 } 22834 for (i = 0, ii = records.length; i < ii; i++) { 22835 const record = records[i]; 22836 if (record.length <= 0) { 22837 continue; 22838 } 22839 const pos = start + stringsStart + record.offset; 22840 if (pos + record.length > end) { 22841 continue; 22842 } 22843 font.pos = pos; 22844 const nameIndex = record.name; 22845 if (record.encoding) { 22846 let str = ""; 22847 for (let j = 0, jj = record.length; j < jj; j += 2) { 22848 str += String.fromCharCode(font.getUint16()); 22849 } 22850 names[1][nameIndex] = str; 22851 } else { 22852 names[0][nameIndex] = font.getString(record.length); 22853 } 22854 } 22855 return [names, records]; 22856 } 22857 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]; 22858 function sanitizeTTProgram(table, ttContext) { 22859 let data = table.data; 22860 let i = 0, 22861 j, 22862 n, 22863 b, 22864 funcId, 22865 pc, 22866 lastEndf = 0, 22867 lastDeff = 0; 22868 const stack = []; 22869 const callstack = []; 22870 const functionsCalled = []; 22871 let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions; 22872 let inFDEF = false, 22873 ifLevel = 0, 22874 inELSE = 0; 22875 for (let ii = data.length; i < ii;) { 22876 const op = data[i++]; 22877 if (op === 0x40) { 22878 n = data[i++]; 22879 if (inFDEF || inELSE) { 22880 i += n; 22881 } else { 22882 for (j = 0; j < n; j++) { 22883 stack.push(data[i++]); 22884 } 22885 } 22886 } else if (op === 0x41) { 22887 n = data[i++]; 22888 if (inFDEF || inELSE) { 22889 i += n * 2; 22890 } else { 22891 for (j = 0; j < n; j++) { 22892 b = data[i++]; 22893 stack.push(b << 8 | data[i++]); 22894 } 22895 } 22896 } else if ((op & 0xf8) === 0xb0) { 22897 n = op - 0xb0 + 1; 22898 if (inFDEF || inELSE) { 22899 i += n; 22900 } else { 22901 for (j = 0; j < n; j++) { 22902 stack.push(data[i++]); 22903 } 22904 } 22905 } else if ((op & 0xf8) === 0xb8) { 22906 n = op - 0xb8 + 1; 22907 if (inFDEF || inELSE) { 22908 i += n * 2; 22909 } else { 22910 for (j = 0; j < n; j++) { 22911 b = data[i++]; 22912 stack.push(b << 8 | data[i++]); 22913 } 22914 } 22915 } else if (op === 0x2b && !tooComplexToFollowFunctions) { 22916 if (!inFDEF && !inELSE) { 22917 funcId = stack.at(-1); 22918 if (isNaN(funcId)) { 22919 (0, _util.info)("TT: CALL empty stack (or invalid entry)."); 22920 } else { 22921 ttContext.functionsUsed[funcId] = true; 22922 if (funcId in ttContext.functionsStackDeltas) { 22923 const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId]; 22924 if (newStackLength < 0) { 22925 (0, _util.warn)("TT: CALL invalid functions stack delta."); 22926 ttContext.hintsValid = false; 22927 return; 22928 } 22929 stack.length = newStackLength; 22930 } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) { 22931 callstack.push({ 22932 data, 22933 i, 22934 stackTop: stack.length - 1 22935 }); 22936 functionsCalled.push(funcId); 22937 pc = ttContext.functionsDefined[funcId]; 22938 if (!pc) { 22939 (0, _util.warn)("TT: CALL non-existent function"); 22940 ttContext.hintsValid = false; 22941 return; 22942 } 22943 data = pc.data; 22944 i = pc.i; 22945 } 22946 } 22947 } 22948 } else if (op === 0x2c && !tooComplexToFollowFunctions) { 22949 if (inFDEF || inELSE) { 22950 (0, _util.warn)("TT: nested FDEFs not allowed"); 22951 tooComplexToFollowFunctions = true; 22952 } 22953 inFDEF = true; 22954 lastDeff = i; 22955 funcId = stack.pop(); 22956 ttContext.functionsDefined[funcId] = { 22957 data, 22958 i 22959 }; 22960 } else if (op === 0x2d) { 22961 if (inFDEF) { 22962 inFDEF = false; 22963 lastEndf = i; 22964 } else { 22965 pc = callstack.pop(); 22966 if (!pc) { 22967 (0, _util.warn)("TT: ENDF bad stack"); 22968 ttContext.hintsValid = false; 22969 return; 22970 } 22971 funcId = functionsCalled.pop(); 22972 data = pc.data; 22973 i = pc.i; 22974 ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop; 22975 } 22976 } else if (op === 0x89) { 22977 if (inFDEF || inELSE) { 22978 (0, _util.warn)("TT: nested IDEFs not allowed"); 22979 tooComplexToFollowFunctions = true; 22980 } 22981 inFDEF = true; 22982 lastDeff = i; 22983 } else if (op === 0x58) { 22984 ++ifLevel; 22985 } else if (op === 0x1b) { 22986 inELSE = ifLevel; 22987 } else if (op === 0x59) { 22988 if (inELSE === ifLevel) { 22989 inELSE = 0; 22990 } 22991 --ifLevel; 22992 } else if (op === 0x1c) { 22993 if (!inFDEF && !inELSE) { 22994 const offset = stack.at(-1); 22995 if (offset > 0) { 22996 i += offset - 1; 22997 } 22998 } 22999 } 23000 if (!inFDEF && !inELSE) { 23001 let stackDelta = 0; 23002 if (op <= 0x8e) { 23003 stackDelta = TTOpsStackDeltas[op]; 23004 } else if (op >= 0xc0 && op <= 0xdf) { 23005 stackDelta = -1; 23006 } else if (op >= 0xe0) { 23007 stackDelta = -2; 23008 } 23009 if (op >= 0x71 && op <= 0x75) { 23010 n = stack.pop(); 23011 if (!isNaN(n)) { 23012 stackDelta = -n * 2; 23013 } 23014 } 23015 while (stackDelta < 0 && stack.length > 0) { 23016 stack.pop(); 23017 stackDelta++; 23018 } 23019 while (stackDelta > 0) { 23020 stack.push(NaN); 23021 stackDelta--; 23022 } 23023 } 23024 } 23025 ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions; 23026 const content = [data]; 23027 if (i > data.length) { 23028 content.push(new Uint8Array(i - data.length)); 23029 } 23030 if (lastDeff > lastEndf) { 23031 (0, _util.warn)("TT: complementing a missing function tail"); 23032 content.push(new Uint8Array([0x22, 0x2d])); 23033 } 23034 foldTTTable(table, content); 23035 } 23036 function checkInvalidFunctions(ttContext, maxFunctionDefs) { 23037 if (ttContext.tooComplexToFollowFunctions) { 23038 return; 23039 } 23040 if (ttContext.functionsDefined.length > maxFunctionDefs) { 23041 (0, _util.warn)("TT: more functions defined than expected"); 23042 ttContext.hintsValid = false; 23043 return; 23044 } 23045 for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) { 23046 if (j > maxFunctionDefs) { 23047 (0, _util.warn)("TT: invalid function id: " + j); 23048 ttContext.hintsValid = false; 23049 return; 23050 } 23051 if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) { 23052 (0, _util.warn)("TT: undefined function: " + j); 23053 ttContext.hintsValid = false; 23054 return; 23055 } 23056 } 23057 } 23058 function foldTTTable(table, content) { 23059 if (content.length > 1) { 23060 let newLength = 0; 23061 let j, jj; 23062 for (j = 0, jj = content.length; j < jj; j++) { 23063 newLength += content[j].length; 23064 } 23065 newLength = newLength + 3 & ~3; 23066 const result = new Uint8Array(newLength); 23067 let pos = 0; 23068 for (j = 0, jj = content.length; j < jj; j++) { 23069 result.set(content[j], pos); 23070 pos += content[j].length; 23071 } 23072 table.data = result; 23073 table.length = newLength; 23074 } 23075 } 23076 function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) { 23077 const ttContext = { 23078 functionsDefined: [], 23079 functionsUsed: [], 23080 functionsStackDeltas: [], 23081 tooComplexToFollowFunctions: false, 23082 hintsValid: true 23083 }; 23084 if (fpgm) { 23085 sanitizeTTProgram(fpgm, ttContext); 23086 } 23087 if (prep) { 23088 sanitizeTTProgram(prep, ttContext); 23089 } 23090 if (fpgm) { 23091 checkInvalidFunctions(ttContext, maxFunctionDefs); 23092 } 23093 if (cvt && cvt.length & 1) { 23094 const cvtData = new Uint8Array(cvt.length + 1); 23095 cvtData.set(cvt.data); 23096 cvt.data = cvtData; 23097 } 23098 return ttContext.hintsValid; 23099 } 23100 font = new _stream.Stream(new Uint8Array(font.getBytes())); 23101 let header, tables; 23102 if (isTrueTypeCollectionFile(font)) { 23103 const ttcData = readTrueTypeCollectionData(font, this.name); 23104 header = ttcData.header; 23105 tables = ttcData.tables; 23106 } else { 23107 header = readOpenTypeHeader(font); 23108 tables = readTables(font, header.numTables); 23109 } 23110 let cff, cffFile; 23111 const isTrueType = !tables["CFF "]; 23112 if (!isTrueType) { 23113 const isComposite = properties.composite && (properties.cidToGidMap?.length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap)); 23114 if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) { 23115 cffFile = new _stream.Stream(tables["CFF "].data); 23116 cff = new _cff_font.CFFFont(cffFile, properties); 23117 adjustWidths(properties); 23118 return this.convert(name, cff, properties); 23119 } 23120 delete tables.glyf; 23121 delete tables.loca; 23122 delete tables.fpgm; 23123 delete tables.prep; 23124 delete tables["cvt "]; 23125 this.isOpenType = true; 23126 } else { 23127 if (!tables.loca) { 23128 throw new _util.FormatError('Required "loca" table is not found'); 23129 } 23130 if (!tables.glyf) { 23131 (0, _util.warn)('Required "glyf" table is not found -- trying to recover.'); 23132 tables.glyf = { 23133 tag: "glyf", 23134 data: new Uint8Array(0) 23135 }; 23136 } 23137 this.isOpenType = false; 23138 } 23139 if (!tables.maxp) { 23140 throw new _util.FormatError('Required "maxp" table is not found'); 23141 } 23142 font.pos = (font.start || 0) + tables.maxp.offset; 23143 const version = font.getInt32(); 23144 const numGlyphs = font.getUint16(); 23145 if (properties.scaleFactors?.length === numGlyphs && isTrueType) { 23146 const { 23147 scaleFactors 23148 } = properties; 23149 const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); 23150 const glyphs = new _glyf.GlyfTable({ 23151 glyfTable: tables.glyf.data, 23152 isGlyphLocationsLong, 23153 locaTable: tables.loca.data, 23154 numGlyphs 23155 }); 23156 glyphs.scale(scaleFactors); 23157 const { 23158 glyf, 23159 loca, 23160 isLocationLong 23161 } = glyphs.write(); 23162 tables.glyf.data = glyf; 23163 tables.loca.data = loca; 23164 if (isLocationLong !== !!isGlyphLocationsLong) { 23165 tables.head.data[50] = 0; 23166 tables.head.data[51] = isLocationLong ? 1 : 0; 23167 } 23168 const metrics = tables.hmtx.data; 23169 for (let i = 0; i < numGlyphs; i++) { 23170 const j = 4 * i; 23171 const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1])); 23172 metrics[j] = advanceWidth >> 8 & 0xff; 23173 metrics[j + 1] = advanceWidth & 0xff; 23174 const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3])); 23175 writeSignedInt16(metrics, j + 2, lsb); 23176 } 23177 } 23178 let numGlyphsOut = numGlyphs + 1; 23179 let dupFirstEntry = true; 23180 if (numGlyphsOut > 0xffff) { 23181 dupFirstEntry = false; 23182 numGlyphsOut = numGlyphs; 23183 (0, _util.warn)("Not enough space in glyfs to duplicate first glyph."); 23184 } 23185 let maxFunctionDefs = 0; 23186 let maxSizeOfInstructions = 0; 23187 if (version >= 0x00010000 && tables.maxp.length >= 22) { 23188 font.pos += 8; 23189 const maxZones = font.getUint16(); 23190 if (maxZones > 2) { 23191 tables.maxp.data[14] = 0; 23192 tables.maxp.data[15] = 2; 23193 } 23194 font.pos += 4; 23195 maxFunctionDefs = font.getUint16(); 23196 font.pos += 4; 23197 maxSizeOfInstructions = font.getUint16(); 23198 } 23199 tables.maxp.data[4] = numGlyphsOut >> 8; 23200 tables.maxp.data[5] = numGlyphsOut & 255; 23201 const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs); 23202 if (!hintsValid) { 23203 delete tables.fpgm; 23204 delete tables.prep; 23205 delete tables["cvt "]; 23206 } 23207 sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry); 23208 if (!tables.head) { 23209 throw new _util.FormatError('Required "head" table is not found'); 23210 } 23211 sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0); 23212 let missingGlyphs = Object.create(null); 23213 if (isTrueType) { 23214 const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); 23215 const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions); 23216 missingGlyphs = glyphsInfo.missingGlyphs; 23217 if (version >= 0x00010000 && tables.maxp.length >= 22) { 23218 tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8; 23219 tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255; 23220 } 23221 } 23222 if (!tables.hhea) { 23223 throw new _util.FormatError('Required "hhea" table is not found'); 23224 } 23225 if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) { 23226 tables.hhea.data[10] = 0xff; 23227 tables.hhea.data[11] = 0xff; 23228 } 23229 const metricsOverride = { 23230 unitsPerEm: int16(tables.head.data[18], tables.head.data[19]), 23231 yMax: signedInt16(tables.head.data[42], tables.head.data[43]), 23232 yMin: signedInt16(tables.head.data[38], tables.head.data[39]), 23233 ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]), 23234 descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]), 23235 lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9]) 23236 }; 23237 this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm; 23238 this.descent = metricsOverride.descent / metricsOverride.unitsPerEm; 23239 this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm; 23240 if (this.cssFontInfo?.lineHeight) { 23241 this.lineHeight = this.cssFontInfo.metrics.lineHeight; 23242 this.lineGap = this.cssFontInfo.metrics.lineGap; 23243 } else { 23244 this.lineHeight = this.ascent - this.descent + this.lineGap; 23245 } 23246 if (tables.post) { 23247 readPostScriptTable(tables.post, properties, numGlyphs); 23248 } 23249 tables.post = { 23250 tag: "post", 23251 data: createPostTable(properties) 23252 }; 23253 const charCodeToGlyphId = []; 23254 function hasGlyph(glyphId) { 23255 return !missingGlyphs[glyphId]; 23256 } 23257 if (properties.composite) { 23258 const cidToGidMap = properties.cidToGidMap || []; 23259 const isCidToGidMapEmpty = cidToGidMap.length === 0; 23260 properties.cMap.forEach(function (charCode, cid) { 23261 if (typeof cid === "string") { 23262 cid = convertCidString(charCode, cid, true); 23263 } 23264 if (cid > 0xffff) { 23265 throw new _util.FormatError("Max size of CID is 65,535"); 23266 } 23267 let glyphId = -1; 23268 if (isCidToGidMapEmpty) { 23269 glyphId = cid; 23270 } else if (cidToGidMap[cid] !== undefined) { 23271 glyphId = cidToGidMap[cid]; 23272 } 23273 if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) { 23274 charCodeToGlyphId[charCode] = glyphId; 23275 } 23276 }); 23277 } else { 23278 const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding); 23279 const cmapPlatformId = cmapTable.platformId; 23280 const cmapEncodingId = cmapTable.encodingId; 23281 const cmapMappings = cmapTable.mappings; 23282 let baseEncoding = [], 23283 forcePostTable = false; 23284 if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) { 23285 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 23286 } 23287 if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) { 23288 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 23289 for (let charCode = 0; charCode < 256; charCode++) { 23290 let glyphName; 23291 if (this.differences[charCode] !== undefined) { 23292 glyphName = this.differences[charCode]; 23293 } else if (baseEncoding.length && baseEncoding[charCode] !== "") { 23294 glyphName = baseEncoding[charCode]; 23295 } else { 23296 glyphName = _encodings.StandardEncoding[charCode]; 23297 } 23298 if (!glyphName) { 23299 continue; 23300 } 23301 const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap); 23302 let unicodeOrCharCode; 23303 if (cmapPlatformId === 3 && cmapEncodingId === 1) { 23304 unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName]; 23305 } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { 23306 unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName); 23307 } 23308 if (unicodeOrCharCode === undefined) { 23309 if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) { 23310 const unicode = this.toUnicode.get(charCode); 23311 if (unicode) { 23312 unicodeOrCharCode = unicode.codePointAt(0); 23313 } 23314 } 23315 if (unicodeOrCharCode === undefined) { 23316 continue; 23317 } 23318 } 23319 for (const mapping of cmapMappings) { 23320 if (mapping.charCode !== unicodeOrCharCode) { 23321 continue; 23322 } 23323 charCodeToGlyphId[charCode] = mapping.glyphId; 23324 break; 23325 } 23326 } 23327 } else if (cmapPlatformId === 0) { 23328 for (const mapping of cmapMappings) { 23329 charCodeToGlyphId[mapping.charCode] = mapping.glyphId; 23330 } 23331 forcePostTable = true; 23332 } else { 23333 for (const mapping of cmapMappings) { 23334 let charCode = mapping.charCode; 23335 if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) { 23336 charCode &= 0xff; 23337 } 23338 charCodeToGlyphId[charCode] = mapping.glyphId; 23339 } 23340 } 23341 if (properties.glyphNames && (baseEncoding.length || this.differences.length)) { 23342 for (let i = 0; i < 256; ++i) { 23343 if (!forcePostTable && charCodeToGlyphId[i] !== undefined) { 23344 continue; 23345 } 23346 const glyphName = this.differences[i] || baseEncoding[i]; 23347 if (!glyphName) { 23348 continue; 23349 } 23350 const glyphId = properties.glyphNames.indexOf(glyphName); 23351 if (glyphId > 0 && hasGlyph(glyphId)) { 23352 charCodeToGlyphId[i] = glyphId; 23353 } 23354 } 23355 } 23356 } 23357 if (charCodeToGlyphId.length === 0) { 23358 charCodeToGlyphId[0] = 0; 23359 } 23360 let glyphZeroId = numGlyphsOut - 1; 23361 if (!dupFirstEntry) { 23362 glyphZeroId = 0; 23363 } 23364 if (!properties.cssFontInfo) { 23365 const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode); 23366 this.toFontChar = newMapping.toFontChar; 23367 tables.cmap = { 23368 tag: "cmap", 23369 data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut) 23370 }; 23371 if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) { 23372 tables["OS/2"] = { 23373 tag: "OS/2", 23374 data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride) 23375 }; 23376 } 23377 } 23378 if (!isTrueType) { 23379 try { 23380 cffFile = new _stream.Stream(tables["CFF "].data); 23381 const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED); 23382 cff = parser.parse(); 23383 cff.duplicateFirstGlyph(); 23384 const compiler = new _cff_parser.CFFCompiler(cff); 23385 tables["CFF "].data = compiler.compile(); 23386 } catch { 23387 (0, _util.warn)("Failed to compile font " + properties.loadedName); 23388 } 23389 } 23390 if (!tables.name) { 23391 tables.name = { 23392 tag: "name", 23393 data: createNameTable(this.name) 23394 }; 23395 } else { 23396 const [namePrototype, nameRecords] = readNameTable(tables.name); 23397 tables.name.data = createNameTable(name, namePrototype); 23398 this.psName = namePrototype[0][6] || null; 23399 if (!properties.composite) { 23400 adjustTrueTypeToUnicode(properties, this.isSymbolicFont, nameRecords); 23401 } 23402 } 23403 const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version); 23404 for (const tableTag in tables) { 23405 builder.addTable(tableTag, tables[tableTag].data); 23406 } 23407 return builder.toArray(); 23408 } 23409 convert(fontName, font, properties) { 23410 properties.fixedPitch = false; 23411 if (properties.builtInEncoding) { 23412 adjustType1ToUnicode(properties, properties.builtInEncoding); 23413 } 23414 let glyphZeroId = 1; 23415 if (font instanceof _cff_font.CFFFont) { 23416 glyphZeroId = font.numGlyphs - 1; 23417 } 23418 const mapping = font.getGlyphMapping(properties); 23419 let newMapping = null; 23420 let newCharCodeToGlyphId = mapping; 23421 let toUnicodeExtraMap = null; 23422 if (!properties.cssFontInfo) { 23423 newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode); 23424 this.toFontChar = newMapping.toFontChar; 23425 newCharCodeToGlyphId = newMapping.charCodeToGlyphId; 23426 toUnicodeExtraMap = newMapping.toUnicodeExtraMap; 23427 } 23428 const numGlyphs = font.numGlyphs; 23429 function getCharCodes(charCodeToGlyphId, glyphId) { 23430 let charCodes = null; 23431 for (const charCode in charCodeToGlyphId) { 23432 if (glyphId === charCodeToGlyphId[charCode]) { 23433 (charCodes ||= []).push(charCode | 0); 23434 } 23435 } 23436 return charCodes; 23437 } 23438 function createCharCode(charCodeToGlyphId, glyphId) { 23439 for (const charCode in charCodeToGlyphId) { 23440 if (glyphId === charCodeToGlyphId[charCode]) { 23441 return charCode | 0; 23442 } 23443 } 23444 newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId; 23445 return newMapping.nextAvailableFontCharCode++; 23446 } 23447 const seacs = font.seacs; 23448 if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs?.length) { 23449 const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX; 23450 const charset = font.getCharset(); 23451 const seacMap = Object.create(null); 23452 for (let glyphId in seacs) { 23453 glyphId |= 0; 23454 const seac = seacs[glyphId]; 23455 const baseGlyphName = _encodings.StandardEncoding[seac[2]]; 23456 const accentGlyphName = _encodings.StandardEncoding[seac[3]]; 23457 const baseGlyphId = charset.indexOf(baseGlyphName); 23458 const accentGlyphId = charset.indexOf(accentGlyphName); 23459 if (baseGlyphId < 0 || accentGlyphId < 0) { 23460 continue; 23461 } 23462 const accentOffset = { 23463 x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4], 23464 y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5] 23465 }; 23466 const charCodes = getCharCodes(mapping, glyphId); 23467 if (!charCodes) { 23468 continue; 23469 } 23470 for (const charCode of charCodes) { 23471 const charCodeToGlyphId = newMapping.charCodeToGlyphId; 23472 const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId); 23473 const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId); 23474 seacMap[charCode] = { 23475 baseFontCharCode, 23476 accentFontCharCode, 23477 accentOffset 23478 }; 23479 } 23480 } 23481 properties.seacMap = seacMap; 23482 } 23483 const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 23484 const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F"); 23485 builder.addTable("CFF ", font.data); 23486 builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId)); 23487 builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs)); 23488 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"); 23489 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)); 23490 builder.addTable("hmtx", function fontFieldsHmtx() { 23491 const charstrings = font.charstrings; 23492 const cffWidths = font.cff ? font.cff.widths : null; 23493 let hmtx = "\x00\x00\x00\x00"; 23494 for (let i = 1, ii = numGlyphs; i < ii; i++) { 23495 let width = 0; 23496 if (charstrings) { 23497 const charstring = charstrings[i - 1]; 23498 width = "width" in charstring ? charstring.width : 0; 23499 } else if (cffWidths) { 23500 width = Math.ceil(cffWidths[i] || 0); 23501 } 23502 hmtx += string16(width) + string16(0); 23503 } 23504 return hmtx; 23505 }()); 23506 builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs)); 23507 builder.addTable("name", createNameTable(fontName)); 23508 builder.addTable("post", createPostTable(properties)); 23509 return builder.toArray(); 23510 } 23511 get spaceWidth() { 23512 const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"]; 23513 let width; 23514 for (const glyphName of possibleSpaceReplacements) { 23515 if (glyphName in this.widths) { 23516 width = this.widths[glyphName]; 23517 break; 23518 } 23519 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 23520 const glyphUnicode = glyphsUnicodeMap[glyphName]; 23521 let charcode = 0; 23522 if (this.composite && this.cMap.contains(glyphUnicode)) { 23523 charcode = this.cMap.lookup(glyphUnicode); 23524 if (typeof charcode === "string") { 23525 charcode = convertCidString(glyphUnicode, charcode); 23526 } 23527 } 23528 if (!charcode && this.toUnicode) { 23529 charcode = this.toUnicode.charCodeOf(glyphUnicode); 23530 } 23531 if (charcode <= 0) { 23532 charcode = glyphUnicode; 23533 } 23534 width = this.widths[charcode]; 23535 if (width) { 23536 break; 23537 } 23538 } 23539 return (0, _util.shadow)(this, "spaceWidth", width || this.defaultWidth); 23540 } 23541 _charToGlyph(charcode, isSpace = false) { 23542 let glyph = this._glyphCache[charcode]; 23543 if (glyph?.isSpace === isSpace) { 23544 return glyph; 23545 } 23546 let fontCharCode, width, operatorListId; 23547 let widthCode = charcode; 23548 if (this.cMap?.contains(charcode)) { 23549 widthCode = this.cMap.lookup(charcode); 23550 if (typeof widthCode === "string") { 23551 widthCode = convertCidString(charcode, widthCode); 23552 } 23553 } 23554 width = this.widths[widthCode]; 23555 if (typeof width !== "number") { 23556 width = this.defaultWidth; 23557 } 23558 const vmetric = this.vmetrics?.[widthCode]; 23559 let unicode = this.toUnicode.get(charcode) || charcode; 23560 if (typeof unicode === "number") { 23561 unicode = String.fromCharCode(unicode); 23562 } 23563 let isInFont = this.toFontChar[charcode] !== undefined; 23564 fontCharCode = this.toFontChar[charcode] || charcode; 23565 if (this.missingFile) { 23566 const glyphName = this.differences[charcode] || this.defaultEncoding[charcode]; 23567 if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") { 23568 fontCharCode = 0x20; 23569 } 23570 fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode); 23571 } 23572 if (this.isType3Font) { 23573 operatorListId = fontCharCode; 23574 } 23575 let accent = null; 23576 if (this.seacMap?.[charcode]) { 23577 isInFont = true; 23578 const seac = this.seacMap[charcode]; 23579 fontCharCode = seac.baseFontCharCode; 23580 accent = { 23581 fontChar: String.fromCodePoint(seac.accentFontCharCode), 23582 offset: seac.accentOffset 23583 }; 23584 } 23585 let fontChar = ""; 23586 if (typeof fontCharCode === "number") { 23587 if (fontCharCode <= 0x10ffff) { 23588 fontChar = String.fromCodePoint(fontCharCode); 23589 } else { 23590 (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`); 23591 } 23592 } 23593 glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); 23594 return this._glyphCache[charcode] = glyph; 23595 } 23596 charsToGlyphs(chars) { 23597 let glyphs = this._charsCache[chars]; 23598 if (glyphs) { 23599 return glyphs; 23600 } 23601 glyphs = []; 23602 if (this.cMap) { 23603 const c = Object.create(null), 23604 ii = chars.length; 23605 let i = 0; 23606 while (i < ii) { 23607 this.cMap.readCharCode(chars, i, c); 23608 const { 23609 charcode, 23610 length 23611 } = c; 23612 i += length; 23613 const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20); 23614 glyphs.push(glyph); 23615 } 23616 } else { 23617 for (let i = 0, ii = chars.length; i < ii; ++i) { 23618 const charcode = chars.charCodeAt(i); 23619 const glyph = this._charToGlyph(charcode, charcode === 0x20); 23620 glyphs.push(glyph); 23621 } 23622 } 23623 return this._charsCache[chars] = glyphs; 23624 } 23625 getCharPositions(chars) { 23626 const positions = []; 23627 if (this.cMap) { 23628 const c = Object.create(null); 23629 let i = 0; 23630 while (i < chars.length) { 23631 this.cMap.readCharCode(chars, i, c); 23632 const length = c.length; 23633 positions.push([i, i + length]); 23634 i += length; 23635 } 23636 } else { 23637 for (let i = 0, ii = chars.length; i < ii; ++i) { 23638 positions.push([i, i + 1]); 23639 } 23640 } 23641 return positions; 23642 } 23643 get glyphCacheValues() { 23644 return Object.values(this._glyphCache); 23645 } 23646 encodeString(str) { 23647 const buffers = []; 23648 const currentBuf = []; 23649 const hasCurrentBufErrors = () => buffers.length % 2 === 1; 23650 const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode)); 23651 for (let i = 0, ii = str.length; i < ii; i++) { 23652 const unicode = str.codePointAt(i); 23653 if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) { 23654 i++; 23655 } 23656 if (this.toUnicode) { 23657 const charCode = getCharCode(unicode); 23658 if (charCode !== -1) { 23659 if (hasCurrentBufErrors()) { 23660 buffers.push(currentBuf.join("")); 23661 currentBuf.length = 0; 23662 } 23663 const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1; 23664 for (let j = charCodeLength - 1; j >= 0; j--) { 23665 currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff)); 23666 } 23667 continue; 23668 } 23669 } 23670 if (!hasCurrentBufErrors()) { 23671 buffers.push(currentBuf.join("")); 23672 currentBuf.length = 0; 23673 } 23674 currentBuf.push(String.fromCodePoint(unicode)); 23675 } 23676 buffers.push(currentBuf.join("")); 23677 return buffers; 23678 } 23679} 23680exports.Font = Font; 23681class ErrorFont { 23682 constructor(error) { 23683 this.error = error; 23684 this.loadedName = "g_font_error"; 23685 this.missingFile = true; 23686 } 23687 charsToGlyphs() { 23688 return []; 23689 } 23690 encodeString(chars) { 23691 return [chars]; 23692 } 23693 exportData(extraProperties = false) { 23694 return { 23695 error: this.error 23696 }; 23697 } 23698} 23699exports.ErrorFont = ErrorFont; 23700 23701/***/ }), 23702/* 35 */ 23703/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 23704 23705 23706 23707Object.defineProperty(exports, "__esModule", ({ 23708 value: true 23709})); 23710exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0; 23711var _util = __w_pdfjs_require__(2); 23712var _charsets = __w_pdfjs_require__(36); 23713var _encodings = __w_pdfjs_require__(37); 23714const MAX_SUBR_NESTING = 10; 23715const 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", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "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"]; 23716exports.CFFStandardStrings = CFFStandardStrings; 23717const NUM_STANDARD_CFF_STRINGS = 391; 23718const CharstringValidationData = [null, { 23719 id: "hstem", 23720 min: 2, 23721 stackClearing: true, 23722 stem: true 23723}, null, { 23724 id: "vstem", 23725 min: 2, 23726 stackClearing: true, 23727 stem: true 23728}, { 23729 id: "vmoveto", 23730 min: 1, 23731 stackClearing: true 23732}, { 23733 id: "rlineto", 23734 min: 2, 23735 resetStack: true 23736}, { 23737 id: "hlineto", 23738 min: 1, 23739 resetStack: true 23740}, { 23741 id: "vlineto", 23742 min: 1, 23743 resetStack: true 23744}, { 23745 id: "rrcurveto", 23746 min: 6, 23747 resetStack: true 23748}, null, { 23749 id: "callsubr", 23750 min: 1, 23751 undefStack: true 23752}, { 23753 id: "return", 23754 min: 0, 23755 undefStack: true 23756}, null, null, { 23757 id: "endchar", 23758 min: 0, 23759 stackClearing: true 23760}, null, null, null, { 23761 id: "hstemhm", 23762 min: 2, 23763 stackClearing: true, 23764 stem: true 23765}, { 23766 id: "hintmask", 23767 min: 0, 23768 stackClearing: true 23769}, { 23770 id: "cntrmask", 23771 min: 0, 23772 stackClearing: true 23773}, { 23774 id: "rmoveto", 23775 min: 2, 23776 stackClearing: true 23777}, { 23778 id: "hmoveto", 23779 min: 1, 23780 stackClearing: true 23781}, { 23782 id: "vstemhm", 23783 min: 2, 23784 stackClearing: true, 23785 stem: true 23786}, { 23787 id: "rcurveline", 23788 min: 8, 23789 resetStack: true 23790}, { 23791 id: "rlinecurve", 23792 min: 8, 23793 resetStack: true 23794}, { 23795 id: "vvcurveto", 23796 min: 4, 23797 resetStack: true 23798}, { 23799 id: "hhcurveto", 23800 min: 4, 23801 resetStack: true 23802}, null, { 23803 id: "callgsubr", 23804 min: 1, 23805 undefStack: true 23806}, { 23807 id: "vhcurveto", 23808 min: 4, 23809 resetStack: true 23810}, { 23811 id: "hvcurveto", 23812 min: 4, 23813 resetStack: true 23814}]; 23815const CharstringValidationData12 = [null, null, null, { 23816 id: "and", 23817 min: 2, 23818 stackDelta: -1 23819}, { 23820 id: "or", 23821 min: 2, 23822 stackDelta: -1 23823}, { 23824 id: "not", 23825 min: 1, 23826 stackDelta: 0 23827}, null, null, null, { 23828 id: "abs", 23829 min: 1, 23830 stackDelta: 0 23831}, { 23832 id: "add", 23833 min: 2, 23834 stackDelta: -1, 23835 stackFn(stack, index) { 23836 stack[index - 2] = stack[index - 2] + stack[index - 1]; 23837 } 23838}, { 23839 id: "sub", 23840 min: 2, 23841 stackDelta: -1, 23842 stackFn(stack, index) { 23843 stack[index - 2] = stack[index - 2] - stack[index - 1]; 23844 } 23845}, { 23846 id: "div", 23847 min: 2, 23848 stackDelta: -1, 23849 stackFn(stack, index) { 23850 stack[index - 2] = stack[index - 2] / stack[index - 1]; 23851 } 23852}, null, { 23853 id: "neg", 23854 min: 1, 23855 stackDelta: 0, 23856 stackFn(stack, index) { 23857 stack[index - 1] = -stack[index - 1]; 23858 } 23859}, { 23860 id: "eq", 23861 min: 2, 23862 stackDelta: -1 23863}, null, null, { 23864 id: "drop", 23865 min: 1, 23866 stackDelta: -1 23867}, null, { 23868 id: "put", 23869 min: 2, 23870 stackDelta: -2 23871}, { 23872 id: "get", 23873 min: 1, 23874 stackDelta: 0 23875}, { 23876 id: "ifelse", 23877 min: 4, 23878 stackDelta: -3 23879}, { 23880 id: "random", 23881 min: 0, 23882 stackDelta: 1 23883}, { 23884 id: "mul", 23885 min: 2, 23886 stackDelta: -1, 23887 stackFn(stack, index) { 23888 stack[index - 2] = stack[index - 2] * stack[index - 1]; 23889 } 23890}, null, { 23891 id: "sqrt", 23892 min: 1, 23893 stackDelta: 0 23894}, { 23895 id: "dup", 23896 min: 1, 23897 stackDelta: 1 23898}, { 23899 id: "exch", 23900 min: 2, 23901 stackDelta: 0 23902}, { 23903 id: "index", 23904 min: 2, 23905 stackDelta: 0 23906}, { 23907 id: "roll", 23908 min: 3, 23909 stackDelta: -2 23910}, null, null, null, { 23911 id: "hflex", 23912 min: 7, 23913 resetStack: true 23914}, { 23915 id: "flex", 23916 min: 13, 23917 resetStack: true 23918}, { 23919 id: "hflex1", 23920 min: 9, 23921 resetStack: true 23922}, { 23923 id: "flex1", 23924 min: 11, 23925 resetStack: true 23926}]; 23927class CFFParser { 23928 constructor(file, properties, seacAnalysisEnabled) { 23929 this.bytes = file.getBytes(); 23930 this.properties = properties; 23931 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 23932 } 23933 parse() { 23934 const properties = this.properties; 23935 const cff = new CFF(); 23936 this.cff = cff; 23937 const header = this.parseHeader(); 23938 const nameIndex = this.parseIndex(header.endPos); 23939 const topDictIndex = this.parseIndex(nameIndex.endPos); 23940 const stringIndex = this.parseIndex(topDictIndex.endPos); 23941 const globalSubrIndex = this.parseIndex(stringIndex.endPos); 23942 const topDictParsed = this.parseDict(topDictIndex.obj.get(0)); 23943 const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings); 23944 cff.header = header.obj; 23945 cff.names = this.parseNameIndex(nameIndex.obj); 23946 cff.strings = this.parseStringIndex(stringIndex.obj); 23947 cff.topDict = topDict; 23948 cff.globalSubrIndex = globalSubrIndex.obj; 23949 this.parsePrivateDict(cff.topDict); 23950 cff.isCIDFont = topDict.hasName("ROS"); 23951 const charStringOffset = topDict.getByName("CharStrings"); 23952 const charStringIndex = this.parseIndex(charStringOffset).obj; 23953 const fontMatrix = topDict.getByName("FontMatrix"); 23954 if (fontMatrix) { 23955 properties.fontMatrix = fontMatrix; 23956 } 23957 const fontBBox = topDict.getByName("FontBBox"); 23958 if (fontBBox) { 23959 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 23960 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 23961 properties.ascentScaled = true; 23962 } 23963 let charset, encoding; 23964 if (cff.isCIDFont) { 23965 const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj; 23966 for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) { 23967 const dictRaw = fdArrayIndex.get(i); 23968 const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings); 23969 this.parsePrivateDict(fontDict); 23970 cff.fdArray.push(fontDict); 23971 } 23972 encoding = null; 23973 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true); 23974 cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count); 23975 } else { 23976 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false); 23977 encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset); 23978 } 23979 cff.charset = charset; 23980 cff.encoding = encoding; 23981 const charStringsAndSeacs = this.parseCharStrings({ 23982 charStrings: charStringIndex, 23983 localSubrIndex: topDict.privateDict.subrsIndex, 23984 globalSubrIndex: globalSubrIndex.obj, 23985 fdSelect: cff.fdSelect, 23986 fdArray: cff.fdArray, 23987 privateDict: topDict.privateDict 23988 }); 23989 cff.charStrings = charStringsAndSeacs.charStrings; 23990 cff.seacs = charStringsAndSeacs.seacs; 23991 cff.widths = charStringsAndSeacs.widths; 23992 return cff; 23993 } 23994 parseHeader() { 23995 let bytes = this.bytes; 23996 const bytesLength = bytes.length; 23997 let offset = 0; 23998 while (offset < bytesLength && bytes[offset] !== 1) { 23999 ++offset; 24000 } 24001 if (offset >= bytesLength) { 24002 throw new _util.FormatError("Invalid CFF header"); 24003 } 24004 if (offset !== 0) { 24005 (0, _util.info)("cff data is shifted"); 24006 bytes = bytes.subarray(offset); 24007 this.bytes = bytes; 24008 } 24009 const major = bytes[0]; 24010 const minor = bytes[1]; 24011 const hdrSize = bytes[2]; 24012 const offSize = bytes[3]; 24013 const header = new CFFHeader(major, minor, hdrSize, offSize); 24014 return { 24015 obj: header, 24016 endPos: hdrSize 24017 }; 24018 } 24019 parseDict(dict) { 24020 let pos = 0; 24021 function parseOperand() { 24022 let value = dict[pos++]; 24023 if (value === 30) { 24024 return parseFloatOperand(); 24025 } else if (value === 28) { 24026 value = dict[pos++]; 24027 value = (value << 24 | dict[pos++] << 16) >> 16; 24028 return value; 24029 } else if (value === 29) { 24030 value = dict[pos++]; 24031 value = value << 8 | dict[pos++]; 24032 value = value << 8 | dict[pos++]; 24033 value = value << 8 | dict[pos++]; 24034 return value; 24035 } else if (value >= 32 && value <= 246) { 24036 return value - 139; 24037 } else if (value >= 247 && value <= 250) { 24038 return (value - 247) * 256 + dict[pos++] + 108; 24039 } else if (value >= 251 && value <= 254) { 24040 return -((value - 251) * 256) - dict[pos++] - 108; 24041 } 24042 (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.'); 24043 return NaN; 24044 } 24045 function parseFloatOperand() { 24046 let str = ""; 24047 const eof = 15; 24048 const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"]; 24049 const length = dict.length; 24050 while (pos < length) { 24051 const b = dict[pos++]; 24052 const b1 = b >> 4; 24053 const b2 = b & 15; 24054 if (b1 === eof) { 24055 break; 24056 } 24057 str += lookup[b1]; 24058 if (b2 === eof) { 24059 break; 24060 } 24061 str += lookup[b2]; 24062 } 24063 return parseFloat(str); 24064 } 24065 let operands = []; 24066 const entries = []; 24067 pos = 0; 24068 const end = dict.length; 24069 while (pos < end) { 24070 let b = dict[pos]; 24071 if (b <= 21) { 24072 if (b === 12) { 24073 b = b << 8 | dict[++pos]; 24074 } 24075 entries.push([b, operands]); 24076 operands = []; 24077 ++pos; 24078 } else { 24079 operands.push(parseOperand()); 24080 } 24081 } 24082 return entries; 24083 } 24084 parseIndex(pos) { 24085 const cffIndex = new CFFIndex(); 24086 const bytes = this.bytes; 24087 const count = bytes[pos++] << 8 | bytes[pos++]; 24088 const offsets = []; 24089 let end = pos; 24090 let i, ii; 24091 if (count !== 0) { 24092 const offsetSize = bytes[pos++]; 24093 const startPos = pos + (count + 1) * offsetSize - 1; 24094 for (i = 0, ii = count + 1; i < ii; ++i) { 24095 let offset = 0; 24096 for (let j = 0; j < offsetSize; ++j) { 24097 offset <<= 8; 24098 offset += bytes[pos++]; 24099 } 24100 offsets.push(startPos + offset); 24101 } 24102 end = offsets[count]; 24103 } 24104 for (i = 0, ii = offsets.length - 1; i < ii; ++i) { 24105 const offsetStart = offsets[i]; 24106 const offsetEnd = offsets[i + 1]; 24107 cffIndex.add(bytes.subarray(offsetStart, offsetEnd)); 24108 } 24109 return { 24110 obj: cffIndex, 24111 endPos: end 24112 }; 24113 } 24114 parseNameIndex(index) { 24115 const names = []; 24116 for (let i = 0, ii = index.count; i < ii; ++i) { 24117 const name = index.get(i); 24118 names.push((0, _util.bytesToString)(name)); 24119 } 24120 return names; 24121 } 24122 parseStringIndex(index) { 24123 const strings = new CFFStrings(); 24124 for (let i = 0, ii = index.count; i < ii; ++i) { 24125 const data = index.get(i); 24126 strings.add((0, _util.bytesToString)(data)); 24127 } 24128 return strings; 24129 } 24130 createDict(Type, dict, strings) { 24131 const cffDict = new Type(strings); 24132 for (const [key, value] of dict) { 24133 cffDict.setByKey(key, value); 24134 } 24135 return cffDict; 24136 } 24137 parseCharString(state, data, localSubrIndex, globalSubrIndex) { 24138 if (!data || state.callDepth > MAX_SUBR_NESTING) { 24139 return false; 24140 } 24141 let stackSize = state.stackSize; 24142 const stack = state.stack; 24143 let length = data.length; 24144 for (let j = 0; j < length;) { 24145 const value = data[j++]; 24146 let validationCommand = null; 24147 if (value === 12) { 24148 const q = data[j++]; 24149 if (q === 0) { 24150 data[j - 2] = 139; 24151 data[j - 1] = 22; 24152 stackSize = 0; 24153 } else { 24154 validationCommand = CharstringValidationData12[q]; 24155 } 24156 } else if (value === 28) { 24157 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16; 24158 j += 2; 24159 stackSize++; 24160 } else if (value === 14) { 24161 if (stackSize >= 4) { 24162 stackSize -= 4; 24163 if (this.seacAnalysisEnabled) { 24164 state.seac = stack.slice(stackSize, stackSize + 4); 24165 return false; 24166 } 24167 } 24168 validationCommand = CharstringValidationData[value]; 24169 } else if (value >= 32 && value <= 246) { 24170 stack[stackSize] = value - 139; 24171 stackSize++; 24172 } else if (value >= 247 && value <= 254) { 24173 stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108; 24174 j++; 24175 stackSize++; 24176 } else if (value === 255) { 24177 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536; 24178 j += 4; 24179 stackSize++; 24180 } else if (value === 19 || value === 20) { 24181 state.hints += stackSize >> 1; 24182 if (state.hints === 0) { 24183 data.copyWithin(j - 1, j, -1); 24184 j -= 1; 24185 length -= 1; 24186 continue; 24187 } 24188 j += state.hints + 7 >> 3; 24189 stackSize %= 2; 24190 validationCommand = CharstringValidationData[value]; 24191 } else if (value === 10 || value === 29) { 24192 const subrsIndex = value === 10 ? localSubrIndex : globalSubrIndex; 24193 if (!subrsIndex) { 24194 validationCommand = CharstringValidationData[value]; 24195 (0, _util.warn)("Missing subrsIndex for " + validationCommand.id); 24196 return false; 24197 } 24198 let bias = 32768; 24199 if (subrsIndex.count < 1240) { 24200 bias = 107; 24201 } else if (subrsIndex.count < 33900) { 24202 bias = 1131; 24203 } 24204 const subrNumber = stack[--stackSize] + bias; 24205 if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) { 24206 validationCommand = CharstringValidationData[value]; 24207 (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id); 24208 return false; 24209 } 24210 state.stackSize = stackSize; 24211 state.callDepth++; 24212 const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex); 24213 if (!valid) { 24214 return false; 24215 } 24216 state.callDepth--; 24217 stackSize = state.stackSize; 24218 continue; 24219 } else if (value === 11) { 24220 state.stackSize = stackSize; 24221 return true; 24222 } else if (value === 0 && j === data.length) { 24223 data[j - 1] = 14; 24224 validationCommand = CharstringValidationData[14]; 24225 } else if (value === 9) { 24226 data.copyWithin(j - 1, j, -1); 24227 j -= 1; 24228 length -= 1; 24229 continue; 24230 } else { 24231 validationCommand = CharstringValidationData[value]; 24232 } 24233 if (validationCommand) { 24234 if (validationCommand.stem) { 24235 state.hints += stackSize >> 1; 24236 if (value === 3 || value === 23) { 24237 state.hasVStems = true; 24238 } else if (state.hasVStems && (value === 1 || value === 18)) { 24239 (0, _util.warn)("CFF stem hints are in wrong order"); 24240 data[j - 1] = value === 1 ? 3 : 23; 24241 } 24242 } 24243 if ("min" in validationCommand) { 24244 if (!state.undefStack && stackSize < validationCommand.min) { 24245 (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min); 24246 if (stackSize === 0) { 24247 data[j - 1] = 14; 24248 return true; 24249 } 24250 return false; 24251 } 24252 } 24253 if (state.firstStackClearing && validationCommand.stackClearing) { 24254 state.firstStackClearing = false; 24255 stackSize -= validationCommand.min; 24256 if (stackSize >= 2 && validationCommand.stem) { 24257 stackSize %= 2; 24258 } else if (stackSize > 1) { 24259 (0, _util.warn)("Found too many parameters for stack-clearing command"); 24260 } 24261 if (stackSize > 0) { 24262 state.width = stack[stackSize - 1]; 24263 } 24264 } 24265 if ("stackDelta" in validationCommand) { 24266 if ("stackFn" in validationCommand) { 24267 validationCommand.stackFn(stack, stackSize); 24268 } 24269 stackSize += validationCommand.stackDelta; 24270 } else if (validationCommand.stackClearing) { 24271 stackSize = 0; 24272 } else if (validationCommand.resetStack) { 24273 stackSize = 0; 24274 state.undefStack = false; 24275 } else if (validationCommand.undefStack) { 24276 stackSize = 0; 24277 state.undefStack = true; 24278 state.firstStackClearing = false; 24279 } 24280 } 24281 } 24282 if (length < data.length) { 24283 data.fill(14, length); 24284 } 24285 state.stackSize = stackSize; 24286 return true; 24287 } 24288 parseCharStrings({ 24289 charStrings, 24290 localSubrIndex, 24291 globalSubrIndex, 24292 fdSelect, 24293 fdArray, 24294 privateDict 24295 }) { 24296 const seacs = []; 24297 const widths = []; 24298 const count = charStrings.count; 24299 for (let i = 0; i < count; i++) { 24300 const charstring = charStrings.get(i); 24301 const state = { 24302 callDepth: 0, 24303 stackSize: 0, 24304 stack: [], 24305 undefStack: true, 24306 hints: 0, 24307 firstStackClearing: true, 24308 seac: null, 24309 width: null, 24310 hasVStems: false 24311 }; 24312 let valid = true; 24313 let localSubrToUse = null; 24314 let privateDictToUse = privateDict; 24315 if (fdSelect && fdArray.length) { 24316 const fdIndex = fdSelect.getFDIndex(i); 24317 if (fdIndex === -1) { 24318 (0, _util.warn)("Glyph index is not in fd select."); 24319 valid = false; 24320 } 24321 if (fdIndex >= fdArray.length) { 24322 (0, _util.warn)("Invalid fd index for glyph index."); 24323 valid = false; 24324 } 24325 if (valid) { 24326 privateDictToUse = fdArray[fdIndex].privateDict; 24327 localSubrToUse = privateDictToUse.subrsIndex; 24328 } 24329 } else if (localSubrIndex) { 24330 localSubrToUse = localSubrIndex; 24331 } 24332 if (valid) { 24333 valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex); 24334 } 24335 if (state.width !== null) { 24336 const nominalWidth = privateDictToUse.getByName("nominalWidthX"); 24337 widths[i] = nominalWidth + state.width; 24338 } else { 24339 const defaultWidth = privateDictToUse.getByName("defaultWidthX"); 24340 widths[i] = defaultWidth; 24341 } 24342 if (state.seac !== null) { 24343 seacs[i] = state.seac; 24344 } 24345 if (!valid) { 24346 charStrings.set(i, new Uint8Array([14])); 24347 } 24348 } 24349 return { 24350 charStrings, 24351 seacs, 24352 widths 24353 }; 24354 } 24355 emptyPrivateDictionary(parentDict) { 24356 const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings); 24357 parentDict.setByKey(18, [0, 0]); 24358 parentDict.privateDict = privateDict; 24359 } 24360 parsePrivateDict(parentDict) { 24361 if (!parentDict.hasName("Private")) { 24362 this.emptyPrivateDictionary(parentDict); 24363 return; 24364 } 24365 const privateOffset = parentDict.getByName("Private"); 24366 if (!Array.isArray(privateOffset) || privateOffset.length !== 2) { 24367 parentDict.removeByName("Private"); 24368 return; 24369 } 24370 const size = privateOffset[0]; 24371 const offset = privateOffset[1]; 24372 if (size === 0 || offset >= this.bytes.length) { 24373 this.emptyPrivateDictionary(parentDict); 24374 return; 24375 } 24376 const privateDictEnd = offset + size; 24377 const dictData = this.bytes.subarray(offset, privateDictEnd); 24378 const dict = this.parseDict(dictData); 24379 const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings); 24380 parentDict.privateDict = privateDict; 24381 if (privateDict.getByName("ExpansionFactor") === 0) { 24382 privateDict.setByName("ExpansionFactor", 0.06); 24383 } 24384 if (!privateDict.getByName("Subrs")) { 24385 return; 24386 } 24387 const subrsOffset = privateDict.getByName("Subrs"); 24388 const relativeOffset = offset + subrsOffset; 24389 if (subrsOffset === 0 || relativeOffset >= this.bytes.length) { 24390 this.emptyPrivateDictionary(parentDict); 24391 return; 24392 } 24393 const subrsIndex = this.parseIndex(relativeOffset); 24394 privateDict.subrsIndex = subrsIndex.obj; 24395 } 24396 parseCharsets(pos, length, strings, cid) { 24397 if (pos === 0) { 24398 return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset); 24399 } else if (pos === 1) { 24400 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset); 24401 } else if (pos === 2) { 24402 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset); 24403 } 24404 const bytes = this.bytes; 24405 const start = pos; 24406 const format = bytes[pos++]; 24407 const charset = [cid ? 0 : ".notdef"]; 24408 let id, count, i; 24409 length -= 1; 24410 switch (format) { 24411 case 0: 24412 for (i = 0; i < length; i++) { 24413 id = bytes[pos++] << 8 | bytes[pos++]; 24414 charset.push(cid ? id : strings.get(id)); 24415 } 24416 break; 24417 case 1: 24418 while (charset.length <= length) { 24419 id = bytes[pos++] << 8 | bytes[pos++]; 24420 count = bytes[pos++]; 24421 for (i = 0; i <= count; i++) { 24422 charset.push(cid ? id++ : strings.get(id++)); 24423 } 24424 } 24425 break; 24426 case 2: 24427 while (charset.length <= length) { 24428 id = bytes[pos++] << 8 | bytes[pos++]; 24429 count = bytes[pos++] << 8 | bytes[pos++]; 24430 for (i = 0; i <= count; i++) { 24431 charset.push(cid ? id++ : strings.get(id++)); 24432 } 24433 } 24434 break; 24435 default: 24436 throw new _util.FormatError("Unknown charset format"); 24437 } 24438 const end = pos; 24439 const raw = bytes.subarray(start, end); 24440 return new CFFCharset(false, format, charset, raw); 24441 } 24442 parseEncoding(pos, properties, strings, charset) { 24443 const encoding = Object.create(null); 24444 const bytes = this.bytes; 24445 let predefined = false; 24446 let format, i, ii; 24447 let raw = null; 24448 function readSupplement() { 24449 const supplementsCount = bytes[pos++]; 24450 for (i = 0; i < supplementsCount; i++) { 24451 const code = bytes[pos++]; 24452 const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff); 24453 encoding[code] = charset.indexOf(strings.get(sid)); 24454 } 24455 } 24456 if (pos === 0 || pos === 1) { 24457 predefined = true; 24458 format = pos; 24459 const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding; 24460 for (i = 0, ii = charset.length; i < ii; i++) { 24461 const index = baseEncoding.indexOf(charset[i]); 24462 if (index !== -1) { 24463 encoding[index] = i; 24464 } 24465 } 24466 } else { 24467 const dataStart = pos; 24468 format = bytes[pos++]; 24469 switch (format & 0x7f) { 24470 case 0: 24471 const glyphsCount = bytes[pos++]; 24472 for (i = 1; i <= glyphsCount; i++) { 24473 encoding[bytes[pos++]] = i; 24474 } 24475 break; 24476 case 1: 24477 const rangesCount = bytes[pos++]; 24478 let gid = 1; 24479 for (i = 0; i < rangesCount; i++) { 24480 const start = bytes[pos++]; 24481 const left = bytes[pos++]; 24482 for (let j = start; j <= start + left; j++) { 24483 encoding[j] = gid++; 24484 } 24485 } 24486 break; 24487 default: 24488 throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`); 24489 } 24490 const dataEnd = pos; 24491 if (format & 0x80) { 24492 bytes[dataStart] &= 0x7f; 24493 readSupplement(); 24494 } 24495 raw = bytes.subarray(dataStart, dataEnd); 24496 } 24497 format &= 0x7f; 24498 return new CFFEncoding(predefined, format, encoding, raw); 24499 } 24500 parseFDSelect(pos, length) { 24501 const bytes = this.bytes; 24502 const format = bytes[pos++]; 24503 const fdSelect = []; 24504 let i; 24505 switch (format) { 24506 case 0: 24507 for (i = 0; i < length; ++i) { 24508 const id = bytes[pos++]; 24509 fdSelect.push(id); 24510 } 24511 break; 24512 case 3: 24513 const rangesCount = bytes[pos++] << 8 | bytes[pos++]; 24514 for (i = 0; i < rangesCount; ++i) { 24515 let first = bytes[pos++] << 8 | bytes[pos++]; 24516 if (i === 0 && first !== 0) { 24517 (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover."); 24518 first = 0; 24519 } 24520 const fdIndex = bytes[pos++]; 24521 const next = bytes[pos] << 8 | bytes[pos + 1]; 24522 for (let j = first; j < next; ++j) { 24523 fdSelect.push(fdIndex); 24524 } 24525 } 24526 pos += 2; 24527 break; 24528 default: 24529 throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`); 24530 } 24531 if (fdSelect.length !== length) { 24532 throw new _util.FormatError("parseFDSelect: Invalid font data."); 24533 } 24534 return new CFFFDSelect(format, fdSelect); 24535 } 24536} 24537exports.CFFParser = CFFParser; 24538class CFF { 24539 constructor() { 24540 this.header = null; 24541 this.names = []; 24542 this.topDict = null; 24543 this.strings = new CFFStrings(); 24544 this.globalSubrIndex = null; 24545 this.encoding = null; 24546 this.charset = null; 24547 this.charStrings = null; 24548 this.fdArray = []; 24549 this.fdSelect = null; 24550 this.isCIDFont = false; 24551 } 24552 duplicateFirstGlyph() { 24553 if (this.charStrings.count >= 65535) { 24554 (0, _util.warn)("Not enough space in charstrings to duplicate first glyph."); 24555 return; 24556 } 24557 const glyphZero = this.charStrings.get(0); 24558 this.charStrings.add(glyphZero); 24559 if (this.isCIDFont) { 24560 this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]); 24561 } 24562 } 24563 hasGlyphId(id) { 24564 if (id < 0 || id >= this.charStrings.count) { 24565 return false; 24566 } 24567 const glyph = this.charStrings.get(id); 24568 return glyph.length > 0; 24569 } 24570} 24571exports.CFF = CFF; 24572class CFFHeader { 24573 constructor(major, minor, hdrSize, offSize) { 24574 this.major = major; 24575 this.minor = minor; 24576 this.hdrSize = hdrSize; 24577 this.offSize = offSize; 24578 } 24579} 24580exports.CFFHeader = CFFHeader; 24581class CFFStrings { 24582 constructor() { 24583 this.strings = []; 24584 } 24585 get(index) { 24586 if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) { 24587 return CFFStandardStrings[index]; 24588 } 24589 if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) { 24590 return this.strings[index - NUM_STANDARD_CFF_STRINGS]; 24591 } 24592 return CFFStandardStrings[0]; 24593 } 24594 getSID(str) { 24595 let index = CFFStandardStrings.indexOf(str); 24596 if (index !== -1) { 24597 return index; 24598 } 24599 index = this.strings.indexOf(str); 24600 if (index !== -1) { 24601 return index + NUM_STANDARD_CFF_STRINGS; 24602 } 24603 return -1; 24604 } 24605 add(value) { 24606 this.strings.push(value); 24607 } 24608 get count() { 24609 return this.strings.length; 24610 } 24611} 24612exports.CFFStrings = CFFStrings; 24613class CFFIndex { 24614 constructor() { 24615 this.objects = []; 24616 this.length = 0; 24617 } 24618 add(data) { 24619 this.length += data.length; 24620 this.objects.push(data); 24621 } 24622 set(index, data) { 24623 this.length += data.length - this.objects[index].length; 24624 this.objects[index] = data; 24625 } 24626 get(index) { 24627 return this.objects[index]; 24628 } 24629 get count() { 24630 return this.objects.length; 24631 } 24632} 24633exports.CFFIndex = CFFIndex; 24634class CFFDict { 24635 constructor(tables, strings) { 24636 this.keyToNameMap = tables.keyToNameMap; 24637 this.nameToKeyMap = tables.nameToKeyMap; 24638 this.defaults = tables.defaults; 24639 this.types = tables.types; 24640 this.opcodes = tables.opcodes; 24641 this.order = tables.order; 24642 this.strings = strings; 24643 this.values = Object.create(null); 24644 } 24645 setByKey(key, value) { 24646 if (!(key in this.keyToNameMap)) { 24647 return false; 24648 } 24649 if (value.length === 0) { 24650 return true; 24651 } 24652 for (const val of value) { 24653 if (isNaN(val)) { 24654 (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`); 24655 return true; 24656 } 24657 } 24658 const type = this.types[key]; 24659 if (type === "num" || type === "sid" || type === "offset") { 24660 value = value[0]; 24661 } 24662 this.values[key] = value; 24663 return true; 24664 } 24665 setByName(name, value) { 24666 if (!(name in this.nameToKeyMap)) { 24667 throw new _util.FormatError(`Invalid dictionary name "${name}"`); 24668 } 24669 this.values[this.nameToKeyMap[name]] = value; 24670 } 24671 hasName(name) { 24672 return this.nameToKeyMap[name] in this.values; 24673 } 24674 getByName(name) { 24675 if (!(name in this.nameToKeyMap)) { 24676 throw new _util.FormatError(`Invalid dictionary name ${name}"`); 24677 } 24678 const key = this.nameToKeyMap[name]; 24679 if (!(key in this.values)) { 24680 return this.defaults[key]; 24681 } 24682 return this.values[key]; 24683 } 24684 removeByName(name) { 24685 delete this.values[this.nameToKeyMap[name]]; 24686 } 24687 static createTables(layout) { 24688 const tables = { 24689 keyToNameMap: {}, 24690 nameToKeyMap: {}, 24691 defaults: {}, 24692 types: {}, 24693 opcodes: {}, 24694 order: [] 24695 }; 24696 for (const entry of layout) { 24697 const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; 24698 tables.keyToNameMap[key] = entry[1]; 24699 tables.nameToKeyMap[entry[1]] = key; 24700 tables.types[key] = entry[2]; 24701 tables.defaults[key] = entry[3]; 24702 tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]]; 24703 tables.order.push(key); 24704 } 24705 return tables; 24706 } 24707} 24708const CFFTopDictLayout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]]; 24709class CFFTopDict extends CFFDict { 24710 static get tables() { 24711 return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout)); 24712 } 24713 constructor(strings) { 24714 super(CFFTopDict.tables, strings); 24715 this.privateDict = null; 24716 } 24717} 24718exports.CFFTopDict = CFFTopDict; 24719const CFFPrivateDictLayout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]]; 24720class CFFPrivateDict extends CFFDict { 24721 static get tables() { 24722 return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout)); 24723 } 24724 constructor(strings) { 24725 super(CFFPrivateDict.tables, strings); 24726 this.subrsIndex = null; 24727 } 24728} 24729exports.CFFPrivateDict = CFFPrivateDict; 24730const CFFCharsetPredefinedTypes = { 24731 ISO_ADOBE: 0, 24732 EXPERT: 1, 24733 EXPERT_SUBSET: 2 24734}; 24735class CFFCharset { 24736 constructor(predefined, format, charset, raw) { 24737 this.predefined = predefined; 24738 this.format = format; 24739 this.charset = charset; 24740 this.raw = raw; 24741 } 24742} 24743exports.CFFCharset = CFFCharset; 24744class CFFEncoding { 24745 constructor(predefined, format, encoding, raw) { 24746 this.predefined = predefined; 24747 this.format = format; 24748 this.encoding = encoding; 24749 this.raw = raw; 24750 } 24751} 24752class CFFFDSelect { 24753 constructor(format, fdSelect) { 24754 this.format = format; 24755 this.fdSelect = fdSelect; 24756 } 24757 getFDIndex(glyphIndex) { 24758 if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) { 24759 return -1; 24760 } 24761 return this.fdSelect[glyphIndex]; 24762 } 24763} 24764exports.CFFFDSelect = CFFFDSelect; 24765class CFFOffsetTracker { 24766 constructor() { 24767 this.offsets = Object.create(null); 24768 } 24769 isTracking(key) { 24770 return key in this.offsets; 24771 } 24772 track(key, location) { 24773 if (key in this.offsets) { 24774 throw new _util.FormatError(`Already tracking location of ${key}`); 24775 } 24776 this.offsets[key] = location; 24777 } 24778 offset(value) { 24779 for (const key in this.offsets) { 24780 this.offsets[key] += value; 24781 } 24782 } 24783 setEntryLocation(key, values, output) { 24784 if (!(key in this.offsets)) { 24785 throw new _util.FormatError(`Not tracking location of ${key}`); 24786 } 24787 const data = output.data; 24788 const dataOffset = this.offsets[key]; 24789 const size = 5; 24790 for (let i = 0, ii = values.length; i < ii; ++i) { 24791 const offset0 = i * size + dataOffset; 24792 const offset1 = offset0 + 1; 24793 const offset2 = offset0 + 2; 24794 const offset3 = offset0 + 3; 24795 const offset4 = offset0 + 4; 24796 if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) { 24797 throw new _util.FormatError("writing to an offset that is not empty"); 24798 } 24799 const value = values[i]; 24800 data[offset0] = 0x1d; 24801 data[offset1] = value >> 24 & 0xff; 24802 data[offset2] = value >> 16 & 0xff; 24803 data[offset3] = value >> 8 & 0xff; 24804 data[offset4] = value & 0xff; 24805 } 24806 } 24807} 24808class CFFCompiler { 24809 constructor(cff) { 24810 this.cff = cff; 24811 } 24812 compile() { 24813 const cff = this.cff; 24814 const output = { 24815 data: [], 24816 length: 0, 24817 add(data) { 24818 try { 24819 this.data.push(...data); 24820 } catch { 24821 this.data = this.data.concat(data); 24822 } 24823 this.length = this.data.length; 24824 } 24825 }; 24826 const header = this.compileHeader(cff.header); 24827 output.add(header); 24828 const nameIndex = this.compileNameIndex(cff.names); 24829 output.add(nameIndex); 24830 if (cff.isCIDFont) { 24831 if (cff.topDict.hasName("FontMatrix")) { 24832 const base = cff.topDict.getByName("FontMatrix"); 24833 cff.topDict.removeByName("FontMatrix"); 24834 for (const subDict of cff.fdArray) { 24835 let matrix = base.slice(0); 24836 if (subDict.hasName("FontMatrix")) { 24837 matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix")); 24838 } 24839 subDict.setByName("FontMatrix", matrix); 24840 } 24841 } 24842 } 24843 const xuid = cff.topDict.getByName("XUID"); 24844 if (xuid?.length > 16) { 24845 cff.topDict.removeByName("XUID"); 24846 } 24847 cff.topDict.setByName("charset", 0); 24848 let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont); 24849 output.add(compiled.output); 24850 const topDictTracker = compiled.trackers[0]; 24851 const stringIndex = this.compileStringIndex(cff.strings.strings); 24852 output.add(stringIndex); 24853 const globalSubrIndex = this.compileIndex(cff.globalSubrIndex); 24854 output.add(globalSubrIndex); 24855 if (cff.encoding && cff.topDict.hasName("Encoding")) { 24856 if (cff.encoding.predefined) { 24857 topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output); 24858 } else { 24859 const encoding = this.compileEncoding(cff.encoding); 24860 topDictTracker.setEntryLocation("Encoding", [output.length], output); 24861 output.add(encoding); 24862 } 24863 } 24864 const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont); 24865 topDictTracker.setEntryLocation("charset", [output.length], output); 24866 output.add(charset); 24867 const charStrings = this.compileCharStrings(cff.charStrings); 24868 topDictTracker.setEntryLocation("CharStrings", [output.length], output); 24869 output.add(charStrings); 24870 if (cff.isCIDFont) { 24871 topDictTracker.setEntryLocation("FDSelect", [output.length], output); 24872 const fdSelect = this.compileFDSelect(cff.fdSelect); 24873 output.add(fdSelect); 24874 compiled = this.compileTopDicts(cff.fdArray, output.length, true); 24875 topDictTracker.setEntryLocation("FDArray", [output.length], output); 24876 output.add(compiled.output); 24877 const fontDictTrackers = compiled.trackers; 24878 this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output); 24879 } 24880 this.compilePrivateDicts([cff.topDict], [topDictTracker], output); 24881 output.add([0]); 24882 return output.data; 24883 } 24884 encodeNumber(value) { 24885 if (Number.isInteger(value)) { 24886 return this.encodeInteger(value); 24887 } 24888 return this.encodeFloat(value); 24889 } 24890 static get EncodeFloatRegExp() { 24891 return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/); 24892 } 24893 encodeFloat(num) { 24894 let value = num.toString(); 24895 const m = CFFCompiler.EncodeFloatRegExp.exec(value); 24896 if (m) { 24897 const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length)); 24898 value = (Math.round(num * epsilon) / epsilon).toString(); 24899 } 24900 let nibbles = ""; 24901 let i, ii; 24902 for (i = 0, ii = value.length; i < ii; ++i) { 24903 const a = value[i]; 24904 if (a === "e") { 24905 nibbles += value[++i] === "-" ? "c" : "b"; 24906 } else if (a === ".") { 24907 nibbles += "a"; 24908 } else if (a === "-") { 24909 nibbles += "e"; 24910 } else { 24911 nibbles += a; 24912 } 24913 } 24914 nibbles += nibbles.length & 1 ? "f" : "ff"; 24915 const out = [30]; 24916 for (i = 0, ii = nibbles.length; i < ii; i += 2) { 24917 out.push(parseInt(nibbles.substring(i, i + 2), 16)); 24918 } 24919 return out; 24920 } 24921 encodeInteger(value) {
vendor: 4,750 bytes, lines 24922-25056
24922 let code; 24923 if (value >= -107 && value <= 107) { 24924 code = [value + 139]; 24925 } else if (value >= 108 && value <= 1131) { 24926 value -= 108; 24927 code = [(value >> 8) + 247, value & 0xff]; 24928 } else if (value >= -1131 && value <= -108) { 24929 value = -value - 108; 24930 code = [(value >> 8) + 251, value & 0xff]; 24931 } else if (value >= -32768 && value <= 32767) { 24932 code = [0x1c, value >> 8 & 0xff, value & 0xff]; 24933 } else { 24934 code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff]; 24935 } 24936 return code; 24937 } 24938 compileHeader(header) { 24939 return [header.major, header.minor, 4, header.offSize]; 24940 } 24941 compileNameIndex(names) { 24942 const nameIndex = new CFFIndex(); 24943 for (const name of names) { 24944 const length = Math.min(name.length, 127); 24945 let sanitizedName = new Array(length); 24946 for (let j = 0; j < length; j++) { 24947 let char = name[j]; 24948 if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") { 24949 char = "_"; 24950 } 24951 sanitizedName[j] = char; 24952 } 24953 sanitizedName = sanitizedName.join(""); 24954 if (sanitizedName === "") { 24955 sanitizedName = "Bad_Font_Name"; 24956 } 24957 nameIndex.add((0, _util.stringToBytes)(sanitizedName)); 24958 } 24959 return this.compileIndex(nameIndex); 24960 } 24961 compileTopDicts(dicts, length, removeCidKeys) { 24962 const fontDictTrackers = []; 24963 let fdArrayIndex = new CFFIndex(); 24964 for (const fontDict of dicts) { 24965 if (removeCidKeys) { 24966 fontDict.removeByName("CIDFontVersion"); 24967 fontDict.removeByName("CIDFontRevision"); 24968 fontDict.removeByName("CIDFontType"); 24969 fontDict.removeByName("CIDCount"); 24970 fontDict.removeByName("UIDBase"); 24971 } 24972 const fontDictTracker = new CFFOffsetTracker(); 24973 const fontDictData = this.compileDict(fontDict, fontDictTracker); 24974 fontDictTrackers.push(fontDictTracker); 24975 fdArrayIndex.add(fontDictData); 24976 fontDictTracker.offset(length); 24977 } 24978 fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers); 24979 return { 24980 trackers: fontDictTrackers, 24981 output: fdArrayIndex 24982 }; 24983 } 24984 compilePrivateDicts(dicts, trackers, output) { 24985 for (let i = 0, ii = dicts.length; i < ii; ++i) { 24986 const fontDict = dicts[i]; 24987 const privateDict = fontDict.privateDict; 24988 if (!privateDict || !fontDict.hasName("Private")) { 24989 throw new _util.FormatError("There must be a private dictionary."); 24990 } 24991 const privateDictTracker = new CFFOffsetTracker(); 24992 const privateDictData = this.compileDict(privateDict, privateDictTracker); 24993 let outputLength = output.length; 24994 privateDictTracker.offset(outputLength); 24995 if (!privateDictData.length) { 24996 outputLength = 0; 24997 } 24998 trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output); 24999 output.add(privateDictData); 25000 if (privateDict.subrsIndex && privateDict.hasName("Subrs")) { 25001 const subrs = this.compileIndex(privateDict.subrsIndex); 25002 privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output); 25003 output.add(subrs); 25004 } 25005 } 25006 } 25007 compileDict(dict, offsetTracker) { 25008 const out = []; 25009 for (const key of dict.order) { 25010 if (!(key in dict.values)) { 25011 continue; 25012 } 25013 let values = dict.values[key]; 25014 let types = dict.types[key]; 25015 if (!Array.isArray(types)) { 25016 types = [types]; 25017 } 25018 if (!Array.isArray(values)) { 25019 values = [values]; 25020 } 25021 if (values.length === 0) { 25022 continue; 25023 } 25024 for (let j = 0, jj = types.length; j < jj; ++j) { 25025 const type = types[j]; 25026 const value = values[j]; 25027 switch (type) { 25028 case "num": 25029 case "sid": 25030 out.push(...this.encodeNumber(value)); 25031 break; 25032 case "offset": 25033 const name = dict.keyToNameMap[key]; 25034 if (!offsetTracker.isTracking(name)) { 25035 offsetTracker.track(name, out.length); 25036 } 25037 out.push(0x1d, 0, 0, 0, 0); 25038 break; 25039 case "array": 25040 case "delta": 25041 out.push(...this.encodeNumber(value)); 25042 for (let k = 1, kk = values.length; k < kk; ++k) { 25043 out.push(...this.encodeNumber(values[k])); 25044 } 25045 break; 25046 default: 25047 throw new _util.FormatError(`Unknown data type of ${type}`); 25048 } 25049 } 25050 out.push(...dict.opcodes[key]); 25051 } 25052 return out; 25053 } 25054 compileStringIndex(strings) { 25055 const stringIndex = new CFFIndex(); 25056 for (const string of strings) {
vendor: 4,098 bytes, lines 25057-25191
25057 stringIndex.add((0, _util.stringToBytes)(string)); 25058 } 25059 return this.compileIndex(stringIndex); 25060 } 25061 compileCharStrings(charStrings) { 25062 const charStringsIndex = new CFFIndex(); 25063 for (let i = 0; i < charStrings.count; i++) { 25064 const glyph = charStrings.get(i); 25065 if (glyph.length === 0) { 25066 charStringsIndex.add(new Uint8Array([0x8b, 0x0e])); 25067 continue; 25068 } 25069 charStringsIndex.add(glyph); 25070 } 25071 return this.compileIndex(charStringsIndex); 25072 } 25073 compileCharset(charset, numGlyphs, strings, isCIDFont) { 25074 let out; 25075 const numGlyphsLessNotDef = numGlyphs - 1; 25076 if (isCIDFont) { 25077 out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]); 25078 } else { 25079 const length = 1 + numGlyphsLessNotDef * 2; 25080 out = new Uint8Array(length); 25081 out[0] = 0; 25082 let charsetIndex = 0; 25083 const numCharsets = charset.charset.length; 25084 let warned = false; 25085 for (let i = 1; i < out.length; i += 2) { 25086 let sid = 0; 25087 if (charsetIndex < numCharsets) { 25088 const name = charset.charset[charsetIndex++]; 25089 sid = strings.getSID(name); 25090 if (sid === -1) { 25091 sid = 0; 25092 if (!warned) { 25093 warned = true; 25094 (0, _util.warn)(`Couldn't find ${name} in CFF strings`); 25095 } 25096 } 25097 } 25098 out[i] = sid >> 8 & 0xff; 25099 out[i + 1] = sid & 0xff; 25100 } 25101 } 25102 return this.compileTypedArray(out); 25103 } 25104 compileEncoding(encoding) { 25105 return this.compileTypedArray(encoding.raw); 25106 } 25107 compileFDSelect(fdSelect) { 25108 const format = fdSelect.format; 25109 let out, i; 25110 switch (format) { 25111 case 0: 25112 out = new Uint8Array(1 + fdSelect.fdSelect.length); 25113 out[0] = format; 25114 for (i = 0; i < fdSelect.fdSelect.length; i++) { 25115 out[i + 1] = fdSelect.fdSelect[i]; 25116 } 25117 break; 25118 case 3: 25119 const start = 0; 25120 let lastFD = fdSelect.fdSelect[0]; 25121 const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD]; 25122 for (i = 1; i < fdSelect.fdSelect.length; i++) { 25123 const currentFD = fdSelect.fdSelect[i]; 25124 if (currentFD !== lastFD) { 25125 ranges.push(i >> 8 & 0xff, i & 0xff, currentFD); 25126 lastFD = currentFD; 25127 } 25128 } 25129 const numRanges = (ranges.length - 3) / 3; 25130 ranges[1] = numRanges >> 8 & 0xff; 25131 ranges[2] = numRanges & 0xff; 25132 ranges.push(i >> 8 & 0xff, i & 0xff); 25133 out = new Uint8Array(ranges); 25134 break; 25135 } 25136 return this.compileTypedArray(out); 25137 } 25138 compileTypedArray(data) { 25139 return Array.from(data); 25140 } 25141 compileIndex(index, trackers = []) { 25142 const objects = index.objects; 25143 const count = objects.length; 25144 if (count === 0) { 25145 return [0, 0]; 25146 } 25147 const data = [count >> 8 & 0xff, count & 0xff]; 25148 let lastOffset = 1, 25149 i; 25150 for (i = 0; i < count; ++i) { 25151 lastOffset += objects[i].length; 25152 } 25153 let offsetSize; 25154 if (lastOffset < 0x100) { 25155 offsetSize = 1; 25156 } else if (lastOffset < 0x10000) { 25157 offsetSize = 2; 25158 } else if (lastOffset < 0x1000000) { 25159 offsetSize = 3; 25160 } else { 25161 offsetSize = 4; 25162 } 25163 data.push(offsetSize); 25164 let relativeOffset = 1; 25165 for (i = 0; i < count + 1; i++) { 25166 if (offsetSize === 1) { 25167 data.push(relativeOffset & 0xff); 25168 } else if (offsetSize === 2) { 25169 data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 25170 } else if (offsetSize === 3) { 25171 data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 25172 } else { 25173 data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 25174 } 25175 if (objects[i]) { 25176 relativeOffset += objects[i].length; 25177 } 25178 } 25179 for (i = 0; i < count; i++) { 25180 if (trackers[i]) { 25181 trackers[i].offset(data.length); 25182 } 25183 data.push(...objects[i]); 25184 } 25185 return data; 25186 } 25187} 25188exports.CFFCompiler = CFFCompiler; 25189 25190/***/ }), 25191/* 36 */
25192/***/ ((__unused_webpack_module, exports) => { 25193 25194 25195 25196Object.defineProperty(exports, "__esModule", ({ 25197 value: true 25198})); 25199exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0; 25200const 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
25200ntered", "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"]; 25201exports.ISOAdobeCharset = ISOAdobeCharset; 25202const 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"]; 25203exports.ExpertCharset = ExpertCharset; 25204const 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"]; 25205exports.ExpertSubsetCharset = ExpertSubsetCharset; 25206 25207/***/ }), 25208/* 37 */
25209/***/ ((__unused_webpack_module, exports) => { 25210 25211 25212 25213Object.defineProperty(exports, "__esModule", ({ 25214 value: true 25215})); 25216exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0; 25217exports.getEncoding = getEncoding; 25218const 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"]; 25219exports.ExpertEncoding = ExpertEncoding; 25220const 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", "", "", "", ""]; 25221const 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
25221ntered", "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"]; 25222exports.MacRomanEncoding = MacRomanEncoding; 25223const 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
25223ntered", "", "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", "", "", "", ""]; 25224exports.StandardEncoding = StandardEncoding; 25225const 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"]; 25226exports.WinAnsiEncoding = WinAnsiEncoding; 25227const 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
25227clemultiply", "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", ""]; 25228exports.SymbolSetEncoding = SymbolSetEncoding; 25229const 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", ""]; 25230exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding; 25231function getEncoding(encodingName) { 25232 switch (encodingName) { 25233 case "WinAnsiEncoding": 25234 return WinAnsiEncoding; 25235 case "StandardEncoding": 25236 return StandardEncoding; 25237 case "MacRomanEncoding": 25238 return MacRomanEncoding; 25239 case "SymbolSetEncoding": 25240 return SymbolSetEncoding; 25241 case "ZapfDingbatsEncoding": 25242 return ZapfDingbatsEncoding; 25243 case "ExpertEncoding": 25244 return ExpertEncoding; 25245 case "MacExpertEncoding": 25246 return MacExpertEncoding; 25247 default: 25248 return null; 25249 } 25250} 25251 25252/***/ }), 25253/* 38 */ 25254/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 25255 25256 25257 25258Object.defineProperty(exports, "__esModule", ({ 25259 value: true 25260})); 25261exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0; 25262exports.normalizeFontName = normalizeFontName; 25263exports.recoverGlyphName = recoverGlyphName; 25264exports.type1FontGlyphMapping = type1FontGlyphMapping; 25265var _encodings = __w_pdfjs_require__(37); 25266var _glyphlist = __w_pdfjs_require__(39); 25267var _unicode = __w_pdfjs_require__(40); 25268var _util = __w_pdfjs_require__(2); 25269const SEAC_ANALYSIS_ENABLED = true; 25270exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED; 25271const FontFlags = { 25272 FixedPitch: 1, 25273 Serif: 2, 25274 Symbolic: 4, 25275 Script: 8, 25276 Nonsymbolic: 32, 25277 Italic: 64, 25278 AllCap: 65536, 25279 SmallCap: 131072, 25280 ForceBold: 262144 25281}; 25282exports.FontFlags = FontFlags; 25283const 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
25283ntered", "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"]; 25284exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering; 25285function recoverGlyphName(name, glyphsUnicodeMap) { 25286 if (glyphsUnicodeMap[name] !== undefined) { 25287 return name; 25288 } 25289 const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap); 25290 if (unicode !== -1) { 25291 for (const key in glyphsUnicodeMap) { 25292 if (glyphsUnicodeMap[key] === unicode) { 25293 return key; 25294 } 25295 } 25296 } 25297 (0, _util.info)("Unable to recover a standard glyph name for: " + name); 25298 return name; 25299} 25300function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { 25301 const charCodeToGlyphId = Object.create(null); 25302 let glyphId, charCode, baseEncoding; 25303 const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 25304 if (properties.isInternalFont) { 25305 baseEncoding = builtInEncoding; 25306 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 25307 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 25308 charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; 25309 } 25310 } else if (properties.baseEncodingName) { 25311 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 25312 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 25313 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 25314 charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; 25315 } 25316 } else if (isSymbolicFont) { 25317 for (charCode in builtInEncoding) { 25318 charCodeToGlyphId[charCode] = builtInEncoding[charCode]; 25319 } 25320 } else { 25321 baseEncoding = _encodings.StandardEncoding; 25322 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 25323 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 25324 charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; 25325 } 25326 } 25327 const differences = properties.differences; 25328 let glyphsUnicodeMap; 25329 if (differences) { 25330 for (charCode in differences) { 25331 const glyphName = differences[charCode]; 25332 glyphId = glyphNames.indexOf(glyphName); 25333 if (glyphId === -1) { 25334 if (!glyphsUnicodeMap) { 25335 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 25336 } 25337 const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 25338 if (standardGlyphName !== glyphName) { 25339 glyphId = glyphNames.indexOf(standardGlyphName); 25340 } 25341 } 25342 charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; 25343 } 25344 } 25345 return charCodeToGlyphId; 25346} 25347function normalizeFontName(name) { 25348 return name.replaceAll(/[,_]/g, "-").replaceAll(/\s/g, ""); 25349} 25350 25351/***/ }), 25352/* 39 */ 25353/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 25354 25355 25356 25357Object.defineProperty(exports, "__esModule", ({ 25358 value: true 25359})); 25360exports.getGlyphsUnicode = exports.getDingbatsGlyphsUnicode = void 0; 25361var _core_utils = __w_pdfjs_require__(3); 25362const getGlyphsUnicode = (0, _core_utils.getLookupTableFactory)
vendor: 115,428 bytes, lines 25362-29691
25362(function (t) { 25363 t.A = 0x0041; 25364 t.AE = 0x00c6; 25365 t.AEacute = 0x01fc; 25366 t.AEmacron = 0x01e2; 25367 t.AEsmall = 0xf7e6; 25368 t.Aacute = 0x00c1; 25369 t.Aacutesmall = 0xf7e1; 25370 t.Abreve = 0x0102; 25371 t.Abreveacute = 0x1eae; 25372 t.Abrevecyrillic = 0x04d0; 25373 t.Abrevedotbelow = 0x1eb6; 25374 t.Abrevegrave = 0x1eb0; 25375 t.Abrevehookabove = 0x1eb2; 25376 t.Abrevetilde = 0x1eb4; 25377 t.Acaron = 0x01cd; 25378 t.Acircle = 0x24b6; 25379 t.Acircumflex = 0x00c2; 25380 t.Acircumflexacute = 0x1ea4; 25381 t.Acircumflexdotbelow = 0x1eac; 25382 t.Acircumflexgrave = 0x1ea6; 25383 t.Acircumflexhookabove = 0x1ea8; 25384 t.Acircumflexsmall = 0xf7e2; 25385 t.Acircumflextilde = 0x1eaa; 25386 t.Acute = 0xf6c9; 25387 t.Acutesmall = 0xf7b4; 25388 t.Acyrillic = 0x0410; 25389 t.Adblgrave = 0x0200; 25390 t.Adieresis = 0x00c4; 25391 t.Adieresiscyrillic = 0x04d2; 25392 t.Adieresismacron = 0x01de; 25393 t.Adieresissmall = 0xf7e4; 25394 t.Adotbelow = 0x1ea0; 25395 t.Adotmacron = 0x01e0; 25396 t.Agrave = 0x00c0; 25397 t.Agravesmall = 0xf7e0; 25398 t.Ahookabove = 0x1ea2; 25399 t.Aiecyrillic = 0x04d4; 25400 t.Ainvertedbreve = 0x0202; 25401 t.Alpha = 0x0391; 25402 t.Alphatonos = 0x0386; 25403 t.Amacron = 0x0100; 25404 t.Amonospace = 0xff21; 25405 t.Aogonek = 0x0104; 25406 t.Aring = 0x00c5; 25407 t.Aringacute = 0x01fa; 25408 t.Aringbelow = 0x1e00; 25409 t.Aringsmall = 0xf7e5; 25410 t.Asmall = 0xf761; 25411 t.Atilde = 0x00c3; 25412 t.Atildesmall = 0xf7e3; 25413 t.Aybarmenian = 0x0531; 25414 t.B = 0x0042; 25415 t.Bcircle = 0x24b7; 25416 t.Bdotaccent = 0x1e02; 25417 t.Bdotbelow = 0x1e04; 25418 t.Becyrillic = 0x0411; 25419 t.Benarmenian = 0x0532; 25420 t.Beta = 0x0392; 25421 t.Bhook = 0x0181; 25422 t.Blinebelow = 0x1e06; 25423 t.Bmonospace = 0xff22; 25424 t.Brevesmall = 0xf6f4; 25425 t.Bsmall = 0xf762; 25426 t.Btopbar = 0x0182; 25427 t.C = 0x0043; 25428 t.Caarmenian = 0x053e; 25429 t.Cacute = 0x0106; 25430 t.Caron = 0xf6ca; 25431 t.Caronsmall = 0xf6f5; 25432 t.Ccaron = 0x010c; 25433 t.Ccedilla = 0x00c7; 25434 t.Ccedillaacute = 0x1e08; 25435 t.Ccedillasmall = 0xf7e7; 25436 t.Ccircle = 0x24b8; 25437 t.Ccircumflex = 0x0108; 25438 t.Cdot = 0x010a; 25439 t.Cdotaccent = 0x010a; 25440 t.Cedillasmall = 0xf7b8; 25441 t.Chaarmenian = 0x0549; 25442 t.Cheabkhasiancyrillic = 0x04bc; 25443 t.Checyrillic = 0x0427; 25444 t.Chedescenderabkhasiancyrillic = 0x04be; 25445 t.Chedescendercyrillic = 0x04b6; 25446 t.Chedieresiscyrillic = 0x04f4; 25447 t.Cheharmenian = 0x0543; 25448 t.Chekhakassiancyrillic = 0x04cb; 25449 t.Cheverticalstrokecyrillic = 0x04b8; 25450 t.Chi = 0x03a7; 25451 t.Chook = 0x0187; 25452 t.Circumflexsmall = 0xf6f6; 25453 t.Cmonospace = 0xff23; 25454 t.Coarmenian = 0x0551; 25455 t.Csmall = 0xf763; 25456 t.D = 0x0044; 25457 t.DZ = 0x01f1; 25458 t.DZcaron = 0x01c4; 25459 t.Daarmenian = 0x0534; 25460 t.Dafrican = 0x0189; 25461 t.Dcaron = 0x010e; 25462 t.Dcedilla = 0x1e10; 25463 t.Dcircle = 0x24b9; 25464 t.Dcircumflexbelow = 0x1e12; 25465 t.Dcroat = 0x0110; 25466 t.Ddotaccent = 0x1e0a; 25467 t.Ddotbelow = 0x1e0c; 25468 t.Decyrillic = 0x0414; 25469 t.Deicoptic = 0x03ee; 25470 t.Delta = 0x2206; 25471 t.Deltagreek = 0x0394; 25472 t.Dhook = 0x018a; 25473 t.Dieresis = 0xf6cb; 25474 t.DieresisAcute = 0xf6cc; 25475 t.DieresisGrave = 0xf6cd; 25476 t.Dieresissmall = 0xf7a8; 25477 t.Digammagreek = 0x03dc; 25478 t.Djecyrillic = 0x0402; 25479 t.Dlinebelow = 0x1e0e; 25480 t.Dmonospace = 0xff24; 25481 t.Dotaccentsmall = 0xf6f7; 25482 t.Dslash = 0x0110; 25483 t.Dsmall = 0xf764; 25484 t.Dtopbar = 0x018b; 25485 t.Dz = 0x01f2; 25486 t.Dzcaron = 0x01c5; 25487 t.Dzeabkhasiancyrillic = 0x04e0; 25488 t.Dzecyrillic = 0x0405; 25489 t.Dzhecyrillic = 0x040f; 25490 t.E = 0x0045; 25491 t.Eacute = 0x00c9; 25492 t.Eacutesmall = 0xf7e9; 25493 t.Ebreve = 0x0114; 25494 t.Ecaron = 0x011a; 25495 t.Ecedillabreve = 0x1e1c; 25496 t.Echarmenian = 0x0535; 25497 t.Ecircle = 0x24ba; 25498 t.Ecircumflex = 0x00ca; 25499 t.Ecircumflexacute = 0x1ebe; 25500 t.Ecircumflexbelow = 0x1e18; 25501 t.Ecircumflexdotbelow = 0x1ec6; 25502 t.Ecircumflexgrave = 0x1ec0; 25503 t.Ecircumflexhookabove = 0x1ec2; 25504 t.Ecircumflexsmall = 0xf7ea; 25505 t.Ecircumflextilde = 0x1ec4; 25506 t.Ecyrillic = 0x0404; 25507 t.Edblgrave = 0x0204; 25508 t.Edieresis = 0x00cb; 25509 t.Edieresissmall = 0xf7eb; 25510 t.Edot = 0x0116; 25511 t.Edotaccent = 0x0116; 25512 t.Edotbelow = 0x1eb8; 25513 t.Efcyrillic = 0x0424; 25514 t.Egrave = 0x00c8; 25515 t.Egravesmall = 0xf7e8; 25516 t.Eharmenian = 0x0537; 25517 t.Ehookabove = 0x1eba; 25518 t.Eightroman = 0x2167; 25519 t.Einvertedbreve = 0x0206; 25520 t.Eiotifiedcyrillic = 0x0464; 25521 t.Elcyrillic = 0x041b; 25522 t.Elevenroman = 0x216a; 25523 t.Emacron = 0x0112; 25524 t.Emacronacute = 0x1e16; 25525 t.Emacrongrave = 0x1e14; 25526 t.Emcyrillic = 0x041c; 25527 t.Emonospace = 0xff25; 25528 t.Encyrillic = 0x041d; 25529 t.Endescendercyrillic = 0x04a2; 25530 t.Eng = 0x014a; 25531 t.Enghecyrillic = 0x04a4; 25532 t.Enhookcyrillic = 0x04c7; 25533 t.Eogonek = 0x0118; 25534 t.Eopen = 0x0190; 25535 t.Epsilon = 0x0395; 25536 t.Epsilontonos = 0x0388; 25537 t.Ercyrillic = 0x0420; 25538 t.Ereversed = 0x018e; 25539 t.Ereversedcyrillic = 0x042d; 25540 t.Escyrillic = 0x0421; 25541 t.Esdescendercyrillic = 0x04aa; 25542 t.Esh = 0x01a9; 25543 t.Esmall = 0xf765; 25544 t.Eta = 0x0397; 25545 t.Etarmenian = 0x0538; 25546 t.Etatonos = 0x0389; 25547 t.Eth = 0x00d0; 25548 t.Ethsmall = 0xf7f0; 25549 t.Etilde = 0x1ebc; 25550 t.Etildebelow = 0x1e1a; 25551 t.Euro = 0x20ac; 25552 t.Ezh = 0x01b7; 25553 t.Ezhcaron = 0x01ee; 25554 t.Ezhreversed = 0x01b8; 25555 t.F = 0x0046; 25556 t.Fcircle = 0x24bb; 25557 t.Fdotaccent = 0x1e1e; 25558 t.Feharmenian = 0x0556; 25559 t.Feicoptic = 0x03e4; 25560 t.Fhook = 0x0191; 25561 t.Fitacyrillic = 0x0472; 25562 t.Fiveroman = 0x2164; 25563 t.Fmonospace = 0xff26; 25564 t.Fourroman = 0x2163; 25565 t.Fsmall = 0xf766; 25566 t.G = 0x0047; 25567 t.GBsquare = 0x3387; 25568 t.Gacute = 0x01f4; 25569 t.Gamma = 0x0393; 25570 t.Gammaafrican = 0x0194; 25571 t.Gangiacoptic = 0x03ea; 25572 t.Gbreve = 0x011e; 25573 t.Gcaron = 0x01e6; 25574 t.Gcedilla = 0x0122; 25575 t.Gcircle = 0x24bc; 25576 t.Gcircumflex = 0x011c; 25577 t.Gcommaaccent = 0x0122; 25578 t.Gdot = 0x0120; 25579 t.Gdotaccent = 0x0120; 25580 t.Gecyrillic = 0x0413; 25581 t.Ghadarmenian = 0x0542; 25582 t.Ghemiddlehookcyrillic = 0x0494; 25583 t.Ghestrokecyrillic = 0x0492; 25584 t.Gheupturncyrillic = 0x0490; 25585 t.Ghook = 0x0193; 25586 t.Gimarmenian = 0x0533; 25587 t.Gjecyrillic = 0x0403; 25588 t.Gmacron = 0x1e20; 25589 t.Gmonospace = 0xff27; 25590 t.Grave = 0xf6ce; 25591 t.Gravesmall = 0xf760; 25592 t.Gsmall = 0xf767; 25593 t.Gsmallhook = 0x029b; 25594 t.Gstroke = 0x01e4; 25595 t.H = 0x0048; 25596 t.H18533 = 0x25cf; 25597 t.H18543 = 0x25aa; 25598 t.H18551 = 0x25ab; 25599 t.H22073 = 0x25a1; 25600 t.HPsquare = 0x33cb; 25601 t.Haabkhasiancyrillic = 0x04a8; 25602 t.Hadescendercyrillic = 0x04b2; 25603 t.Hardsigncyrillic = 0x042a; 25604 t.Hbar = 0x0126; 25605 t.Hbrevebelow = 0x1e2a; 25606 t.Hcedilla = 0x1e28; 25607 t.Hcircle = 0x24bd; 25608 t.Hcircumflex = 0x0124; 25609 t.Hdieresis = 0x1e26; 25610 t.Hdotaccent = 0x1e22; 25611 t.Hdotbelow = 0x1e24; 25612 t.Hmonospace = 0xff28; 25613 t.Hoarmenian = 0x0540; 25614 t.Horicoptic = 0x03e8; 25615 t.Hsmall = 0xf768; 25616 t.Hungarumlaut = 0xf6cf; 25617 t.Hungarumlautsmall = 0xf6f8; 25618 t.Hzsquare = 0x3390; 25619 t.I = 0x0049; 25620 t.IAcyrillic = 0x042f; 25621 t.IJ = 0x0132; 25622 t.IUcyrillic = 0x042e; 25623 t.Iacute = 0x00cd; 25624 t.Iacutesmall = 0xf7ed; 25625 t.Ibreve = 0x012c; 25626 t.Icaron = 0x01cf; 25627 t.Icircle = 0x24be; 25628 t.Icircumflex = 0x00ce; 25629 t.Icircumflexsmall = 0xf7ee; 25630 t.Icyrillic = 0x0406; 25631 t.Idblgrave = 0x0208; 25632 t.Idieresis = 0x00cf; 25633 t.Idieresisacute = 0x1e2e; 25634 t.Idieresiscyrillic = 0x04e4; 25635 t.Idieresissmall = 0xf7ef; 25636 t.Idot = 0x0130; 25637 t.Idotaccent = 0x0130; 25638 t.Idotbelow = 0x1eca; 25639 t.Iebrevecyrillic = 0x04d6; 25640 t.Iecyrillic = 0x0415; 25641 t.Ifraktur = 0x2111; 25642 t.Igrave = 0x00cc; 25643 t.Igravesmall = 0xf7ec; 25644 t.Ihookabove = 0x1ec8; 25645 t.Iicyrillic = 0x0418; 25646 t.Iinvertedbreve = 0x020a; 25647 t.Iishortcyrillic = 0x0419; 25648 t.Imacron = 0x012a; 25649 t.Imacroncyrillic = 0x04e2; 25650 t.Imonospace = 0xff29; 25651 t.Iniarmenian = 0x053b; 25652 t.Iocyrillic = 0x0401; 25653 t.Iogonek = 0x012e; 25654 t.Iota = 0x0399; 25655 t.Iotaafrican = 0x0196; 25656 t.Iotadieresis = 0x03aa; 25657 t.Iotatonos = 0x038a; 25658 t.Ismall = 0xf769; 25659 t.Istroke = 0x0197; 25660 t.Itilde = 0x0128; 25661 t.Itildebelow = 0x1e2c; 25662 t.Izhitsacyrillic = 0x0474; 25663 t.Izhitsadblgravecyrillic = 0x0476; 25664 t.J = 0x004a; 25665 t.Jaarmenian = 0x0541; 25666 t.Jcircle = 0x24bf; 25667 t.Jcircumflex = 0x0134; 25668 t.Jecyrillic = 0x0408; 25669 t.Jheharmenian = 0x054b; 25670 t.Jmonospace = 0xff2a; 25671 t.Jsmall = 0xf76a; 25672 t.K = 0x004b; 25673 t.KBsquare = 0x3385; 25674 t.KKsquare = 0x33cd; 25675 t.Kabashkircyrillic = 0x04a0; 25676 t.Kacute = 0x1e30; 25677 t.Kacyrillic = 0x041a; 25678 t.Kadescendercyrillic = 0x049a; 25679 t.Kahookcyrillic = 0x04c3; 25680 t.Kappa = 0x039a; 25681 t.Kastrokecyrillic = 0x049e; 25682 t.Kaverticalstrokecyrillic = 0x049c; 25683 t.Kcaron = 0x01e8; 25684 t.Kcedilla = 0x0136; 25685 t.Kcircle = 0x24c0; 25686 t.Kcommaaccent = 0x0136; 25687 t.Kdotbelow = 0x1e32; 25688 t.Keharmenian = 0x0554; 25689 t.Kenarmenian = 0x053f; 25690 t.Khacyrillic = 0x0425; 25691 t.Kheicoptic = 0x03e6; 25692 t.Khook = 0x0198; 25693 t.Kjecyrillic = 0x040c; 25694 t.Klinebelow = 0x1e34; 25695 t.Kmonospace = 0xff2b; 25696 t.Koppacyrillic = 0x0480; 25697 t.Koppagreek = 0x03de; 25698 t.Ksicyrillic = 0x046e; 25699 t.Ksmall = 0xf76b; 25700 t.L = 0x004c; 25701 t.LJ = 0x01c7; 25702 t.LL = 0xf6bf; 25703 t.Lacute = 0x0139; 25704 t.Lambda = 0x039b; 25705 t.Lcaron = 0x013d; 25706 t.Lcedilla = 0x013b; 25707 t.Lcircle = 0x24c1; 25708 t.Lcircumflexbelow = 0x1e3c; 25709 t.Lcommaaccent = 0x013b; 25710 t.Ldot = 0x013f; 25711 t.Ldotaccent = 0x013f; 25712 t.Ldotbelow = 0x1e36; 25713 t.Ldotbelowmacron = 0x1e38; 25714 t.Liwnarmenian = 0x053c; 25715 t.Lj = 0x01c8; 25716 t.Ljecyrillic = 0x0409; 25717 t.Llinebelow = 0x1e3a; 25718 t.Lmonospace = 0xff2c; 25719 t.Lslash = 0x0141; 25720 t.Lslashsmall = 0xf6f9; 25721 t.Lsmall = 0xf76c; 25722 t.M = 0x004d; 25723 t.MBsquare = 0x3386; 25724 t.Macron = 0xf6d0; 25725 t.Macronsmall = 0xf7af; 25726 t.Macute = 0x1e3e; 25727 t.Mcircle = 0x24c2; 25728 t.Mdotaccent = 0x1e40; 25729 t.Mdotbelow = 0x1e42; 25730 t.Menarmenian = 0x0544; 25731 t.Mmonospace = 0xff2d; 25732 t.Msmall = 0xf76d; 25733 t.Mturned = 0x019c; 25734 t.Mu = 0x039c; 25735 t.N = 0x004e; 25736 t.NJ = 0x01ca; 25737 t.Nacute = 0x0143; 25738 t.Ncaron = 0x0147; 25739 t.Ncedilla = 0x0145; 25740 t.Ncircle = 0x24c3; 25741 t.Ncircumflexbelow = 0x1e4a; 25742 t.Ncommaaccent = 0x0145; 25743 t.Ndotaccent = 0x1e44; 25744 t.Ndotbelow = 0x1e46; 25745 t.Nhookleft = 0x019d; 25746 t.Nineroman = 0x2168; 25747 t.Nj = 0x01cb; 25748 t.Njecyrillic = 0x040a; 25749 t.Nlinebelow = 0x1e48; 25750 t.Nmonospace = 0xff2e; 25751 t.Nowarmenian = 0x0546; 25752 t.Nsmall = 0xf76e; 25753 t.Ntilde = 0x00d1; 25754 t.Ntildesmall = 0xf7f1; 25755 t.Nu = 0x039d; 25756 t.O = 0x004f; 25757 t.OE = 0x0152; 25758 t.OEsmall = 0xf6fa; 25759 t.Oacute = 0x00d3; 25760 t.Oacutesmall = 0xf7f3; 25761 t.Obarredcyrillic = 0x04e8; 25762 t.Obarreddieresiscyrillic = 0x04ea; 25763 t.Obreve = 0x014e; 25764 t.Ocaron = 0x01d1; 25765 t.Ocenteredtilde = 0x019f; 25766 t.Ocircle = 0x24c4; 25767 t.Ocircumflex = 0x00d4; 25768 t.Ocircumflexacute = 0x1ed0; 25769 t.Ocircumflexdotbelow = 0x1ed8; 25770 t.Ocircumflexgrave = 0x1ed2; 25771 t.Ocircumflexhookabove = 0x1ed4; 25772 t.Ocircumflexsmall = 0xf7f4; 25773 t.Ocircumflextilde = 0x1ed6; 25774 t.Ocyrillic = 0x041e; 25775 t.Odblacute = 0x0150; 25776 t.Odblgrave = 0x020c; 25777 t.Odieresis = 0x00d6; 25778 t.Odieresiscyrillic = 0x04e6; 25779 t.Odieresissmall = 0xf7f6; 25780 t.Odotbelow = 0x1ecc; 25781 t.Ogoneksmall = 0xf6fb; 25782 t.Ograve = 0x00d2; 25783 t.Ogravesmall = 0xf7f2; 25784 t.Oharmenian = 0x0555; 25785 t.Ohm = 0x2126; 25786 t.Ohookabove = 0x1ece; 25787 t.Ohorn = 0x01a0; 25788 t.Ohornacute = 0x1eda; 25789 t.Ohorndotbelow = 0x1ee2; 25790 t.Ohorngrave = 0x1edc; 25791 t.Ohornhookabove = 0x1ede; 25792 t.Ohorntilde = 0x1ee0; 25793 t.Ohungarumlaut = 0x0150; 25794 t.Oi = 0x01a2; 25795 t.Oinvertedbreve = 0x020e; 25796 t.Omacron = 0x014c; 25797 t.Omacronacute = 0x1e52; 25798 t.Omacrongrave = 0x1e50; 25799 t.Omega = 0x2126; 25800 t.Omegacyrillic = 0x0460; 25801 t.Omegagreek = 0x03a9; 25802 t.Omegaroundcyrillic = 0x047a; 25803 t.Omegatitlocyrillic = 0x047c; 25804 t.Omegatonos = 0x038f; 25805 t.Omicron = 0x039f; 25806 t.Omicrontonos = 0x038c; 25807 t.Omonospace = 0xff2f; 25808 t.Oneroman = 0x2160; 25809 t.Oogonek = 0x01ea; 25810 t.Oogonekmacron = 0x01ec; 25811 t.Oopen = 0x0186; 25812 t.Oslash = 0x00d8; 25813 t.Oslashacute = 0x01fe; 25814 t.Oslashsmall = 0xf7f8; 25815 t.Osmall = 0xf76f; 25816 t.Ostrokeacute = 0x01fe; 25817 t.Otcyrillic = 0x047e; 25818 t.Otilde = 0x00d5; 25819 t.Otildeacute = 0x1e4c; 25820 t.Otildedieresis = 0x1e4e; 25821 t.Otildesmall = 0xf7f5; 25822 t.P = 0x0050; 25823 t.Pacute = 0x1e54; 25824 t.Pcircle = 0x24c5; 25825 t.Pdotaccent = 0x1e56; 25826 t.Pecyrillic = 0x041f; 25827 t.Peharmenian = 0x054a; 25828 t.Pemiddlehookcyrillic = 0x04a6; 25829 t.Phi = 0x03a6; 25830 t.Phook = 0x01a4; 25831 t.Pi = 0x03a0; 25832 t.Piwrarmenian = 0x0553; 25833 t.Pmonospace = 0xff30; 25834 t.Psi = 0x03a8; 25835 t.Psicyrillic = 0x0470; 25836 t.Psmall = 0xf770; 25837 t.Q = 0x0051; 25838 t.Qcircle = 0x24c6; 25839 t.Qmonospace = 0xff31; 25840 t.Qsmall = 0xf771; 25841 t.R = 0x0052; 25842 t.Raarmenian = 0x054c; 25843 t.Racute = 0x0154; 25844 t.Rcaron = 0x0158; 25845 t.Rcedilla = 0x0156; 25846 t.Rcircle = 0x24c7; 25847 t.Rcommaaccent = 0x0156; 25848 t.Rdblgrave = 0x0210; 25849 t.Rdotaccent = 0x1e58; 25850 t.Rdotbelow = 0x1e5a; 25851 t.Rdotbelowmacron = 0x1e5c; 25852 t.Reharmenian = 0x0550; 25853 t.Rfraktur = 0x211c; 25854 t.Rho = 0x03a1; 25855 t.Ringsmall = 0xf6fc; 25856 t.Rinvertedbreve = 0x0212; 25857 t.Rlinebelow = 0x1e5e; 25858 t.Rmonospace = 0xff32; 25859 t.Rsmall = 0xf772; 25860 t.Rsmallinverted = 0x0281; 25861 t.Rsmallinvertedsuperior = 0x02b6; 25862 t.S = 0x0053; 25863 t.SF010000 = 0x250c; 25864 t.SF020000 = 0x2514; 25865 t.SF030000 = 0x2510; 25866 t.SF040000 = 0x2518; 25867 t.SF050000 = 0x253c; 25868 t.SF060000 = 0x252c; 25869 t.SF070000 = 0x2534; 25870 t.SF080000 = 0x251c; 25871 t.SF090000 = 0x2524; 25872 t.SF100000 = 0x2500; 25873 t.SF110000 = 0x2502; 25874 t.SF190000 = 0x2561; 25875 t.SF200000 = 0x2562; 25876 t.SF210000 = 0x2556; 25877 t.SF220000 = 0x2555; 25878 t.SF230000 = 0x2563; 25879 t.SF240000 = 0x2551; 25880 t.SF250000 = 0x2557; 25881 t.SF260000 = 0x255d; 25882 t.SF270000 = 0x255c; 25883 t.SF280000 = 0x255b; 25884 t.SF360000 = 0x255e; 25885 t.SF370000 = 0x255f; 25886 t.SF380000 = 0x255a; 25887 t.SF390000 = 0x2554; 25888 t.SF400000 = 0x2569; 25889 t.SF410000 = 0x2566; 25890 t.SF420000 = 0x2560; 25891 t.SF430000 = 0x2550; 25892 t.SF440000 = 0x256c; 25893 t.SF450000 = 0x2567; 25894 t.SF460000 = 0x2568; 25895 t.SF470000 = 0x2564; 25896 t.SF480000 = 0x2565; 25897 t.SF490000 = 0x2559; 25898 t.SF500000 = 0x2558; 25899 t.SF510000 = 0x2552; 25900 t.SF520000 = 0x2553; 25901 t.SF530000 = 0x256b; 25902 t.SF540000 = 0x256a; 25903 t.Sacute = 0x015a; 25904 t.Sacutedotaccent = 0x1e64; 25905 t.Sampigreek = 0x03e0; 25906 t.Scaron = 0x0160; 25907 t.Scarondotaccent = 0x1e66; 25908 t.Scaronsmall = 0xf6fd; 25909 t.Scedilla = 0x015e; 25910 t.Schwa = 0x018f; 25911 t.Schwacyrillic = 0x04d8; 25912 t.Schwadieresiscyrillic = 0x04da; 25913 t.Scircle = 0x24c8; 25914 t.Scircumflex = 0x015c; 25915 t.Scommaaccent = 0x0218; 25916 t.Sdotaccent = 0x1e60; 25917 t.Sdotbelow = 0x1e62; 25918 t.Sdotbelowdotaccent = 0x1e68; 25919 t.Seharmenian = 0x054d; 25920 t.Sevenroman = 0x2166; 25921 t.Shaarmenian = 0x0547; 25922 t.Shacyrillic = 0x0428; 25923 t.Shchacyrillic = 0x0429; 25924 t.Sheicoptic = 0x03e2; 25925 t.Shhacyrillic = 0x04ba; 25926 t.Shimacoptic = 0x03ec; 25927 t.Sigma = 0x03a3; 25928 t.Sixroman = 0x2165; 25929 t.Smonospace = 0xff33; 25930 t.Softsigncyrillic = 0x042c; 25931 t.Ssmall = 0xf773; 25932 t.Stigmagreek = 0x03da; 25933 t.T = 0x0054; 25934 t.Tau = 0x03a4; 25935 t.Tbar = 0x0166; 25936 t.Tcaron = 0x0164; 25937 t.Tcedilla = 0x0162; 25938 t.Tcircle = 0x24c9; 25939 t.Tcircumflexbelow = 0x1e70; 25940 t.Tcommaaccent = 0x0162; 25941 t.Tdotaccent = 0x1e6a; 25942 t.Tdotbelow = 0x1e6c; 25943 t.Tecyrillic = 0x0422; 25944 t.Tedescendercyrillic = 0x04ac; 25945 t.Tenroman = 0x2169; 25946 t.Tetsecyrillic = 0x04b4; 25947 t.Theta = 0x0398; 25948 t.Thook = 0x01ac; 25949 t.Thorn = 0x00de; 25950 t.Thornsmall = 0xf7fe; 25951 t.Threeroman = 0x2162; 25952 t.Tildesmall = 0xf6fe; 25953 t.Tiwnarmenian = 0x054f; 25954 t.Tlinebelow = 0x1e6e; 25955 t.Tmonospace = 0xff34; 25956 t.Toarmenian = 0x0539; 25957 t.Tonefive = 0x01bc; 25958 t.Tonesix = 0x0184; 25959 t.Tonetwo = 0x01a7; 25960 t.Tretroflexhook = 0x01ae; 25961 t.Tsecyrillic = 0x0426; 25962 t.Tshecyrillic = 0x040b; 25963 t.Tsmall = 0xf774; 25964 t.Twelveroman = 0x216b; 25965 t.Tworoman = 0x2161; 25966 t.U = 0x0055; 25967 t.Uacute = 0x00da; 25968 t.Uacutesmall = 0xf7fa; 25969 t.Ubreve = 0x016c; 25970 t.Ucaron = 0x01d3; 25971 t.Ucircle = 0x24ca; 25972 t.Ucircumflex = 0x00db; 25973 t.Ucircumflexbelow = 0x1e76; 25974 t.Ucircumflexsmall = 0xf7fb; 25975 t.Ucyrillic = 0x0423; 25976 t.Udblacute = 0x0170; 25977 t.Udblgrave = 0x0214; 25978 t.Udieresis = 0x00dc; 25979 t.Udieresisacute = 0x01d7; 25980 t.Udieresisbelow = 0x1e72; 25981 t.Udieresiscaron = 0x01d9; 25982 t.Udieresiscyrillic = 0x04f0; 25983 t.Udieresisgrave = 0x01db; 25984 t.Udieresismacron = 0x01d5; 25985 t.Udieresissmall = 0xf7fc; 25986 t.Udotbelow = 0x1ee4; 25987 t.Ugrave = 0x00d9; 25988 t.Ugravesmall = 0xf7f9; 25989 t.Uhookabove = 0x1ee6; 25990 t.Uhorn = 0x01af; 25991 t.Uhornacute = 0x1ee8; 25992 t.Uhorndotbelow = 0x1ef0; 25993 t.Uhorngrave = 0x1eea; 25994 t.Uhornhookabove = 0x1eec; 25995 t.Uhorntilde = 0x1eee; 25996 t.Uhungarumlaut = 0x0170; 25997 t.Uhungarumlautcyrillic = 0x04f2; 25998 t.Uinvertedbreve = 0x0216; 25999 t.Ukcyrillic = 0x0478; 26000 t.Umacron = 0x016a; 26001 t.Umacroncyrillic = 0x04ee; 26002 t.Umacrondieresis = 0x1e7a; 26003 t.Umonospace = 0xff35; 26004 t.Uogonek = 0x0172; 26005 t.Upsilon = 0x03a5; 26006 t.Upsilon1 = 0x03d2; 26007 t.Upsilonacutehooksymbolgreek = 0x03d3; 26008 t.Upsilonafrican = 0x01b1; 26009 t.Upsilondieresis = 0x03ab; 26010 t.Upsilondieresishooksymbolgreek = 0x03d4; 26011 t.Upsilonhooksymbol = 0x03d2; 26012 t.Upsilontonos = 0x038e; 26013 t.Uring = 0x016e; 26014 t.Ushortcyrillic = 0x040e; 26015 t.Usmall = 0xf775; 26016 t.Ustraightcyrillic = 0x04ae; 26017 t.Ustraightstrokecyrillic = 0x04b0; 26018 t.Utilde = 0x0168; 26019 t.Utildeacute = 0x1e78; 26020 t.Utildebelow = 0x1e74; 26021 t.V = 0x0056; 26022 t.Vcircle = 0x24cb; 26023 t.Vdotbelow = 0x1e7e; 26024 t.Vecyrillic = 0x0412; 26025 t.Vewarmenian = 0x054e; 26026 t.Vhook = 0x01b2; 26027 t.Vmonospace = 0xff36; 26028 t.Voarmenian = 0x0548; 26029 t.Vsmall = 0xf776; 26030 t.Vtilde = 0x1e7c; 26031 t.W = 0x0057; 26032 t.Wacute = 0x1e82; 26033 t.Wcircle = 0x24cc; 26034 t.Wcircumflex = 0x0174; 26035 t.Wdieresis = 0x1e84; 26036 t.Wdotaccent = 0x1e86; 26037 t.Wdotbelow = 0x1e88; 26038 t.Wgrave = 0x1e80; 26039 t.Wmonospace = 0xff37; 26040 t.Wsmall = 0xf777; 26041 t.X = 0x0058; 26042 t.Xcircle = 0x24cd; 26043 t.Xdieresis = 0x1e8c; 26044 t.Xdotaccent = 0x1e8a; 26045 t.Xeharmenian = 0x053d; 26046 t.Xi = 0x039e; 26047 t.Xmonospace = 0xff38; 26048 t.Xsmall = 0xf778; 26049 t.Y = 0x0059; 26050 t.Yacute = 0x00dd; 26051 t.Yacutesmall = 0xf7fd; 26052 t.Yatcyrillic = 0x0462; 26053 t.Ycircle = 0x24ce; 26054 t.Ycircumflex = 0x0176; 26055 t.Ydieresis = 0x0178; 26056 t.Ydieresissmall = 0xf7ff; 26057 t.Ydotaccent = 0x1e8e; 26058 t.Ydotbelow = 0x1ef4; 26059 t.Yericyrillic = 0x042b; 26060 t.Yerudieresiscyrillic = 0x04f8; 26061 t.Ygrave = 0x1ef2; 26062 t.Yhook = 0x01b3; 26063 t.Yhookabove = 0x1ef6; 26064 t.Yiarmenian = 0x0545; 26065 t.Yicyrillic = 0x0407; 26066 t.Yiwnarmenian = 0x0552; 26067 t.Ymonospace = 0xff39; 26068 t.Ysmall = 0xf779; 26069 t.Ytilde = 0x1ef8; 26070 t.Yusbigcyrillic = 0x046a; 26071 t.Yusbigiotifiedcyrillic = 0x046c; 26072 t.Yuslittlecyrillic = 0x0466; 26073 t.Yuslittleiotifiedcyrillic = 0x0468; 26074 t.Z = 0x005a; 26075 t.Zaarmenian = 0x0536; 26076 t.Zacute = 0x0179; 26077 t.Zcaron = 0x017d; 26078 t.Zcaronsmall = 0xf6ff; 26079 t.Zcircle = 0x24cf; 26080 t.Zcircumflex = 0x1e90; 26081 t.Zdot = 0x017b; 26082 t.Zdotaccent = 0x017b; 26083 t.Zdotbelow = 0x1e92; 26084 t.Zecyrillic = 0x0417; 26085 t.Zedescendercyrillic = 0x0498; 26086 t.Zedieresiscyrillic = 0x04de; 26087 t.Zeta = 0x0396; 26088 t.Zhearmenian = 0x053a; 26089 t.Zhebrevecyrillic = 0x04c1; 26090 t.Zhecyrillic = 0x0416; 26091 t.Zhedescendercyrillic = 0x0496; 26092 t.Zhedieresiscyrillic = 0x04dc; 26093 t.Zlinebelow = 0x1e94; 26094 t.Zmonospace = 0xff3a; 26095 t.Zsmall = 0xf77a; 26096 t.Zstroke = 0x01b5; 26097 t.a = 0x0061; 26098 t.aabengali = 0x0986; 26099 t.aacute = 0x00e1; 26100 t.aadeva = 0x0906; 26101 t.aagujarati = 0x0a86; 26102 t.aagurmukhi = 0x0a06; 26103 t.aamatragurmukhi = 0x0a3e; 26104 t.aarusquare = 0x3303; 26105 t.aavowelsignbengali = 0x09be; 26106 t.aavowelsigndeva = 0x093e; 26107 t.aavowelsigngujarati = 0x0abe; 26108 t.abbreviationmarkarmenian = 0x055f; 26109 t.abbreviationsigndeva = 0x0970; 26110 t.abengali = 0x0985; 26111 t.abopomofo = 0x311a; 26112 t.abreve = 0x0103; 26113 t.abreveacute = 0x1eaf; 26114 t.abrevecyrillic = 0x04d1; 26115 t.abrevedotbelow = 0x1eb7; 26116 t.abrevegrave = 0x1eb1; 26117 t.abrevehookabove = 0x1eb3; 26118 t.abrevetilde = 0x1eb5; 26119 t.acaron = 0x01ce; 26120 t.acircle = 0x24d0; 26121 t.acircumflex = 0x00e2; 26122 t.acircumflexacute = 0x1ea5; 26123 t.acircumflexdotbelow = 0x1ead; 26124 t.acircumflexgrave = 0x1ea7; 26125 t.acircumflexhookabove = 0x1ea9; 26126 t.acircumflextilde = 0x1eab; 26127 t.acute = 0x00b4; 26128 t.acutebelowcmb = 0x0317; 26129 t.acutecmb = 0x0301; 26130 t.acutecomb = 0x0301; 26131 t.acutedeva = 0x0954; 26132 t.acutelowmod = 0x02cf; 26133 t.acutetonecmb = 0x0341; 26134 t.acyrillic = 0x0430; 26135 t.adblgrave = 0x0201; 26136 t.addakgurmukhi = 0x0a71; 26137 t.adeva = 0x0905; 26138 t.adieresis = 0x00e4; 26139 t.adieresiscyrillic = 0x04d3; 26140 t.adieresismacron = 0x01df; 26141 t.adotbelow = 0x1ea1; 26142 t.adotmacron = 0x01e1; 26143 t.ae = 0x00e6; 26144 t.aeacute = 0x01fd; 26145 t.aekorean = 0x3150; 26146 t.aemacron = 0x01e3; 26147 t.afii00208 = 0x2015; 26148 t.afii08941 = 0x20a4; 26149 t.afii10017 = 0x0410; 26150 t.afii10018 = 0x0411; 26151 t.afii10019 = 0x0412; 26152 t.afii10020 = 0x0413; 26153 t.afii10021 = 0x0414; 26154 t.afii10022 = 0x0415; 26155 t.afii10023 = 0x0401; 26156 t.afii10024 = 0x0416; 26157 t.afii10025 = 0x0417; 26158 t.afii10026 = 0x0418; 26159 t.afii10027 = 0x0419; 26160 t.afii10028 = 0x041a; 26161 t.afii10029 = 0x041b; 26162 t.afii10030 = 0x041c; 26163 t.afii10031 = 0x041d; 26164 t.afii10032 = 0x041e; 26165 t.afii10033 = 0x041f; 26166 t.afii10034 = 0x0420; 26167 t.afii10035 = 0x0421; 26168 t.afii10036 = 0x0422; 26169 t.afii10037 = 0x0423; 26170 t.afii10038 = 0x0424; 26171 t.afii10039 = 0x0425; 26172 t.afii10040 = 0x0426; 26173 t.afii10041 = 0x0427; 26174 t.afii10042 = 0x0428; 26175 t.afii10043 = 0x0429; 26176 t.afii10044 = 0x042a; 26177 t.afii10045 = 0x042b; 26178 t.afii10046 = 0x042c; 26179 t.afii10047 = 0x042d; 26180 t.afii10048 = 0x042e; 26181 t.afii10049 = 0x042f; 26182 t.afii10050 = 0x0490; 26183 t.afii10051 = 0x0402; 26184 t.afii10052 = 0x0403; 26185 t.afii10053 = 0x0404; 26186 t.afii10054 = 0x0405; 26187 t.afii10055 = 0x0406; 26188 t.afii10056 = 0x0407; 26189 t.afii10057 = 0x0408; 26190 t.afii10058 = 0x0409; 26191 t.afii10059 = 0x040a; 26192 t.afii10060 = 0x040b; 26193 t.afii10061 = 0x040c; 26194 t.afii10062 = 0x040e; 26195 t.afii10063 = 0xf6c4; 26196 t.afii10064 = 0xf6c5; 26197 t.afii10065 = 0x0430; 26198 t.afii10066 = 0x0431; 26199 t.afii10067 = 0x0432; 26200 t.afii10068 = 0x0433; 26201 t.afii10069 = 0x0434; 26202 t.afii10070 = 0x0435; 26203 t.afii10071 = 0x0451; 26204 t.afii10072 = 0x0436; 26205 t.afii10073 = 0x0437; 26206 t.afii10074 = 0x0438; 26207 t.afii10075 = 0x0439; 26208 t.afii10076 = 0x043a; 26209 t.afii10077 = 0x043b; 26210 t.afii10078 = 0x043c; 26211 t.afii10079 = 0x043d; 26212 t.afii10080 = 0x043e; 26213 t.afii10081 = 0x043f; 26214 t.afii10082 = 0x0440; 26215 t.afii10083 = 0x0441; 26216 t.afii10084 = 0x0442; 26217 t.afii10085 = 0x0443; 26218 t.afii10086 = 0x0444; 26219 t.afii10087 = 0x0445; 26220 t.afii10088 = 0x0446; 26221 t.afii10089 = 0x0447; 26222 t.afii10090 = 0x0448; 26223 t.afii10091 = 0x0449; 26224 t.afii10092 = 0x044a; 26225 t.afii10093 = 0x044b; 26226 t.afii10094 = 0x044c; 26227 t.afii10095 = 0x044d; 26228 t.afii10096 = 0x044e; 26229 t.afii10097 = 0x044f; 26230 t.afii10098 = 0x0491; 26231 t.afii10099 = 0x0452; 26232 t.afii10100 = 0x0453; 26233 t.afii10101 = 0x0454; 26234 t.afii10102 = 0x0455; 26235 t.afii10103 = 0x0456; 26236 t.afii10104 = 0x0457; 26237 t.afii10105 = 0x0458; 26238 t.afii10106 = 0x0459; 26239 t.afii10107 = 0x045a; 26240 t.afii10108 = 0x045b; 26241 t.afii10109 = 0x045c; 26242 t.afii10110 = 0x045e; 26243 t.afii10145 = 0x040f; 26244 t.afii10146 = 0x0462; 26245 t.afii10147 = 0x0472; 26246 t.afii10148 = 0x0474; 26247 t.afii10192 = 0xf6c6; 26248 t.afii10193 = 0x045f; 26249 t.afii10194 = 0x0463; 26250 t.afii10195 = 0x0473; 26251 t.afii10196 = 0x0475; 26252 t.afii10831 = 0xf6c7; 26253 t.afii10832 = 0xf6c8; 26254 t.afii10846 = 0x04d9; 26255 t.afii299 = 0x200e; 26256 t.afii300 = 0x200f; 26257 t.afii301 = 0x200d; 26258 t.afii57381 = 0x066a; 26259 t.afii57388 = 0x060c; 26260 t.afii57392 = 0x0660; 26261 t.afii57393 = 0x0661; 26262 t.afii57394 = 0x0662; 26263 t.afii57395 = 0x0663; 26264 t.afii57396 = 0x0664; 26265 t.afii57397 = 0x0665; 26266 t.afii57398 = 0x0666; 26267 t.afii57399 = 0x0667; 26268 t.afii57400 = 0x0668; 26269 t.afii57401 = 0x0669; 26270 t.afii57403 = 0x061b; 26271 t.afii57407 = 0x061f; 26272 t.afii57409 = 0x0621; 26273 t.afii57410 = 0x0622; 26274 t.afii57411 = 0x0623; 26275 t.afii57412 = 0x0624; 26276 t.afii57413 = 0x0625; 26277 t.afii57414 = 0x0626; 26278 t.afii57415 = 0x0627; 26279 t.afii57416 = 0x0628; 26280 t.afii57417 = 0x0629; 26281 t.afii57418 = 0x062a; 26282 t.afii57419 = 0x062b; 26283 t.afii57420 = 0x062c; 26284 t.afii57421 = 0x062d; 26285 t.afii57422 = 0x062e; 26286 t.afii57423 = 0x062f; 26287 t.afii57424 = 0x0630; 26288 t.afii57425 = 0x0631; 26289 t.afii57426 = 0x0632; 26290 t.afii57427 = 0x0633; 26291 t.afii57428 = 0x0634; 26292 t.afii57429 = 0x0635; 26293 t.afii57430 = 0x0636; 26294 t.afii57431 = 0x0637; 26295 t.afii57432 = 0x0638; 26296 t.afii57433 = 0x0639; 26297 t.afii57434 = 0x063a; 26298 t.afii57440 = 0x0640; 26299 t.afii57441 = 0x0641; 26300 t.afii57442 = 0x0642; 26301 t.afii57443 = 0x0643; 26302 t.afii57444 = 0x0644; 26303 t.afii57445 = 0x0645; 26304 t.afii57446 = 0x0646; 26305 t.afii57448 = 0x0648; 26306 t.afii57449 = 0x0649; 26307 t.afii57450 = 0x064a; 26308 t.afii57451 = 0x064b; 26309 t.afii57452 = 0x064c; 26310 t.afii57453 = 0x064d; 26311 t.afii57454 = 0x064e; 26312 t.afii57455 = 0x064f; 26313 t.afii57456 = 0x0650; 26314 t.afii57457 = 0x0651; 26315 t.afii57458 = 0x0652; 26316 t.afii57470 = 0x0647; 26317 t.afii57505 = 0x06a4; 26318 t.afii57506 = 0x067e; 26319 t.afii57507 = 0x0686; 26320 t.afii57508 = 0x0698; 26321 t.afii57509 = 0x06af; 26322 t.afii57511 = 0x0679; 26323 t.afii57512 = 0x0688; 26324 t.afii57513 = 0x0691; 26325 t.afii57514 = 0x06ba; 26326 t.afii57519 = 0x06d2; 26327 t.afii57534 = 0x06d5; 26328 t.afii57636 = 0x20aa; 26329 t.afii57645 = 0x05be; 26330 t.afii57658 = 0x05c3; 26331 t.afii57664 = 0x05d0; 26332 t.afii57665 = 0x05d1; 26333 t.afii57666 = 0x05d2; 26334 t.afii57667 = 0x05d3; 26335 t.afii57668 = 0x05d4; 26336 t.afii57669 = 0x05d5; 26337 t.afii57670 = 0x05d6; 26338 t.afii57671 = 0x05d7; 26339 t.afii57672 = 0x05d8; 26340 t.afii57673 = 0x05d9; 26341 t.afii57674 = 0x05da; 26342 t.afii57675 = 0x05db; 26343 t.afii57676 = 0x05dc; 26344 t.afii57677 = 0x05dd; 26345 t.afii57678 = 0x05de; 26346 t.afii57679 = 0x05df; 26347 t.afii57680 = 0x05e0; 26348 t.afii57681 = 0x05e1; 26349 t.afii57682 = 0x05e2; 26350 t.afii57683 = 0x05e3; 26351 t.afii57684 = 0x05e4; 26352 t.afii57685 = 0x05e5; 26353 t.afii57686 = 0x05e6; 26354 t.afii57687 = 0x05e7; 26355 t.afii57688 = 0x05e8; 26356 t.afii57689 = 0x05e9; 26357 t.afii57690 = 0x05ea; 26358 t.afii57694 = 0xfb2a; 26359 t.afii57695 = 0xfb2b; 26360 t.afii57700 = 0xfb4b; 26361 t.afii57705 = 0xfb1f; 26362 t.afii57716 = 0x05f0; 26363 t.afii57717 = 0x05f1; 26364 t.afii57718 = 0x05f2; 26365 t.afii57723 = 0xfb35; 26366 t.afii57793 = 0x05b4; 26367 t.afii57794 = 0x05b5; 26368 t.afii57795 = 0x05b6; 26369 t.afii57796 = 0x05bb; 26370 t.afii57797 = 0x05b8; 26371 t.afii57798 = 0x05b7; 26372 t.afii57799 = 0x05b0; 26373 t.afii57800 = 0x05b2; 26374 t.afii57801 = 0x05b1; 26375 t.afii57802 = 0x05b3; 26376 t.afii57803 = 0x05c2; 26377 t.afii57804 = 0x05c1; 26378 t.afii57806 = 0x05b9; 26379 t.afii57807 = 0x05bc; 26380 t.afii57839 = 0x05bd; 26381 t.afii57841 = 0x05bf; 26382 t.afii57842 = 0x05c0; 26383 t.afii57929 = 0x02bc; 26384 t.afii61248 = 0x2105; 26385 t.afii61289 = 0x2113; 26386 t.afii61352 = 0x2116; 26387 t.afii61573 = 0x202c; 26388 t.afii61574 = 0x202d; 26389 t.afii61575 = 0x202e; 26390 t.afii61664 = 0x200c; 26391 t.afii63167 = 0x066d; 26392 t.afii64937 = 0x02bd; 26393 t.agrave = 0x00e0; 26394 t.agujarati = 0x0a85; 26395 t.agurmukhi = 0x0a05; 26396 t.ahiragana = 0x3042; 26397 t.ahookabove = 0x1ea3; 26398 t.aibengali = 0x0990; 26399 t.aibopomofo = 0x311e; 26400 t.aideva = 0x0910; 26401 t.aiecyrillic = 0x04d5; 26402 t.aigujarati = 0x0a90; 26403 t.aigurmukhi = 0x0a10; 26404 t.aimatragurmukhi = 0x0a48; 26405 t.ainarabic = 0x0639; 26406 t.ainfinalarabic = 0xfeca; 26407 t.aininitialarabic = 0xfecb; 26408 t.ainmedialarabic = 0xfecc; 26409 t.ainvertedbreve = 0x0203; 26410 t.aivowelsignbengali = 0x09c8; 26411 t.aivowelsigndeva = 0x0948; 26412 t.aivowelsigngujarati = 0x0ac8; 26413 t.akatakana = 0x30a2; 26414 t.akatakanahalfwidth = 0xff71; 26415 t.akorean = 0x314f; 26416 t.alef = 0x05d0; 26417 t.alefarabic = 0x0627; 26418 t.alefdageshhebrew = 0xfb30; 26419 t.aleffinalarabic = 0xfe8e; 26420 t.alefhamzaabovearabic = 0x0623; 26421 t.alefhamzaabovefinalarabic = 0xfe84; 26422 t.alefhamzabelowarabic = 0x0625; 26423 t.alefhamzabelowfinalarabic = 0xfe88; 26424 t.alefhebrew = 0x05d0; 26425 t.aleflamedhebrew = 0xfb4f; 26426 t.alefmaddaabovearabic = 0x0622; 26427 t.alefmaddaabovefinalarabic = 0xfe82; 26428 t.alefmaksuraarabic = 0x0649; 26429 t.alefmaksurafinalarabic = 0xfef0; 26430 t.alefmaksurainitialarabic = 0xfef3; 26431 t.alefmaksuramedialarabic = 0xfef4; 26432 t.alefpatahhebrew = 0xfb2e; 26433 t.alefqamatshebrew = 0xfb2f; 26434 t.aleph = 0x2135; 26435 t.allequal = 0x224c; 26436 t.alpha = 0x03b1; 26437 t.alphatonos = 0x03ac; 26438 t.amacron = 0x0101; 26439 t.amonospace = 0xff41; 26440 t.ampersand = 0x0026; 26441 t.ampersandmonospace = 0xff06; 26442 t.ampersandsmall = 0xf726; 26443 t.amsquare = 0x33c2; 26444 t.anbopomofo = 0x3122; 26445 t.angbopomofo = 0x3124; 26446 t.angbracketleft = 0x3008; 26447 t.angbracketright = 0x3009; 26448 t.angkhankhuthai = 0x0e5a; 26449 t.angle = 0x2220; 26450 t.anglebracketleft = 0x3008; 26451 t.anglebracketleftvertical = 0xfe3f; 26452 t.anglebracketright = 0x3009; 26453 t.anglebracketrightvertical = 0xfe40; 26454 t.angleleft = 0x2329; 26455 t.angleright = 0x232a; 26456 t.angstrom = 0x212b; 26457 t.anoteleia = 0x0387; 26458 t.anudattadeva = 0x0952; 26459 t.anusvarabengali = 0x0982; 26460 t.anusvaradeva = 0x0902; 26461 t.anusvaragujarati = 0x0a82; 26462 t.aogonek = 0x0105; 26463 t.apaatosquare = 0x3300; 26464 t.aparen = 0x249c; 26465 t.apostrophearmenian = 0x055a; 26466 t.apostrophemod = 0x02bc; 26467 t.apple = 0xf8ff; 26468 t.approaches = 0x2250; 26469 t.approxequal = 0x2248; 26470 t.approxequalorimage = 0x2252; 26471 t.approximatelyequal = 0x2245; 26472 t.araeaekorean = 0x318e; 26473 t.araeakorean = 0x318d; 26474 t.arc = 0x2312; 26475 t.arighthalfring = 0x1e9a; 26476 t.aring = 0x00e5; 26477 t.aringacute = 0x01fb; 26478 t.aringbelow = 0x1e01; 26479 t.arrowboth = 0x2194; 26480 t.arrowdashdown = 0x21e3; 26481 t.arrowdashleft = 0x21e0; 26482 t.arrowdashright = 0x21e2; 26483 t.arrowdashup = 0x21e1; 26484 t.arrowdblboth = 0x21d4; 26485 t.arrowdbldown = 0x21d3; 26486 t.arrowdblleft = 0x21d0; 26487 t.arrowdblright = 0x21d2; 26488 t.arrowdblup = 0x21d1; 26489 t.arrowdown = 0x2193; 26490 t.arrowdownleft = 0x2199; 26491 t.arrowdownright = 0x2198; 26492 t.arrowdownwhite = 0x21e9; 26493 t.arrowheaddownmod = 0x02c5; 26494 t.arrowheadleftmod = 0x02c2; 26495 t.arrowheadrightmod = 0x02c3; 26496 t.arrowheadupmod = 0x02c4; 26497 t.arrowhorizex = 0xf8e7; 26498 t.arrowleft = 0x2190; 26499 t.arrowleftdbl = 0x21d0; 26500 t.arrowleftdblstroke = 0x21cd; 26501 t.arrowleftoverright = 0x21c6; 26502 t.arrowleftwhite = 0x21e6; 26503 t.arrowright = 0x2192; 26504 t.arrowrightdblstroke = 0x21cf; 26505 t.arrowrightheavy = 0x279e; 26506 t.arrowrightoverleft = 0x21c4; 26507 t.arrowrightwhite = 0x21e8; 26508 t.arrowtableft = 0x21e4; 26509 t.arrowtabright = 0x21e5; 26510 t.arrowup = 0x2191; 26511 t.arrowupdn = 0x2195; 26512 t.arrowupdnbse = 0x21a8; 26513 t.arrowupdownbase = 0x21a8; 26514 t.arrowupleft = 0x2196; 26515 t.arrowupleftofdown = 0x21c5; 26516 t.arrowupright = 0x2197; 26517 t.arrowupwhite = 0x21e7; 26518 t.arrowvertex = 0xf8e6; 26519 t.asciicircum = 0x005e; 26520 t.asciicircummonospace = 0xff3e; 26521 t.asciitilde = 0x007e; 26522 t.asciitildemonospace = 0xff5e; 26523 t.ascript = 0x0251; 26524 t.ascriptturned = 0x0252; 26525 t.asmallhiragana = 0x3041; 26526 t.asmallkatakana = 0x30a1; 26527 t.asmallkatakanahalfwidth = 0xff67; 26528 t.asterisk = 0x002a; 26529 t.asteriskaltonearabic = 0x066d; 26530 t.asteriskarabic = 0x066d; 26531 t.asteriskmath = 0x2217; 26532 t.asteriskmonospace = 0xff0a; 26533 t.asterisksmall = 0xfe61; 26534 t.asterism = 0x2042; 26535 t.asuperior = 0xf6e9; 26536 t.asymptoticallyequal = 0x2243; 26537 t.at = 0x0040; 26538 t.atilde = 0x00e3; 26539 t.atmonospace = 0xff20; 26540 t.atsmall = 0xfe6b; 26541 t.aturned = 0x0250; 26542 t.aubengali = 0x0994; 26543 t.aubopomofo = 0x3120; 26544 t.audeva = 0x0914; 26545 t.augujarati = 0x0a94; 26546 t.augurmukhi = 0x0a14; 26547 t.aulengthmarkbengali = 0x09d7; 26548 t.aumatragurmukhi = 0x0a4c; 26549 t.auvowelsignbengali = 0x09cc; 26550 t.auvowelsigndeva = 0x094c; 26551 t.auvowelsigngujarati = 0x0acc; 26552 t.avagrahadeva = 0x093d; 26553 t.aybarmenian = 0x0561; 26554 t.ayin = 0x05e2; 26555 t.ayinaltonehebrew = 0xfb20; 26556 t.ayinhebrew = 0x05e2; 26557 t.b = 0x0062; 26558 t.babengali = 0x09ac; 26559 t.backslash = 0x005c; 26560 t.backslashmonospace = 0xff3c; 26561 t.badeva = 0x092c; 26562 t.bagujarati = 0x0aac; 26563 t.bagurmukhi = 0x0a2c; 26564 t.bahiragana = 0x3070; 26565 t.bahtthai = 0x0e3f; 26566 t.bakatakana = 0x30d0; 26567 t.bar = 0x007c; 26568 t.barmonospace = 0xff5c; 26569 t.bbopomofo = 0x3105; 26570 t.bcircle = 0x24d1; 26571 t.bdotaccent = 0x1e03; 26572 t.bdotbelow = 0x1e05; 26573 t.beamedsixteenthnotes = 0x266c; 26574 t.because = 0x2235; 26575 t.becyrillic = 0x0431; 26576 t.beharabic = 0x0628; 26577 t.behfinalarabic = 0xfe90; 26578 t.behinitialarabic = 0xfe91; 26579 t.behiragana = 0x3079; 26580 t.behmedialarabic = 0xfe92; 26581 t.behmeeminitialarabic = 0xfc9f; 26582 t.behmeemisolatedarabic = 0xfc08; 26583 t.behnoonfinalarabic = 0xfc6d; 26584 t.bekatakana = 0x30d9; 26585 t.benarmenian = 0x0562; 26586 t.bet = 0x05d1; 26587 t.beta = 0x03b2; 26588 t.betasymbolgreek = 0x03d0; 26589 t.betdagesh = 0xfb31; 26590 t.betdageshhebrew = 0xfb31; 26591 t.bethebrew = 0x05d1; 26592 t.betrafehebrew = 0xfb4c; 26593 t.bhabengali = 0x09ad; 26594 t.bhadeva = 0x092d; 26595 t.bhagujarati = 0x0aad; 26596 t.bhagurmukhi = 0x0a2d; 26597 t.bhook = 0x0253; 26598 t.bihiragana = 0x3073; 26599 t.bikatakana = 0x30d3; 26600 t.bilabialclick = 0x0298; 26601 t.bindigurmukhi = 0x0a02; 26602 t.birusquare = 0x3331; 26603 t.blackcircle = 0x25cf; 26604 t.blackdiamond = 0x25c6; 26605 t.blackdownpointingtriangle = 0x25bc; 26606 t.blackleftpointingpointer = 0x25c4; 26607 t.blackleftpointingtriangle = 0x25c0; 26608 t.blacklenticularbracketleft = 0x3010; 26609 t.blacklenticularbracketleftvertical = 0xfe3b; 26610 t.blacklenticularbracketright = 0x3011; 26611 t.blacklenticularbracketrightvertical = 0xfe3c; 26612 t.blacklowerlefttriangle = 0x25e3; 26613 t.blacklowerrighttriangle = 0x25e2; 26614 t.blackrectangle = 0x25ac; 26615 t.blackrightpointingpointer = 0x25ba; 26616 t.blackrightpointingtriangle = 0x25b6; 26617 t.blacksmallsquare = 0x25aa; 26618 t.blacksmilingface = 0x263b; 26619 t.blacksquare = 0x25a0; 26620 t.blackstar = 0x2605; 26621 t.blackupperlefttriangle = 0x25e4; 26622 t.blackupperrighttriangle = 0x25e5; 26623 t.blackuppointingsmalltriangle = 0x25b4; 26624 t.blackuppointingtriangle = 0x25b2; 26625 t.blank = 0x2423; 26626 t.blinebelow = 0x1e07; 26627 t.block = 0x2588; 26628 t.bmonospace = 0xff42; 26629 t.bobaimaithai = 0x0e1a; 26630 t.bohiragana = 0x307c; 26631 t.bokatakana = 0x30dc; 26632 t.bparen = 0x249d; 26633 t.bqsquare = 0x33c3; 26634 t.braceex = 0xf8f4; 26635 t.braceleft = 0x007b; 26636 t.braceleftbt = 0xf8f3; 26637 t.braceleftmid = 0xf8f2; 26638 t.braceleftmonospace = 0xff5b; 26639 t.braceleftsmall = 0xfe5b; 26640 t.bracelefttp = 0xf8f1; 26641 t.braceleftvertical = 0xfe37; 26642 t.braceright = 0x007d; 26643 t.bracerightbt = 0xf8fe; 26644 t.bracerightmid = 0xf8fd; 26645 t.bracerightmonospace = 0xff5d; 26646 t.bracerightsmall = 0xfe5c; 26647 t.bracerighttp = 0xf8fc; 26648 t.bracerightvertical = 0xfe38; 26649 t.bracketleft = 0x005b; 26650 t.bracketleftbt = 0xf8f0; 26651 t.bracketleftex = 0xf8ef; 26652 t.bracketleftmonospace = 0xff3b; 26653 t.bracketlefttp = 0xf8ee; 26654 t.bracketright = 0x005d; 26655 t.bracketrightbt = 0xf8fb; 26656 t.bracketrightex = 0xf8fa; 26657 t.bracketrightmonospace = 0xff3d; 26658 t.bracketrighttp = 0xf8f9; 26659 t.breve = 0x02d8; 26660 t.brevebelowcmb = 0x032e; 26661 t.brevecmb = 0x0306; 26662 t.breveinvertedbelowcmb = 0x032f; 26663 t.breveinvertedcmb = 0x0311; 26664 t.breveinverteddoublecmb = 0x0361; 26665 t.bridgebelowcmb = 0x032a; 26666 t.bridgeinvertedbelowcmb = 0x033a; 26667 t.brokenbar = 0x00a6; 26668 t.bstroke = 0x0180; 26669 t.bsuperior = 0xf6ea; 26670 t.btopbar = 0x0183; 26671 t.buhiragana = 0x3076; 26672 t.bukatakana = 0x30d6; 26673 t.bullet = 0x2022; 26674 t.bulletinverse = 0x25d8; 26675 t.bulletoperator = 0x2219; 26676 t.bullseye = 0x25ce; 26677 t.c = 0x0063; 26678 t.caarmenian = 0x056e; 26679 t.cabengali = 0x099a; 26680 t.cacute = 0x0107; 26681 t.cadeva = 0x091a; 26682 t.cagujarati = 0x0a9a; 26683 t.cagurmukhi = 0x0a1a; 26684 t.calsquare = 0x3388; 26685 t.candrabindubengali = 0x0981; 26686 t.candrabinducmb = 0x0310; 26687 t.candrabindudeva = 0x0901; 26688 t.candrabindugujarati = 0x0a81; 26689 t.capslock = 0x21ea; 26690 t.careof = 0x2105; 26691 t.caron = 0x02c7; 26692 t.caronbelowcmb = 0x032c; 26693 t.caroncmb = 0x030c; 26694 t.carriagereturn = 0x21b5; 26695 t.cbopomofo = 0x3118; 26696 t.ccaron = 0x010d; 26697 t.ccedilla = 0x00e7; 26698 t.ccedillaacute = 0x1e09; 26699 t.ccircle = 0x24d2; 26700 t.ccircumflex = 0x0109; 26701 t.ccurl = 0x0255; 26702 t.cdot = 0x010b; 26703 t.cdotaccent = 0x010b; 26704 t.cdsquare = 0x33c5; 26705 t.cedilla = 0x00b8; 26706 t.cedillacmb = 0x0327; 26707 t.cent = 0x00a2; 26708 t.centigrade = 0x2103; 26709 t.centinferior = 0xf6df; 26710 t.centmonospace = 0xffe0; 26711 t.centoldstyle = 0xf7a2; 26712 t.centsuperior = 0xf6e0; 26713 t.chaarmenian = 0x0579; 26714 t.chabengali = 0x099b; 26715 t.chadeva = 0x091b; 26716 t.chagujarati = 0x0a9b; 26717 t.chagurmukhi = 0x0a1b; 26718 t.chbopomofo = 0x3114; 26719 t.cheabkhasiancyrillic = 0x04bd; 26720 t.checkmark = 0x2713; 26721 t.checyrillic = 0x0447; 26722 t.chedescenderabkhasiancyrillic = 0x04bf; 26723 t.chedescendercyrillic = 0x04b7; 26724 t.chedieresiscyrillic = 0x04f5; 26725 t.cheharmenian = 0x0573; 26726 t.chekhakassiancyrillic = 0x04cc; 26727 t.cheverticalstrokecyrillic = 0x04b9; 26728 t.chi = 0x03c7; 26729 t.chieuchacirclekorean = 0x3277; 26730 t.chieuchaparenkorean = 0x3217; 26731 t.chieuchcirclekorean = 0x3269; 26732 t.chieuchkorean = 0x314a; 26733 t.chieuchparenkorean = 0x3209; 26734 t.chochangthai = 0x0e0a; 26735 t.chochanthai = 0x0e08; 26736 t.chochingthai = 0x0e09; 26737 t.chochoethai = 0x0e0c; 26738 t.chook = 0x0188; 26739 t.cieucacirclekorean = 0x3276; 26740 t.cieucaparenkorean = 0x3216; 26741 t.cieuccirclekorean = 0x3268; 26742 t.cieuckorean = 0x3148; 26743 t.cieucparenkorean = 0x3208; 26744 t.cieucuparenkorean = 0x321c; 26745 t.circle = 0x25cb; 26746 t.circlecopyrt = 0x00a9; 26747 t.circlemultiply = 0x2297; 26748 t.circleot = 0x2299; 26749 t.circleplus = 0x2295; 26750 t.circlepostalmark = 0x3036; 26751 t.circlewithlefthalfblack = 0x25d0; 26752 t.circlewithrighthalfblack = 0x25d1; 26753 t.circumflex = 0x02c6; 26754 t.circumflexbelowcmb = 0x032d; 26755 t.circumflexcmb = 0x0302; 26756 t.clear = 0x2327; 26757 t.clickalveolar = 0x01c2; 26758 t.clickdental = 0x01c0; 26759 t.clicklateral = 0x01c1; 26760 t.clickretroflex = 0x01c3; 26761 t.club = 0x2663; 26762 t.clubsuitblack = 0x2663; 26763 t.clubsuitwhite = 0x2667; 26764 t.cmcubedsquare = 0x33a4; 26765 t.cmonospace = 0xff43; 26766 t.cmsquaredsquare = 0x33a0; 26767 t.coarmenian = 0x0581; 26768 t.colon = 0x003a; 26769 t.colonmonetary = 0x20a1; 26770 t.colonmonospace = 0xff1a; 26771 t.colonsign = 0x20a1; 26772 t.colonsmall = 0xfe55; 26773 t.colontriangularhalfmod = 0x02d1; 26774 t.colontriangularmod = 0x02d0; 26775 t.comma = 0x002c; 26776 t.commaabovecmb = 0x0313; 26777 t.commaaboverightcmb = 0x0315; 26778 t.commaaccent = 0xf6c3; 26779 t.commaarabic = 0x060c; 26780 t.commaarmenian = 0x055d; 26781 t.commainferior = 0xf6e1; 26782 t.commamonospace = 0xff0c; 26783 t.commareversedabovecmb = 0x0314; 26784 t.commareversedmod = 0x02bd; 26785 t.commasmall = 0xfe50; 26786 t.commasuperior = 0xf6e2; 26787 t.commaturnedabovecmb = 0x0312; 26788 t.commaturnedmod = 0x02bb; 26789 t.compass = 0x263c; 26790 t.congruent = 0x2245; 26791 t.contourintegral = 0x222e; 26792 t.control = 0x2303; 26793 t.controlACK = 0x0006; 26794 t.controlBEL = 0x0007; 26795 t.controlBS = 0x0008; 26796 t.controlCAN = 0x0018; 26797 t.controlCR = 0x000d; 26798 t.controlDC1 = 0x0011; 26799 t.controlDC2 = 0x0012; 26800 t.controlDC3 = 0x0013; 26801 t.controlDC4 = 0x0014; 26802 t.controlDEL = 0x007f; 26803 t.controlDLE = 0x0010; 26804 t.controlEM = 0x0019; 26805 t.controlENQ = 0x0005; 26806 t.controlEOT = 0x0004; 26807 t.controlESC = 0x001b; 26808 t.controlETB = 0x0017; 26809 t.controlETX = 0x0003; 26810 t.controlFF = 0x000c; 26811 t.controlFS = 0x001c; 26812 t.controlGS = 0x001d; 26813 t.controlHT = 0x0009; 26814 t.controlLF = 0x000a; 26815 t.controlNAK = 0x0015; 26816 t.controlNULL = 0x0000; 26817 t.controlRS = 0x001e; 26818 t.controlSI = 0x000f; 26819 t.controlSO = 0x000e; 26820 t.controlSOT = 0x0002; 26821 t.controlSTX = 0x0001; 26822 t.controlSUB = 0x001a; 26823 t.controlSYN = 0x0016; 26824 t.controlUS = 0x001f; 26825 t.controlVT = 0x000b; 26826 t.copyright = 0x00a9; 26827 t.copyrightsans = 0xf8e9; 26828 t.copyrightserif = 0xf6d9; 26829 t.cornerbracketleft = 0x300c; 26830 t.cornerbracketlefthalfwidth = 0xff62; 26831 t.cornerbracketleftvertical = 0xfe41; 26832 t.cornerbracketright = 0x300d; 26833 t.cornerbracketrighthalfwidth = 0xff63; 26834 t.cornerbracketrightvertical = 0xfe42; 26835 t.corporationsquare = 0x337f; 26836 t.cosquare = 0x33c7; 26837 t.coverkgsquare = 0x33c6; 26838 t.cparen = 0x249e; 26839 t.cruzeiro = 0x20a2; 26840 t.cstretched = 0x0297; 26841 t.curlyand = 0x22cf; 26842 t.curlyor = 0x22ce; 26843 t.currency = 0x00a4; 26844 t.cyrBreve = 0xf6d1; 26845 t.cyrFlex = 0xf6d2; 26846 t.cyrbreve = 0xf6d4; 26847 t.cyrflex = 0xf6d5; 26848 t.d = 0x0064; 26849 t.daarmenian = 0x0564; 26850 t.dabengali = 0x09a6; 26851 t.dadarabic = 0x0636; 26852 t.dadeva = 0x0926; 26853 t.dadfinalarabic = 0xfebe; 26854 t.dadinitialarabic = 0xfebf; 26855 t.dadmedialarabic = 0xfec0; 26856 t.dagesh = 0x05bc; 26857 t.dageshhebrew = 0x05bc; 26858 t.dagger = 0x2020; 26859 t.daggerdbl = 0x2021; 26860 t.dagujarati = 0x0aa6; 26861 t.dagurmukhi = 0x0a26; 26862 t.dahiragana = 0x3060; 26863 t.dakatakana = 0x30c0; 26864 t.dalarabic = 0x062f; 26865 t.dalet = 0x05d3; 26866 t.daletdagesh = 0xfb33; 26867 t.daletdageshhebrew = 0xfb33; 26868 t.dalethebrew = 0x05d3; 26869 t.dalfinalarabic = 0xfeaa; 26870 t.dammaarabic = 0x064f; 26871 t.dammalowarabic = 0x064f; 26872 t.dammatanaltonearabic = 0x064c; 26873 t.dammatanarabic = 0x064c; 26874 t.danda = 0x0964; 26875 t.dargahebrew = 0x05a7; 26876 t.dargalefthebrew = 0x05a7; 26877 t.dasiapneumatacyrilliccmb = 0x0485; 26878 t.dblGrave = 0xf6d3; 26879 t.dblanglebracketleft = 0x300a; 26880 t.dblanglebracketleftvertical = 0xfe3d; 26881 t.dblanglebracketright = 0x300b; 26882 t.dblanglebracketrightvertical = 0xfe3e; 26883 t.dblarchinvertedbelowcmb = 0x032b; 26884 t.dblarrowleft = 0x21d4; 26885 t.dblarrowright = 0x21d2; 26886 t.dbldanda = 0x0965; 26887 t.dblgrave = 0xf6d6; 26888 t.dblgravecmb = 0x030f; 26889 t.dblintegral = 0x222c; 26890 t.dbllowline = 0x2017; 26891 t.dbllowlinecmb = 0x0333; 26892 t.dbloverlinecmb = 0x033f; 26893 t.dblprimemod = 0x02ba; 26894 t.dblverticalbar = 0x2016; 26895 t.dblverticallineabovecmb = 0x030e; 26896 t.dbopomofo = 0x3109; 26897 t.dbsquare = 0x33c8; 26898 t.dcaron = 0x010f; 26899 t.dcedilla = 0x1e11; 26900 t.dcircle = 0x24d3; 26901 t.dcircumflexbelow = 0x1e13; 26902 t.dcroat = 0x0111; 26903 t.ddabengali = 0x09a1; 26904 t.ddadeva = 0x0921; 26905 t.ddagujarati = 0x0aa1; 26906 t.ddagurmukhi = 0x0a21; 26907 t.ddalarabic = 0x0688; 26908 t.ddalfinalarabic = 0xfb89; 26909 t.dddhadeva = 0x095c; 26910 t.ddhabengali = 0x09a2; 26911 t.ddhadeva = 0x0922; 26912 t.ddhagujarati = 0x0aa2; 26913 t.ddhagurmukhi = 0x0a22; 26914 t.ddotaccent = 0x1e0b; 26915 t.ddotbelow = 0x1e0d; 26916 t.decimalseparatorarabic = 0x066b; 26917 t.decimalseparatorpersian = 0x066b; 26918 t.decyrillic = 0x0434; 26919 t.degree = 0x00b0; 26920 t.dehihebrew = 0x05ad; 26921 t.dehiragana = 0x3067; 26922 t.deicoptic = 0x03ef; 26923 t.dekatakana = 0x30c7; 26924 t.deleteleft = 0x232b; 26925 t.deleteright = 0x2326; 26926 t.delta = 0x03b4; 26927 t.deltaturned = 0x018d; 26928 t.denominatorminusonenumeratorbengali = 0x09f8; 26929 t.dezh = 0x02a4; 26930 t.dhabengali = 0x09a7; 26931 t.dhadeva = 0x0927; 26932 t.dhagujarati = 0x0aa7; 26933 t.dhagurmukhi = 0x0a27; 26934 t.dhook = 0x0257; 26935 t.dialytikatonos = 0x0385; 26936 t.dialytikatonoscmb = 0x0344; 26937 t.diamond = 0x2666; 26938 t.diamondsuitwhite = 0x2662; 26939 t.dieresis = 0x00a8; 26940 t.dieresisacute = 0xf6d7; 26941 t.dieresisbelowcmb = 0x0324; 26942 t.dieresiscmb = 0x0308; 26943 t.dieresisgrave = 0xf6d8; 26944 t.dieresistonos = 0x0385; 26945 t.dihiragana = 0x3062; 26946 t.dikatakana = 0x30c2; 26947 t.dittomark = 0x3003; 26948 t.divide = 0x00f7; 26949 t.divides = 0x2223; 26950 t.divisionslash = 0x2215; 26951 t.djecyrillic = 0x0452; 26952 t.dkshade = 0x2593; 26953 t.dlinebelow = 0x1e0f; 26954 t.dlsquare = 0x3397; 26955 t.dmacron = 0x0111; 26956 t.dmonospace = 0xff44; 26957 t.dnblock = 0x2584; 26958 t.dochadathai = 0x0e0e; 26959 t.dodekthai = 0x0e14; 26960 t.dohiragana = 0x3069; 26961 t.dokatakana = 0x30c9; 26962 t.dollar = 0x0024; 26963 t.dollarinferior = 0xf6e3; 26964 t.dollarmonospace = 0xff04; 26965 t.dollaroldstyle = 0xf724; 26966 t.dollarsmall = 0xfe69; 26967 t.dollarsuperior = 0xf6e4; 26968 t.dong = 0x20ab; 26969 t.dorusquare = 0x3326; 26970 t.dotaccent = 0x02d9; 26971 t.dotaccentcmb = 0x0307; 26972 t.dotbelowcmb = 0x0323; 26973 t.dotbelowcomb = 0x0323; 26974 t.dotkatakana = 0x30fb; 26975 t.dotlessi = 0x0131; 26976 t.dotlessj = 0xf6be; 26977 t.dotlessjstrokehook = 0x0284; 26978 t.dotmath = 0x22c5; 26979 t.dottedcircle = 0x25cc; 26980 t.doubleyodpatah = 0xfb1f; 26981 t.doubleyodpatahhebrew = 0xfb1f; 26982 t.downtackbelowcmb = 0x031e; 26983 t.downtackmod = 0x02d5; 26984 t.dparen = 0x249f; 26985 t.dsuperior = 0xf6eb; 26986 t.dtail = 0x0256; 26987 t.dtopbar = 0x018c; 26988 t.duhiragana = 0x3065; 26989 t.dukatakana = 0x30c5; 26990 t.dz = 0x01f3; 26991 t.dzaltone = 0x02a3; 26992 t.dzcaron = 0x01c6; 26993 t.dzcurl = 0x02a5; 26994 t.dzeabkhasiancyrillic = 0x04e1; 26995 t.dzecyrillic = 0x0455; 26996 t.dzhecyrillic = 0x045f; 26997 t.e = 0x0065; 26998 t.eacute = 0x00e9; 26999 t.earth = 0x2641; 27000 t.ebengali = 0x098f; 27001 t.ebopomofo = 0x311c; 27002 t.ebreve = 0x0115; 27003 t.ecandradeva = 0x090d; 27004 t.ecandragujarati = 0x0a8d; 27005 t.ecandravowelsigndeva = 0x0945; 27006 t.ecandravowelsigngujarati = 0x0ac5; 27007 t.ecaron = 0x011b; 27008 t.ecedillabreve = 0x1e1d; 27009 t.echarmenian = 0x0565; 27010 t.echyiwnarmenian = 0x0587; 27011 t.ecircle = 0x24d4; 27012 t.ecircumflex = 0x00ea; 27013 t.ecircumflexacute = 0x1ebf; 27014 t.ecircumflexbelow = 0x1e19; 27015 t.ecircumflexdotbelow = 0x1ec7; 27016 t.ecircumflexgrave = 0x1ec1; 27017 t.ecircumflexhookabove = 0x1ec3; 27018 t.ecircumflextilde = 0x1ec5; 27019 t.ecyrillic = 0x0454; 27020 t.edblgrave = 0x0205; 27021 t.edeva = 0x090f; 27022 t.edieresis = 0x00eb; 27023 t.edot = 0x0117; 27024 t.edotaccent = 0x0117; 27025 t.edotbelow = 0x1eb9; 27026 t.eegurmukhi = 0x0a0f; 27027 t.eematragurmukhi = 0x0a47; 27028 t.efcyrillic = 0x0444; 27029 t.egrave = 0x00e8; 27030 t.egujarati = 0x0a8f; 27031 t.eharmenian = 0x0567; 27032 t.ehbopomofo = 0x311d; 27033 t.ehiragana = 0x3048; 27034 t.ehookabove = 0x1ebb; 27035 t.eibopomofo = 0x311f; 27036 t.eight = 0x0038; 27037 t.eightarabic = 0x0668; 27038 t.eightbengali = 0x09ee; 27039 t.eightcircle = 0x2467; 27040 t.eightcircleinversesansserif = 0x2791; 27041 t.eightdeva = 0x096e; 27042 t.eighteencircle = 0x2471; 27043 t.eighteenparen = 0x2485; 27044 t.eighteenperiod = 0x2499; 27045 t.eightgujarati = 0x0aee; 27046 t.eightgurmukhi = 0x0a6e; 27047 t.eighthackarabic = 0x0668; 27048 t.eighthangzhou = 0x3028; 27049 t.eighthnotebeamed = 0x266b; 27050 t.eightideographicparen = 0x3227; 27051 t.eightinferior = 0x2088; 27052 t.eightmonospace = 0xff18; 27053 t.eightoldstyle = 0xf738; 27054 t.eightparen = 0x247b; 27055 t.eightperiod = 0x248f; 27056 t.eightpersian = 0x06f8; 27057 t.eightroman = 0x2177; 27058 t.eightsuperior = 0x2078; 27059 t.eightthai = 0x0e58; 27060 t.einvertedbreve = 0x0207; 27061 t.eiotifiedcyrillic = 0x0465; 27062 t.ekatakana = 0x30a8; 27063 t.ekatakanahalfwidth = 0xff74; 27064 t.ekonkargurmukhi = 0x0a74; 27065 t.ekorean = 0x3154; 27066 t.elcyrillic = 0x043b; 27067 t.element = 0x2208; 27068 t.elevencircle = 0x246a; 27069 t.elevenparen = 0x247e; 27070 t.elevenperiod = 0x2492; 27071 t.elevenroman = 0x217a; 27072 t.ellipsis = 0x2026; 27073 t.ellipsisvertical = 0x22ee; 27074 t.emacron = 0x0113; 27075 t.emacronacute = 0x1e17; 27076 t.emacrongrave = 0x1e15; 27077 t.emcyrillic = 0x043c; 27078 t.emdash = 0x2014; 27079 t.emdashvertical = 0xfe31; 27080 t.emonospace = 0xff45; 27081 t.emphasismarkarmenian = 0x055b; 27082 t.emptyset = 0x2205; 27083 t.enbopomofo = 0x3123; 27084 t.encyrillic = 0x043d; 27085 t.endash = 0x2013; 27086 t.endashvertical = 0xfe32; 27087 t.endescendercyrillic = 0x04a3; 27088 t.eng = 0x014b; 27089 t.engbopomofo = 0x3125; 27090 t.enghecyrillic = 0x04a5; 27091 t.enhookcyrillic = 0x04c8; 27092 t.enspace = 0x2002; 27093 t.eogonek = 0x0119; 27094 t.eokorean = 0x3153; 27095 t.eopen = 0x025b; 27096 t.eopenclosed = 0x029a; 27097 t.eopenreversed = 0x025c; 27098 t.eopenreversedclosed = 0x025e; 27099 t.eopenreversedhook = 0x025d; 27100 t.eparen = 0x24a0; 27101 t.epsilon = 0x03b5; 27102 t.epsilontonos = 0x03ad; 27103 t.equal = 0x003d; 27104 t.equalmonospace = 0xff1d; 27105 t.equalsmall = 0xfe66; 27106 t.equalsuperior = 0x207c; 27107 t.equivalence = 0x2261; 27108 t.erbopomofo = 0x3126; 27109 t.ercyrillic = 0x0440; 27110 t.ereversed = 0x0258; 27111 t.ereversedcyrillic = 0x044d; 27112 t.escyrillic = 0x0441; 27113 t.esdescendercyrillic = 0x04ab; 27114 t.esh = 0x0283; 27115 t.eshcurl = 0x0286; 27116 t.eshortdeva = 0x090e; 27117 t.eshortvowelsigndeva = 0x0946; 27118 t.eshreversedloop = 0x01aa; 27119 t.eshsquatreversed = 0x0285; 27120 t.esmallhiragana = 0x3047; 27121 t.esmallkatakana = 0x30a7; 27122 t.esmallkatakanahalfwidth = 0xff6a; 27123 t.estimated = 0x212e; 27124 t.esuperior = 0xf6ec; 27125 t.eta = 0x03b7; 27126 t.etarmenian = 0x0568; 27127 t.etatonos = 0x03ae; 27128 t.eth = 0x00f0; 27129 t.etilde = 0x1ebd; 27130 t.etildebelow = 0x1e1b; 27131 t.etnahtafoukhhebrew = 0x0591; 27132 t.etnahtafoukhlefthebrew = 0x0591; 27133 t.etnahtahebrew = 0x0591; 27134 t.etnahtalefthebrew = 0x0591; 27135 t.eturned = 0x01dd; 27136 t.eukorean = 0x3161; 27137 t.euro = 0x20ac; 27138 t.evowelsignbengali = 0x09c7; 27139 t.evowelsigndeva = 0x0947; 27140 t.evowelsigngujarati = 0x0ac7; 27141 t.exclam = 0x0021; 27142 t.exclamarmenian = 0x055c; 27143 t.exclamdbl = 0x203c; 27144 t.exclamdown = 0x00a1; 27145 t.exclamdownsmall = 0xf7a1; 27146 t.exclammonospace = 0xff01; 27147 t.exclamsmall = 0xf721; 27148 t.existential = 0x2203; 27149 t.ezh = 0x0292; 27150 t.ezhcaron = 0x01ef; 27151 t.ezhcurl = 0x0293; 27152 t.ezhreversed = 0x01b9; 27153 t.ezhtail = 0x01ba; 27154 t.f = 0x0066; 27155 t.fadeva = 0x095e; 27156 t.fagurmukhi = 0x0a5e; 27157 t.fahrenheit = 0x2109; 27158 t.fathaarabic = 0x064e; 27159 t.fathalowarabic = 0x064e; 27160 t.fathatanarabic = 0x064b; 27161 t.fbopomofo = 0x3108; 27162 t.fcircle = 0x24d5; 27163 t.fdotaccent = 0x1e1f; 27164 t.feharabic = 0x0641; 27165 t.feharmenian = 0x0586; 27166 t.fehfinalarabic = 0xfed2; 27167 t.fehinitialarabic = 0xfed3; 27168 t.fehmedialarabic = 0xfed4; 27169 t.feicoptic = 0x03e5; 27170 t.female = 0x2640; 27171 t.ff = 0xfb00; 27172 t.f_f = 0xfb00; 27173 t.ffi = 0xfb03; 27174 t.f_f_i = 0xfb03; 27175 t.ffl = 0xfb04; 27176 t.f_f_l = 0xfb04; 27177 t.fi = 0xfb01; 27178 t.f_i = 0xfb01; 27179 t.fifteencircle = 0x246e; 27180 t.fifteenparen = 0x2482; 27181 t.fifteenperiod = 0x2496; 27182 t.figuredash = 0x2012; 27183 t.filledbox = 0x25a0; 27184 t.filledrect = 0x25ac; 27185 t.finalkaf = 0x05da; 27186 t.finalkafdagesh = 0xfb3a; 27187 t.finalkafdageshhebrew = 0xfb3a; 27188 t.finalkafhebrew = 0x05da; 27189 t.finalmem = 0x05dd; 27190 t.finalmemhebrew = 0x05dd; 27191 t.finalnun = 0x05df; 27192 t.finalnunhebrew = 0x05df; 27193 t.finalpe = 0x05e3; 27194 t.finalpehebrew = 0x05e3; 27195 t.finaltsadi = 0x05e5; 27196 t.finaltsadihebrew = 0x05e5; 27197 t.firsttonechinese = 0x02c9; 27198 t.fisheye = 0x25c9; 27199 t.fitacyrillic = 0x0473; 27200 t.five = 0x0035; 27201 t.fivearabic = 0x0665; 27202 t.fivebengali = 0x09eb; 27203 t.fivecircle = 0x2464; 27204 t.fivecircleinversesansserif = 0x278e; 27205 t.fivedeva = 0x096b; 27206 t.fiveeighths = 0x215d; 27207 t.fivegujarati = 0x0aeb; 27208 t.fivegurmukhi = 0x0a6b; 27209 t.fivehackarabic = 0x0665; 27210 t.fivehangzhou = 0x3025; 27211 t.fiveideographicparen = 0x3224; 27212 t.fiveinferior = 0x2085; 27213 t.fivemonospace = 0xff15; 27214 t.fiveoldstyle = 0xf735; 27215 t.fiveparen = 0x2478; 27216 t.fiveperiod = 0x248c; 27217 t.fivepersian = 0x06f5; 27218 t.fiveroman = 0x2174; 27219 t.fivesuperior = 0x2075; 27220 t.fivethai = 0x0e55; 27221 t.fl = 0xfb02; 27222 t.f_l = 0xfb02; 27223 t.florin = 0x0192; 27224 t.fmonospace = 0xff46; 27225 t.fmsquare = 0x3399; 27226 t.fofanthai = 0x0e1f; 27227 t.fofathai = 0x0e1d; 27228 t.fongmanthai = 0x0e4f; 27229 t.forall = 0x2200; 27230 t.four = 0x0034; 27231 t.fourarabic = 0x0664; 27232 t.fourbengali = 0x09ea; 27233 t.fourcircle = 0x2463; 27234 t.fourcircleinversesansserif = 0x278d; 27235 t.fourdeva = 0x096a; 27236 t.fourgujarati = 0x0aea; 27237 t.fourgurmukhi = 0x0a6a; 27238 t.fourhackarabic = 0x0664; 27239 t.fourhangzhou = 0x3024; 27240 t.fourideographicparen = 0x3223; 27241 t.fourinferior = 0x2084; 27242 t.fourmonospace = 0xff14; 27243 t.fournumeratorbengali = 0x09f7; 27244 t.fouroldstyle = 0xf734; 27245 t.fourparen = 0x2477; 27246 t.fourperiod = 0x248b; 27247 t.fourpersian = 0x06f4; 27248 t.fourroman = 0x2173; 27249 t.foursuperior = 0x2074; 27250 t.fourteencircle = 0x246d; 27251 t.fourteenparen = 0x2481; 27252 t.fourteenperiod = 0x2495; 27253 t.fourthai = 0x0e54; 27254 t.fourthtonechinese = 0x02cb; 27255 t.fparen = 0x24a1; 27256 t.fraction = 0x2044; 27257 t.franc = 0x20a3; 27258 t.g = 0x0067; 27259 t.gabengali = 0x0997; 27260 t.gacute = 0x01f5; 27261 t.gadeva = 0x0917; 27262 t.gafarabic = 0x06af; 27263 t.gaffinalarabic = 0xfb93; 27264 t.gafinitialarabic = 0xfb94; 27265 t.gafmedialarabic = 0xfb95; 27266 t.gagujarati = 0x0a97; 27267 t.gagurmukhi = 0x0a17; 27268 t.gahiragana = 0x304c; 27269 t.gakatakana = 0x30ac; 27270 t.gamma = 0x03b3; 27271 t.gammalatinsmall = 0x0263; 27272 t.gammasuperior = 0x02e0; 27273 t.gangiacoptic = 0x03eb; 27274 t.gbopomofo = 0x310d; 27275 t.gbreve = 0x011f; 27276 t.gcaron = 0x01e7; 27277 t.gcedilla = 0x0123; 27278 t.gcircle = 0x24d6; 27279 t.gcircumflex = 0x011d; 27280 t.gcommaaccent = 0x0123; 27281 t.gdot = 0x0121; 27282 t.gdotaccent = 0x0121; 27283 t.gecyrillic = 0x0433; 27284 t.gehiragana = 0x3052; 27285 t.gekatakana = 0x30b2; 27286 t.geometricallyequal = 0x2251; 27287 t.gereshaccenthebrew = 0x059c; 27288 t.gereshhebrew = 0x05f3; 27289 t.gereshmuqdamhebrew = 0x059d; 27290 t.germandbls = 0x00df; 27291 t.gershayimaccenthebrew = 0x059e; 27292 t.gershayimhebrew = 0x05f4; 27293 t.getamark = 0x3013; 27294 t.ghabengali = 0x0998; 27295 t.ghadarmenian = 0x0572; 27296 t.ghadeva = 0x0918; 27297 t.ghagujarati = 0x0a98; 27298 t.ghagurmukhi = 0x0a18; 27299 t.ghainarabic = 0x063a; 27300 t.ghainfinalarabic = 0xfece; 27301 t.ghaininitialarabic = 0xfecf; 27302 t.ghainmedialarabic = 0xfed0; 27303 t.ghemiddlehookcyrillic = 0x0495; 27304 t.ghestrokecyrillic = 0x0493; 27305 t.gheupturncyrillic = 0x0491; 27306 t.ghhadeva = 0x095a; 27307 t.ghhagurmukhi = 0x0a5a; 27308 t.ghook = 0x0260; 27309 t.ghzsquare = 0x3393; 27310 t.gihiragana = 0x304e; 27311 t.gikatakana = 0x30ae; 27312 t.gimarmenian = 0x0563; 27313 t.gimel = 0x05d2; 27314 t.gimeldagesh = 0xfb32; 27315 t.gimeldageshhebrew = 0xfb32; 27316 t.gimelhebrew = 0x05d2; 27317 t.gjecyrillic = 0x0453; 27318 t.glottalinvertedstroke = 0x01be; 27319 t.glottalstop = 0x0294; 27320 t.glottalstopinverted = 0x0296; 27321 t.glottalstopmod = 0x02c0; 27322 t.glottalstopreversed = 0x0295; 27323 t.glottalstopreversedmod = 0x02c1; 27324 t.glottalstopreversedsuperior = 0x02e4; 27325 t.glottalstopstroke = 0x02a1; 27326 t.glottalstopstrokereversed = 0x02a2; 27327 t.gmacron = 0x1e21; 27328 t.gmonospace = 0xff47; 27329 t.gohiragana = 0x3054; 27330 t.gokatakana = 0x30b4; 27331 t.gparen = 0x24a2; 27332 t.gpasquare = 0x33ac; 27333 t.gradient = 0x2207; 27334 t.grave = 0x0060; 27335 t.gravebelowcmb = 0x0316; 27336 t.gravecmb = 0x0300; 27337 t.gravecomb = 0x0300; 27338 t.gravedeva = 0x0953; 27339 t.gravelowmod = 0x02ce; 27340 t.gravemonospace = 0xff40; 27341 t.gravetonecmb = 0x0340; 27342 t.greater = 0x003e; 27343 t.greaterequal = 0x2265; 27344 t.greaterequalorless = 0x22db; 27345 t.greatermonospace = 0xff1e; 27346 t.greaterorequivalent = 0x2273; 27347 t.greaterorless = 0x2277; 27348 t.greateroverequal = 0x2267; 27349 t.greatersmall = 0xfe65; 27350 t.gscript = 0x0261; 27351 t.gstroke = 0x01e5; 27352 t.guhiragana = 0x3050; 27353 t.guillemotleft = 0x00ab; 27354 t.guillemotright = 0x00bb; 27355 t.guilsinglleft = 0x2039; 27356 t.guilsinglright = 0x203a; 27357 t.gukatakana = 0x30b0; 27358 t.guramusquare = 0x3318; 27359 t.gysquare = 0x33c9; 27360 t.h = 0x0068; 27361 t.haabkhasiancyrillic = 0x04a9; 27362 t.haaltonearabic = 0x06c1; 27363 t.habengali = 0x09b9; 27364 t.hadescendercyrillic = 0x04b3; 27365 t.hadeva = 0x0939; 27366 t.hagujarati = 0x0ab9; 27367 t.hagurmukhi = 0x0a39; 27368 t.haharabic = 0x062d; 27369 t.hahfinalarabic = 0xfea2; 27370 t.hahinitialarabic = 0xfea3; 27371 t.hahiragana = 0x306f; 27372 t.hahmedialarabic = 0xfea4; 27373 t.haitusquare = 0x332a; 27374 t.hakatakana = 0x30cf; 27375 t.hakatakanahalfwidth = 0xff8a; 27376 t.halantgurmukhi = 0x0a4d; 27377 t.hamzaarabic = 0x0621; 27378 t.hamzalowarabic = 0x0621; 27379 t.hangulfiller = 0x3164; 27380 t.hardsigncyrillic = 0x044a; 27381 t.harpoonleftbarbup = 0x21bc; 27382 t.harpoonrightbarbup = 0x21c0; 27383 t.hasquare = 0x33ca; 27384 t.hatafpatah = 0x05b2; 27385 t.hatafpatah16 = 0x05b2; 27386 t.hatafpatah23 = 0x05b2; 27387 t.hatafpatah2f = 0x05b2; 27388 t.hatafpatahhebrew = 0x05b2; 27389 t.hatafpatahnarrowhebrew = 0x05b2; 27390 t.hatafpatahquarterhebrew = 0x05b2; 27391 t.hatafpatahwidehebrew = 0x05b2; 27392 t.hatafqamats = 0x05b3; 27393 t.hatafqamats1b = 0x05b3; 27394 t.hatafqamats28 = 0x05b3; 27395 t.hatafqamats34 = 0x05b3; 27396 t.hatafqamatshebrew = 0x05b3; 27397 t.hatafqamatsnarrowhebrew = 0x05b3; 27398 t.hatafqamatsquarterhebrew = 0x05b3; 27399 t.hatafqamatswidehebrew = 0x05b3; 27400 t.hatafsegol = 0x05b1; 27401 t.hatafsegol17 = 0x05b1; 27402 t.hatafsegol24 = 0x05b1; 27403 t.hatafsegol30 = 0x05b1; 27404 t.hatafsegolhebrew = 0x05b1; 27405 t.hatafsegolnarrowhebrew = 0x05b1; 27406 t.hatafsegolquarterhebrew = 0x05b1; 27407 t.hatafsegolwidehebrew = 0x05b1; 27408 t.hbar = 0x0127; 27409 t.hbopomofo = 0x310f; 27410 t.hbrevebelow = 0x1e2b; 27411 t.hcedilla = 0x1e29; 27412 t.hcircle = 0x24d7; 27413 t.hcircumflex = 0x0125; 27414 t.hdieresis = 0x1e27; 27415 t.hdotaccent = 0x1e23; 27416 t.hdotbelow = 0x1e25; 27417 t.he = 0x05d4; 27418 t.heart = 0x2665; 27419 t.heartsuitblack = 0x2665; 27420 t.heartsuitwhite = 0x2661; 27421 t.hedagesh = 0xfb34; 27422 t.hedageshhebrew = 0xfb34; 27423 t.hehaltonearabic = 0x06c1; 27424 t.heharabic = 0x0647; 27425 t.hehebrew = 0x05d4; 27426 t.hehfinalaltonearabic = 0xfba7; 27427 t.hehfinalalttwoarabic = 0xfeea; 27428 t.hehfinalarabic = 0xfeea; 27429 t.hehhamzaabovefinalarabic = 0xfba5; 27430 t.hehhamzaaboveisolatedarabic = 0xfba4; 27431 t.hehinitialaltonearabic = 0xfba8; 27432 t.hehinitialarabic = 0xfeeb; 27433 t.hehiragana = 0x3078; 27434 t.hehmedialaltonearabic = 0xfba9; 27435 t.hehmedialarabic = 0xfeec; 27436 t.heiseierasquare = 0x337b; 27437 t.hekatakana = 0x30d8; 27438 t.hekatakanahalfwidth = 0xff8d; 27439 t.hekutaarusquare = 0x3336; 27440 t.henghook = 0x0267; 27441 t.herutusquare = 0x3339; 27442 t.het = 0x05d7; 27443 t.hethebrew = 0x05d7; 27444 t.hhook = 0x0266; 27445 t.hhooksuperior = 0x02b1; 27446 t.hieuhacirclekorean = 0x327b; 27447 t.hieuhaparenkorean = 0x321b; 27448 t.hieuhcirclekorean = 0x326d; 27449 t.hieuhkorean = 0x314e; 27450 t.hieuhparenkorean = 0x320d; 27451 t.hihiragana = 0x3072; 27452 t.hikatakana = 0x30d2; 27453 t.hikatakanahalfwidth = 0xff8b; 27454 t.hiriq = 0x05b4; 27455 t.hiriq14 = 0x05b4; 27456 t.hiriq21 = 0x05b4; 27457 t.hiriq2d = 0x05b4; 27458 t.hiriqhebrew = 0x05b4; 27459 t.hiriqnarrowhebrew = 0x05b4; 27460 t.hiriqquarterhebrew = 0x05b4; 27461 t.hiriqwidehebrew = 0x05b4; 27462 t.hlinebelow = 0x1e96; 27463 t.hmonospace = 0xff48; 27464 t.hoarmenian = 0x0570; 27465 t.hohipthai = 0x0e2b; 27466 t.hohiragana = 0x307b; 27467 t.hokatakana = 0x30db; 27468 t.hokatakanahalfwidth = 0xff8e; 27469 t.holam = 0x05b9; 27470 t.holam19 = 0x05b9; 27471 t.holam26 = 0x05b9; 27472 t.holam32 = 0x05b9; 27473 t.holamhebrew = 0x05b9; 27474 t.holamnarrowhebrew = 0x05b9; 27475 t.holamquarterhebrew = 0x05b9; 27476 t.holamwidehebrew = 0x05b9; 27477 t.honokhukthai = 0x0e2e; 27478 t.hookabovecomb = 0x0309; 27479 t.hookcmb = 0x0309; 27480 t.hookpalatalizedbelowcmb = 0x0321; 27481 t.hookretroflexbelowcmb = 0x0322; 27482 t.hoonsquare = 0x3342; 27483 t.horicoptic = 0x03e9; 27484 t.horizontalbar = 0x2015; 27485 t.horncmb = 0x031b; 27486 t.hotsprings = 0x2668; 27487 t.house = 0x2302; 27488 t.hparen = 0x24a3; 27489 t.hsuperior = 0x02b0; 27490 t.hturned = 0x0265; 27491 t.huhiragana = 0x3075; 27492 t.huiitosquare = 0x3333; 27493 t.hukatakana = 0x30d5; 27494 t.hukatakanahalfwidth = 0xff8c; 27495 t.hungarumlaut = 0x02dd; 27496 t.hungarumlautcmb = 0x030b; 27497 t.hv = 0x0195; 27498 t.hyphen = 0x002d; 27499 t.hypheninferior = 0xf6e5; 27500 t.hyphenmonospace = 0xff0d; 27501 t.hyphensmall = 0xfe63; 27502 t.hyphensuperior = 0xf6e6; 27503 t.hyphentwo = 0x2010; 27504 t.i = 0x0069; 27505 t.iacute = 0x00ed; 27506 t.iacyrillic = 0x044f; 27507 t.ibengali = 0x0987; 27508 t.ibopomofo = 0x3127; 27509 t.ibreve = 0x012d; 27510 t.icaron = 0x01d0; 27511 t.icircle = 0x24d8; 27512 t.icircumflex = 0x00ee; 27513 t.icyrillic = 0x0456; 27514 t.idblgrave = 0x0209; 27515 t.ideographearthcircle = 0x328f; 27516 t.ideographfirecircle = 0x328b; 27517 t.ideographicallianceparen = 0x323f; 27518 t.ideographiccallparen = 0x323a; 27519 t.ideographiccentrecircle = 0x32a5; 27520 t.ideographicclose = 0x3006; 27521 t.ideographiccomma = 0x3001; 27522 t.ideographiccommaleft = 0xff64; 27523 t.ideographiccongratulationparen = 0x3237; 27524 t.ideographiccorrectcircle = 0x32a3; 27525 t.ideographicearthparen = 0x322f; 27526 t.ideographicenterpriseparen = 0x323d; 27527 t.ideographicexcellentcircle = 0x329d; 27528 t.ideographicfestivalparen = 0x3240; 27529 t.ideographicfinancialcircle = 0x3296; 27530 t.ideographicfinancialparen = 0x3236; 27531 t.ideographicfireparen = 0x322b; 27532 t.ideographichaveparen = 0x3232; 27533 t.ideographichighcircle = 0x32a4; 27534 t.ideographiciterationmark = 0x3005; 27535 t.ideographiclaborcircle = 0x3298; 27536 t.ideographiclaborparen = 0x3238; 27537 t.ideographicleftcircle = 0x32a7; 27538 t.ideographiclowcircle = 0x32a6; 27539 t.ideographicmedicinecircle = 0x32a9; 27540 t.ideographicmetalparen = 0x322e; 27541 t.ideographicmoonparen = 0x322a; 27542 t.ideographicnameparen = 0x3234; 27543 t.ideographicperiod = 0x3002; 27544 t.ideographicprintcircle = 0x329e; 27545 t.ideographicreachparen = 0x3243; 27546 t.ideographicrepresentparen = 0x3239; 27547 t.ideographicresourceparen = 0x323e; 27548 t.ideographicrightcircle = 0x32a8; 27549 t.ideographicsecretcircle = 0x3299; 27550 t.ideographicselfparen = 0x3242; 27551 t.ideographicsocietyparen = 0x3233; 27552 t.ideographicspace = 0x3000; 27553 t.ideographicspecialparen = 0x3235; 27554 t.ideographicstockparen = 0x3231; 27555 t.ideographicstudyparen = 0x323b; 27556 t.ideographicsunparen = 0x3230; 27557 t.ideographicsuperviseparen = 0x323c; 27558 t.ideographicwaterparen = 0x322c; 27559 t.ideographicwoodparen = 0x322d; 27560 t.ideographiczero = 0x3007; 27561 t.ideographmetalcircle = 0x328e; 27562 t.ideographmooncircle = 0x328a; 27563 t.ideographnamecircle = 0x3294; 27564 t.ideographsuncircle = 0x3290; 27565 t.ideographwatercircle = 0x328c; 27566 t.ideographwoodcircle = 0x328d; 27567 t.ideva = 0x0907; 27568 t.idieresis = 0x00ef; 27569 t.idieresisacute = 0x1e2f; 27570 t.idieresiscyrillic = 0x04e5; 27571 t.idotbelow = 0x1ecb; 27572 t.iebrevecyrillic = 0x04d7; 27573 t.iecyrillic = 0x0435; 27574 t.ieungacirclekorean = 0x3275; 27575 t.ieungaparenkorean = 0x3215; 27576 t.ieungcirclekorean = 0x3267; 27577 t.ieungkorean = 0x3147; 27578 t.ieungparenkorean = 0x3207; 27579 t.igrave = 0x00ec; 27580 t.igujarati = 0x0a87; 27581 t.igurmukhi = 0x0a07; 27582 t.ihiragana = 0x3044; 27583 t.ihookabove = 0x1ec9; 27584 t.iibengali = 0x0988; 27585 t.iicyrillic = 0x0438; 27586 t.iideva = 0x0908; 27587 t.iigujarati = 0x0a88; 27588 t.iigurmukhi = 0x0a08; 27589 t.iimatragurmukhi = 0x0a40; 27590 t.iinvertedbreve = 0x020b; 27591 t.iishortcyrillic = 0x0439; 27592 t.iivowelsignbengali = 0x09c0; 27593 t.iivowelsigndeva = 0x0940; 27594 t.iivowelsigngujarati = 0x0ac0; 27595 t.ij = 0x0133; 27596 t.ikatakana = 0x30a4; 27597 t.ikatakanahalfwidth = 0xff72; 27598 t.ikorean = 0x3163; 27599 t.ilde = 0x02dc; 27600 t.iluyhebrew = 0x05ac; 27601 t.imacron = 0x012b; 27602 t.imacroncyrillic = 0x04e3; 27603 t.imageorapproximatelyequal = 0x2253; 27604 t.imatragurmukhi = 0x0a3f; 27605 t.imonospace = 0xff49; 27606 t.increment = 0x2206; 27607 t.infinity = 0x221e; 27608 t.iniarmenian = 0x056b; 27609 t.integral = 0x222b; 27610 t.integralbottom = 0x2321; 27611 t.integralbt = 0x2321; 27612 t.integralex = 0xf8f5; 27613 t.integraltop = 0x2320; 27614 t.integraltp = 0x2320; 27615 t.intersection = 0x2229; 27616 t.intisquare = 0x3305; 27617 t.invbullet = 0x25d8; 27618 t.invcircle = 0x25d9; 27619 t.invsmileface = 0x263b; 27620 t.iocyrillic = 0x0451; 27621 t.iogonek = 0x012f; 27622 t.iota = 0x03b9; 27623 t.iotadieresis = 0x03ca; 27624 t.iotadieresistonos = 0x0390; 27625 t.iotalatin = 0x0269; 27626 t.iotatonos = 0x03af; 27627 t.iparen = 0x24a4; 27628 t.irigurmukhi = 0x0a72; 27629 t.ismallhiragana = 0x3043; 27630 t.ismallkatakana = 0x30a3; 27631 t.ismallkatakanahalfwidth = 0xff68; 27632 t.issharbengali = 0x09fa; 27633 t.istroke = 0x0268; 27634 t.isuperior = 0xf6ed; 27635 t.iterationhiragana = 0x309d; 27636 t.iterationkatakana = 0x30fd; 27637 t.itilde = 0x0129; 27638 t.itildebelow = 0x1e2d; 27639 t.iubopomofo = 0x3129; 27640 t.iucyrillic = 0x044e; 27641 t.ivowelsignbengali = 0x09bf; 27642 t.ivowelsigndeva = 0x093f; 27643 t.ivowelsigngujarati = 0x0abf; 27644 t.izhitsacyrillic = 0x0475; 27645 t.izhitsadblgravecyrillic = 0x0477; 27646 t.j = 0x006a; 27647 t.jaarmenian = 0x0571; 27648 t.jabengali = 0x099c; 27649 t.jadeva = 0x091c; 27650 t.jagujarati = 0x0a9c; 27651 t.jagurmukhi = 0x0a1c; 27652 t.jbopomofo = 0x3110; 27653 t.jcaron = 0x01f0; 27654 t.jcircle = 0x24d9; 27655 t.jcircumflex = 0x0135; 27656 t.jcrossedtail = 0x029d; 27657 t.jdotlessstroke = 0x025f; 27658 t.jecyrillic = 0x0458; 27659 t.jeemarabic = 0x062c; 27660 t.jeemfinalarabic = 0xfe9e; 27661 t.jeeminitialarabic = 0xfe9f; 27662 t.jeemmedialarabic = 0xfea0; 27663 t.jeharabic = 0x0698; 27664 t.jehfinalarabic = 0xfb8b; 27665 t.jhabengali = 0x099d; 27666 t.jhadeva = 0x091d; 27667 t.jhagujarati = 0x0a9d; 27668 t.jhagurmukhi = 0x0a1d; 27669 t.jheharmenian = 0x057b; 27670 t.jis = 0x3004; 27671 t.jmonospace = 0xff4a; 27672 t.jparen = 0x24a5; 27673 t.jsuperior = 0x02b2; 27674 t.k = 0x006b; 27675 t.kabashkircyrillic = 0x04a1; 27676 t.kabengali = 0x0995; 27677 t.kacute = 0x1e31; 27678 t.kacyrillic = 0x043a; 27679 t.kadescendercyrillic = 0x049b; 27680 t.kadeva = 0x0915; 27681 t.kaf = 0x05db; 27682 t.kafarabic = 0x0643; 27683 t.kafdagesh = 0xfb3b; 27684 t.kafdageshhebrew = 0xfb3b; 27685 t.kaffinalarabic = 0xfeda; 27686 t.kafhebrew = 0x05db; 27687 t.kafinitialarabic = 0xfedb; 27688 t.kafmedialarabic = 0xfedc; 27689 t.kafrafehebrew = 0xfb4d; 27690 t.kagujarati = 0x0a95; 27691 t.kagurmukhi = 0x0a15; 27692 t.kahiragana = 0x304b; 27693 t.kahookcyrillic = 0x04c4; 27694 t.kakatakana = 0x30ab; 27695 t.kakatakanahalfwidth = 0xff76; 27696 t.kappa = 0x03ba; 27697 t.kappasymbolgreek = 0x03f0; 27698 t.kapyeounmieumkorean = 0x3171; 27699 t.kapyeounphieuphkorean = 0x3184; 27700 t.kapyeounpieupkorean = 0x3178; 27701 t.kapyeounssangpieupkorean = 0x3179; 27702 t.karoriisquare = 0x330d; 27703 t.kashidaautoarabic = 0x0640; 27704 t.kashidaautonosidebearingarabic = 0x0640; 27705 t.kasmallkatakana = 0x30f5; 27706 t.kasquare = 0x3384; 27707 t.kasraarabic = 0x0650; 27708 t.kasratanarabic = 0x064d; 27709 t.kastrokecyrillic = 0x049f; 27710 t.katahiraprolongmarkhalfwidth = 0xff70; 27711 t.kaverticalstrokecyrillic = 0x049d; 27712 t.kbopomofo = 0x310e; 27713 t.kcalsquare = 0x3389; 27714 t.kcaron = 0x01e9; 27715 t.kcedilla = 0x0137; 27716 t.kcircle = 0x24da; 27717 t.kcommaaccent = 0x0137; 27718 t.kdotbelow = 0x1e33; 27719 t.keharmenian = 0x0584; 27720 t.kehiragana = 0x3051; 27721 t.kekatakana = 0x30b1; 27722 t.kekatakanahalfwidth = 0xff79; 27723 t.kenarmenian = 0x056f; 27724 t.kesmallkatakana = 0x30f6; 27725 t.kgreenlandic = 0x0138; 27726 t.khabengali = 0x0996; 27727 t.khacyrillic = 0x0445; 27728 t.khadeva = 0x0916; 27729 t.khagujarati = 0x0a96; 27730 t.khagurmukhi = 0x0a16; 27731 t.khaharabic = 0x062e; 27732 t.khahfinalarabic = 0xfea6; 27733 t.khahinitialarabic = 0xfea7; 27734 t.khahmedialarabic = 0xfea8; 27735 t.kheicoptic = 0x03e7; 27736 t.khhadeva = 0x0959; 27737 t.khhagurmukhi = 0x0a59; 27738 t.khieukhacirclekorean = 0x3278; 27739 t.khieukhaparenkorean = 0x3218; 27740 t.khieukhcirclekorean = 0x326a; 27741 t.khieukhkorean = 0x314b; 27742 t.khieukhparenkorean = 0x320a; 27743 t.khokhaithai = 0x0e02; 27744 t.khokhonthai = 0x0e05; 27745 t.khokhuatthai = 0x0e03; 27746 t.khokhwaithai = 0x0e04; 27747 t.khomutthai = 0x0e5b; 27748 t.khook = 0x0199; 27749 t.khorakhangthai = 0x0e06; 27750 t.khzsquare = 0x3391; 27751 t.kihiragana = 0x304d; 27752 t.kikatakana = 0x30ad; 27753 t.kikatakanahalfwidth = 0xff77; 27754 t.kiroguramusquare = 0x3315; 27755 t.kiromeetorusquare = 0x3316; 27756 t.kirosquare = 0x3314; 27757 t.kiyeokacirclekorean = 0x326e; 27758 t.kiyeokaparenkorean = 0x320e; 27759 t.kiyeokcirclekorean = 0x3260; 27760 t.kiyeokkorean = 0x3131; 27761 t.kiyeokparenkorean = 0x3200; 27762 t.kiyeoksioskorean = 0x3133; 27763 t.kjecyrillic = 0x045c; 27764 t.klinebelow = 0x1e35; 27765 t.klsquare = 0x3398; 27766 t.kmcubedsquare = 0x33a6; 27767 t.kmonospace = 0xff4b; 27768 t.kmsquaredsquare = 0x33a2; 27769 t.kohiragana = 0x3053; 27770 t.kohmsquare = 0x33c0; 27771 t.kokaithai = 0x0e01; 27772 t.kokatakana = 0x30b3; 27773 t.kokatakanahalfwidth = 0xff7a; 27774 t.kooposquare = 0x331e; 27775 t.koppacyrillic = 0x0481; 27776 t.koreanstandardsymbol = 0x327f; 27777 t.koroniscmb = 0x0343; 27778 t.kparen = 0x24a6; 27779 t.kpasquare = 0x33aa; 27780 t.ksicyrillic = 0x046f; 27781 t.ktsquare = 0x33cf; 27782 t.kturned = 0x029e; 27783 t.kuhiragana = 0x304f; 27784 t.kukatakana = 0x30af; 27785 t.kukatakanahalfwidth = 0xff78; 27786 t.kvsquare = 0x33b8; 27787 t.kwsquare = 0x33be; 27788 t.l = 0x006c; 27789 t.labengali = 0x09b2; 27790 t.lacute = 0x013a; 27791 t.ladeva = 0x0932; 27792 t.lagujarati = 0x0ab2; 27793 t.lagurmukhi = 0x0a32; 27794 t.lakkhangyaothai = 0x0e45; 27795 t.lamaleffinalarabic = 0xfefc; 27796 t.lamalefhamzaabovefinalarabic = 0xfef8; 27797 t.lamalefhamzaaboveisolatedarabic = 0xfef7; 27798 t.lamalefhamzabelowfinalarabic = 0xfefa; 27799 t.lamalefhamzabelowisolatedarabic = 0xfef9; 27800 t.lamalefisolatedarabic = 0xfefb; 27801 t.lamalefmaddaabovefinalarabic = 0xfef6; 27802 t.lamalefmaddaaboveisolatedarabic = 0xfef5; 27803 t.lamarabic = 0x0644; 27804 t.lambda = 0x03bb; 27805 t.lambdastroke = 0x019b; 27806 t.lamed = 0x05dc; 27807 t.lameddagesh = 0xfb3c; 27808 t.lameddageshhebrew = 0xfb3c; 27809 t.lamedhebrew = 0x05dc; 27810 t.lamfinalarabic = 0xfede; 27811 t.lamhahinitialarabic = 0xfcca; 27812 t.laminitialarabic = 0xfedf; 27813 t.lamjeeminitialarabic = 0xfcc9; 27814 t.lamkhahinitialarabic = 0xfccb; 27815 t.lamlamhehisolatedarabic = 0xfdf2; 27816 t.lammedialarabic = 0xfee0; 27817 t.lammeemhahinitialarabic = 0xfd88; 27818 t.lammeeminitialarabic = 0xfccc; 27819 t.largecircle = 0x25ef; 27820 t.lbar = 0x019a; 27821 t.lbelt = 0x026c; 27822 t.lbopomofo = 0x310c; 27823 t.lcaron = 0x013e; 27824 t.lcedilla = 0x013c; 27825 t.lcircle = 0x24db; 27826 t.lcircumflexbelow = 0x1e3d; 27827 t.lcommaaccent = 0x013c; 27828 t.ldot = 0x0140; 27829 t.ldotaccent = 0x0140; 27830 t.ldotbelow = 0x1e37; 27831 t.ldotbelowmacron = 0x1e39; 27832 t.leftangleabovecmb = 0x031a; 27833 t.lefttackbelowcmb = 0x0318; 27834 t.less = 0x003c; 27835 t.lessequal = 0x2264; 27836 t.lessequalorgreater = 0x22da; 27837 t.lessmonospace = 0xff1c; 27838 t.lessorequivalent = 0x2272; 27839 t.lessorgreater = 0x2276; 27840 t.lessoverequal = 0x2266; 27841 t.lesssmall = 0xfe64; 27842 t.lezh = 0x026e; 27843 t.lfblock = 0x258c; 27844 t.lhookretroflex = 0x026d; 27845 t.lira = 0x20a4; 27846 t.liwnarmenian = 0x056c; 27847 t.lj = 0x01c9; 27848 t.ljecyrillic = 0x0459; 27849 t.ll = 0xf6c0; 27850 t.lladeva = 0x0933; 27851 t.llagujarati = 0x0ab3; 27852 t.llinebelow = 0x1e3b; 27853 t.llladeva = 0x0934; 27854 t.llvocalicbengali = 0x09e1; 27855 t.llvocalicdeva = 0x0961; 27856 t.llvocalicvowelsignbengali = 0x09e3; 27857 t.llvocalicvowelsigndeva = 0x0963; 27858 t.lmiddletilde = 0x026b; 27859 t.lmonospace = 0xff4c; 27860 t.lmsquare = 0x33d0; 27861 t.lochulathai = 0x0e2c; 27862 t.logicaland = 0x2227; 27863 t.logicalnot = 0x00ac; 27864 t.logicalnotreversed = 0x2310; 27865 t.logicalor = 0x2228; 27866 t.lolingthai = 0x0e25; 27867 t.longs = 0x017f; 27868 t.lowlinecenterline = 0xfe4e; 27869 t.lowlinecmb = 0x0332; 27870 t.lowlinedashed = 0xfe4d; 27871 t.lozenge = 0x25ca; 27872 t.lparen = 0x24a7; 27873 t.lslash = 0x0142; 27874 t.lsquare = 0x2113; 27875 t.lsuperior = 0xf6ee; 27876 t.ltshade = 0x2591; 27877 t.luthai = 0x0e26; 27878 t.lvocalicbengali = 0x098c; 27879 t.lvocalicdeva = 0x090c; 27880 t.lvocalicvowelsignbengali = 0x09e2; 27881 t.lvocalicvowelsigndeva = 0x0962; 27882 t.lxsquare = 0x33d3; 27883 t.m = 0x006d; 27884 t.mabengali = 0x09ae; 27885 t.macron = 0x00af; 27886 t.macronbelowcmb = 0x0331; 27887 t.macroncmb = 0x0304; 27888 t.macronlowmod = 0x02cd; 27889 t.macronmonospace = 0xffe3; 27890 t.macute = 0x1e3f; 27891 t.madeva = 0x092e; 27892 t.magujarati = 0x0aae; 27893 t.magurmukhi = 0x0a2e; 27894 t.mahapakhhebrew = 0x05a4; 27895 t.mahapakhlefthebrew = 0x05a4; 27896 t.mahiragana = 0x307e; 27897 t.maichattawalowleftthai = 0xf895; 27898 t.maichattawalowrightthai = 0xf894; 27899 t.maichattawathai = 0x0e4b; 27900 t.maichattawaupperleftthai = 0xf893; 27901 t.maieklowleftthai = 0xf88c; 27902 t.maieklowrightthai = 0xf88b; 27903 t.maiekthai = 0x0e48; 27904 t.maiekupperleftthai = 0xf88a; 27905 t.maihanakatleftthai = 0xf884; 27906 t.maihanakatthai = 0x0e31; 27907 t.maitaikhuleftthai = 0xf889; 27908 t.maitaikhuthai = 0x0e47; 27909 t.maitholowleftthai = 0xf88f; 27910 t.maitholowrightthai = 0xf88e; 27911 t.maithothai = 0x0e49; 27912 t.maithoupperleftthai = 0xf88d; 27913 t.maitrilowleftthai = 0xf892; 27914 t.maitrilowrightthai = 0xf891; 27915 t.maitrithai = 0x0e4a; 27916 t.maitriupperleftthai = 0xf890; 27917 t.maiyamokthai = 0x0e46; 27918 t.makatakana = 0x30de; 27919 t.makatakanahalfwidth = 0xff8f; 27920 t.male = 0x2642; 27921 t.mansyonsquare = 0x3347; 27922 t.maqafhebrew = 0x05be; 27923 t.mars = 0x2642; 27924 t.masoracirclehebrew = 0x05af; 27925 t.masquare = 0x3383; 27926 t.mbopomofo = 0x3107; 27927 t.mbsquare = 0x33d4; 27928 t.mcircle = 0x24dc; 27929 t.mcubedsquare = 0x33a5; 27930 t.mdotaccent = 0x1e41; 27931 t.mdotbelow = 0x1e43; 27932 t.meemarabic = 0x0645; 27933 t.meemfinalarabic = 0xfee2; 27934 t.meeminitialarabic = 0xfee3; 27935 t.meemmedialarabic = 0xfee4; 27936 t.meemmeeminitialarabic = 0xfcd1; 27937 t.meemmeemisolatedarabic = 0xfc48; 27938 t.meetorusquare = 0x334d; 27939 t.mehiragana = 0x3081; 27940 t.meizierasquare = 0x337e; 27941 t.mekatakana = 0x30e1; 27942 t.mekatakanahalfwidth = 0xff92; 27943 t.mem = 0x05de; 27944 t.memdagesh = 0xfb3e; 27945 t.memdageshhebrew = 0xfb3e; 27946 t.memhebrew = 0x05de; 27947 t.menarmenian = 0x0574; 27948 t.merkhahebrew = 0x05a5; 27949 t.merkhakefulahebrew = 0x05a6; 27950 t.merkhakefulalefthebrew = 0x05a6; 27951 t.merkhalefthebrew = 0x05a5; 27952 t.mhook = 0x0271; 27953 t.mhzsquare = 0x3392; 27954 t.middledotkatakanahalfwidth = 0xff65; 27955 t.middot = 0x00b7; 27956 t.mieumacirclekorean = 0x3272; 27957 t.mieumaparenkorean = 0x3212; 27958 t.mieumcirclekorean = 0x3264; 27959 t.mieumkorean = 0x3141; 27960 t.mieumpansioskorean = 0x3170; 27961 t.mieumparenkorean = 0x3204; 27962 t.mieumpieupkorean = 0x316e; 27963 t.mieumsioskorean = 0x316f; 27964 t.mihiragana = 0x307f; 27965 t.mikatakana = 0x30df; 27966 t.mikatakanahalfwidth = 0xff90; 27967 t.minus = 0x2212; 27968 t.minusbelowcmb = 0x0320; 27969 t.minuscircle = 0x2296; 27970 t.minusmod = 0x02d7; 27971 t.minusplus = 0x2213; 27972 t.minute = 0x2032; 27973 t.miribaarusquare = 0x334a; 27974 t.mirisquare = 0x3349; 27975 t.mlonglegturned = 0x0270; 27976 t.mlsquare = 0x3396; 27977 t.mmcubedsquare = 0x33a3; 27978 t.mmonospace = 0xff4d; 27979 t.mmsquaredsquare = 0x339f; 27980 t.mohiragana = 0x3082; 27981 t.mohmsquare = 0x33c1; 27982 t.mokatakana = 0x30e2; 27983 t.mokatakanahalfwidth = 0xff93; 27984 t.molsquare = 0x33d6; 27985 t.momathai = 0x0e21; 27986 t.moverssquare = 0x33a7; 27987 t.moverssquaredsquare = 0x33a8; 27988 t.mparen = 0x24a8; 27989 t.mpasquare = 0x33ab; 27990 t.mssquare = 0x33b3; 27991 t.msuperior = 0xf6ef; 27992 t.mturned = 0x026f; 27993 t.mu = 0x00b5; 27994 t.mu1 = 0x00b5; 27995 t.muasquare = 0x3382; 27996 t.muchgreater = 0x226b; 27997 t.muchless = 0x226a; 27998 t.mufsquare = 0x338c; 27999 t.mugreek = 0x03bc; 28000 t.mugsquare = 0x338d; 28001 t.muhiragana = 0x3080; 28002 t.mukatakana = 0x30e0; 28003 t.mukatakanahalfwidth = 0xff91; 28004 t.mulsquare = 0x3395; 28005 t.multiply = 0x00d7; 28006 t.mumsquare = 0x339b; 28007 t.munahhebrew = 0x05a3; 28008 t.munahlefthebrew = 0x05a3; 28009 t.musicalnote = 0x266a; 28010 t.musicalnotedbl = 0x266b; 28011 t.musicflatsign = 0x266d; 28012 t.musicsharpsign = 0x266f; 28013 t.mussquare = 0x33b2; 28014 t.muvsquare = 0x33b6; 28015 t.muwsquare = 0x33bc; 28016 t.mvmegasquare = 0x33b9; 28017 t.mvsquare = 0x33b7; 28018 t.mwmegasquare = 0x33bf; 28019 t.mwsquare = 0x33bd; 28020 t.n = 0x006e; 28021 t.nabengali = 0x09a8; 28022 t.nabla = 0x2207; 28023 t.nacute = 0x0144; 28024 t.nadeva = 0x0928; 28025 t.nagujarati = 0x0aa8; 28026 t.nagurmukhi = 0x0a28; 28027 t.nahiragana = 0x306a; 28028 t.nakatakana = 0x30ca; 28029 t.nakatakanahalfwidth = 0xff85; 28030 t.napostrophe = 0x0149; 28031 t.nasquare = 0x3381; 28032 t.nbopomofo = 0x310b; 28033 t.nbspace = 0x00a0; 28034 t.ncaron = 0x0148; 28035 t.ncedilla = 0x0146; 28036 t.ncircle = 0x24dd; 28037 t.ncircumflexbelow = 0x1e4b; 28038 t.ncommaaccent = 0x0146; 28039 t.ndotaccent = 0x1e45; 28040 t.ndotbelow = 0x1e47; 28041 t.nehiragana = 0x306d; 28042 t.nekatakana = 0x30cd; 28043 t.nekatakanahalfwidth = 0xff88; 28044 t.newsheqelsign = 0x20aa; 28045 t.nfsquare = 0x338b; 28046 t.ngabengali = 0x0999; 28047 t.ngadeva = 0x0919; 28048 t.ngagujarati = 0x0a99; 28049 t.ngagurmukhi = 0x0a19; 28050 t.ngonguthai = 0x0e07; 28051 t.nhiragana = 0x3093; 28052 t.nhookleft = 0x0272; 28053 t.nhookretroflex = 0x0273; 28054 t.nieunacirclekorean = 0x326f; 28055 t.nieunaparenkorean = 0x320f; 28056 t.nieuncieuckorean = 0x3135; 28057 t.nieuncirclekorean = 0x3261; 28058 t.nieunhieuhkorean = 0x3136; 28059 t.nieunkorean = 0x3134; 28060 t.nieunpansioskorean = 0x3168; 28061 t.nieunparenkorean = 0x3201; 28062 t.nieunsioskorean = 0x3167; 28063 t.nieuntikeutkorean = 0x3166; 28064 t.nihiragana = 0x306b; 28065 t.nikatakana = 0x30cb; 28066 t.nikatakanahalfwidth = 0xff86; 28067 t.nikhahitleftthai = 0xf899; 28068 t.nikhahitthai = 0x0e4d; 28069 t.nine = 0x0039; 28070 t.ninearabic = 0x0669; 28071 t.ninebengali = 0x09ef; 28072 t.ninecircle = 0x2468; 28073 t.ninecircleinversesansserif = 0x2792; 28074 t.ninedeva = 0x096f; 28075 t.ninegujarati = 0x0aef; 28076 t.ninegurmukhi = 0x0a6f; 28077 t.ninehackarabic = 0x0669; 28078 t.ninehangzhou = 0x3029; 28079 t.nineideographicparen = 0x3228; 28080 t.nineinferior = 0x2089; 28081 t.ninemonospace = 0xff19; 28082 t.nineoldstyle = 0xf739; 28083 t.nineparen = 0x247c; 28084 t.nineperiod = 0x2490; 28085 t.ninepersian = 0x06f9; 28086 t.nineroman = 0x2178; 28087 t.ninesuperior = 0x2079; 28088 t.nineteencircle = 0x2472; 28089 t.nineteenparen = 0x2486; 28090 t.nineteenperiod = 0x249a; 28091 t.ninethai = 0x0e59; 28092 t.nj = 0x01cc; 28093 t.njecyrillic = 0x045a; 28094 t.nkatakana = 0x30f3; 28095 t.nkatakanahalfwidth = 0xff9d; 28096 t.nlegrightlong = 0x019e; 28097 t.nlinebelow = 0x1e49; 28098 t.nmonospace = 0xff4e; 28099 t.nmsquare = 0x339a; 28100 t.nnabengali = 0x09a3; 28101 t.nnadeva = 0x0923; 28102 t.nnagujarati = 0x0aa3; 28103 t.nnagurmukhi = 0x0a23; 28104 t.nnnadeva = 0x0929; 28105 t.nohiragana = 0x306e; 28106 t.nokatakana = 0x30ce; 28107 t.nokatakanahalfwidth = 0xff89; 28108 t.nonbreakingspace = 0x00a0; 28109 t.nonenthai = 0x0e13; 28110 t.nonuthai = 0x0e19; 28111 t.noonarabic = 0x0646; 28112 t.noonfinalarabic = 0xfee6; 28113 t.noonghunnaarabic = 0x06ba; 28114 t.noonghunnafinalarabic = 0xfb9f; 28115 t.nooninitialarabic = 0xfee7; 28116 t.noonjeeminitialarabic = 0xfcd2; 28117 t.noonjeemisolatedarabic = 0xfc4b; 28118 t.noonmedialarabic = 0xfee8; 28119 t.noonmeeminitialarabic = 0xfcd5; 28120 t.noonmeemisolatedarabic = 0xfc4e; 28121 t.noonnoonfinalarabic = 0xfc8d; 28122 t.notcontains = 0x220c; 28123 t.notelement = 0x2209; 28124 t.notelementof = 0x2209; 28125 t.notequal = 0x2260; 28126 t.notgreater = 0x226f; 28127 t.notgreaternorequal = 0x2271; 28128 t.notgreaternorless = 0x2279; 28129 t.notidentical = 0x2262; 28130 t.notless = 0x226e; 28131 t.notlessnorequal = 0x2270; 28132 t.notparallel = 0x2226; 28133 t.notprecedes = 0x2280; 28134 t.notsubset = 0x2284; 28135 t.notsucceeds = 0x2281; 28136 t.notsuperset = 0x2285; 28137 t.nowarmenian = 0x0576; 28138 t.nparen = 0x24a9; 28139 t.nssquare = 0x33b1; 28140 t.nsuperior = 0x207f; 28141 t.ntilde = 0x00f1; 28142 t.nu = 0x03bd; 28143 t.nuhiragana = 0x306c; 28144 t.nukatakana = 0x30cc; 28145 t.nukatakanahalfwidth = 0xff87; 28146 t.nuktabengali = 0x09bc; 28147 t.nuktadeva = 0x093c; 28148 t.nuktagujarati = 0x0abc; 28149 t.nuktagurmukhi = 0x0a3c; 28150 t.numbersign = 0x0023; 28151 t.numbersignmonospace = 0xff03; 28152 t.numbersignsmall = 0xfe5f; 28153 t.numeralsigngreek = 0x0374; 28154 t.numeralsignlowergreek = 0x0375; 28155 t.numero = 0x2116; 28156 t.nun = 0x05e0; 28157 t.nundagesh = 0xfb40; 28158 t.nundageshhebrew = 0xfb40; 28159 t.nunhebrew = 0x05e0; 28160 t.nvsquare = 0x33b5; 28161 t.nwsquare = 0x33bb; 28162 t.nyabengali = 0x099e; 28163 t.nyadeva = 0x091e; 28164 t.nyagujarati = 0x0a9e; 28165 t.nyagurmukhi = 0x0a1e; 28166 t.o = 0x006f; 28167 t.oacute = 0x00f3; 28168 t.oangthai = 0x0e2d; 28169 t.obarred = 0x0275; 28170 t.obarredcyrillic = 0x04e9; 28171 t.obarreddieresiscyrillic = 0x04eb; 28172 t.obengali = 0x0993; 28173 t.obopomofo = 0x311b; 28174 t.obreve = 0x014f; 28175 t.ocandradeva = 0x0911; 28176 t.ocandragujarati = 0x0a91; 28177 t.ocandravowelsigndeva = 0x0949; 28178 t.ocandravowelsigngujarati = 0x0ac9; 28179 t.ocaron = 0x01d2; 28180 t.ocircle = 0x24de; 28181 t.ocircumflex = 0x00f4; 28182 t.ocircumflexacute = 0x1ed1; 28183 t.ocircumflexdotbelow = 0x1ed9; 28184 t.ocircumflexgrave = 0x1ed3; 28185 t.ocircumflexhookabove = 0x1ed5; 28186 t.ocircumflextilde = 0x1ed7; 28187 t.ocyrillic = 0x043e; 28188 t.odblacute = 0x0151; 28189 t.odblgrave = 0x020d; 28190 t.odeva = 0x0913; 28191 t.odieresis = 0x00f6; 28192 t.odieresiscyrillic = 0x04e7; 28193 t.odotbelow = 0x1ecd; 28194 t.oe = 0x0153; 28195 t.oekorean = 0x315a; 28196 t.ogonek = 0x02db; 28197 t.ogonekcmb = 0x0328; 28198 t.ograve = 0x00f2; 28199 t.ogujarati = 0x0a93; 28200 t.oharmenian = 0x0585; 28201 t.ohiragana = 0x304a; 28202 t.ohookabove = 0x1ecf; 28203 t.ohorn = 0x01a1; 28204 t.ohornacute = 0x1edb; 28205 t.ohorndotbelow = 0x1ee3; 28206 t.ohorngrave = 0x1edd; 28207 t.ohornhookabove = 0x1edf; 28208 t.ohorntilde = 0x1ee1; 28209 t.ohungarumlaut = 0x0151; 28210 t.oi = 0x01a3; 28211 t.oinvertedbreve = 0x020f; 28212 t.okatakana = 0x30aa; 28213 t.okatakanahalfwidth = 0xff75; 28214 t.okorean = 0x3157; 28215 t.olehebrew = 0x05ab; 28216 t.omacron = 0x014d; 28217 t.omacronacute = 0x1e53; 28218 t.omacrongrave = 0x1e51; 28219 t.omdeva = 0x0950; 28220 t.omega = 0x03c9; 28221 t.omega1 = 0x03d6; 28222 t.omegacyrillic = 0x0461; 28223 t.omegalatinclosed = 0x0277; 28224 t.omegaroundcyrillic = 0x047b; 28225 t.omegatitlocyrillic = 0x047d; 28226 t.omegatonos = 0x03ce; 28227 t.omgujarati = 0x0ad0; 28228 t.omicron = 0x03bf; 28229 t.omicrontonos = 0x03cc; 28230 t.omonospace = 0xff4f; 28231 t.one = 0x0031; 28232 t.onearabic = 0x0661; 28233 t.onebengali = 0x09e7; 28234 t.onecircle = 0x2460; 28235 t.onecircleinversesansserif = 0x278a; 28236 t.onedeva = 0x0967; 28237 t.onedotenleader = 0x2024; 28238 t.oneeighth = 0x215b; 28239 t.onefitted = 0xf6dc; 28240 t.onegujarati = 0x0ae7; 28241 t.onegurmukhi = 0x0a67; 28242 t.onehackarabic = 0x0661; 28243 t.onehalf = 0x00bd; 28244 t.onehangzhou = 0x3021; 28245 t.oneideographicparen = 0x3220; 28246 t.oneinferior = 0x2081; 28247 t.onemonospace = 0xff11; 28248 t.onenumeratorbengali = 0x09f4; 28249 t.oneoldstyle = 0xf731; 28250 t.oneparen = 0x2474; 28251 t.oneperiod = 0x2488; 28252 t.onepersian = 0x06f1; 28253 t.onequarter = 0x00bc; 28254 t.oneroman = 0x2170; 28255 t.onesuperior = 0x00b9; 28256 t.onethai = 0x0e51; 28257 t.onethird = 0x2153; 28258 t.oogonek = 0x01eb; 28259 t.oogonekmacron = 0x01ed; 28260 t.oogurmukhi = 0x0a13; 28261 t.oomatragurmukhi = 0x0a4b; 28262 t.oopen = 0x0254; 28263 t.oparen = 0x24aa; 28264 t.openbullet = 0x25e6; 28265 t.option = 0x2325; 28266 t.ordfeminine = 0x00aa; 28267 t.ordmasculine = 0x00ba; 28268 t.orthogonal = 0x221f; 28269 t.oshortdeva = 0x0912; 28270 t.oshortvowelsigndeva = 0x094a; 28271 t.oslash = 0x00f8; 28272 t.oslashacute = 0x01ff; 28273 t.osmallhiragana = 0x3049; 28274 t.osmallkatakana = 0x30a9; 28275 t.osmallkatakanahalfwidth = 0xff6b; 28276 t.ostrokeacute = 0x01ff; 28277 t.osuperior = 0xf6f0; 28278 t.otcyrillic = 0x047f; 28279 t.otilde = 0x00f5; 28280 t.otildeacute = 0x1e4d; 28281 t.otildedieresis = 0x1e4f; 28282 t.oubopomofo = 0x3121; 28283 t.overline = 0x203e; 28284 t.overlinecenterline = 0xfe4a; 28285 t.overlinecmb = 0x0305; 28286 t.overlinedashed = 0xfe49; 28287 t.overlinedblwavy = 0xfe4c; 28288 t.overlinewavy = 0xfe4b; 28289 t.overscore = 0x00af; 28290 t.ovowelsignbengali = 0x09cb; 28291 t.ovowelsigndeva = 0x094b; 28292 t.ovowelsigngujarati = 0x0acb; 28293 t.p = 0x0070; 28294 t.paampssquare = 0x3380; 28295 t.paasentosquare = 0x332b; 28296 t.pabengali = 0x09aa; 28297 t.pacute = 0x1e55; 28298 t.padeva = 0x092a; 28299 t.pagedown = 0x21df; 28300 t.pageup = 0x21de; 28301 t.pagujarati = 0x0aaa; 28302 t.pagurmukhi = 0x0a2a; 28303 t.pahiragana = 0x3071; 28304 t.paiyannoithai = 0x0e2f; 28305 t.pakatakana = 0x30d1; 28306 t.palatalizationcyrilliccmb = 0x0484; 28307 t.palochkacyrillic = 0x04c0; 28308 t.pansioskorean = 0x317f; 28309 t.paragraph = 0x00b6; 28310 t.parallel = 0x2225; 28311 t.parenleft = 0x0028; 28312 t.parenleftaltonearabic = 0xfd3e; 28313 t.parenleftbt = 0xf8ed; 28314 t.parenleftex = 0xf8ec; 28315 t.parenleftinferior = 0x208d; 28316 t.parenleftmonospace = 0xff08; 28317 t.parenleftsmall = 0xfe59; 28318 t.parenleftsuperior = 0x207d; 28319 t.parenlefttp = 0xf8eb; 28320 t.parenleftvertical = 0xfe35; 28321 t.parenright = 0x0029; 28322 t.parenrightaltonearabic = 0xfd3f; 28323 t.parenrightbt = 0xf8f8; 28324 t.parenrightex = 0xf8f7; 28325 t.parenrightinferior = 0x208e; 28326 t.parenrightmonospace = 0xff09; 28327 t.parenrightsmall = 0xfe5a; 28328 t.parenrightsuperior = 0x207e; 28329 t.parenrighttp = 0xf8f6; 28330 t.parenrightvertical = 0xfe36; 28331 t.partialdiff = 0x2202; 28332 t.paseqhebrew = 0x05c0; 28333 t.pashtahebrew = 0x0599; 28334 t.pasquare = 0x33a9; 28335 t.patah = 0x05b7; 28336 t.patah11 = 0x05b7; 28337 t.patah1d = 0x05b7; 28338 t.patah2a = 0x05b7; 28339 t.patahhebrew = 0x05b7; 28340 t.patahnarrowhebrew = 0x05b7; 28341 t.patahquarterhebrew = 0x05b7; 28342 t.patahwidehebrew = 0x05b7; 28343 t.pazerhebrew = 0x05a1; 28344 t.pbopomofo = 0x3106; 28345 t.pcircle = 0x24df; 28346 t.pdotaccent = 0x1e57; 28347 t.pe = 0x05e4; 28348 t.pecyrillic = 0x043f; 28349 t.pedagesh = 0xfb44; 28350 t.pedageshhebrew = 0xfb44; 28351 t.peezisquare = 0x333b; 28352 t.pefinaldageshhebrew = 0xfb43; 28353 t.peharabic = 0x067e; 28354 t.peharmenian = 0x057a; 28355 t.pehebrew = 0x05e4; 28356 t.pehfinalarabic = 0xfb57; 28357 t.pehinitialarabic = 0xfb58; 28358 t.pehiragana = 0x307a; 28359 t.pehmedialarabic = 0xfb59; 28360 t.pekatakana = 0x30da; 28361 t.pemiddlehookcyrillic = 0x04a7; 28362 t.perafehebrew = 0xfb4e; 28363 t.percent = 0x0025; 28364 t.percentarabic = 0x066a; 28365 t.percentmonospace = 0xff05; 28366 t.percentsmall = 0xfe6a; 28367 t.period = 0x002e; 28368 t.periodarmenian = 0x0589; 28369 t.periodcentered = 0x00b7; 28370 t.periodhalfwidth = 0xff61; 28371 t.periodinferior = 0xf6e7; 28372 t.periodmonospace = 0xff0e; 28373 t.periodsmall = 0xfe52; 28374 t.periodsuperior = 0xf6e8; 28375 t.perispomenigreekcmb = 0x0342; 28376 t.perpendicular = 0x22a5; 28377 t.perthousand = 0x2030; 28378 t.peseta = 0x20a7; 28379 t.pfsquare = 0x338a; 28380 t.phabengali = 0x09ab; 28381 t.phadeva = 0x092b; 28382 t.phagujarati = 0x0aab; 28383 t.phagurmukhi = 0x0a2b; 28384 t.phi = 0x03c6; 28385 t.phi1 = 0x03d5; 28386 t.phieuphacirclekorean = 0x327a; 28387 t.phieuphaparenkorean = 0x321a; 28388 t.phieuphcirclekorean = 0x326c; 28389 t.phieuphkorean = 0x314d; 28390 t.phieuphparenkorean = 0x320c; 28391 t.philatin = 0x0278; 28392 t.phinthuthai = 0x0e3a; 28393 t.phisymbolgreek = 0x03d5; 28394 t.phook = 0x01a5; 28395 t.phophanthai = 0x0e1e; 28396 t.phophungthai = 0x0e1c; 28397 t.phosamphaothai = 0x0e20; 28398 t.pi = 0x03c0; 28399 t.pieupacirclekorean = 0x3273; 28400 t.pieupaparenkorean = 0x3213; 28401 t.pieupcieuckorean = 0x3176; 28402 t.pieupcirclekorean = 0x3265; 28403 t.pieupkiyeokkorean = 0x3172; 28404 t.pieupkorean = 0x3142; 28405 t.pieupparenkorean = 0x3205; 28406 t.pieupsioskiyeokkorean = 0x3174; 28407 t.pieupsioskorean = 0x3144; 28408 t.pieupsiostikeutkorean = 0x3175; 28409 t.pieupthieuthkorean = 0x3177; 28410 t.pieuptikeutkorean = 0x3173; 28411 t.pihiragana = 0x3074; 28412 t.pikatakana = 0x30d4; 28413 t.pisymbolgreek = 0x03d6; 28414 t.piwrarmenian = 0x0583; 28415 t.planckover2pi = 0x210f; 28416 t.planckover2pi1 = 0x210f; 28417 t.plus = 0x002b; 28418 t.plusbelowcmb = 0x031f; 28419 t.pluscircle = 0x2295; 28420 t.plusminus = 0x00b1; 28421 t.plusmod = 0x02d6; 28422 t.plusmonospace = 0xff0b; 28423 t.plussmall = 0xfe62; 28424 t.plussuperior = 0x207a; 28425 t.pmonospace = 0xff50; 28426 t.pmsquare = 0x33d8; 28427 t.pohiragana = 0x307d; 28428 t.pointingindexdownwhite = 0x261f; 28429 t.pointingindexleftwhite = 0x261c; 28430 t.pointingindexrightwhite = 0x261e; 28431 t.pointingindexupwhite = 0x261d; 28432 t.pokatakana = 0x30dd; 28433 t.poplathai = 0x0e1b; 28434 t.postalmark = 0x3012; 28435 t.postalmarkface = 0x3020; 28436 t.pparen = 0x24ab; 28437 t.precedes = 0x227a; 28438 t.prescription = 0x211e; 28439 t.primemod = 0x02b9; 28440 t.primereversed = 0x2035; 28441 t.product = 0x220f; 28442 t.projective = 0x2305; 28443 t.prolongedkana = 0x30fc; 28444 t.propellor = 0x2318; 28445 t.propersubset = 0x2282; 28446 t.propersuperset = 0x2283; 28447 t.proportion = 0x2237; 28448 t.proportional = 0x221d; 28449 t.psi = 0x03c8; 28450 t.psicyrillic = 0x0471; 28451 t.psilipneumatacyrilliccmb = 0x0486; 28452 t.pssquare = 0x33b0; 28453 t.puhiragana = 0x3077; 28454 t.pukatakana = 0x30d7; 28455 t.pvsquare = 0x33b4; 28456 t.pwsquare = 0x33ba; 28457 t.q = 0x0071; 28458 t.qadeva = 0x0958; 28459 t.qadmahebrew = 0x05a8; 28460 t.qafarabic = 0x0642; 28461 t.qaffinalarabic = 0xfed6; 28462 t.qafinitialarabic = 0xfed7; 28463 t.qafmedialarabic = 0xfed8; 28464 t.qamats = 0x05b8; 28465 t.qamats10 = 0x05b8; 28466 t.qamats1a = 0x05b8; 28467 t.qamats1c = 0x05b8; 28468 t.qamats27 = 0x05b8; 28469 t.qamats29 = 0x05b8; 28470 t.qamats33 = 0x05b8; 28471 t.qamatsde = 0x05b8; 28472 t.qamatshebrew = 0x05b8; 28473 t.qamatsnarrowhebrew = 0x05b8; 28474 t.qamatsqatanhebrew = 0x05b8; 28475 t.qamatsqatannarrowhebrew = 0x05b8; 28476 t.qamatsqatanquarterhebrew = 0x05b8; 28477 t.qamatsqatanwidehebrew = 0x05b8; 28478 t.qamatsquarterhebrew = 0x05b8; 28479 t.qamatswidehebrew = 0x05b8; 28480 t.qarneyparahebrew = 0x059f; 28481 t.qbopomofo = 0x3111; 28482 t.qcircle = 0x24e0; 28483 t.qhook = 0x02a0; 28484 t.qmonospace = 0xff51; 28485 t.qof = 0x05e7; 28486 t.qofdagesh = 0xfb47; 28487 t.qofdageshhebrew = 0xfb47; 28488 t.qofhebrew = 0x05e7; 28489 t.qparen = 0x24ac; 28490 t.quarternote = 0x2669; 28491 t.qubuts = 0x05bb; 28492 t.qubuts18 = 0x05bb; 28493 t.qubuts25 = 0x05bb; 28494 t.qubuts31 = 0x05bb; 28495 t.qubutshebrew = 0x05bb; 28496 t.qubutsnarrowhebrew = 0x05bb; 28497 t.qubutsquarterhebrew = 0x05bb; 28498 t.qubutswidehebrew = 0x05bb; 28499 t.question = 0x003f; 28500 t.questionarabic = 0x061f; 28501 t.questionarmenian = 0x055e; 28502 t.questiondown = 0x00bf; 28503 t.questiondownsmall = 0xf7bf; 28504 t.questiongreek = 0x037e; 28505 t.questionmonospace = 0xff1f; 28506 t.questionsmall = 0xf73f; 28507 t.quotedbl = 0x0022; 28508 t.quotedblbase = 0x201e; 28509 t.quotedblleft = 0x201c; 28510 t.quotedblmonospace = 0xff02; 28511 t.quotedblprime = 0x301e; 28512 t.quotedblprimereversed = 0x301d; 28513 t.quotedblright = 0x201d; 28514 t.quoteleft = 0x2018; 28515 t.quoteleftreversed = 0x201b; 28516 t.quotereversed = 0x201b; 28517 t.quoteright = 0x2019; 28518 t.quoterightn = 0x0149; 28519 t.quotesinglbase = 0x201a; 28520 t.quotesingle = 0x0027; 28521 t.quotesinglemonospace = 0xff07; 28522 t.r = 0x0072; 28523 t.raarmenian = 0x057c; 28524 t.rabengali = 0x09b0; 28525 t.racute = 0x0155; 28526 t.radeva = 0x0930; 28527 t.radical = 0x221a; 28528 t.radicalex = 0xf8e5; 28529 t.radoverssquare = 0x33ae; 28530 t.radoverssquaredsquare = 0x33af; 28531 t.radsquare = 0x33ad; 28532 t.rafe = 0x05bf; 28533 t.rafehebrew = 0x05bf; 28534 t.ragujarati = 0x0ab0; 28535 t.ragurmukhi = 0x0a30; 28536 t.rahiragana = 0x3089; 28537 t.rakatakana = 0x30e9; 28538 t.rakatakanahalfwidth = 0xff97; 28539 t.ralowerdiagonalbengali = 0x09f1; 28540 t.ramiddlediagonalbengali = 0x09f0; 28541 t.ramshorn = 0x0264; 28542 t.ratio = 0x2236; 28543 t.rbopomofo = 0x3116; 28544 t.rcaron = 0x0159; 28545 t.rcedilla = 0x0157; 28546 t.rcircle = 0x24e1; 28547 t.rcommaaccent = 0x0157; 28548 t.rdblgrave = 0x0211; 28549 t.rdotaccent = 0x1e59; 28550 t.rdotbelow = 0x1e5b; 28551 t.rdotbelowmacron = 0x1e5d; 28552 t.referencemark = 0x203b; 28553 t.reflexsubset = 0x2286; 28554 t.reflexsuperset = 0x2287; 28555 t.registered = 0x00ae; 28556 t.registersans = 0xf8e8; 28557 t.registerserif = 0xf6da; 28558 t.reharabic = 0x0631; 28559 t.reharmenian = 0x0580; 28560 t.rehfinalarabic = 0xfeae; 28561 t.rehiragana = 0x308c; 28562 t.rekatakana = 0x30ec; 28563 t.rekatakanahalfwidth = 0xff9a; 28564 t.resh = 0x05e8; 28565 t.reshdageshhebrew = 0xfb48; 28566 t.reshhebrew = 0x05e8; 28567 t.reversedtilde = 0x223d; 28568 t.reviahebrew = 0x0597; 28569 t.reviamugrashhebrew = 0x0597; 28570 t.revlogicalnot = 0x2310; 28571 t.rfishhook = 0x027e; 28572 t.rfishhookreversed = 0x027f; 28573 t.rhabengali = 0x09dd; 28574 t.rhadeva = 0x095d; 28575 t.rho = 0x03c1; 28576 t.rhook = 0x027d; 28577 t.rhookturned = 0x027b; 28578 t.rhookturnedsuperior = 0x02b5; 28579 t.rhosymbolgreek = 0x03f1; 28580 t.rhotichookmod = 0x02de; 28581 t.rieulacirclekorean = 0x3271; 28582 t.rieulaparenkorean = 0x3211; 28583 t.rieulcirclekorean = 0x3263; 28584 t.rieulhieuhkorean = 0x3140; 28585 t.rieulkiyeokkorean = 0x313a; 28586 t.rieulkiyeoksioskorean = 0x3169; 28587 t.rieulkorean = 0x3139; 28588 t.rieulmieumkorean = 0x313b; 28589 t.rieulpansioskorean = 0x316c; 28590 t.rieulparenkorean = 0x3203; 28591 t.rieulphieuphkorean = 0x313f; 28592 t.rieulpieupkorean = 0x313c; 28593 t.rieulpieupsioskorean = 0x316b; 28594 t.rieulsioskorean = 0x313d; 28595 t.rieulthieuthkorean = 0x313e; 28596 t.rieultikeutkorean = 0x316a; 28597 t.rieulyeorinhieuhkorean = 0x316d; 28598 t.rightangle = 0x221f; 28599 t.righttackbelowcmb = 0x0319; 28600 t.righttriangle = 0x22bf; 28601 t.rihiragana = 0x308a; 28602 t.rikatakana = 0x30ea; 28603 t.rikatakanahalfwidth = 0xff98; 28604 t.ring = 0x02da; 28605 t.ringbelowcmb = 0x0325; 28606 t.ringcmb = 0x030a; 28607 t.ringhalfleft = 0x02bf; 28608 t.ringhalfleftarmenian = 0x0559; 28609 t.ringhalfleftbelowcmb = 0x031c; 28610 t.ringhalfleftcentered = 0x02d3; 28611 t.ringhalfright = 0x02be; 28612 t.ringhalfrightbelowcmb = 0x0339; 28613 t.ringhalfrightcentered = 0x02d2; 28614 t.rinvertedbreve = 0x0213; 28615 t.rittorusquare = 0x3351; 28616 t.rlinebelow = 0x1e5f; 28617 t.rlongleg = 0x027c; 28618 t.rlonglegturned = 0x027a; 28619 t.rmonospace = 0xff52; 28620 t.rohiragana = 0x308d; 28621 t.rokatakana = 0x30ed; 28622 t.rokatakanahalfwidth = 0xff9b; 28623 t.roruathai = 0x0e23; 28624 t.rparen = 0x24ad; 28625 t.rrabengali = 0x09dc; 28626 t.rradeva = 0x0931; 28627 t.rragurmukhi = 0x0a5c; 28628 t.rreharabic = 0x0691; 28629 t.rrehfinalarabic = 0xfb8d; 28630 t.rrvocalicbengali = 0x09e0; 28631 t.rrvocalicdeva = 0x0960; 28632 t.rrvocalicgujarati = 0x0ae0; 28633 t.rrvocalicvowelsignbengali = 0x09c4; 28634 t.rrvocalicvowelsigndeva = 0x0944; 28635 t.rrvocalicvowelsigngujarati = 0x0ac4; 28636 t.rsuperior = 0xf6f1; 28637 t.rtblock = 0x2590; 28638 t.rturned = 0x0279; 28639 t.rturnedsuperior = 0x02b4; 28640 t.ruhiragana = 0x308b; 28641 t.rukatakana = 0x30eb; 28642 t.rukatakanahalfwidth = 0xff99; 28643 t.rupeemarkbengali = 0x09f2; 28644 t.rupeesignbengali = 0x09f3; 28645 t.rupiah = 0xf6dd; 28646 t.ruthai = 0x0e24; 28647 t.rvocalicbengali = 0x098b; 28648 t.rvocalicdeva = 0x090b; 28649 t.rvocalicgujarati = 0x0a8b; 28650 t.rvocalicvowelsignbengali = 0x09c3; 28651 t.rvocalicvowelsigndeva = 0x0943; 28652 t.rvocalicvowelsigngujarati = 0x0ac3; 28653 t.s = 0x0073; 28654 t.sabengali = 0x09b8; 28655 t.sacute = 0x015b; 28656 t.sacutedotaccent = 0x1e65; 28657 t.sadarabic = 0x0635; 28658 t.sadeva = 0x0938; 28659 t.sadfinalarabic = 0xfeba; 28660 t.sadinitialarabic = 0xfebb; 28661 t.sadmedialarabic = 0xfebc; 28662 t.sagujarati = 0x0ab8; 28663 t.sagurmukhi = 0x0a38; 28664 t.sahiragana = 0x3055; 28665 t.sakatakana = 0x30b5; 28666 t.sakatakanahalfwidth = 0xff7b; 28667 t.sallallahoualayhewasallamarabic = 0xfdfa; 28668 t.samekh = 0x05e1; 28669 t.samekhdagesh = 0xfb41; 28670 t.samekhdageshhebrew = 0xfb41; 28671 t.samekhhebrew = 0x05e1; 28672 t.saraaathai = 0x0e32; 28673 t.saraaethai = 0x0e41; 28674 t.saraaimaimalaithai = 0x0e44; 28675 t.saraaimaimuanthai = 0x0e43; 28676 t.saraamthai = 0x0e33; 28677 t.saraathai = 0x0e30; 28678 t.saraethai = 0x0e40; 28679 t.saraiileftthai = 0xf886; 28680 t.saraiithai = 0x0e35; 28681 t.saraileftthai = 0xf885; 28682 t.saraithai = 0x0e34; 28683 t.saraothai = 0x0e42; 28684 t.saraueeleftthai = 0xf888; 28685 t.saraueethai = 0x0e37; 28686 t.saraueleftthai = 0xf887; 28687 t.sarauethai = 0x0e36; 28688 t.sarauthai = 0x0e38; 28689 t.sarauuthai = 0x0e39; 28690 t.sbopomofo = 0x3119; 28691 t.scaron = 0x0161; 28692 t.scarondotaccent = 0x1e67; 28693 t.scedilla = 0x015f; 28694 t.schwa = 0x0259; 28695 t.schwacyrillic = 0x04d9; 28696 t.schwadieresiscyrillic = 0x04db; 28697 t.schwahook = 0x025a; 28698 t.scircle = 0x24e2; 28699 t.scircumflex = 0x015d; 28700 t.scommaaccent = 0x0219; 28701 t.sdotaccent = 0x1e61; 28702 t.sdotbelow = 0x1e63; 28703 t.sdotbelowdotaccent = 0x1e69; 28704 t.seagullbelowcmb = 0x033c; 28705 t.second = 0x2033; 28706 t.secondtonechinese = 0x02ca; 28707 t.section = 0x00a7; 28708 t.seenarabic = 0x0633; 28709 t.seenfinalarabic = 0xfeb2; 28710 t.seeninitialarabic = 0xfeb3; 28711 t.seenmedialarabic = 0xfeb4; 28712 t.segol = 0x05b6; 28713 t.segol13 = 0x05b6; 28714 t.segol1f = 0x05b6; 28715 t.segol2c = 0x05b6; 28716 t.segolhebrew = 0x05b6; 28717 t.segolnarrowhebrew = 0x05b6; 28718 t.segolquarterhebrew = 0x05b6; 28719 t.segoltahebrew = 0x0592; 28720 t.segolwidehebrew = 0x05b6; 28721 t.seharmenian = 0x057d; 28722 t.sehiragana = 0x305b; 28723 t.sekatakana = 0x30bb; 28724 t.sekatakanahalfwidth = 0xff7e; 28725 t.semicolon = 0x003b; 28726 t.semicolonarabic = 0x061b; 28727 t.semicolonmonospace = 0xff1b; 28728 t.semicolonsmall = 0xfe54; 28729 t.semivoicedmarkkana = 0x309c; 28730 t.semivoicedmarkkanahalfwidth = 0xff9f; 28731 t.sentisquare = 0x3322; 28732 t.sentosquare = 0x3323; 28733 t.seven = 0x0037; 28734 t.sevenarabic = 0x0667; 28735 t.sevenbengali = 0x09ed; 28736 t.sevencircle = 0x2466; 28737 t.sevencircleinversesansserif = 0x2790; 28738 t.sevendeva = 0x096d; 28739 t.seveneighths = 0x215e; 28740 t.sevengujarati = 0x0aed; 28741 t.sevengurmukhi = 0x0a6d; 28742 t.sevenhackarabic = 0x0667; 28743 t.sevenhangzhou = 0x3027; 28744 t.sevenideographicparen = 0x3226; 28745 t.seveninferior = 0x2087; 28746 t.sevenmonospace = 0xff17; 28747 t.sevenoldstyle = 0xf737; 28748 t.sevenparen = 0x247a; 28749 t.sevenperiod = 0x248e; 28750 t.sevenpersian = 0x06f7; 28751 t.sevenroman = 0x2176; 28752 t.sevensuperior = 0x2077; 28753 t.seventeencircle = 0x2470; 28754 t.seventeenparen = 0x2484; 28755 t.seventeenperiod = 0x2498; 28756 t.seventhai = 0x0e57; 28757 t.sfthyphen = 0x00ad; 28758 t.shaarmenian = 0x0577; 28759 t.shabengali = 0x09b6; 28760 t.shacyrillic = 0x0448; 28761 t.shaddaarabic = 0x0651; 28762 t.shaddadammaarabic = 0xfc61; 28763 t.shaddadammatanarabic = 0xfc5e; 28764 t.shaddafathaarabic = 0xfc60; 28765 t.shaddakasraarabic = 0xfc62; 28766 t.shaddakasratanarabic = 0xfc5f; 28767 t.shade = 0x2592; 28768 t.shadedark = 0x2593; 28769 t.shadelight = 0x2591; 28770 t.shademedium = 0x2592; 28771 t.shadeva = 0x0936; 28772 t.shagujarati = 0x0ab6; 28773 t.shagurmukhi = 0x0a36; 28774 t.shalshelethebrew = 0x0593; 28775 t.shbopomofo = 0x3115; 28776 t.shchacyrillic = 0x0449; 28777 t.sheenarabic = 0x0634; 28778 t.sheenfinalarabic = 0xfeb6; 28779 t.sheeninitialarabic = 0xfeb7; 28780 t.sheenmedialarabic = 0xfeb8; 28781 t.sheicoptic = 0x03e3; 28782 t.sheqel = 0x20aa; 28783 t.sheqelhebrew = 0x20aa; 28784 t.sheva = 0x05b0; 28785 t.sheva115 = 0x05b0; 28786 t.sheva15 = 0x05b0; 28787 t.sheva22 = 0x05b0; 28788 t.sheva2e = 0x05b0; 28789 t.shevahebrew = 0x05b0; 28790 t.shevanarrowhebrew = 0x05b0; 28791 t.shevaquarterhebrew = 0x05b0; 28792 t.shevawidehebrew = 0x05b0; 28793 t.shhacyrillic = 0x04bb; 28794 t.shimacoptic = 0x03ed; 28795 t.shin = 0x05e9; 28796 t.shindagesh = 0xfb49; 28797 t.shindageshhebrew = 0xfb49; 28798 t.shindageshshindot = 0xfb2c; 28799 t.shindageshshindothebrew = 0xfb2c; 28800 t.shindageshsindot = 0xfb2d; 28801 t.shindageshsindothebrew = 0xfb2d; 28802 t.shindothebrew = 0x05c1; 28803 t.shinhebrew = 0x05e9; 28804 t.shinshindot = 0xfb2a; 28805 t.shinshindothebrew = 0xfb2a; 28806 t.shinsindot = 0xfb2b; 28807 t.shinsindothebrew = 0xfb2b; 28808 t.shook = 0x0282; 28809 t.sigma = 0x03c3; 28810 t.sigma1 = 0x03c2; 28811 t.sigmafinal = 0x03c2; 28812 t.sigmalunatesymbolgreek = 0x03f2; 28813 t.sihiragana = 0x3057; 28814 t.sikatakana = 0x30b7; 28815 t.sikatakanahalfwidth = 0xff7c; 28816 t.siluqhebrew = 0x05bd; 28817 t.siluqlefthebrew = 0x05bd; 28818 t.similar = 0x223c; 28819 t.sindothebrew = 0x05c2; 28820 t.siosacirclekorean = 0x3274; 28821 t.siosaparenkorean = 0x3214; 28822 t.sioscieuckorean = 0x317e; 28823 t.sioscirclekorean = 0x3266; 28824 t.sioskiyeokkorean = 0x317a; 28825 t.sioskorean = 0x3145; 28826 t.siosnieunkorean = 0x317b; 28827 t.siosparenkorean = 0x3206; 28828 t.siospieupkorean = 0x317d; 28829 t.siostikeutkorean = 0x317c; 28830 t.six = 0x0036; 28831 t.sixarabic = 0x0666; 28832 t.sixbengali = 0x09ec; 28833 t.sixcircle = 0x2465; 28834 t.sixcircleinversesansserif = 0x278f; 28835 t.sixdeva = 0x096c; 28836 t.sixgujarati = 0x0aec; 28837 t.sixgurmukhi = 0x0a6c; 28838 t.sixhackarabic = 0x0666; 28839 t.sixhangzhou = 0x3026; 28840 t.sixideographicparen = 0x3225; 28841 t.sixinferior = 0x2086; 28842 t.sixmonospace = 0xff16; 28843 t.sixoldstyle = 0xf736; 28844 t.sixparen = 0x2479; 28845 t.sixperiod = 0x248d; 28846 t.sixpersian = 0x06f6; 28847 t.sixroman = 0x2175; 28848 t.sixsuperior = 0x2076; 28849 t.sixteencircle = 0x246f; 28850 t.sixteencurrencydenominatorbengali = 0x09f9; 28851 t.sixteenparen = 0x2483; 28852 t.sixteenperiod = 0x2497; 28853 t.sixthai = 0x0e56; 28854 t.slash = 0x002f; 28855 t.slashmonospace = 0xff0f; 28856 t.slong = 0x017f; 28857 t.slongdotaccent = 0x1e9b; 28858 t.smileface = 0x263a; 28859 t.smonospace = 0xff53; 28860 t.sofpasuqhebrew = 0x05c3; 28861 t.softhyphen = 0x00ad; 28862 t.softsigncyrillic = 0x044c; 28863 t.sohiragana = 0x305d; 28864 t.sokatakana = 0x30bd; 28865 t.sokatakanahalfwidth = 0xff7f; 28866 t.soliduslongoverlaycmb = 0x0338; 28867 t.solidusshortoverlaycmb = 0x0337; 28868 t.sorusithai = 0x0e29; 28869 t.sosalathai = 0x0e28; 28870 t.sosothai = 0x0e0b; 28871 t.sosuathai = 0x0e2a; 28872 t.space = 0x0020; 28873 t.spacehackarabic = 0x0020; 28874 t.spade = 0x2660; 28875 t.spadesuitblack = 0x2660; 28876 t.spadesuitwhite = 0x2664; 28877 t.sparen = 0x24ae; 28878 t.squarebelowcmb = 0x033b; 28879 t.squarecc = 0x33c4; 28880 t.squarecm = 0x339d; 28881 t.squarediagonalcrosshatchfill = 0x25a9; 28882 t.squarehorizontalfill = 0x25a4; 28883 t.squarekg = 0x338f; 28884 t.squarekm = 0x339e; 28885 t.squarekmcapital = 0x33ce; 28886 t.squareln = 0x33d1; 28887 t.squarelog = 0x33d2; 28888 t.squaremg = 0x338e; 28889 t.squaremil = 0x33d5; 28890 t.squaremm = 0x339c; 28891 t.squaremsquared = 0x33a1; 28892 t.squareorthogonalcrosshatchfill = 0x25a6; 28893 t.squareupperlefttolowerrightfill = 0x25a7; 28894 t.squareupperrighttolowerleftfill = 0x25a8; 28895 t.squareverticalfill = 0x25a5; 28896 t.squarewhitewithsmallblack = 0x25a3; 28897 t.srsquare = 0x33db; 28898 t.ssabengali = 0x09b7; 28899 t.ssadeva = 0x0937; 28900 t.ssagujarati = 0x0ab7; 28901 t.ssangcieuckorean = 0x3149; 28902 t.ssanghieuhkorean = 0x3185; 28903 t.ssangieungkorean = 0x3180; 28904 t.ssangkiyeokkorean = 0x3132; 28905 t.ssangnieunkorean = 0x3165; 28906 t.ssangpieupkorean = 0x3143; 28907 t.ssangsioskorean = 0x3146; 28908 t.ssangtikeutkorean = 0x3138; 28909 t.ssuperior = 0xf6f2; 28910 t.sterling = 0x00a3; 28911 t.sterlingmonospace = 0xffe1; 28912 t.strokelongoverlaycmb = 0x0336; 28913 t.strokeshortoverlaycmb = 0x0335; 28914 t.subset = 0x2282; 28915 t.subsetnotequal = 0x228a; 28916 t.subsetorequal = 0x2286; 28917 t.succeeds = 0x227b; 28918 t.suchthat = 0x220b; 28919 t.suhiragana = 0x3059; 28920 t.sukatakana = 0x30b9; 28921 t.sukatakanahalfwidth = 0xff7d; 28922 t.sukunarabic = 0x0652; 28923 t.summation = 0x2211; 28924 t.sun = 0x263c; 28925 t.superset = 0x2283; 28926 t.supersetnotequal = 0x228b; 28927 t.supersetorequal = 0x2287; 28928 t.svsquare = 0x33dc; 28929 t.syouwaerasquare = 0x337c; 28930 t.t = 0x0074; 28931 t.tabengali = 0x09a4; 28932 t.tackdown = 0x22a4; 28933 t.tackleft = 0x22a3; 28934 t.tadeva = 0x0924; 28935 t.tagujarati = 0x0aa4; 28936 t.tagurmukhi = 0x0a24; 28937 t.taharabic = 0x0637; 28938 t.tahfinalarabic = 0xfec2; 28939 t.tahinitialarabic = 0xfec3; 28940 t.tahiragana = 0x305f; 28941 t.tahmedialarabic = 0xfec4; 28942 t.taisyouerasquare = 0x337d; 28943 t.takatakana = 0x30bf; 28944 t.takatakanahalfwidth = 0xff80; 28945 t.tatweelarabic = 0x0640; 28946 t.tau = 0x03c4; 28947 t.tav = 0x05ea; 28948 t.tavdages = 0xfb4a; 28949 t.tavdagesh = 0xfb4a; 28950 t.tavdageshhebrew = 0xfb4a; 28951 t.tavhebrew = 0x05ea; 28952 t.tbar = 0x0167; 28953 t.tbopomofo = 0x310a; 28954 t.tcaron = 0x0165; 28955 t.tccurl = 0x02a8; 28956 t.tcedilla = 0x0163; 28957 t.tcheharabic = 0x0686; 28958 t.tchehfinalarabic = 0xfb7b; 28959 t.tchehinitialarabic = 0xfb7c; 28960 t.tchehmedialarabic = 0xfb7d; 28961 t.tcircle = 0x24e3; 28962 t.tcircumflexbelow = 0x1e71; 28963 t.tcommaaccent = 0x0163; 28964 t.tdieresis = 0x1e97; 28965 t.tdotaccent = 0x1e6b; 28966 t.tdotbelow = 0x1e6d; 28967 t.tecyrillic = 0x0442; 28968 t.tedescendercyrillic = 0x04ad; 28969 t.teharabic = 0x062a; 28970 t.tehfinalarabic = 0xfe96; 28971 t.tehhahinitialarabic = 0xfca2; 28972 t.tehhahisolatedarabic = 0xfc0c; 28973 t.tehinitialarabic = 0xfe97; 28974 t.tehiragana = 0x3066; 28975 t.tehjeeminitialarabic = 0xfca1; 28976 t.tehjeemisolatedarabic = 0xfc0b; 28977 t.tehmarbutaarabic = 0x0629; 28978 t.tehmarbutafinalarabic = 0xfe94; 28979 t.tehmedialarabic = 0xfe98; 28980 t.tehmeeminitialarabic = 0xfca4; 28981 t.tehmeemisolatedarabic = 0xfc0e; 28982 t.tehnoonfinalarabic = 0xfc73; 28983 t.tekatakana = 0x30c6; 28984 t.tekatakanahalfwidth = 0xff83; 28985 t.telephone = 0x2121; 28986 t.telephoneblack = 0x260e; 28987 t.telishagedolahebrew = 0x05a0; 28988 t.telishaqetanahebrew = 0x05a9; 28989 t.tencircle = 0x2469; 28990 t.tenideographicparen = 0x3229; 28991 t.tenparen = 0x247d; 28992 t.tenperiod = 0x2491; 28993 t.tenroman = 0x2179; 28994 t.tesh = 0x02a7; 28995 t.tet = 0x05d8; 28996 t.tetdagesh = 0xfb38; 28997 t.tetdageshhebrew = 0xfb38; 28998 t.tethebrew = 0x05d8; 28999 t.tetsecyrillic = 0x04b5; 29000 t.tevirhebrew = 0x059b; 29001 t.tevirlefthebrew = 0x059b; 29002 t.thabengali = 0x09a5; 29003 t.thadeva = 0x0925; 29004 t.thagujarati = 0x0aa5; 29005 t.thagurmukhi = 0x0a25; 29006 t.thalarabic = 0x0630; 29007 t.thalfinalarabic = 0xfeac; 29008 t.thanthakhatlowleftthai = 0xf898; 29009 t.thanthakhatlowrightthai = 0xf897; 29010 t.thanthakhatthai = 0x0e4c; 29011 t.thanthakhatupperleftthai = 0xf896; 29012 t.theharabic = 0x062b; 29013 t.thehfinalarabic = 0xfe9a; 29014 t.thehinitialarabic = 0xfe9b; 29015 t.thehmedialarabic = 0xfe9c; 29016 t.thereexists = 0x2203; 29017 t.therefore = 0x2234; 29018 t.theta = 0x03b8; 29019 t.theta1 = 0x03d1; 29020 t.thetasymbolgreek = 0x03d1; 29021 t.thieuthacirclekorean = 0x3279; 29022 t.thieuthaparenkorean = 0x3219; 29023 t.thieuthcirclekorean = 0x326b; 29024 t.thieuthkorean = 0x314c; 29025 t.thieuthparenkorean = 0x320b; 29026 t.thirteencircle = 0x246c; 29027 t.thirteenparen = 0x2480; 29028 t.thirteenperiod = 0x2494; 29029 t.thonangmonthothai = 0x0e11; 29030 t.thook = 0x01ad; 29031 t.thophuthaothai = 0x0e12; 29032 t.thorn = 0x00fe; 29033 t.thothahanthai = 0x0e17; 29034 t.thothanthai = 0x0e10; 29035 t.thothongthai = 0x0e18; 29036 t.thothungthai = 0x0e16; 29037 t.thousandcyrillic = 0x0482; 29038 t.thousandsseparatorarabic = 0x066c; 29039 t.thousandsseparatorpersian = 0x066c; 29040 t.three = 0x0033; 29041 t.threearabic = 0x0663; 29042 t.threebengali = 0x09e9; 29043 t.threecircle = 0x2462; 29044 t.threecircleinversesansserif = 0x278c; 29045 t.threedeva = 0x0969; 29046 t.threeeighths = 0x215c; 29047 t.threegujarati = 0x0ae9; 29048 t.threegurmukhi = 0x0a69; 29049 t.threehackarabic = 0x0663; 29050 t.threehangzhou = 0x3023; 29051 t.threeideographicparen = 0x3222; 29052 t.threeinferior = 0x2083; 29053 t.threemonospace = 0xff13; 29054 t.threenumeratorbengali = 0x09f6; 29055 t.threeoldstyle = 0xf733; 29056 t.threeparen = 0x2476; 29057 t.threeperiod = 0x248a; 29058 t.threepersian = 0x06f3; 29059 t.threequarters = 0x00be; 29060 t.threequartersemdash = 0xf6de; 29061 t.threeroman = 0x2172; 29062 t.threesuperior = 0x00b3; 29063 t.threethai = 0x0e53; 29064 t.thzsquare = 0x3394; 29065 t.tihiragana = 0x3061; 29066 t.tikatakana = 0x30c1; 29067 t.tikatakanahalfwidth = 0xff81; 29068 t.tikeutacirclekorean = 0x3270; 29069 t.tikeutaparenkorean = 0x3210; 29070 t.tikeutcirclekorean = 0x3262; 29071 t.tikeutkorean = 0x3137; 29072 t.tikeutparenkorean = 0x3202; 29073 t.tilde = 0x02dc; 29074 t.tildebelowcmb = 0x0330; 29075 t.tildecmb = 0x0303; 29076 t.tildecomb = 0x0303; 29077 t.tildedoublecmb = 0x0360; 29078 t.tildeoperator = 0x223c; 29079 t.tildeoverlaycmb = 0x0334; 29080 t.tildeverticalcmb = 0x033e; 29081 t.timescircle = 0x2297; 29082 t.tipehahebrew = 0x0596; 29083 t.tipehalefthebrew = 0x0596; 29084 t.tippigurmukhi = 0x0a70; 29085 t.titlocyrilliccmb = 0x0483; 29086 t.tiwnarmenian = 0x057f; 29087 t.tlinebelow = 0x1e6f; 29088 t.tmonospace = 0xff54; 29089 t.toarmenian = 0x0569; 29090 t.tohiragana = 0x3068; 29091 t.tokatakana = 0x30c8; 29092 t.tokatakanahalfwidth = 0xff84; 29093 t.tonebarextrahighmod = 0x02e5; 29094 t.tonebarextralowmod = 0x02e9; 29095 t.tonebarhighmod = 0x02e6; 29096 t.tonebarlowmod = 0x02e8; 29097 t.tonebarmidmod = 0x02e7; 29098 t.tonefive = 0x01bd; 29099 t.tonesix = 0x0185; 29100 t.tonetwo = 0x01a8; 29101 t.tonos = 0x0384; 29102 t.tonsquare = 0x3327; 29103 t.topatakthai = 0x0e0f; 29104 t.tortoiseshellbracketleft = 0x3014; 29105 t.tortoiseshellbracketleftsmall = 0xfe5d; 29106 t.tortoiseshellbracketleftvertical = 0xfe39; 29107 t.tortoiseshellbracketright = 0x3015; 29108 t.tortoiseshellbracketrightsmall = 0xfe5e; 29109 t.tortoiseshellbracketrightvertical = 0xfe3a; 29110 t.totaothai = 0x0e15; 29111 t.tpalatalhook = 0x01ab; 29112 t.tparen = 0x24af; 29113 t.trademark = 0x2122; 29114 t.trademarksans = 0xf8ea; 29115 t.trademarkserif = 0xf6db; 29116 t.tretroflexhook = 0x0288; 29117 t.triagdn = 0x25bc; 29118 t.triaglf = 0x25c4; 29119 t.triagrt = 0x25ba; 29120 t.triagup = 0x25b2; 29121 t.ts = 0x02a6; 29122 t.tsadi = 0x05e6; 29123 t.tsadidagesh = 0xfb46; 29124 t.tsadidageshhebrew = 0xfb46; 29125 t.tsadihebrew = 0x05e6; 29126 t.tsecyrillic = 0x0446; 29127 t.tsere = 0x05b5; 29128 t.tsere12 = 0x05b5; 29129 t.tsere1e = 0x05b5; 29130 t.tsere2b = 0x05b5; 29131 t.tserehebrew = 0x05b5; 29132 t.tserenarrowhebrew = 0x05b5; 29133 t.tserequarterhebrew = 0x05b5; 29134 t.tserewidehebrew = 0x05b5; 29135 t.tshecyrillic = 0x045b; 29136 t.tsuperior = 0xf6f3; 29137 t.ttabengali = 0x099f; 29138 t.ttadeva = 0x091f; 29139 t.ttagujarati = 0x0a9f; 29140 t.ttagurmukhi = 0x0a1f; 29141 t.tteharabic = 0x0679; 29142 t.ttehfinalarabic = 0xfb67; 29143 t.ttehinitialarabic = 0xfb68; 29144 t.ttehmedialarabic = 0xfb69; 29145 t.tthabengali = 0x09a0; 29146 t.tthadeva = 0x0920; 29147 t.tthagujarati = 0x0aa0; 29148 t.tthagurmukhi = 0x0a20; 29149 t.tturned = 0x0287; 29150 t.tuhiragana = 0x3064; 29151 t.tukatakana = 0x30c4; 29152 t.tukatakanahalfwidth = 0xff82; 29153 t.tusmallhiragana = 0x3063; 29154 t.tusmallkatakana = 0x30c3; 29155 t.tusmallkatakanahalfwidth = 0xff6f; 29156 t.twelvecircle = 0x246b; 29157 t.twelveparen = 0x247f; 29158 t.twelveperiod = 0x2493; 29159 t.twelveroman = 0x217b; 29160 t.twentycircle = 0x2473; 29161 t.twentyhangzhou = 0x5344; 29162 t.twentyparen = 0x2487; 29163 t.twentyperiod = 0x249b; 29164 t.two = 0x0032; 29165 t.twoarabic = 0x0662; 29166 t.twobengali = 0x09e8; 29167 t.twocircle = 0x2461; 29168 t.twocircleinversesansserif = 0x278b; 29169 t.twodeva = 0x0968; 29170 t.twodotenleader = 0x2025; 29171 t.twodotleader = 0x2025; 29172 t.twodotleadervertical = 0xfe30; 29173 t.twogujarati = 0x0ae8; 29174 t.twogurmukhi = 0x0a68; 29175 t.twohackarabic = 0x0662; 29176 t.twohangzhou = 0x3022; 29177 t.twoideographicparen = 0x3221; 29178 t.twoinferior = 0x2082; 29179 t.twomonospace = 0xff12; 29180 t.twonumeratorbengali = 0x09f5; 29181 t.twooldstyle = 0xf732; 29182 t.twoparen = 0x2475; 29183 t.twoperiod = 0x2489; 29184 t.twopersian = 0x06f2; 29185 t.tworoman = 0x2171; 29186 t.twostroke = 0x01bb; 29187 t.twosuperior = 0x00b2; 29188 t.twothai = 0x0e52; 29189 t.twothirds = 0x2154; 29190 t.u = 0x0075; 29191 t.uacute = 0x00fa; 29192 t.ubar = 0x0289; 29193 t.ubengali = 0x0989; 29194 t.ubopomofo = 0x3128; 29195 t.ubreve = 0x016d; 29196 t.ucaron = 0x01d4; 29197 t.ucircle = 0x24e4; 29198 t.ucircumflex = 0x00fb; 29199 t.ucircumflexbelow = 0x1e77; 29200 t.ucyrillic = 0x0443; 29201 t.udattadeva = 0x0951; 29202 t.udblacute = 0x0171; 29203 t.udblgrave = 0x0215; 29204 t.udeva = 0x0909; 29205 t.udieresis = 0x00fc; 29206 t.udieresisacute = 0x01d8; 29207 t.udieresisbelow = 0x1e73; 29208 t.udieresiscaron = 0x01da; 29209 t.udieresiscyrillic = 0x04f1; 29210 t.udieresisgrave = 0x01dc; 29211 t.udieresismacron = 0x01d6; 29212 t.udotbelow = 0x1ee5; 29213 t.ugrave = 0x00f9; 29214 t.ugujarati = 0x0a89; 29215 t.ugurmukhi = 0x0a09; 29216 t.uhiragana = 0x3046; 29217 t.uhookabove = 0x1ee7; 29218 t.uhorn = 0x01b0; 29219 t.uhornacute = 0x1ee9; 29220 t.uhorndotbelow = 0x1ef1; 29221 t.uhorngrave = 0x1eeb; 29222 t.uhornhookabove = 0x1eed; 29223 t.uhorntilde = 0x1eef; 29224 t.uhungarumlaut = 0x0171; 29225 t.uhungarumlautcyrillic = 0x04f3; 29226 t.uinvertedbreve = 0x0217; 29227 t.ukatakana = 0x30a6; 29228 t.ukatakanahalfwidth = 0xff73; 29229 t.ukcyrillic = 0x0479; 29230 t.ukorean = 0x315c; 29231 t.umacron = 0x016b; 29232 t.umacroncyrillic = 0x04ef; 29233 t.umacrondieresis = 0x1e7b; 29234 t.umatragurmukhi = 0x0a41; 29235 t.umonospace = 0xff55; 29236 t.underscore = 0x005f; 29237 t.underscoredbl = 0x2017; 29238 t.underscoremonospace = 0xff3f; 29239 t.underscorevertical = 0xfe33; 29240 t.underscorewavy = 0xfe4f; 29241 t.union = 0x222a; 29242 t.universal = 0x2200; 29243 t.uogonek = 0x0173; 29244 t.uparen = 0x24b0; 29245 t.upblock = 0x2580; 29246 t.upperdothebrew = 0x05c4; 29247 t.upsilon = 0x03c5; 29248 t.upsilondieresis = 0x03cb; 29249 t.upsilondieresistonos = 0x03b0; 29250 t.upsilonlatin = 0x028a; 29251 t.upsilontonos = 0x03cd; 29252 t.uptackbelowcmb = 0x031d; 29253 t.uptackmod = 0x02d4; 29254 t.uragurmukhi = 0x0a73; 29255 t.uring = 0x016f; 29256 t.ushortcyrillic = 0x045e; 29257 t.usmallhiragana = 0x3045; 29258 t.usmallkatakana = 0x30a5; 29259 t.usmallkatakanahalfwidth = 0xff69; 29260 t.ustraightcyrillic = 0x04af; 29261 t.ustraightstrokecyrillic = 0x04b1; 29262 t.utilde = 0x0169; 29263 t.utildeacute = 0x1e79; 29264 t.utildebelow = 0x1e75; 29265 t.uubengali = 0x098a; 29266 t.uudeva = 0x090a; 29267 t.uugujarati = 0x0a8a; 29268 t.uugurmukhi = 0x0a0a; 29269 t.uumatragurmukhi = 0x0a42; 29270 t.uuvowelsignbengali = 0x09c2; 29271 t.uuvowelsigndeva = 0x0942; 29272 t.uuvowelsigngujarati = 0x0ac2; 29273 t.uvowelsignbengali = 0x09c1; 29274 t.uvowelsigndeva = 0x0941; 29275 t.uvowelsigngujarati = 0x0ac1; 29276 t.v = 0x0076; 29277 t.vadeva = 0x0935; 29278 t.vagujarati = 0x0ab5; 29279 t.vagurmukhi = 0x0a35; 29280 t.vakatakana = 0x30f7; 29281 t.vav = 0x05d5; 29282 t.vavdagesh = 0xfb35; 29283 t.vavdagesh65 = 0xfb35; 29284 t.vavdageshhebrew = 0xfb35; 29285 t.vavhebrew = 0x05d5; 29286 t.vavholam = 0xfb4b; 29287 t.vavholamhebrew = 0xfb4b; 29288 t.vavvavhebrew = 0x05f0; 29289 t.vavyodhebrew = 0x05f1; 29290 t.vcircle = 0x24e5; 29291 t.vdotbelow = 0x1e7f; 29292 t.vecyrillic = 0x0432; 29293 t.veharabic = 0x06a4; 29294 t.vehfinalarabic = 0xfb6b; 29295 t.vehinitialarabic = 0xfb6c; 29296 t.vehmedialarabic = 0xfb6d; 29297 t.vekatakana = 0x30f9; 29298 t.venus = 0x2640; 29299 t.verticalbar = 0x007c; 29300 t.verticallineabovecmb = 0x030d; 29301 t.verticallinebelowcmb = 0x0329; 29302 t.verticallinelowmod = 0x02cc; 29303 t.verticallinemod = 0x02c8; 29304 t.vewarmenian = 0x057e; 29305 t.vhook = 0x028b; 29306 t.vikatakana = 0x30f8; 29307 t.viramabengali = 0x09cd; 29308 t.viramadeva = 0x094d; 29309 t.viramagujarati = 0x0acd; 29310 t.visargabengali = 0x0983; 29311 t.visargadeva = 0x0903; 29312 t.visargagujarati = 0x0a83; 29313 t.vmonospace = 0xff56; 29314 t.voarmenian = 0x0578; 29315 t.voicediterationhiragana = 0x309e; 29316 t.voicediterationkatakana = 0x30fe; 29317 t.voicedmarkkana = 0x309b; 29318 t.voicedmarkkanahalfwidth = 0xff9e; 29319 t.vokatakana = 0x30fa; 29320 t.vparen = 0x24b1; 29321 t.vtilde = 0x1e7d; 29322 t.vturned = 0x028c; 29323 t.vuhiragana = 0x3094; 29324 t.vukatakana = 0x30f4; 29325 t.w = 0x0077; 29326 t.wacute = 0x1e83; 29327 t.waekorean = 0x3159; 29328 t.wahiragana = 0x308f; 29329 t.wakatakana = 0x30ef; 29330 t.wakatakanahalfwidth = 0xff9c; 29331 t.wakorean = 0x3158; 29332 t.wasmallhiragana = 0x308e; 29333 t.wasmallkatakana = 0x30ee; 29334 t.wattosquare = 0x3357; 29335 t.wavedash = 0x301c; 29336 t.wavyunderscorevertical = 0xfe34; 29337 t.wawarabic = 0x0648; 29338 t.wawfinalarabic = 0xfeee; 29339 t.wawhamzaabovearabic = 0x0624; 29340 t.wawhamzaabovefinalarabic = 0xfe86; 29341 t.wbsquare = 0x33dd; 29342 t.wcircle = 0x24e6; 29343 t.wcircumflex = 0x0175; 29344 t.wdieresis = 0x1e85; 29345 t.wdotaccent = 0x1e87; 29346 t.wdotbelow = 0x1e89; 29347 t.wehiragana = 0x3091; 29348 t.weierstrass = 0x2118; 29349 t.wekatakana = 0x30f1; 29350 t.wekorean = 0x315e; 29351 t.weokorean = 0x315d; 29352 t.wgrave = 0x1e81; 29353 t.whitebullet = 0x25e6; 29354 t.whitecircle = 0x25cb; 29355 t.whitecircleinverse = 0x25d9; 29356 t.whitecornerbracketleft = 0x300e; 29357 t.whitecornerbracketleftvertical = 0xfe43; 29358 t.whitecornerbracketright = 0x300f; 29359 t.whitecornerbracketrightvertical = 0xfe44; 29360 t.whitediamond = 0x25c7; 29361 t.whitediamondcontainingblacksmalldiamond = 0x25c8; 29362 t.whitedownpointingsmalltriangle = 0x25bf; 29363 t.whitedownpointingtriangle = 0x25bd; 29364 t.whiteleftpointingsmalltriangle = 0x25c3; 29365 t.whiteleftpointingtriangle = 0x25c1; 29366 t.whitelenticularbracketleft = 0x3016; 29367 t.whitelenticularbracketright = 0x3017; 29368 t.whiterightpointingsmalltriangle = 0x25b9; 29369 t.whiterightpointingtriangle = 0x25b7; 29370 t.whitesmallsquare = 0x25ab; 29371 t.whitesmilingface = 0x263a; 29372 t.whitesquare = 0x25a1; 29373 t.whitestar = 0x2606; 29374 t.whitetelephone = 0x260f; 29375 t.whitetortoiseshellbracketleft = 0x3018; 29376 t.whitetortoiseshellbracketright = 0x3019; 29377 t.whiteuppointingsmalltriangle = 0x25b5; 29378 t.whiteuppointingtriangle = 0x25b3; 29379 t.wihiragana = 0x3090; 29380 t.wikatakana = 0x30f0; 29381 t.wikorean = 0x315f; 29382 t.wmonospace = 0xff57; 29383 t.wohiragana = 0x3092; 29384 t.wokatakana = 0x30f2; 29385 t.wokatakanahalfwidth = 0xff66; 29386 t.won = 0x20a9; 29387 t.wonmonospace = 0xffe6; 29388 t.wowaenthai = 0x0e27; 29389 t.wparen = 0x24b2; 29390 t.wring = 0x1e98; 29391 t.wsuperior = 0x02b7; 29392 t.wturned = 0x028d; 29393 t.wynn = 0x01bf; 29394 t.x = 0x0078; 29395 t.xabovecmb = 0x033d; 29396 t.xbopomofo = 0x3112; 29397 t.xcircle = 0x24e7; 29398 t.xdieresis = 0x1e8d; 29399 t.xdotaccent = 0x1e8b; 29400 t.xeharmenian = 0x056d; 29401 t.xi = 0x03be; 29402 t.xmonospace = 0xff58; 29403 t.xparen = 0x24b3; 29404 t.xsuperior = 0x02e3; 29405 t.y = 0x0079; 29406 t.yaadosquare = 0x334e; 29407 t.yabengali = 0x09af; 29408 t.yacute = 0x00fd; 29409 t.yadeva = 0x092f; 29410 t.yaekorean = 0x3152; 29411 t.yagujarati = 0x0aaf; 29412 t.yagurmukhi = 0x0a2f; 29413 t.yahiragana = 0x3084; 29414 t.yakatakana = 0x30e4; 29415 t.yakatakanahalfwidth = 0xff94; 29416 t.yakorean = 0x3151; 29417 t.yamakkanthai = 0x0e4e; 29418 t.yasmallhiragana = 0x3083; 29419 t.yasmallkatakana = 0x30e3; 29420 t.yasmallkatakanahalfwidth = 0xff6c; 29421 t.yatcyrillic = 0x0463; 29422 t.ycircle = 0x24e8; 29423 t.ycircumflex = 0x0177; 29424 t.ydieresis = 0x00ff; 29425 t.ydotaccent = 0x1e8f; 29426 t.ydotbelow = 0x1ef5; 29427 t.yeharabic = 0x064a; 29428 t.yehbarreearabic = 0x06d2; 29429 t.yehbarreefinalarabic = 0xfbaf; 29430 t.yehfinalarabic = 0xfef2; 29431 t.yehhamzaabovearabic = 0x0626; 29432 t.yehhamzaabovefinalarabic = 0xfe8a; 29433 t.yehhamzaaboveinitialarabic = 0xfe8b; 29434 t.yehhamzaabovemedialarabic = 0xfe8c; 29435 t.yehinitialarabic = 0xfef3; 29436 t.yehmedialarabic = 0xfef4; 29437 t.yehmeeminitialarabic = 0xfcdd; 29438 t.yehmeemisolatedarabic = 0xfc58; 29439 t.yehnoonfinalarabic = 0xfc94; 29440 t.yehthreedotsbelowarabic = 0x06d1; 29441 t.yekorean = 0x3156; 29442 t.yen = 0x00a5; 29443 t.yenmonospace = 0xffe5; 29444 t.yeokorean = 0x3155; 29445 t.yeorinhieuhkorean = 0x3186; 29446 t.yerahbenyomohebrew = 0x05aa; 29447 t.yerahbenyomolefthebrew = 0x05aa; 29448 t.yericyrillic = 0x044b; 29449 t.yerudieresiscyrillic = 0x04f9; 29450 t.yesieungkorean = 0x3181; 29451 t.yesieungpansioskorean = 0x3183; 29452 t.yesieungsioskorean = 0x3182; 29453 t.yetivhebrew = 0x059a; 29454 t.ygrave = 0x1ef3; 29455 t.yhook = 0x01b4; 29456 t.yhookabove = 0x1ef7; 29457 t.yiarmenian = 0x0575; 29458 t.yicyrillic = 0x0457; 29459 t.yikorean = 0x3162; 29460 t.yinyang = 0x262f; 29461 t.yiwnarmenian = 0x0582; 29462 t.ymonospace = 0xff59; 29463 t.yod = 0x05d9; 29464 t.yoddagesh = 0xfb39; 29465 t.yoddageshhebrew = 0xfb39; 29466 t.yodhebrew = 0x05d9; 29467 t.yodyodhebrew = 0x05f2; 29468 t.yodyodpatahhebrew = 0xfb1f; 29469 t.yohiragana = 0x3088; 29470 t.yoikorean = 0x3189; 29471 t.yokatakana = 0x30e8; 29472 t.yokatakanahalfwidth = 0xff96; 29473 t.yokorean = 0x315b; 29474 t.yosmallhiragana = 0x3087; 29475 t.yosmallkatakana = 0x30e7; 29476 t.yosmallkatakanahalfwidth = 0xff6e; 29477 t.yotgreek = 0x03f3; 29478 t.yoyaekorean = 0x3188; 29479 t.yoyakorean = 0x3187; 29480 t.yoyakthai = 0x0e22; 29481 t.yoyingthai = 0x0e0d; 29482 t.yparen = 0x24b4; 29483 t.ypogegrammeni = 0x037a; 29484 t.ypogegrammenigreekcmb = 0x0345; 29485 t.yr = 0x01a6; 29486 t.yring = 0x1e99; 29487 t.ysuperior = 0x02b8; 29488 t.ytilde = 0x1ef9; 29489 t.yturned = 0x028e; 29490 t.yuhiragana = 0x3086; 29491 t.yuikorean = 0x318c; 29492 t.yukatakana = 0x30e6; 29493 t.yukatakanahalfwidth = 0xff95; 29494 t.yukorean = 0x3160; 29495 t.yusbigcyrillic = 0x046b; 29496 t.yusbigiotifiedcyrillic = 0x046d; 29497 t.yuslittlecyrillic = 0x0467; 29498 t.yuslittleiotifiedcyrillic = 0x0469; 29499 t.yusmallhiragana = 0x3085; 29500 t.yusmallkatakana = 0x30e5; 29501 t.yusmallkatakanahalfwidth = 0xff6d; 29502 t.yuyekorean = 0x318b; 29503 t.yuyeokorean = 0x318a; 29504 t.yyabengali = 0x09df; 29505 t.yyadeva = 0x095f; 29506 t.z = 0x007a; 29507 t.zaarmenian = 0x0566; 29508 t.zacute = 0x017a; 29509 t.zadeva = 0x095b; 29510 t.zagurmukhi = 0x0a5b; 29511 t.zaharabic = 0x0638; 29512 t.zahfinalarabic = 0xfec6; 29513 t.zahinitialarabic = 0xfec7; 29514 t.zahiragana = 0x3056; 29515 t.zahmedialarabic = 0xfec8; 29516 t.zainarabic = 0x0632; 29517 t.zainfinalarabic = 0xfeb0; 29518 t.zakatakana = 0x30b6; 29519 t.zaqefgadolhebrew = 0x0595; 29520 t.zaqefqatanhebrew = 0x0594; 29521 t.zarqahebrew = 0x0598; 29522 t.zayin = 0x05d6; 29523 t.zayindagesh = 0xfb36; 29524 t.zayindageshhebrew = 0xfb36; 29525 t.zayinhebrew = 0x05d6; 29526 t.zbopomofo = 0x3117; 29527 t.zcaron = 0x017e; 29528 t.zcircle = 0x24e9; 29529 t.zcircumflex = 0x1e91; 29530 t.zcurl = 0x0291; 29531 t.zdot = 0x017c; 29532 t.zdotaccent = 0x017c; 29533 t.zdotbelow = 0x1e93; 29534 t.zecyrillic = 0x0437; 29535 t.zedescendercyrillic = 0x0499; 29536 t.zedieresiscyrillic = 0x04df; 29537 t.zehiragana = 0x305c; 29538 t.zekatakana = 0x30bc; 29539 t.zero = 0x0030; 29540 t.zeroarabic = 0x0660; 29541 t.zerobengali = 0x09e6; 29542 t.zerodeva = 0x0966; 29543 t.zerogujarati = 0x0ae6; 29544 t.zerogurmukhi = 0x0a66; 29545 t.zerohackarabic = 0x0660; 29546 t.zeroinferior = 0x2080; 29547 t.zeromonospace = 0xff10; 29548 t.zerooldstyle = 0xf730; 29549 t.zeropersian = 0x06f0; 29550 t.zerosuperior = 0x2070; 29551 t.zerothai = 0x0e50; 29552 t.zerowidthjoiner = 0xfeff; 29553 t.zerowidthnonjoiner = 0x200c; 29554 t.zerowidthspace = 0x200b; 29555 t.zeta = 0x03b6; 29556 t.zhbopomofo = 0x3113; 29557 t.zhearmenian = 0x056a; 29558 t.zhebrevecyrillic = 0x04c2; 29559 t.zhecyrillic = 0x0436; 29560 t.zhedescendercyrillic = 0x0497; 29561 t.zhedieresiscyrillic = 0x04dd; 29562 t.zihiragana = 0x3058; 29563 t.zikatakana = 0x30b8; 29564 t.zinorhebrew = 0x05ae; 29565 t.zlinebelow = 0x1e95; 29566 t.zmonospace = 0xff5a; 29567 t.zohiragana = 0x305e; 29568 t.zokatakana = 0x30be; 29569 t.zparen = 0x24b5; 29570 t.zretroflexhook = 0x0290; 29571 t.zstroke = 0x01b6; 29572 t.zuhiragana = 0x305a; 29573 t.zukatakana = 0x30ba; 29574 t[".notdef"] = 0x0000; 29575 t.angbracketleftbig = 0x2329; 29576 t.angbracketleftBig = 0x2329; 29577 t.angbracketleftbigg = 0x2329; 29578 t.angbracketleftBigg = 0x2329; 29579 t.angbracketrightBig = 0x232a; 29580 t.angbracketrightbig = 0x232a; 29581 t.angbracketrightBigg = 0x232a; 29582 t.angbracketrightbigg = 0x232a; 29583 t.arrowhookleft = 0x21aa; 29584 t.arrowhookright = 0x21a9; 29585 t.arrowlefttophalf = 0x21bc; 29586 t.arrowleftbothalf = 0x21bd; 29587 t.arrownortheast = 0x2197; 29588 t.arrownorthwest = 0x2196; 29589 t.arrowrighttophalf = 0x21c0; 29590 t.arrowrightbothalf = 0x21c1; 29591 t.arrowsoutheast = 0x2198; 29592 t.arrowsouthwest = 0x2199; 29593 t.backslashbig = 0x2216; 29594 t.backslashBig = 0x2216; 29595 t.backslashBigg = 0x2216; 29596 t.backslashbigg = 0x2216; 29597 t.bardbl = 0x2016; 29598 t.bracehtipdownleft = 0xfe37; 29599 t.bracehtipdownright = 0xfe37; 29600 t.bracehtipupleft = 0xfe38; 29601 t.bracehtipupright = 0xfe38; 29602 t.braceleftBig = 0x007b; 29603 t.braceleftbig = 0x007b; 29604 t.braceleftbigg = 0x007b; 29605 t.braceleftBigg = 0x007b; 29606 t.bracerightBig = 0x007d; 29607 t.bracerightbig = 0x007d; 29608 t.bracerightbigg = 0x007d; 29609 t.bracerightBigg = 0x007d; 29610 t.bracketleftbig = 0x005b; 29611 t.bracketleftBig = 0x005b; 29612 t.bracketleftbigg = 0x005b; 29613 t.bracketleftBigg = 0x005b; 29614 t.bracketrightBig = 0x005d; 29615 t.bracketrightbig = 0x005d; 29616 t.bracketrightbigg = 0x005d; 29617 t.bracketrightBigg = 0x005d; 29618 t.ceilingleftbig = 0x2308; 29619 t.ceilingleftBig = 0x2308; 29620 t.ceilingleftBigg = 0x2308; 29621 t.ceilingleftbigg = 0x2308; 29622 t.ceilingrightbig = 0x2309; 29623 t.ceilingrightBig = 0x2309; 29624 t.ceilingrightbigg = 0x2309; 29625 t.ceilingrightBigg = 0x2309; 29626 t.circledotdisplay = 0x2299; 29627 t.circledottext = 0x2299; 29628 t.circlemultiplydisplay = 0x2297; 29629 t.circlemultiplytext = 0x2297; 29630 t.circleplusdisplay = 0x2295; 29631 t.circleplustext = 0x2295; 29632 t.contintegraldisplay = 0x222e; 29633 t.contintegraltext = 0x222e; 29634 t.coproductdisplay = 0x2210; 29635 t.coproducttext = 0x2210; 29636 t.floorleftBig = 0x230a; 29637 t.floorleftbig = 0x230a; 29638 t.floorleftbigg = 0x230a; 29639 t.floorleftBigg = 0x230a; 29640 t.floorrightbig = 0x230b; 29641 t.floorrightBig = 0x230b; 29642 t.floorrightBigg = 0x230b; 29643 t.floorrightbigg = 0x230b; 29644 t.hatwide = 0x0302; 29645 t.hatwider = 0x0302; 29646 t.hatwidest = 0x0302; 29647 t.intercal = 0x1d40; 29648 t.integraldisplay = 0x222b; 29649 t.integraltext = 0x222b; 29650 t.intersectiondisplay = 0x22c2; 29651 t.intersectiontext = 0x22c2; 29652 t.logicalanddisplay = 0x2227; 29653 t.logicalandtext = 0x2227; 29654 t.logicalordisplay = 0x2228; 29655 t.logicalortext = 0x2228; 29656 t.parenleftBig = 0x0028; 29657 t.parenleftbig = 0x0028; 29658 t.parenleftBigg = 0x0028; 29659 t.parenleftbigg = 0x0028; 29660 t.parenrightBig = 0x0029; 29661 t.parenrightbig = 0x0029; 29662 t.parenrightBigg = 0x0029; 29663 t.parenrightbigg = 0x0029; 29664 t.prime = 0x2032; 29665 t.productdisplay = 0x220f; 29666 t.producttext = 0x220f; 29667 t.radicalbig = 0x221a; 29668 t.radicalBig = 0x221a; 29669 t.radicalBigg = 0x221a; 29670 t.radicalbigg = 0x221a; 29671 t.radicalbt = 0x221a; 29672 t.radicaltp = 0x221a; 29673 t.radicalvertex = 0x221a; 29674 t.slashbig = 0x002f; 29675 t.slashBig = 0x002f; 29676 t.slashBigg = 0x002f; 29677 t.slashbigg = 0x002f; 29678 t.summationdisplay = 0x2211; 29679 t.summationtext = 0x2211; 29680 t.tildewide = 0x02dc; 29681 t.tildewider = 0x02dc; 29682 t.tildewidest = 0x02dc; 29683 t.uniondisplay = 0x22c3; 29684 t.unionmultidisplay = 0x228e; 29685 t.unionmultitext = 0x228e; 29686 t.unionsqdisplay = 0x2294; 29687 t.unionsqtext = 0x2294; 29688 t.uniontext = 0x22c3; 29689 t.vextenddouble = 0x2225; 29690 t.vextendsingle = 0x2223; 29691});
29692exports.getGlyphsUnicode = getGlyphsUnicode; 29693const getDingbatsGlyphsUnicode = (0, _core_utils.getLookupTableFactory)(function (t) { 29694 t.space = 0x0020; 29695 t.a1 = 0x2701; 29696 t.a2 = 0x2702; 29697 t.a202 = 0x2703; 29698 t.a3 = 0x2704; 29699 t.a4 = 0x260e; 29700 t.a5 = 0x2706; 29701 t.a119 = 0x2707; 29702 t.a118 = 0x2708; 29703 t.a117 = 0x2709; 29704 t.a11 = 0x261b; 29705 t.a12 = 0x261e; 29706 t.a13 = 0x270c; 29707 t.a14 = 0x270d; 29708 t.a15 = 0x270e; 29709 t.a16 = 0x270f; 29710 t.a105 = 0x2710; 29711 t.a17 = 0x2711; 29712 t.a18 = 0x2712; 29713 t.a19 = 0x2713; 29714 t.a20 = 0x2714; 29715 t.a21 = 0x2715; 29716 t.a22 = 0x2716; 29717 t.a23 = 0x2717; 29718 t.a24 = 0x2718; 29719 t.a25 = 0x2719; 29720 t.a26 = 0x271a; 29721 t.a27 = 0x271b; 29722 t.a28 = 0x271c; 29723 t.a6 = 0x271d; 29724 t.a7 = 0x271e; 29725 t.a8 = 0x271f; 29726 t.a9 = 0x2720; 29727 t.a10 = 0x2721; 29728 t.a29 = 0x2722; 29729 t.a30 = 0x2723; 29730 t.a31 = 0x2724; 29731 t.a32 = 0x2725; 29732 t.a33 = 0x2726; 29733 t.a34 = 0x2727; 29734 t.a35 = 0x2605; 29735 t.a36 = 0x2729; 29736 t.a37 = 0x272a; 29737 t.a38 = 0x272b; 29738 t.a39 = 0x272c; 29739 t.a40 = 0x272d; 29740 t.a41 = 0x272e; 29741 t.a42 = 0x272f; 29742 t.a43 = 0x2730; 29743 t.a44 = 0x2731; 29744 t.a45 = 0x2732; 29745 t.a46 = 0x2733; 29746 t.a47 = 0x2734; 29747 t.a48 = 0x2735; 29748 t.a49 = 0x2736; 29749 t.a50 = 0x2737; 29750 t.a51 = 0x2738; 29751 t.a52 = 0x2739; 29752 t.a53 = 0x273a; 29753 t.a54 = 0x273b; 29754 t.a55 = 0x273c; 29755 t.a56 = 0x273d; 29756 t.a57 = 0x273e; 29757 t.a58 = 0x273f; 29758 t.a59 = 0x2740; 29759 t.a60 = 0x2741; 29760 t.a61 = 0x2742; 29761 t.a62 = 0x2743; 29762 t.a63 = 0x2744; 29763 t.a64 = 0x2745; 29764 t.a65 = 0x2746; 29765 t.a66 = 0x2747; 29766 t.a67 = 0x2748; 29767 t.a68 = 0x2749; 29768 t.a69 = 0x274a; 29769 t.a70 = 0x274b; 29770 t.a71 = 0x25cf; 29771 t.a72 = 0x274d; 29772 t.a73 = 0x25a0; 29773 t.a74 = 0x274f; 29774 t.a203 = 0x2750; 29775 t.a75 = 0x2751; 29776 t.a204 = 0x2752; 29777 t.a76 = 0x25b2; 29778 t.a77 = 0x25bc; 29779 t.a78 = 0x25c6; 29780 t.a79 = 0x2756; 29781 t.a81 = 0x25d7; 29782 t.a82 = 0x2758; 29783 t.a83 = 0x2759; 29784 t.a84 = 0x275a; 29785 t.a97 = 0x275b; 29786 t.a98 = 0x275c; 29787 t.a99 = 0x275d; 29788 t.a100 = 0x275e; 29789 t.a101 = 0x2761; 29790 t.a102 = 0x2762; 29791 t.a103 = 0x2763; 29792 t.a104 = 0x2764; 29793 t.a106 = 0x2765; 29794 t.a107 = 0x2766; 29795 t.a108 = 0x2767; 29796 t.a112 = 0x2663; 29797 t.a111 = 0x2666; 29798 t.a110 = 0x2665; 29799 t.a109 = 0x2660; 29800 t.a120 = 0x2460; 29801 t.a121 = 0x2461; 29802 t.a122 = 0x2462; 29803 t.a123 = 0x2463; 29804 t.a124 = 0x2464; 29805 t.a125 = 0x2465; 29806 t.a126 = 0x2466; 29807 t.a127 = 0x2467; 29808 t.a128 = 0x2468; 29809 t.a129 = 0x2469; 29810 t.a130 = 0x2776; 29811 t.a131 = 0x2777; 29812 t.a132 = 0x2778; 29813 t.a133 = 0x2779; 29814 t.a134 = 0x277a; 29815 t.a135 = 0x277b; 29816 t.a136 = 0x277c; 29817 t.a137 = 0x277d; 29818 t.a138 = 0x277e; 29819 t.a139 = 0x277f; 29820 t.a140 = 0x2780; 29821 t.a141 = 0x2781; 29822 t.a142 = 0x2782; 29823 t.a143 = 0x2783; 29824 t.a144 = 0x2784; 29825 t.a145 = 0x2785; 29826 t.a146 = 0x2786; 29827 t.a147 = 0x2787; 29828 t.a148 = 0x2788; 29829 t.a149 = 0x2789; 29830 t.a150 = 0x278a; 29831 t.a151 = 0x278b; 29832 t.a152 = 0x278c; 29833 t.a153 = 0x278d; 29834 t.a154 = 0x278e; 29835 t.a155 = 0x278f; 29836 t.a156 = 0x2790; 29837 t.a157 = 0x2791; 29838 t.a158 = 0x2792; 29839 t.a159 = 0x2793; 29840 t.a160 = 0x2794; 29841 t.a161 = 0x2192; 29842 t.a163 = 0x2194; 29843 t.a164 = 0x2195; 29844 t.a196 = 0x2798; 29845 t.a165 = 0x2799; 29846 t.a192 = 0x279a; 29847 t.a166 = 0x279b; 29848 t.a167 = 0x279c; 29849 t.a168 = 0x279d; 29850 t.a169 = 0x279e; 29851 t.a170 = 0x279f; 29852 t.a171 = 0x27a0; 29853 t.a172 = 0x27a1; 29854 t.a173 = 0x27a2; 29855 t.a162 = 0x27a3; 29856 t.a174 = 0x27a4; 29857 t.a175 = 0x27a5; 29858 t.a176 = 0x27a6; 29859 t.a177 = 0x27a7; 29860 t.a178 = 0x27a8; 29861 t.a179 = 0x27a9; 29862 t.a193 = 0x27aa; 29863 t.a180 = 0x27ab; 29864 t.a199 = 0x27ac; 29865 t.a181 = 0x27ad; 29866 t.a200 = 0x27ae; 29867 t.a182 = 0x27af; 29868 t.a201 = 0x27b1; 29869 t.a183 = 0x27b2; 29870 t.a184 = 0x27b3; 29871 t.a197 = 0x27b4; 29872 t.a185 = 0x27b5; 29873 t.a194 = 0x27b6; 29874 t.a198 = 0x27b7; 29875 t.a186 = 0x27b8; 29876 t.a195 = 0x27b9; 29877 t.a187 = 0x27ba; 29878 t.a188 = 0x27bb; 29879 t.a189 = 0x27bc; 29880 t.a190 = 0x27bd; 29881 t.a191 = 0x27be; 29882 t.a89 = 0x2768; 29883 t.a90 = 0x2769; 29884 t.a93 = 0x276a; 29885 t.a94 = 0x276b; 29886 t.a91 = 0x276c; 29887 t.a92 = 0x276d; 29888 t.a205 = 0x276e; 29889 t.a85 = 0x276f; 29890 t.a206 = 0x2770; 29891 t.a86 = 0x2771; 29892 t.a87 = 0x2772; 29893 t.a88 = 0x2773; 29894 t.a95 = 0x2774; 29895 t.a96 = 0x2775; 29896 t[".notdef"] = 0x0000; 29897}); 29898exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode; 29899 29900/***/ }), 29901/* 40 */ 29902/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 29903 29904 29905 29906Object.defineProperty(exports, "__esModule", ({ 29907 value: true 29908})); 29909exports.clearUnicodeCaches = clearUnicodeCaches; 29910exports.getCharUnicodeCategory = getCharUnicodeCategory; 29911exports.getUnicodeForGlyph = getUnicodeForGlyph; 29912exports.getUnicodeRangeFor = getUnicodeRangeFor; 29913exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues; 29914var _core_utils = __w_pdfjs_require__(3);
vendor: 5,739 bytes, lines 29915-30026
29915const getSpecialPUASymbols = (0, _core_utils.getLookupTableFactory)(function (t) { 29916 t[63721] = 0x00a9; 29917 t[63193] = 0x00a9; 29918 t[63720] = 0x00ae; 29919 t[63194] = 0x00ae; 29920 t[63722] = 0x2122; 29921 t[63195] = 0x2122; 29922 t[63729] = 0x23a7; 29923 t[63730] = 0x23a8; 29924 t[63731] = 0x23a9; 29925 t[63740] = 0x23ab; 29926 t[63741] = 0x23ac; 29927 t[63742] = 0x23ad; 29928 t[63726] = 0x23a1; 29929 t[63727] = 0x23a2; 29930 t[63728] = 0x23a3; 29931 t[63737] = 0x23a4; 29932 t[63738] = 0x23a5; 29933 t[63739] = 0x23a6; 29934 t[63723] = 0x239b; 29935 t[63724] = 0x239c; 29936 t[63725] = 0x239d; 29937 t[63734] = 0x239e; 29938 t[63735] = 0x239f; 29939 t[63736] = 0x23a0; 29940}); 29941function mapSpecialUnicodeValues(code) { 29942 if (code >= 0xfff0 && code <= 0xffff) { 29943 return 0; 29944 } else if (code >= 0xf600 && code <= 0xf8ff) { 29945 return getSpecialPUASymbols()[code] || code; 29946 } else if (code === 0x00ad) { 29947 return 0x002d; 29948 } 29949 return code; 29950} 29951function getUnicodeForGlyph(name, glyphsUnicodeMap) { 29952 let unicode = glyphsUnicodeMap[name]; 29953 if (unicode !== undefined) { 29954 return unicode; 29955 } 29956 if (!name) { 29957 return -1; 29958 } 29959 if (name[0] === "u") { 29960 const nameLen = name.length; 29961 let hexStr; 29962 if (nameLen === 7 && name[1] === "n" && name[2] === "i") { 29963 hexStr = name.substring(3); 29964 } else if (nameLen >= 5 && nameLen <= 7) { 29965 hexStr = name.substring(1); 29966 } else { 29967 return -1; 29968 } 29969 if (hexStr === hexStr.toUpperCase()) { 29970 unicode = parseInt(hexStr, 16); 29971 if (unicode >= 0) { 29972 return unicode; 29973 } 29974 } 29975 } 29976 return -1; 29977} 29978const UnicodeRanges = [[0x0000, 0x007f], [0x0080, 0x00ff], [0x0100, 0x017f], [0x0180, 0x024f], [0x0250, 0x02af, 0x1d00, 0x1d7f, 0x1d80, 0x1dbf], [0x02b0, 0x02ff, 0xa700, 0xa71f], [0x0300, 0x036f, 0x1dc0, 0x1dff], [0x0370, 0x03ff], [0x2c80, 0x2cff], [0x0400, 0x04ff, 0x0500, 0x052f, 0x2de0, 0x2dff, 0xa640, 0xa69f], [0x0530, 0x058f], [0x0590, 0x05ff], [0xa500, 0xa63f], [0x0600, 0x06ff, 0x0750, 0x077f], [0x07c0, 0x07ff], [0x0900, 0x097f], [0x0980, 0x09ff], [0x0a00, 0x0a7f], [0x0a80, 0x0aff], [0x0b00, 0x0b7f], [0x0b80, 0x0bff], [0x0c00, 0x0c7f], [0x0c80, 0x0cff], [0x0d00, 0x0d7f], [0x0e00, 0x0e7f], [0x0e80, 0x0eff], [0x10a0, 0x10ff, 0x2d00, 0x2d2f], [0x1b00, 0x1b7f], [0x1100, 0x11ff], [0x1e00, 0x1eff, 0x2c60, 0x2c7f, 0xa720, 0xa7ff], [0x1f00, 0x1fff], [0x2000, 0x206f, 0x2e00, 0x2e7f], [0x2070, 0x209f], [0x20a0, 0x20cf], [0x20d0, 0x20ff], [0x2100, 0x214f], [0x2150, 0x218f], [0x2190, 0x21ff, 0x27f0, 0x27ff, 0x2900, 0x297f, 0x2b00, 0x2bff], [0x2200, 0x22ff, 0x2a00, 0x2aff, 0x27c0, 0x27ef, 0x2980, 0x29ff], [0x2300, 0x23ff], [0x2400, 0x243f], [0x2440, 0x245f], [0x2460, 0x24ff], [0x2500, 0x257f], [0x2580, 0x259f], [0x25a0, 0x25ff], [0x2600, 0x26ff], [0x2700, 0x27bf], [0x3000, 0x303f], [0x3040, 0x309f], [0x30a0, 0x30ff, 0x31f0, 0x31ff], [0x3100, 0x312f, 0x31a0, 0x31bf], [0x3130, 0x318f], [0xa840, 0xa87f], [0x3200, 0x32ff], [0x3300, 0x33ff], [0xac00, 0xd7af], [0xd800, 0xdfff], [0x10900, 0x1091f], [0x4e00, 0x9fff, 0x2e80, 0x2eff, 0x2f00, 0x2fdf, 0x2ff0, 0x2fff, 0x3400, 0x4dbf, 0x20000, 0x2a6df, 0x3190, 0x319f], [0xe000, 0xf8ff], [0x31c0, 0x31ef, 0xf900, 0xfaff, 0x2f800, 0x2fa1f], [0xfb00, 0xfb4f], [0xfb50, 0xfdff], [0xfe20, 0xfe2f], [0xfe10, 0xfe1f], [0xfe50, 0xfe6f], [0xfe70, 0xfeff], [0xff00, 0xffef], [0xfff0, 0xffff], [0x0f00, 0x0fff], [0x0700, 0x074f], [0x0780, 0x07bf], [0x0d80, 0x0dff], [0x1000, 0x109f], [0x1200, 0x137f, 0x1380, 0x139f, 0x2d80, 0x2ddf], [0x13a0, 0x13ff], [0x1400, 0x167f], [0x1680, 0x169f], [0x16a0, 0x16ff], [0x1780, 0x17ff], [0x1800, 0x18af], [0x2800, 0x28ff], [0xa000, 0xa48f], [0x1700, 0x171f, 0x1720, 0x173f, 0x1740, 0x175f, 0x1760, 0x177f], [0x10300, 0x1032f], [0x10330, 0x1034f], [0x10400, 0x1044f], [0x1d000, 0x1d0ff, 0x1d100, 0x1d1ff, 0x1d200, 0x1d24f], [0x1d400, 0x1d7ff], [0xff000, 0xffffd], [0xfe00, 0xfe0f, 0xe0100, 0xe01ef], [0xe0000, 0xe007f], [0x1900, 0x194f], [0x1950, 0x197f], [0x1980, 0x19df], [0x1a00, 0x1a1f], [0x2c00, 0x2c5f], [0x2d30, 0x2d7f], [0x4dc0, 0x4dff], [0xa800, 0xa82f], [0x10000, 0x1007f, 0x10080, 0x100ff, 0x10100, 0x1013f], [0x10140, 0x1018f], [0x10380, 0x1039f], [0x103a0, 0x103df], [0x10450, 0x1047f], [0x10480, 0x104af], [0x10800, 0x1083f], [0x10a00, 0x10a5f], [0x1d300, 0x1d35f], [0x12000, 0x123ff, 0x12400, 0x1247f], [0x1d360, 0x1d37f], [0x1b80, 0x1bbf], [0x1c00, 0x1c4f], [0x1c50, 0x1c7f], [0xa880, 0xa8df], [0xa900, 0xa92f], [0xa930, 0xa95f], [0xaa00, 0xaa5f], [0x10190, 0x101cf], [0x101d0, 0x101ff], [0x102a0, 0x102df, 0x10280, 0x1029f, 0x10920, 0x1093f], [0x1f030, 0x1f09f, 0x1f000, 0x1f02f]]; 29979function getUnicodeRangeFor(value, lastPosition = -1) { 29980 if (lastPosition !== -1) { 29981 const range = UnicodeRanges[lastPosition]; 29982 for (let i = 0, ii = range.length; i < ii; i += 2) { 29983 if (value >= range[i] && value <= range[i + 1]) { 29984 return lastPosition; 29985 } 29986 } 29987 } 29988 for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) { 29989 const range = UnicodeRanges[i]; 29990 for (let j = 0, jj = range.length; j < jj; j += 2) { 29991 if (value >= range[j] && value <= range[j + 1]) { 29992 return i; 29993 } 29994 } 29995 } 29996 return -1; 29997} 29998const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u"); 29999const CategoryCache = new Map(); 30000function getCharUnicodeCategory(char) { 30001 const cachedCategory = CategoryCache.get(char); 30002 if (cachedCategory) { 30003 return cachedCategory; 30004 } 30005 const groups = char.match(SpecialCharRegExp); 30006 const category = { 30007 isWhitespace: !!groups?.[1], 30008 isZeroWidthDiacritic: !!groups?.[2], 30009 isInvisibleFormatMark: !!groups?.[3] 30010 }; 30011 CategoryCache.set(char, category); 30012 return category; 30013} 30014function clearUnicodeCaches() { 30015 CategoryCache.clear(); 30016} 30017 30018/***/ }), 30019/* 41 */ 30020/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 30021 30022 30023 30024Object.defineProperty(exports, "__esModule", ({ 30025 value: true 30026}));
30027exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0; 30028exports.getStandardFontName = getStandardFontName; 30029exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0; 30030exports.isKnownFontName = isKnownFontName; 30031var _core_utils = __w_pdfjs_require__(3); 30032var _fonts_utils = __w_pdfjs_require__(38); 30033const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 30034 t["Times-Roman"] = "Times-Roman"; 30035 t.Helvetica = "Helvetica"; 30036 t.Courier = "Courier"; 30037 t.Symbol = "Symbol"; 30038 t["Times-Bold"] = "Times-Bold"; 30039 t["Helvetica-Bold"] = "Helvetica-Bold"; 30040 t["Courier-Bold"] = "Courier-Bold"; 30041 t.ZapfDingbats = "ZapfDingbats"; 30042 t["Times-Italic"] = "Times-Italic"; 30043 t["Helvetica-Oblique"] = "Helvetica-Oblique"; 30044 t["Courier-Oblique"] = "Courier-Oblique"; 30045 t["Times-BoldItalic"] = "Times-BoldItalic"; 30046 t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique"; 30047 t["Courier-BoldOblique"] = "Courier-BoldOblique"; 30048 t.ArialNarrow = "Helvetica"; 30049 t["ArialNarrow-Bold"] = "Helvetica-Bold"; 30050 t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique"; 30051 t["ArialNarrow-Italic"] = "Helvetica-Oblique"; 30052 t.ArialBlack = "Helvetica"; 30053 t["ArialBlack-Bold"] = "Helvetica-Bold"; 30054 t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique"; 30055 t["ArialBlack-Italic"] = "Helvetica-Oblique"; 30056 t["Arial-Black"] = "Helvetica"; 30057 t["Arial-Black-Bold"] = "Helvetica-Bold"; 30058 t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique"; 30059 t["Arial-Black-Italic"] = "Helvetica-Oblique"; 30060 t.Arial = "Helvetica"; 30061 t["Arial-Bold"] = "Helvetica-Bold"; 30062 t["Arial-BoldItalic"] = "Helvetica-BoldOblique"; 30063 t["Arial-Italic"] = "Helvetica-Oblique"; 30064 t.ArialMT = "Helvetica"; 30065 t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique"; 30066 t["Arial-BoldMT"] = "Helvetica-Bold"; 30067 t["Arial-ItalicMT"] = "Helvetica-Oblique"; 30068 t["Arial-BoldItalicMT-BoldItalic"] = "Helvetica-BoldOblique";
30069 t["Arial-BoldMT-Bold"] = "Helvetica-Bold"; 30070 t["Arial-ItalicMT-Italic"] = "Helvetica-Oblique"; 30071 t.ArialUnicodeMS = "Helvetica"; 30072 t["ArialUnicodeMS-Bold"] = "Helvetica-Bold"; 30073 t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique"; 30074 t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique"; 30075 t["Courier-BoldItalic"] = "Courier-BoldOblique"; 30076 t["Courier-Italic"] = "Courier-Oblique"; 30077 t.CourierNew = "Courier"; 30078 t["CourierNew-Bold"] = "Courier-Bold"; 30079 t["CourierNew-BoldItalic"] = "Courier-BoldOblique"; 30080 t["CourierNew-Italic"] = "Courier-Oblique"; 30081 t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique"; 30082 t["CourierNewPS-BoldMT"] = "Courier-Bold"; 30083 t["CourierNewPS-ItalicMT"] = "Courier-Oblique"; 30084 t.CourierNewPSMT = "Courier"; 30085 t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique"; 30086 t["Helvetica-Italic"] = "Helvetica-Oblique"; 30087 t["Symbol-Bold"] = "Symbol"; 30088 t["Symbol-BoldItalic"] = "Symbol"; 30089 t["Symbol-Italic"] = "Symbol"; 30090 t.TimesNewRoman = "Times-Roman"; 30091 t["TimesNewRoman-Bold"] = "Times-Bold"; 30092 t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic"; 30093 t["TimesNewRoman-Italic"] = "Times-Italic"; 30094 t.TimesNewRomanPS = "Times-Roman"; 30095 t["TimesNewRomanPS-Bold"] = "Times-Bold"; 30096 t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic"; 30097 t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic"; 30098 t["TimesNewRomanPS-BoldMT"] = "Times-Bold"; 30099 t["TimesNewRomanPS-Italic"] = "Times-Italic"; 30100 t["TimesNewRomanPS-ItalicMT"] = "Times-Italic"; 30101 t.TimesNewRomanPSMT = "Times-Roman"; 30102 t["TimesNewRomanPSMT-Bold"] = "Times-Bold"; 30103 t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic"; 30104 t["TimesNewRomanPSMT-Italic"] = "Times-Italic"; 30105}); 30106exports.getStdFontMap = getStdFontMap; 30107const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) { 30108 t.Courier = "FoxitFixed.pfb"; 30109 t["Courier-Bold"] = "FoxitFixedBold.pfb"; 30110 t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb"; 30111 t["Courier-Oblique"] = "FoxitFixedItalic.pfb"; 30112 t.Helvetica = "LiberationSans-Regular.ttf"; 30113 t["Helvetica-Bold"] = "LiberationSans-Bold.ttf"; 30114 t["Helvetica-BoldOblique"] = "LiberationSans-BoldItalic.ttf"; 30115 t["Helvetica-Oblique"] = "LiberationSans-Italic.ttf"; 30116 t["Times-Roman"] = "FoxitSerif.pfb"; 30117 t["Times-Bold"] = "FoxitSerifBold.pfb"; 30118 t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb"; 30119 t["Times-Italic"] = "FoxitSerifItalic.pfb"; 30120 t.Symbol = "FoxitSymbol.pfb"; 30121 t.ZapfDingbats = "FoxitDingbats.pfb"; 30122 t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf"; 30123 t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf"; 30124 t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf"; 30125 t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf"; 30126}); 30127exports.getFontNameToFileMap = getFontNameToFileMap; 30128const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 30129 t.Calibri = "Helvetica"; 30130 t["Calibri-Bold"] = "Helvetica-Bold"; 30131 t["Calibri-BoldItalic"] = "Helvetica-BoldOblique"; 30132 t["Calibri-Italic"] = "Helvetica-Oblique"; 30133 t.CenturyGothic = "Helvetica"; 30134 t["CenturyGothic-Bold"] = "Helvetica-Bold"; 30135 t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique"; 30136 t["CenturyGothic-Italic"] = "Helvetica-Oblique"; 30137 t.ComicSansMS = "Comic Sans MS"; 30138 t["ComicSansMS-Bold"] = "Comic Sans MS-Bold"; 30139 t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic"; 30140 t["ComicSansMS-Italic"] = "Comic Sans MS-Italic"; 30141 t.Impact = "Helvetica"; 30142 t["ItcSymbol-Bold"] = "Helvetica-Bold"; 30143 t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique"; 30144 t["ItcSymbol-Book"] = "Helvetica"; 30145 t["ItcSymbol-BookItalic"] = "Helvetica-Oblique"; 30146 t["ItcSymbol-Medium"] = "Helvetica"; 30147 t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique"; 30148 t.LucidaConsole = "Courier"; 30149 t["LucidaConsole-Bold"] = "Courier-Bold"; 30150 t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique"; 30151 t["LucidaConsole-Italic"] = "Courier-Oblique"; 30152 t["LucidaSans-Demi"] = "Helvetica-Bold"; 30153 t["MS-Gothic"] = "MS Gothic"; 30154 t["MS-Gothic-Bold"] = "MS Gothic-Bold"; 30155 t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic"; 30156 t["MS-Gothic-Italic"] = "MS Gothic-Italic"; 30157 t["MS-Mincho"] = "MS Mincho"; 30158 t["MS-Mincho-Bold"] = "MS Mincho-Bold"; 30159 t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic"; 30160 t["MS-Mincho-Italic"] = "MS Mincho-Italic"; 30161 t["MS-PGothic"] = "MS PGothic"; 30162 t["MS-PGothic-Bold"] = "MS PGothic-Bold"; 30163 t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic"; 30164 t["MS-PGothic-Italic"] = "MS PGothic-Italic"; 30165 t["MS-PMincho"] = "MS PMincho"; 30166 t["MS-PMincho-Bold"] = "MS PMincho-Bold"; 30167 t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic"; 30168 t["MS-PMincho-Italic"] = "MS PMincho-Italic"; 30169 t.NuptialScript = "Times-Italic"; 30170 t.SegoeUISymbol = "Helvetica"; 30171}); 30172exports.getNonStdFontMap = getNonStdFontMap; 30173const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 30174 t["Adobe Jenson"] = true; 30175 t["Adobe Text"] = true; 30176 t.Albertus = true;
30177 t.Aldus = true; 30178 t.Alexandria = true; 30179 t.Algerian = true; 30180 t["American Typewriter"] = true; 30181 t.Antiqua = true; 30182 t.Apex = true; 30183 t.Arno = true; 30184 t.Aster = true; 30185 t.Aurora = true; 30186 t.Baskerville = true; 30187 t.Bell = true; 30188 t.Bembo = true; 30189 t["Bembo Schoolbook"] = true; 30190 t.Benguiat = true; 30191 t["Berkeley Old Style"] = true; 30192 t["Bernhard Modern"] = true; 30193 t["Berthold City"] = true; 30194 t.Bodoni = true; 30195 t["Bauer Bodoni"] = true; 30196 t["Book Antiqua"] = true; 30197 t.Bookman = true; 30198 t["Bordeaux Roman"] = true; 30199 t["Californian FB"] = true; 30200 t.Calisto = true; 30201 t.Calvert = true; 30202 t.Capitals = true; 30203 t.Cambria = true; 30204 t.Cartier = true; 30205 t.Caslon = true; 30206 t.Catull = true; 30207 t.Centaur = true; 30208 t["Century Old Style"] = true; 30209 t["Century Schoolbook"] = true; 30210 t.Chaparral = true; 30211 t["Charis SIL"] = true; 30212 t.Cheltenham = true; 30213 t["Cholla Slab"] = true; 30214 t.Clarendon = true; 30215 t.Clearface = true; 30216 t.Cochin = true; 30217 t.Colonna = true; 30218 t["Computer Modern"] = true; 30219 t["Concrete Roman"] = true; 30220 t.Constantia = true; 30221 t["Cooper Black"] = true; 30222 t.Corona = true; 30223 t.Ecotype = true; 30224 t.Egyptienne = true; 30225 t.Elephant = true; 30226 t.Excelsior = true; 30227 t.Fairfield = true; 30228 t["FF Scala"] = true; 30229 t.Folkard = true; 30230 t.Footlight = true; 30231 t.FreeSerif = true; 30232 t["Friz Quadrata"] = true; 30233 t.Garamond = true; 30234 t.Gentium = true; 30235 t.Georgia = true; 30236 t.Gloucester = true; 30237 t["Goudy Old Style"] = true; 30238 t["Goudy Schoolbook"] = true; 30239 t["Goudy Pro Font"] = true; 30240 t.Granjon = true; 30241 t["Guardian Egyptian"] = true; 30242 t.Heather = true; 30243 t.Hercules = true; 30244 t["High Tower Text"] = true; 30245 t.Hiroshige = true; 30246 t["Hoefler Text"] = true; 30247 t["Humana Serif"] = true; 30248 t.Imprint = true; 30249 t["Ionic No. 5"] = true; 30250 t.Janson = true; 30251 t.Joanna = true; 30252 t.Korinna = true; 30253 t.Lexicon = true; 30254 t.LiberationSerif = true; 30255 t["Liberation Serif"] = true; 30256 t["Linux Libertine"] = true; 30257 t.Literaturnaya = true; 30258 t.Lucida = true; 30259 t["Lucida Bright"] = true; 30260 t.Melior = true; 30261 t.Memphis = true; 30262 t.Miller = true; 30263 t.Minion = true; 30264 t.Modern = true; 30265 t["Mona Lisa"] = true; 30266 t["Mrs Eaves"] = true; 30267 t["MS Serif"] = true; 30268 t["Museo Slab"] = true; 30269 t["New York"] = true; 30270 t["Nimbus Roman"] = true; 30271 t["NPS Rawlinson Roadway"] = true; 30272 t.NuptialScript = true; 30273 t.Palatino = true; 30274 t.Perpetua = true; 30275 t.Plantin = true; 30276 t["Plantin Schoolbook"] = true; 30277 t.Playbill = true; 30278 t["Poor Richard"] = true; 30279 t["Rawlinson Roadway"] = true; 30280 t.Renault = true; 30281 t.Requiem = true; 30282 t.Rockwell = true; 30283 t.Roman = true; 30284 t["Rotis Serif"] = true; 30285 t.Sabon = true; 30286 t.Scala = true; 30287 t.Seagull = true; 30288 t.Sistina = true; 30289 t.Souvenir = true; 30290 t.STIX = true; 30291 t["Stone Informal"] = true; 30292 t["Stone Serif"] = true; 30293 t.Sylfaen = true; 30294 t.Times = true; 30295 t.Trajan = true; 30296 t["Trinité"] = true; 30297 t["Trump Mediaeval"] = true; 30298 t.Utopia = true; 30299 t["Vale Type"] = true; 30300 t["Bitstream Vera"] = true; 30301 t["Vera Serif"] = true; 30302 t.Versailles = true; 30303 t.Wanted = true; 30304 t.Weiss = true; 30305 t["Wide Latin"] = true; 30306 t.Windsor = true; 30307 t.XITS = true; 30308}); 30309exports.getSerifFonts = getSerifFonts; 30310const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 30311 t.Dingbats = true; 30312 t.Symbol = true; 30313 t.ZapfDingbats = true; 30314 t.Wingdings = true; 30315 t["Wingdings-Bold"] = true; 30316 t["Wingdings-Regular"] = true; 30317}); 30318exports.getSymbolsFonts = getSymbolsFonts; 30319const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 30320 t[2] = 10; 30321 t[3] = 32; 30322 t[4] = 33; 30323 t[5] = 34; 30324 t[6] = 35; 30325 t[7] = 36; 30326 t[8] = 37; 30327 t[9] = 38; 30328 t[10] = 39; 30329 t[11] = 40; 30330 t[12] = 41; 30331 t[13] = 42; 30332 t[14] = 43; 30333 t[15] = 44; 30334 t[16] = 45; 30335 t[17] = 46; 30336 t[18] = 47; 30337 t[19] = 48; 30338 t[20] = 49; 30339 t[21] = 50; 30340 t[22] = 51; 30341 t[23] = 52; 30342 t[24] = 53; 30343 t[25] = 54; 30344 t[26] = 55; 30345 t[27] = 56; 30346 t[28] = 57; 30347 t[29] = 58; 30348 t[30] = 894; 30349 t[31] = 60; 30350 t[32] = 61; 30351 t[33] = 62; 30352 t[34] = 63; 30353 t[35] = 64; 30354 t[36] = 65; 30355 t[37] = 66; 30356 t[38] = 67; 30357 t[39] = 68; 30358 t[40] = 69; 30359 t[41] = 70; 30360 t[42] = 71; 30361 t[43] = 72; 30362 t[44] = 73; 30363 t[45] = 74; 30364 t[46] = 75; 30365 t[47] = 76; 30366 t[48] = 77; 30367 t[49] = 78; 30368 t[50] = 79; 30369 t[51] = 80; 30370 t[52] = 81; 30371 t[53] = 82; 30372 t[54] = 83; 30373 t[55] = 84; 30374 t[56] = 85; 30375 t[57] = 86; 30376 t[58] = 87; 30377 t[59] = 88; 30378 t[60] = 89; 30379 t[61] = 90; 30380 t[62] = 91; 30381 t[63] = 92; 30382 t[64] = 93; 30383 t[65] = 94; 30384 t[66] = 95; 30385 t[67] = 96; 30386 t[68] = 97; 30387 t[69] = 98; 30388 t[70] = 99; 30389 t[71] = 100; 30390 t[72] = 101; 30391 t[73] = 102; 30392 t[74] = 103; 30393 t[75] = 104; 30394 t[76] = 105; 30395 t[77] = 106; 30396 t[78] = 107; 30397 t[79] = 108; 30398 t[80] = 109; 30399 t[81] = 110; 30400 t[82] = 111; 30401 t[83] = 112; 30402 t[84] = 113; 30403 t[85] = 114; 30404 t[86] = 115; 30405 t[87] = 116; 30406 t[88] = 117; 30407 t[89] = 118; 30408 t[90] = 119; 30409 t[91] = 120; 30410 t[92] = 121;
30411 t[93] = 122; 30412 t[94] = 123; 30413 t[95] = 124; 30414 t[96] = 125; 30415 t[97] = 126; 30416 t[98] = 196; 30417 t[99] = 197; 30418 t[100] = 199; 30419 t[101] = 201; 30420 t[102] = 209; 30421 t[103] = 214; 30422 t[104] = 220; 30423 t[105] = 225; 30424 t[106] = 224; 30425 t[107] = 226; 30426 t[108] = 228; 30427 t[109] = 227; 30428 t[110] = 229; 30429 t[111] = 231; 30430 t[112] = 233; 30431 t[113] = 232; 30432 t[114] = 234; 30433 t[115] = 235; 30434 t[116] = 237; 30435 t[117] = 236; 30436 t[118] = 238; 30437 t[119] = 239; 30438 t[120] = 241; 30439 t[121] = 243; 30440 t[122] = 242; 30441 t[123] = 244; 30442 t[124] = 246; 30443 t[125] = 245; 30444 t[126] = 250; 30445 t[127] = 249; 30446 t[128] = 251; 30447 t[129] = 252; 30448 t[130] = 8224; 30449 t[131] = 176; 30450 t[132] = 162; 30451 t[133] = 163; 30452 t[134] = 167; 30453 t[135] = 8226; 30454 t[136] = 182; 30455 t[137] = 223; 30456 t[138] = 174; 30457 t[139] = 169; 30458 t[140] = 8482; 30459 t[141] = 180; 30460 t[142] = 168; 30461 t[143] = 8800; 30462 t[144] = 198; 30463 t[145] = 216; 30464 t[146] = 8734; 30465 t[147] = 177; 30466 t[148] = 8804; 30467 t[149] = 8805; 30468 t[150] = 165; 30469 t[151] = 181; 30470 t[152] = 8706; 30471 t[153] = 8721; 30472 t[154] = 8719; 30473 t[156] = 8747; 30474 t[157] = 170; 30475 t[158] = 186; 30476 t[159] = 8486; 30477 t[160] = 230; 30478 t[161] = 248; 30479 t[162] = 191; 30480 t[163] = 161; 30481 t[164] = 172; 30482 t[165] = 8730; 30483 t[166] = 402; 30484 t[167] = 8776; 30485 t[168] = 8710; 30486 t[169] = 171; 30487 t[170] = 187; 30488 t[171] = 8230; 30489 t[179] = 8220; 30490 t[180] = 8221; 30491 t[181] = 8216; 30492 t[182] = 8217; 30493 t[200] = 193; 30494 t[203] = 205; 30495 t[207] = 211; 30496 t[210] = 218; 30497 t[223] = 711; 30498 t[224] = 321; 30499 t[225] = 322; 30500 t[226] = 352; 30501 t[227] = 353; 30502 t[228] = 381; 30503 t[229] = 382; 30504 t[233] = 221; 30505 t[234] = 253; 30506 t[252] = 263; 30507 t[253] = 268; 30508 t[254] = 269; 30509 t[258] = 258; 30510 t[260] = 260; 30511 t[261] = 261; 30512 t[265] = 280; 30513 t[266] = 281; 30514 t[267] = 282; 30515 t[268] = 283; 30516 t[269] = 313; 30517 t[275] = 323; 30518 t[276] = 324; 30519 t[278] = 328; 30520 t[283] = 344; 30521 t[284] = 345; 30522 t[285] = 346; 30523 t[286] = 347; 30524 t[292] = 367; 30525 t[295] = 377; 30526 t[296] = 378; 30527 t[298] = 380; 30528 t[305] = 963; 30529 t[306] = 964; 30530 t[307] = 966; 30531 t[308] = 8215; 30532 t[309] = 8252; 30533 t[310] = 8319; 30534 t[311] = 8359; 30535 t[312] = 8592; 30536 t[313] = 8593; 30537 t[337] = 9552; 30538 t[493] = 1039; 30539 t[494] = 1040; 30540 t[672] = 1488; 30541 t[673] = 1489; 30542 t[674] = 1490; 30543 t[675] = 1491; 30544 t[676] = 1492; 30545 t[677] = 1493; 30546 t[678] = 1494; 30547 t[679] = 1495; 30548 t[680] = 1496; 30549 t[681] = 1497; 30550 t[682] = 1498; 30551 t[683] = 1499; 30552 t[684] = 1500; 30553 t[685] = 1501; 30554 t[686] = 1502; 30555 t[687] = 1503; 30556 t[688] = 1504; 30557 t[689] = 1505; 30558 t[690] = 1506; 30559 t[691] = 1507; 30560 t[692] = 1508; 30561 t[693] = 1509; 30562 t[694] = 1510; 30563 t[695] = 1511; 30564 t[696] = 1512; 30565 t[697] = 1513; 30566 t[698] = 1514; 30567 t[705] = 1524; 30568 t[706] = 8362; 30569 t[710] = 64288; 30570 t[711] = 64298; 30571 t[759] = 1617; 30572 t[761] = 1776; 30573 t[763] = 1778; 30574 t[775] = 1652; 30575 t[777] = 1764; 30576 t[778] = 1780; 30577 t[779] = 1781; 30578 t[780] = 1782; 30579 t[782] = 771; 30580 t[783] = 64726; 30581 t[786] = 8363; 30582 t[788] = 8532; 30583 t[790] = 768; 30584 t[791] = 769; 30585 t[792] = 768; 30586 t[795] = 803; 30587 t[797] = 64336; 30588 t[798] = 64337; 30589 t[799] = 64342; 30590 t[800] = 64343; 30591 t[801] = 64344; 30592 t[802] = 64345; 30593 t[803] = 64362; 30594 t[804] = 64363; 30595 t[805] = 64364; 30596 t[2424] = 7821; 30597 t[2425] = 7822; 30598 t[2426] = 7823; 30599 t[2427] = 7824; 30600 t[2428] = 7825; 30601 t[2429] = 7826; 30602 t[2430] = 7827; 30603 t[2433] = 7682; 30604 t[2678] = 8045; 30605 t[2679] = 8046; 30606 t[2830] = 1552; 30607 t[2838] = 686; 30608 t[2840] = 751; 30609 t[2842] = 753; 30610 t[2843] = 754; 30611 t[2844] = 755; 30612 t[2846] = 757; 30613 t[2856] = 767; 30614 t[2857] = 848; 30615 t[2858] = 849; 30616 t[2862] = 853; 30617 t[2863] = 854; 30618 t[2864] = 855; 30619 t[2865] = 861; 30620 t[2866] = 862; 30621 t[2906] = 7460; 30622 t[2908] = 7462; 30623 t[2909] = 7463; 30624 t[2910] = 7464; 30625 t[2912] = 7466; 30626 t[2913] = 7467; 30627 t[2914] = 7468; 30628 t[2916] = 7470; 30629 t[2917] = 7471; 30630 t[2918] = 7472; 30631 t[2920] = 7474; 30632 t[2921] = 7475; 30633 t[2922] = 7476; 30634 t[2924] = 7478; 30635 t[2925] = 7479; 30636 t[2926] = 7480; 30637 t[2928] = 7482; 30638 t[2929] = 7483; 30639 t[2930] = 7484; 30640 t[2932] = 7486; 30641 t[2933] = 7487; 30642 t[2934] = 7488; 30643 t[2936] = 7490; 30644 t[2937] = 7491; 30645 t[2938] = 7492; 30646 t[2940] = 7494; 30647 t[2941] = 7495; 30648 t[2942] = 7496; 30649 t[2944] = 7498; 30650 t[2946] = 7500; 30651 t[2948] = 7502; 30652 t[2950] = 7504; 30653 t[2951] = 7505; 30654 t[2952] = 7506; 30655 t[2954] = 7508; 30656 t[2955] = 7509; 30657 t[2956] = 7510; 30658 t[2958] = 7512; 30659 t[2959] = 7513; 30660 t[2960] = 7514; 30661 t[2962] = 7516; 30662 t[2963] = 7517; 30663 t[2964] = 7518; 30664 t[2966] = 7520; 30665 t[2967] = 7521; 30666 t[2968] = 7522; 30667 t[2970] = 7524; 30668 t[2971] = 7525; 30669 t[2972] = 7526; 30670 t[2974] = 7528; 30671 t[2975] = 7529; 30672 t[2976] = 7530; 30673 t[2978] = 1537; 30674 t[2979] = 1538; 30675 t[2980] = 1539; 30676 t[2982] = 1549;
30677 t[2983] = 1551; 30678 t[2984] = 1552; 30679 t[2986] = 1554; 30680 t[2987] = 1555; 30681 t[2988] = 1556; 30682 t[2990] = 1623; 30683 t[2991] = 1624; 30684 t[2995] = 1775; 30685 t[2999] = 1791; 30686 t[3002] = 64290; 30687 t[3003] = 64291; 30688 t[3004] = 64292; 30689 t[3006] = 64294; 30690 t[3007] = 64295; 30691 t[3008] = 64296; 30692 t[3011] = 1900; 30693 t[3014] = 8223; 30694 t[3015] = 8244; 30695 t[3017] = 7532; 30696 t[3018] = 7533; 30697 t[3019] = 7534; 30698 t[3075] = 7590; 30699 t[3076] = 7591; 30700 t[3079] = 7594; 30701 t[3080] = 7595; 30702 t[3083] = 7598; 30703 t[3084] = 7599; 30704 t[3087] = 7602; 30705 t[3088] = 7603; 30706 t[3091] = 7606; 30707 t[3092] = 7607; 30708 t[3095] = 7610; 30709 t[3096] = 7611; 30710 t[3099] = 7614; 30711 t[3100] = 7615; 30712 t[3103] = 7618; 30713 t[3104] = 7619; 30714 t[3107] = 8337; 30715 t[3108] = 8338; 30716 t[3116] = 1884; 30717 t[3119] = 1885; 30718 t[3120] = 1885; 30719 t[3123] = 1886; 30720 t[3124] = 1886; 30721 t[3127] = 1887; 30722 t[3128] = 1887; 30723 t[3131] = 1888; 30724 t[3132] = 1888; 30725 t[3135] = 1889; 30726 t[3136] = 1889; 30727 t[3139] = 1890; 30728 t[3140] = 1890; 30729 t[3143] = 1891; 30730 t[3144] = 1891; 30731 t[3147] = 1892; 30732 t[3148] = 1892; 30733 t[3153] = 580; 30734 t[3154] = 581; 30735 t[3157] = 584; 30736 t[3158] = 585; 30737 t[3161] = 588; 30738 t[3162] = 589; 30739 t[3165] = 891; 30740 t[3166] = 892; 30741 t[3169] = 1274; 30742 t[3170] = 1275; 30743 t[3173] = 1278; 30744 t[3174] = 1279; 30745 t[3181] = 7622; 30746 t[3182] = 7623; 30747 t[3282] = 11799; 30748 t[3316] = 578; 30749 t[3379] = 42785; 30750 t[3393] = 1159; 30751 t[3416] = 8377; 30752}); 30753exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts; 30754const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) { 30755 t[227] = 322; 30756 t[264] = 261; 30757 t[291] = 346; 30758}); 30759exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack; 30760const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) { 30761 t[1] = 32; 30762 t[4] = 65; 30763 t[5] = 192; 30764 t[6] = 193; 30765 t[9] = 196; 30766 t[17] = 66; 30767 t[18] = 67; 30768 t[21] = 268; 30769 t[24] = 68; 30770 t[28] = 69; 30771 t[29] = 200; 30772 t[30] = 201; 30773 t[32] = 282; 30774 t[38] = 70; 30775 t[39] = 71; 30776 t[44] = 72; 30777 t[47] = 73; 30778 t[48] = 204; 30779 t[49] = 205; 30780 t[58] = 74; 30781 t[60] = 75; 30782 t[62] = 76; 30783 t[68] = 77; 30784 t[69] = 78; 30785 t[75] = 79; 30786 t[76] = 210; 30787 t[80] = 214; 30788 t[87] = 80; 30789 t[89] = 81; 30790 t[90] = 82; 30791 t[92] = 344; 30792 t[94] = 83; 30793 t[97] = 352; 30794 t[100] = 84; 30795 t[104] = 85; 30796 t[109] = 220; 30797 t[115] = 86; 30798 t[116] = 87; 30799 t[121] = 88; 30800 t[122] = 89; 30801 t[124] = 221; 30802 t[127] = 90; 30803 t[129] = 381; 30804 t[258] = 97; 30805 t[259] = 224; 30806 t[260] = 225; 30807 t[263] = 228; 30808 t[268] = 261; 30809 t[271] = 98; 30810 t[272] = 99; 30811 t[273] = 263; 30812 t[275] = 269; 30813 t[282] = 100; 30814 t[286] = 101; 30815 t[287] = 232; 30816 t[288] = 233; 30817 t[290] = 283; 30818 t[295] = 281; 30819 t[296] = 102; 30820 t[336] = 103; 30821 t[346] = 104; 30822 t[349] = 105; 30823 t[350] = 236; 30824 t[351] = 237; 30825 t[361] = 106; 30826 t[364] = 107; 30827 t[367] = 108; 30828 t[371] = 322; 30829 t[373] = 109; 30830 t[374] = 110; 30831 t[381] = 111; 30832 t[382] = 242; 30833 t[383] = 243; 30834 t[386] = 246; 30835 t[393] = 112; 30836 t[395] = 113; 30837 t[396] = 114; 30838 t[398] = 345; 30839 t[400] = 115; 30840 t[401] = 347; 30841 t[403] = 353; 30842 t[410] = 116; 30843 t[437] = 117; 30844 t[442] = 252; 30845 t[448] = 118; 30846 t[449] = 119; 30847 t[454] = 120; 30848 t[455] = 121; 30849 t[457] = 253; 30850 t[460] = 122; 30851 t[462] = 382; 30852 t[463] = 380; 30853 t[853] = 44; 30854 t[855] = 58; 30855 t[856] = 46; 30856 t[876] = 47; 30857 t[878] = 45; 30858 t[882] = 45; 30859 t[894] = 40; 30860 t[895] = 41; 30861 t[896] = 91; 30862 t[897] = 93; 30863 t[923] = 64; 30864 t[1004] = 48; 30865 t[1005] = 49; 30866 t[1006] = 50; 30867 t[1007] = 51; 30868 t[1008] = 52; 30869 t[1009] = 53; 30870 t[1010] = 54; 30871 t[1011] = 55;
vendor: 24,649 bytes, lines 30872-31742
30872 t[1012] = 56; 30873 t[1013] = 57; 30874 t[1081] = 37; 30875 t[1085] = 43; 30876 t[1086] = 45; 30877}); 30878exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri; 30879function getStandardFontName(name) { 30880 const fontName = (0, _fonts_utils.normalizeFontName)(name); 30881 const stdFontMap = getStdFontMap(); 30882 return stdFontMap[fontName]; 30883} 30884function isKnownFontName(name) { 30885 const fontName = (0, _fonts_utils.normalizeFontName)(name); 30886 return !!(getStdFontMap()[fontName] || getNonStdFontMap()[fontName] || getSerifFonts()[fontName] || getSymbolsFonts()[fontName]); 30887} 30888 30889/***/ }), 30890/* 42 */ 30891/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 30892 30893 30894 30895Object.defineProperty(exports, "__esModule", ({ 30896 value: true 30897})); 30898exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0; 30899var _util = __w_pdfjs_require__(2); 30900class ToUnicodeMap { 30901 constructor(cmap = []) { 30902 this._map = cmap; 30903 } 30904 get length() { 30905 return this._map.length; 30906 } 30907 forEach(callback) { 30908 for (const charCode in this._map) { 30909 callback(charCode, this._map[charCode].charCodeAt(0)); 30910 } 30911 } 30912 has(i) { 30913 return this._map[i] !== undefined; 30914 } 30915 get(i) { 30916 return this._map[i]; 30917 } 30918 charCodeOf(value) { 30919 const map = this._map; 30920 if (map.length <= 0x10000) { 30921 return map.indexOf(value); 30922 } 30923 for (const charCode in map) { 30924 if (map[charCode] === value) { 30925 return charCode | 0; 30926 } 30927 } 30928 return -1; 30929 } 30930 amend(map) { 30931 for (const charCode in map) { 30932 this._map[charCode] = map[charCode]; 30933 } 30934 } 30935} 30936exports.ToUnicodeMap = ToUnicodeMap; 30937class IdentityToUnicodeMap { 30938 constructor(firstChar, lastChar) { 30939 this.firstChar = firstChar; 30940 this.lastChar = lastChar; 30941 } 30942 get length() { 30943 return this.lastChar + 1 - this.firstChar; 30944 } 30945 forEach(callback) { 30946 for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) { 30947 callback(i, i); 30948 } 30949 } 30950 has(i) { 30951 return this.firstChar <= i && i <= this.lastChar; 30952 } 30953 get(i) { 30954 if (this.firstChar <= i && i <= this.lastChar) { 30955 return String.fromCharCode(i); 30956 } 30957 return undefined; 30958 } 30959 charCodeOf(v) { 30960 return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1; 30961 } 30962 amend(map) { 30963 (0, _util.unreachable)("Should not call amend()"); 30964 } 30965} 30966exports.IdentityToUnicodeMap = IdentityToUnicodeMap; 30967 30968/***/ }), 30969/* 43 */ 30970/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 30971 30972 30973 30974Object.defineProperty(exports, "__esModule", ({ 30975 value: true 30976})); 30977exports.CFFFont = void 0; 30978var _cff_parser = __w_pdfjs_require__(35); 30979var _fonts_utils = __w_pdfjs_require__(38); 30980var _util = __w_pdfjs_require__(2); 30981class CFFFont { 30982 constructor(file, properties) { 30983 this.properties = properties; 30984 const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED); 30985 this.cff = parser.parse(); 30986 this.cff.duplicateFirstGlyph(); 30987 const compiler = new _cff_parser.CFFCompiler(this.cff); 30988 this.seacs = this.cff.seacs; 30989 try { 30990 this.data = compiler.compile(); 30991 } catch { 30992 (0, _util.warn)("Failed to compile font " + properties.loadedName); 30993 this.data = file; 30994 } 30995 this._createBuiltInEncoding(); 30996 } 30997 get numGlyphs() { 30998 return this.cff.charStrings.count; 30999 } 31000 getCharset() { 31001 return this.cff.charset.charset; 31002 } 31003 getGlyphMapping() { 31004 const cff = this.cff; 31005 const properties = this.properties; 31006 const { 31007 cidToGidMap, 31008 cMap 31009 } = properties; 31010 const charsets = cff.charset.charset; 31011 let charCodeToGlyphId; 31012 let glyphId; 31013 if (properties.composite) { 31014 let invCidToGidMap; 31015 if (cidToGidMap?.length > 0) { 31016 invCidToGidMap = Object.create(null); 31017 for (let i = 0, ii = cidToGidMap.length; i < ii; i++) { 31018 const gid = cidToGidMap[i]; 31019 if (gid !== undefined) { 31020 invCidToGidMap[gid] = i; 31021 } 31022 } 31023 } 31024 charCodeToGlyphId = Object.create(null); 31025 let charCode; 31026 if (cff.isCIDFont) { 31027 for (glyphId = 0; glyphId < charsets.length; glyphId++) { 31028 const cid = charsets[glyphId]; 31029 charCode = cMap.charCodeOf(cid); 31030 if (invCidToGidMap?.[charCode] !== undefined) { 31031 charCode = invCidToGidMap[charCode]; 31032 } 31033 charCodeToGlyphId[charCode] = glyphId; 31034 } 31035 } else { 31036 for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { 31037 charCode = cMap.charCodeOf(glyphId); 31038 charCodeToGlyphId[charCode] = glyphId; 31039 } 31040 } 31041 return charCodeToGlyphId; 31042 } 31043 let encoding = cff.encoding ? cff.encoding.encoding : null; 31044 if (properties.isInternalFont) { 31045 encoding = properties.defaultEncoding; 31046 } 31047 charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets); 31048 return charCodeToGlyphId; 31049 } 31050 hasGlyphId(id) { 31051 return this.cff.hasGlyphId(id); 31052 } 31053 _createBuiltInEncoding() { 31054 const { 31055 charset, 31056 encoding 31057 } = this.cff; 31058 if (!charset || !encoding) { 31059 return; 31060 } 31061 const charsets = charset.charset, 31062 encodings = encoding.encoding; 31063 const map = []; 31064 for (const charCode in encodings) { 31065 const glyphId = encodings[charCode]; 31066 if (glyphId >= 0) { 31067 const glyphName = charsets[glyphId]; 31068 if (glyphName) { 31069 map[charCode] = glyphName; 31070 } 31071 } 31072 } 31073 if (map.length > 0) { 31074 this.properties.builtInEncoding = map; 31075 } 31076 } 31077} 31078exports.CFFFont = CFFFont; 31079 31080/***/ }), 31081/* 44 */ 31082/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 31083 31084 31085 31086Object.defineProperty(exports, "__esModule", ({ 31087 value: true 31088})); 31089exports.FontRendererFactory = void 0; 31090var _util = __w_pdfjs_require__(2); 31091var _cff_parser = __w_pdfjs_require__(35); 31092var _glyphlist = __w_pdfjs_require__(39); 31093var _encodings = __w_pdfjs_require__(37); 31094var _stream = __w_pdfjs_require__(8); 31095function getUint32(data, offset) { 31096 return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; 31097} 31098function getUint16(data, offset) { 31099 return data[offset] << 8 | data[offset + 1]; 31100} 31101function getInt16(data, offset) { 31102 return (data[offset] << 24 | data[offset + 1] << 16) >> 16; 31103} 31104function getInt8(data, offset) { 31105 return data[offset] << 24 >> 24; 31106} 31107function getFloat214(data, offset) { 31108 return getInt16(data, offset) / 16384; 31109} 31110function getSubroutineBias(subrs) { 31111 const numSubrs = subrs.length; 31112 let bias = 32768; 31113 if (numSubrs < 1240) { 31114 bias = 107; 31115 } else if (numSubrs < 33900) { 31116 bias = 1131; 31117 } 31118 return bias; 31119} 31120function parseCmap(data, start, end) { 31121 const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16); 31122 const format = getUint16(data, start + offset); 31123 let ranges, p, i; 31124 if (format === 4) { 31125 getUint16(data, start + offset + 2); 31126 const segCount = getUint16(data, start + offset + 6) >> 1; 31127 p = start + offset + 14; 31128 ranges = []; 31129 for (i = 0; i < segCount; i++, p += 2) { 31130 ranges[i] = { 31131 end: getUint16(data, p) 31132 }; 31133 } 31134 p += 2; 31135 for (i = 0; i < segCount; i++, p += 2) { 31136 ranges[i].start = getUint16(data, p); 31137 } 31138 for (i = 0; i < segCount; i++, p += 2) { 31139 ranges[i].idDelta = getUint16(data, p); 31140 } 31141 for (i = 0; i < segCount; i++, p += 2) { 31142 let idOffset = getUint16(data, p); 31143 if (idOffset === 0) { 31144 continue; 31145 } 31146 ranges[i].ids = []; 31147 for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) { 31148 ranges[i].ids[j] = getUint16(data, p + idOffset); 31149 idOffset += 2; 31150 } 31151 } 31152 return ranges; 31153 } else if (format === 12) { 31154 const groups = getUint32(data, start + offset + 12); 31155 p = start + offset + 16; 31156 ranges = []; 31157 for (i = 0; i < groups; i++) { 31158 start = getUint32(data, p); 31159 ranges.push({ 31160 start, 31161 end: getUint32(data, p + 4), 31162 idDelta: getUint32(data, p + 8) - start 31163 }); 31164 p += 12; 31165 } 31166 return ranges; 31167 } 31168 throw new _util.FormatError(`unsupported cmap: ${format}`); 31169} 31170function parseCff(data, start, end, seacAnalysisEnabled) { 31171 const properties = {}; 31172 const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled); 31173 const cff = parser.parse(); 31174 return { 31175 glyphs: cff.charStrings.objects, 31176 subrs: cff.topDict.privateDict?.subrsIndex?.objects, 31177 gsubrs: cff.globalSubrIndex?.objects, 31178 isCFFCIDFont: cff.isCIDFont, 31179 fdSelect: cff.fdSelect, 31180 fdArray: cff.fdArray 31181 }; 31182} 31183function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { 31184 let itemSize, itemDecode; 31185 if (isGlyphLocationsLong) { 31186 itemSize = 4; 31187 itemDecode = getUint32; 31188 } else { 31189 itemSize = 2; 31190 itemDecode = (data, offset) => 2 * getUint16(data, offset); 31191 } 31192 const glyphs = []; 31193 let startOffset = itemDecode(loca, 0); 31194 for (let j = itemSize; j < loca.length; j += itemSize) { 31195 const endOffset = itemDecode(loca, j); 31196 glyphs.push(glyf.subarray(startOffset, endOffset)); 31197 startOffset = endOffset; 31198 } 31199 return glyphs; 31200} 31201function lookupCmap(ranges, unicode) { 31202 const code = unicode.codePointAt(0); 31203 let gid = 0, 31204 l = 0, 31205 r = ranges.length - 1; 31206 while (l < r) { 31207 const c = l + r + 1 >> 1; 31208 if (code < ranges[c].start) { 31209 r = c - 1; 31210 } else { 31211 l = c; 31212 } 31213 } 31214 if (ranges[l].start <= code && code <= ranges[l].end) { 31215 gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff; 31216 } 31217 return { 31218 charCode: code, 31219 glyphId: gid 31220 }; 31221} 31222function compileGlyf(code, cmds, font) { 31223 function moveTo(x, y) { 31224 cmds.push({ 31225 cmd: "moveTo", 31226 args: [x, y] 31227 }); 31228 } 31229 function lineTo(x, y) { 31230 cmds.push({ 31231 cmd: "lineTo", 31232 args: [x, y] 31233 }); 31234 } 31235 function quadraticCurveTo(xa, ya, x, y) { 31236 cmds.push({ 31237 cmd: "quadraticCurveTo", 31238 args: [xa, ya, x, y] 31239 }); 31240 } 31241 let i = 0; 31242 const numberOfContours = getInt16(code, i); 31243 let flags; 31244 let x = 0, 31245 y = 0; 31246 i += 10; 31247 if (numberOfContours < 0) { 31248 do { 31249 flags = getUint16(code, i); 31250 const glyphIndex = getUint16(code, i + 2); 31251 i += 4; 31252 let arg1, arg2; 31253 if (flags & 0x01) { 31254 if (flags & 0x02) { 31255 arg1 = getInt16(code, i); 31256 arg2 = getInt16(code, i + 2); 31257 } else { 31258 arg1 = getUint16(code, i); 31259 arg2 = getUint16(code, i + 2); 31260 } 31261 i += 4; 31262 } else if (flags & 0x02) { 31263 arg1 = getInt8(code, i++); 31264 arg2 = getInt8(code, i++); 31265 } else { 31266 arg1 = code[i++]; 31267 arg2 = code[i++]; 31268 } 31269 if (flags & 0x02) { 31270 x = arg1; 31271 y = arg2; 31272 } else { 31273 x = 0; 31274 y = 0; 31275 } 31276 let scaleX = 1, 31277 scaleY = 1, 31278 scale01 = 0, 31279 scale10 = 0; 31280 if (flags & 0x08) { 31281 scaleX = scaleY = getFloat214(code, i); 31282 i += 2; 31283 } else if (flags & 0x40) { 31284 scaleX = getFloat214(code, i); 31285 scaleY = getFloat214(code, i + 2); 31286 i += 4; 31287 } else if (flags & 0x80) { 31288 scaleX = getFloat214(code, i); 31289 scale01 = getFloat214(code, i + 2); 31290 scale10 = getFloat214(code, i + 4); 31291 scaleY = getFloat214(code, i + 6); 31292 i += 8; 31293 } 31294 const subglyph = font.glyphs[glyphIndex]; 31295 if (subglyph) { 31296 cmds.push({ 31297 cmd: "save" 31298 }, { 31299 cmd: "transform", 31300 args: [scaleX, scale01, scale10, scaleY, x, y] 31301 }); 31302 if (!(flags & 0x02)) {} 31303 compileGlyf(subglyph, cmds, font); 31304 cmds.push({ 31305 cmd: "restore" 31306 }); 31307 } 31308 } while (flags & 0x20); 31309 } else { 31310 const endPtsOfContours = []; 31311 let j, jj; 31312 for (j = 0; j < numberOfContours; j++) { 31313 endPtsOfContours.push(getUint16(code, i)); 31314 i += 2; 31315 } 31316 const instructionLength = getUint16(code, i); 31317 i += 2 + instructionLength; 31318 const numberOfPoints = endPtsOfContours.at(-1) + 1; 31319 const points = []; 31320 while (points.length < numberOfPoints) { 31321 flags = code[i++]; 31322 let repeat = 1; 31323 if (flags & 0x08) { 31324 repeat += code[i++]; 31325 } 31326 while (repeat-- > 0) { 31327 points.push({ 31328 flags 31329 }); 31330 } 31331 } 31332 for (j = 0; j < numberOfPoints; j++) { 31333 switch (points[j].flags & 0x12) { 31334 case 0x00: 31335 x += getInt16(code, i); 31336 i += 2; 31337 break; 31338 case 0x02: 31339 x -= code[i++]; 31340 break; 31341 case 0x12: 31342 x += code[i++]; 31343 break; 31344 } 31345 points[j].x = x; 31346 } 31347 for (j = 0; j < numberOfPoints; j++) { 31348 switch (points[j].flags & 0x24) { 31349 case 0x00: 31350 y += getInt16(code, i); 31351 i += 2; 31352 break; 31353 case 0x04: 31354 y -= code[i++]; 31355 break; 31356 case 0x24: 31357 y += code[i++]; 31358 break; 31359 } 31360 points[j].y = y; 31361 } 31362 let startPoint = 0; 31363 for (i = 0; i < numberOfContours; i++) { 31364 const endPoint = endPtsOfContours[i]; 31365 const contour = points.slice(startPoint, endPoint + 1); 31366 if (contour[0].flags & 1) { 31367 contour.push(contour[0]); 31368 } else if (contour.at(-1).flags & 1) { 31369 contour.unshift(contour.at(-1)); 31370 } else { 31371 const p = { 31372 flags: 1, 31373 x: (contour[0].x + contour.at(-1).x) / 2, 31374 y: (contour[0].y + contour.at(-1).y) / 2 31375 }; 31376 contour.unshift(p); 31377 contour.push(p); 31378 } 31379 moveTo(contour[0].x, contour[0].y); 31380 for (j = 1, jj = contour.length; j < jj; j++) { 31381 if (contour[j].flags & 1) { 31382 lineTo(contour[j].x, contour[j].y); 31383 } else if (contour[j + 1].flags & 1) { 31384 quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y); 31385 j++; 31386 } else { 31387 quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2); 31388 } 31389 } 31390 startPoint = endPoint + 1; 31391 } 31392 } 31393} 31394function compileCharString(charStringCode, cmds, font, glyphId) { 31395 function moveTo(x, y) { 31396 cmds.push({ 31397 cmd: "moveTo", 31398 args: [x, y] 31399 }); 31400 } 31401 function lineTo(x, y) { 31402 cmds.push({ 31403 cmd: "lineTo", 31404 args: [x, y] 31405 }); 31406 } 31407 function bezierCurveTo(x1, y1, x2, y2, x, y) { 31408 cmds.push({ 31409 cmd: "bezierCurveTo", 31410 args: [x1, y1, x2, y2, x, y] 31411 }); 31412 } 31413 const stack = []; 31414 let x = 0, 31415 y = 0; 31416 let stems = 0; 31417 function parse(code) { 31418 let i = 0; 31419 while (i < code.length) { 31420 let stackClean = false; 31421 let v = code[i++]; 31422 let xa, xb, ya, yb, y1, y2, y3, n, subrCode; 31423 switch (v) { 31424 case 1: 31425 stems += stack.length >> 1; 31426 stackClean = true; 31427 break; 31428 case 3: 31429 stems += stack.length >> 1; 31430 stackClean = true; 31431 break; 31432 case 4: 31433 y += stack.pop(); 31434 moveTo(x, y); 31435 stackClean = true; 31436 break; 31437 case 5: 31438 while (stack.length > 0) { 31439 x += stack.shift(); 31440 y += stack.shift(); 31441 lineTo(x, y); 31442 } 31443 break; 31444 case 6: 31445 while (stack.length > 0) { 31446 x += stack.shift(); 31447 lineTo(x, y); 31448 if (stack.length === 0) { 31449 break; 31450 } 31451 y += stack.shift(); 31452 lineTo(x, y); 31453 } 31454 break; 31455 case 7: 31456 while (stack.length > 0) { 31457 y += stack.shift(); 31458 lineTo(x, y); 31459 if (stack.length === 0) { 31460 break; 31461 } 31462 x += stack.shift(); 31463 lineTo(x, y); 31464 } 31465 break; 31466 case 8: 31467 while (stack.length > 0) { 31468 xa = x + stack.shift(); 31469 ya = y + stack.shift(); 31470 xb = xa + stack.shift(); 31471 yb = ya + stack.shift(); 31472 x = xb + stack.shift(); 31473 y = yb + stack.shift(); 31474 bezierCurveTo(xa, ya, xb, yb, x, y); 31475 } 31476 break; 31477 case 10: 31478 n = stack.pop(); 31479 subrCode = null; 31480 if (font.isCFFCIDFont) { 31481 const fdIndex = font.fdSelect.getFDIndex(glyphId); 31482 if (fdIndex >= 0 && fdIndex < font.fdArray.length) { 31483 const fontDict = font.fdArray[fdIndex]; 31484 let subrs; 31485 if (fontDict.privateDict?.subrsIndex) { 31486 subrs = fontDict.privateDict.subrsIndex.objects; 31487 } 31488 if (subrs) { 31489 n += getSubroutineBias(subrs); 31490 subrCode = subrs[n]; 31491 } 31492 } else { 31493 (0, _util.warn)("Invalid fd index for glyph index."); 31494 } 31495 } else { 31496 subrCode = font.subrs[n + font.subrsBias]; 31497 } 31498 if (subrCode) { 31499 parse(subrCode); 31500 } 31501 break; 31502 case 11: 31503 return; 31504 case 12: 31505 v = code[i++]; 31506 switch (v) { 31507 case 34: 31508 xa = x + stack.shift(); 31509 xb = xa + stack.shift(); 31510 y1 = y + stack.shift(); 31511 x = xb + stack.shift(); 31512 bezierCurveTo(xa, y, xb, y1, x, y1); 31513 xa = x + stack.shift(); 31514 xb = xa + stack.shift(); 31515 x = xb + stack.shift(); 31516 bezierCurveTo(xa, y1, xb, y, x, y); 31517 break; 31518 case 35: 31519 xa = x + stack.shift(); 31520 ya = y + stack.shift(); 31521 xb = xa + stack.shift(); 31522 yb = ya + stack.shift(); 31523 x = xb + stack.shift(); 31524 y = yb + stack.shift(); 31525 bezierCurveTo(xa, ya, xb, yb, x, y); 31526 xa = x + stack.shift(); 31527 ya = y + stack.shift(); 31528 xb = xa + stack.shift(); 31529 yb = ya + stack.shift(); 31530 x = xb + stack.shift(); 31531 y = yb + stack.shift(); 31532 bezierCurveTo(xa, ya, xb, yb, x, y); 31533 stack.pop(); 31534 break; 31535 case 36: 31536 xa = x + stack.shift(); 31537 y1 = y + stack.shift(); 31538 xb = xa + stack.shift(); 31539 y2 = y1 + stack.shift(); 31540 x = xb + stack.shift(); 31541 bezierCurveTo(xa, y1, xb, y2, x, y2); 31542 xa = x + stack.shift(); 31543 xb = xa + stack.shift(); 31544 y3 = y2 + stack.shift(); 31545 x = xb + stack.shift(); 31546 bezierCurveTo(xa, y2, xb, y3, x, y); 31547 break; 31548 case 37: 31549 const x0 = x, 31550 y0 = y; 31551 xa = x + stack.shift(); 31552 ya = y + stack.shift(); 31553 xb = xa + stack.shift(); 31554 yb = ya + stack.shift(); 31555 x = xb + stack.shift(); 31556 y = yb + stack.shift(); 31557 bezierCurveTo(xa, ya, xb, yb, x, y); 31558 xa = x + stack.shift(); 31559 ya = y + stack.shift(); 31560 xb = xa + stack.shift(); 31561 yb = ya + stack.shift(); 31562 x = xb; 31563 y = yb; 31564 if (Math.abs(x - x0) > Math.abs(y - y0)) { 31565 x += stack.shift(); 31566 } else { 31567 y += stack.shift(); 31568 } 31569 bezierCurveTo(xa, ya, xb, yb, x, y); 31570 break; 31571 default: 31572 throw new _util.FormatError(`unknown operator: 12 ${v}`); 31573 } 31574 break; 31575 case 14: 31576 if (stack.length >= 4) { 31577 const achar = stack.pop(); 31578 const bchar = stack.pop(); 31579 y = stack.pop(); 31580 x = stack.pop(); 31581 cmds.push({ 31582 cmd: "save" 31583 }, { 31584 cmd: "translate", 31585 args: [x, y] 31586 }); 31587 let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]])); 31588 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 31589 cmds.push({ 31590 cmd: "restore" 31591 }); 31592 cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]])); 31593 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 31594 } 31595 return; 31596 case 18: 31597 stems += stack.length >> 1; 31598 stackClean = true; 31599 break; 31600 case 19: 31601 stems += stack.length >> 1; 31602 i += stems + 7 >> 3; 31603 stackClean = true; 31604 break; 31605 case 20: 31606 stems += stack.length >> 1; 31607 i += stems + 7 >> 3; 31608 stackClean = true; 31609 break; 31610 case 21: 31611 y += stack.pop(); 31612 x += stack.pop(); 31613 moveTo(x, y); 31614 stackClean = true; 31615 break; 31616 case 22: 31617 x += stack.pop(); 31618 moveTo(x, y); 31619 stackClean = true; 31620 break; 31621 case 23: 31622 stems += stack.length >> 1; 31623 stackClean = true; 31624 break; 31625 case 24: 31626 while (stack.length > 2) { 31627 xa = x + stack.shift(); 31628 ya = y + stack.shift(); 31629 xb = xa + stack.shift(); 31630 yb = ya + stack.shift(); 31631 x = xb + stack.shift(); 31632 y = yb + stack.shift(); 31633 bezierCurveTo(xa, ya, xb, yb, x, y); 31634 } 31635 x += stack.shift(); 31636 y += stack.shift(); 31637 lineTo(x, y); 31638 break; 31639 case 25: 31640 while (stack.length > 6) { 31641 x += stack.shift(); 31642 y += stack.shift(); 31643 lineTo(x, y); 31644 } 31645 xa = x + stack.shift(); 31646 ya = y + stack.shift(); 31647 xb = xa + stack.shift(); 31648 yb = ya + stack.shift(); 31649 x = xb + stack.shift(); 31650 y = yb + stack.shift(); 31651 bezierCurveTo(xa, ya, xb, yb, x, y); 31652 break; 31653 case 26: 31654 if (stack.length % 2) { 31655 x += stack.shift(); 31656 } 31657 while (stack.length > 0) { 31658 xa = x; 31659 ya = y + stack.shift(); 31660 xb = xa + stack.shift(); 31661 yb = ya + stack.shift(); 31662 x = xb; 31663 y = yb + stack.shift(); 31664 bezierCurveTo(xa, ya, xb, yb, x, y); 31665 } 31666 break; 31667 case 27: 31668 if (stack.length % 2) { 31669 y += stack.shift(); 31670 } 31671 while (stack.length > 0) { 31672 xa = x + stack.shift(); 31673 ya = y; 31674 xb = xa + stack.shift(); 31675 yb = ya + stack.shift(); 31676 x = xb + stack.shift(); 31677 y = yb; 31678 bezierCurveTo(xa, ya, xb, yb, x, y); 31679 } 31680 break; 31681 case 28: 31682 stack.push((code[i] << 24 | code[i + 1] << 16) >> 16); 31683 i += 2; 31684 break; 31685 case 29: 31686 n = stack.pop() + font.gsubrsBias; 31687 subrCode = font.gsubrs[n]; 31688 if (subrCode) { 31689 parse(subrCode); 31690 } 31691 break; 31692 case 30: 31693 while (stack.length > 0) { 31694 xa = x; 31695 ya = y + stack.shift(); 31696 xb = xa + stack.shift(); 31697 yb = ya + stack.shift(); 31698 x = xb + stack.shift(); 31699 y = yb + (stack.length === 1 ? stack.shift() : 0); 31700 bezierCurveTo(xa, ya, xb, yb, x, y); 31701 if (stack.length === 0) { 31702 break; 31703 } 31704 xa = x + stack.shift(); 31705 ya = y; 31706 xb = xa + stack.shift(); 31707 yb = ya + stack.shift(); 31708 y = yb + stack.shift(); 31709 x = xb + (stack.length === 1 ? stack.shift() : 0); 31710 bezierCurveTo(xa, ya, xb, yb, x, y); 31711 } 31712 break; 31713 case 31: 31714 while (stack.length > 0) { 31715 xa = x + stack.shift(); 31716 ya = y; 31717 xb = xa + stack.shift(); 31718 yb = ya + stack.shift(); 31719 y = yb + stack.shift(); 31720 x = xb + (stack.length === 1 ? stack.shift() : 0); 31721 bezierCurveTo(xa, ya, xb, yb, x, y); 31722 if (stack.length === 0) { 31723 break; 31724 } 31725 xa = x; 31726 ya = y + stack.shift(); 31727 xb = xa + stack.shift(); 31728 yb = ya + stack.shift(); 31729 x = xb + stack.shift(); 31730 y = yb + (stack.length === 1 ? stack.shift() : 0); 31731 bezierCurveTo(xa, ya, xb, yb, x, y); 31732 } 31733 break; 31734 default: 31735 if (v < 32) { 31736 throw new _util.FormatError(`unknown operator: ${v}`); 31737 } 31738 if (v < 247) { 31739 stack.push(v - 139); 31740 } else if (v < 251) { 31741 stack.push((v - 247) * 256 + code[i++] + 108); 31742 } else if (v < 255) {
31743 stack.push(-(v - 251) * 256 - code[i++] - 108); 31744 } else { 31745 stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536); 31746 i += 4; 31747 } 31748 break; 31749 } 31750 if (stackClean) { 31751 stack.length = 0; 31752 } 31753 } 31754 } 31755 parse(charStringCode); 31756} 31757const NOOP = []; 31758class CompiledFont { 31759 constructor(fontMatrix) { 31760 if (this.constructor === CompiledFont) { 31761 (0, _util.unreachable)("Cannot initialize CompiledFont."); 31762 } 31763 this.fontMatrix = fontMatrix; 31764 this.compiledGlyphs = Object.create(null); 31765 this.compiledCharCodeToGlyphId = Object.create(null); 31766 } 31767 getPathJs(unicode) { 31768 const { 31769 charCode, 31770 glyphId 31771 } = lookupCmap(this.cmap, unicode); 31772 let fn = this.compiledGlyphs[glyphId]; 31773 if (!fn) { 31774 try { 31775 fn = this.compileGlyph(this.glyphs[glyphId], glyphId); 31776 this.compiledGlyphs[glyphId] = fn; 31777 } catch (ex) { 31778 this.compiledGlyphs[glyphId] = NOOP; 31779 if (this.compiledCharCodeToGlyphId[charCode] === undefined) { 31780 this.compiledCharCodeToGlyphId[charCode] = glyphId; 31781 } 31782 throw ex; 31783 } 31784 } 31785 if (this.compiledCharCodeToGlyphId[charCode] === undefined) { 31786 this.compiledCharCodeToGlyphId[charCode] = glyphId; 31787 } 31788 return fn; 31789 } 31790 compileGlyph(code, glyphId) { 31791 if (!code || code.length === 0 || code[0] === 14) { 31792 return NOOP; 31793 } 31794 let fontMatrix = this.fontMatrix; 31795 if (this.isCFFCIDFont) { 31796 const fdIndex = this.fdSelect.getFDIndex(glyphId); 31797 if (fdIndex >= 0 && fdIndex < this.fdArray.length) { 31798 const fontDict = this.fdArray[fdIndex]; 31799 fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX; 31800 } else { 31801 (0, _util.warn)("Invalid fd index for glyph index."); 31802 } 31803 } 31804 const cmds = [{ 31805 cmd: "save" 31806 }, {
vendor: 3,406 bytes, lines 31807-31911
31807 cmd: "transform", 31808 args: fontMatrix.slice() 31809 }, { 31810 cmd: "scale", 31811 args: ["size", "-size"] 31812 }]; 31813 this.compileGlyphImpl(code, cmds, glyphId); 31814 cmds.push({ 31815 cmd: "restore" 31816 }); 31817 return cmds; 31818 } 31819 compileGlyphImpl() { 31820 (0, _util.unreachable)("Children classes should implement this."); 31821 } 31822 hasBuiltPath(unicode) { 31823 const { 31824 charCode, 31825 glyphId 31826 } = lookupCmap(this.cmap, unicode); 31827 return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined; 31828 } 31829} 31830class TrueTypeCompiled extends CompiledFont { 31831 constructor(glyphs, cmap, fontMatrix) { 31832 super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]); 31833 this.glyphs = glyphs; 31834 this.cmap = cmap; 31835 } 31836 compileGlyphImpl(code, cmds) { 31837 compileGlyf(code, cmds, this); 31838 } 31839} 31840class Type2Compiled extends CompiledFont { 31841 constructor(cffInfo, cmap, fontMatrix, glyphNameMap) { 31842 super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]); 31843 this.glyphs = cffInfo.glyphs; 31844 this.gsubrs = cffInfo.gsubrs || []; 31845 this.subrs = cffInfo.subrs || []; 31846 this.cmap = cmap; 31847 this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)(); 31848 this.gsubrsBias = getSubroutineBias(this.gsubrs); 31849 this.subrsBias = getSubroutineBias(this.subrs); 31850 this.isCFFCIDFont = cffInfo.isCFFCIDFont; 31851 this.fdSelect = cffInfo.fdSelect; 31852 this.fdArray = cffInfo.fdArray; 31853 } 31854 compileGlyphImpl(code, cmds, glyphId) { 31855 compileCharString(code, cmds, this, glyphId); 31856 } 31857} 31858class FontRendererFactory { 31859 static create(font, seacAnalysisEnabled) { 31860 const data = new Uint8Array(font.data); 31861 let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm; 31862 const numTables = getUint16(data, 4); 31863 for (let i = 0, p = 12; i < numTables; i++, p += 16) { 31864 const tag = (0, _util.bytesToString)(data.subarray(p, p + 4)); 31865 const offset = getUint32(data, p + 8); 31866 const length = getUint32(data, p + 12); 31867 switch (tag) { 31868 case "cmap": 31869 cmap = parseCmap(data, offset, offset + length); 31870 break; 31871 case "glyf": 31872 glyf = data.subarray(offset, offset + length); 31873 break; 31874 case "loca": 31875 loca = data.subarray(offset, offset + length); 31876 break; 31877 case "head": 31878 unitsPerEm = getUint16(data, offset + 18); 31879 indexToLocFormat = getUint16(data, offset + 50); 31880 break; 31881 case "CFF ": 31882 cff = parseCff(data, offset, offset + length, seacAnalysisEnabled); 31883 break; 31884 } 31885 } 31886 if (glyf) { 31887 const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0]; 31888 return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix); 31889 } 31890 return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap); 31891 } 31892} 31893exports.FontRendererFactory = FontRendererFactory; 31894 31895/***/ }), 31896/* 45 */ 31897/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 31898 31899 31900 31901Object.defineProperty(exports, "__esModule", ({ 31902 value: true 31903})); 31904exports.getMetrics = exports.getFontBasicMetrics = void 0; 31905var _core_utils = __w_pdfjs_require__(3); 31906const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) { 31907 t.Courier = 600; 31908 t["Courier-Bold"] = 600; 31909 t["Courier-BoldOblique"] = 600; 31910 t["Courier-Oblique"] = 600; 31911 t.Helvetica = (0, _core_utils.getLookupTableFactory)
vendor: 6,500 bytes, lines 31911-32228
31911(function (t) { 31912 t.space = 278; 31913 t.exclam = 278; 31914 t.quotedbl = 355; 31915 t.numbersign = 556; 31916 t.dollar = 556; 31917 t.percent = 889; 31918 t.ampersand = 667; 31919 t.quoteright = 222; 31920 t.parenleft = 333; 31921 t.parenright = 333; 31922 t.asterisk = 389; 31923 t.plus = 584; 31924 t.comma = 278; 31925 t.hyphen = 333; 31926 t.period = 278; 31927 t.slash = 278; 31928 t.zero = 556; 31929 t.one = 556; 31930 t.two = 556; 31931 t.three = 556; 31932 t.four = 556; 31933 t.five = 556; 31934 t.six = 556; 31935 t.seven = 556; 31936 t.eight = 556; 31937 t.nine = 556; 31938 t.colon = 278; 31939 t.semicolon = 278; 31940 t.less = 584; 31941 t.equal = 584; 31942 t.greater = 584; 31943 t.question = 556; 31944 t.at = 1015; 31945 t.A = 667; 31946 t.B = 667; 31947 t.C = 722; 31948 t.D = 722; 31949 t.E = 667; 31950 t.F = 611; 31951 t.G = 778; 31952 t.H = 722; 31953 t.I = 278; 31954 t.J = 500; 31955 t.K = 667; 31956 t.L = 556; 31957 t.M = 833; 31958 t.N = 722; 31959 t.O = 778; 31960 t.P = 667; 31961 t.Q = 778; 31962 t.R = 722; 31963 t.S = 667; 31964 t.T = 611; 31965 t.U = 722; 31966 t.V = 667; 31967 t.W = 944; 31968 t.X = 667; 31969 t.Y = 667; 31970 t.Z = 611; 31971 t.bracketleft = 278; 31972 t.backslash = 278; 31973 t.bracketright = 278; 31974 t.asciicircum = 469; 31975 t.underscore = 556; 31976 t.quoteleft = 222; 31977 t.a = 556; 31978 t.b = 556; 31979 t.c = 500; 31980 t.d = 556; 31981 t.e = 556; 31982 t.f = 278; 31983 t.g = 556; 31984 t.h = 556; 31985 t.i = 222; 31986 t.j = 222; 31987 t.k = 500; 31988 t.l = 222; 31989 t.m = 833; 31990 t.n = 556; 31991 t.o = 556; 31992 t.p = 556; 31993 t.q = 556; 31994 t.r = 333; 31995 t.s = 500; 31996 t.t = 278; 31997 t.u = 556; 31998 t.v = 500; 31999 t.w = 722; 32000 t.x = 500; 32001 t.y = 500; 32002 t.z = 500; 32003 t.braceleft = 334; 32004 t.bar = 260; 32005 t.braceright = 334; 32006 t.asciitilde = 584; 32007 t.exclamdown = 333; 32008 t.cent = 556; 32009 t.sterling = 556; 32010 t.fraction = 167; 32011 t.yen = 556; 32012 t.florin = 556; 32013 t.section = 556; 32014 t.currency = 556; 32015 t.quotesingle = 191; 32016 t.quotedblleft = 333; 32017 t.guillemotleft = 556; 32018 t.guilsinglleft = 333; 32019 t.guilsinglright = 333; 32020 t.fi = 500; 32021 t.fl = 500; 32022 t.endash = 556; 32023 t.dagger = 556; 32024 t.daggerdbl = 556; 32025 t.periodcentered = 278; 32026 t.paragraph = 537; 32027 t.bullet = 350; 32028 t.quotesinglbase = 222; 32029 t.quotedblbase = 333; 32030 t.quotedblright = 333; 32031 t.guillemotright = 556; 32032 t.ellipsis = 1000; 32033 t.perthousand = 1000; 32034 t.questiondown = 611; 32035 t.grave = 333; 32036 t.acute = 333; 32037 t.circumflex = 333; 32038 t.tilde = 333; 32039 t.macron = 333; 32040 t.breve = 333; 32041 t.dotaccent = 333; 32042 t.dieresis = 333; 32043 t.ring = 333; 32044 t.cedilla = 333; 32045 t.hungarumlaut = 333; 32046 t.ogonek = 333; 32047 t.caron = 333; 32048 t.emdash = 1000; 32049 t.AE = 1000; 32050 t.ordfeminine = 370; 32051 t.Lslash = 556; 32052 t.Oslash = 778; 32053 t.OE = 1000; 32054 t.ordmasculine = 365; 32055 t.ae = 889; 32056 t.dotlessi = 278; 32057 t.lslash = 222; 32058 t.oslash = 611; 32059 t.oe = 944; 32060 t.germandbls = 611; 32061 t.Idieresis = 278; 32062 t.eacute = 556; 32063 t.abreve = 556; 32064 t.uhungarumlaut = 556; 32065 t.ecaron = 556; 32066 t.Ydieresis = 667; 32067 t.divide = 584; 32068 t.Yacute = 667; 32069 t.Acircumflex = 667; 32070 t.aacute = 556; 32071 t.Ucircumflex = 722; 32072 t.yacute = 500; 32073 t.scommaaccent = 500; 32074 t.ecircumflex = 556; 32075 t.Uring = 722; 32076 t.Udieresis = 722; 32077 t.aogonek = 556; 32078 t.Uacute = 722; 32079 t.uogonek = 556; 32080 t.Edieresis = 667; 32081 t.Dcroat = 722; 32082 t.commaaccent = 250; 32083 t.copyright = 737; 32084 t.Emacron = 667; 32085 t.ccaron = 500; 32086 t.aring = 556; 32087 t.Ncommaaccent = 722; 32088 t.lacute = 222; 32089 t.agrave = 556; 32090 t.Tcommaaccent = 611; 32091 t.Cacute = 722; 32092 t.atilde = 556; 32093 t.Edotaccent = 667; 32094 t.scaron = 500; 32095 t.scedilla = 500; 32096 t.iacute = 278; 32097 t.lozenge = 471; 32098 t.Rcaron = 722; 32099 t.Gcommaaccent = 778; 32100 t.ucircumflex = 556; 32101 t.acircumflex = 556; 32102 t.Amacron = 667; 32103 t.rcaron = 333; 32104 t.ccedilla = 500; 32105 t.Zdotaccent = 611; 32106 t.Thorn = 667; 32107 t.Omacron = 778; 32108 t.Racute = 722; 32109 t.Sacute = 667; 32110 t.dcaron = 643; 32111 t.Umacron = 722; 32112 t.uring = 556; 32113 t.threesuperior = 333; 32114 t.Ograve = 778; 32115 t.Agrave = 667; 32116 t.Abreve = 667; 32117 t.multiply = 584; 32118 t.uacute = 556; 32119 t.Tcaron = 611; 32120 t.partialdiff = 476; 32121 t.ydieresis = 500; 32122 t.Nacute = 722; 32123 t.icircumflex = 278; 32124 t.Ecircumflex = 667; 32125 t.adieresis = 556; 32126 t.edieresis = 556; 32127 t.cacute = 500; 32128 t.nacute = 556; 32129 t.umacron = 556; 32130 t.Ncaron = 722; 32131 t.Iacute = 278; 32132 t.plusminus = 584; 32133 t.brokenbar = 260; 32134 t.registered = 737; 32135 t.Gbreve = 778; 32136 t.Idotaccent = 278; 32137 t.summation = 600; 32138 t.Egrave = 667; 32139 t.racute = 333; 32140 t.omacron = 556; 32141 t.Zacute = 611; 32142 t.Zcaron = 611; 32143 t.greaterequal = 549; 32144 t.Eth = 722; 32145 t.Ccedilla = 722; 32146 t.lcommaaccent = 222; 32147 t.tcaron = 317; 32148 t.eogonek = 556; 32149 t.Uogonek = 722; 32150 t.Aacute = 667; 32151 t.Adieresis = 667; 32152 t.egrave = 556; 32153 t.zacute = 500; 32154 t.iogonek = 222; 32155 t.Oacute = 778; 32156 t.oacute = 556; 32157 t.amacron = 556; 32158 t.sacute = 500; 32159 t.idieresis = 278; 32160 t.Ocircumflex = 778; 32161 t.Ugrave = 722; 32162 t.Delta = 612; 32163 t.thorn = 556; 32164 t.twosuperior = 333; 32165 t.Odieresis = 778; 32166 t.mu = 556; 32167 t.igrave = 278; 32168 t.ohungarumlaut = 556; 32169 t.Eogonek = 667; 32170 t.dcroat = 556; 32171 t.threequarters = 834; 32172 t.Scedilla = 667; 32173 t.lcaron = 299; 32174 t.Kcommaaccent = 667; 32175 t.Lacute = 556; 32176 t.trademark = 1000; 32177 t.edotaccent = 556; 32178 t.Igrave = 278; 32179 t.Imacron = 278; 32180 t.Lcaron = 556; 32181 t.onehalf = 834; 32182 t.lessequal = 549; 32183 t.ocircumflex = 556; 32184 t.ntilde = 556; 32185 t.Uhungarumlaut = 722; 32186 t.Eacute = 667; 32187 t.emacron = 556; 32188 t.gbreve = 556; 32189 t.onequarter = 834; 32190 t.Scaron = 667; 32191 t.Scommaaccent = 667; 32192 t.Ohungarumlaut = 778; 32193 t.degree = 400; 32194 t.ograve = 556; 32195 t.Ccaron = 722; 32196 t.ugrave = 556; 32197 t.radical = 453; 32198 t.Dcaron = 722; 32199 t.rcommaaccent = 333; 32200 t.Ntilde = 722; 32201 t.otilde = 556; 32202 t.Rcommaaccent = 722; 32203 t.Lcommaaccent = 556; 32204 t.Atilde = 667; 32205 t.Aogonek = 667; 32206 t.Aring = 667; 32207 t.Otilde = 778; 32208 t.zdotaccent = 500; 32209 t.Ecaron = 667; 32210 t.Iogonek = 278; 32211 t.kcommaaccent = 500; 32212 t.minus = 584; 32213 t.Icircumflex = 278; 32214 t.ncaron = 556; 32215 t.tcommaaccent = 278; 32216 t.logicalnot = 584; 32217 t.odieresis = 556; 32218 t.udieresis = 556; 32219 t.notequal = 549; 32220 t.gcommaaccent = 556; 32221 t.eth = 556; 32222 t.zcaron = 500; 32223 t.ncommaaccent = 556; 32224 t.onesuperior = 333; 32225 t.imacron = 278; 32226 t.Euro = 556; 32227 }); 32228 t
32228["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 32229 t.space = 278; 32230 t.exclam = 333; 32231 t.quotedbl = 474; 32232 t.numbersign = 556; 32233 t.dollar = 556; 32234 t.percent = 889; 32235 t.ampersand = 722; 32236 t.quoteright = 278; 32237 t.parenleft = 333; 32238 t.parenright = 333; 32239 t.asterisk = 389; 32240 t.plus = 584; 32241 t.comma = 278; 32242 t.hyphen = 333; 32243 t.period = 278; 32244 t.slash = 278; 32245 t.zero = 556; 32246 t.one = 556; 32247 t.two = 556; 32248 t.three = 556; 32249 t.four = 556; 32250 t.five = 556; 32251 t.six = 556; 32252 t.seven = 556; 32253 t.eight = 556; 32254 t.nine = 556; 32255 t.colon = 333; 32256 t.semicolon = 333; 32257 t.less = 584; 32258 t.equal = 584; 32259 t.greater = 584; 32260 t.question = 611; 32261 t.at = 975; 32262 t.A = 722; 32263 t.B = 722; 32264 t.C = 722; 32265 t.D = 722; 32266 t.E = 667; 32267 t.F = 611; 32268 t.G = 778; 32269 t.H = 722; 32270 t.I = 278; 32271 t.J = 556; 32272 t.K = 722; 32273 t.L = 611; 32274 t.M = 833; 32275 t.N = 722; 32276 t.O = 778; 32277 t.P = 667; 32278 t.Q = 778; 32279 t.R = 722; 32280 t.S = 667; 32281 t.T = 611; 32282 t.U = 722; 32283 t.V = 667; 32284 t.W = 944; 32285 t.X = 667; 32286 t.Y = 667; 32287 t.Z = 611; 32288 t.bracketleft = 333; 32289 t.backslash = 278; 32290 t.bracketright = 333; 32291 t.asciicircum = 584; 32292 t.underscore = 556; 32293 t.quoteleft = 278; 32294 t.a = 556; 32295 t.b = 611; 32296 t.c = 556; 32297 t.d = 611; 32298 t.e = 556; 32299 t.f = 333; 32300 t.g = 611; 32301 t.h = 611; 32302 t.i = 278; 32303 t.j = 278; 32304 t.k = 556; 32305 t.l = 278; 32306 t.m = 889; 32307 t.n = 611; 32308 t.o = 611; 32309 t.p = 611; 32310 t.q = 611; 32311 t.r = 389; 32312 t.s = 556; 32313 t.t = 333; 32314 t.u = 611; 32315 t.v = 556; 32316 t.w = 778; 32317 t.x = 556; 32318 t.y = 556; 32319 t.z = 500; 32320 t.braceleft = 389; 32321 t.bar = 280; 32322 t.braceright = 389; 32323 t.asciitilde = 584; 32324 t.exclamdown = 333; 32325 t.cent = 556; 32326 t.sterling = 556; 32327 t.fraction = 167; 32328 t.yen = 556; 32329 t.florin = 556; 32330 t.section = 556; 32331 t.currency = 556; 32332 t.quotesingle = 238; 32333 t.quotedblleft = 500; 32334 t.guillemotleft = 556; 32335 t.guilsinglleft = 333; 32336 t.guilsinglright = 333; 32337 t.fi = 611; 32338 t.fl = 611; 32339 t.endash = 556; 32340 t.dagger = 556; 32341 t.daggerdbl = 556; 32342 t.periodcentered = 278; 32343 t.paragraph = 556; 32344 t.bullet = 350; 32345 t.quotesinglbase = 278; 32346 t.quotedblbase = 500; 32347 t.quotedblright = 500; 32348 t.guillemotright = 556; 32349 t.ellipsis = 1000; 32350 t.perthousand = 1000; 32351 t.questiondown = 611; 32352 t.grave = 333; 32353 t.acute = 333; 32354 t.circumflex = 333; 32355 t.tilde = 333; 32356 t.macron = 333; 32357 t.breve = 333; 32358 t.dotaccent = 333; 32359 t.dieresis = 333; 32360 t.ring = 333; 32361 t.cedilla = 333; 32362 t.hungarumlaut = 333; 32363 t.ogonek = 333; 32364 t.caron = 333; 32365 t.emdash = 1000; 32366 t.AE = 1000; 32367 t.ordfeminine = 370; 32368 t.Lslash = 611; 32369 t.Oslash = 778; 32370 t.OE = 1000; 32371 t.ordmasculine = 365; 32372 t.ae = 889; 32373 t.dotlessi = 278; 32374 t.lslash = 278; 32375 t.oslash = 611; 32376 t.oe = 944; 32377 t.germandbls = 611; 32378 t.Idieresis = 278; 32379 t.eacute = 556; 32380 t.abreve = 556; 32381 t.uhungarumlaut = 611; 32382 t.ecaron = 556; 32383 t.Ydieresis = 667; 32384 t.divide = 584; 32385 t.Yacute = 667; 32386 t.Acircumflex = 722; 32387 t.aacute = 556; 32388 t.Ucircumflex = 722; 32389 t.yacute = 556; 32390 t.scommaaccent = 556; 32391 t.ecircumflex = 556; 32392 t.Uring = 722; 32393 t.Udieresis = 722; 32394 t.aogonek = 556; 32395 t.Uacute = 722; 32396 t.uogonek = 611; 32397 t.Edieresis = 667; 32398 t.Dcroat = 722; 32399 t.commaaccent = 250; 32400 t.copyright = 737; 32401 t.Emacron = 667; 32402 t.ccaron = 556; 32403 t.aring = 556; 32404 t.Ncommaaccent = 722; 32405 t.lacute = 278; 32406 t.agrave = 556; 32407 t.Tcommaaccent = 611; 32408 t.Cacute = 722; 32409 t.atilde = 556; 32410 t.Edotaccent = 667; 32411 t.scaron = 556; 32412 t.scedilla = 556; 32413 t.iacute = 278; 32414 t.lozenge = 494; 32415 t.Rcaron = 722; 32416 t.Gcommaaccent = 778; 32417 t.ucircumflex = 611; 32418 t.acircumflex = 556; 32419 t.Amacron = 722; 32420 t.rcaron = 389; 32421 t.ccedilla = 556; 32422 t.Zdotaccent = 611; 32423 t.Thorn = 667; 32424 t.Omacron = 778; 32425 t.Racute = 722; 32426 t.Sacute = 667; 32427 t.dcaron = 743; 32428 t.Umacron = 722; 32429 t.uring = 611; 32430 t.threesuperior = 333; 32431 t.Ograve = 778; 32432 t.Agrave = 722; 32433 t.Abreve = 722; 32434 t.multiply = 584; 32435 t.uacute = 611; 32436 t.Tcaron = 611; 32437 t.partialdiff = 494; 32438 t.ydieresis = 556; 32439 t.Nacute = 722; 32440 t.icircumflex = 278; 32441 t.Ecircumflex = 667; 32442 t.adieresis = 556; 32443 t.edieresis = 556; 32444 t.cacute = 556; 32445 t.nacute = 611; 32446 t.umacron = 611; 32447 t.Ncaron = 722; 32448 t.Iacute = 278; 32449 t.plusminus = 584; 32450 t.brokenbar = 280; 32451 t.registered = 737; 32452 t.Gbreve = 778; 32453 t.Idotaccent = 278; 32454 t.summation = 600; 32455 t.Egrave = 667; 32456 t.racute = 389; 32457 t.omacron = 611; 32458 t.Zacute = 611; 32459 t.Zcaron = 611; 32460 t.greaterequal = 549; 32461 t.Eth = 722; 32462 t.Ccedilla = 722; 32463 t.lcommaaccent = 278; 32464 t.tcaron = 389; 32465 t.eogonek = 556; 32466 t.Uogonek = 722; 32467 t.Aacute = 722; 32468 t.Adieresis = 722; 32469 t.egrave = 556; 32470 t.zacute = 500; 32471 t.iogonek = 278; 32472 t.Oacute = 778; 32473 t.oacute = 611; 32474 t.amacron = 556; 32475 t.sacute = 556; 32476 t.idieresis = 278; 32477 t.Ocircumflex = 778; 32478 t.Ugrave = 722; 32479 t.Delta = 612; 32480 t.thorn = 611; 32481 t.twosuperior = 333; 32482 t.Odieresis = 778; 32483 t.mu = 611; 32484 t.igrave = 278; 32485 t.ohungarumlaut = 611; 32486 t.Eogonek = 667; 32487 t.dcroat = 611; 32488 t.threequarters = 834; 32489 t.Scedilla = 667; 32490 t.lcaron = 400; 32491 t.Kcommaaccent = 722; 32492 t.Lacute = 611; 32493 t.trademark = 1000; 32494 t.edotaccent = 556; 32495 t.Igrave = 278; 32496 t.Imacron = 278; 32497 t.Lcaron = 611; 32498 t.onehalf = 834; 32499 t.lessequal = 549; 32500 t.ocircumflex = 611; 32501 t.ntilde = 611; 32502 t.Uhungarumlaut = 722; 32503 t.Eacute = 667; 32504 t.emacron = 556; 32505 t.gbreve = 611; 32506 t.onequarter = 834; 32507 t.Scaron = 667; 32508 t.Scommaaccent = 667;
32509 t.Ohungarumlaut = 778; 32510 t.degree = 400; 32511 t.ograve = 611; 32512 t.Ccaron = 722; 32513 t.ugrave = 611; 32514 t.radical = 549; 32515 t.Dcaron = 722; 32516 t.rcommaaccent = 389; 32517 t.Ntilde = 722; 32518 t.otilde = 611; 32519 t.Rcommaaccent = 722; 32520 t.Lcommaaccent = 611; 32521 t.Atilde = 722; 32522 t.Aogonek = 722; 32523 t.Aring = 722; 32524 t.Otilde = 778; 32525 t.zdotaccent = 500; 32526 t.Ecaron = 667; 32527 t.Iogonek = 278; 32528 t.kcommaaccent = 556; 32529 t.minus = 584; 32530 t.Icircumflex = 278; 32531 t.ncaron = 611; 32532 t.tcommaaccent = 333; 32533 t.logicalnot = 584; 32534 t.odieresis = 611; 32535 t.udieresis = 611; 32536 t.notequal = 549; 32537 t.gcommaaccent = 611; 32538 t.eth = 611; 32539 t.zcaron = 500; 32540 t.ncommaaccent = 611; 32541 t.onesuperior = 333; 32542 t.imacron = 278; 32543 t.Euro = 556; 32544 }); 32545 t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) { 32546 t.space = 278; 32547 t.exclam = 333; 32548 t.quotedbl = 474; 32549 t.numbersign = 556; 32550 t.dollar = 556; 32551 t.percent = 889; 32552 t.ampersand = 722; 32553 t.quoteright = 278; 32554 t.parenleft = 333; 32555 t.parenright = 333; 32556 t.asterisk = 389; 32557 t.plus = 584; 32558 t.comma = 278; 32559 t.hyphen = 333; 32560 t.period = 278; 32561 t.slash = 278; 32562 t.zero = 556; 32563 t.one = 556; 32564 t.two = 556; 32565 t.three = 556; 32566 t.four = 556; 32567 t.five = 556; 32568 t.six = 556; 32569 t.seven = 556; 32570 t.eight = 556; 32571 t.nine = 556; 32572 t.colon = 333; 32573 t.semicolon = 333; 32574 t.less = 584; 32575 t.equal = 584; 32576 t.greater = 584; 32577 t.question = 611; 32578 t.at = 975; 32579 t.A = 722; 32580 t.B = 722; 32581 t.C = 722; 32582 t.D = 722; 32583 t.E = 667; 32584 t.F = 611; 32585 t.G = 778; 32586 t.H = 722; 32587 t.I = 278; 32588 t.J = 556; 32589 t.K = 722; 32590 t.L = 611; 32591 t.M = 833; 32592 t.N = 722; 32593 t.O = 778; 32594 t.P = 667; 32595 t.Q = 778; 32596 t.R = 722; 32597 t.S = 667; 32598 t.T = 611; 32599 t.U = 722; 32600 t.V = 667; 32601 t.W = 944; 32602 t.X = 667; 32603 t.Y = 667; 32604 t.Z = 611; 32605 t.bracketleft = 333; 32606 t.backslash = 278; 32607 t.bracketright = 333; 32608 t.asciicircum = 584; 32609 t.underscore = 556; 32610 t.quoteleft = 278; 32611 t.a = 556; 32612 t.b = 611; 32613 t.c = 556; 32614 t.d = 611; 32615 t.e = 556; 32616 t.f = 333; 32617 t.g = 611; 32618 t.h = 611; 32619 t.i = 278; 32620 t.j = 278; 32621 t.k = 556; 32622 t.l = 278; 32623 t.m = 889; 32624 t.n = 611; 32625 t.o = 611; 32626 t.p = 611; 32627 t.q = 611; 32628 t.r = 389; 32629 t.s = 556; 32630 t.t = 333; 32631 t.u = 611; 32632 t.v = 556; 32633 t.w = 778; 32634 t.x = 556; 32635 t.y = 556; 32636 t.z = 500; 32637 t.braceleft = 389; 32638 t.bar = 280; 32639 t.braceright = 389; 32640 t.asciitilde = 584; 32641 t.exclamdown = 333; 32642 t.cent = 556; 32643 t.sterling = 556; 32644 t.fraction = 167; 32645 t.yen = 556; 32646 t.florin = 556; 32647 t.section = 556; 32648 t.currency = 556; 32649 t.quotesingle = 238; 32650 t.quotedblleft = 500; 32651 t.guillemotleft = 556; 32652 t.guilsinglleft = 333; 32653 t.guilsinglright = 333; 32654 t.fi = 611; 32655 t.fl = 611; 32656 t.endash = 556; 32657 t.dagger = 556; 32658 t.daggerdbl = 556; 32659 t.periodcentered = 278; 32660 t.paragraph = 556; 32661 t.bullet = 350; 32662 t.quotesinglbase = 278; 32663 t.quotedblbase = 500; 32664 t.quotedblright = 500; 32665 t.guillemotright = 556; 32666 t.ellipsis = 1000; 32667 t.perthousand = 1000; 32668 t.questiondown = 611; 32669 t.grave = 333; 32670 t.acute = 333; 32671 t.circumflex = 333; 32672 t.tilde = 333; 32673 t.macron = 333; 32674 t.breve = 333; 32675 t.dotaccent = 333; 32676 t.dieresis = 333; 32677 t.ring = 333; 32678 t.cedilla = 333; 32679 t.hungarumlaut = 333; 32680 t.ogonek = 333; 32681 t.caron = 333; 32682 t.emdash = 1000; 32683 t.AE = 1000; 32684 t.ordfeminine = 370; 32685 t.Lslash = 611; 32686 t.Oslash = 778; 32687 t.OE = 1000; 32688 t.ordmasculine = 365; 32689 t.ae = 889; 32690 t.dotlessi = 278; 32691 t.lslash = 278; 32692 t.oslash = 611; 32693 t.oe = 944; 32694 t.germandbls = 611; 32695 t.Idieresis = 278; 32696 t.eacute = 556; 32697 t.abreve = 556; 32698 t.uhungarumlaut = 611; 32699 t.ecaron = 556; 32700 t.Ydieresis = 667; 32701 t.divide = 584; 32702 t.Yacute = 667; 32703 t.Acircumflex = 722; 32704 t.aacute = 556; 32705 t.Ucircumflex = 722; 32706 t.yacute = 556; 32707 t.scommaaccent = 556; 32708 t.ecircumflex = 556; 32709 t.Uring = 722; 32710 t.Udieresis = 722; 32711 t.aogonek = 556; 32712 t.Uacute = 722; 32713 t.uogonek = 611; 32714 t.Edieresis = 667; 32715 t.Dcroat = 722; 32716 t.commaaccent = 250; 32717 t.copyright = 737; 32718 t.Emacron = 667; 32719 t.ccaron = 556; 32720 t.aring = 556; 32721 t.Ncommaaccent = 722; 32722 t.lacute = 278; 32723 t.agrave = 556; 32724 t.Tcommaaccent = 611; 32725 t.Cacute = 722; 32726 t.atilde = 556; 32727 t.Edotaccent = 667; 32728 t.scaron = 556; 32729 t.scedilla = 556; 32730 t.iacute = 278; 32731 t.lozenge = 494; 32732 t.Rcaron = 722; 32733 t.Gcommaaccent = 778; 32734 t.ucircumflex = 611; 32735 t.acircumflex = 556; 32736 t.Amacron = 722; 32737 t.rcaron = 389; 32738 t.ccedilla = 556; 32739 t.Zdotaccent = 611; 32740 t.Thorn = 667; 32741 t.Omacron = 778; 32742 t.Racute = 722; 32743 t.Sacute = 667; 32744 t.dcaron = 743; 32745 t.Umacron = 722; 32746 t.uring = 611; 32747 t.threesuperior = 333; 32748 t.Ograve = 778; 32749 t.Agrave = 722; 32750 t.Abreve = 722; 32751 t.multiply = 584; 32752 t.uacute = 611; 32753 t.Tcaron = 611; 32754 t.partialdiff = 494; 32755 t.ydieresis = 556; 32756 t.Nacute = 722; 32757 t.icircumflex = 278; 32758 t.Ecircumflex = 667; 32759 t.adieresis = 556; 32760 t.edieresis = 556; 32761 t.cacute = 556; 32762 t.nacute = 611; 32763 t.umacron = 611; 32764 t.Ncaron = 722; 32765 t.Iacute = 278; 32766 t.plusminus = 584; 32767 t.brokenbar = 280; 32768 t.registered = 737; 32769 t.Gbreve = 778; 32770 t.Idotaccent = 278; 32771 t.summation = 600; 32772 t.Egrave = 667; 32773 t.racute = 389; 32774 t.omacron = 611; 32775 t.Zacute = 611; 32776 t.Zcaron = 611; 32777 t.greaterequal = 549; 32778 t.Eth = 722; 32779 t.Ccedilla = 722; 32780 t.lcommaaccent = 278; 32781 t.tcaron = 389; 32782 t.eogonek = 556; 32783 t.Uogonek = 722; 32784 t.Aacute = 722; 32785 t.Adieresis = 722; 32786 t.egrave = 556; 32787 t.zacute = 500; 32788 t.iogonek = 278; 32789 t.Oacute = 778; 32790 t.oacute = 611; 32791 t.amacron = 556; 32792 t.sacute = 556; 32793 t.idieresis = 278; 32794 t.Ocircumflex = 778; 32795 t.Ugrave = 722; 32796 t.Delta = 612; 32797 t.thorn = 611; 32798 t.twosuperior = 333; 32799 t.Odieresis = 778; 32800 t.mu = 611; 32801 t.igrave = 278; 32802 t.ohungarumlaut = 611; 32803 t.Eogonek = 667; 32804 t.dcroat = 611; 32805 t.threequarters = 834; 32806 t.Scedilla = 667; 32807 t.lcaron = 400; 32808 t.Kcommaaccent = 722; 32809 t.Lacute = 611; 32810 t.trademark = 1000; 32811 t.edotaccent = 556; 32812 t.Igrave = 278; 32813 t.Imacron = 278; 32814 t.Lcaron = 611; 32815 t.onehalf = 834; 32816 t.lessequal = 549; 32817 t.ocircumflex = 611; 32818 t.ntilde = 611; 32819 t.Uhungarumlaut = 722; 32820 t.Eacute = 667; 32821 t.emacron = 556; 32822 t.gbreve = 611; 32823 t.onequarter = 834; 32824 t.Scaron = 667; 32825 t.Scommaaccent = 667;
32826 t.Ohungarumlaut = 778; 32827 t.degree = 400; 32828 t.ograve = 611; 32829 t.Ccaron = 722; 32830 t.ugrave = 611; 32831 t.radical = 549; 32832 t.Dcaron = 722; 32833 t.rcommaaccent = 389; 32834 t.Ntilde = 722; 32835 t.otilde = 611; 32836 t.Rcommaaccent = 722; 32837 t.Lcommaaccent = 611; 32838 t.Atilde = 722; 32839 t.Aogonek = 722; 32840 t.Aring = 722; 32841 t.Otilde = 778; 32842 t.zdotaccent = 500; 32843 t.Ecaron = 667; 32844 t.Iogonek = 278; 32845 t.kcommaaccent = 556; 32846 t.minus = 584; 32847 t.Icircumflex = 278; 32848 t.ncaron = 611; 32849 t.tcommaaccent = 333; 32850 t.logicalnot = 584; 32851 t.odieresis = 611; 32852 t.udieresis = 611; 32853 t.notequal = 549; 32854 t.gcommaaccent = 611; 32855 t.eth = 611; 32856 t.zcaron = 500; 32857 t.ncommaaccent = 611; 32858 t.onesuperior = 333; 32859 t.imacron = 278; 32860 t.Euro = 556; 32861 }); 32862 t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)
vendor: 6,510 bytes, lines 32862-33179
32862(function (t) { 32863 t.space = 278; 32864 t.exclam = 278; 32865 t.quotedbl = 355; 32866 t.numbersign = 556; 32867 t.dollar = 556; 32868 t.percent = 889; 32869 t.ampersand = 667; 32870 t.quoteright = 222; 32871 t.parenleft = 333; 32872 t.parenright = 333; 32873 t.asterisk = 389; 32874 t.plus = 584; 32875 t.comma = 278; 32876 t.hyphen = 333; 32877 t.period = 278; 32878 t.slash = 278; 32879 t.zero = 556; 32880 t.one = 556; 32881 t.two = 556; 32882 t.three = 556; 32883 t.four = 556; 32884 t.five = 556; 32885 t.six = 556; 32886 t.seven = 556; 32887 t.eight = 556; 32888 t.nine = 556; 32889 t.colon = 278; 32890 t.semicolon = 278; 32891 t.less = 584; 32892 t.equal = 584; 32893 t.greater = 584; 32894 t.question = 556; 32895 t.at = 1015; 32896 t.A = 667; 32897 t.B = 667; 32898 t.C = 722; 32899 t.D = 722; 32900 t.E = 667; 32901 t.F = 611; 32902 t.G = 778; 32903 t.H = 722; 32904 t.I = 278; 32905 t.J = 500; 32906 t.K = 667; 32907 t.L = 556; 32908 t.M = 833; 32909 t.N = 722; 32910 t.O = 778; 32911 t.P = 667; 32912 t.Q = 778; 32913 t.R = 722; 32914 t.S = 667; 32915 t.T = 611; 32916 t.U = 722; 32917 t.V = 667; 32918 t.W = 944; 32919 t.X = 667; 32920 t.Y = 667; 32921 t.Z = 611; 32922 t.bracketleft = 278; 32923 t.backslash = 278; 32924 t.bracketright = 278; 32925 t.asciicircum = 469; 32926 t.underscore = 556; 32927 t.quoteleft = 222; 32928 t.a = 556; 32929 t.b = 556; 32930 t.c = 500; 32931 t.d = 556; 32932 t.e = 556; 32933 t.f = 278; 32934 t.g = 556; 32935 t.h = 556; 32936 t.i = 222; 32937 t.j = 222; 32938 t.k = 500; 32939 t.l = 222; 32940 t.m = 833; 32941 t.n = 556; 32942 t.o = 556; 32943 t.p = 556; 32944 t.q = 556; 32945 t.r = 333; 32946 t.s = 500; 32947 t.t = 278; 32948 t.u = 556; 32949 t.v = 500; 32950 t.w = 722; 32951 t.x = 500; 32952 t.y = 500; 32953 t.z = 500; 32954 t.braceleft = 334; 32955 t.bar = 260; 32956 t.braceright = 334; 32957 t.asciitilde = 584; 32958 t.exclamdown = 333; 32959 t.cent = 556; 32960 t.sterling = 556; 32961 t.fraction = 167; 32962 t.yen = 556; 32963 t.florin = 556; 32964 t.section = 556; 32965 t.currency = 556; 32966 t.quotesingle = 191; 32967 t.quotedblleft = 333; 32968 t.guillemotleft = 556; 32969 t.guilsinglleft = 333; 32970 t.guilsinglright = 333; 32971 t.fi = 500; 32972 t.fl = 500; 32973 t.endash = 556; 32974 t.dagger = 556; 32975 t.daggerdbl = 556; 32976 t.periodcentered = 278; 32977 t.paragraph = 537; 32978 t.bullet = 350; 32979 t.quotesinglbase = 222; 32980 t.quotedblbase = 333; 32981 t.quotedblright = 333; 32982 t.guillemotright = 556; 32983 t.ellipsis = 1000; 32984 t.perthousand = 1000; 32985 t.questiondown = 611; 32986 t.grave = 333; 32987 t.acute = 333; 32988 t.circumflex = 333; 32989 t.tilde = 333; 32990 t.macron = 333; 32991 t.breve = 333; 32992 t.dotaccent = 333; 32993 t.dieresis = 333; 32994 t.ring = 333; 32995 t.cedilla = 333; 32996 t.hungarumlaut = 333; 32997 t.ogonek = 333; 32998 t.caron = 333; 32999 t.emdash = 1000; 33000 t.AE = 1000; 33001 t.ordfeminine = 370; 33002 t.Lslash = 556; 33003 t.Oslash = 778; 33004 t.OE = 1000; 33005 t.ordmasculine = 365; 33006 t.ae = 889; 33007 t.dotlessi = 278; 33008 t.lslash = 222; 33009 t.oslash = 611; 33010 t.oe = 944; 33011 t.germandbls = 611; 33012 t.Idieresis = 278; 33013 t.eacute = 556; 33014 t.abreve = 556; 33015 t.uhungarumlaut = 556; 33016 t.ecaron = 556; 33017 t.Ydieresis = 667; 33018 t.divide = 584; 33019 t.Yacute = 667; 33020 t.Acircumflex = 667; 33021 t.aacute = 556; 33022 t.Ucircumflex = 722; 33023 t.yacute = 500; 33024 t.scommaaccent = 500; 33025 t.ecircumflex = 556; 33026 t.Uring = 722; 33027 t.Udieresis = 722; 33028 t.aogonek = 556; 33029 t.Uacute = 722; 33030 t.uogonek = 556; 33031 t.Edieresis = 667; 33032 t.Dcroat = 722; 33033 t.commaaccent = 250; 33034 t.copyright = 737; 33035 t.Emacron = 667; 33036 t.ccaron = 500; 33037 t.aring = 556; 33038 t.Ncommaaccent = 722; 33039 t.lacute = 222; 33040 t.agrave = 556; 33041 t.Tcommaaccent = 611; 33042 t.Cacute = 722; 33043 t.atilde = 556; 33044 t.Edotaccent = 667; 33045 t.scaron = 500; 33046 t.scedilla = 500; 33047 t.iacute = 278; 33048 t.lozenge = 471; 33049 t.Rcaron = 722; 33050 t.Gcommaaccent = 778; 33051 t.ucircumflex = 556; 33052 t.acircumflex = 556; 33053 t.Amacron = 667; 33054 t.rcaron = 333; 33055 t.ccedilla = 500; 33056 t.Zdotaccent = 611; 33057 t.Thorn = 667; 33058 t.Omacron = 778; 33059 t.Racute = 722; 33060 t.Sacute = 667; 33061 t.dcaron = 643; 33062 t.Umacron = 722; 33063 t.uring = 556; 33064 t.threesuperior = 333; 33065 t.Ograve = 778; 33066 t.Agrave = 667; 33067 t.Abreve = 667; 33068 t.multiply = 584; 33069 t.uacute = 556; 33070 t.Tcaron = 611; 33071 t.partialdiff = 476; 33072 t.ydieresis = 500; 33073 t.Nacute = 722; 33074 t.icircumflex = 278; 33075 t.Ecircumflex = 667; 33076 t.adieresis = 556; 33077 t.edieresis = 556; 33078 t.cacute = 500; 33079 t.nacute = 556; 33080 t.umacron = 556; 33081 t.Ncaron = 722; 33082 t.Iacute = 278; 33083 t.plusminus = 584; 33084 t.brokenbar = 260; 33085 t.registered = 737; 33086 t.Gbreve = 778; 33087 t.Idotaccent = 278; 33088 t.summation = 600; 33089 t.Egrave = 667; 33090 t.racute = 333; 33091 t.omacron = 556; 33092 t.Zacute = 611; 33093 t.Zcaron = 611; 33094 t.greaterequal = 549; 33095 t.Eth = 722; 33096 t.Ccedilla = 722; 33097 t.lcommaaccent = 222; 33098 t.tcaron = 317; 33099 t.eogonek = 556; 33100 t.Uogonek = 722; 33101 t.Aacute = 667; 33102 t.Adieresis = 667; 33103 t.egrave = 556; 33104 t.zacute = 500; 33105 t.iogonek = 222; 33106 t.Oacute = 778; 33107 t.oacute = 556; 33108 t.amacron = 556; 33109 t.sacute = 500; 33110 t.idieresis = 278; 33111 t.Ocircumflex = 778; 33112 t.Ugrave = 722; 33113 t.Delta = 612; 33114 t.thorn = 556; 33115 t.twosuperior = 333; 33116 t.Odieresis = 778; 33117 t.mu = 556; 33118 t.igrave = 278; 33119 t.ohungarumlaut = 556; 33120 t.Eogonek = 667; 33121 t.dcroat = 556; 33122 t.threequarters = 834; 33123 t.Scedilla = 667; 33124 t.lcaron = 299; 33125 t.Kcommaaccent = 667; 33126 t.Lacute = 556; 33127 t.trademark = 1000; 33128 t.edotaccent = 556; 33129 t.Igrave = 278; 33130 t.Imacron = 278; 33131 t.Lcaron = 556; 33132 t.onehalf = 834; 33133 t.lessequal = 549; 33134 t.ocircumflex = 556; 33135 t.ntilde = 556; 33136 t.Uhungarumlaut = 722; 33137 t.Eacute = 667; 33138 t.emacron = 556; 33139 t.gbreve = 556; 33140 t.onequarter = 834; 33141 t.Scaron = 667; 33142 t.Scommaaccent = 667; 33143 t.Ohungarumlaut = 778; 33144 t.degree = 400; 33145 t.ograve = 556; 33146 t.Ccaron = 722; 33147 t.ugrave = 556; 33148 t.radical = 453; 33149 t.Dcaron = 722; 33150 t.rcommaaccent = 333; 33151 t.Ntilde = 722; 33152 t.otilde = 556; 33153 t.Rcommaaccent = 722; 33154 t.Lcommaaccent = 556; 33155 t.Atilde = 667; 33156 t.Aogonek = 667; 33157 t.Aring = 667; 33158 t.Otilde = 778; 33159 t.zdotaccent = 500; 33160 t.Ecaron = 667; 33161 t.Iogonek = 278; 33162 t.kcommaaccent = 500; 33163 t.minus = 584; 33164 t.Icircumflex = 278; 33165 t.ncaron = 556; 33166 t.tcommaaccent = 278; 33167 t.logicalnot = 584; 33168 t.odieresis = 556; 33169 t.udieresis = 556; 33170 t.notequal = 549; 33171 t.gcommaaccent = 556; 33172 t.eth = 556; 33173 t.zcaron = 500; 33174 t.ncommaaccent = 556; 33175 t.onesuperior = 333; 33176 t.imacron = 278; 33177 t.Euro = 556; 33178 }); 33179 t.Symbol =
33179(0, _core_utils.getLookupTableFactory)(function (t) { 33180 t.space = 250; 33181 t.exclam = 333; 33182 t.universal = 713; 33183 t.numbersign = 500; 33184 t.existential = 549; 33185 t.percent = 833; 33186 t.ampersand = 778; 33187 t.suchthat = 439; 33188 t.parenleft = 333; 33189 t.parenright = 333; 33190 t.asteriskmath = 500; 33191 t.plus = 549; 33192 t.comma = 250; 33193 t.minus = 549; 33194 t.period = 250; 33195 t.slash = 278; 33196 t.zero = 500; 33197 t.one = 500; 33198 t.two = 500; 33199 t.three = 500; 33200 t.four = 500; 33201 t.five = 500; 33202 t.six = 500; 33203 t.seven = 500; 33204 t.eight = 500; 33205 t.nine = 500; 33206 t.colon = 278; 33207 t.semicolon = 278; 33208 t.less = 549; 33209 t.equal = 549; 33210 t.greater = 549; 33211 t.question = 444; 33212 t.congruent = 549; 33213 t.Alpha = 722; 33214 t.Beta = 667; 33215 t.Chi = 722; 33216 t.Delta = 612; 33217 t.Epsilon = 611; 33218 t.Phi = 763; 33219 t.Gamma = 603; 33220 t.Eta = 722; 33221 t.Iota = 333; 33222 t.theta1 = 631; 33223 t.Kappa = 722; 33224 t.Lambda = 686; 33225 t.Mu = 889; 33226 t.Nu = 722; 33227 t.Omicron = 722; 33228 t.Pi = 768; 33229 t.Theta = 741; 33230 t.Rho = 556; 33231 t.Sigma = 592; 33232 t.Tau = 611; 33233 t.Upsilon = 690; 33234 t.sigma1 = 439; 33235 t.Omega = 768; 33236 t.Xi = 645; 33237 t.Psi = 795; 33238 t.Zeta = 611; 33239 t.bracketleft = 333; 33240 t.therefore = 863; 33241 t.bracketright = 333; 33242 t.perpendicular = 658; 33243 t.underscore = 500; 33244 t.radicalex = 500; 33245 t.alpha = 631; 33246 t.beta = 549; 33247 t.chi = 549; 33248 t.delta = 494; 33249 t.epsilon = 439; 33250 t.phi = 521; 33251 t.gamma = 411; 33252 t.eta = 603; 33253 t.iota = 329; 33254 t.phi1 = 603; 33255 t.kappa = 549; 33256 t.lambda = 549; 33257 t.mu = 576; 33258 t.nu = 521; 33259 t.omicron = 549; 33260 t.pi = 549; 33261 t.theta = 521; 33262 t.rho = 549; 33263 t.sigma = 603; 33264 t.tau = 439; 33265 t.upsilon = 576; 33266 t.omega1 = 713; 33267 t.omega = 686; 33268 t.xi = 493; 33269 t.psi = 686; 33270 t.zeta = 494; 33271 t.braceleft = 480; 33272 t.bar = 200; 33273 t.braceright = 480; 33274 t.similar = 549; 33275 t.Euro = 750; 33276 t.Upsilon1 = 620; 33277 t.minute = 247; 33278 t.lessequal = 549; 33279 t.fraction = 167; 33280 t.infinity = 713; 33281 t.florin = 500; 33282 t.club = 753; 33283 t.diamond = 753; 33284 t.heart = 753; 33285 t.spade = 753; 33286 t.arrowboth = 1042; 33287 t.arrowleft = 987; 33288 t.arrowup = 603; 33289 t.arrowright = 987; 33290 t.arrowdown = 603; 33291 t.degree = 400; 33292 t.plusminus = 549; 33293 t.second = 411; 33294 t.greaterequal = 549; 33295 t.multiply = 549; 33296 t.proportional = 713; 33297 t.partialdiff = 494; 33298 t.bullet = 460; 33299 t.divide = 549; 33300 t.notequal = 549; 33301 t.equivalence = 549; 33302 t.approxequal = 549; 33303 t.ellipsis = 1000; 33304 t.arrowvertex = 603; 33305 t.arrowhorizex = 1000; 33306 t.carriagereturn = 658; 33307 t.aleph = 823; 33308 t.Ifraktur = 686; 33309 t.Rfraktur = 795; 33310 t.weierstrass = 987; 33311 t.circlemultiply = 768; 33312 t.circleplus = 768; 33313 t.emptyset = 823; 33314 t.intersection = 768; 33315 t.union = 768; 33316 t.propersuperset = 713; 33317 t.reflexsuperset = 713; 33318 t.notsubset = 713; 33319 t.propersubset = 713; 33320 t.reflexsubset = 713; 33321 t.element = 713; 33322 t.notelement = 713; 33323 t.angle = 768; 33324 t.gradient = 713; 33325 t.registerserif = 790; 33326 t.copyrightserif = 790; 33327 t.trademarkserif = 890; 33328 t.product = 823; 33329 t.radical = 549; 33330 t.dotmath = 250; 33331 t.logicalnot = 713; 33332 t.logicaland = 603; 33333 t.logicalor = 603; 33334 t.arrowdblboth = 1042; 33335 t.arrowdblleft = 987; 33336 t.arrowdblup = 603; 33337 t.arrowdblright = 987; 33338 t.arrowdbldown = 603; 33339 t.lozenge = 494; 33340 t.angleleft = 329; 33341 t.registersans = 790; 33342 t.copyrightsans = 790; 33343 t.trademarksans = 786; 33344 t.summation = 713; 33345 t.parenlefttp = 384; 33346 t.parenleftex = 384; 33347 t.parenleftbt = 384; 33348 t.bracketlefttp = 384; 33349 t.bracketleftex = 384; 33350 t.bracketleftbt = 384; 33351 t.bracelefttp = 494; 33352 t.braceleftmid = 494; 33353 t.braceleftbt = 494; 33354 t.braceex = 494; 33355 t.angleright = 329; 33356 t.integral = 274; 33357 t.integraltp = 686; 33358 t.integralex = 686; 33359 t.integralbt = 686; 33360 t.parenrighttp = 384; 33361 t.parenrightex = 384; 33362 t.parenrightbt = 384; 33363 t.bracketrighttp = 384; 33364 t.bracketrightex = 384; 33365 t.bracketrightbt = 384; 33366 t.bracerighttp = 494; 33367 t.bracerightmid = 494; 33368 t.bracerightbt = 494; 33369 t.apple = 790; 33370 }); 33371 t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) { 33372 t.space = 250; 33373 t.exclam = 333; 33374 t.quotedbl = 408; 33375 t.numbersign = 500; 33376 t.dollar = 500; 33377 t.percent = 833; 33378 t.ampersand = 778; 33379 t.quoteright = 333; 33380 t.parenleft = 333; 33381 t.parenright = 333; 33382 t.asterisk = 500; 33383 t.plus = 564; 33384 t.comma = 250; 33385 t.hyphen = 333; 33386 t.period = 250; 33387 t.slash = 278; 33388 t.zero = 500; 33389 t.one = 500; 33390 t.two = 500; 33391 t.three = 500; 33392 t.four = 500; 33393 t.five = 500; 33394 t.six = 500; 33395 t.seven = 500; 33396 t.eight = 500; 33397 t.nine = 500; 33398 t.colon = 278; 33399 t.semicolon = 278; 33400 t.less = 564; 33401 t.equal = 564; 33402 t.greater = 564; 33403 t.question = 444; 33404 t.at = 921; 33405 t.A = 722; 33406 t.B = 667; 33407 t.C = 667; 33408 t.D = 722; 33409 t.E = 611; 33410 t.F = 556; 33411 t.G = 722; 33412 t.H = 722; 33413 t.I = 333; 33414 t.J = 389; 33415 t.K = 722; 33416 t.L = 611;
33417 t.M = 889; 33418 t.N = 722; 33419 t.O = 722; 33420 t.P = 556; 33421 t.Q = 722; 33422 t.R = 667; 33423 t.S = 556; 33424 t.T = 611; 33425 t.U = 722; 33426 t.V = 722; 33427 t.W = 944; 33428 t.X = 722; 33429 t.Y = 722; 33430 t.Z = 611; 33431 t.bracketleft = 333; 33432 t.backslash = 278; 33433 t.bracketright = 333; 33434 t.asciicircum = 469; 33435 t.underscore = 500; 33436 t.quoteleft = 333; 33437 t.a = 444; 33438 t.b = 500; 33439 t.c = 444; 33440 t.d = 500; 33441 t.e = 444; 33442 t.f = 333; 33443 t.g = 500; 33444 t.h = 500; 33445 t.i = 278; 33446 t.j = 278; 33447 t.k = 500; 33448 t.l = 278; 33449 t.m = 778; 33450 t.n = 500; 33451 t.o = 500; 33452 t.p = 500; 33453 t.q = 500; 33454 t.r = 333; 33455 t.s = 389; 33456 t.t = 278; 33457 t.u = 500; 33458 t.v = 500; 33459 t.w = 722; 33460 t.x = 500; 33461 t.y = 500; 33462 t.z = 444; 33463 t.braceleft = 480; 33464 t.bar = 200; 33465 t.braceright = 480; 33466 t.asciitilde = 541; 33467 t.exclamdown = 333; 33468 t.cent = 500; 33469 t.sterling = 500; 33470 t.fraction = 167; 33471 t.yen = 500; 33472 t.florin = 500; 33473 t.section = 500; 33474 t.currency = 500; 33475 t.quotesingle = 180; 33476 t.quotedblleft = 444; 33477 t.guillemotleft = 500; 33478 t.guilsinglleft = 333; 33479 t.guilsinglright = 333; 33480 t.fi = 556; 33481 t.fl = 556; 33482 t.endash = 500; 33483 t.dagger = 500; 33484 t.daggerdbl = 500; 33485 t.periodcentered = 250; 33486 t.paragraph = 453; 33487 t.bullet = 350; 33488 t.quotesinglbase = 333; 33489 t.quotedblbase = 444; 33490 t.quotedblright = 444; 33491 t.guillemotright = 500; 33492 t.ellipsis = 1000; 33493 t.perthousand = 1000; 33494 t.questiondown = 444; 33495 t.grave = 333; 33496 t.acute = 333; 33497 t.circumflex = 333; 33498 t.tilde = 333; 33499 t.macron = 333; 33500 t.breve = 333; 33501 t.dotaccent = 333; 33502 t.dieresis = 333; 33503 t.ring = 333; 33504 t.cedilla = 333; 33505 t.hungarumlaut = 333; 33506 t.ogonek = 333; 33507 t.caron = 333; 33508 t.emdash = 1000; 33509 t.AE = 889; 33510 t.ordfeminine = 276; 33511 t.Lslash = 611; 33512 t.Oslash = 722; 33513 t.OE = 889; 33514 t.ordmasculine = 310; 33515 t.ae = 667; 33516 t.dotlessi = 278; 33517 t.lslash = 278; 33518 t.oslash = 500; 33519 t.oe = 722; 33520 t.germandbls = 500; 33521 t.Idieresis = 333; 33522 t.eacute = 444; 33523 t.abreve = 444; 33524 t.uhungarumlaut = 500; 33525 t.ecaron = 444; 33526 t.Ydieresis = 722; 33527 t.divide = 564; 33528 t.Yacute = 722; 33529 t.Acircumflex = 722; 33530 t.aacute = 444; 33531 t.Ucircumflex = 722; 33532 t.yacute = 500; 33533 t.scommaaccent = 389; 33534 t.ecircumflex = 444; 33535 t.Uring = 722; 33536 t.Udieresis = 722; 33537 t.aogonek = 444; 33538 t.Uacute = 722; 33539 t.uogonek = 500; 33540 t.Edieresis = 611; 33541 t.Dcroat = 722; 33542 t.commaaccent = 250; 33543 t.copyright = 760; 33544 t.Emacron = 611; 33545 t.ccaron = 444; 33546 t.aring = 444; 33547 t.Ncommaaccent = 722; 33548 t.lacute = 278; 33549 t.agrave = 444; 33550 t.Tcommaaccent = 611; 33551 t.Cacute = 667; 33552 t.atilde = 444; 33553 t.Edotaccent = 611; 33554 t.scaron = 389; 33555 t.scedilla = 389; 33556 t.iacute = 278; 33557 t.lozenge = 471; 33558 t.Rcaron = 667; 33559 t.Gcommaaccent = 722; 33560 t.ucircumflex = 500; 33561 t.acircumflex = 444; 33562 t.Amacron = 722; 33563 t.rcaron = 333; 33564 t.ccedilla = 444; 33565 t.Zdotaccent = 611; 33566 t.Thorn = 556; 33567 t.Omacron = 722; 33568 t.Racute = 667; 33569 t.Sacute = 556; 33570 t.dcaron = 588; 33571 t.Umacron = 722; 33572 t.uring = 500; 33573 t.threesuperior = 300; 33574 t.Ograve = 722; 33575 t.Agrave = 722; 33576 t.Abreve = 722; 33577 t.multiply = 564; 33578 t.uacute = 500; 33579 t.Tcaron = 611; 33580 t.partialdiff = 476; 33581 t.ydieresis = 500; 33582 t.Nacute = 722; 33583 t.icircumflex = 278; 33584 t.Ecircumflex = 611; 33585 t.adieresis = 444; 33586 t.edieresis = 444; 33587 t.cacute = 444; 33588 t.nacute = 500; 33589 t.umacron = 500; 33590 t.Ncaron = 722; 33591 t.Iacute = 333; 33592 t.plusminus = 564; 33593 t.brokenbar = 200; 33594 t.registered = 760; 33595 t.Gbreve = 722; 33596 t.Idotaccent = 333; 33597 t.summation = 600; 33598 t.Egrave = 611; 33599 t.racute = 333; 33600 t.omacron = 500; 33601 t.Zacute = 611; 33602 t.Zcaron = 611; 33603 t.greaterequal = 549; 33604 t.Eth = 722; 33605 t.Ccedilla = 667; 33606 t.lcommaaccent = 278; 33607 t.tcaron = 326; 33608 t.eogonek = 444; 33609 t.Uogonek = 722; 33610 t.Aacute = 722; 33611 t.Adieresis = 722; 33612 t.egrave = 444; 33613 t.zacute = 444; 33614 t.iogonek = 278; 33615 t.Oacute = 722; 33616 t.oacute = 500; 33617 t.amacron = 444; 33618 t.sacute = 389; 33619 t.idieresis = 278; 33620 t.Ocircumflex = 722; 33621 t.Ugrave = 722; 33622 t.Delta = 612; 33623 t.thorn = 500; 33624 t.twosuperior = 300; 33625 t.Odieresis = 722; 33626 t.mu = 500; 33627 t.igrave = 278; 33628 t.ohungarumlaut = 500; 33629 t.Eogonek = 611; 33630 t.dcroat = 500; 33631 t.threequarters = 750; 33632 t.Scedilla = 556; 33633 t.lcaron = 344; 33634 t.Kcommaaccent = 722; 33635 t.Lacute = 611; 33636 t.trademark = 980; 33637 t.edotaccent = 444; 33638 t.Igrave = 333; 33639 t.Imacron = 333; 33640 t.Lcaron = 611; 33641 t.onehalf = 750; 33642 t.lessequal = 549; 33643 t.ocircumflex = 500; 33644 t.ntilde = 500; 33645 t.Uhungarumlaut = 722; 33646 t.Eacute = 611; 33647 t.emacron = 444; 33648 t.gbreve = 500; 33649 t.onequarter = 750; 33650 t.Scaron = 556; 33651 t.Scommaaccent = 556;
33652 t.Ohungarumlaut = 722; 33653 t.degree = 400; 33654 t.ograve = 500; 33655 t.Ccaron = 667; 33656 t.ugrave = 500; 33657 t.radical = 453; 33658 t.Dcaron = 722; 33659 t.rcommaaccent = 333; 33660 t.Ntilde = 722; 33661 t.otilde = 500; 33662 t.Rcommaaccent = 667; 33663 t.Lcommaaccent = 611; 33664 t.Atilde = 722; 33665 t.Aogonek = 722; 33666 t.Aring = 722; 33667 t.Otilde = 722; 33668 t.zdotaccent = 444; 33669 t.Ecaron = 611; 33670 t.Iogonek = 333; 33671 t.kcommaaccent = 500; 33672 t.minus = 564; 33673 t.Icircumflex = 333; 33674 t.ncaron = 500; 33675 t.tcommaaccent = 278; 33676 t.logicalnot = 564; 33677 t.odieresis = 500; 33678 t.udieresis = 500; 33679 t.notequal = 549; 33680 t.gcommaaccent = 500; 33681 t.eth = 500; 33682 t.zcaron = 444; 33683 t.ncommaaccent = 500; 33684 t.onesuperior = 300; 33685 t.imacron = 278; 33686 t.Euro = 500; 33687 }); 33688 t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 33689 t.space = 250; 33690 t.exclam = 333; 33691 t.quotedbl = 555; 33692 t.numbersign = 500; 33693 t.dollar = 500; 33694 t.percent = 1000; 33695 t.ampersand = 833; 33696 t.quoteright = 333; 33697 t.parenleft = 333; 33698 t.parenright = 333; 33699 t.asterisk = 500; 33700 t.plus = 570; 33701 t.comma = 250; 33702 t.hyphen = 333; 33703 t.period = 250; 33704 t.slash = 278; 33705 t.zero = 500; 33706 t.one = 500; 33707 t.two = 500; 33708 t.three = 500; 33709 t.four = 500; 33710 t.five = 500; 33711 t.six = 500; 33712 t.seven = 500; 33713 t.eight = 500; 33714 t.nine = 500; 33715 t.colon = 333; 33716 t.semicolon = 333; 33717 t.less = 570; 33718 t.equal = 570; 33719 t.greater = 570; 33720 t.question = 500; 33721 t.at = 930; 33722 t.A = 722; 33723 t.B = 667; 33724 t.C = 722; 33725 t.D = 722; 33726 t.E = 667; 33727 t.F = 611; 33728 t.G = 778; 33729 t.H = 778; 33730 t.I = 389; 33731 t.J = 500; 33732 t.K = 778; 33733 t.L = 667; 33734 t.M = 944; 33735 t.N = 722; 33736 t.O = 778; 33737 t.P = 611; 33738 t.Q = 778; 33739 t.R = 722; 33740 t.S = 556; 33741 t.T = 667; 33742 t.U = 722; 33743 t.V = 722; 33744 t.W = 1000; 33745 t.X = 722; 33746 t.Y = 722; 33747 t.Z = 667; 33748 t.bracketleft = 333; 33749 t.backslash = 278; 33750 t.bracketright = 333; 33751 t.asciicircum = 581; 33752 t.underscore = 500; 33753 t.quoteleft = 333; 33754 t.a = 500; 33755 t.b = 556; 33756 t.c = 444; 33757 t.d = 556; 33758 t.e = 444; 33759 t.f = 333; 33760 t.g = 500; 33761 t.h = 556; 33762 t.i = 278; 33763 t.j = 333; 33764 t.k = 556; 33765 t.l = 278; 33766 t.m = 833; 33767 t.n = 556; 33768 t.o = 500; 33769 t.p = 556; 33770 t.q = 556; 33771 t.r = 444; 33772 t.s = 389; 33773 t.t = 333; 33774 t.u = 556; 33775 t.v = 500; 33776 t.w = 722; 33777 t.x = 500; 33778 t.y = 500; 33779 t.z = 444; 33780 t.braceleft = 394; 33781 t.bar = 220; 33782 t.braceright = 394; 33783 t.asciitilde = 520; 33784 t.exclamdown = 333; 33785 t.cent = 500; 33786 t.sterling = 500; 33787 t.fraction = 167; 33788 t.yen = 500; 33789 t.florin = 500; 33790 t.section = 500; 33791 t.currency = 500; 33792 t.quotesingle = 278; 33793 t.quotedblleft = 500; 33794 t.guillemotleft = 500; 33795 t.guilsinglleft = 333; 33796 t.guilsinglright = 333; 33797 t.fi = 556; 33798 t.fl = 556; 33799 t.endash = 500; 33800 t.dagger = 500; 33801 t.daggerdbl = 500; 33802 t.periodcentered = 250; 33803 t.paragraph = 540; 33804 t.bullet = 350; 33805 t.quotesinglbase = 333; 33806 t.quotedblbase = 500; 33807 t.quotedblright = 500; 33808 t.guillemotright = 500; 33809 t.ellipsis = 1000; 33810 t.perthousand = 1000; 33811 t.questiondown = 500; 33812 t.grave = 333; 33813 t.acute = 333; 33814 t.circumflex = 333; 33815 t.tilde = 333; 33816 t.macron = 333; 33817 t.breve = 333; 33818 t.dotaccent = 333; 33819 t.dieresis = 333; 33820 t.ring = 333; 33821 t.cedilla = 333; 33822 t.hungarumlaut = 333; 33823 t.ogonek = 333; 33824 t.caron = 333; 33825 t.emdash = 1000; 33826 t.AE = 1000; 33827 t.ordfeminine = 300; 33828 t.Lslash = 667; 33829 t.Oslash = 778; 33830 t.OE = 1000; 33831 t.ordmasculine = 330; 33832 t.ae = 722; 33833 t.dotlessi = 278; 33834 t.lslash = 278; 33835 t.oslash = 500; 33836 t.oe = 722; 33837 t.germandbls = 556; 33838 t.Idieresis = 389; 33839 t.eacute = 444; 33840 t.abreve = 500; 33841 t.uhungarumlaut = 556; 33842 t.ecaron = 444; 33843 t.Ydieresis = 722; 33844 t.divide = 570; 33845 t.Yacute = 722; 33846 t.Acircumflex = 722; 33847 t.aacute = 500; 33848 t.Ucircumflex = 722; 33849 t.yacute = 500; 33850 t.scommaaccent = 389; 33851 t.ecircumflex = 444; 33852 t.Uring = 722; 33853 t.Udieresis = 722; 33854 t.aogonek = 500; 33855 t.Uacute = 722; 33856 t.uogonek = 556; 33857 t.Edieresis = 667; 33858 t.Dcroat = 722; 33859 t.commaaccent = 250; 33860 t.copyright = 747; 33861 t.Emacron = 667; 33862 t.ccaron = 444; 33863 t.aring = 500; 33864 t.Ncommaaccent = 722; 33865 t.lacute = 278; 33866 t.agrave = 500; 33867 t.Tcommaaccent = 667; 33868 t.Cacute = 722; 33869 t.atilde = 500; 33870 t.Edotaccent = 667; 33871 t.scaron = 389; 33872 t.scedilla = 389; 33873 t.iacute = 278; 33874 t.lozenge = 494; 33875 t.Rcaron = 722; 33876 t.Gcommaaccent = 778; 33877 t.ucircumflex = 556; 33878 t.acircumflex = 500; 33879 t.Amacron = 722; 33880 t.rcaron = 444; 33881 t.ccedilla = 444; 33882 t.Zdotaccent = 667; 33883 t.Thorn = 611; 33884 t.Omacron = 778; 33885 t.Racute = 722; 33886 t.Sacute = 556; 33887 t.dcaron = 672; 33888 t.Umacron = 722; 33889 t.uring = 556; 33890 t.threesuperior = 300; 33891 t.Ograve = 778; 33892 t.Agrave = 722; 33893 t.Abreve = 722; 33894 t.multiply = 570; 33895 t.uacute = 556; 33896 t.Tcaron = 667; 33897 t.partialdiff = 494; 33898 t.ydieresis = 500; 33899 t.Nacute = 722; 33900 t.icircumflex = 278; 33901 t.Ecircumflex = 667; 33902 t.adieresis = 500; 33903 t.edieresis = 444; 33904 t.cacute = 444; 33905 t.nacute = 556; 33906 t.umacron = 556; 33907 t.Ncaron = 722; 33908 t.Iacute = 389; 33909 t.plusminus = 570; 33910 t.brokenbar = 220; 33911 t.registered = 747; 33912 t.Gbreve = 778; 33913 t.Idotaccent = 389; 33914 t.summation = 600; 33915 t.Egrave = 667; 33916 t.racute = 444; 33917 t.omacron = 500; 33918 t.Zacute = 667; 33919 t.Zcaron = 667; 33920 t.greaterequal = 549; 33921 t.Eth = 722; 33922 t.Ccedilla = 722; 33923 t.lcommaaccent = 278; 33924 t.tcaron = 416; 33925 t.eogonek = 444; 33926 t.Uogonek = 722; 33927 t.Aacute = 722; 33928 t.Adieresis = 722; 33929 t.egrave = 444; 33930 t.zacute = 444; 33931 t.iogonek = 278; 33932 t.Oacute = 778; 33933 t.oacute = 500; 33934 t.amacron = 500; 33935 t.sacute = 389; 33936 t.idieresis = 278; 33937 t.Ocircumflex = 778; 33938 t.Ugrave = 722; 33939 t.Delta = 612; 33940 t.thorn = 556; 33941 t.twosuperior = 300; 33942 t.Odieresis = 778; 33943 t.mu = 556; 33944 t.igrave = 278; 33945 t.ohungarumlaut = 500; 33946 t.Eogonek = 667; 33947 t.dcroat = 556; 33948 t.threequarters = 750; 33949 t.Scedilla = 556; 33950 t.lcaron = 394; 33951 t.Kcommaaccent = 778; 33952 t.Lacute = 667; 33953 t.trademark = 1000; 33954 t.edotaccent = 444; 33955 t.Igrave = 389; 33956 t.Imacron = 389; 33957 t.Lcaron = 667; 33958 t.onehalf = 750; 33959 t.lessequal = 549; 33960 t.ocircumflex = 500; 33961 t.ntilde = 556; 33962 t.Uhungarumlaut = 722; 33963 t.Eacute = 667; 33964 t.emacron = 444; 33965 t.gbreve = 500; 33966 t.onequarter = 750; 33967 t.Scaron = 556; 33968 t.Scommaaccent = 556;
33969 t.Ohungarumlaut = 778; 33970 t.degree = 400; 33971 t.ograve = 500; 33972 t.Ccaron = 722; 33973 t.ugrave = 556; 33974 t.radical = 549; 33975 t.Dcaron = 722; 33976 t.rcommaaccent = 444; 33977 t.Ntilde = 722; 33978 t.otilde = 500; 33979 t.Rcommaaccent = 722; 33980 t.Lcommaaccent = 667; 33981 t.Atilde = 722; 33982 t.Aogonek = 722; 33983 t.Aring = 722; 33984 t.Otilde = 778; 33985 t.zdotaccent = 444; 33986 t.Ecaron = 667; 33987 t.Iogonek = 389; 33988 t.kcommaaccent = 556; 33989 t.minus = 570; 33990 t.Icircumflex = 389; 33991 t.ncaron = 556; 33992 t.tcommaaccent = 333; 33993 t.logicalnot = 570; 33994 t.odieresis = 500; 33995 t.udieresis = 556; 33996 t.notequal = 549; 33997 t.gcommaaccent = 500; 33998 t.eth = 500; 33999 t.zcaron = 444; 34000 t.ncommaaccent = 556; 34001 t.onesuperior = 300; 34002 t.imacron = 278; 34003 t.Euro = 500; 34004 }); 34005 t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) { 34006 t.space = 250; 34007 t.exclam = 389; 34008 t.quotedbl = 555; 34009 t.numbersign = 500; 34010 t.dollar = 500; 34011 t.percent = 833; 34012 t.ampersand = 778; 34013 t.quoteright = 333; 34014 t.parenleft = 333; 34015 t.parenright = 333; 34016 t.asterisk = 500; 34017 t.plus = 570; 34018 t.comma = 250; 34019 t.hyphen = 333; 34020 t.period = 250; 34021 t.slash = 278; 34022 t.zero = 500; 34023 t.one = 500; 34024 t.two = 500; 34025 t.three = 500; 34026 t.four = 500; 34027 t.five = 500; 34028 t.six = 500; 34029 t.seven = 500; 34030 t.eight = 500; 34031 t.nine = 500; 34032 t.colon = 333; 34033 t.semicolon = 333; 34034 t.less = 570; 34035 t.equal = 570; 34036 t.greater = 570; 34037 t.question = 500; 34038 t.at = 832; 34039 t.A = 667; 34040 t.B = 667; 34041 t.C = 667; 34042 t.D = 722; 34043 t.E = 667; 34044 t.F = 667; 34045 t.G = 722; 34046 t.H = 778; 34047 t.I = 389; 34048 t.J = 500; 34049 t.K = 667; 34050 t.L = 611; 34051 t.M = 889; 34052 t.N = 722; 34053 t.O = 722; 34054 t.P = 611; 34055 t.Q = 722; 34056 t.R = 667; 34057 t.S = 556; 34058 t.T = 611; 34059 t.U = 722; 34060 t.V = 667; 34061 t.W = 889; 34062 t.X = 667; 34063 t.Y = 611; 34064 t.Z = 611; 34065 t.bracketleft = 333; 34066 t.backslash = 278; 34067 t.bracketright = 333; 34068 t.asciicircum = 570; 34069 t.underscore = 500; 34070 t.quoteleft = 333; 34071 t.a = 500; 34072 t.b = 500; 34073 t.c = 444; 34074 t.d = 500; 34075 t.e = 444; 34076 t.f = 333; 34077 t.g = 500; 34078 t.h = 556; 34079 t.i = 278; 34080 t.j = 278; 34081 t.k = 500; 34082 t.l = 278; 34083 t.m = 778; 34084 t.n = 556; 34085 t.o = 500; 34086 t.p = 500; 34087 t.q = 500; 34088 t.r = 389; 34089 t.s = 389; 34090 t.t = 278; 34091 t.u = 556; 34092 t.v = 444; 34093 t.w = 667; 34094 t.x = 500; 34095 t.y = 444; 34096 t.z = 389; 34097 t.braceleft = 348; 34098 t.bar = 220; 34099 t.braceright = 348; 34100 t.asciitilde = 570; 34101 t.exclamdown = 389; 34102 t.cent = 500; 34103 t.sterling = 500; 34104 t.fraction = 167; 34105 t.yen = 500; 34106 t.florin = 500; 34107 t.section = 500; 34108 t.currency = 500; 34109 t.quotesingle = 278; 34110 t.quotedblleft = 500; 34111 t.guillemotleft = 500; 34112 t.guilsinglleft = 333; 34113 t.guilsinglright = 333; 34114 t.fi = 556; 34115 t.fl = 556; 34116 t.endash = 500; 34117 t.dagger = 500; 34118 t.daggerdbl = 500; 34119 t.periodcentered = 250; 34120 t.paragraph = 500; 34121 t.bullet = 350; 34122 t.quotesinglbase = 333; 34123 t.quotedblbase = 500; 34124 t.quotedblright = 500; 34125 t.guillemotright = 500; 34126 t.ellipsis = 1000; 34127 t.perthousand = 1000; 34128 t.questiondown = 500; 34129 t.grave = 333; 34130 t.acute = 333; 34131 t.circumflex = 333; 34132 t.tilde = 333; 34133 t.macron = 333; 34134 t.breve = 333; 34135 t.dotaccent = 333; 34136 t.dieresis = 333; 34137 t.ring = 333; 34138 t.cedilla = 333; 34139 t.hungarumlaut = 333; 34140 t.ogonek = 333; 34141 t.caron = 333; 34142 t.emdash = 1000; 34143 t.AE = 944; 34144 t.ordfeminine = 266; 34145 t.Lslash = 611; 34146 t.Oslash = 722; 34147 t.OE = 944; 34148 t.ordmasculine = 300; 34149 t.ae = 722; 34150 t.dotlessi = 278; 34151 t.lslash = 278; 34152 t.oslash = 500; 34153 t.oe = 722; 34154 t.germandbls = 500; 34155 t.Idieresis = 389; 34156 t.eacute = 444; 34157 t.abreve = 500; 34158 t.uhungarumlaut = 556; 34159 t.ecaron = 444; 34160 t.Ydieresis = 611; 34161 t.divide = 570; 34162 t.Yacute = 611; 34163 t.Acircumflex = 667; 34164 t.aacute = 500; 34165 t.Ucircumflex = 722; 34166 t.yacute = 444; 34167 t.scommaaccent = 389; 34168 t.ecircumflex = 444; 34169 t.Uring = 722; 34170 t.Udieresis = 722; 34171 t.aogonek = 500; 34172 t.Uacute = 722; 34173 t.uogonek = 556; 34174 t.Edieresis = 667; 34175 t.Dcroat = 722; 34176 t.commaaccent = 250; 34177 t.copyright = 747; 34178 t.Emacron = 667; 34179 t.ccaron = 444; 34180 t.aring = 500; 34181 t.Ncommaaccent = 722; 34182 t.lacute = 278; 34183 t.agrave = 500; 34184 t.Tcommaaccent = 611; 34185 t.Cacute = 667; 34186 t.atilde = 500; 34187 t.Edotaccent = 667; 34188 t.scaron = 389; 34189 t.scedilla = 389; 34190 t.iacute = 278; 34191 t.lozenge = 494; 34192 t.Rcaron = 667; 34193 t.Gcommaaccent = 722; 34194 t.ucircumflex = 556; 34195 t.acircumflex = 500; 34196 t.Amacron = 667; 34197 t.rcaron = 389; 34198 t.ccedilla = 444; 34199 t.Zdotaccent = 611; 34200 t.Thorn = 611; 34201 t.Omacron = 722; 34202 t.Racute = 667; 34203 t.Sacute = 556; 34204 t.dcaron = 608; 34205 t.Umacron = 722; 34206 t.uring = 556; 34207 t.threesuperior = 300; 34208 t.Ograve = 722; 34209 t.Agrave = 667; 34210 t.Abreve = 667; 34211 t.multiply = 570; 34212 t.uacute = 556; 34213 t.Tcaron = 611; 34214 t.partialdiff = 494; 34215 t.ydieresis = 444; 34216 t.Nacute = 722; 34217 t.icircumflex = 278; 34218 t.Ecircumflex = 667; 34219 t.adieresis = 500; 34220 t.edieresis = 444; 34221 t.cacute = 444; 34222 t.nacute = 556; 34223 t.umacron = 556; 34224 t.Ncaron = 722; 34225 t.Iacute = 389; 34226 t.plusminus = 570; 34227 t.brokenbar = 220; 34228 t.registered = 747; 34229 t.Gbreve = 722; 34230 t.Idotaccent = 389; 34231 t.summation = 600; 34232 t.Egrave = 667; 34233 t.racute = 389; 34234 t.omacron = 500; 34235 t.Zacute = 611; 34236 t.Zcaron = 611; 34237 t.greaterequal = 549; 34238 t.Eth = 722; 34239 t.Ccedilla = 667; 34240 t.lcommaaccent = 278; 34241 t.tcaron = 366; 34242 t.eogonek = 444; 34243 t.Uogonek = 722; 34244 t.Aacute = 667; 34245 t.Adieresis = 667; 34246 t.egrave = 444; 34247 t.zacute = 389; 34248 t.iogonek = 278; 34249 t.Oacute = 722; 34250 t.oacute = 500; 34251 t.amacron = 500; 34252 t.sacute = 389; 34253 t.idieresis = 278; 34254 t.Ocircumflex = 722; 34255 t.Ugrave = 722; 34256 t.Delta = 612; 34257 t.thorn = 500; 34258 t.twosuperior = 300; 34259 t.Odieresis = 722; 34260 t.mu = 576; 34261 t.igrave = 278; 34262 t.ohungarumlaut = 500; 34263 t.Eogonek = 667; 34264 t.dcroat = 500; 34265 t.threequarters = 750; 34266 t.Scedilla = 556; 34267 t.lcaron = 382; 34268 t.Kcommaaccent = 667; 34269 t.Lacute = 611; 34270 t.trademark = 1000; 34271 t.edotaccent = 444; 34272 t.Igrave = 389; 34273 t.Imacron = 389; 34274 t.Lcaron = 611; 34275 t.onehalf = 750; 34276 t.lessequal = 549; 34277 t.ocircumflex = 500; 34278 t.ntilde = 556; 34279 t.Uhungarumlaut = 722; 34280 t.Eacute = 667; 34281 t.emacron = 444; 34282 t.gbreve = 500; 34283 t.onequarter = 750; 34284 t.Scaron = 556; 34285 t.Scommaaccent = 556;
34286 t.Ohungarumlaut = 722; 34287 t.degree = 400; 34288 t.ograve = 500; 34289 t.Ccaron = 667; 34290 t.ugrave = 556; 34291 t.radical = 549; 34292 t.Dcaron = 722; 34293 t.rcommaaccent = 389; 34294 t.Ntilde = 722; 34295 t.otilde = 500; 34296 t.Rcommaaccent = 667; 34297 t.Lcommaaccent = 611; 34298 t.Atilde = 667; 34299 t.Aogonek = 667; 34300 t.Aring = 667; 34301 t.Otilde = 722; 34302 t.zdotaccent = 389; 34303 t.Ecaron = 667; 34304 t.Iogonek = 389; 34305 t.kcommaaccent = 500; 34306 t.minus = 606; 34307 t.Icircumflex = 389; 34308 t.ncaron = 556; 34309 t.tcommaaccent = 278; 34310 t.logicalnot = 606; 34311 t.odieresis = 500; 34312 t.udieresis = 556; 34313 t.notequal = 549; 34314 t.gcommaaccent = 500; 34315 t.eth = 500; 34316 t.zcaron = 389; 34317 t.ncommaaccent = 556; 34318 t.onesuperior = 300; 34319 t.imacron = 278; 34320 t.Euro = 500; 34321 }); 34322 t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)
vendor: 6,510 bytes, lines 34322-34639
34322(function (t) { 34323 t.space = 250; 34324 t.exclam = 333; 34325 t.quotedbl = 420; 34326 t.numbersign = 500; 34327 t.dollar = 500; 34328 t.percent = 833; 34329 t.ampersand = 778; 34330 t.quoteright = 333; 34331 t.parenleft = 333; 34332 t.parenright = 333; 34333 t.asterisk = 500; 34334 t.plus = 675; 34335 t.comma = 250; 34336 t.hyphen = 333; 34337 t.period = 250; 34338 t.slash = 278; 34339 t.zero = 500; 34340 t.one = 500; 34341 t.two = 500; 34342 t.three = 500; 34343 t.four = 500; 34344 t.five = 500; 34345 t.six = 500; 34346 t.seven = 500; 34347 t.eight = 500; 34348 t.nine = 500; 34349 t.colon = 333; 34350 t.semicolon = 333; 34351 t.less = 675; 34352 t.equal = 675; 34353 t.greater = 675; 34354 t.question = 500; 34355 t.at = 920; 34356 t.A = 611; 34357 t.B = 611; 34358 t.C = 667; 34359 t.D = 722; 34360 t.E = 611; 34361 t.F = 611; 34362 t.G = 722; 34363 t.H = 722; 34364 t.I = 333; 34365 t.J = 444; 34366 t.K = 667; 34367 t.L = 556; 34368 t.M = 833; 34369 t.N = 667; 34370 t.O = 722; 34371 t.P = 611; 34372 t.Q = 722; 34373 t.R = 611; 34374 t.S = 500; 34375 t.T = 556; 34376 t.U = 722; 34377 t.V = 611; 34378 t.W = 833; 34379 t.X = 611; 34380 t.Y = 556; 34381 t.Z = 556; 34382 t.bracketleft = 389; 34383 t.backslash = 278; 34384 t.bracketright = 389; 34385 t.asciicircum = 422; 34386 t.underscore = 500; 34387 t.quoteleft = 333; 34388 t.a = 500; 34389 t.b = 500; 34390 t.c = 444; 34391 t.d = 500; 34392 t.e = 444; 34393 t.f = 278; 34394 t.g = 500; 34395 t.h = 500; 34396 t.i = 278; 34397 t.j = 278; 34398 t.k = 444; 34399 t.l = 278; 34400 t.m = 722; 34401 t.n = 500; 34402 t.o = 500; 34403 t.p = 500; 34404 t.q = 500; 34405 t.r = 389; 34406 t.s = 389; 34407 t.t = 278; 34408 t.u = 500; 34409 t.v = 444; 34410 t.w = 667; 34411 t.x = 444; 34412 t.y = 444; 34413 t.z = 389; 34414 t.braceleft = 400; 34415 t.bar = 275; 34416 t.braceright = 400; 34417 t.asciitilde = 541; 34418 t.exclamdown = 389; 34419 t.cent = 500; 34420 t.sterling = 500; 34421 t.fraction = 167; 34422 t.yen = 500; 34423 t.florin = 500; 34424 t.section = 500; 34425 t.currency = 500; 34426 t.quotesingle = 214; 34427 t.quotedblleft = 556; 34428 t.guillemotleft = 500; 34429 t.guilsinglleft = 333; 34430 t.guilsinglright = 333; 34431 t.fi = 500; 34432 t.fl = 500; 34433 t.endash = 500; 34434 t.dagger = 500; 34435 t.daggerdbl = 500; 34436 t.periodcentered = 250; 34437 t.paragraph = 523; 34438 t.bullet = 350; 34439 t.quotesinglbase = 333; 34440 t.quotedblbase = 556; 34441 t.quotedblright = 556; 34442 t.guillemotright = 500; 34443 t.ellipsis = 889; 34444 t.perthousand = 1000; 34445 t.questiondown = 500; 34446 t.grave = 333; 34447 t.acute = 333; 34448 t.circumflex = 333; 34449 t.tilde = 333; 34450 t.macron = 333; 34451 t.breve = 333; 34452 t.dotaccent = 333; 34453 t.dieresis = 333; 34454 t.ring = 333; 34455 t.cedilla = 333; 34456 t.hungarumlaut = 333; 34457 t.ogonek = 333; 34458 t.caron = 333; 34459 t.emdash = 889; 34460 t.AE = 889; 34461 t.ordfeminine = 276; 34462 t.Lslash = 556; 34463 t.Oslash = 722; 34464 t.OE = 944; 34465 t.ordmasculine = 310; 34466 t.ae = 667; 34467 t.dotlessi = 278; 34468 t.lslash = 278; 34469 t.oslash = 500; 34470 t.oe = 667; 34471 t.germandbls = 500; 34472 t.Idieresis = 333; 34473 t.eacute = 444; 34474 t.abreve = 500; 34475 t.uhungarumlaut = 500; 34476 t.ecaron = 444; 34477 t.Ydieresis = 556; 34478 t.divide = 675; 34479 t.Yacute = 556; 34480 t.Acircumflex = 611; 34481 t.aacute = 500; 34482 t.Ucircumflex = 722; 34483 t.yacute = 444; 34484 t.scommaaccent = 389; 34485 t.ecircumflex = 444; 34486 t.Uring = 722; 34487 t.Udieresis = 722; 34488 t.aogonek = 500; 34489 t.Uacute = 722; 34490 t.uogonek = 500; 34491 t.Edieresis = 611; 34492 t.Dcroat = 722; 34493 t.commaaccent = 250; 34494 t.copyright = 760; 34495 t.Emacron = 611; 34496 t.ccaron = 444; 34497 t.aring = 500; 34498 t.Ncommaaccent = 667; 34499 t.lacute = 278; 34500 t.agrave = 500; 34501 t.Tcommaaccent = 556; 34502 t.Cacute = 667; 34503 t.atilde = 500; 34504 t.Edotaccent = 611; 34505 t.scaron = 389; 34506 t.scedilla = 389; 34507 t.iacute = 278; 34508 t.lozenge = 471; 34509 t.Rcaron = 611; 34510 t.Gcommaaccent = 722; 34511 t.ucircumflex = 500; 34512 t.acircumflex = 500; 34513 t.Amacron = 611; 34514 t.rcaron = 389; 34515 t.ccedilla = 444; 34516 t.Zdotaccent = 556; 34517 t.Thorn = 611; 34518 t.Omacron = 722; 34519 t.Racute = 611; 34520 t.Sacute = 500; 34521 t.dcaron = 544; 34522 t.Umacron = 722; 34523 t.uring = 500; 34524 t.threesuperior = 300; 34525 t.Ograve = 722; 34526 t.Agrave = 611; 34527 t.Abreve = 611; 34528 t.multiply = 675; 34529 t.uacute = 500; 34530 t.Tcaron = 556; 34531 t.partialdiff = 476; 34532 t.ydieresis = 444; 34533 t.Nacute = 667; 34534 t.icircumflex = 278; 34535 t.Ecircumflex = 611; 34536 t.adieresis = 500; 34537 t.edieresis = 444; 34538 t.cacute = 444; 34539 t.nacute = 500; 34540 t.umacron = 500; 34541 t.Ncaron = 667; 34542 t.Iacute = 333; 34543 t.plusminus = 675; 34544 t.brokenbar = 275; 34545 t.registered = 760; 34546 t.Gbreve = 722; 34547 t.Idotaccent = 333; 34548 t.summation = 600; 34549 t.Egrave = 611; 34550 t.racute = 389; 34551 t.omacron = 500; 34552 t.Zacute = 556; 34553 t.Zcaron = 556; 34554 t.greaterequal = 549; 34555 t.Eth = 722; 34556 t.Ccedilla = 667; 34557 t.lcommaaccent = 278; 34558 t.tcaron = 300; 34559 t.eogonek = 444; 34560 t.Uogonek = 722; 34561 t.Aacute = 611; 34562 t.Adieresis = 611; 34563 t.egrave = 444; 34564 t.zacute = 389; 34565 t.iogonek = 278; 34566 t.Oacute = 722; 34567 t.oacute = 500; 34568 t.amacron = 500; 34569 t.sacute = 389; 34570 t.idieresis = 278; 34571 t.Ocircumflex = 722; 34572 t.Ugrave = 722; 34573 t.Delta = 612; 34574 t.thorn = 500; 34575 t.twosuperior = 300; 34576 t.Odieresis = 722; 34577 t.mu = 500; 34578 t.igrave = 278; 34579 t.ohungarumlaut = 500; 34580 t.Eogonek = 611; 34581 t.dcroat = 500; 34582 t.threequarters = 750; 34583 t.Scedilla = 500; 34584 t.lcaron = 300; 34585 t.Kcommaaccent = 667; 34586 t.Lacute = 556; 34587 t.trademark = 980; 34588 t.edotaccent = 444; 34589 t.Igrave = 333; 34590 t.Imacron = 333; 34591 t.Lcaron = 611; 34592 t.onehalf = 750; 34593 t.lessequal = 549; 34594 t.ocircumflex = 500; 34595 t.ntilde = 500; 34596 t.Uhungarumlaut = 722; 34597 t.Eacute = 611; 34598 t.emacron = 444; 34599 t.gbreve = 500; 34600 t.onequarter = 750; 34601 t.Scaron = 500; 34602 t.Scommaaccent = 500; 34603 t.Ohungarumlaut = 722; 34604 t.degree = 400; 34605 t.ograve = 500; 34606 t.Ccaron = 667; 34607 t.ugrave = 500; 34608 t.radical = 453; 34609 t.Dcaron = 722; 34610 t.rcommaaccent = 389; 34611 t.Ntilde = 667; 34612 t.otilde = 500; 34613 t.Rcommaaccent = 611; 34614 t.Lcommaaccent = 556; 34615 t.Atilde = 611; 34616 t.Aogonek = 611; 34617 t.Aring = 611; 34618 t.Otilde = 722; 34619 t.zdotaccent = 389; 34620 t.Ecaron = 611; 34621 t.Iogonek = 333; 34622 t.kcommaaccent = 444; 34623 t.minus = 675; 34624 t.Icircumflex = 333; 34625 t.ncaron = 500; 34626 t.tcommaaccent = 278; 34627 t.logicalnot = 675; 34628 t.odieresis = 500; 34629 t.udieresis = 500; 34630 t.notequal = 549; 34631 t.gcommaaccent = 500; 34632 t.eth = 500; 34633 t.zcaron = 389; 34634 t.ncommaaccent = 500; 34635 t.onesuperior = 300; 34636 t.imacron = 278; 34637 t.Euro = 500; 34638 }); 34639 t.ZapfDingbats =
34639(0, _core_utils.getLookupTableFactory)(function (t) { 34640 t.space = 278; 34641 t.a1 = 974; 34642 t.a2 = 961; 34643 t.a202 = 974; 34644 t.a3 = 980; 34645 t.a4 = 719; 34646 t.a5 = 789; 34647 t.a119 = 790; 34648 t.a118 = 791; 34649 t.a117 = 690; 34650 t.a11 = 960; 34651 t.a12 = 939; 34652 t.a13 = 549; 34653 t.a14 = 855; 34654 t.a15 = 911; 34655 t.a16 = 933; 34656 t.a105 = 911; 34657 t.a17 = 945; 34658 t.a18 = 974; 34659 t.a19 = 755; 34660 t.a20 = 846; 34661 t.a21 = 762; 34662 t.a22 = 761; 34663 t.a23 = 571; 34664 t.a24 = 677; 34665 t.a25 = 763; 34666 t.a26 = 760; 34667 t.a27 = 759; 34668 t.a28 = 754; 34669 t.a6 = 494; 34670 t.a7 = 552; 34671 t.a8 = 537; 34672 t.a9 = 577; 34673 t.a10 = 692; 34674 t.a29 = 786; 34675 t.a30 = 788; 34676 t.a31 = 788; 34677 t.a32 = 790; 34678 t.a33 = 793; 34679 t.a34 = 794; 34680 t.a35 = 816; 34681 t.a36 = 823; 34682 t.a37 = 789; 34683 t.a38 = 841; 34684 t.a39 = 823; 34685 t.a40 = 833; 34686 t.a41 = 816; 34687 t.a42 = 831; 34688 t.a43 = 923; 34689 t.a44 = 744; 34690 t.a45 = 723; 34691 t.a46 = 749; 34692 t.a47 = 790; 34693 t.a48 = 792; 34694 t.a49 = 695; 34695 t.a50 = 776; 34696 t.a51 = 768; 34697 t.a52 = 792; 34698 t.a53 = 759; 34699 t.a54 = 707; 34700 t.a55 = 708; 34701 t.a56 = 682; 34702 t.a57 = 701; 34703 t.a58 = 826; 34704 t.a59 = 815; 34705 t.a60 = 789; 34706 t.a61 = 789; 34707 t.a62 = 707; 34708 t.a63 = 687; 34709 t.a64 = 696; 34710 t.a65 = 689; 34711 t.a66 = 786; 34712 t.a67 = 787; 34713 t.a68 = 713; 34714 t.a69 = 791; 34715 t.a70 = 785; 34716 t.a71 = 791; 34717 t.a72 = 873; 34718 t.a73 = 761; 34719 t.a74 = 762; 34720 t.a203 = 762; 34721 t.a75 = 759; 34722 t.a204 = 759; 34723 t.a76 = 892; 34724 t.a77 = 892; 34725 t.a78 = 788; 34726 t.a79 = 784; 34727 t.a81 = 438; 34728 t.a82 = 138; 34729 t.a83 = 277; 34730 t.a84 = 415; 34731 t.a97 = 392; 34732 t.a98 = 392; 34733 t.a99 = 668; 34734 t.a100 = 668; 34735 t.a89 = 390; 34736 t.a90 = 390; 34737 t.a93 = 317; 34738 t.a94 = 317; 34739 t.a91 = 276; 34740 t.a92 = 276; 34741 t.a205 = 509; 34742 t.a85 = 509; 34743 t.a206 = 410; 34744 t.a86 = 410; 34745 t.a87 = 234; 34746 t.a88 = 234; 34747 t.a95 = 334; 34748 t.a96 = 334; 34749 t.a101 = 732; 34750 t.a102 = 544; 34751 t.a103 = 544; 34752 t.a104 = 910; 34753 t.a106 = 667; 34754 t.a107 = 760; 34755 t.a108 = 760; 34756 t.a112 = 776; 34757 t.a111 = 595; 34758 t.a110 = 694; 34759 t.a109 = 626; 34760 t.a120 = 788; 34761 t.a121 = 788; 34762 t.a122 = 788; 34763 t.a123 = 788; 34764 t.a124 = 788; 34765 t.a125 = 788; 34766 t.a126 = 788; 34767 t.a127 = 788; 34768 t.a128 = 788; 34769 t.a129 = 788; 34770 t.a130 = 788; 34771 t.a131 = 788; 34772 t.a132 = 788; 34773 t.a133 = 788; 34774 t.a134 = 788; 34775 t.a135 = 788; 34776 t.a136 = 788; 34777 t.a137 = 788; 34778 t.a138 = 788; 34779 t.a139 = 788; 34780 t.a140 = 788; 34781 t.a141 = 788; 34782 t.a142 = 788; 34783 t.a143 = 788; 34784 t.a144 = 788; 34785 t.a145 = 788; 34786 t.a146 = 788; 34787 t.a147 = 788; 34788 t.a148 = 788; 34789 t.a149 = 788; 34790 t.a150 = 788; 34791 t.a151 = 788; 34792 t.a152 = 788; 34793 t.a153 = 788; 34794 t.a154 = 788; 34795 t.a155 = 788; 34796 t.a156 = 788; 34797 t.a157 = 788; 34798 t.a158 = 788; 34799 t.a159 = 788; 34800 t.a160 = 894; 34801 t.a161 = 838; 34802 t.a163 = 1016; 34803 t.a164 = 458; 34804 t.a196 = 748; 34805 t.a165 = 924; 34806 t.a192 = 748; 34807 t.a166 = 918; 34808 t.a167 = 927; 34809 t.a168 = 928; 34810 t.a169 = 928; 34811 t.a170 = 834; 34812 t.a171 = 873; 34813 t.a172 = 828; 34814 t.a173 = 924; 34815 t.a162 = 924; 34816 t.a174 = 917; 34817 t.a175 = 930; 34818 t.a176 = 931; 34819 t.a177 = 463; 34820 t.a178 = 883; 34821 t.a179 = 836; 34822 t.a193 = 836; 34823 t.a180 = 867; 34824 t.a199 = 867; 34825 t.a181 = 696; 34826 t.a200 = 696; 34827 t.a182 = 874; 34828 t.a201 = 874; 34829 t.a183 = 760; 34830 t.a184 = 946; 34831 t.a197 = 771; 34832 t.a185 = 865; 34833 t.a194 = 771; 34834 t.a198 = 888; 34835 t.a186 = 967; 34836 t.a195 = 888; 34837 t.a187 = 831; 34838 t.a188 = 873; 34839 t.a189 = 927; 34840 t.a190 = 970; 34841 t.a191 = 918; 34842 }); 34843}); 34844exports.getMetrics = getMetrics; 34845const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) { 34846 t.Courier = { 34847 ascent: 629, 34848 descent: -157, 34849 capHeight: 562, 34850 xHeight: -426 34851 };
vendor: 36,287 bytes, lines 34852-36077
34852 t["Courier-Bold"] = { 34853 ascent: 629, 34854 descent: -157, 34855 capHeight: 562, 34856 xHeight: 439 34857 }; 34858 t["Courier-Oblique"] = { 34859 ascent: 629, 34860 descent: -157, 34861 capHeight: 562, 34862 xHeight: 426 34863 }; 34864 t["Courier-BoldOblique"] = { 34865 ascent: 629, 34866 descent: -157, 34867 capHeight: 562, 34868 xHeight: 426 34869 }; 34870 t.Helvetica = { 34871 ascent: 718, 34872 descent: -207, 34873 capHeight: 718, 34874 xHeight: 523 34875 }; 34876 t["Helvetica-Bold"] = { 34877 ascent: 718, 34878 descent: -207, 34879 capHeight: 718, 34880 xHeight: 532 34881 }; 34882 t["Helvetica-Oblique"] = { 34883 ascent: 718, 34884 descent: -207, 34885 capHeight: 718, 34886 xHeight: 523 34887 }; 34888 t["Helvetica-BoldOblique"] = { 34889 ascent: 718, 34890 descent: -207, 34891 capHeight: 718, 34892 xHeight: 532 34893 }; 34894 t["Times-Roman"] = { 34895 ascent: 683, 34896 descent: -217, 34897 capHeight: 662, 34898 xHeight: 450 34899 }; 34900 t["Times-Bold"] = { 34901 ascent: 683, 34902 descent: -217, 34903 capHeight: 676, 34904 xHeight: 461 34905 }; 34906 t["Times-Italic"] = { 34907 ascent: 683, 34908 descent: -217, 34909 capHeight: 653, 34910 xHeight: 441 34911 }; 34912 t["Times-BoldItalic"] = { 34913 ascent: 683, 34914 descent: -217, 34915 capHeight: 669, 34916 xHeight: 462 34917 }; 34918 t.Symbol = { 34919 ascent: Math.NaN, 34920 descent: Math.NaN, 34921 capHeight: Math.NaN, 34922 xHeight: Math.NaN 34923 }; 34924 t.ZapfDingbats = { 34925 ascent: Math.NaN, 34926 descent: Math.NaN, 34927 capHeight: Math.NaN, 34928 xHeight: Math.NaN 34929 }; 34930}); 34931exports.getFontBasicMetrics = getFontBasicMetrics; 34932 34933/***/ }), 34934/* 46 */ 34935/***/ ((__unused_webpack_module, exports) => { 34936 34937 34938 34939Object.defineProperty(exports, "__esModule", ({ 34940 value: true 34941})); 34942exports.GlyfTable = void 0; 34943const ON_CURVE_POINT = 1 << 0; 34944const X_SHORT_VECTOR = 1 << 1; 34945const Y_SHORT_VECTOR = 1 << 2; 34946const REPEAT_FLAG = 1 << 3; 34947const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4; 34948const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5; 34949const OVERLAP_SIMPLE = 1 << 6; 34950const ARG_1_AND_2_ARE_WORDS = 1 << 0; 34951const ARGS_ARE_XY_VALUES = 1 << 1; 34952const WE_HAVE_A_SCALE = 1 << 3; 34953const MORE_COMPONENTS = 1 << 5; 34954const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6; 34955const WE_HAVE_A_TWO_BY_TWO = 1 << 7; 34956const WE_HAVE_INSTRUCTIONS = 1 << 8; 34957class GlyfTable { 34958 constructor({ 34959 glyfTable, 34960 isGlyphLocationsLong, 34961 locaTable, 34962 numGlyphs 34963 }) { 34964 this.glyphs = []; 34965 const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength); 34966 const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength); 34967 const offsetSize = isGlyphLocationsLong ? 4 : 2; 34968 let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0); 34969 let pos = 0; 34970 for (let i = 0; i < numGlyphs; i++) { 34971 pos += offsetSize; 34972 const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos); 34973 if (next === prev) { 34974 this.glyphs.push(new Glyph({})); 34975 continue; 34976 } 34977 const glyph = Glyph.parse(prev, glyf); 34978 this.glyphs.push(glyph); 34979 prev = next; 34980 } 34981 } 34982 getSize() { 34983 return this.glyphs.reduce((a, g) => { 34984 const size = g.getSize(); 34985 return a + (size + 3 & ~3); 34986 }, 0); 34987 } 34988 write() { 34989 const totalSize = this.getSize(); 34990 const glyfTable = new DataView(new ArrayBuffer(totalSize)); 34991 const isLocationLong = totalSize > 0x1fffe; 34992 const offsetSize = isLocationLong ? 4 : 2; 34993 const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize)); 34994 if (isLocationLong) { 34995 locaTable.setUint32(0, 0); 34996 } else { 34997 locaTable.setUint16(0, 0); 34998 } 34999 let pos = 0; 35000 let locaIndex = 0; 35001 for (const glyph of this.glyphs) { 35002 pos += glyph.write(pos, glyfTable); 35003 pos = pos + 3 & ~3; 35004 locaIndex += offsetSize; 35005 if (isLocationLong) { 35006 locaTable.setUint32(locaIndex, pos); 35007 } else { 35008 locaTable.setUint16(locaIndex, pos >> 1); 35009 } 35010 } 35011 return { 35012 isLocationLong, 35013 loca: new Uint8Array(locaTable.buffer), 35014 glyf: new Uint8Array(glyfTable.buffer) 35015 }; 35016 } 35017 scale(factors) { 35018 for (let i = 0, ii = this.glyphs.length; i < ii; i++) { 35019 this.glyphs[i].scale(factors[i]); 35020 } 35021 } 35022} 35023exports.GlyfTable = GlyfTable; 35024class Glyph { 35025 constructor({ 35026 header = null, 35027 simple = null, 35028 composites = null 35029 }) { 35030 this.header = header; 35031 this.simple = simple; 35032 this.composites = composites; 35033 } 35034 static parse(pos, glyf) { 35035 const [read, header] = GlyphHeader.parse(pos, glyf); 35036 pos += read; 35037 if (header.numberOfContours < 0) { 35038 const composites = []; 35039 while (true) { 35040 const [n, composite] = CompositeGlyph.parse(pos, glyf); 35041 pos += n; 35042 composites.push(composite); 35043 if (!(composite.flags & MORE_COMPONENTS)) { 35044 break; 35045 } 35046 } 35047 return new Glyph({ 35048 header, 35049 composites 35050 }); 35051 } 35052 const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours); 35053 return new Glyph({ 35054 header, 35055 simple 35056 }); 35057 } 35058 getSize() { 35059 if (!this.header) { 35060 return 0; 35061 } 35062 const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0); 35063 return this.header.getSize() + size; 35064 } 35065 write(pos, buf) { 35066 if (!this.header) { 35067 return 0; 35068 } 35069 const spos = pos; 35070 pos += this.header.write(pos, buf); 35071 if (this.simple) { 35072 pos += this.simple.write(pos, buf); 35073 } else { 35074 for (const composite of this.composites) { 35075 pos += composite.write(pos, buf); 35076 } 35077 } 35078 return pos - spos; 35079 } 35080 scale(factor) { 35081 if (!this.header) { 35082 return; 35083 } 35084 const xMiddle = (this.header.xMin + this.header.xMax) / 2; 35085 this.header.scale(xMiddle, factor); 35086 if (this.simple) { 35087 this.simple.scale(xMiddle, factor); 35088 } else { 35089 for (const composite of this.composites) { 35090 composite.scale(xMiddle, factor); 35091 } 35092 } 35093 } 35094} 35095class GlyphHeader { 35096 constructor({ 35097 numberOfContours, 35098 xMin, 35099 yMin, 35100 xMax, 35101 yMax 35102 }) { 35103 this.numberOfContours = numberOfContours; 35104 this.xMin = xMin; 35105 this.yMin = yMin; 35106 this.xMax = xMax; 35107 this.yMax = yMax; 35108 } 35109 static parse(pos, glyf) { 35110 return [10, new GlyphHeader({ 35111 numberOfContours: glyf.getInt16(pos), 35112 xMin: glyf.getInt16(pos + 2), 35113 yMin: glyf.getInt16(pos + 4), 35114 xMax: glyf.getInt16(pos + 6), 35115 yMax: glyf.getInt16(pos + 8) 35116 })]; 35117 } 35118 getSize() { 35119 return 10; 35120 } 35121 write(pos, buf) { 35122 buf.setInt16(pos, this.numberOfContours); 35123 buf.setInt16(pos + 2, this.xMin); 35124 buf.setInt16(pos + 4, this.yMin); 35125 buf.setInt16(pos + 6, this.xMax); 35126 buf.setInt16(pos + 8, this.yMax); 35127 return 10; 35128 } 35129 scale(x, factor) { 35130 this.xMin = Math.round(x + (this.xMin - x) * factor); 35131 this.xMax = Math.round(x + (this.xMax - x) * factor); 35132 } 35133} 35134class Contour { 35135 constructor({ 35136 flags, 35137 xCoordinates, 35138 yCoordinates 35139 }) { 35140 this.xCoordinates = xCoordinates; 35141 this.yCoordinates = yCoordinates; 35142 this.flags = flags; 35143 } 35144} 35145class SimpleGlyph { 35146 constructor({ 35147 contours, 35148 instructions 35149 }) { 35150 this.contours = contours; 35151 this.instructions = instructions; 35152 } 35153 static parse(pos, glyf, numberOfContours) { 35154 const endPtsOfContours = []; 35155 for (let i = 0; i < numberOfContours; i++) { 35156 const endPt = glyf.getUint16(pos); 35157 pos += 2; 35158 endPtsOfContours.push(endPt); 35159 } 35160 const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1; 35161 const instructionLength = glyf.getUint16(pos); 35162 pos += 2; 35163 const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); 35164 pos += instructionLength; 35165 const flags = []; 35166 for (let i = 0; i < numberOfPt; pos++, i++) { 35167 let flag = glyf.getUint8(pos); 35168 flags.push(flag); 35169 if (flag & REPEAT_FLAG) { 35170 const count = glyf.getUint8(++pos); 35171 flag ^= REPEAT_FLAG; 35172 for (let m = 0; m < count; m++) { 35173 flags.push(flag); 35174 } 35175 i += count; 35176 } 35177 } 35178 const allXCoordinates = []; 35179 let xCoordinates = []; 35180 let yCoordinates = []; 35181 let pointFlags = []; 35182 const contours = []; 35183 let endPtsOfContoursIndex = 0; 35184 let lastCoordinate = 0; 35185 for (let i = 0; i < numberOfPt; i++) { 35186 const flag = flags[i]; 35187 if (flag & X_SHORT_VECTOR) { 35188 const x = glyf.getUint8(pos++); 35189 lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x; 35190 xCoordinates.push(lastCoordinate); 35191 } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) { 35192 xCoordinates.push(lastCoordinate); 35193 } else { 35194 lastCoordinate += glyf.getInt16(pos); 35195 pos += 2; 35196 xCoordinates.push(lastCoordinate); 35197 } 35198 if (endPtsOfContours[endPtsOfContoursIndex] === i) { 35199 endPtsOfContoursIndex++; 35200 allXCoordinates.push(xCoordinates); 35201 xCoordinates = []; 35202 } 35203 } 35204 lastCoordinate = 0; 35205 endPtsOfContoursIndex = 0; 35206 for (let i = 0; i < numberOfPt; i++) { 35207 const flag = flags[i]; 35208 if (flag & Y_SHORT_VECTOR) { 35209 const y = glyf.getUint8(pos++); 35210 lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y; 35211 yCoordinates.push(lastCoordinate); 35212 } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) { 35213 yCoordinates.push(lastCoordinate); 35214 } else { 35215 lastCoordinate += glyf.getInt16(pos); 35216 pos += 2; 35217 yCoordinates.push(lastCoordinate); 35218 } 35219 pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE); 35220 if (endPtsOfContours[endPtsOfContoursIndex] === i) { 35221 xCoordinates = allXCoordinates[endPtsOfContoursIndex]; 35222 endPtsOfContoursIndex++; 35223 contours.push(new Contour({ 35224 flags: pointFlags, 35225 xCoordinates, 35226 yCoordinates 35227 })); 35228 yCoordinates = []; 35229 pointFlags = []; 35230 } 35231 } 35232 return new SimpleGlyph({ 35233 contours, 35234 instructions 35235 }); 35236 } 35237 getSize() { 35238 let size = this.contours.length * 2 + 2 + this.instructions.length; 35239 let lastX = 0; 35240 let lastY = 0; 35241 for (const contour of this.contours) { 35242 size += contour.flags.length; 35243 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 35244 const x = contour.xCoordinates[i]; 35245 const y = contour.yCoordinates[i]; 35246 let abs = Math.abs(x - lastX); 35247 if (abs > 255) { 35248 size += 2; 35249 } else if (abs > 0) { 35250 size += 1; 35251 } 35252 lastX = x; 35253 abs = Math.abs(y - lastY); 35254 if (abs > 255) { 35255 size += 2; 35256 } else if (abs > 0) { 35257 size += 1; 35258 } 35259 lastY = y; 35260 } 35261 } 35262 return size; 35263 } 35264 write(pos, buf) { 35265 const spos = pos; 35266 const xCoordinates = []; 35267 const yCoordinates = []; 35268 const flags = []; 35269 let lastX = 0; 35270 let lastY = 0; 35271 for (const contour of this.contours) { 35272 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 35273 let flag = contour.flags[i]; 35274 const x = contour.xCoordinates[i]; 35275 let delta = x - lastX; 35276 if (delta === 0) { 35277 flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR; 35278 xCoordinates.push(0); 35279 } else { 35280 const abs = Math.abs(delta); 35281 if (abs <= 255) { 35282 flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR; 35283 xCoordinates.push(abs); 35284 } else { 35285 xCoordinates.push(delta); 35286 } 35287 } 35288 lastX = x; 35289 const y = contour.yCoordinates[i]; 35290 delta = y - lastY; 35291 if (delta === 0) { 35292 flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR; 35293 yCoordinates.push(0); 35294 } else { 35295 const abs = Math.abs(delta); 35296 if (abs <= 255) { 35297 flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR; 35298 yCoordinates.push(abs); 35299 } else { 35300 yCoordinates.push(delta); 35301 } 35302 } 35303 lastY = y; 35304 flags.push(flag); 35305 } 35306 buf.setUint16(pos, xCoordinates.length - 1); 35307 pos += 2; 35308 } 35309 buf.setUint16(pos, this.instructions.length); 35310 pos += 2; 35311 if (this.instructions.length) { 35312 new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); 35313 pos += this.instructions.length; 35314 } 35315 for (const flag of flags) { 35316 buf.setUint8(pos++, flag); 35317 } 35318 for (let i = 0, ii = xCoordinates.length; i < ii; i++) { 35319 const x = xCoordinates[i]; 35320 const flag = flags[i]; 35321 if (flag & X_SHORT_VECTOR) { 35322 buf.setUint8(pos++, x); 35323 } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) { 35324 buf.setInt16(pos, x); 35325 pos += 2; 35326 } 35327 } 35328 for (let i = 0, ii = yCoordinates.length; i < ii; i++) { 35329 const y = yCoordinates[i]; 35330 const flag = flags[i]; 35331 if (flag & Y_SHORT_VECTOR) { 35332 buf.setUint8(pos++, y); 35333 } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) { 35334 buf.setInt16(pos, y); 35335 pos += 2; 35336 } 35337 } 35338 return pos - spos; 35339 } 35340 scale(x, factor) { 35341 for (const contour of this.contours) { 35342 if (contour.xCoordinates.length === 0) { 35343 continue; 35344 } 35345 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 35346 contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor); 35347 } 35348 } 35349 } 35350} 35351class CompositeGlyph { 35352 constructor({ 35353 flags, 35354 glyphIndex, 35355 argument1, 35356 argument2, 35357 transf, 35358 instructions 35359 }) { 35360 this.flags = flags; 35361 this.glyphIndex = glyphIndex; 35362 this.argument1 = argument1; 35363 this.argument2 = argument2; 35364 this.transf = transf; 35365 this.instructions = instructions; 35366 } 35367 static parse(pos, glyf) { 35368 const spos = pos; 35369 const transf = []; 35370 let flags = glyf.getUint16(pos); 35371 const glyphIndex = glyf.getUint16(pos + 2); 35372 pos += 4; 35373 let argument1, argument2; 35374 if (flags & ARG_1_AND_2_ARE_WORDS) { 35375 if (flags & ARGS_ARE_XY_VALUES) { 35376 argument1 = glyf.getInt16(pos); 35377 argument2 = glyf.getInt16(pos + 2); 35378 } else { 35379 argument1 = glyf.getUint16(pos); 35380 argument2 = glyf.getUint16(pos + 2); 35381 } 35382 pos += 4; 35383 flags ^= ARG_1_AND_2_ARE_WORDS; 35384 } else { 35385 if (flags & ARGS_ARE_XY_VALUES) { 35386 argument1 = glyf.getInt8(pos); 35387 argument2 = glyf.getInt8(pos + 1); 35388 } else { 35389 argument1 = glyf.getUint8(pos); 35390 argument2 = glyf.getUint8(pos + 1); 35391 } 35392 pos += 2; 35393 } 35394 if (flags & WE_HAVE_A_SCALE) { 35395 transf.push(glyf.getUint16(pos)); 35396 pos += 2; 35397 } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { 35398 transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2)); 35399 pos += 4; 35400 } else if (flags & WE_HAVE_A_TWO_BY_TWO) { 35401 transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6)); 35402 pos += 8; 35403 } 35404 let instructions = null; 35405 if (flags & WE_HAVE_INSTRUCTIONS) { 35406 const instructionLength = glyf.getUint16(pos); 35407 pos += 2; 35408 instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); 35409 pos += instructionLength; 35410 } 35411 return [pos - spos, new CompositeGlyph({ 35412 flags, 35413 glyphIndex, 35414 argument1, 35415 argument2, 35416 transf, 35417 instructions 35418 })]; 35419 } 35420 getSize() { 35421 let size = 2 + 2 + this.transf.length * 2; 35422 if (this.flags & WE_HAVE_INSTRUCTIONS) { 35423 size += 2 + this.instructions.length; 35424 } 35425 size += 2; 35426 if (this.flags & 2) { 35427 if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { 35428 size += 2; 35429 } 35430 } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { 35431 size += 2; 35432 } 35433 return size; 35434 } 35435 write(pos, buf) { 35436 const spos = pos; 35437 if (this.flags & ARGS_ARE_XY_VALUES) { 35438 if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { 35439 this.flags |= ARG_1_AND_2_ARE_WORDS; 35440 } 35441 } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { 35442 this.flags |= ARG_1_AND_2_ARE_WORDS; 35443 } 35444 buf.setUint16(pos, this.flags); 35445 buf.setUint16(pos + 2, this.glyphIndex); 35446 pos += 4; 35447 if (this.flags & ARG_1_AND_2_ARE_WORDS) { 35448 if (this.flags & ARGS_ARE_XY_VALUES) { 35449 buf.setInt16(pos, this.argument1); 35450 buf.setInt16(pos + 2, this.argument2); 35451 } else { 35452 buf.setUint16(pos, this.argument1); 35453 buf.setUint16(pos + 2, this.argument2); 35454 } 35455 pos += 4; 35456 } else { 35457 buf.setUint8(pos, this.argument1); 35458 buf.setUint8(pos + 1, this.argument2); 35459 pos += 2; 35460 } 35461 if (this.flags & WE_HAVE_INSTRUCTIONS) { 35462 buf.setUint16(pos, this.instructions.length); 35463 pos += 2; 35464 if (this.instructions.length) { 35465 new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); 35466 pos += this.instructions.length; 35467 } 35468 } 35469 return pos - spos; 35470 } 35471 scale(x, factor) {} 35472} 35473 35474/***/ }), 35475/* 47 */ 35476/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 35477 35478 35479 35480Object.defineProperty(exports, "__esModule", ({ 35481 value: true 35482})); 35483exports.OpenTypeFileBuilder = void 0; 35484var _core_utils = __w_pdfjs_require__(3); 35485var _util = __w_pdfjs_require__(2); 35486function writeInt16(dest, offset, num) { 35487 dest[offset] = num >> 8 & 0xff; 35488 dest[offset + 1] = num & 0xff; 35489} 35490function writeInt32(dest, offset, num) { 35491 dest[offset] = num >> 24 & 0xff; 35492 dest[offset + 1] = num >> 16 & 0xff; 35493 dest[offset + 2] = num >> 8 & 0xff; 35494 dest[offset + 3] = num & 0xff; 35495} 35496function writeData(dest, offset, data) { 35497 if (data instanceof Uint8Array) { 35498 dest.set(data, offset); 35499 } else if (typeof data === "string") { 35500 for (let i = 0, ii = data.length; i < ii; i++) { 35501 dest[offset++] = data.charCodeAt(i) & 0xff; 35502 } 35503 } else { 35504 for (const num of data) { 35505 dest[offset++] = num & 0xff; 35506 } 35507 } 35508} 35509const OTF_HEADER_SIZE = 12; 35510const OTF_TABLE_ENTRY_SIZE = 16; 35511class OpenTypeFileBuilder { 35512 constructor(sfnt) { 35513 this.sfnt = sfnt; 35514 this.tables = Object.create(null); 35515 } 35516 static getSearchParams(entriesCount, entrySize) { 35517 let maxPower2 = 1, 35518 log2 = 0; 35519 while ((maxPower2 ^ entriesCount) > maxPower2) { 35520 maxPower2 <<= 1; 35521 log2++; 35522 } 35523 const searchRange = maxPower2 * entrySize; 35524 return { 35525 range: searchRange, 35526 entry: log2, 35527 rangeShift: entrySize * entriesCount - searchRange 35528 }; 35529 } 35530 toArray() { 35531 let sfnt = this.sfnt; 35532 const tables = this.tables; 35533 const tablesNames = Object.keys(tables); 35534 tablesNames.sort(); 35535 const numTables = tablesNames.length; 35536 let i, j, jj, table, tableName; 35537 let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE; 35538 const tableOffsets = [offset]; 35539 for (i = 0; i < numTables; i++) { 35540 table = tables[tablesNames[i]]; 35541 const paddedLength = (table.length + 3 & ~3) >>> 0; 35542 offset += paddedLength; 35543 tableOffsets.push(offset); 35544 } 35545 const file = new Uint8Array(offset); 35546 for (i = 0; i < numTables; i++) { 35547 table = tables[tablesNames[i]]; 35548 writeData(file, tableOffsets[i], table); 35549 } 35550 if (sfnt === "true") { 35551 sfnt = (0, _util.string32)(0x00010000); 35552 } 35553 file[0] = sfnt.charCodeAt(0) & 0xff; 35554 file[1] = sfnt.charCodeAt(1) & 0xff; 35555 file[2] = sfnt.charCodeAt(2) & 0xff; 35556 file[3] = sfnt.charCodeAt(3) & 0xff; 35557 writeInt16(file, 4, numTables); 35558 const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16); 35559 writeInt16(file, 6, searchParams.range); 35560 writeInt16(file, 8, searchParams.entry); 35561 writeInt16(file, 10, searchParams.rangeShift); 35562 offset = OTF_HEADER_SIZE; 35563 for (i = 0; i < numTables; i++) { 35564 tableName = tablesNames[i]; 35565 file[offset] = tableName.charCodeAt(0) & 0xff; 35566 file[offset + 1] = tableName.charCodeAt(1) & 0xff; 35567 file[offset + 2] = tableName.charCodeAt(2) & 0xff; 35568 file[offset + 3] = tableName.charCodeAt(3) & 0xff; 35569 let checksum = 0; 35570 for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) { 35571 const quad = (0, _core_utils.readUint32)(file, j); 35572 checksum = checksum + quad >>> 0; 35573 } 35574 writeInt32(file, offset + 4, checksum); 35575 writeInt32(file, offset + 8, tableOffsets[i]); 35576 writeInt32(file, offset + 12, tables[tableName].length); 35577 offset += OTF_TABLE_ENTRY_SIZE; 35578 } 35579 return file; 35580 } 35581 addTable(tag, data) { 35582 if (tag in this.tables) { 35583 throw new Error("Table " + tag + " already exists"); 35584 } 35585 this.tables[tag] = data; 35586 } 35587} 35588exports.OpenTypeFileBuilder = OpenTypeFileBuilder; 35589 35590/***/ }), 35591/* 48 */ 35592/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 35593 35594 35595 35596Object.defineProperty(exports, "__esModule", ({ 35597 value: true 35598})); 35599exports.Type1Font = void 0; 35600var _cff_parser = __w_pdfjs_require__(35); 35601var _util = __w_pdfjs_require__(2); 35602var _fonts_utils = __w_pdfjs_require__(38); 35603var _core_utils = __w_pdfjs_require__(3); 35604var _stream = __w_pdfjs_require__(8); 35605var _type1_parser = __w_pdfjs_require__(49); 35606function findBlock(streamBytes, signature, startIndex) { 35607 const streamBytesLength = streamBytes.length; 35608 const signatureLength = signature.length; 35609 const scanLength = streamBytesLength - signatureLength; 35610 let i = startIndex, 35611 found = false; 35612 while (i < scanLength) { 35613 let j = 0; 35614 while (j < signatureLength && streamBytes[i + j] === signature[j]) { 35615 j++; 35616 } 35617 if (j >= signatureLength) { 35618 i += j; 35619 while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) { 35620 i++; 35621 } 35622 found = true; 35623 break; 35624 } 35625 i++; 35626 } 35627 return { 35628 found, 35629 length: i 35630 }; 35631} 35632function getHeaderBlock(stream, suggestedLength) { 35633 const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63]; 35634 const streamStartPos = stream.pos; 35635 let headerBytes, headerBytesLength, block; 35636 try { 35637 headerBytes = stream.getBytes(suggestedLength); 35638 headerBytesLength = headerBytes.length; 35639 } catch {} 35640 if (headerBytesLength === suggestedLength) { 35641 block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length); 35642 if (block.found && block.length === suggestedLength) { 35643 return { 35644 stream: new _stream.Stream(headerBytes), 35645 length: suggestedLength 35646 }; 35647 } 35648 } 35649 (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.'); 35650 stream.pos = streamStartPos; 35651 const SCAN_BLOCK_LENGTH = 2048; 35652 let actualLength; 35653 while (true) { 35654 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 35655 block = findBlock(scanBytes, EEXEC_SIGNATURE, 0); 35656 if (block.length === 0) { 35657 break; 35658 } 35659 stream.pos += block.length; 35660 if (block.found) { 35661 actualLength = stream.pos - streamStartPos; 35662 break; 35663 } 35664 } 35665 stream.pos = streamStartPos; 35666 if (actualLength) { 35667 return { 35668 stream: new _stream.Stream(stream.getBytes(actualLength)), 35669 length: actualLength 35670 }; 35671 } 35672 (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.'); 35673 return { 35674 stream: new _stream.Stream(stream.getBytes(suggestedLength)), 35675 length: suggestedLength 35676 }; 35677} 35678function getEexecBlock(stream, suggestedLength) { 35679 const eexecBytes = stream.getBytes(); 35680 if (eexecBytes.length === 0) { 35681 throw new _util.FormatError("getEexecBlock - no font program found."); 35682 } 35683 return { 35684 stream: new _stream.Stream(eexecBytes), 35685 length: eexecBytes.length 35686 }; 35687} 35688class Type1Font { 35689 constructor(name, file, properties) { 35690 const PFB_HEADER_SIZE = 6; 35691 let headerBlockLength = properties.length1; 35692 let eexecBlockLength = properties.length2; 35693 let pfbHeader = file.peekBytes(PFB_HEADER_SIZE); 35694 const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; 35695 if (pfbHeaderPresent) { 35696 file.skip(PFB_HEADER_SIZE); 35697 headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 35698 } 35699 const headerBlock = getHeaderBlock(file, headerBlockLength); 35700 const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED); 35701 headerBlockParser.extractFontHeader(properties); 35702 if (pfbHeaderPresent) { 35703 pfbHeader = file.getBytes(PFB_HEADER_SIZE); 35704 eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 35705 } 35706 const eexecBlock = getEexecBlock(file, eexecBlockLength); 35707 const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED); 35708 const data = eexecBlockParser.extractFontProgram(properties); 35709 for (const key in data.properties) { 35710 properties[key] = data.properties[key]; 35711 } 35712 const charstrings = data.charstrings; 35713 const type2Charstrings = this.getType2Charstrings(charstrings); 35714 const subrs = this.getType2Subrs(data.subrs); 35715 this.charstrings = charstrings; 35716 this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties); 35717 this.seacs = this.getSeacs(data.charstrings); 35718 } 35719 get numGlyphs() { 35720 return this.charstrings.length + 1; 35721 } 35722 getCharset() { 35723 const charset = [".notdef"]; 35724 for (const { 35725 glyphName 35726 } of this.charstrings) { 35727 charset.push(glyphName); 35728 } 35729 return charset; 35730 } 35731 getGlyphMapping(properties) { 35732 const charstrings = this.charstrings; 35733 if (properties.composite) { 35734 const charCodeToGlyphId = Object.create(null); 35735 for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) { 35736 const charCode = properties.cMap.charCodeOf(glyphId); 35737 charCodeToGlyphId[charCode] = glyphId + 1; 35738 } 35739 return charCodeToGlyphId; 35740 } 35741 const glyphNames = [".notdef"]; 35742 let builtInEncoding, glyphId; 35743 for (glyphId = 0; glyphId < charstrings.length; glyphId++) { 35744 glyphNames.push(charstrings[glyphId].glyphName); 35745 } 35746 const encoding = properties.builtInEncoding; 35747 if (encoding) { 35748 builtInEncoding = Object.create(null); 35749 for (const charCode in encoding) { 35750 glyphId = glyphNames.indexOf(encoding[charCode]); 35751 if (glyphId >= 0) { 35752 builtInEncoding[charCode] = glyphId; 35753 } 35754 } 35755 } 35756 return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames); 35757 } 35758 hasGlyphId(id) { 35759 if (id < 0 || id >= this.numGlyphs) { 35760 return false; 35761 } 35762 if (id === 0) { 35763 return true; 35764 } 35765 const glyph = this.charstrings[id - 1]; 35766 return glyph.charstring.length > 0; 35767 } 35768 getSeacs(charstrings) { 35769 const seacMap = []; 35770 for (let i = 0, ii = charstrings.length; i < ii; i++) { 35771 const charstring = charstrings[i]; 35772 if (charstring.seac) { 35773 seacMap[i + 1] = charstring.seac; 35774 } 35775 } 35776 return seacMap; 35777 } 35778 getType2Charstrings(type1Charstrings) { 35779 const type2Charstrings = []; 35780 for (const type1Charstring of type1Charstrings) { 35781 type2Charstrings.push(type1Charstring.charstring); 35782 } 35783 return type2Charstrings; 35784 } 35785 getType2Subrs(type1Subrs) { 35786 let bias = 0; 35787 const count = type1Subrs.length; 35788 if (count < 1133) { 35789 bias = 107; 35790 } else if (count < 33769) { 35791 bias = 1131; 35792 } else { 35793 bias = 32768; 35794 } 35795 const type2Subrs = []; 35796 let i; 35797 for (i = 0; i < bias; i++) { 35798 type2Subrs.push([0x0b]); 35799 } 35800 for (i = 0; i < count; i++) { 35801 type2Subrs.push(type1Subrs[i]); 35802 } 35803 return type2Subrs; 35804 } 35805 wrap(name, glyphs, charstrings, subrs, properties) { 35806 const cff = new _cff_parser.CFF(); 35807 cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4); 35808 cff.names = [name]; 35809 const topDict = new _cff_parser.CFFTopDict(); 35810 topDict.setByName("version", 391); 35811 topDict.setByName("Notice", 392); 35812 topDict.setByName("FullName", 393); 35813 topDict.setByName("FamilyName", 394); 35814 topDict.setByName("Weight", 395); 35815 topDict.setByName("Encoding", null); 35816 topDict.setByName("FontMatrix", properties.fontMatrix); 35817 topDict.setByName("FontBBox", properties.bbox); 35818 topDict.setByName("charset", null); 35819 topDict.setByName("CharStrings", null); 35820 topDict.setByName("Private", null); 35821 cff.topDict = topDict; 35822 const strings = new _cff_parser.CFFStrings(); 35823 strings.add("Version 0.11"); 35824 strings.add("See original notice"); 35825 strings.add(name); 35826 strings.add(name); 35827 strings.add("Medium"); 35828 cff.strings = strings; 35829 cff.globalSubrIndex = new _cff_parser.CFFIndex(); 35830 const count = glyphs.length; 35831 const charsetArray = [".notdef"]; 35832 let i, ii; 35833 for (i = 0; i < count; i++) { 35834 const glyphName = charstrings[i].glyphName; 35835 const index = _cff_parser.CFFStandardStrings.indexOf(glyphName); 35836 if (index === -1) { 35837 strings.add(glyphName); 35838 } 35839 charsetArray.push(glyphName); 35840 } 35841 cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray); 35842 const charStringsIndex = new _cff_parser.CFFIndex(); 35843 charStringsIndex.add([0x8b, 0x0e]); 35844 for (i = 0; i < count; i++) { 35845 charStringsIndex.add(glyphs[i]); 35846 } 35847 cff.charStrings = charStringsIndex; 35848 const privateDict = new _cff_parser.CFFPrivateDict(); 35849 privateDict.setByName("Subrs", null); 35850 const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"]; 35851 for (i = 0, ii = fields.length; i < ii; i++) { 35852 const field = fields[i]; 35853 if (!(field in properties.privateData)) { 35854 continue; 35855 } 35856 const value = properties.privateData[field]; 35857 if (Array.isArray(value)) { 35858 for (let j = value.length - 1; j > 0; j--) { 35859 value[j] -= value[j - 1]; 35860 } 35861 } 35862 privateDict.setByName(field, value); 35863 } 35864 cff.topDict.privateDict = privateDict; 35865 const subrIndex = new _cff_parser.CFFIndex(); 35866 for (i = 0, ii = subrs.length; i < ii; i++) { 35867 subrIndex.add(subrs[i]); 35868 } 35869 privateDict.subrsIndex = subrIndex; 35870 const compiler = new _cff_parser.CFFCompiler(cff); 35871 return compiler.compile(); 35872 } 35873} 35874exports.Type1Font = Type1Font; 35875 35876/***/ }), 35877/* 49 */ 35878/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 35879 35880 35881 35882Object.defineProperty(exports, "__esModule", ({ 35883 value: true 35884})); 35885exports.Type1Parser = void 0; 35886var _encodings = __w_pdfjs_require__(37); 35887var _core_utils = __w_pdfjs_require__(3); 35888var _stream = __w_pdfjs_require__(8); 35889var _util = __w_pdfjs_require__(2); 35890const HINTING_ENABLED = false; 35891const COMMAND_MAP = { 35892 hstem: [1], 35893 vstem: [3], 35894 vmoveto: [4], 35895 rlineto: [5], 35896 hlineto: [6], 35897 vlineto: [7], 35898 rrcurveto: [8], 35899 callsubr: [10], 35900 flex: [12, 35], 35901 drop: [12, 18], 35902 endchar: [14], 35903 rmoveto: [21], 35904 hmoveto: [22], 35905 vhcurveto: [30], 35906 hvcurveto: [31] 35907}; 35908class Type1CharString { 35909 constructor() { 35910 this.width = 0; 35911 this.lsb = 0; 35912 this.flexing = false; 35913 this.output = []; 35914 this.stack = []; 35915 } 35916 convert(encoded, subrs, seacAnalysisEnabled) { 35917 const count = encoded.length; 35918 let error = false; 35919 let wx, sbx, subrNumber; 35920 for (let i = 0; i < count; i++) { 35921 let value = encoded[i]; 35922 if (value < 32) { 35923 if (value === 12) { 35924 value = (value << 8) + encoded[++i]; 35925 } 35926 switch (value) { 35927 case 1: 35928 if (!HINTING_ENABLED) { 35929 this.stack = []; 35930 break; 35931 } 35932 error = this.executeCommand(2, COMMAND_MAP.hstem); 35933 break; 35934 case 3: 35935 if (!HINTING_ENABLED) { 35936 this.stack = []; 35937 break; 35938 } 35939 error = this.executeCommand(2, COMMAND_MAP.vstem); 35940 break; 35941 case 4: 35942 if (this.flexing) { 35943 if (this.stack.length < 1) { 35944 error = true; 35945 break; 35946 } 35947 const dy = this.stack.pop(); 35948 this.stack.push(0, dy); 35949 break; 35950 } 35951 error = this.executeCommand(1, COMMAND_MAP.vmoveto); 35952 break; 35953 case 5: 35954 error = this.executeCommand(2, COMMAND_MAP.rlineto); 35955 break; 35956 case 6: 35957 error = this.executeCommand(1, COMMAND_MAP.hlineto); 35958 break; 35959 case 7: 35960 error = this.executeCommand(1, COMMAND_MAP.vlineto); 35961 break; 35962 case 8: 35963 error = this.executeCommand(6, COMMAND_MAP.rrcurveto); 35964 break; 35965 case 9: 35966 this.stack = []; 35967 break; 35968 case 10: 35969 if (this.stack.length < 1) { 35970 error = true; 35971 break; 35972 } 35973 subrNumber = this.stack.pop(); 35974 if (!subrs[subrNumber]) { 35975 error = true; 35976 break; 35977 } 35978 error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled); 35979 break; 35980 case 11: 35981 return error; 35982 case 13: 35983 if (this.stack.length < 2) { 35984 error = true; 35985 break; 35986 } 35987 wx = this.stack.pop(); 35988 sbx = this.stack.pop(); 35989 this.lsb = sbx; 35990 this.width = wx; 35991 this.stack.push(wx, sbx); 35992 error = this.executeCommand(2, COMMAND_MAP.hmoveto); 35993 break; 35994 case 14: 35995 this.output.push(COMMAND_MAP.endchar[0]); 35996 break; 35997 case 21: 35998 if (this.flexing) { 35999 break; 36000 } 36001 error = this.executeCommand(2, COMMAND_MAP.rmoveto); 36002 break; 36003 case 22: 36004 if (this.flexing) { 36005 this.stack.push(0); 36006 break; 36007 } 36008 error = this.executeCommand(1, COMMAND_MAP.hmoveto); 36009 break; 36010 case 30: 36011 error = this.executeCommand(4, COMMAND_MAP.vhcurveto); 36012 break; 36013 case 31: 36014 error = this.executeCommand(4, COMMAND_MAP.hvcurveto); 36015 break; 36016 case (12 << 8) + 0: 36017 this.stack = []; 36018 break; 36019 case (12 << 8) + 1: 36020 if (!HINTING_ENABLED) { 36021 this.stack = []; 36022 break; 36023 } 36024 error = this.executeCommand(2, COMMAND_MAP.vstem); 36025 break; 36026 case (12 << 8) + 2: 36027 if (!HINTING_ENABLED) { 36028 this.stack = []; 36029 break; 36030 } 36031 error = this.executeCommand(2, COMMAND_MAP.hstem); 36032 break; 36033 case (12 << 8) + 6: 36034 if (seacAnalysisEnabled) { 36035 const asb = this.stack.at(-5); 36036 this.seac = this.stack.splice(-4, 4); 36037 this.seac[0] += this.lsb - asb; 36038 error = this.executeCommand(0, COMMAND_MAP.endchar); 36039 } else { 36040 error = this.executeCommand(4, COMMAND_MAP.endchar); 36041 } 36042 break; 36043 case (12 << 8) + 7: 36044 if (this.stack.length < 4) { 36045 error = true; 36046 break; 36047 } 36048 this.stack.pop(); 36049 wx = this.stack.pop(); 36050 const sby = this.stack.pop(); 36051 sbx = this.stack.pop(); 36052 this.lsb = sbx; 36053 this.width = wx; 36054 this.stack.push(wx, sbx, sby); 36055 error = this.executeCommand(3, COMMAND_MAP.rmoveto); 36056 break; 36057 case (12 << 8) + 12: 36058 if (this.stack.length < 2) { 36059 error = true; 36060 break; 36061 } 36062 const num2 = this.stack.pop(); 36063 const num1 = this.stack.pop(); 36064 this.stack.push(num1 / num2); 36065 break; 36066 case (12 << 8) + 16: 36067 if (this.stack.length < 2) { 36068 error = true; 36069 break; 36070 } 36071 subrNumber = this.stack.pop(); 36072 const numArgs = this.stack.pop(); 36073 if (subrNumber === 0 && numArgs === 3) { 36074 const flexArgs = this.stack.splice(-17, 17); 36075 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]); 36076 error = this.executeCommand(13, COMMAND_MAP.flex, true); 36077 this.flexing = false;
vendor: 4,617 bytes, lines 36078-36230
36078 this.stack.push(flexArgs[15], flexArgs[16]); 36079 } else if (subrNumber === 1 && numArgs === 0) { 36080 this.flexing = true; 36081 } 36082 break; 36083 case (12 << 8) + 17: 36084 break; 36085 case (12 << 8) + 33: 36086 this.stack = []; 36087 break; 36088 default: 36089 (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"'); 36090 break; 36091 } 36092 if (error) { 36093 break; 36094 } 36095 continue; 36096 } else if (value <= 246) { 36097 value -= 139; 36098 } else if (value <= 250) { 36099 value = (value - 247) * 256 + encoded[++i] + 108; 36100 } else if (value <= 254) { 36101 value = -((value - 251) * 256) - encoded[++i] - 108; 36102 } else { 36103 value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0; 36104 } 36105 this.stack.push(value); 36106 } 36107 return error; 36108 } 36109 executeCommand(howManyArgs, command, keepStack) { 36110 const stackLength = this.stack.length; 36111 if (howManyArgs > stackLength) { 36112 return true; 36113 } 36114 const start = stackLength - howManyArgs; 36115 for (let i = start; i < stackLength; i++) { 36116 let value = this.stack[i]; 36117 if (Number.isInteger(value)) { 36118 this.output.push(28, value >> 8 & 0xff, value & 0xff); 36119 } else { 36120 value = 65536 * value | 0; 36121 this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 36122 } 36123 } 36124 this.output.push(...command); 36125 if (keepStack) { 36126 this.stack.splice(start, howManyArgs); 36127 } else { 36128 this.stack.length = 0; 36129 } 36130 return false; 36131 } 36132} 36133const EEXEC_ENCRYPT_KEY = 55665; 36134const CHAR_STRS_ENCRYPT_KEY = 4330; 36135function isHexDigit(code) { 36136 return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102; 36137} 36138function decrypt(data, key, discardNumber) { 36139 if (discardNumber >= data.length) { 36140 return new Uint8Array(0); 36141 } 36142 const c1 = 52845, 36143 c2 = 22719; 36144 let r = key | 0, 36145 i, 36146 j; 36147 for (i = 0; i < discardNumber; i++) { 36148 r = (data[i] + r) * c1 + c2 & (1 << 16) - 1; 36149 } 36150 const count = data.length - discardNumber; 36151 const decrypted = new Uint8Array(count); 36152 for (i = discardNumber, j = 0; j < count; i++, j++) { 36153 const value = data[i]; 36154 decrypted[j] = value ^ r >> 8; 36155 r = (value + r) * c1 + c2 & (1 << 16) - 1; 36156 } 36157 return decrypted; 36158} 36159function decryptAscii(data, key, discardNumber) { 36160 const c1 = 52845, 36161 c2 = 22719; 36162 let r = key | 0; 36163 const count = data.length, 36164 maybeLength = count >>> 1; 36165 const decrypted = new Uint8Array(maybeLength); 36166 let i, j; 36167 for (i = 0, j = 0; i < count; i++) { 36168 const digit1 = data[i]; 36169 if (!isHexDigit(digit1)) { 36170 continue; 36171 } 36172 i++; 36173 let digit2; 36174 while (i < count && !isHexDigit(digit2 = data[i])) { 36175 i++; 36176 } 36177 if (i < count) { 36178 const value = parseInt(String.fromCharCode(digit1, digit2), 16); 36179 decrypted[j++] = value ^ r >> 8; 36180 r = (value + r) * c1 + c2 & (1 << 16) - 1; 36181 } 36182 } 36183 return decrypted.slice(discardNumber, j); 36184} 36185function isSpecial(c) { 36186 return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29; 36187} 36188class Type1Parser { 36189 constructor(stream, encrypted, seacAnalysisEnabled) { 36190 if (encrypted) { 36191 const data = stream.getBytes(); 36192 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])); 36193 stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); 36194 } 36195 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 36196 this.stream = stream; 36197 this.nextChar(); 36198 } 36199 readNumberArray() { 36200 this.getToken(); 36201 const array = []; 36202 while (true) { 36203 const token = this.getToken(); 36204 if (token === null || token === "]" || token === "}") { 36205 break; 36206 } 36207 array.push(parseFloat(token || 0)); 36208 } 36209 return array; 36210 } 36211 readNumber() { 36212 const token = this.getToken(); 36213 return parseFloat(token || 0); 36214 } 36215 readInt() { 36216 const token = this.getToken(); 36217 return parseInt(token || 0, 10) | 0; 36218 } 36219 readBoolean() { 36220 const token = this.getToken(); 36221 return token === "true" ? 1 : 0; 36222 } 36223 nextChar() { 36224 return this.currentChar = this.stream.getByte(); 36225 } 36226 prevChar() { 36227 this.stream.skip(-2); 36228 return this.currentChar = this.stream.getByte(); 36229 } 36230 getToken() {
vendor: 9,428 bytes, lines 36231-36539
36231 let comment = false; 36232 let ch = this.currentChar; 36233 while (true) { 36234 if (ch === -1) { 36235 return null; 36236 } 36237 if (comment) { 36238 if (ch === 0x0a || ch === 0x0d) { 36239 comment = false; 36240 } 36241 } else if (ch === 0x25) { 36242 comment = true; 36243 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 36244 break; 36245 } 36246 ch = this.nextChar(); 36247 } 36248 if (isSpecial(ch)) { 36249 this.nextChar(); 36250 return String.fromCharCode(ch); 36251 } 36252 let token = ""; 36253 do { 36254 token += String.fromCharCode(ch); 36255 ch = this.nextChar(); 36256 } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch)); 36257 return token; 36258 } 36259 readCharStrings(bytes, lenIV) { 36260 if (lenIV === -1) { 36261 return bytes; 36262 } 36263 return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV); 36264 } 36265 extractFontProgram(properties) { 36266 const stream = this.stream; 36267 const subrs = [], 36268 charstrings = []; 36269 const privateData = Object.create(null); 36270 privateData.lenIV = 4; 36271 const program = { 36272 subrs: [], 36273 charstrings: [], 36274 properties: { 36275 privateData 36276 } 36277 }; 36278 let token, length, data, lenIV; 36279 while ((token = this.getToken()) !== null) { 36280 if (token !== "/") { 36281 continue; 36282 } 36283 token = this.getToken(); 36284 switch (token) { 36285 case "CharStrings": 36286 this.getToken(); 36287 this.getToken(); 36288 this.getToken(); 36289 this.getToken(); 36290 while (true) { 36291 token = this.getToken(); 36292 if (token === null || token === "end") { 36293 break; 36294 } 36295 if (token !== "/") { 36296 continue; 36297 } 36298 const glyph = this.getToken(); 36299 length = this.readInt(); 36300 this.getToken(); 36301 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 36302 lenIV = program.properties.privateData.lenIV; 36303 const encoded = this.readCharStrings(data, lenIV); 36304 this.nextChar(); 36305 token = this.getToken(); 36306 if (token === "noaccess") { 36307 this.getToken(); 36308 } else if (token === "/") { 36309 this.prevChar(); 36310 } 36311 charstrings.push({ 36312 glyph, 36313 encoded 36314 }); 36315 } 36316 break; 36317 case "Subrs": 36318 this.readInt(); 36319 this.getToken(); 36320 while (this.getToken() === "dup") { 36321 const index = this.readInt(); 36322 length = this.readInt(); 36323 this.getToken(); 36324 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 36325 lenIV = program.properties.privateData.lenIV; 36326 const encoded = this.readCharStrings(data, lenIV); 36327 this.nextChar(); 36328 token = this.getToken(); 36329 if (token === "noaccess") { 36330 this.getToken(); 36331 } 36332 subrs[index] = encoded; 36333 } 36334 break; 36335 case "BlueValues": 36336 case "OtherBlues": 36337 case "FamilyBlues": 36338 case "FamilyOtherBlues": 36339 const blueArray = this.readNumberArray(); 36340 if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) { 36341 program.properties.privateData[token] = blueArray; 36342 } 36343 break; 36344 case "StemSnapH": 36345 case "StemSnapV": 36346 program.properties.privateData[token] = this.readNumberArray(); 36347 break; 36348 case "StdHW": 36349 case "StdVW": 36350 program.properties.privateData[token] = this.readNumberArray()[0]; 36351 break; 36352 case "BlueShift": 36353 case "lenIV": 36354 case "BlueFuzz": 36355 case "BlueScale": 36356 case "LanguageGroup": 36357 program.properties.privateData[token] = this.readNumber(); 36358 break; 36359 case "ExpansionFactor": 36360 program.properties.privateData[token] = this.readNumber() || 0.06; 36361 break; 36362 case "ForceBold": 36363 program.properties.privateData[token] = this.readBoolean(); 36364 break; 36365 } 36366 } 36367 for (const { 36368 encoded, 36369 glyph 36370 } of charstrings) { 36371 const charString = new Type1CharString(); 36372 const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled); 36373 let output = charString.output; 36374 if (error) { 36375 output = [14]; 36376 } 36377 const charStringObject = { 36378 glyphName: glyph, 36379 charstring: output, 36380 width: charString.width, 36381 lsb: charString.lsb, 36382 seac: charString.seac 36383 }; 36384 if (glyph === ".notdef") { 36385 program.charstrings.unshift(charStringObject); 36386 } else { 36387 program.charstrings.push(charStringObject); 36388 } 36389 if (properties.builtInEncoding) { 36390 const index = properties.builtInEncoding.indexOf(glyph); 36391 if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) { 36392 properties.widths[index] = charString.width; 36393 } 36394 } 36395 } 36396 return program; 36397 } 36398 extractFontHeader(properties) { 36399 let token; 36400 while ((token = this.getToken()) !== null) { 36401 if (token !== "/") { 36402 continue; 36403 } 36404 token = this.getToken(); 36405 switch (token) { 36406 case "FontMatrix": 36407 const matrix = this.readNumberArray(); 36408 properties.fontMatrix = matrix; 36409 break; 36410 case "Encoding": 36411 const encodingArg = this.getToken(); 36412 let encoding; 36413 if (!/^\d+$/.test(encodingArg)) { 36414 encoding = (0, _encodings.getEncoding)(encodingArg); 36415 } else { 36416 encoding = []; 36417 const size = parseInt(encodingArg, 10) | 0; 36418 this.getToken(); 36419 for (let j = 0; j < size; j++) { 36420 token = this.getToken(); 36421 while (token !== "dup" && token !== "def") { 36422 token = this.getToken(); 36423 if (token === null) { 36424 return; 36425 } 36426 } 36427 if (token === "def") { 36428 break; 36429 } 36430 const index = this.readInt(); 36431 this.getToken(); 36432 const glyph = this.getToken(); 36433 encoding[index] = glyph; 36434 this.getToken(); 36435 } 36436 } 36437 properties.builtInEncoding = encoding; 36438 break; 36439 case "FontBBox": 36440 const fontBBox = this.readNumberArray(); 36441 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 36442 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 36443 properties.ascentScaled = true; 36444 break; 36445 } 36446 } 36447 } 36448} 36449exports.Type1Parser = Type1Parser; 36450 36451/***/ }), 36452/* 50 */ 36453/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 36454 36455 36456 36457Object.defineProperty(exports, "__esModule", ({ 36458 value: true 36459})); 36460exports.Pattern = void 0; 36461exports.clearPatternCaches = clearPatternCaches; 36462exports.getTilingPatternIR = getTilingPatternIR; 36463var _util = __w_pdfjs_require__(2); 36464var _base_stream = __w_pdfjs_require__(5); 36465var _colorspace = __w_pdfjs_require__(12); 36466var _core_utils = __w_pdfjs_require__(3); 36467const ShadingType = { 36468 FUNCTION_BASED: 1, 36469 AXIAL: 2, 36470 RADIAL: 3, 36471 FREE_FORM_MESH: 4, 36472 LATTICE_FORM_MESH: 5, 36473 COONS_PATCH_MESH: 6, 36474 TENSOR_PATCH_MESH: 7 36475}; 36476class Pattern { 36477 constructor() { 36478 (0, _util.unreachable)("Cannot initialize Pattern."); 36479 } 36480 static parseShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache) { 36481 const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading; 36482 const type = dict.get("ShadingType"); 36483 try { 36484 switch (type) { 36485 case ShadingType.AXIAL: 36486 case ShadingType.RADIAL: 36487 return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache); 36488 case ShadingType.FREE_FORM_MESH: 36489 case ShadingType.LATTICE_FORM_MESH: 36490 case ShadingType.COONS_PATCH_MESH: 36491 case ShadingType.TENSOR_PATCH_MESH: 36492 return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache); 36493 default: 36494 throw new _util.FormatError("Unsupported ShadingType: " + type); 36495 } 36496 } catch (ex) { 36497 if (ex instanceof _core_utils.MissingDataException) { 36498 throw ex; 36499 } 36500 (0, _util.warn)(ex); 36501 return new DummyShading(); 36502 } 36503 } 36504} 36505exports.Pattern = Pattern; 36506class BaseShading { 36507 static SMALL_NUMBER = 1e-6; 36508 constructor() { 36509 if (this.constructor === BaseShading) { 36510 (0, _util.unreachable)("Cannot initialize BaseShading."); 36511 } 36512 } 36513 getIR() { 36514 (0, _util.unreachable)("Abstract method `getIR` called."); 36515 } 36516} 36517class RadialAxialShading extends BaseShading { 36518 constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) { 36519 super(); 36520 this.coordsArr = dict.getArray("Coords"); 36521 this.shadingType = dict.get("ShadingType"); 36522 const cs = _colorspace.ColorSpace.parse({ 36523 cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), 36524 xref, 36525 resources, 36526 pdfFunctionFactory, 36527 localColorSpaceCache 36528 }); 36529 const bbox = dict.getArray("BBox"); 36530 this.bbox = Array.isArray(bbox) && bbox.length === 4 ? _util.Util.normalizeRect(bbox) : null; 36531 let t0 = 0.0, 36532 t1 = 1.0; 36533 if (dict.has("Domain")) { 36534 const domainArr = dict.getArray("Domain"); 36535 t0 = domainArr[0]; 36536 t1 = domainArr[1]; 36537 } 36538 let extendStart = false, 36539 extendEnd = false;
36540 if (dict.has("Extend")) { 36541 const extendArr = dict.getArray("Extend"); 36542 extendStart = extendArr[0]; 36543 extendEnd = extendArr[1]; 36544 } 36545 if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) { 36546 const [x1, y1, r1, x2, y2, r2] = this.coordsArr; 36547 const distance = Math.hypot(x1 - x2, y1 - y2); 36548 if (r1 <= r2 + distance && r2 <= r1 + distance) { 36549 (0, _util.warn)("Unsupported radial gradient."); 36550 } 36551 } 36552 this.extendStart = extendStart; 36553 this.extendEnd = extendEnd; 36554 const fnObj = dict.getRaw("Function"); 36555 const fn = pdfFunctionFactory.createFromArray(fnObj); 36556 const NUMBER_OF_SAMPLES = 840; 36557 const step = (t1 - t0) / NUMBER_OF_SAMPLES; 36558 const colorStops = this.colorStops = []; 36559 if (t0 >= t1 || step <= 0) { 36560 (0, _util.info)("Bad shading domain."); 36561 return; 36562 } 36563 const color = new Float32Array(cs.numComps), 36564 ratio = new Float32Array(1); 36565 let rgbColor; 36566 let iBase = 0; 36567 ratio[0] = t0; 36568 fn(ratio, 0, color, 0); 36569 let rgbBase = cs.getRgb(color, 0); 36570 const cssColorBase = _util.Util.makeHexColor(rgbBase[0], rgbBase[1], rgbBase[2]); 36571 colorStops.push([0, cssColorBase]); 36572 let iPrev = 1; 36573 ratio[0] = t0 + step; 36574 fn(ratio, 0, color, 0); 36575 let rgbPrev = cs.getRgb(color, 0); 36576 let maxSlopeR = rgbPrev[0] - rgbBase[0] + 1; 36577 let maxSlopeG = rgbPrev[1] - rgbBase[1] + 1; 36578 let maxSlopeB = rgbPrev[2] - rgbBase[2] + 1; 36579 let minSlopeR = rgbPrev[0] - rgbBase[0] - 1; 36580 let minSlopeG = rgbPrev[1] - rgbBase[1] - 1; 36581 let minSlopeB = rgbPrev[2] - rgbBase[2] - 1; 36582 for (let i = 2; i < NUMBER_OF_SAMPLES; i++) { 36583 ratio[0] = t0 + i * step; 36584 fn(ratio, 0, color, 0); 36585 rgbColor = cs.getRgb(color, 0); 36586 const run = i - iBase; 36587 maxSlopeR = Math.min(maxSlopeR, (rgbColor[0] - rgbBase[0] + 1) / run); 36588 maxSlopeG = Math.min(maxSlopeG, (rgbColor[1] - rgbBase[1] + 1) / run); 36589 maxSlopeB = Math.min(maxSlopeB, (rgbColor[2] - rgbBase[2] + 1) / run); 36590 minSlopeR = Math.max(minSlopeR, (rgbColor[0] - rgbBase[0] - 1) / run); 36591 minSlopeG = Math.max(minSlopeG, (rgbColor[1] - rgbBase[1] - 1) / run); 36592 minSlopeB = Math.max(minSlopeB, (rgbColor[2] - rgbBase[2] - 1) / run); 36593 const slopesExist = minSlopeR <= maxSlopeR && minSlopeG <= maxSlopeG && minSlopeB <= maxSlopeB; 36594 if (!slopesExist) { 36595 const cssColor = _util.Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]); 36596 colorStops.push([iPrev / NUMBER_OF_SAMPLES, cssColor]); 36597 maxSlopeR = rgbColor[0] - rgbPrev[0] + 1; 36598 maxSlopeG = rgbColor[1] - rgbPrev[1] + 1; 36599 maxSlopeB = rgbColor[2] - rgbPrev[2] + 1; 36600 minSlopeR = rgbColor[0] - rgbPrev[0] - 1; 36601 minSlopeG = rgbColor[1] - rgbPrev[1] - 1; 36602 minSlopeB = rgbColor[2] - rgbPrev[2] - 1; 36603 iBase = iPrev; 36604 rgbBase = rgbPrev; 36605 } 36606 iPrev = i; 36607 rgbPrev = rgbColor; 36608 } 36609 const cssColor = _util.Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]); 36610 colorStops.push([1, cssColor]); 36611 let background = "transparent";
vendor: 24,229 bytes, lines 36612-37308
36612 if (dict.has("Background")) { 36613 rgbColor = cs.getRgb(dict.get("Background"), 0); 36614 background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]); 36615 } 36616 if (!extendStart) { 36617 colorStops.unshift([0, background]); 36618 colorStops[1][0] += BaseShading.SMALL_NUMBER; 36619 } 36620 if (!extendEnd) { 36621 colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER; 36622 colorStops.push([1, background]); 36623 } 36624 this.colorStops = colorStops; 36625 } 36626 getIR() { 36627 const coordsArr = this.coordsArr; 36628 const shadingType = this.shadingType; 36629 let type, p0, p1, r0, r1; 36630 if (shadingType === ShadingType.AXIAL) { 36631 p0 = [coordsArr[0], coordsArr[1]]; 36632 p1 = [coordsArr[2], coordsArr[3]]; 36633 r0 = null; 36634 r1 = null; 36635 type = "axial"; 36636 } else if (shadingType === ShadingType.RADIAL) { 36637 p0 = [coordsArr[0], coordsArr[1]]; 36638 p1 = [coordsArr[3], coordsArr[4]]; 36639 r0 = coordsArr[2]; 36640 r1 = coordsArr[5]; 36641 type = "radial"; 36642 } else { 36643 (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`); 36644 } 36645 return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1]; 36646 } 36647} 36648class MeshStreamReader { 36649 constructor(stream, context) { 36650 this.stream = stream; 36651 this.context = context; 36652 this.buffer = 0; 36653 this.bufferLength = 0; 36654 const numComps = context.numComps; 36655 this.tmpCompsBuf = new Float32Array(numComps); 36656 const csNumComps = context.colorSpace.numComps; 36657 this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf; 36658 } 36659 get hasData() { 36660 if (this.stream.end) { 36661 return this.stream.pos < this.stream.end; 36662 } 36663 if (this.bufferLength > 0) { 36664 return true; 36665 } 36666 const nextByte = this.stream.getByte(); 36667 if (nextByte < 0) { 36668 return false; 36669 } 36670 this.buffer = nextByte; 36671 this.bufferLength = 8; 36672 return true; 36673 } 36674 readBits(n) { 36675 let buffer = this.buffer; 36676 let bufferLength = this.bufferLength; 36677 if (n === 32) { 36678 if (bufferLength === 0) { 36679 return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0; 36680 } 36681 buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte(); 36682 const nextByte = this.stream.getByte(); 36683 this.buffer = nextByte & (1 << bufferLength) - 1; 36684 return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0; 36685 } 36686 if (n === 8 && bufferLength === 0) { 36687 return this.stream.getByte(); 36688 } 36689 while (bufferLength < n) { 36690 buffer = buffer << 8 | this.stream.getByte(); 36691 bufferLength += 8; 36692 } 36693 bufferLength -= n; 36694 this.bufferLength = bufferLength; 36695 this.buffer = buffer & (1 << bufferLength) - 1; 36696 return buffer >> bufferLength; 36697 } 36698 align() { 36699 this.buffer = 0; 36700 this.bufferLength = 0; 36701 } 36702 readFlag() { 36703 return this.readBits(this.context.bitsPerFlag); 36704 } 36705 readCoordinate() { 36706 const bitsPerCoordinate = this.context.bitsPerCoordinate; 36707 const xi = this.readBits(bitsPerCoordinate); 36708 const yi = this.readBits(bitsPerCoordinate); 36709 const decode = this.context.decode; 36710 const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10; 36711 return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]]; 36712 } 36713 readComponents() { 36714 const numComps = this.context.numComps; 36715 const bitsPerComponent = this.context.bitsPerComponent; 36716 const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10; 36717 const decode = this.context.decode; 36718 const components = this.tmpCompsBuf; 36719 for (let i = 0, j = 4; i < numComps; i++, j += 2) { 36720 const ci = this.readBits(bitsPerComponent); 36721 components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j]; 36722 } 36723 const color = this.tmpCsCompsBuf; 36724 if (this.context.colorFn) { 36725 this.context.colorFn(components, 0, color, 0); 36726 } 36727 return this.context.colorSpace.getRgb(color, 0); 36728 } 36729} 36730let bCache = Object.create(null); 36731function buildB(count) { 36732 const lut = []; 36733 for (let i = 0; i <= count; i++) { 36734 const t = i / count, 36735 t_ = 1 - t; 36736 lut.push(new Float32Array([t_ ** 3, 3 * t * t_ ** 2, 3 * t ** 2 * t_, t ** 3])); 36737 } 36738 return lut; 36739} 36740function getB(count) { 36741 return bCache[count] ||= buildB(count); 36742} 36743function clearPatternCaches() { 36744 bCache = Object.create(null); 36745} 36746class MeshShading extends BaseShading { 36747 static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3; 36748 static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20; 36749 static TRIANGLE_DENSITY = 20; 36750 constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) { 36751 super(); 36752 if (!(stream instanceof _base_stream.BaseStream)) { 36753 throw new _util.FormatError("Mesh data is not a stream"); 36754 } 36755 const dict = stream.dict; 36756 this.shadingType = dict.get("ShadingType"); 36757 const bbox = dict.getArray("BBox"); 36758 this.bbox = Array.isArray(bbox) && bbox.length === 4 ? _util.Util.normalizeRect(bbox) : null; 36759 const cs = _colorspace.ColorSpace.parse({ 36760 cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), 36761 xref, 36762 resources, 36763 pdfFunctionFactory, 36764 localColorSpaceCache 36765 }); 36766 this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null; 36767 const fnObj = dict.getRaw("Function"); 36768 const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null; 36769 this.coords = []; 36770 this.colors = []; 36771 this.figures = []; 36772 const decodeContext = { 36773 bitsPerCoordinate: dict.get("BitsPerCoordinate"), 36774 bitsPerComponent: dict.get("BitsPerComponent"), 36775 bitsPerFlag: dict.get("BitsPerFlag"), 36776 decode: dict.getArray("Decode"), 36777 colorFn: fn, 36778 colorSpace: cs, 36779 numComps: fn ? 1 : cs.numComps 36780 }; 36781 const reader = new MeshStreamReader(stream, decodeContext); 36782 let patchMesh = false; 36783 switch (this.shadingType) { 36784 case ShadingType.FREE_FORM_MESH: 36785 this._decodeType4Shading(reader); 36786 break; 36787 case ShadingType.LATTICE_FORM_MESH: 36788 const verticesPerRow = dict.get("VerticesPerRow") | 0; 36789 if (verticesPerRow < 2) { 36790 throw new _util.FormatError("Invalid VerticesPerRow"); 36791 } 36792 this._decodeType5Shading(reader, verticesPerRow); 36793 break; 36794 case ShadingType.COONS_PATCH_MESH: 36795 this._decodeType6Shading(reader); 36796 patchMesh = true; 36797 break; 36798 case ShadingType.TENSOR_PATCH_MESH: 36799 this._decodeType7Shading(reader); 36800 patchMesh = true; 36801 break; 36802 default: 36803 (0, _util.unreachable)("Unsupported mesh type."); 36804 break; 36805 } 36806 if (patchMesh) { 36807 this._updateBounds(); 36808 for (let i = 0, ii = this.figures.length; i < ii; i++) { 36809 this._buildFigureFromPatch(i); 36810 } 36811 } 36812 this._updateBounds(); 36813 this._packData(); 36814 } 36815 _decodeType4Shading(reader) { 36816 const coords = this.coords; 36817 const colors = this.colors; 36818 const operators = []; 36819 const ps = []; 36820 let verticesLeft = 0; 36821 while (reader.hasData) { 36822 const f = reader.readFlag(); 36823 const coord = reader.readCoordinate(); 36824 const color = reader.readComponents(); 36825 if (verticesLeft === 0) { 36826 if (!(0 <= f && f <= 2)) { 36827 throw new _util.FormatError("Unknown type4 flag"); 36828 } 36829 switch (f) { 36830 case 0: 36831 verticesLeft = 3; 36832 break; 36833 case 1: 36834 ps.push(ps.at(-2), ps.at(-1)); 36835 verticesLeft = 1; 36836 break; 36837 case 2: 36838 ps.push(ps.at(-3), ps.at(-1)); 36839 verticesLeft = 1; 36840 break; 36841 } 36842 operators.push(f); 36843 } 36844 ps.push(coords.length); 36845 coords.push(coord); 36846 colors.push(color); 36847 verticesLeft--; 36848 reader.align(); 36849 } 36850 this.figures.push({ 36851 type: "triangles", 36852 coords: new Int32Array(ps), 36853 colors: new Int32Array(ps) 36854 }); 36855 } 36856 _decodeType5Shading(reader, verticesPerRow) { 36857 const coords = this.coords; 36858 const colors = this.colors; 36859 const ps = []; 36860 while (reader.hasData) { 36861 const coord = reader.readCoordinate(); 36862 const color = reader.readComponents(); 36863 ps.push(coords.length); 36864 coords.push(coord); 36865 colors.push(color); 36866 } 36867 this.figures.push({ 36868 type: "lattice", 36869 coords: new Int32Array(ps), 36870 colors: new Int32Array(ps), 36871 verticesPerRow 36872 }); 36873 } 36874 _decodeType6Shading(reader) { 36875 const coords = this.coords; 36876 const colors = this.colors; 36877 const ps = new Int32Array(16); 36878 const cs = new Int32Array(4); 36879 while (reader.hasData) { 36880 const f = reader.readFlag(); 36881 if (!(0 <= f && f <= 3)) { 36882 throw new _util.FormatError("Unknown type6 flag"); 36883 } 36884 const pi = coords.length; 36885 for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) { 36886 coords.push(reader.readCoordinate()); 36887 } 36888 const ci = colors.length; 36889 for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 36890 colors.push(reader.readComponents()); 36891 } 36892 let tmp1, tmp2, tmp3, tmp4; 36893 switch (f) { 36894 case 0: 36895 ps[12] = pi + 3; 36896 ps[13] = pi + 4; 36897 ps[14] = pi + 5; 36898 ps[15] = pi + 6; 36899 ps[8] = pi + 2; 36900 ps[11] = pi + 7; 36901 ps[4] = pi + 1; 36902 ps[7] = pi + 8; 36903 ps[0] = pi; 36904 ps[1] = pi + 11; 36905 ps[2] = pi + 10; 36906 ps[3] = pi + 9; 36907 cs[2] = ci + 1; 36908 cs[3] = ci + 2; 36909 cs[0] = ci; 36910 cs[1] = ci + 3; 36911 break; 36912 case 1: 36913 tmp1 = ps[12]; 36914 tmp2 = ps[13]; 36915 tmp3 = ps[14]; 36916 tmp4 = ps[15]; 36917 ps[12] = tmp4; 36918 ps[13] = pi + 0; 36919 ps[14] = pi + 1; 36920 ps[15] = pi + 2; 36921 ps[8] = tmp3; 36922 ps[11] = pi + 3; 36923 ps[4] = tmp2; 36924 ps[7] = pi + 4; 36925 ps[0] = tmp1; 36926 ps[1] = pi + 7; 36927 ps[2] = pi + 6; 36928 ps[3] = pi + 5; 36929 tmp1 = cs[2]; 36930 tmp2 = cs[3]; 36931 cs[2] = tmp2; 36932 cs[3] = ci; 36933 cs[0] = tmp1; 36934 cs[1] = ci + 1; 36935 break; 36936 case 2: 36937 tmp1 = ps[15]; 36938 tmp2 = ps[11]; 36939 ps[12] = ps[3]; 36940 ps[13] = pi + 0; 36941 ps[14] = pi + 1; 36942 ps[15] = pi + 2; 36943 ps[8] = ps[7]; 36944 ps[11] = pi + 3; 36945 ps[4] = tmp2; 36946 ps[7] = pi + 4; 36947 ps[0] = tmp1; 36948 ps[1] = pi + 7; 36949 ps[2] = pi + 6; 36950 ps[3] = pi + 5; 36951 tmp1 = cs[3]; 36952 cs[2] = cs[1]; 36953 cs[3] = ci; 36954 cs[0] = tmp1; 36955 cs[1] = ci + 1; 36956 break; 36957 case 3: 36958 ps[12] = ps[0]; 36959 ps[13] = pi + 0; 36960 ps[14] = pi + 1; 36961 ps[15] = pi + 2; 36962 ps[8] = ps[1]; 36963 ps[11] = pi + 3; 36964 ps[4] = ps[2]; 36965 ps[7] = pi + 4; 36966 ps[0] = ps[3]; 36967 ps[1] = pi + 7; 36968 ps[2] = pi + 6; 36969 ps[3] = pi + 5; 36970 cs[2] = cs[0]; 36971 cs[3] = ci; 36972 cs[0] = cs[1]; 36973 cs[1] = ci + 1; 36974 break; 36975 } 36976 ps[5] = coords.length; 36977 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]); 36978 ps[6] = coords.length; 36979 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]); 36980 ps[9] = coords.length; 36981 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]); 36982 ps[10] = coords.length; 36983 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]); 36984 this.figures.push({ 36985 type: "patch", 36986 coords: new Int32Array(ps), 36987 colors: new Int32Array(cs) 36988 }); 36989 } 36990 } 36991 _decodeType7Shading(reader) { 36992 const coords = this.coords; 36993 const colors = this.colors; 36994 const ps = new Int32Array(16); 36995 const cs = new Int32Array(4); 36996 while (reader.hasData) { 36997 const f = reader.readFlag(); 36998 if (!(0 <= f && f <= 3)) { 36999 throw new _util.FormatError("Unknown type7 flag"); 37000 } 37001 const pi = coords.length; 37002 for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) { 37003 coords.push(reader.readCoordinate()); 37004 } 37005 const ci = colors.length; 37006 for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 37007 colors.push(reader.readComponents()); 37008 } 37009 let tmp1, tmp2, tmp3, tmp4; 37010 switch (f) { 37011 case 0: 37012 ps[12] = pi + 3; 37013 ps[13] = pi + 4; 37014 ps[14] = pi + 5; 37015 ps[15] = pi + 6; 37016 ps[8] = pi + 2; 37017 ps[9] = pi + 13; 37018 ps[10] = pi + 14; 37019 ps[11] = pi + 7; 37020 ps[4] = pi + 1; 37021 ps[5] = pi + 12; 37022 ps[6] = pi + 15; 37023 ps[7] = pi + 8; 37024 ps[0] = pi; 37025 ps[1] = pi + 11; 37026 ps[2] = pi + 10; 37027 ps[3] = pi + 9; 37028 cs[2] = ci + 1; 37029 cs[3] = ci + 2; 37030 cs[0] = ci; 37031 cs[1] = ci + 3; 37032 break; 37033 case 1: 37034 tmp1 = ps[12]; 37035 tmp2 = ps[13]; 37036 tmp3 = ps[14]; 37037 tmp4 = ps[15]; 37038 ps[12] = tmp4; 37039 ps[13] = pi + 0; 37040 ps[14] = pi + 1; 37041 ps[15] = pi + 2; 37042 ps[8] = tmp3; 37043 ps[9] = pi + 9; 37044 ps[10] = pi + 10; 37045 ps[11] = pi + 3; 37046 ps[4] = tmp2; 37047 ps[5] = pi + 8; 37048 ps[6] = pi + 11; 37049 ps[7] = pi + 4; 37050 ps[0] = tmp1; 37051 ps[1] = pi + 7; 37052 ps[2] = pi + 6; 37053 ps[3] = pi + 5; 37054 tmp1 = cs[2]; 37055 tmp2 = cs[3]; 37056 cs[2] = tmp2; 37057 cs[3] = ci; 37058 cs[0] = tmp1; 37059 cs[1] = ci + 1; 37060 break; 37061 case 2: 37062 tmp1 = ps[15]; 37063 tmp2 = ps[11]; 37064 ps[12] = ps[3]; 37065 ps[13] = pi + 0; 37066 ps[14] = pi + 1; 37067 ps[15] = pi + 2; 37068 ps[8] = ps[7]; 37069 ps[9] = pi + 9; 37070 ps[10] = pi + 10; 37071 ps[11] = pi + 3; 37072 ps[4] = tmp2; 37073 ps[5] = pi + 8; 37074 ps[6] = pi + 11; 37075 ps[7] = pi + 4; 37076 ps[0] = tmp1; 37077 ps[1] = pi + 7; 37078 ps[2] = pi + 6; 37079 ps[3] = pi + 5; 37080 tmp1 = cs[3]; 37081 cs[2] = cs[1]; 37082 cs[3] = ci; 37083 cs[0] = tmp1; 37084 cs[1] = ci + 1; 37085 break; 37086 case 3: 37087 ps[12] = ps[0]; 37088 ps[13] = pi + 0; 37089 ps[14] = pi + 1; 37090 ps[15] = pi + 2; 37091 ps[8] = ps[1]; 37092 ps[9] = pi + 9; 37093 ps[10] = pi + 10; 37094 ps[11] = pi + 3; 37095 ps[4] = ps[2]; 37096 ps[5] = pi + 8; 37097 ps[6] = pi + 11; 37098 ps[7] = pi + 4; 37099 ps[0] = ps[3]; 37100 ps[1] = pi + 7; 37101 ps[2] = pi + 6; 37102 ps[3] = pi + 5; 37103 cs[2] = cs[0]; 37104 cs[3] = ci; 37105 cs[0] = cs[1]; 37106 cs[1] = ci + 1; 37107 break; 37108 } 37109 this.figures.push({ 37110 type: "patch", 37111 coords: new Int32Array(ps), 37112 colors: new Int32Array(cs) 37113 }); 37114 } 37115 } 37116 _buildFigureFromPatch(index) { 37117 const figure = this.figures[index]; 37118 (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure"); 37119 const coords = this.coords, 37120 colors = this.colors; 37121 const pi = figure.coords; 37122 const ci = figure.colors; 37123 const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 37124 const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 37125 const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 37126 const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 37127 let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0])); 37128 splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy)); 37129 let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1])); 37130 splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy)); 37131 const verticesPerRow = splitXBy + 1; 37132 const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow); 37133 const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow); 37134 let k = 0; 37135 const cl = new Uint8Array(3), 37136 cr = new Uint8Array(3); 37137 const c0 = colors[ci[0]], 37138 c1 = colors[ci[1]], 37139 c2 = colors[ci[2]], 37140 c3 = colors[ci[3]]; 37141 const bRow = getB(splitYBy), 37142 bCol = getB(splitXBy); 37143 for (let row = 0; row <= splitYBy; row++) { 37144 cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0; 37145 cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0; 37146 cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0; 37147 cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0; 37148 cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0; 37149 cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0; 37150 for (let col = 0; col <= splitXBy; col++, k++) { 37151 if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) { 37152 continue; 37153 } 37154 let x = 0, 37155 y = 0; 37156 let q = 0; 37157 for (let i = 0; i <= 3; i++) { 37158 for (let j = 0; j <= 3; j++, q++) { 37159 const m = bRow[row][i] * bCol[col][j]; 37160 x += coords[pi[q]][0] * m; 37161 y += coords[pi[q]][1] * m; 37162 } 37163 } 37164 figureCoords[k] = coords.length; 37165 coords.push([x, y]); 37166 figureColors[k] = colors.length; 37167 const newColor = new Uint8Array(3); 37168 newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0; 37169 newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0; 37170 newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0; 37171 colors.push(newColor); 37172 } 37173 } 37174 figureCoords[0] = pi[0]; 37175 figureColors[0] = ci[0]; 37176 figureCoords[splitXBy] = pi[3]; 37177 figureColors[splitXBy] = ci[1]; 37178 figureCoords[verticesPerRow * splitYBy] = pi[12]; 37179 figureColors[verticesPerRow * splitYBy] = ci[2]; 37180 figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15]; 37181 figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3]; 37182 this.figures[index] = { 37183 type: "lattice", 37184 coords: figureCoords, 37185 colors: figureColors, 37186 verticesPerRow 37187 }; 37188 } 37189 _updateBounds() { 37190 let minX = this.coords[0][0], 37191 minY = this.coords[0][1], 37192 maxX = minX, 37193 maxY = minY; 37194 for (let i = 1, ii = this.coords.length; i < ii; i++) { 37195 const x = this.coords[i][0], 37196 y = this.coords[i][1]; 37197 minX = minX > x ? x : minX; 37198 minY = minY > y ? y : minY; 37199 maxX = maxX < x ? x : maxX; 37200 maxY = maxY < y ? y : maxY; 37201 } 37202 this.bounds = [minX, minY, maxX, maxY]; 37203 } 37204 _packData() { 37205 let i, ii, j, jj; 37206 const coords = this.coords; 37207 const coordsPacked = new Float32Array(coords.length * 2); 37208 for (i = 0, j = 0, ii = coords.length; i < ii; i++) { 37209 const xy = coords[i]; 37210 coordsPacked[j++] = xy[0]; 37211 coordsPacked[j++] = xy[1]; 37212 } 37213 this.coords = coordsPacked; 37214 const colors = this.colors; 37215 const colorsPacked = new Uint8Array(colors.length * 3); 37216 for (i = 0, j = 0, ii = colors.length; i < ii; i++) { 37217 const c = colors[i]; 37218 colorsPacked[j++] = c[0]; 37219 colorsPacked[j++] = c[1]; 37220 colorsPacked[j++] = c[2]; 37221 } 37222 this.colors = colorsPacked; 37223 const figures = this.figures; 37224 for (i = 0, ii = figures.length; i < ii; i++) { 37225 const figure = figures[i], 37226 ps = figure.coords, 37227 cs = figure.colors; 37228 for (j = 0, jj = ps.length; j < jj; j++) { 37229 ps[j] *= 2; 37230 cs[j] *= 3; 37231 } 37232 } 37233 } 37234 getIR() { 37235 return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background]; 37236 } 37237} 37238class DummyShading extends BaseShading { 37239 getIR() { 37240 return ["Dummy"]; 37241 } 37242} 37243function getTilingPatternIR(operatorList, dict, color) { 37244 const matrix = dict.getArray("Matrix"); 37245 const bbox = _util.Util.normalizeRect(dict.getArray("BBox")); 37246 const xstep = dict.get("XStep"); 37247 const ystep = dict.get("YStep"); 37248 const paintType = dict.get("PaintType"); 37249 const tilingType = dict.get("TilingType"); 37250 if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) { 37251 throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`); 37252 } 37253 return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType]; 37254} 37255 37256/***/ }), 37257/* 51 */ 37258/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 37259 37260 37261 37262Object.defineProperty(exports, "__esModule", ({ 37263 value: true 37264})); 37265exports.getXfaFontDict = getXfaFontDict; 37266exports.getXfaFontName = getXfaFontName; 37267var _calibri_factors = __w_pdfjs_require__(52); 37268var _primitives = __w_pdfjs_require__(4); 37269var _helvetica_factors = __w_pdfjs_require__(53); 37270var _liberationsans_widths = __w_pdfjs_require__(54); 37271var _myriadpro_factors = __w_pdfjs_require__(55); 37272var _segoeui_factors = __w_pdfjs_require__(56); 37273var _core_utils = __w_pdfjs_require__(3); 37274var _fonts_utils = __w_pdfjs_require__(38); 37275const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 37276 t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = { 37277 name: "LiberationSans-Regular", 37278 factors: _myriadpro_factors.MyriadProRegularFactors, 37279 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 37280 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 37281 metrics: _myriadpro_factors.MyriadProRegularMetrics 37282 }; 37283 t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = { 37284 name: "LiberationSans-Bold", 37285 factors: _myriadpro_factors.MyriadProBoldFactors, 37286 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 37287 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 37288 metrics: _myriadpro_factors.MyriadProBoldMetrics 37289 }; 37290 t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = { 37291 name: "LiberationSans-Italic", 37292 factors: _myriadpro_factors.MyriadProItalicFactors, 37293 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 37294 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 37295 metrics: _myriadpro_factors.MyriadProItalicMetrics 37296 }; 37297 t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = { 37298 name: "LiberationSans-BoldItalic", 37299 factors: _myriadpro_factors.MyriadProBoldItalicFactors, 37300 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 37301 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 37302 metrics: _myriadpro_factors.MyriadProBoldItalicMetrics 37303 }; 37304 t.ArialMT = t.Arial = t["Arial-Regular"] = { 37305 name: "LiberationSans-Regular", 37306 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 37307 baseMapping: _liberationsans_widths.LiberationSansRegularMapping 37308 };
37309 t["Arial-BoldMT"] = t["Arial-Bold"] = { 37310 name: "LiberationSans-Bold", 37311 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 37312 baseMapping: _liberationsans_widths.LiberationSansBoldMapping 37313 }; 37314 t["Arial-ItalicMT"] = t["Arial-Italic"] = { 37315 name: "LiberationSans-Italic", 37316 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 37317 baseMapping: _liberationsans_widths.LiberationSansItalicMapping 37318 }; 37319 t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = { 37320 name: "LiberationSans-BoldItalic", 37321 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 37322 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping 37323 }; 37324 t["Calibri-Regular"] = { 37325 name: "LiberationSans-Regular", 37326 factors: _calibri_factors.CalibriRegularFactors, 37327 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 37328 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 37329 metrics: _calibri_factors.CalibriRegularMetrics 37330 }; 37331 t["Calibri-Bold"] = { 37332 name: "LiberationSans-Bold", 37333 factors: _calibri_factors.CalibriBoldFactors, 37334 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 37335 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 37336 metrics: _calibri_factors.CalibriBoldMetrics 37337 }; 37338 t["Calibri-Italic"] = { 37339 name: "LiberationSans-Italic", 37340 factors: _calibri_factors.CalibriItalicFactors, 37341 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 37342 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 37343 metrics: _calibri_factors.CalibriItalicMetrics 37344 }; 37345 t["Calibri-BoldItalic"] = { 37346 name: "LiberationSans-BoldItalic", 37347 factors: _calibri_factors.CalibriBoldItalicFactors, 37348 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 37349 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 37350 metrics: _calibri_factors.CalibriBoldItalicMetrics 37351 }; 37352 t["Segoeui-Regular"] = { 37353 name: "LiberationSans-Regular", 37354 factors: _segoeui_factors.SegoeuiRegularFactors, 37355 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 37356 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 37357 metrics: _segoeui_factors.SegoeuiRegularMetrics 37358 }; 37359 t["Segoeui-Bold"] = { 37360 name: "LiberationSans-Bold", 37361 factors: _segoeui_factors.SegoeuiBoldFactors, 37362 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 37363 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 37364 metrics: _segoeui_factors.SegoeuiBoldMetrics 37365 }; 37366 t["Segoeui-Italic"] = { 37367 name: "LiberationSans-Italic", 37368 factors: _segoeui_factors.SegoeuiItalicFactors, 37369 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 37370 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 37371 metrics: _segoeui_factors.SegoeuiItalicMetrics 37372 }; 37373 t["Segoeui-BoldItalic"] = { 37374 name: "LiberationSans-BoldItalic", 37375 factors: _segoeui_factors.SegoeuiBoldItalicFactors, 37376 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 37377 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 37378 metrics: _segoeui_factors.SegoeuiBoldItalicMetrics 37379 }; 37380 t["Helvetica-Regular"] = t.Helvetica = { 37381 name: "LiberationSans-Regular", 37382 factors: _helvetica_factors.HelveticaRegularFactors, 37383 baseWidths: _liberationsans_widths.LiberationSansRegularWidths, 37384 baseMapping: _liberationsans_widths.LiberationSansRegularMapping, 37385 metrics: _helvetica_factors.HelveticaRegularMetrics 37386 }; 37387 t["Helvetica-Bold"] = { 37388 name: "LiberationSans-Bold", 37389 factors: _helvetica_factors.HelveticaBoldFactors, 37390 baseWidths: _liberationsans_widths.LiberationSansBoldWidths, 37391 baseMapping: _liberationsans_widths.LiberationSansBoldMapping, 37392 metrics: _helvetica_factors.HelveticaBoldMetrics 37393 }; 37394 t["Helvetica-Italic"] = { 37395 name: "LiberationSans-Italic", 37396 factors: _helvetica_factors.HelveticaItalicFactors, 37397 baseWidths: _liberationsans_widths.LiberationSansItalicWidths, 37398 baseMapping: _liberationsans_widths.LiberationSansItalicMapping, 37399 metrics: _helvetica_factors.HelveticaItalicMetrics 37400 }; 37401 t["Helvetica-BoldItalic"] = { 37402 name: "LiberationSans-BoldItalic",
vendor: 2,506 bytes, lines 37403-37473
37403 factors: _helvetica_factors.HelveticaBoldItalicFactors, 37404 baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, 37405 baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping, 37406 metrics: _helvetica_factors.HelveticaBoldItalicMetrics 37407 }; 37408}); 37409function getXfaFontName(name) { 37410 const fontName = (0, _fonts_utils.normalizeFontName)(name); 37411 const fontMap = getXFAFontMap(); 37412 return fontMap[fontName]; 37413} 37414function getXfaFontWidths(name) { 37415 const info = getXfaFontName(name); 37416 if (!info) { 37417 return null; 37418 } 37419 const { 37420 baseWidths, 37421 baseMapping, 37422 factors 37423 } = info; 37424 const rescaledBaseWidths = !factors ? baseWidths : baseWidths.map((w, i) => w * factors[i]); 37425 let currentCode = -2; 37426 let currentArray; 37427 const newWidths = []; 37428 for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) { 37429 if (unicode === -1) { 37430 continue; 37431 } 37432 if (unicode === currentCode + 1) { 37433 currentArray.push(rescaledBaseWidths[glyphIndex]); 37434 currentCode += 1; 37435 } else { 37436 currentCode = unicode; 37437 currentArray = [rescaledBaseWidths[glyphIndex]]; 37438 newWidths.push(unicode, currentArray); 37439 } 37440 } 37441 return newWidths; 37442} 37443function getXfaFontDict(name) { 37444 const widths = getXfaFontWidths(name); 37445 const dict = new _primitives.Dict(null); 37446 dict.set("BaseFont", _primitives.Name.get(name)); 37447 dict.set("Type", _primitives.Name.get("Font")); 37448 dict.set("Subtype", _primitives.Name.get("CIDFontType2")); 37449 dict.set("Encoding", _primitives.Name.get("Identity-H")); 37450 dict.set("CIDToGIDMap", _primitives.Name.get("Identity")); 37451 dict.set("W", widths); 37452 dict.set("FirstChar", widths[0]); 37453 dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1); 37454 const descriptor = new _primitives.Dict(null); 37455 dict.set("FontDescriptor", descriptor); 37456 const systemInfo = new _primitives.Dict(null); 37457 systemInfo.set("Ordering", "Identity"); 37458 systemInfo.set("Registry", "Adobe"); 37459 systemInfo.set("Supplement", 0); 37460 dict.set("CIDSystemInfo", systemInfo); 37461 return dict; 37462} 37463 37464/***/ }), 37465/* 52 */ 37466/***/ ((__unused_webpack_module, exports) => { 37467 37468 37469 37470Object.defineProperty(exports, "__esModule", ({ 37471 value: true 37472})); 37473exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
vendor: 4,837 bytes, lines 37473-37474
37473 37474const 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];
37475exports.CalibriBoldFactors = CalibriBoldFactors; 37476const CalibriBoldMetrics = { 37477 lineHeight: 1.2207, 37478 lineGap: 0.2207 37479}; 37480exports.CalibriBoldMetrics = CalibriBoldMetrics
vendor: 4,884 bytes, lines 37480-37481
37480; 37481const 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];
37482exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors; 37483const CalibriBoldItalicMetrics = { 37484 lineHeight: 1.2207, 37485 lineGap: 0.2207 37486}; 37487exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics
vendor: 4,805 bytes, lines 37487-37488
37487; 37488const 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];
37489exports.CalibriItalicFactors = CalibriItalicFactors; 37490const CalibriItalicMetrics = { 37491 lineHeight: 1.2207, 37492 lineGap: 0.2207 37493}; 37494exports.CalibriItalicMetrics = CalibriItalicMetrics
vendor: 4,863 bytes, lines 37494-37495
37494; 37495const 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];
37496exports.CalibriRegularFactors = CalibriRegularFactors; 37497const CalibriRegularMetrics = { 37498 lineHeight: 1.2207, 37499 lineGap: 0.2207 37500}; 37501exports.CalibriRegularMetrics = CalibriRegularMetrics; 37502 37503/***/ }), 37504/* 53 */ 37505/***/ ((__unused_webpack_module, exports) => { 37506 37507 37508 37509Object.defineProperty(exports, "__esModule", ({ 37510 value: true 37511})); 37512exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0; 37513const 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];
37514exports.HelveticaBoldFactors = HelveticaBoldFactors; 37515const HelveticaBoldMetrics = { 37516 lineHeight: 1.2, 37517 lineGap: 0.2 37518}; 37519exports.HelveticaBoldMetrics = HelveticaBoldMetrics; 37520const 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];
37521exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors; 37522const HelveticaBoldItalicMetrics = { 37523 lineHeight: 1.35, 37524 lineGap: 0.2 37525}; 37526exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics; 37527const 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]; 37528exports.HelveticaItalicFactors = HelveticaItalicFactors; 37529const HelveticaItalicMetrics = { 37530 lineHeight: 1.35, 37531 lineGap: 0.2 37532}; 37533exports.HelveticaItalicMetrics = HelveticaItalicMetrics; 37534const 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,
375341.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]; 37535exports.HelveticaRegularFactors = HelveticaRegularFactors; 37536const HelveticaRegularMetrics = { 37537 lineHeight: 1.2, 37538 lineGap: 0.2 37539}; 37540exports.HelveticaRegularMetrics = HelveticaRegularMetrics; 37541 37542/***/ }), 37543/* 54 */ 37544/***/ ((__unused_webpack_module, exports) => { 37545 37546 37547 37548Object.defineProperty(exports, "__esModule", ({ 37549 value: true 37550})); 37551exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0; 37552const 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,
37552604, 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]; 37553exports.LiberationSansBoldWidths = LiberationSansBoldWidths; 37554const 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]; 37555exports.LiberationSansBoldMapping = LiberationSansBoldMapping; 37556const 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
375567, 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]; 37557exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths; 37558const 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]; 37559exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping; 37560const LiberationSansItalicWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889,
37560667, 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]; 37561exports.LiberationSansItalicWidths = LiberationSansItalicWidths; 37562const 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]; 37563exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
37564const 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]; 37565exports.LiberationSansRegularWidths = LiberationSansRegularWidths; 37566const 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]; 37567exports.LiberationSansRegularMapping = LiberationSansRegularMapping; 37568 37569/***/ }), 37570/* 55 */
37571/***/ ((__unused_webpack_module, exports) => { 37572 37573 37574 37575Object.defineProperty(exports, "__esModule", ({ 37576 value: true 37577})); 37578exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0; 37579const 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]; 37580exports.MyriadProBoldFactors = MyriadProBoldFactors; 37581const MyriadProBoldMetrics = { 37582 lineHeight: 1.2, 37583 lineGap: 0.2 37584}; 37585exports.MyriadProBoldMetrics = MyriadProBoldMetrics
vendor: 4,577 bytes, lines 37585-37586
37585; 37586const 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];
37587exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors; 37588const MyriadProBoldItalicMetrics = { 37589 lineHeight: 1.2, 37590 lineGap: 0.2 37591}; 37592exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics; 37593const 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,
375931, 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]; 37594exports.MyriadProItalicFactors = MyriadProItalicFactors; 37595const MyriadProItalicMetrics = { 37596 lineHeight: 1.2, 37597 lineGap: 0.2 37598}; 37599exports.MyriadProItalicMetrics = MyriadProItalicMetrics; 37600const 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,
376001.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]; 37601exports.MyriadProRegularFactors = MyriadProRegularFactors; 37602const MyriadProRegularMetrics = { 37603 lineHeight: 1.2, 37604 lineGap: 0.2 37605}; 37606exports.MyriadProRegularMetrics = MyriadProRegularMetrics; 37607 37608/***/ }), 37609/* 56 */ 37610/***/ ((__unused_webpack_module, exports) => { 37611 37612 37613 37614Object.defineProperty(exports, "__esModule", ({ 37615 value: true 37616})); 37617exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0; 37618const 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]; 37619exports.SegoeuiBoldFactors = SegoeuiBoldFactors; 37620const SegoeuiBoldMetrics = { 37621 lineHeight: 1.33008, 37622 lineGap: 0 37623}; 37624exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics; 37625const 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,
376251.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]; 37626exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors; 37627const SegoeuiBoldItalicMetrics = { 37628 lineHeight: 1.33008, 37629 lineGap: 0 37630}; 37631exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics; 37632const 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,
376320.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]; 37633exports.SegoeuiItalicFactors = SegoeuiItalicFactors; 37634const SegoeuiItalicMetrics = { 37635 lineHeight: 1.33008, 37636 lineGap: 0 37637}; 37638exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics; 37639const 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,
376390.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]; 37640exports.SegoeuiRegularFactors = SegoeuiRegularFactors; 37641const SegoeuiRegularMetrics = { 37642 lineHeight: 1.33008, 37643 lineGap: 0 37644}; 37645exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics; 37646 37647/***/ }), 37648/* 57 */ 37649/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 37650 37651 37652 37653Object.defineProperty(exports, "__esModule", ({ 37654 value: true 37655})); 37656exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0; 37657exports.isPDFFunction = isPDFFunction; 37658var _primitives = __w_pdfjs_require__(4); 37659var _util = __w_pdfjs_require__(2); 37660var _ps_parser = __w_pdfjs_require__(58); 37661var _base_stream = __w_pdfjs_require__(5); 37662var _image_utils = __w_pdfjs_require__(59); 37663class PDFFunctionFactory { 37664 constructor({ 37665 xref, 37666 isEvalSupported = true 37667 }) { 37668 this.xref = xref; 37669 this.isEvalSupported = isEvalSupported !== false; 37670 } 37671 create(fn) { 37672 const cachedFunction = this.getCached(fn); 37673 if (cachedFunction) { 37674 return cachedFunction; 37675 } 37676 const parsedFunction = PDFFunction.parse({ 37677 xref: this.xref, 37678 isEvalSupported: this.isEvalSupported, 37679 fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn 37680 }); 37681 this._cache(fn, parsedFunction); 37682 return parsedFunction; 37683 } 37684 createFromArray(fnObj) { 37685 const cachedFunction = this.getCached(fnObj); 37686 if (cachedFunction) { 37687 return cachedFunction; 37688 } 37689 const parsedFunction = PDFFunction.parseArray({ 37690 xref: this.xref, 37691 isEvalSupported: this.isEvalSupported, 37692 fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj 37693 }); 37694 this._cache(fnObj, parsedFunction); 37695 return parsedFunction; 37696 } 37697 getCached(cacheKey) { 37698 let fnRef; 37699 if (cacheKey instanceof _primitives.Ref) { 37700 fnRef = cacheKey; 37701 } else if (cacheKey instanceof _primitives.Dict) { 37702 fnRef = cacheKey.objId; 37703 } else if (cacheKey instanceof _base_stream.BaseStream) { 37704 fnRef = cacheKey.dict?.objId; 37705 } 37706 if (fnRef) { 37707 const localFunction = this._localFunctionCache.getByRef(fnRef); 37708 if (localFunction) { 37709 return localFunction; 37710 } 37711 } 37712 return null; 37713 } 37714 _cache(cacheKey, parsedFunction) { 37715 if (!parsedFunction) { 37716 throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.'); 37717 } 37718 let fnRef; 37719 if (cacheKey instanceof _primitives.Ref) { 37720 fnRef = cacheKey; 37721 } else if (cacheKey instanceof _primitives.Dict) { 37722 fnRef = cacheKey.objId; 37723 } else if (cacheKey instanceof _base_stream.BaseStream) { 37724 fnRef = cacheKey.dict?.objId; 37725 } 37726 if (fnRef) { 37727 this._localFunctionCache.set(null, fnRef, parsedFunction); 37728 } 37729 } 37730 get _localFunctionCache() { 37731 return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache()); 37732 } 37733} 37734exports.PDFFunctionFactory = PDFFunctionFactory; 37735function toNumberArray(arr) { 37736 if (!Array.isArray(arr)) { 37737 return null; 37738 } 37739 const length = arr.length; 37740 for (let i = 0; i < length; i++) { 37741 if (typeof arr[i] !== "number") { 37742 const result = new Array(length); 37743 for (let j = 0; j < length; j++) { 37744 result[j] = +arr[j]; 37745 } 37746 return result; 37747 } 37748 } 37749 return arr; 37750} 37751class PDFFunction { 37752 static getSampleArray(size, outputSize, bps, stream) { 37753 let i, ii; 37754 let length = 1; 37755 for (i = 0, ii = size.length; i < ii; i++) { 37756 length *= size[i]; 37757 } 37758 length *= outputSize; 37759 const array = new Array(length);
vendor: 5,282 bytes, lines 37760-37944
37760 let codeSize = 0; 37761 let codeBuf = 0; 37762 const sampleMul = 1.0 / (2.0 ** bps - 1); 37763 const strBytes = stream.getBytes((length * bps + 7) / 8); 37764 let strIdx = 0; 37765 for (i = 0; i < length; i++) { 37766 while (codeSize < bps) { 37767 codeBuf <<= 8; 37768 codeBuf |= strBytes[strIdx++]; 37769 codeSize += 8; 37770 } 37771 codeSize -= bps; 37772 array[i] = (codeBuf >> codeSize) * sampleMul; 37773 codeBuf &= (1 << codeSize) - 1; 37774 } 37775 return array; 37776 } 37777 static parse({ 37778 xref, 37779 isEvalSupported, 37780 fn 37781 }) { 37782 const dict = fn.dict || fn; 37783 const typeNum = dict.get("FunctionType"); 37784 switch (typeNum) { 37785 case 0: 37786 return this.constructSampled({ 37787 xref, 37788 isEvalSupported, 37789 fn, 37790 dict 37791 }); 37792 case 1: 37793 break; 37794 case 2: 37795 return this.constructInterpolated({ 37796 xref, 37797 isEvalSupported, 37798 dict 37799 }); 37800 case 3: 37801 return this.constructStiched({ 37802 xref, 37803 isEvalSupported, 37804 dict 37805 }); 37806 case 4: 37807 return this.constructPostScript({ 37808 xref, 37809 isEvalSupported, 37810 fn, 37811 dict 37812 }); 37813 } 37814 throw new _util.FormatError("Unknown type of function"); 37815 } 37816 static parseArray({ 37817 xref, 37818 isEvalSupported, 37819 fnObj 37820 }) { 37821 if (!Array.isArray(fnObj)) { 37822 return this.parse({ 37823 xref, 37824 isEvalSupported, 37825 fn: fnObj 37826 }); 37827 } 37828 const fnArray = []; 37829 for (const fn of fnObj) { 37830 fnArray.push(this.parse({ 37831 xref, 37832 isEvalSupported, 37833 fn: xref.fetchIfRef(fn) 37834 })); 37835 } 37836 return function (src, srcOffset, dest, destOffset) { 37837 for (let i = 0, ii = fnArray.length; i < ii; i++) { 37838 fnArray[i](src, srcOffset, dest, destOffset + i); 37839 } 37840 }; 37841 } 37842 static constructSampled({ 37843 xref, 37844 isEvalSupported, 37845 fn, 37846 dict 37847 }) { 37848 function toMultiArray(arr) { 37849 const inputLength = arr.length; 37850 const out = []; 37851 let index = 0; 37852 for (let i = 0; i < inputLength; i += 2) { 37853 out[index++] = [arr[i], arr[i + 1]]; 37854 } 37855 return out; 37856 } 37857 function interpolate(x, xmin, xmax, ymin, ymax) { 37858 return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin)); 37859 } 37860 let domain = toNumberArray(dict.getArray("Domain")); 37861 let range = toNumberArray(dict.getArray("Range")); 37862 if (!domain || !range) { 37863 throw new _util.FormatError("No domain or range"); 37864 } 37865 const inputSize = domain.length / 2; 37866 const outputSize = range.length / 2; 37867 domain = toMultiArray(domain); 37868 range = toMultiArray(range); 37869 const size = toNumberArray(dict.getArray("Size")); 37870 const bps = dict.get("BitsPerSample"); 37871 const order = dict.get("Order") || 1; 37872 if (order !== 1) { 37873 (0, _util.info)("No support for cubic spline interpolation: " + order); 37874 } 37875 let encode = toNumberArray(dict.getArray("Encode")); 37876 if (!encode) { 37877 encode = []; 37878 for (let i = 0; i < inputSize; ++i) { 37879 encode.push([0, size[i] - 1]); 37880 } 37881 } else { 37882 encode = toMultiArray(encode); 37883 } 37884 let decode = toNumberArray(dict.getArray("Decode")); 37885 decode = !decode ? range : toMultiArray(decode); 37886 const samples = this.getSampleArray(size, outputSize, bps, fn); 37887 return function constructSampledFn(src, srcOffset, dest, destOffset) { 37888 const cubeVertices = 1 << inputSize; 37889 const cubeN = new Float64Array(cubeVertices); 37890 const cubeVertex = new Uint32Array(cubeVertices); 37891 let i, j; 37892 for (j = 0; j < cubeVertices; j++) { 37893 cubeN[j] = 1; 37894 } 37895 let k = outputSize, 37896 pos = 1; 37897 for (i = 0; i < inputSize; ++i) { 37898 const domain_2i = domain[i][0]; 37899 const domain_2i_1 = domain[i][1]; 37900 const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1); 37901 let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]); 37902 const size_i = size[i]; 37903 e = Math.min(Math.max(e, 0), size_i - 1); 37904 const e0 = e < size_i - 1 ? Math.floor(e) : e - 1; 37905 const n0 = e0 + 1 - e; 37906 const n1 = e - e0; 37907 const offset0 = e0 * k; 37908 const offset1 = offset0 + k; 37909 for (j = 0; j < cubeVertices; j++) { 37910 if (j & pos) { 37911 cubeN[j] *= n1; 37912 cubeVertex[j] += offset1; 37913 } else { 37914 cubeN[j] *= n0; 37915 cubeVertex[j] += offset0; 37916 } 37917 } 37918 k *= size_i; 37919 pos <<= 1; 37920 } 37921 for (j = 0; j < outputSize; ++j) { 37922 let rj = 0; 37923 for (i = 0; i < cubeVertices; i++) { 37924 rj += samples[cubeVertex[i] + j] * cubeN[i]; 37925 } 37926 rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]); 37927 dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]); 37928 } 37929 }; 37930 } 37931 static constructInterpolated({ 37932 xref, 37933 isEvalSupported, 37934 dict 37935 }) { 37936 const c0 = toNumberArray(dict.getArray("C0")) || [0]; 37937 const c1 = toNumberArray(dict.getArray("C1")) || [1]; 37938 const n = dict.get("N"); 37939 const diff = []; 37940 for (let i = 0, ii = c0.length; i < ii; ++i) { 37941 diff.push(c1[i] - c0[i]); 37942 } 37943 const length = diff.length; 37944 return function constructInterpolatedFn(src, srcOffset, dest, destOff
37944set) { 37945 const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n; 37946 for (let j = 0; j < length; ++j) { 37947 dest[destOffset + j] = c0[j] + x * diff[j]; 37948 } 37949 }; 37950 } 37951 static constructStiched({ 37952 xref, 37953 isEvalSupported, 37954 dict 37955 }) { 37956 const domain = toNumberArray(dict.getArray("Domain")); 37957 if (!domain) { 37958 throw new _util.FormatError("No domain"); 37959 } 37960 const inputSize = domain.length / 2; 37961 if (inputSize !== 1) { 37962 throw new _util.FormatError("Bad domain for stiched function"); 37963 } 37964 const fns = []; 37965 for (const fn of dict.get("Functions")) { 37966 fns.push(this.parse({ 37967 xref, 37968 isEvalSupported, 37969 fn: xref.fetchIfRef(fn) 37970 })); 37971 } 37972 const bounds = toNumberArray(dict.getArray("Bounds")); 37973 const encode = toNumberArray(dict.getArray("Encode")); 37974 const tmpBuf = new Float32Array(1); 37975 return function constructStichedFn(src, srcOffset, dest, destOffset) { 37976 const clip = function constructStichedFromIRClip(v, min, max) { 37977 if (v > max) { 37978 v = max; 37979 } else if (v < min) { 37980 v = min; 37981 } 37982 return v; 37983 }; 37984 const v = clip(src[srcOffset], domain[0], domain[1]); 37985 const length = bounds.length; 37986 let i; 37987 for (i = 0; i < length; ++i) { 37988 if (v < bounds[i]) { 37989 break; 37990 } 37991 } 37992 let dmin = domain[0]; 37993 if (i > 0) { 37994 dmin = bounds[i - 1]; 37995 } 37996 let dmax = domain[1]; 37997 if (i < bounds.length) { 37998 dmax = bounds[i]; 37999 } 38000 const rmin = encode[2 * i]; 38001 const rmax = encode[2 * i + 1]; 38002 tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); 38003 fns[i](tmpBuf, 0, dest, destOffset); 38004 }; 38005 } 38006 static constructPostScript({ 38007 xref, 38008 isEvalSupported, 38009 fn, 38010 dict 38011 }) { 38012 const domain = toNumberArray(dict.getArray("Domain")); 38013 const range = toNumberArray(dict.getArray("Range")); 38014 if (!domain) { 38015 throw new _util.FormatError("No domain."); 38016 } 38017 if (!range) { 38018 throw new _util.FormatError("No range."); 38019 } 38020 const lexer = new _ps_parser.PostScriptLexer(fn); 38021 const parser = new _ps_parser.PostScriptParser(lexer); 38022 const code = parser.parse(); 38023 if (isEvalSupported && _util.FeatureTest.isEvalSupported) { 38024 const compiled = new PostScriptCompiler().compile(code, domain, range); 38025 if (compiled) { 38026 return new Function("src", "srcOffset", "dest", "destOffset", compiled); 38027 } 38028 } 38029 (0, _util.info)("Unable to compile PS function"); 38030 const numOutputs = range.length >> 1; 38031 const numInputs = domain.length >> 1; 38032 const evaluator = new PostScriptEvaluator(code); 38033 const cache = Object.create(null); 38034 const MAX_CACHE_SIZE = 2048 * 4; 38035 let cache_available = MAX_CACHE_SIZE; 38036 const tmpBuf = new Float32Array(numInputs); 38037 return function constructPostScriptFn(src, srcOffset, dest, destOffset) { 38038 let i, value; 38039 let key = ""; 38040 const input = tmpBuf; 38041 for (i = 0; i < numInputs; i++) { 38042 value = src[srcOffset + i]; 38043 input[i] = value; 38044 key += value + "_"; 38045 } 38046 const cachedValue = cache[key]; 38047 if (cachedValue !== undefined) { 38048 dest.set(cachedValue, destOffset); 38049 return; 38050 } 38051 const output = new Float32Array(numOutputs); 38052 const stack = evaluator.execute(input); 38053 const stackIndex = stack.length - numOutputs; 38054 for (i = 0; i < numOutputs; i++) { 38055 value = stack[stackIndex + i]; 38056 let bound = range[i * 2]; 38057 if (value < bound) { 38058 value = bound; 38059 } else { 38060 bound = range[i * 2 + 1]; 38061 if (value > bound) { 38062 value = bound; 38063 } 38064 } 38065 output[i] = value; 38066 } 38067 if (cache_available > 0) { 38068 cache_available--; 38069 cache[key] = output; 38070 } 38071 dest.set(output, destOffset); 38072 }; 38073 } 38074} 38075function isPDFFunction(v) { 38076 let fnDict; 38077 if (v instanceof _primitives.Dict) { 38078 fnDict = v; 38079 } else if (v instanceof _base_stream.BaseStream) { 38080 fnDict = v.dict; 38081 } else { 38082 return false;
vendor: 7,308 bytes, lines 38083-38375
38083 } 38084 return fnDict.has("FunctionType"); 38085} 38086class PostScriptStack { 38087 static MAX_STACK_SIZE = 100; 38088 constructor(initialStack) { 38089 this.stack = initialStack ? Array.from(initialStack) : []; 38090 } 38091 push(value) { 38092 if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) { 38093 throw new Error("PostScript function stack overflow."); 38094 } 38095 this.stack.push(value); 38096 } 38097 pop() { 38098 if (this.stack.length <= 0) { 38099 throw new Error("PostScript function stack underflow."); 38100 } 38101 return this.stack.pop(); 38102 } 38103 copy(n) { 38104 if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) { 38105 throw new Error("PostScript function stack overflow."); 38106 } 38107 const stack = this.stack; 38108 for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) { 38109 stack.push(stack[i]); 38110 } 38111 } 38112 index(n) { 38113 this.push(this.stack[this.stack.length - n - 1]); 38114 } 38115 roll(n, p) { 38116 const stack = this.stack; 38117 const l = stack.length - n; 38118 const r = stack.length - 1; 38119 const c = l + (p - Math.floor(p / n) * n); 38120 for (let i = l, j = r; i < j; i++, j--) { 38121 const t = stack[i]; 38122 stack[i] = stack[j]; 38123 stack[j] = t; 38124 } 38125 for (let i = l, j = c - 1; i < j; i++, j--) { 38126 const t = stack[i]; 38127 stack[i] = stack[j]; 38128 stack[j] = t; 38129 } 38130 for (let i = c, j = r; i < j; i++, j--) { 38131 const t = stack[i]; 38132 stack[i] = stack[j]; 38133 stack[j] = t; 38134 } 38135 } 38136} 38137class PostScriptEvaluator { 38138 constructor(operators) { 38139 this.operators = operators; 38140 } 38141 execute(initialStack) { 38142 const stack = new PostScriptStack(initialStack); 38143 let counter = 0; 38144 const operators = this.operators; 38145 const length = operators.length; 38146 let operator, a, b; 38147 while (counter < length) { 38148 operator = operators[counter++]; 38149 if (typeof operator === "number") { 38150 stack.push(operator); 38151 continue; 38152 } 38153 switch (operator) { 38154 case "jz": 38155 b = stack.pop(); 38156 a = stack.pop(); 38157 if (!a) { 38158 counter = b; 38159 } 38160 break; 38161 case "j": 38162 a = stack.pop(); 38163 counter = a; 38164 break; 38165 case "abs": 38166 a = stack.pop(); 38167 stack.push(Math.abs(a)); 38168 break; 38169 case "add": 38170 b = stack.pop(); 38171 a = stack.pop(); 38172 stack.push(a + b); 38173 break; 38174 case "and": 38175 b = stack.pop(); 38176 a = stack.pop(); 38177 if (typeof a === "boolean" && typeof b === "boolean") { 38178 stack.push(a && b); 38179 } else { 38180 stack.push(a & b); 38181 } 38182 break; 38183 case "atan": 38184 b = stack.pop(); 38185 a = stack.pop(); 38186 a = Math.atan2(a, b) / Math.PI * 180; 38187 if (a < 0) { 38188 a += 360; 38189 } 38190 stack.push(a); 38191 break; 38192 case "bitshift": 38193 b = stack.pop(); 38194 a = stack.pop(); 38195 if (a > 0) { 38196 stack.push(a << b); 38197 } else { 38198 stack.push(a >> b); 38199 } 38200 break; 38201 case "ceiling": 38202 a = stack.pop(); 38203 stack.push(Math.ceil(a)); 38204 break; 38205 case "copy": 38206 a = stack.pop(); 38207 stack.copy(a); 38208 break; 38209 case "cos": 38210 a = stack.pop(); 38211 stack.push(Math.cos(a % 360 / 180 * Math.PI)); 38212 break; 38213 case "cvi": 38214 a = stack.pop() | 0; 38215 stack.push(a); 38216 break; 38217 case "cvr": 38218 break; 38219 case "div": 38220 b = stack.pop(); 38221 a = stack.pop(); 38222 stack.push(a / b); 38223 break; 38224 case "dup": 38225 stack.copy(1); 38226 break; 38227 case "eq": 38228 b = stack.pop(); 38229 a = stack.pop(); 38230 stack.push(a === b); 38231 break; 38232 case "exch": 38233 stack.roll(2, 1); 38234 break; 38235 case "exp": 38236 b = stack.pop(); 38237 a = stack.pop(); 38238 stack.push(a ** b); 38239 break; 38240 case "false": 38241 stack.push(false); 38242 break; 38243 case "floor": 38244 a = stack.pop(); 38245 stack.push(Math.floor(a)); 38246 break; 38247 case "ge": 38248 b = stack.pop(); 38249 a = stack.pop(); 38250 stack.push(a >= b); 38251 break; 38252 case "gt": 38253 b = stack.pop(); 38254 a = stack.pop(); 38255 stack.push(a > b); 38256 break; 38257 case "idiv": 38258 b = stack.pop(); 38259 a = stack.pop(); 38260 stack.push(a / b | 0); 38261 break; 38262 case "index": 38263 a = stack.pop(); 38264 stack.index(a); 38265 break; 38266 case "le": 38267 b = stack.pop(); 38268 a = stack.pop(); 38269 stack.push(a <= b); 38270 break; 38271 case "ln": 38272 a = stack.pop(); 38273 stack.push(Math.log(a)); 38274 break; 38275 case "log": 38276 a = stack.pop(); 38277 stack.push(Math.log10(a)); 38278 break; 38279 case "lt": 38280 b = stack.pop(); 38281 a = stack.pop(); 38282 stack.push(a < b); 38283 break; 38284 case "mod": 38285 b = stack.pop(); 38286 a = stack.pop(); 38287 stack.push(a % b); 38288 break; 38289 case "mul": 38290 b = stack.pop(); 38291 a = stack.pop(); 38292 stack.push(a * b); 38293 break; 38294 case "ne": 38295 b = stack.pop(); 38296 a = stack.pop(); 38297 stack.push(a !== b); 38298 break; 38299 case "neg": 38300 a = stack.pop(); 38301 stack.push(-a); 38302 break; 38303 case "not": 38304 a = stack.pop(); 38305 if (typeof a === "boolean") { 38306 stack.push(!a); 38307 } else { 38308 stack.push(~a); 38309 } 38310 break; 38311 case "or": 38312 b = stack.pop(); 38313 a = stack.pop(); 38314 if (typeof a === "boolean" && typeof b === "boolean") { 38315 stack.push(a || b); 38316 } else { 38317 stack.push(a | b); 38318 } 38319 break; 38320 case "pop": 38321 stack.pop(); 38322 break; 38323 case "roll": 38324 b = stack.pop(); 38325 a = stack.pop(); 38326 stack.roll(a, b); 38327 break; 38328 case "round": 38329 a = stack.pop(); 38330 stack.push(Math.round(a)); 38331 break; 38332 case "sin": 38333 a = stack.pop(); 38334 stack.push(Math.sin(a % 360 / 180 * Math.PI)); 38335 break; 38336 case "sqrt": 38337 a = stack.pop(); 38338 stack.push(Math.sqrt(a)); 38339 break; 38340 case "sub": 38341 b = stack.pop(); 38342 a = stack.pop(); 38343 stack.push(a - b); 38344 break; 38345 case "true": 38346 stack.push(true); 38347 break; 38348 case "truncate": 38349 a = stack.pop(); 38350 a = a < 0 ? Math.ceil(a) : Math.floor(a); 38351 stack.push(a); 38352 break; 38353 case "xor": 38354 b = stack.pop(); 38355 a = stack.pop(); 38356 if (typeof a === "boolean" && typeof b === "boolean") { 38357 stack.push(a !== b); 38358 } else { 38359 stack.push(a ^ b); 38360 } 38361 break; 38362 default: 38363 throw new _util.FormatError(`Unknown operator ${operator}`); 38364 } 38365 } 38366 return stack.stack; 38367 } 38368} 38369exports.PostScriptEvaluator = PostScriptEvaluator; 38370class AstNode { 38371 constructor(type) { 38372 this.type = type; 38373 } 38374 visit(visitor) { 38375 (0, _util.unreachable)
vendor: 8,967 bytes, lines 38375-38693
38375("abstract method"); 38376 } 38377} 38378class AstArgument extends AstNode { 38379 constructor(index, min, max) { 38380 super("args"); 38381 this.index = index; 38382 this.min = min; 38383 this.max = max; 38384 } 38385 visit(visitor) { 38386 visitor.visitArgument(this); 38387 } 38388} 38389class AstLiteral extends AstNode { 38390 constructor(number) { 38391 super("literal"); 38392 this.number = number; 38393 this.min = number; 38394 this.max = number; 38395 } 38396 visit(visitor) { 38397 visitor.visitLiteral(this); 38398 } 38399} 38400class AstBinaryOperation extends AstNode { 38401 constructor(op, arg1, arg2, min, max) { 38402 super("binary"); 38403 this.op = op; 38404 this.arg1 = arg1; 38405 this.arg2 = arg2; 38406 this.min = min; 38407 this.max = max; 38408 } 38409 visit(visitor) { 38410 visitor.visitBinaryOperation(this); 38411 } 38412} 38413class AstMin extends AstNode { 38414 constructor(arg, max) { 38415 super("max"); 38416 this.arg = arg; 38417 this.min = arg.min; 38418 this.max = max; 38419 } 38420 visit(visitor) { 38421 visitor.visitMin(this); 38422 } 38423} 38424class AstVariable extends AstNode { 38425 constructor(index, min, max) { 38426 super("var"); 38427 this.index = index; 38428 this.min = min; 38429 this.max = max; 38430 } 38431 visit(visitor) { 38432 visitor.visitVariable(this); 38433 } 38434} 38435class AstVariableDefinition extends AstNode { 38436 constructor(variable, arg) { 38437 super("definition"); 38438 this.variable = variable; 38439 this.arg = arg; 38440 } 38441 visit(visitor) { 38442 visitor.visitVariableDefinition(this); 38443 } 38444} 38445class ExpressionBuilderVisitor { 38446 constructor() { 38447 this.parts = []; 38448 } 38449 visitArgument(arg) { 38450 this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))"); 38451 } 38452 visitVariable(variable) { 38453 this.parts.push("v", variable.index); 38454 } 38455 visitLiteral(literal) { 38456 this.parts.push(literal.number); 38457 } 38458 visitBinaryOperation(operation) { 38459 this.parts.push("("); 38460 operation.arg1.visit(this); 38461 this.parts.push(" ", operation.op, " "); 38462 operation.arg2.visit(this); 38463 this.parts.push(")"); 38464 } 38465 visitVariableDefinition(definition) { 38466 this.parts.push("var "); 38467 definition.variable.visit(this); 38468 this.parts.push(" = "); 38469 definition.arg.visit(this); 38470 this.parts.push(";"); 38471 } 38472 visitMin(max) { 38473 this.parts.push("Math.min("); 38474 max.arg.visit(this); 38475 this.parts.push(", ", max.max, ")"); 38476 } 38477 toString() { 38478 return this.parts.join(""); 38479 } 38480} 38481function buildAddOperation(num1, num2) { 38482 if (num2.type === "literal" && num2.number === 0) { 38483 return num1; 38484 } 38485 if (num1.type === "literal" && num1.number === 0) { 38486 return num2; 38487 } 38488 if (num2.type === "literal" && num1.type === "literal") { 38489 return new AstLiteral(num1.number + num2.number); 38490 } 38491 return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max); 38492} 38493function buildMulOperation(num1, num2) { 38494 if (num2.type === "literal") { 38495 if (num2.number === 0) { 38496 return new AstLiteral(0); 38497 } else if (num2.number === 1) { 38498 return num1; 38499 } else if (num1.type === "literal") { 38500 return new AstLiteral(num1.number * num2.number); 38501 } 38502 } 38503 if (num1.type === "literal") { 38504 if (num1.number === 0) { 38505 return new AstLiteral(0); 38506 } else if (num1.number === 1) { 38507 return num2; 38508 } 38509 } 38510 const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 38511 const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 38512 return new AstBinaryOperation("*", num1, num2, min, max); 38513} 38514function buildSubOperation(num1, num2) { 38515 if (num2.type === "literal") { 38516 if (num2.number === 0) { 38517 return num1; 38518 } else if (num1.type === "literal") { 38519 return new AstLiteral(num1.number - num2.number); 38520 } 38521 } 38522 if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) { 38523 return num2.arg2; 38524 } 38525 return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min); 38526} 38527function buildMinOperation(num1, max) { 38528 if (num1.min >= max) { 38529 return new AstLiteral(max); 38530 } else if (num1.max <= max) { 38531 return num1; 38532 } 38533 return new AstMin(num1, max); 38534} 38535class PostScriptCompiler { 38536 compile(code, domain, range) { 38537 const stack = []; 38538 const instructions = []; 38539 const inputSize = domain.length >> 1, 38540 outputSize = range.length >> 1; 38541 let lastRegister = 0; 38542 let n, j; 38543 let num1, num2, ast1, ast2, tmpVar, item; 38544 for (let i = 0; i < inputSize; i++) { 38545 stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1])); 38546 } 38547 for (let i = 0, ii = code.length; i < ii; i++) { 38548 item = code[i]; 38549 if (typeof item === "number") { 38550 stack.push(new AstLiteral(item)); 38551 continue; 38552 } 38553 switch (item) { 38554 case "add": 38555 if (stack.length < 2) { 38556 return null; 38557 } 38558 num2 = stack.pop(); 38559 num1 = stack.pop(); 38560 stack.push(buildAddOperation(num1, num2)); 38561 break; 38562 case "cvr": 38563 if (stack.length < 1) { 38564 return null; 38565 } 38566 break; 38567 case "mul": 38568 if (stack.length < 2) { 38569 return null; 38570 } 38571 num2 = stack.pop(); 38572 num1 = stack.pop(); 38573 stack.push(buildMulOperation(num1, num2)); 38574 break; 38575 case "sub": 38576 if (stack.length < 2) { 38577 return null; 38578 } 38579 num2 = stack.pop(); 38580 num1 = stack.pop(); 38581 stack.push(buildSubOperation(num1, num2)); 38582 break; 38583 case "exch": 38584 if (stack.length < 2) { 38585 return null; 38586 } 38587 ast1 = stack.pop(); 38588 ast2 = stack.pop(); 38589 stack.push(ast1, ast2); 38590 break; 38591 case "pop": 38592 if (stack.length < 1) { 38593 return null; 38594 } 38595 stack.pop(); 38596 break; 38597 case "index": 38598 if (stack.length < 1) { 38599 return null; 38600 } 38601 num1 = stack.pop(); 38602 if (num1.type !== "literal") { 38603 return null; 38604 } 38605 n = num1.number; 38606 if (n < 0 || !Number.isInteger(n) || stack.length < n) { 38607 return null; 38608 } 38609 ast1 = stack[stack.length - n - 1]; 38610 if (ast1.type === "literal" || ast1.type === "var") { 38611 stack.push(ast1); 38612 break; 38613 } 38614 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 38615 stack[stack.length - n - 1] = tmpVar; 38616 stack.push(tmpVar); 38617 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 38618 break; 38619 case "dup": 38620 if (stack.length < 1) { 38621 return null; 38622 } 38623 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]) { 38624 num1 = stack.pop(); 38625 stack.push(buildMinOperation(num1, code[i + 1])); 38626 i += 6; 38627 break; 38628 } 38629 ast1 = stack.at(-1); 38630 if (ast1.type === "literal" || ast1.type === "var") { 38631 stack.push(ast1); 38632 break; 38633 } 38634 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 38635 stack[stack.length - 1] = tmpVar; 38636 stack.push(tmpVar); 38637 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 38638 break; 38639 case "roll": 38640 if (stack.length < 2) { 38641 return null; 38642 } 38643 num2 = stack.pop(); 38644 num1 = stack.pop(); 38645 if (num2.type !== "literal" || num1.type !== "literal") { 38646 return null; 38647 } 38648 j = num2.number; 38649 n = num1.number; 38650 if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) { 38651 return null; 38652 } 38653 j = (j % n + n) % n; 38654 if (j === 0) { 38655 break; 38656 } 38657 stack.push(...stack.splice(stack.length - n, n - j)); 38658 break; 38659 default: 38660 return null; 38661 } 38662 } 38663 if (stack.length !== outputSize) { 38664 return null; 38665 } 38666 const result = []; 38667 for (const instruction of instructions) { 38668 const statementBuilder = new ExpressionBuilderVisitor(); 38669 instruction.visit(statementBuilder); 38670 result.push(statementBuilder.toString()); 38671 } 38672 for (let i = 0, ii = stack.length; i < ii; i++) { 38673 const expr = stack[i], 38674 statementBuilder = new ExpressionBuilderVisitor(); 38675 expr.visit(statementBuilder); 38676 const min = range[i * 2], 38677 max = range[i * 2 + 1]; 38678 const out = [statementBuilder.toString()]; 38679 if (min > expr.min) { 38680 out.unshift("Math.max(", min, ", "); 38681 out.push(")"); 38682 } 38683 if (max < expr.max) { 38684 out.unshift("Math.min(", max, ", "); 38685 out.push(")"); 38686 } 38687 out.unshift("dest[destOffset + ", i, "] = "); 38688 out.push(";"); 38689 result.push(out.join("")); 38690 } 38691 return result.join("\n"); 38692 } 38693}
vendor: 5,075 bytes, lines 38694-38875
38694exports.PostScriptCompiler = PostScriptCompiler; 38695 38696/***/ }), 38697/* 58 */ 38698/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 38699 38700 38701 38702Object.defineProperty(exports, "__esModule", ({ 38703 value: true 38704})); 38705exports.PostScriptParser = exports.PostScriptLexer = void 0; 38706var _util = __w_pdfjs_require__(2); 38707var _primitives = __w_pdfjs_require__(4); 38708var _core_utils = __w_pdfjs_require__(3); 38709class PostScriptParser { 38710 constructor(lexer) { 38711 this.lexer = lexer; 38712 this.operators = []; 38713 this.token = null; 38714 this.prev = null; 38715 } 38716 nextToken() { 38717 this.prev = this.token; 38718 this.token = this.lexer.getToken(); 38719 } 38720 accept(type) { 38721 if (this.token.type === type) { 38722 this.nextToken(); 38723 return true; 38724 } 38725 return false; 38726 } 38727 expect(type) { 38728 if (this.accept(type)) { 38729 return true; 38730 } 38731 throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`); 38732 } 38733 parse() { 38734 this.nextToken(); 38735 this.expect(PostScriptTokenTypes.LBRACE); 38736 this.parseBlock(); 38737 this.expect(PostScriptTokenTypes.RBRACE); 38738 return this.operators; 38739 } 38740 parseBlock() { 38741 while (true) { 38742 if (this.accept(PostScriptTokenTypes.NUMBER)) { 38743 this.operators.push(this.prev.value); 38744 } else if (this.accept(PostScriptTokenTypes.OPERATOR)) { 38745 this.operators.push(this.prev.value); 38746 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 38747 this.parseCondition(); 38748 } else { 38749 return; 38750 } 38751 } 38752 } 38753 parseCondition() { 38754 const conditionLocation = this.operators.length; 38755 this.operators.push(null, null); 38756 this.parseBlock(); 38757 this.expect(PostScriptTokenTypes.RBRACE); 38758 if (this.accept(PostScriptTokenTypes.IF)) { 38759 this.operators[conditionLocation] = this.operators.length; 38760 this.operators[conditionLocation + 1] = "jz"; 38761 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 38762 const jumpLocation = this.operators.length; 38763 this.operators.push(null, null); 38764 const endOfTrue = this.operators.length; 38765 this.parseBlock(); 38766 this.expect(PostScriptTokenTypes.RBRACE); 38767 this.expect(PostScriptTokenTypes.IFELSE); 38768 this.operators[jumpLocation] = this.operators.length; 38769 this.operators[jumpLocation + 1] = "j"; 38770 this.operators[conditionLocation] = endOfTrue; 38771 this.operators[conditionLocation + 1] = "jz"; 38772 } else { 38773 throw new _util.FormatError("PS Function: error parsing conditional."); 38774 } 38775 } 38776} 38777exports.PostScriptParser = PostScriptParser; 38778const PostScriptTokenTypes = { 38779 LBRACE: 0, 38780 RBRACE: 1, 38781 NUMBER: 2, 38782 OPERATOR: 3, 38783 IF: 4, 38784 IFELSE: 5 38785}; 38786class PostScriptToken { 38787 static get opCache() { 38788 return (0, _util.shadow)(this, "opCache", Object.create(null)); 38789 } 38790 constructor(type, value) { 38791 this.type = type; 38792 this.value = value; 38793 } 38794 static getOperator(op) { 38795 return PostScriptToken.opCache[op] ||= new PostScriptToken(PostScriptTokenTypes.OPERATOR, op); 38796 } 38797 static get LBRACE() { 38798 return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{")); 38799 } 38800 static get RBRACE() { 38801 return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}")); 38802 } 38803 static get IF() { 38804 return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF")); 38805 } 38806 static get IFELSE() { 38807 return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE")); 38808 } 38809} 38810class PostScriptLexer { 38811 constructor(stream) { 38812 this.stream = stream; 38813 this.nextChar(); 38814 this.strBuf = []; 38815 } 38816 nextChar() { 38817 return this.currentChar = this.stream.getByte(); 38818 } 38819 getToken() { 38820 let comment = false; 38821 let ch = this.currentChar; 38822 while (true) { 38823 if (ch < 0) { 38824 return _primitives.EOF; 38825 } 38826 if (comment) { 38827 if (ch === 0x0a || ch === 0x0d) { 38828 comment = false; 38829 } 38830 } else if (ch === 0x25) { 38831 comment = true; 38832 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 38833 break; 38834 } 38835 ch = this.nextChar(); 38836 } 38837 switch (ch | 0) { 38838 case 0x30: 38839 case 0x31: 38840 case 0x32: 38841 case 0x33: 38842 case 0x34: 38843 case 0x35: 38844 case 0x36: 38845 case 0x37: 38846 case 0x38: 38847 case 0x39: 38848 case 0x2b: 38849 case 0x2d: 38850 case 0x2e: 38851 return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber()); 38852 case 0x7b: 38853 this.nextChar(); 38854 return PostScriptToken.LBRACE; 38855 case 0x7d: 38856 this.nextChar(); 38857 return PostScriptToken.RBRACE; 38858 } 38859 const strBuf = this.strBuf; 38860 strBuf.length = 0; 38861 strBuf[0] = String.fromCharCode(ch); 38862 while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) { 38863 strBuf.push(String.fromCharCode(ch)); 38864 } 38865 const str = strBuf.join(""); 38866 switch (str.toLowerCase()) { 38867 case "if": 38868 return PostScriptToken.IF; 38869 case "ifelse": 38870 return PostScriptToken.IFELSE; 38871 default: 38872 return PostScriptToken.getOperator(str); 38873 } 38874 } 38875 getNumber() {
38876 let ch = this.currentChar; 38877 const strBuf = this.strBuf; 38878 strBuf.length = 0; 38879 strBuf[0] = String.fromCharCode(ch); 38880 while ((ch = this.nextChar()) >= 0) { 38881 if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) { 38882 strBuf.push(String.fromCharCode(ch)); 38883 } else { 38884 break; 38885 } 38886 } 38887 const value = parseFloat(strBuf.join("")); 38888 if (isNaN(value)) { 38889 throw new _util.FormatError(`Invalid floating point number: ${value}`); 38890 } 38891 return value; 38892 } 38893} 38894exports.PostScriptLexer = PostScriptLexer; 38895 38896/***/ }), 38897/* 59 */ 38898/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 38899 38900 38901 38902Object.defineProperty(exports, "__esModule", ({ 38903 value: true 38904})); 38905exports.RegionalImageCache = exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0; 38906var _util = __w_pdfjs_require__(2); 38907var _primitives = __w_pdfjs_require__(4); 38908class BaseLocalCache { 38909 constructor(options) { 38910 if (this.constructor === BaseLocalCache) { 38911 (0, _util.unreachable)("Cannot initialize BaseLocalCache."); 38912 } 38913 this._onlyRefs = options?.onlyRefs === true; 38914 if (!this._onlyRefs) { 38915 this._nameRefMap = new Map(); 38916 this._imageMap = new Map(); 38917 } 38918 this._imageCache = new _primitives.RefSetCache(); 38919 } 38920 getByName(name) { 38921 if (this._onlyRefs) { 38922 (0, _util.unreachable)("Should not call `getByName` method."); 38923 } 38924 const ref = this._nameRefMap.get(name); 38925 if (ref) { 38926 return this.getByRef(ref); 38927 } 38928 return this._imageMap.get(name) || null; 38929 } 38930 getByRef(ref) { 38931 return this._imageCache.get(ref) || null; 38932 } 38933 set(name, ref, data) { 38934 (0, _util.unreachable)("Abstract method `set` called."); 38935 } 38936} 38937class LocalImageCache extends BaseLocalCache { 38938 set(name, ref = null, data) { 38939 if (typeof name !== "string") { 38940 throw new Error('LocalImageCache.set - expected "name" argument.'); 38941 } 38942 if (ref) { 38943 if (this._imageCache.has(ref)) { 38944 return; 38945 } 38946 this._nameRefMap.set(name, ref); 38947 this._imageCache.put(ref, data); 38948 return; 38949 } 38950 if (this._imageMap.has(name)) { 38951 return; 38952 } 38953 this._imageMap.set(name, data); 38954 } 38955} 38956exports.LocalImageCache = LocalImageCache; 38957class LocalColorSpaceCache extends BaseLocalCache { 38958 set(name = null, ref = null, data) { 38959 if (typeof name !== "string" && !ref) { 38960 throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.'); 38961 } 38962 if (ref) { 38963 if (this._imageCache.has(ref)) { 38964 return; 38965 } 38966 if (name !== null) { 38967 this._nameRefMap.set(name, ref); 38968 } 38969 this._imageCache.put(ref, data); 38970 return; 38971 } 38972 if (this._imageMap.has(name)) { 38973 return; 38974 } 38975 this._imageMap.set(name, data); 38976 } 38977} 38978exports.LocalColorSpaceCache = LocalColorSpaceCache; 38979class LocalFunctionCache extends BaseLocalCache { 38980 constructor(options) { 38981 super({ 38982 onlyRefs: true 38983 }); 38984 } 38985 set(name = null, ref, data) { 38986 if (!ref) { 38987 throw new Error('LocalFunctionCache.set - expected "ref" argument.'); 38988 } 38989 if (this._imageCache.has(ref)) { 38990 return; 38991 } 38992 this._imageCache.put(ref, data); 38993 } 38994} 38995exports.LocalFunctionCache = LocalFunctionCache; 38996class LocalGStateCache extends BaseLocalCache { 38997 set(name, ref = null, data) { 38998 if (typeof name !== "string") { 38999 throw new Error('LocalGStateCache.set - expected "name" argument.'); 39000 } 39001 if (ref) { 39002 if (this._imageCache.has(ref)) { 39003 return; 39004 } 39005 this._nameRefMap.set(name, ref); 39006 this._imageCache.put(ref, data); 39007 return; 39008 } 39009 if (this._imageMap.has(name)) { 39010 return; 39011 } 39012 this._imageMap.set(name, data); 39013 } 39014} 39015exports.LocalGStateCache = LocalGStateCache; 39016class LocalTilingPatternCache extends BaseLocalCache { 39017 constructor(options) { 39018 super({ 39019 onlyRefs: true 39020 }); 39021 } 39022 set(name = null, ref, data) { 39023 if (!ref) { 39024 throw new Error('LocalTilingPatternCache.set - expected "ref" argument.'); 39025 } 39026 if (this._imageCache.has(ref)) { 39027 return; 39028 } 39029 this._imageCache.put(ref, data); 39030 } 39031} 39032exports.LocalTilingPatternCache = LocalTilingPatternCache; 39033class RegionalImageCache extends BaseLocalCache { 39034 constructor(options) { 39035 super({ 39036 onlyRefs: true 39037 }); 39038 } 39039 set(name = null, ref, data) { 39040 if (!ref) { 39041 throw new Error('RegionalImageCache.set - expected "ref" argument.'); 39042 } 39043 if (this._imageCache.has(ref)) { 39044 return; 39045 } 39046 this._imageCache.put(ref, data); 39047 } 39048} 39049exports.RegionalImageCache = RegionalImageCache; 39050class GlobalImageCache { 39051 static NUM_PAGES_THRESHOLD = 2; 39052 static MIN_IMAGES_TO_CACHE = 10; 39053 static MAX_BYTE_SIZE = 5 * _util.MAX_IMAGE_SIZE_TO_CACHE; 39054 constructor() { 39055 this._refCache = new _primitives.RefSetCache(); 39056 this._imageCache = new _primitives.RefSetCache(); 39057 } 39058 get _byteSize() { 39059 let byteSize = 0; 39060 for (const imageData of this._imageCache) { 39061 byteSize += imageData.byteSize; 39062 } 39063 return byteSize; 39064 } 39065 get _cacheLimitReached() { 39066 if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) { 39067 return false;
vendor: 16,515 bytes, lines 39068-39596
39068 } 39069 if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) { 39070 return false; 39071 } 39072 return true; 39073 } 39074 shouldCache(ref, pageIndex) { 39075 let pageIndexSet = this._refCache.get(ref); 39076 if (!pageIndexSet) { 39077 pageIndexSet = new Set(); 39078 this._refCache.put(ref, pageIndexSet); 39079 } 39080 pageIndexSet.add(pageIndex); 39081 if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { 39082 return false; 39083 } 39084 if (!this._imageCache.has(ref) && this._cacheLimitReached) { 39085 return false; 39086 } 39087 return true; 39088 } 39089 addByteSize(ref, byteSize) { 39090 const imageData = this._imageCache.get(ref); 39091 if (!imageData) { 39092 return; 39093 } 39094 if (imageData.byteSize) { 39095 return; 39096 } 39097 imageData.byteSize = byteSize; 39098 } 39099 getData(ref, pageIndex) { 39100 const pageIndexSet = this._refCache.get(ref); 39101 if (!pageIndexSet) { 39102 return null; 39103 } 39104 if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { 39105 return null; 39106 } 39107 const imageData = this._imageCache.get(ref); 39108 if (!imageData) { 39109 return null; 39110 } 39111 pageIndexSet.add(pageIndex); 39112 return imageData; 39113 } 39114 setData(ref, data) { 39115 if (!this._refCache.has(ref)) { 39116 throw new Error('GlobalImageCache.setData - expected "shouldCache" to have been called.'); 39117 } 39118 if (this._imageCache.has(ref)) { 39119 return; 39120 } 39121 if (this._cacheLimitReached) { 39122 (0, _util.warn)("GlobalImageCache.setData - cache limit reached."); 39123 return; 39124 } 39125 this._imageCache.put(ref, data); 39126 } 39127 clear(onlyData = false) { 39128 if (!onlyData) { 39129 this._refCache.clear(); 39130 } 39131 this._imageCache.clear(); 39132 } 39133} 39134exports.GlobalImageCache = GlobalImageCache; 39135 39136/***/ }), 39137/* 60 */ 39138/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 39139 39140 39141 39142Object.defineProperty(exports, "__esModule", ({ 39143 value: true 39144})); 39145exports.bidi = bidi; 39146var _util = __w_pdfjs_require__(2); 39147const 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"]; 39148const 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"]; 39149function isOdd(i) { 39150 return (i & 1) !== 0; 39151} 39152function isEven(i) { 39153 return (i & 1) === 0; 39154} 39155function findUnequal(arr, start, value) { 39156 let j, jj; 39157 for (j = start, jj = arr.length; j < jj; ++j) { 39158 if (arr[j] !== value) { 39159 return j; 39160 } 39161 } 39162 return j; 39163} 39164function setValues(arr, start, end, value) { 39165 for (let j = start; j < end; ++j) { 39166 arr[j] = value; 39167 } 39168} 39169function reverseValues(arr, start, end) { 39170 for (let i = start, j = end - 1; i < j; ++i, --j) { 39171 const temp = arr[i]; 39172 arr[i] = arr[j]; 39173 arr[j] = temp; 39174 } 39175} 39176function createBidiText(str, isLTR, vertical = false) { 39177 let dir = "ltr"; 39178 if (vertical) { 39179 dir = "ttb"; 39180 } else if (!isLTR) { 39181 dir = "rtl"; 39182 } 39183 return { 39184 str, 39185 dir 39186 }; 39187} 39188const chars = []; 39189const types = []; 39190function bidi(str, startLevel = -1, vertical = false) { 39191 let isLTR = true; 39192 const strLength = str.length; 39193 if (strLength === 0 || vertical) { 39194 return createBidiText(str, isLTR, vertical); 39195 } 39196 chars.length = strLength; 39197 types.length = strLength; 39198 let numBidi = 0; 39199 let i, ii; 39200 for (i = 0; i < strLength; ++i) { 39201 chars[i] = str.charAt(i); 39202 const charCode = str.charCodeAt(i); 39203 let charType = "L"; 39204 if (charCode <= 0x00ff) { 39205 charType = baseTypes[charCode]; 39206 } else if (0x0590 <= charCode && charCode <= 0x05f4) { 39207 charType = "R"; 39208 } else if (0x0600 <= charCode && charCode <= 0x06ff) { 39209 charType = arabicTypes[charCode & 0xff]; 39210 if (!charType) { 39211 (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16)); 39212 } 39213 } else if (0x0700 <= charCode && charCode <= 0x08ac || 0xfb50 <= charCode && charCode <= 0xfdff || 0xfe70 <= charCode && charCode <= 0xfeff) { 39214 charType = "AL"; 39215 } 39216 if (charType === "R" || charType === "AL" || charType === "AN") { 39217 numBidi++; 39218 } 39219 types[i] = charType; 39220 } 39221 if (numBidi === 0) { 39222 isLTR = true; 39223 return createBidiText(str, isLTR); 39224 } 39225 if (startLevel === -1) { 39226 if (numBidi / strLength < 0.3 && strLength > 4) { 39227 isLTR = true; 39228 startLevel = 0; 39229 } else { 39230 isLTR = false; 39231 startLevel = 1; 39232 } 39233 } 39234 const levels = []; 39235 for (i = 0; i < strLength; ++i) { 39236 levels[i] = startLevel; 39237 } 39238 const e = isOdd(startLevel) ? "R" : "L"; 39239 const sor = e; 39240 const eor = sor; 39241 let lastType = sor; 39242 for (i = 0; i < strLength; ++i) { 39243 if (types[i] === "NSM") { 39244 types[i] = lastType; 39245 } else { 39246 lastType = types[i]; 39247 } 39248 } 39249 lastType = sor; 39250 let t; 39251 for (i = 0; i < strLength; ++i) { 39252 t = types[i]; 39253 if (t === "EN") { 39254 types[i] = lastType === "AL" ? "AN" : "EN"; 39255 } else if (t === "R" || t === "L" || t === "AL") { 39256 lastType = t; 39257 } 39258 } 39259 for (i = 0; i < strLength; ++i) { 39260 t = types[i]; 39261 if (t === "AL") { 39262 types[i] = "R"; 39263 } 39264 } 39265 for (i = 1; i < strLength - 1; ++i) { 39266 if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") { 39267 types[i] = "EN"; 39268 } 39269 if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) { 39270 types[i] = types[i - 1]; 39271 } 39272 } 39273 for (i = 0; i < strLength; ++i) { 39274 if (types[i] === "EN") { 39275 for (let j = i - 1; j >= 0; --j) { 39276 if (types[j] !== "ET") { 39277 break; 39278 } 39279 types[j] = "EN"; 39280 } 39281 for (let j = i + 1; j < strLength; ++j) { 39282 if (types[j] !== "ET") { 39283 break; 39284 } 39285 types[j] = "EN"; 39286 } 39287 } 39288 } 39289 for (i = 0; i < strLength; ++i) { 39290 t = types[i]; 39291 if (t === "WS" || t === "ES" || t === "ET" || t === "CS") { 39292 types[i] = "ON"; 39293 } 39294 } 39295 lastType = sor; 39296 for (i = 0; i < strLength; ++i) { 39297 t = types[i]; 39298 if (t === "EN") { 39299 types[i] = lastType === "L" ? "L" : "EN"; 39300 } else if (t === "R" || t === "L") { 39301 lastType = t; 39302 } 39303 } 39304 for (i = 0; i < strLength; ++i) { 39305 if (types[i] === "ON") { 39306 const end = findUnequal(types, i + 1, "ON"); 39307 let before = sor; 39308 if (i > 0) { 39309 before = types[i - 1]; 39310 } 39311 let after = eor; 39312 if (end + 1 < strLength) { 39313 after = types[end + 1]; 39314 } 39315 if (before !== "L") { 39316 before = "R"; 39317 } 39318 if (after !== "L") { 39319 after = "R"; 39320 } 39321 if (before === after) { 39322 setValues(types, i, end, before); 39323 } 39324 i = end - 1; 39325 } 39326 } 39327 for (i = 0; i < strLength; ++i) { 39328 if (types[i] === "ON") { 39329 types[i] = e; 39330 } 39331 } 39332 for (i = 0; i < strLength; ++i) { 39333 t = types[i]; 39334 if (isEven(levels[i])) { 39335 if (t === "R") { 39336 levels[i] += 1; 39337 } else if (t === "AN" || t === "EN") { 39338 levels[i] += 2; 39339 } 39340 } else if (t === "L" || t === "AN" || t === "EN") { 39341 levels[i] += 1; 39342 } 39343 } 39344 let highestLevel = -1; 39345 let lowestOddLevel = 99; 39346 let level; 39347 for (i = 0, ii = levels.length; i < ii; ++i) { 39348 level = levels[i]; 39349 if (highestLevel < level) { 39350 highestLevel = level; 39351 } 39352 if (lowestOddLevel > level && isOdd(level)) { 39353 lowestOddLevel = level; 39354 } 39355 } 39356 for (level = highestLevel; level >= lowestOddLevel; --level) { 39357 let start = -1; 39358 for (i = 0, ii = levels.length; i < ii; ++i) { 39359 if (levels[i] < level) { 39360 if (start >= 0) { 39361 reverseValues(chars, start, i); 39362 start = -1; 39363 } 39364 } else if (start < 0) { 39365 start = i; 39366 } 39367 } 39368 if (start >= 0) { 39369 reverseValues(chars, start, levels.length); 39370 } 39371 } 39372 for (i = 0, ii = chars.length; i < ii; ++i) { 39373 const ch = chars[i]; 39374 if (ch === "<" || ch === ">") { 39375 chars[i] = ""; 39376 } 39377 } 39378 return createBidiText(chars.join(""), isLTR); 39379} 39380 39381/***/ }), 39382/* 61 */ 39383/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 39384 39385 39386 39387Object.defineProperty(exports, "__esModule", ({ 39388 value: true 39389})); 39390exports.getFontSubstitution = getFontSubstitution; 39391var _fonts_utils = __w_pdfjs_require__(38); 39392var _core_utils = __w_pdfjs_require__(3); 39393const NORMAL = { 39394 style: "normal", 39395 weight: "normal" 39396}; 39397const BOLD = { 39398 style: "normal", 39399 weight: "bold" 39400}; 39401const ITALIC = { 39402 style: "italic", 39403 weight: "normal" 39404}; 39405const BOLDITALIC = { 39406 style: "italic", 39407 weight: "bold" 39408}; 39409const substitutionMap = new Map([["Times-Roman", { 39410 local: ["Times New Roman", "Times-Roman", "Times", "Liberation Serif", "Nimbus Roman", "Nimbus Roman L", "Tinos", "Thorndale", "TeX Gyre Termes", "FreeSerif", "DejaVu Serif", "Bitstream Vera Serif", "Ubuntu"], 39411 style: NORMAL, 39412 ultimate: "serif" 39413}], ["Times-Bold", { 39414 alias: "Times-Roman", 39415 style: BOLD, 39416 ultimate: "serif" 39417}], ["Times-Italic", { 39418 alias: "Times-Roman", 39419 style: ITALIC, 39420 ultimate: "serif" 39421}], ["Times-BoldItalic", { 39422 alias: "Times-Roman", 39423 style: BOLDITALIC, 39424 ultimate: "serif" 39425}], ["Helvetica", { 39426 local: ["Helvetica", "Helvetica Neue", "Arial", "Arial Nova", "Liberation Sans", "Arimo", "Nimbus Sans", "Nimbus Sans L", "A030", "TeX Gyre Heros", "FreeSans", "DejaVu Sans", "Albany", "Bitstream Vera Sans", "Arial Unicode MS", "Microsoft Sans Serif", "Apple Symbols", "Cantarell"], 39427 path: "LiberationSans-Regular.ttf", 39428 style: NORMAL, 39429 ultimate: "sans-serif" 39430}], ["Helvetica-Bold", { 39431 alias: "Helvetica", 39432 path: "LiberationSans-Bold.ttf", 39433 style: BOLD, 39434 ultimate: "sans-serif" 39435}], ["Helvetica-Oblique", { 39436 alias: "Helvetica", 39437 path: "LiberationSans-Italic.ttf", 39438 style: ITALIC, 39439 ultimate: "sans-serif" 39440}], ["Helvetica-BoldOblique", { 39441 alias: "Helvetica", 39442 path: "LiberationSans-BoldItalic.ttf", 39443 style: BOLDITALIC, 39444 ultimate: "sans-serif" 39445}], ["Courier", { 39446 local: ["Courier", "Courier New", "Liberation Mono", "Nimbus Mono", "Nimbus Mono L", "Cousine", "Cumberland", "TeX Gyre Cursor", "FreeMono"], 39447 style: NORMAL, 39448 ultimate: "monospace" 39449}], ["Courier-Bold", { 39450 alias: "Courier", 39451 style: BOLD, 39452 ultimate: "monospace" 39453}], ["Courier-Oblique", { 39454 alias: "Courier", 39455 style: ITALIC, 39456 ultimate: "monospace" 39457}], ["Courier-BoldOblique", { 39458 alias: "Courier", 39459 style: BOLDITALIC, 39460 ultimate: "monospace" 39461}], ["ArialBlack", { 39462 local: ["Arial Black"], 39463 style: { 39464 style: "normal", 39465 weight: "900" 39466 }, 39467 fallback: "Helvetica-Bold" 39468}], ["ArialBlack-Bold", { 39469 alias: "ArialBlack" 39470}], ["ArialBlack-Italic", { 39471 alias: "ArialBlack", 39472 style: { 39473 style: "italic", 39474 weight: "900" 39475 }, 39476 fallback: "Helvetica-BoldOblique" 39477}], ["ArialBlack-BoldItalic", { 39478 alias: "ArialBlack-Italic" 39479}], ["ArialNarrow", { 39480 local: ["Arial Narrow", "Liberation Sans Narrow", "Helvetica Condensed", "Nimbus Sans Narrow", "TeX Gyre Heros Cn"], 39481 style: NORMAL, 39482 fallback: "Helvetica" 39483}], ["ArialNarrow-Bold", { 39484 alias: "ArialNarrow", 39485 style: BOLD, 39486 fallback: "Helvetica-Bold" 39487}], ["ArialNarrow-Italic", { 39488 alias: "ArialNarrow", 39489 style: ITALIC, 39490 fallback: "Helvetica-Oblique" 39491}], ["ArialNarrow-BoldItalic", { 39492 alias: "ArialNarrow", 39493 style: BOLDITALIC, 39494 fallback: "Helvetica-BoldOblique" 39495}], ["Calibri", { 39496 local: ["Calibri", "Carlito"], 39497 style: NORMAL, 39498 fallback: "Helvetica" 39499}], ["Calibri-Bold", { 39500 alias: "Calibri", 39501 style: BOLD, 39502 fallback: "Helvetica-Bold" 39503}], ["Calibri-Italic", { 39504 alias: "Calibri", 39505 style: ITALIC, 39506 fallback: "Helvetica-Oblique" 39507}], ["Calibri-BoldItalic", { 39508 alias: "Calibri", 39509 style: BOLDITALIC, 39510 fallback: "Helvetica-BoldOblique" 39511}], ["Wingdings", { 39512 local: ["Wingdings", "URW Dingbats"], 39513 style: NORMAL 39514}], ["Wingdings-Regular", { 39515 alias: "Wingdings" 39516}], ["Wingdings-Bold", { 39517 alias: "Wingdings" 39518}]]); 39519const fontAliases = new Map([["Arial-Black", "ArialBlack"]]); 39520function getStyleToAppend(style) { 39521 switch (style) { 39522 case BOLD: 39523 return "Bold"; 39524 case ITALIC: 39525 return "Italic"; 39526 case BOLDITALIC: 39527 return "Bold Italic"; 39528 default: 39529 if (style?.weight === "bold") { 39530 return "Bold"; 39531 } 39532 if (style?.style === "italic") { 39533 return "Italic"; 39534 } 39535 } 39536 return ""; 39537} 39538function generateFont({ 39539 alias, 39540 local, 39541 path, 39542 fallback, 39543 style, 39544 ultimate 39545}, src, localFontPath, useFallback = true, usePath = true, append = "") { 39546 const result = { 39547 style: null, 39548 ultimate: null 39549 }; 39550 if (local) { 39551 const extra = append ? ` ${append}` : ""; 39552 for (const name of local) { 39553 src.push(`local(${name}${extra})`); 39554 } 39555 } 39556 if (alias) { 39557 const substitution = substitutionMap.get(alias); 39558 const aliasAppend = append || getStyleToAppend(style); 39559 Object.assign(result, generateFont(substitution, src, localFontPath, useFallback && !fallback, usePath && !path, aliasAppend)); 39560 } 39561 if (style) { 39562 result.style = style; 39563 } 39564 if (ultimate) { 39565 result.ultimate = ultimate; 39566 } 39567 if (useFallback && fallback) { 39568 const fallbackInfo = substitutionMap.get(fallback); 39569 const { 39570 ultimate: fallbackUltimate 39571 } = generateFont(fallbackInfo, src, localFontPath, useFallback, usePath && !path, append); 39572 result.ultimate ||= fallbackUltimate; 39573 } 39574 if (usePath && path && localFontPath) { 39575 src.push(`url(${localFontPath}${path})`); 39576 } 39577 return result; 39578} 39579function getFontSubstitution(systemFontCache, idFactory, localFontPath, baseFontName, standardFontName) { 39580 baseFontName = (0, _fonts_utils.normalizeFontName)(baseFontName); 39581 const key = baseFontName; 39582 let substitutionInfo = systemFontCache.get(key); 39583 if (substitutionInfo) { 39584 return substitutionInfo; 39585 } 39586 let substitution = substitutionMap.get(baseFontName); 39587 if (!substitution) { 39588 for (const [alias, subst] of fontAliases) { 39589 if (baseFontName.startsWith(alias)) { 39590 baseFontName = `${subst}${baseFontName.substring(alias.length)}`; 39591 substitution = substitutionMap.get(baseFontName); 39592 break; 39593 } 39594 } 39595 } 39596 let mustAddBaseFont = false;
39597 if (!substitution) { 39598 substitution = substitutionMap.get(standardFontName); 39599 mustAddBaseFont = true; 39600 } 39601 const loadedName = `${idFactory.getDocId()}_s${idFactory.createFontId()}`; 39602 if (!substitution) { 39603 if (!(0, _core_utils.validateFontName)(baseFontName)) { 39604 systemFontCache.set(key, null); 39605 return null; 39606 } 39607 const bold = /bold/gi.test(baseFontName); 39608 const italic = /oblique|italic/gi.test(baseFontName); 39609 const style = bold && italic && BOLDITALIC || bold && BOLD || italic && ITALIC || NORMAL; 39610 substitutionInfo = { 39611 css: loadedName, 39612 guessFallback: true, 39613 loadedName, 39614 baseFontName, 39615 src: `local(${baseFontName})`, 39616 style 39617 }; 39618 systemFontCache.set(key, substitutionInfo); 39619 return substitutionInfo; 39620 } 39621 const src = []; 39622 if (mustAddBaseFont && (0, _core_utils.validateFontName)(baseFontName)) { 39623 src.push(`local(${baseFontName})`); 39624 } 39625 const { 39626 style, 39627 ultimate 39628 } = generateFont(substitution, src, localFontPath); 39629 const guessFallback = ultimate === null; 39630 const fallback = guessFallback ? "" : `,${ultimate}`; 39631 substitutionInfo = { 39632 css: `${loadedName}${fallback}`, 39633 guessFallback, 39634 loadedName, 39635 baseFontName, 39636 src: src.join(","), 39637 style 39638 }; 39639 systemFontCache.set(key, substitutionInfo); 39640 return substitutionInfo; 39641} 39642 39643/***/ }), 39644/* 62 */ 39645/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 39646 39647 39648 39649Object.defineProperty(exports, "__esModule", ({ 39650 value: true 39651})); 39652exports.ImageResizer = void 0; 39653var _util = __w_pdfjs_require__(2); 39654const MIN_IMAGE_DIM = 2048; 39655const MAX_IMAGE_DIM = 65537; 39656const MAX_ERROR = 128; 39657class ImageResizer { 39658 constructor(imgData, isMask) { 39659 this._imgData = imgData; 39660 this._isMask = isMask; 39661 } 39662 static needsToBeResized(width, height) { 39663 if (width <= this._goodSquareLength && height <= this._goodSquareLength) { 39664 return false; 39665 } 39666 const { 39667 MAX_DIM 39668 } = this; 39669 if (width > MAX_DIM || height > MAX_DIM) { 39670 return true; 39671 } 39672 const area = width * height; 39673 if (this._hasMaxArea) { 39674 return area > this.MAX_AREA; 39675 } 39676 if (area < this._goodSquareLength ** 2) { 39677 return false; 39678 } 39679 if (this._areGoodDims(width, height)) { 39680 this._goodSquareLength = Math.max(this._goodSquareLength, Math.floor(Math.sqrt(width * height))); 39681 return false; 39682 } 39683 this._goodSquareLength = this._guessMax(this._goodSquareLength, MAX_DIM, MAX_ERROR, 0); 39684 const maxArea = this.MAX_AREA = this._goodSquareLength ** 2; 39685 return area > maxArea; 39686 } 39687 static get MAX_DIM() { 39688 return (0, _util.shadow)(this, "MAX_DIM", this._guessMax(MIN_IMAGE_DIM, MAX_IMAGE_DIM, 0, 1)); 39689 } 39690 static get MAX_AREA() { 39691 this._hasMaxArea = true; 39692 return (0, _util.shadow)(this, "MAX_AREA", this._guessMax(ImageResizer._goodSquareLength, this.MAX_DIM, MAX_ERROR, 0) ** 2); 39693 } 39694 static set MAX_AREA(area) { 39695 if (area >= 0) { 39696 this._hasMaxArea = true; 39697 (0, _util.shadow)(this, "MAX_AREA", area); 39698 } 39699 } 39700 static setMaxArea(area) { 39701 if (!this._hasMaxArea) { 39702 this.MAX_AREA = area >> 2; 39703 } 39704 } 39705 static _areGoodDims(width, height) { 39706 try { 39707 const canvas = new OffscreenCanvas(width, height); 39708 const ctx = canvas.getContext("2d"); 39709 ctx.fillRect(0, 0, 1, 1); 39710 const opacity = ctx.getImageData(0, 0, 1, 1).data[3]; 39711 canvas.width = canvas.height = 1; 39712 return opacity !== 0; 39713 } catch { 39714 return false; 39715 } 39716 } 39717 static _guessMax(start, end, tolerance, defaultHeight) { 39718 while (start + tolerance + 1 < end) { 39719 const middle = Math.floor((start + end) / 2); 39720 const height = defaultHeight || middle; 39721 if (this._areGoodDims(middle, height)) { 39722 start = middle; 39723 } else { 39724 end = middle; 39725 } 39726 } 39727 return start; 39728 } 39729 static async createImage(imgData, isMask = false) { 39730 return new ImageResizer(imgData, isMask)._createImage(); 39731 } 39732 async _createImage() { 39733 const data = this._encodeBMP(); 39734 const blob = new Blob([data.buffer], { 39735 type: "image/bmp" 39736 }); 39737 const bitmapPromise = createImageBitmap(blob); 39738 const { 39739 MAX_AREA, 39740 MAX_DIM 39741 } = ImageResizer; 39742 const { 39743 _imgData: imgData 39744 } = this; 39745 const { 39746 width, 39747 height 39748 } = imgData; 39749 const minFactor = Math.max(width / MAX_DIM, height / MAX_DIM, Math.sqrt(width * height / MAX_AREA)); 39750 const firstFactor = Math.max(minFactor, 2); 39751 const factor = Math.round(10 * (minFactor + 1.25)) / 10 / firstFactor; 39752 const N = Math.floor(Math.log2(factor)); 39753 const steps = new Array(N + 2).fill(2); 39754 steps[0] = firstFactor; 39755 steps.splice(-1, 1, factor / (1 << N)); 39756 let newWidth = width; 39757 let newHeight = height; 39758 let bitmap = await bitmapPromise; 39759 for (const step of steps) { 39760 const prevWidth = newWidth; 39761 const prevHeight = newHeight; 39762 newWidth = Math.floor(newWidth / step) - 1; 39763 newHeight = Math.floor(newHeight / step) - 1; 39764 const canvas = new OffscreenCanvas(newWidth, newHeight); 39765 const ctx = canvas.getContext("2d"); 39766 ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight); 39767 bitmap = canvas.transferToImageBitmap(); 39768 } 39769 imgData.data = null; 39770 imgData.bitmap = bitmap; 39771 imgData.width = newWidth; 39772 imgData.height = newHeight; 39773 return imgData; 39774 } 39775 _encodeBMP() { 39776 const { 39777 width, 39778 height, 39779 kind 39780 } = this._imgData; 39781 let data = this._imgData.data; 39782 let bitPerPixel;
vendor: 5,198 bytes, lines 39783-39948
39783 let colorTable = new Uint8Array(0); 39784 let maskTable = colorTable; 39785 let compression = 0; 39786 switch (kind) { 39787 case _util.ImageKind.GRAYSCALE_1BPP: 39788 { 39789 bitPerPixel = 1; 39790 colorTable = new Uint8Array(this._isMask ? [255, 255, 255, 255, 0, 0, 0, 0] : [0, 0, 0, 0, 255, 255, 255, 255]); 39791 const rowLen = width + 7 >> 3; 39792 const rowSize = rowLen + 3 & -4; 39793 if (rowLen !== rowSize) { 39794 const newData = new Uint8Array(rowSize * height); 39795 let k = 0; 39796 for (let i = 0, ii = height * rowLen; i < ii; i += rowLen, k += rowSize) { 39797 newData.set(data.subarray(i, i + rowLen), k); 39798 } 39799 data = newData; 39800 } 39801 break; 39802 } 39803 case _util.ImageKind.RGB_24BPP: 39804 { 39805 bitPerPixel = 24; 39806 if (width & 3) { 39807 const rowLen = 3 * width; 39808 const rowSize = rowLen + 3 & -4; 39809 const extraLen = rowSize - rowLen; 39810 const newData = new Uint8Array(rowSize * height); 39811 let k = 0; 39812 for (let i = 0, ii = height * rowLen; i < ii; i += rowLen) { 39813 const row = data.subarray(i, i + rowLen); 39814 for (let j = 0; j < rowLen; j += 3) { 39815 newData[k++] = row[j + 2]; 39816 newData[k++] = row[j + 1]; 39817 newData[k++] = row[j]; 39818 } 39819 k += extraLen; 39820 } 39821 data = newData; 39822 } else { 39823 for (let i = 0, ii = data.length; i < ii; i += 3) { 39824 const tmp = data[i]; 39825 data[i] = data[i + 2]; 39826 data[i + 2] = tmp; 39827 } 39828 } 39829 break; 39830 } 39831 case _util.ImageKind.RGBA_32BPP: 39832 bitPerPixel = 32; 39833 compression = 3; 39834 maskTable = new Uint8Array(4 + 4 + 4 + 4 + 52); 39835 const view = new DataView(maskTable.buffer); 39836 if (_util.FeatureTest.isLittleEndian) { 39837 view.setUint32(0, 0x000000ff, true); 39838 view.setUint32(4, 0x0000ff00, true); 39839 view.setUint32(8, 0x00ff0000, true); 39840 view.setUint32(12, 0xff000000, true); 39841 } else { 39842 view.setUint32(0, 0xff000000, true); 39843 view.setUint32(4, 0x00ff0000, true); 39844 view.setUint32(8, 0x0000ff00, true); 39845 view.setUint32(12, 0x000000ff, true); 39846 } 39847 break; 39848 default: 39849 throw new Error("invalid format"); 39850 } 39851 let i = 0; 39852 const headerLength = 40 + maskTable.length; 39853 const fileLength = 14 + headerLength + colorTable.length + data.length; 39854 const bmpData = new Uint8Array(fileLength); 39855 const view = new DataView(bmpData.buffer); 39856 view.setUint16(i, 0x4d42, true); 39857 i += 2; 39858 view.setUint32(i, fileLength, true); 39859 i += 4; 39860 view.setUint32(i, 0, true); 39861 i += 4; 39862 view.setUint32(i, 14 + headerLength + colorTable.length, true); 39863 i += 4; 39864 view.setUint32(i, headerLength, true); 39865 i += 4; 39866 view.setInt32(i, width, true); 39867 i += 4; 39868 view.setInt32(i, -height, true); 39869 i += 4; 39870 view.setUint16(i, 1, true); 39871 i += 2; 39872 view.setUint16(i, bitPerPixel, true); 39873 i += 2; 39874 view.setUint32(i, compression, true); 39875 i += 4; 39876 view.setUint32(i, 0, true); 39877 i += 4; 39878 view.setInt32(i, 0, true); 39879 i += 4; 39880 view.setInt32(i, 0, true); 39881 i += 4; 39882 view.setUint32(i, colorTable.length / 4, true); 39883 i += 4; 39884 view.setUint32(i, 0, true); 39885 i += 4; 39886 bmpData.set(maskTable, i); 39887 i += maskTable.length; 39888 bmpData.set(colorTable, i); 39889 i += colorTable.length; 39890 bmpData.set(data, i); 39891 return bmpData; 39892 } 39893} 39894exports.ImageResizer = ImageResizer; 39895ImageResizer._goodSquareLength = MIN_IMAGE_DIM; 39896 39897/***/ }), 39898/* 63 */ 39899/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 39900 39901 39902 39903Object.defineProperty(exports, "__esModule", ({ 39904 value: true 39905})); 39906exports.MurmurHash3_64 = void 0; 39907var _util = __w_pdfjs_require__(2); 39908const SEED = 0xc3d2e1f0; 39909const MASK_HIGH = 0xffff0000; 39910const MASK_LOW = 0xffff; 39911class MurmurHash3_64 { 39912 constructor(seed) { 39913 this.h1 = seed ? seed & 0xffffffff : SEED; 39914 this.h2 = seed ? seed & 0xffffffff : SEED; 39915 } 39916 update(input) { 39917 let data, length; 39918 if (typeof input === "string") { 39919 data = new Uint8Array(input.length * 2); 39920 length = 0; 39921 for (let i = 0, ii = input.length; i < ii; i++) { 39922 const code = input.charCodeAt(i); 39923 if (code <= 0xff) { 39924 data[length++] = code; 39925 } else { 39926 data[length++] = code >>> 8; 39927 data[length++] = code & 0xff; 39928 } 39929 } 39930 } else if ((0, _util.isArrayBuffer)(input)) { 39931 data = input.slice(); 39932 length = data.byteLength; 39933 } else { 39934 throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array."); 39935 } 39936 const blockCounts = length >> 2; 39937 const tailLength = length - blockCounts * 4; 39938 const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts); 39939 let k1 = 0, 39940 k2 = 0; 39941 let h1 = this.h1, 39942 h2 = this.h2; 39943 const C1 = 0xcc9e2d51, 39944 C2 = 0x1b873593; 39945 const C1_LOW = C1 & MASK_LOW, 39946 C2_LOW = C2 & MASK_LOW; 39947 for (let i = 0; i < blockCounts; i++) { 39948 if (i & 1) {
vendor: 2,407 bytes, lines 39949-40026
39949 k1 = dataUint32[i]; 39950 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 39951 k1 = k1 << 15 | k1 >>> 17; 39952 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 39953 h1 ^= k1; 39954 h1 = h1 << 13 | h1 >>> 19; 39955 h1 = h1 * 5 + 0xe6546b64; 39956 } else { 39957 k2 = dataUint32[i]; 39958 k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW; 39959 k2 = k2 << 15 | k2 >>> 17; 39960 k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW; 39961 h2 ^= k2; 39962 h2 = h2 << 13 | h2 >>> 19; 39963 h2 = h2 * 5 + 0xe6546b64; 39964 } 39965 } 39966 k1 = 0; 39967 switch (tailLength) { 39968 case 3: 39969 k1 ^= data[blockCounts * 4 + 2] << 16; 39970 case 2: 39971 k1 ^= data[blockCounts * 4 + 1] << 8; 39972 case 1: 39973 k1 ^= data[blockCounts * 4]; 39974 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 39975 k1 = k1 << 15 | k1 >>> 17; 39976 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 39977 if (blockCounts & 1) { 39978 h1 ^= k1; 39979 } else { 39980 h2 ^= k1; 39981 } 39982 } 39983 this.h1 = h1; 39984 this.h2 = h2; 39985 } 39986 hexdigest() { 39987 let h1 = this.h1, 39988 h2 = this.h2; 39989 h1 ^= h2 >>> 1; 39990 h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW; 39991 h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16; 39992 h1 ^= h2 >>> 1; 39993 h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW; 39994 h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16; 39995 h1 ^= h2 >>> 1; 39996 return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0"); 39997 } 39998} 39999exports.MurmurHash3_64 = MurmurHash3_64; 40000 40001/***/ }), 40002/* 64 */ 40003/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 40004 40005 40006 40007Object.defineProperty(exports, "__esModule", ({ 40008 value: true 40009})); 40010exports.OperatorList = void 0; 40011var _util = __w_pdfjs_require__(2); 40012function addState(parentState, pattern, checkFn, iterateFn, processFn) { 40013 let state = parentState; 40014 for (let i = 0, ii = pattern.length - 1; i < ii; i++) { 40015 const item = pattern[i]; 40016 state = state[item] ||= []; 40017 } 40018 state[pattern.at(-1)] = { 40019 checkFn, 40020 iterateFn, 40021 processFn 40022 }; 40023} 40024const InitialState = []; 40025addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) { 40026 const fnArray = context.fnArray;
vendor: 9,750 bytes, lines 40027-40275
40027 const iFirstSave = context.iCurr - 3; 40028 const pos = (i - iFirstSave) % 4; 40029 switch (pos) { 40030 case 0: 40031 return fnArray[i] === _util.OPS.save; 40032 case 1: 40033 return fnArray[i] === _util.OPS.transform; 40034 case 2: 40035 return fnArray[i] === _util.OPS.paintInlineImageXObject; 40036 case 3: 40037 return fnArray[i] === _util.OPS.restore; 40038 } 40039 throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`); 40040}, function foundInlineImageGroup(context, i) { 40041 const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; 40042 const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; 40043 const MAX_WIDTH = 1000; 40044 const IMAGE_PADDING = 1; 40045 const fnArray = context.fnArray, 40046 argsArray = context.argsArray; 40047 const curr = context.iCurr; 40048 const iFirstSave = curr - 3; 40049 const iFirstTransform = curr - 2; 40050 const iFirstPIIXO = curr - 1; 40051 const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK); 40052 if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) { 40053 return i - (i - iFirstSave) % 4; 40054 } 40055 let maxX = 0; 40056 const map = []; 40057 let maxLineHeight = 0; 40058 let currentX = IMAGE_PADDING, 40059 currentY = IMAGE_PADDING; 40060 for (let q = 0; q < count; q++) { 40061 const transform = argsArray[iFirstTransform + (q << 2)]; 40062 const img = argsArray[iFirstPIIXO + (q << 2)][0]; 40063 if (currentX + img.width > MAX_WIDTH) { 40064 maxX = Math.max(maxX, currentX); 40065 currentY += maxLineHeight + 2 * IMAGE_PADDING; 40066 currentX = 0; 40067 maxLineHeight = 0; 40068 } 40069 map.push({ 40070 transform, 40071 x: currentX, 40072 y: currentY, 40073 w: img.width, 40074 h: img.height 40075 }); 40076 currentX += img.width + 2 * IMAGE_PADDING; 40077 maxLineHeight = Math.max(maxLineHeight, img.height); 40078 } 40079 const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING; 40080 const imgHeight = currentY + maxLineHeight + IMAGE_PADDING; 40081 const imgData = new Uint8Array(imgWidth * imgHeight * 4); 40082 const imgRowSize = imgWidth << 2; 40083 for (let q = 0; q < count; q++) { 40084 const data = argsArray[iFirstPIIXO + (q << 2)][0].data; 40085 const rowSize = map[q].w << 2; 40086 let dataOffset = 0; 40087 let offset = map[q].x + map[q].y * imgWidth << 2; 40088 imgData.set(data.subarray(0, rowSize), offset - imgRowSize); 40089 for (let k = 0, kk = map[q].h; k < kk; k++) { 40090 imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset); 40091 dataOffset += rowSize; 40092 offset += imgRowSize; 40093 } 40094 imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset); 40095 while (offset >= 0) { 40096 data[offset - 4] = data[offset]; 40097 data[offset - 3] = data[offset + 1]; 40098 data[offset - 2] = data[offset + 2]; 40099 data[offset - 1] = data[offset + 3]; 40100 data[offset + rowSize] = data[offset + rowSize - 4]; 40101 data[offset + rowSize + 1] = data[offset + rowSize - 3]; 40102 data[offset + rowSize + 2] = data[offset + rowSize - 2]; 40103 data[offset + rowSize + 3] = data[offset + rowSize - 1]; 40104 offset -= imgRowSize; 40105 } 40106 } 40107 const img = { 40108 width: imgWidth, 40109 height: imgHeight 40110 }; 40111 if (context.isOffscreenCanvasSupported) { 40112 const canvas = new OffscreenCanvas(imgWidth, imgHeight); 40113 const ctx = canvas.getContext("2d"); 40114 ctx.putImageData(new ImageData(new Uint8ClampedArray(imgData.buffer), imgWidth, imgHeight), 0, 0); 40115 img.bitmap = canvas.transferToImageBitmap(); 40116 img.data = null; 40117 } else { 40118 img.kind = _util.ImageKind.RGBA_32BPP; 40119 img.data = imgData; 40120 } 40121 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup); 40122 argsArray.splice(iFirstSave, count * 4, [img, map]); 40123 return iFirstSave + 1; 40124}); 40125addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) { 40126 const fnArray = context.fnArray; 40127 const iFirstSave = context.iCurr - 3; 40128 const pos = (i - iFirstSave) % 4; 40129 switch (pos) { 40130 case 0: 40131 return fnArray[i] === _util.OPS.save; 40132 case 1: 40133 return fnArray[i] === _util.OPS.transform; 40134 case 2: 40135 return fnArray[i] === _util.OPS.paintImageMaskXObject; 40136 case 3: 40137 return fnArray[i] === _util.OPS.restore; 40138 } 40139 throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`); 40140}, function foundImageMaskGroup(context, i) { 40141 const MIN_IMAGES_IN_MASKS_BLOCK = 10; 40142 const MAX_IMAGES_IN_MASKS_BLOCK = 100; 40143 const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000; 40144 const fnArray = context.fnArray, 40145 argsArray = context.argsArray; 40146 const curr = context.iCurr; 40147 const iFirstSave = curr - 3; 40148 const iFirstTransform = curr - 2; 40149 const iFirstPIMXO = curr - 1; 40150 let count = Math.floor((i - iFirstSave) / 4); 40151 if (count < MIN_IMAGES_IN_MASKS_BLOCK) { 40152 return i - (i - iFirstSave) % 4; 40153 } 40154 let isSameImage = false; 40155 let iTransform, transformArgs; 40156 const firstPIMXOArg0 = argsArray[iFirstPIMXO][0]; 40157 const firstTransformArg0 = argsArray[iFirstTransform][0], 40158 firstTransformArg1 = argsArray[iFirstTransform][1], 40159 firstTransformArg2 = argsArray[iFirstTransform][2], 40160 firstTransformArg3 = argsArray[iFirstTransform][3]; 40161 if (firstTransformArg1 === firstTransformArg2) { 40162 isSameImage = true; 40163 iTransform = iFirstTransform + 4; 40164 let iPIMXO = iFirstPIMXO + 4; 40165 for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) { 40166 transformArgs = argsArray[iTransform]; 40167 if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) { 40168 if (q < MIN_IMAGES_IN_MASKS_BLOCK) { 40169 isSameImage = false; 40170 } else { 40171 count = q; 40172 } 40173 break; 40174 } 40175 } 40176 } 40177 if (isSameImage) { 40178 count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK); 40179 const positions = new Float32Array(count * 2); 40180 iTransform = iFirstTransform; 40181 for (let q = 0; q < count; q++, iTransform += 4) { 40182 transformArgs = argsArray[iTransform]; 40183 positions[q << 1] = transformArgs[4]; 40184 positions[(q << 1) + 1] = transformArgs[5]; 40185 } 40186 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat); 40187 argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]); 40188 } else { 40189 count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK); 40190 const images = []; 40191 for (let q = 0; q < count; q++) { 40192 transformArgs = argsArray[iFirstTransform + (q << 2)]; 40193 const maskParams = argsArray[iFirstPIMXO + (q << 2)][0]; 40194 images.push({ 40195 data: maskParams.data, 40196 width: maskParams.width, 40197 height: maskParams.height, 40198 interpolate: maskParams.interpolate, 40199 count: maskParams.count, 40200 transform: transformArgs 40201 }); 40202 } 40203 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup); 40204 argsArray.splice(iFirstSave, count * 4, [images]); 40205 } 40206 return iFirstSave + 1; 40207}); 40208addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) { 40209 const argsArray = context.argsArray; 40210 const iFirstTransform = context.iCurr - 2; 40211 return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0; 40212}, function iterateImageGroup(context, i) { 40213 const fnArray = context.fnArray, 40214 argsArray = context.argsArray; 40215 const iFirstSave = context.iCurr - 3; 40216 const pos = (i - iFirstSave) % 4; 40217 switch (pos) { 40218 case 0: 40219 return fnArray[i] === _util.OPS.save; 40220 case 1: 40221 if (fnArray[i] !== _util.OPS.transform) { 40222 return false; 40223 } 40224 const iFirstTransform = context.iCurr - 2; 40225 const firstTransformArg0 = argsArray[iFirstTransform][0]; 40226 const firstTransformArg3 = argsArray[iFirstTransform][3]; 40227 if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) { 40228 return false; 40229 } 40230 return true; 40231 case 2: 40232 if (fnArray[i] !== _util.OPS.paintImageXObject) { 40233 return false; 40234 } 40235 const iFirstPIXO = context.iCurr - 1; 40236 const firstPIXOArg0 = argsArray[iFirstPIXO][0]; 40237 if (argsArray[i][0] !== firstPIXOArg0) { 40238 return false; 40239 } 40240 return true; 40241 case 3: 40242 return fnArray[i] === _util.OPS.restore; 40243 } 40244 throw new Error(`iterateImageGroup - invalid pos: ${pos}`); 40245}, function (context, i) { 40246 const MIN_IMAGES_IN_BLOCK = 3; 40247 const MAX_IMAGES_IN_BLOCK = 1000; 40248 const fnArray = context.fnArray, 40249 argsArray = context.argsArray; 40250 const curr = context.iCurr; 40251 const iFirstSave = curr - 3; 40252 const iFirstTransform = curr - 2; 40253 const iFirstPIXO = curr - 1; 40254 const firstPIXOArg0 = argsArray[iFirstPIXO][0]; 40255 const firstTransformArg0 = argsArray[iFirstTransform][0]; 40256 const firstTransformArg3 = argsArray[iFirstTransform][3]; 40257 const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK); 40258 if (count < MIN_IMAGES_IN_BLOCK) { 40259 return i - (i - iFirstSave) % 4; 40260 } 40261 const positions = new Float32Array(count * 2); 40262 let iTransform = iFirstTransform; 40263 for (let q = 0; q < count; q++, iTransform += 4) { 40264 const transformArgs = argsArray[iTransform]; 40265 positions[q << 1] = transformArgs[4]; 40266 positions[(q << 1) + 1] = transformArgs[5]; 40267 } 40268 const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions]; 40269 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat); 40270 argsArray.splice(iFirstSave, count * 4, args); 40271 return iFirstSave + 1; 40272}); 40273addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) { 40274 const fnArray = context.fnArray, 40275 argsArray = context.argsArray;
vendor: 10,103 bytes, lines 40276-40634
40276 const iFirstSave = context.iCurr - 4; 40277 const pos = (i - iFirstSave) % 5; 40278 switch (pos) { 40279 case 0: 40280 return fnArray[i] === _util.OPS.beginText; 40281 case 1: 40282 return fnArray[i] === _util.OPS.setFont; 40283 case 2: 40284 return fnArray[i] === _util.OPS.setTextMatrix; 40285 case 3: 40286 if (fnArray[i] !== _util.OPS.showText) { 40287 return false; 40288 } 40289 const iFirstSetFont = context.iCurr - 3; 40290 const firstSetFontArg0 = argsArray[iFirstSetFont][0]; 40291 const firstSetFontArg1 = argsArray[iFirstSetFont][1]; 40292 if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) { 40293 return false; 40294 } 40295 return true; 40296 case 4: 40297 return fnArray[i] === _util.OPS.endText; 40298 } 40299 throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`); 40300}, function (context, i) { 40301 const MIN_CHARS_IN_BLOCK = 3; 40302 const MAX_CHARS_IN_BLOCK = 1000; 40303 const fnArray = context.fnArray, 40304 argsArray = context.argsArray; 40305 const curr = context.iCurr; 40306 const iFirstBeginText = curr - 4; 40307 const iFirstSetFont = curr - 3; 40308 const iFirstSetTextMatrix = curr - 2; 40309 const iFirstShowText = curr - 1; 40310 const iFirstEndText = curr; 40311 const firstSetFontArg0 = argsArray[iFirstSetFont][0]; 40312 const firstSetFontArg1 = argsArray[iFirstSetFont][1]; 40313 let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK); 40314 if (count < MIN_CHARS_IN_BLOCK) { 40315 return i - (i - iFirstBeginText) % 5; 40316 } 40317 let iFirst = iFirstBeginText; 40318 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) { 40319 count++; 40320 iFirst -= 5; 40321 } 40322 let iEndText = iFirst + 4; 40323 for (let q = 1; q < count; q++) { 40324 fnArray.splice(iEndText, 3); 40325 argsArray.splice(iEndText, 3); 40326 iEndText += 2; 40327 } 40328 return iEndText + 1; 40329}); 40330class NullOptimizer { 40331 constructor(queue) { 40332 this.queue = queue; 40333 } 40334 _optimize() {} 40335 push(fn, args) { 40336 this.queue.fnArray.push(fn); 40337 this.queue.argsArray.push(args); 40338 this._optimize(); 40339 } 40340 flush() {} 40341 reset() {} 40342} 40343class QueueOptimizer extends NullOptimizer { 40344 constructor(queue) { 40345 super(queue); 40346 this.state = null; 40347 this.context = { 40348 iCurr: 0, 40349 fnArray: queue.fnArray, 40350 argsArray: queue.argsArray, 40351 isOffscreenCanvasSupported: false 40352 }; 40353 this.match = null; 40354 this.lastProcessed = 0; 40355 } 40356 set isOffscreenCanvasSupported(value) { 40357 this.context.isOffscreenCanvasSupported = value; 40358 } 40359 _optimize() { 40360 const fnArray = this.queue.fnArray; 40361 let i = this.lastProcessed, 40362 ii = fnArray.length; 40363 let state = this.state; 40364 let match = this.match; 40365 if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) { 40366 this.lastProcessed = ii; 40367 return; 40368 } 40369 const context = this.context; 40370 while (i < ii) { 40371 if (match) { 40372 const iterate = (0, match.iterateFn)(context, i); 40373 if (iterate) { 40374 i++; 40375 continue; 40376 } 40377 i = (0, match.processFn)(context, i + 1); 40378 ii = fnArray.length; 40379 match = null; 40380 state = null; 40381 if (i >= ii) { 40382 break; 40383 } 40384 } 40385 state = (state || InitialState)[fnArray[i]]; 40386 if (!state || Array.isArray(state)) { 40387 i++; 40388 continue; 40389 } 40390 context.iCurr = i; 40391 i++; 40392 if (state.checkFn && !(0, state.checkFn)(context)) { 40393 state = null; 40394 continue; 40395 } 40396 match = state; 40397 state = null; 40398 } 40399 this.state = state; 40400 this.match = match; 40401 this.lastProcessed = i; 40402 } 40403 flush() { 40404 while (this.match) { 40405 const length = this.queue.fnArray.length; 40406 this.lastProcessed = (0, this.match.processFn)(this.context, length); 40407 this.match = null; 40408 this.state = null; 40409 this._optimize(); 40410 } 40411 } 40412 reset() { 40413 this.state = null; 40414 this.match = null; 40415 this.lastProcessed = 0; 40416 } 40417} 40418class OperatorList { 40419 static CHUNK_SIZE = 1000; 40420 static CHUNK_SIZE_ABOUT = this.CHUNK_SIZE - 5; 40421 constructor(intent = 0, streamSink) { 40422 this._streamSink = streamSink; 40423 this.fnArray = []; 40424 this.argsArray = []; 40425 this.optimizer = streamSink && !(intent & _util.RenderingIntentFlag.OPLIST) ? new QueueOptimizer(this) : new NullOptimizer(this); 40426 this.dependencies = new Set(); 40427 this._totalLength = 0; 40428 this.weight = 0; 40429 this._resolved = streamSink ? null : Promise.resolve(); 40430 } 40431 set isOffscreenCanvasSupported(value) { 40432 this.optimizer.isOffscreenCanvasSupported = value; 40433 } 40434 get length() { 40435 return this.argsArray.length; 40436 } 40437 get ready() { 40438 return this._resolved || this._streamSink.ready; 40439 } 40440 get totalLength() { 40441 return this._totalLength + this.length; 40442 } 40443 addOp(fn, args) { 40444 this.optimizer.push(fn, args); 40445 this.weight++; 40446 if (this._streamSink) { 40447 if (this.weight >= OperatorList.CHUNK_SIZE) { 40448 this.flush(); 40449 } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) { 40450 this.flush(); 40451 } 40452 } 40453 } 40454 addImageOps(fn, args, optionalContent) { 40455 if (optionalContent !== undefined) { 40456 this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]); 40457 } 40458 this.addOp(fn, args); 40459 if (optionalContent !== undefined) { 40460 this.addOp(_util.OPS.endMarkedContent, []); 40461 } 40462 } 40463 addDependency(dependency) { 40464 if (this.dependencies.has(dependency)) { 40465 return; 40466 } 40467 this.dependencies.add(dependency); 40468 this.addOp(_util.OPS.dependency, [dependency]); 40469 } 40470 addDependencies(dependencies) { 40471 for (const dependency of dependencies) { 40472 this.addDependency(dependency); 40473 } 40474 } 40475 addOpList(opList) { 40476 if (!(opList instanceof OperatorList)) { 40477 (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.'); 40478 return; 40479 } 40480 for (const dependency of opList.dependencies) { 40481 this.dependencies.add(dependency); 40482 } 40483 for (let i = 0, ii = opList.length; i < ii; i++) { 40484 this.addOp(opList.fnArray[i], opList.argsArray[i]); 40485 } 40486 } 40487 getIR() { 40488 return { 40489 fnArray: this.fnArray, 40490 argsArray: this.argsArray, 40491 length: this.length 40492 }; 40493 } 40494 get _transfers() { 40495 const transfers = []; 40496 const { 40497 fnArray, 40498 argsArray, 40499 length 40500 } = this; 40501 for (let i = 0; i < length; i++) { 40502 switch (fnArray[i]) { 40503 case _util.OPS.paintInlineImageXObject: 40504 case _util.OPS.paintInlineImageXObjectGroup: 40505 case _util.OPS.paintImageMaskXObject: 40506 const arg = argsArray[i][0]; 40507 if (!arg.cached && arg.data?.buffer instanceof ArrayBuffer) { 40508 transfers.push(arg.data.buffer); 40509 } 40510 break; 40511 } 40512 } 40513 return transfers; 40514 } 40515 flush(lastChunk = false, separateAnnots = null) { 40516 this.optimizer.flush(); 40517 const length = this.length; 40518 this._totalLength += length; 40519 this._streamSink.enqueue({ 40520 fnArray: this.fnArray, 40521 argsArray: this.argsArray, 40522 lastChunk, 40523 separateAnnots, 40524 length 40525 }, 1, this._transfers); 40526 this.dependencies.clear(); 40527 this.fnArray.length = 0; 40528 this.argsArray.length = 0; 40529 this.weight = 0; 40530 this.optimizer.reset(); 40531 } 40532} 40533exports.OperatorList = OperatorList; 40534 40535/***/ }), 40536/* 65 */ 40537/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 40538 40539 40540 40541Object.defineProperty(exports, "__esModule", ({ 40542 value: true 40543})); 40544exports.PDFImage = void 0; 40545var _util = __w_pdfjs_require__(2); 40546var _image_utils = __w_pdfjs_require__(28); 40547var _base_stream = __w_pdfjs_require__(5); 40548var _colorspace = __w_pdfjs_require__(12); 40549var _decode_stream = __w_pdfjs_require__(18); 40550var _image_resizer = __w_pdfjs_require__(62); 40551var _jpeg_stream = __w_pdfjs_require__(26); 40552var _jpx = __w_pdfjs_require__(30); 40553var _primitives = __w_pdfjs_require__(4); 40554function decodeAndClamp(value, addend, coefficient, max) { 40555 value = addend + value * coefficient; 40556 if (value < 0) { 40557 value = 0; 40558 } else if (value > max) { 40559 value = max; 40560 } 40561 return value; 40562} 40563function resizeImageMask(src, bpc, w1, h1, w2, h2) { 40564 const length = w2 * h2; 40565 let dest; 40566 if (bpc <= 8) { 40567 dest = new Uint8Array(length); 40568 } else if (bpc <= 16) { 40569 dest = new Uint16Array(length); 40570 } else { 40571 dest = new Uint32Array(length); 40572 } 40573 const xRatio = w1 / w2; 40574 const yRatio = h1 / h2; 40575 let i, 40576 j, 40577 py, 40578 newIndex = 0, 40579 oldIndex; 40580 const xScaled = new Uint16Array(w2); 40581 const w1Scanline = w1; 40582 for (i = 0; i < w2; i++) { 40583 xScaled[i] = Math.floor(i * xRatio); 40584 } 40585 for (i = 0; i < h2; i++) { 40586 py = Math.floor(i * yRatio) * w1Scanline; 40587 for (j = 0; j < w2; j++) { 40588 oldIndex = py + xScaled[j]; 40589 dest[newIndex++] = src[oldIndex]; 40590 } 40591 } 40592 return dest; 40593} 40594class PDFImage { 40595 constructor({ 40596 xref, 40597 res, 40598 image, 40599 isInline = false, 40600 smask = null, 40601 mask = null, 40602 isMask = false, 40603 pdfFunctionFactory, 40604 localColorSpaceCache 40605 }) { 40606 this.image = image; 40607 const dict = image.dict; 40608 const filter = dict.get("F", "Filter"); 40609 let filterName; 40610 if (filter instanceof _primitives.Name) { 40611 filterName = filter.name; 40612 } else if (Array.isArray(filter)) { 40613 const filterZero = xref.fetchIfRef(filter[0]); 40614 if (filterZero instanceof _primitives.Name) { 40615 filterName = filterZero.name; 40616 } 40617 } 40618 switch (filterName) { 40619 case "JPXDecode": 40620 const jpxImage = new _jpx.JpxImage(); 40621 jpxImage.parseImageProperties(image.stream); 40622 image.stream.reset(); 40623 image.width = jpxImage.width; 40624 image.height = jpxImage.height; 40625 image.bitsPerComponent = jpxImage.bitsPerComponent; 40626 image.numComps = jpxImage.componentsCount; 40627 break; 40628 case "JBIG2Decode": 40629 image.bitsPerComponent = 1; 40630 image.numComps = 1; 40631 break; 40632 } 40633 let width = dict.get("W", "Width"); 40634 let height = dict.get("H", "Height");
40635 if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) { 40636 (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary."); 40637 width = image.width; 40638 height = image.height; 40639 } 40640 if (width < 1 || height < 1) { 40641 throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`); 40642 } 40643 this.width = width; 40644 this.height = height; 40645 this.interpolate = dict.get("I", "Interpolate"); 40646 this.imageMask = dict.get("IM", "ImageMask") || false; 40647 this.matte = dict.get("Matte") || false; 40648 let bitsPerComponent = image.bitsPerComponent; 40649 if (!bitsPerComponent) { 40650 bitsPerComponent = dict.get("BPC", "BitsPerComponent"); 40651 if (!bitsPerComponent) { 40652 if (this.imageMask) { 40653 bitsPerComponent = 1; 40654 } else { 40655 throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`); 40656 } 40657 } 40658 } 40659 this.bpc = bitsPerComponent; 40660 if (!this.imageMask) { 40661 let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace"); 40662 if (!colorSpace) { 40663 (0, _util.info)("JPX images (which do not require color spaces)"); 40664 switch (image.numComps) { 40665 case 1: 40666 colorSpace = _primitives.Name.get("DeviceGray"); 40667 break; 40668 case 3: 40669 colorSpace = _primitives.Name.get("DeviceRGB"); 40670 break; 40671 case 4: 40672 colorSpace = _primitives.Name.get("DeviceCMYK"); 40673 break; 40674 default: 40675 throw new Error(`JPX images with ${image.numComps} color components not supported.`); 40676 } 40677 } 40678 this.colorSpace = _colorspace.ColorSpace.parse({ 40679 cs: colorSpace, 40680 xref, 40681 resources: isInline ? res : null, 40682 pdfFunctionFactory, 40683 localColorSpaceCache 40684 }); 40685 this.numComps = this.colorSpace.numComps; 40686 } 40687 this.decode = dict.getArray("D", "Decode"); 40688 this.needsDecode = false; 40689 if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) { 40690 this.needsDecode = true; 40691 const max = (1 << bitsPerComponent) - 1; 40692 this.decodeCoefficients = []; 40693 this.decodeAddends = []; 40694 const isIndexed = this.colorSpace?.name === "Indexed"; 40695 for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) { 40696 const dmin = this.decode[i]; 40697 const dmax = this.decode[i + 1]; 40698 this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin; 40699 this.decodeAddends[j] = isIndexed ? dmin : max * dmin; 40700 } 40701 } 40702 if (smask) { 40703 this.smask = new PDFImage({ 40704 xref, 40705 res, 40706 image: smask, 40707 isInline, 40708 pdfFunctionFactory, 40709 localColorSpaceCache 40710 }); 40711 } else if (mask) { 40712 if (mask instanceof _base_stream.BaseStream) { 40713 const maskDict = mask.dict, 40714 imageMask = maskDict.get("IM", "ImageMask"); 40715 if (!imageMask) { 40716 (0, _util.warn)("Ignoring /Mask in image without /ImageMask."); 40717 } else { 40718 this.mask = new PDFImage({ 40719 xref, 40720 res, 40721 image: mask, 40722 isInline, 40723 isMask: true, 40724 pdfFunctionFactory, 40725 localColorSpaceCache 40726 }); 40727 } 40728 } else { 40729 this.mask = mask; 40730 } 40731 } 40732 } 40733 static async buildImage({ 40734 xref, 40735 res, 40736 image, 40737 isInline = false, 40738 pdfFunctionFactory, 40739 localColorSpaceCache 40740 }) { 40741 const imageData = image; 40742 let smaskData = null; 40743 let maskData = null; 40744 const smask = image.dict.get("SMask"); 40745 const mask = image.dict.get("Mask"); 40746 if (smask) { 40747 if (smask instanceof _base_stream.BaseStream) { 40748 smaskData = smask; 40749 } else { 40750 (0, _util.warn)("Unsupported /SMask format."); 40751 } 40752 } else if (mask) { 40753 if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) { 40754 maskData = mask; 40755 } else { 40756 (0, _util.warn)("Unsupported /Mask format."); 40757 } 40758 } 40759 return new PDFImage({ 40760 xref, 40761 res, 40762 image: imageData, 40763 isInline, 40764 smask: smaskData, 40765 mask: maskData, 40766 pdfFunctionFactory, 40767 localColorSpaceCache 40768 }); 40769 } 40770 static createRawMask({ 40771 imgArray, 40772 width, 40773 height, 40774 imageIsFromDecodeStream, 40775 inverseDecode, 40776 interpolate 40777 }) { 40778 const computedLength = (width + 7 >> 3) * height; 40779 const actualLength = imgArray.byteLength; 40780 const haveFullData = computedLength === actualLength; 40781 let data, i; 40782 if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) { 40783 data = imgArray; 40784 } else if (!inverseDecode) { 40785 data = new Uint8Array(imgArray); 40786 } else { 40787 data = new Uint8Array(computedLength); 40788 data.set(imgArray); 40789 data.fill(0xff, actualLength); 40790 } 40791 if (inverseDecode) { 40792 for (i = 0; i < actualLength; i++) { 40793 data[i] ^= 0xff; 40794 } 40795 } 40796 return { 40797 data, 40798 width, 40799 height, 40800 interpolate 40801 }; 40802 } 40803 static async createMask({ 40804 imgArray, 40805 width, 40806 height, 40807 imageIsFromDecodeStream, 40808 inverseDecode, 40809 interpolate, 40810 isOffscreenCanvasSupported = false 40811 }) { 40812 const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128)); 40813 if (isSingleOpaquePixel) { 40814 return { 40815 isSingleOpaquePixel 40816 }; 40817 } 40818 if (isOffscreenCanvasSupported) { 40819 if (_image_resizer.ImageResizer.needsToBeResized(width, height)) { 40820 const data = new Uint8ClampedArray(width * height * 4); 40821 (0, _image_utils.convertBlackAndWhiteToRGBA)({ 40822 src: imgArray, 40823 dest: data, 40824 width, 40825 height, 40826 nonBlackColor: 0, 40827 inverseDecode 40828 }); 40829 return _image_resizer.ImageResizer.createImage({ 40830 kind: _util.ImageKind.RGBA_32BPP, 40831 data, 40832 width, 40833 height, 40834 interpolate 40835 }); 40836 } 40837 const canvas = new OffscreenCanvas(width, height); 40838 const ctx = canvas.getContext("2d"); 40839 const imgData = ctx.createImageData(width, height); 40840 (0, _image_utils.convertBlackAndWhiteToRGBA)({ 40841 src: imgArray, 40842 dest: imgData.data, 40843 width, 40844 height, 40845 nonBlackColor: 0, 40846 inverseDecode 40847 }); 40848 ctx.putImageData(imgData, 0, 0); 40849 const bitmap = canvas.transferToImageBitmap(); 40850 return { 40851 data: null, 40852 width, 40853 height, 40854 interpolate, 40855 bitmap 40856 }; 40857 } 40858 return this.createRawMask({ 40859 imgArray, 40860 width, 40861 height, 40862 inverseDecode, 40863 imageIsFromDecodeStream, 40864 interpolate 40865 }); 40866 } 40867 get drawWidth() { 40868 return Math.max(this.width, this.smask?.width || 0, this.mask?.width || 0); 40869 } 40870 get drawHeight() { 40871 return Math.max(this.height, this.smask?.height || 0, this.mask?.height || 0
vendor: 8,937 bytes, lines 40871-41146
40871); 40872 } 40873 decodeBuffer(buffer) { 40874 const bpc = this.bpc; 40875 const numComps = this.numComps; 40876 const decodeAddends = this.decodeAddends; 40877 const decodeCoefficients = this.decodeCoefficients; 40878 const max = (1 << bpc) - 1; 40879 let i, ii; 40880 if (bpc === 1) { 40881 for (i = 0, ii = buffer.length; i < ii; i++) { 40882 buffer[i] = +!buffer[i]; 40883 } 40884 return; 40885 } 40886 let index = 0; 40887 for (i = 0, ii = this.width * this.height; i < ii; i++) { 40888 for (let j = 0; j < numComps; j++) { 40889 buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max); 40890 index++; 40891 } 40892 } 40893 } 40894 getComponents(buffer) { 40895 const bpc = this.bpc; 40896 if (bpc === 8) { 40897 return buffer; 40898 } 40899 const width = this.width; 40900 const height = this.height; 40901 const numComps = this.numComps; 40902 const length = width * height * numComps; 40903 let bufferPos = 0; 40904 let output; 40905 if (bpc <= 8) { 40906 output = new Uint8Array(length); 40907 } else if (bpc <= 16) { 40908 output = new Uint16Array(length); 40909 } else { 40910 output = new Uint32Array(length); 40911 } 40912 const rowComps = width * numComps; 40913 const max = (1 << bpc) - 1; 40914 let i = 0, 40915 ii, 40916 buf; 40917 if (bpc === 1) { 40918 let mask, loop1End, loop2End; 40919 for (let j = 0; j < height; j++) { 40920 loop1End = i + (rowComps & ~7); 40921 loop2End = i + rowComps; 40922 while (i < loop1End) { 40923 buf = buffer[bufferPos++]; 40924 output[i] = buf >> 7 & 1; 40925 output[i + 1] = buf >> 6 & 1; 40926 output[i + 2] = buf >> 5 & 1; 40927 output[i + 3] = buf >> 4 & 1; 40928 output[i + 4] = buf >> 3 & 1; 40929 output[i + 5] = buf >> 2 & 1; 40930 output[i + 6] = buf >> 1 & 1; 40931 output[i + 7] = buf & 1; 40932 i += 8; 40933 } 40934 if (i < loop2End) { 40935 buf = buffer[bufferPos++]; 40936 mask = 128; 40937 while (i < loop2End) { 40938 output[i++] = +!!(buf & mask); 40939 mask >>= 1; 40940 } 40941 } 40942 } 40943 } else { 40944 let bits = 0; 40945 buf = 0; 40946 for (i = 0, ii = length; i < ii; ++i) { 40947 if (i % rowComps === 0) { 40948 buf = 0; 40949 bits = 0; 40950 } 40951 while (bits < bpc) { 40952 buf = buf << 8 | buffer[bufferPos++]; 40953 bits += 8; 40954 } 40955 const remainingBits = bits - bpc; 40956 let value = buf >> remainingBits; 40957 if (value < 0) { 40958 value = 0; 40959 } else if (value > max) { 40960 value = max; 40961 } 40962 output[i] = value; 40963 buf &= (1 << remainingBits) - 1; 40964 bits = remainingBits; 40965 } 40966 } 40967 return output; 40968 } 40969 fillOpacity(rgbaBuf, width, height, actualHeight, image) { 40970 const smask = this.smask; 40971 const mask = this.mask; 40972 let alphaBuf, sw, sh, i, ii, j; 40973 if (smask) { 40974 sw = smask.width; 40975 sh = smask.height; 40976 alphaBuf = new Uint8ClampedArray(sw * sh); 40977 smask.fillGrayBuffer(alphaBuf); 40978 if (sw !== width || sh !== height) { 40979 alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height); 40980 } 40981 } else if (mask) { 40982 if (mask instanceof PDFImage) { 40983 sw = mask.width; 40984 sh = mask.height; 40985 alphaBuf = new Uint8ClampedArray(sw * sh); 40986 mask.numComps = 1; 40987 mask.fillGrayBuffer(alphaBuf); 40988 for (i = 0, ii = sw * sh; i < ii; ++i) { 40989 alphaBuf[i] = 255 - alphaBuf[i]; 40990 } 40991 if (sw !== width || sh !== height) { 40992 alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height); 40993 } 40994 } else if (Array.isArray(mask)) { 40995 alphaBuf = new Uint8ClampedArray(width * height); 40996 const numComps = this.numComps; 40997 for (i = 0, ii = width * height; i < ii; ++i) { 40998 let opacity = 0; 40999 const imageOffset = i * numComps; 41000 for (j = 0; j < numComps; ++j) { 41001 const color = image[imageOffset + j]; 41002 const maskOffset = j * 2; 41003 if (color < mask[maskOffset] || color > mask[maskOffset + 1]) { 41004 opacity = 255; 41005 break; 41006 } 41007 } 41008 alphaBuf[i] = opacity; 41009 } 41010 } else { 41011 throw new _util.FormatError("Unknown mask format."); 41012 } 41013 } 41014 if (alphaBuf) { 41015 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 41016 rgbaBuf[j] = alphaBuf[i]; 41017 } 41018 } else { 41019 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 41020 rgbaBuf[j] = 255; 41021 } 41022 } 41023 } 41024 undoPreblend(buffer, width, height) { 41025 const matte = this.smask?.matte; 41026 if (!matte) { 41027 return; 41028 } 41029 const matteRgb = this.colorSpace.getRgb(matte, 0); 41030 const matteR = matteRgb[0]; 41031 const matteG = matteRgb[1]; 41032 const matteB = matteRgb[2]; 41033 const length = width * height * 4; 41034 for (let i = 0; i < length; i += 4) { 41035 const alpha = buffer[i + 3]; 41036 if (alpha === 0) { 41037 buffer[i] = 255; 41038 buffer[i + 1] = 255; 41039 buffer[i + 2] = 255; 41040 continue; 41041 } 41042 const k = 255 / alpha; 41043 buffer[i] = (buffer[i] - matteR) * k + matteR; 41044 buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG; 41045 buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB; 41046 } 41047 } 41048 async createImageData(forceRGBA = false, isOffscreenCanvasSupported = false) { 41049 const drawWidth = this.drawWidth; 41050 const drawHeight = this.drawHeight; 41051 const imgData = { 41052 width: drawWidth, 41053 height: drawHeight, 41054 interpolate: this.interpolate, 41055 kind: 0, 41056 data: null 41057 }; 41058 const numComps = this.numComps; 41059 const originalWidth = this.width; 41060 const originalHeight = this.height; 41061 const bpc = this.bpc; 41062 const rowBytes = originalWidth * numComps * bpc + 7 >> 3; 41063 const mustBeResized = isOffscreenCanvasSupported && _image_resizer.ImageResizer.needsToBeResized(drawWidth, drawHeight); 41064 if (!forceRGBA) { 41065 let kind; 41066 if (this.colorSpace.name === "DeviceGray" && bpc === 1) { 41067 kind = _util.ImageKind.GRAYSCALE_1BPP; 41068 } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) { 41069 kind = _util.ImageKind.RGB_24BPP; 41070 } 41071 if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) { 41072 const data = this.getImageBytes(originalHeight * rowBytes, {}); 41073 if (isOffscreenCanvasSupported) { 41074 if (mustBeResized) { 41075 return _image_resizer.ImageResizer.createImage({ 41076 data, 41077 kind, 41078 width: drawWidth, 41079 height: drawHeight, 41080 interpolate: this.interpolate 41081 }, this.needsDecode); 41082 } 41083 return this.createBitmap(kind, originalWidth, originalHeight, data); 41084 } 41085 imgData.kind = kind; 41086 imgData.data = data; 41087 if (this.needsDecode) { 41088 (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale."); 41089 const buffer = imgData.data; 41090 for (let i = 0, ii = buffer.length; i < ii; i++) { 41091 buffer[i] ^= 0xff; 41092 } 41093 } 41094 return imgData; 41095 } 41096 if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask && !this.needsDecode) { 41097 let imageLength = originalHeight * rowBytes; 41098 if (isOffscreenCanvasSupported && !mustBeResized) { 41099 let isHandled = false; 41100 switch (this.colorSpace.name) { 41101 case "DeviceGray": 41102 imageLength *= 4; 41103 isHandled = true; 41104 break; 41105 case "DeviceRGB": 41106 imageLength = imageLength / 3 * 4; 41107 isHandled = true; 41108 break; 41109 case "DeviceCMYK": 41110 isHandled = true; 41111 break; 41112 } 41113 if (isHandled) { 41114 const rgba = this.getImageBytes(imageLength, { 41115 drawWidth, 41116 drawHeight, 41117 forceRGBA: true 41118 }); 41119 return this.createBitmap(_util.ImageKind.RGBA_32BPP, drawWidth, drawHeight, rgba); 41120 } 41121 } else { 41122 switch (this.colorSpace.name) { 41123 case "DeviceGray": 41124 imageLength *= 3; 41125 case "DeviceRGB": 41126 case "DeviceCMYK": 41127 imgData.kind = _util.ImageKind.RGB_24BPP; 41128 imgData.data = this.getImageBytes(imageLength, { 41129 drawWidth, 41130 drawHeight, 41131 forceRGB: true 41132 }); 41133 if (mustBeResized) { 41134 return _image_resizer.ImageResizer.createImage(imgData); 41135 } 41136 return imgData; 41137 } 41138 } 41139 } 41140 } 41141 const imgArray = this.getImageBytes(originalHeight * rowBytes, { 41142 internal: true 41143 }); 41144 const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight; 41145 const comps = this.getComponents(imgArray); 41146 let alpha01, maybeUndoPreblend;
41147 let canvas, ctx, canvasImgData, data; 41148 if (isOffscreenCanvasSupported && !mustBeResized) { 41149 canvas = new OffscreenCanvas(drawWidth, drawHeight); 41150 ctx = canvas.getContext("2d"); 41151 canvasImgData = ctx.createImageData(drawWidth, drawHeight); 41152 data = canvasImgData.data; 41153 } 41154 imgData.kind = _util.ImageKind.RGBA_32BPP; 41155 if (!forceRGBA && !this.smask && !this.mask) { 41156 if (!isOffscreenCanvasSupported || mustBeResized) { 41157 imgData.kind = _util.ImageKind.RGB_24BPP; 41158 data = new Uint8ClampedArray(drawWidth * drawHeight * 3); 41159 alpha01 = 0; 41160 } else { 41161 const arr = new Uint32Array(data.buffer); 41162 arr.fill(_util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff); 41163 alpha01 = 1; 41164 } 41165 maybeUndoPreblend = false; 41166 } else { 41167 if (!isOffscreenCanvasSupported || mustBeResized) { 41168 data = new Uint8ClampedArray(drawWidth * drawHeight * 4); 41169 } 41170 alpha01 = 1; 41171 maybeUndoPreblend = true; 41172 this.fillOpacity(data, drawWidth, drawHeight, actualHeight, comps); 41173 } 41174 if (this.needsDecode) { 41175 this.decodeBuffer(comps); 41176 } 41177 this.colorSpace.fillRgb(data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01); 41178 if (maybeUndoPreblend) { 41179 this.undoPreblend(data, drawWidth, actualHeight); 41180 } 41181 if (isOffscreenCanvasSupported && !mustBeResized) { 41182 ctx.putImageData(canvasImgData, 0, 0); 41183 const bitmap = canvas.transferToImageBitmap(); 41184 return { 41185 data: null, 41186 width: drawWidth, 41187 height: drawHeight, 41188 bitmap, 41189 interpolate: this.interpolate 41190 }; 41191 } 41192 imgData.data = data; 41193 if (mustBeResized) { 41194 return _image_resizer.ImageResizer.createImage(imgData); 41195 } 41196 return imgData; 41197 } 41198 fillGrayBuffer(buffer) { 41199 const numComps = this.numComps; 41200 if (numComps !== 1) { 41201 throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`); 41202 } 41203 const width = this.width; 41204 const height = this.height; 41205 const bpc = this.bpc; 41206 const rowBytes = width * numComps * bpc + 7 >> 3; 41207 const imgArray = this.getImageBytes(height * rowBytes, { 41208 internal: true 41209 }); 41210 const comps = this.getComponents(imgArray); 41211 let i, length; 41212 if (bpc === 1) { 41213 length = width * height; 41214 if (this.needsDecode) { 41215 for (i = 0; i < length; ++i) { 41216 buffer[i] = comps[i] - 1 & 255; 41217 } 41218 } else { 41219 for (i = 0; i < length; ++i) { 41220 buffer[i] = -comps[i] & 255; 41221 } 41222 } 41223 return; 41224 } 41225 if (this.needsDecode) { 41226 this.decodeBuffer(comps); 41227 } 41228 length = width * height; 41229 const scale = 255 / ((1 << bpc) - 1); 41230 for (i = 0; i < length; ++i) { 41231 buffer[i] = scale * comps[i]; 41232 } 41233 } 41234 createBitmap(kind, width, height, src) { 41235 const canvas = new OffscreenCanvas(width, height); 41236 const ctx = canvas.getContext("2d"); 41237 let imgData; 41238 if (kind === _util.ImageKind.RGBA_32BPP) { 41239 imgData = new ImageData(src, width, height); 41240 } else { 41241 imgData = ctx.createImageData(width, height); 41242 (0, _image_utils.convertToRGBA)({ 41243 kind, 41244 src, 41245 dest: new Uint32Array(imgData.data.buffer), 41246 width, 41247 height, 41248 inverseDecode: this.needsDecode 41249 }); 41250 } 41251 ctx.putImageData(imgData, 0, 0); 41252 const bitmap = canvas.transferToImageBitmap(); 41253 return { 41254 data: null, 41255 width, 41256 height, 41257 bitmap, 41258 interpolate: this.interpolate 41259 }; 41260 } 41261 getImageBytes(length, { 41262 drawWidth, 41263 drawHeight, 41264 forceRGBA = false, 41265 forceRGB = false, 41266 internal = false 41267 }) { 41268 this.image.reset(); 41269 this.image.drawWidth = drawWidth || this.width; 41270 this.image.drawHeight = drawHeight || this.height; 41271 this.image.forceRGBA = !!forceRGBA; 41272 this.image.forceRGB = !!forceRGB; 41273 const imageBytes = this.image.getBytes(length); 41274 if (internal || this.image instanceof _decode_stream.DecodeStream) { 41275 return imageBytes; 41276 } 41277 (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.'); 41278 return new Uint8Array(imageBytes); 41279 } 41280} 41281exports.PDFImage = PDFImage; 41282 41283/***/ }), 41284/* 66 */ 41285/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 41286 41287 41288 41289Object.defineProperty(exports, "__esModule", ({ 41290 value: true 41291})); 41292exports.Catalog = void 0; 41293var _core_utils = __w_pdfjs_require__(3); 41294var _util = __w_pdfjs_require__(2); 41295var _primitives = __w_pdfjs_require__(4); 41296var _name_number_tree = __w_pdfjs_require__(67); 41297var _base_stream = __w_pdfjs_require__(5); 41298var _cleanup_helper = __w_pdfjs_require__(68); 41299var _colorspace = __w_pdfjs_require__(12); 41300var _file_spec = __w_pdfjs_require__(69); 41301var _image_utils = __w_pdfjs_require__(59); 41302var _metadata_parser = __w_pdfjs_require__(70); 41303var _struct_tree = __w_pdfjs_require__(72); 41304function fetchDestination(dest) { 41305 if (dest instanceof _primitives.Dict) { 41306 dest = dest.get("D"); 41307 } 41308 return Array.isArray(dest) ? dest : null; 41309} 41310class Catalog { 41311 constructor(pdfManager, xref) { 41312 this.pdfManager = pdfManager; 41313 this.xref = xref; 41314 this._catDict = xref.getCatalogObj(); 41315 if (!(this._catDict instanceof _primitives.Dict)) { 41316 throw new _util.FormatError("Catalog object is not a dictionary."); 41317 } 41318 this.toplevelPagesDict; 41319 this._actualNumPages = null; 41320 this.fontCache = new _primitives.RefSetCache(); 41321 this.builtInCMapCache = new Map(); 41322 this.standardFontDataCache = new Map(); 41323 this.globalImageCache = new _image_utils.GlobalImageCache(); 41324 this.pageKidsCountCache = new _primitives.RefSetCache(); 41325 this.pageIndexCache = new _primitives.RefSetCache(); 41326 this.nonBlendModesSet = new _primitives.RefSet(); 41327 this.systemFontCache = new Map(); 41328 } 41329 cloneDict() { 41330 return this._catDict.clone(); 41331 } 41332 get version() { 41333 const version = this._catDict.get("Version"); 41334 if (version instanceof _primitives.Name) { 41335 if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) { 41336 return (0, _util.shadow)(this, "version", version.name); 41337 } 41338 (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`); 41339 } 41340 return (0, _util.shadow)(this, "version", null); 41341 } 41342 get lang() { 41343 const lang = this._catDict.get("Lang"); 41344 return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null); 41345 } 41346 get needsRendering() { 41347 const needsRendering = this._catDict.get("NeedsRendering"); 41348 return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false); 41349 } 41350 get collection() {
41351 let collection = null; 41352 try { 41353 const obj = this._catDict.get("Collection"); 41354 if (obj instanceof _primitives.Dict && obj.size > 0) { 41355 collection = obj; 41356 } 41357 } catch (ex) { 41358 if (ex instanceof _core_utils.MissingDataException) { 41359 throw ex; 41360 } 41361 (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present."); 41362 } 41363 return (0, _util.shadow)(this, "collection", collection); 41364 } 41365 get acroForm() { 41366 let acroForm = null; 41367 try { 41368 const obj = this._catDict.get("AcroForm"); 41369 if (obj instanceof _primitives.Dict && obj.size > 0) { 41370 acroForm = obj; 41371 } 41372 } catch (ex) { 41373 if (ex instanceof _core_utils.MissingDataException) { 41374 throw ex; 41375 } 41376 (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present."); 41377 } 41378 return (0, _util.shadow)(this, "acroForm", acroForm); 41379 } 41380 get acroFormRef() { 41381 const value = this._catDict.getRaw("AcroForm"); 41382 return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null); 41383 } 41384 get metadata() { 41385 const streamRef = this._catDict.getRaw("Metadata"); 41386 if (!(streamRef instanceof _primitives.Ref)) { 41387 return (0, _util.shadow)(this, "metadata", null); 41388 } 41389 let metadata = null; 41390 try { 41391 const stream = this.xref.fetch(streamRef, !this.xref.encrypt?.encryptMetadata); 41392 if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) { 41393 const type = stream.dict.get("Type"); 41394 const subtype = stream.dict.get("Subtype"); 41395 if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) { 41396 const data = (0, _util.stringToUTF8String)(stream.getString()); 41397 if (data) { 41398 metadata = new _metadata_parser.MetadataParser(data).serializable; 41399 } 41400 } 41401 } 41402 } catch (ex) { 41403 if (ex instanceof _core_utils.MissingDataException) { 41404 throw ex; 41405 } 41406 (0, _util.info)(`Skipping invalid Metadata: "${ex}".`); 41407 } 41408 return (0, _util.shadow)(this, "metadata", metadata); 41409 } 41410 get markInfo() { 41411 let markInfo = null; 41412 try { 41413 markInfo = this._readMarkInfo(); 41414 } catch (ex) { 41415 if (ex instanceof _core_utils.MissingDataException) { 41416 throw ex; 41417 } 41418 (0, _util.warn)("Unable to read mark info."); 41419 } 41420 return (0, _util.shadow)(this, "markInfo", markInfo); 41421 } 41422 _readMarkInfo() { 41423 const obj = this._catDict.get("MarkInfo"); 41424 if (!(obj instanceof _primitives.Dict)) { 41425 return null; 41426 } 41427 const markInfo = { 41428 Marked: false, 41429 UserProperties: false, 41430 Suspects: false 41431 }; 41432 for (const key in markInfo) { 41433 const value = obj.get(key); 41434 if (typeof value === "boolean") { 41435 markInfo[key] = value; 41436 } 41437 } 41438 return markInfo; 41439 } 41440 get structTreeRoot() { 41441 let structTree = null; 41442 try { 41443 structTree = this._readStructTreeRoot(); 41444 } catch (ex) { 41445 if (ex instanceof _core_utils.MissingDataException) { 41446 throw ex; 41447 } 41448 (0, _util.warn)("Unable read to structTreeRoot info."); 41449 } 41450 return (0, _util.shadow)(this, "structTreeRoot", structTree); 41451 } 41452 _readStructTreeRoot() { 41453 const rawObj = this._catDict.getRaw("StructTreeRoot"); 41454 const obj = this.xref.fetchIfRef(rawObj); 41455 if (!(obj instanceof _primitives.Dict)) { 41456 return null; 41457 } 41458 const root = new _struct_tree.StructTreeRoot(obj, rawObj); 41459 root.init(); 41460 return root; 41461 } 41462 get toplevelPagesDict() { 41463 const pagesObj = this._catDict.get("Pages"); 41464 if (!(pagesObj instanceof _primitives.Dict)) { 41465 throw new _util.FormatError("Invalid top-level pages dictionary."); 41466 } 41467 return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj); 41468 } 41469 get documentOutline() { 41470 let obj = null; 41471 try { 41472 obj = this._readDocumentOutline(); 41473 } catch (ex) { 41474 if (ex instanceof _core_utils.MissingDataException) { 41475 throw ex; 41476 } 41477 (0, _util.warn)("Unable to read document outline."); 41478 } 41479 return (0, _util.shadow)(this, "documentOutline", obj); 41480 } 41481 _readDocumentOutline() { 41482 let obj = this._catDict.get("Outlines"); 41483 if (!(obj instanceof _primitives.Dict)) { 41484 return null; 41485 } 41486 obj = obj.getRaw("First"); 41487 if (!(obj instanceof _primitives.Ref)) { 41488 return null; 41489 } 41490 const root = { 41491 items: [] 41492 }; 41493 const queue = [{ 41494 obj, 41495 parent: root 41496 }]; 41497 const processed = new _primitives.RefSet(); 41498 processed.put(obj); 41499 const xref = this.xref, 41500 blackColor = new Uint8ClampedArray(3); 41501 while (queue.length > 0) { 41502 const i = queue.shift(); 41503 const outlineDict = xref.fetchIfRef(i.obj); 41504 if (outlineDict === null) { 41505 continue; 41506 } 41507 if (!outlineDict.has("Title")) { 41508 throw new _util.FormatError("Invalid outline item encountered."); 41509 } 41510 const data = { 41511 url: null, 41512 dest: null, 41513 action: null 41514 }; 41515 Catalog.parseDestDictionary({ 41516 destDict: outlineDict, 41517 resultObj: data, 41518 docBaseUrl: this.baseUrl, 41519 docAttachments: this.attachments 41520 }); 41521 const title = outlineDict.get("Title"); 41522 const flags = outlineDict.get("F") || 0; 41523 const color = outlineDict.getArray("C"); 41524 const count = outlineDict.get("Count"); 41525 let rgbColor = blackColor; 41526 if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { 41527 rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0); 41528 } 41529 const outlineItem = { 41530 action: data.action, 41531 attachment: data.attachment, 41532 dest: data.dest, 41533 url: data.url, 41534 unsafeUrl: data.unsafeUrl, 41535 newWindow: data.newWindow, 41536 setOCGState: data.setOCGState, 41537 title: (0, _util.stringToPDFString)(title), 41538 color: rgbColor, 41539 count: Number.isInteger(count) ? count : undefined, 41540 bold: !!(flags & 2), 41541 italic: !!(flags & 1), 41542 items: [] 41543 }; 41544 i.parent.items.push(outlineItem); 41545 obj = outlineDict.getRaw("First"); 41546 if (obj instanceof _primitives.Ref && !processed.has(obj)) { 41547 queue.push({ 41548 obj, 41549 parent: outlineItem 41550 }); 41551 processed.put(obj); 41552 } 41553 obj = outlineDict.getRaw("Next"); 41554 if (obj instanceof _primitives.Ref && !processed.has(obj)) { 41555 queue.push({ 41556 obj, 41557 parent: i.parent 41558 }); 41559 processed.put(obj); 41560 } 41561 } 41562 return root.items.length > 0 ? root.items : null; 41563 } 41564 get permissions() { 41565 let permissions = null; 41566 try { 41567 permissions = this._readPermissions(); 41568 } catch (ex) { 41569 if (ex instanceof _core_utils.MissingDataException) { 41570 throw ex; 41571 } 41572 (0, _util.warn)("Unable to read permissions."); 41573 } 41574 return (0, _util.shadow)(this, "permissions", permissions); 41575 } 41576 _readPermissions() { 41577 const encrypt = this.xref.trailer.get("Encrypt"); 41578 if (!(encrypt instanceof _primitives.Dict)) { 41579 return null; 41580 } 41581 let flags = encrypt.get("P"); 41582 if (typeof flags !== "number") { 41583 return null; 41584 } 41585 flags += 2 ** 32; 41586 const permissions = []; 41587 for (const key in _util.PermissionFlag) { 41588 const value = _util.PermissionFlag[key]; 41589 if (flags & value) { 41590 permissions.push(value); 41591 } 41592 } 41593 return permissions; 41594 } 41595 get optionalContentConfig() {
41596 let config = null; 41597 try { 41598 const properties = this._catDict.get("OCProperties"); 41599 if (!properties) { 41600 return (0, _util.shadow)(this, "optionalContentConfig", null); 41601 } 41602 const defaultConfig = properties.get("D"); 41603 if (!defaultConfig) { 41604 return (0, _util.shadow)(this, "optionalContentConfig", null); 41605 } 41606 const groupsData = properties.get("OCGs"); 41607 if (!Array.isArray(groupsData)) { 41608 return (0, _util.shadow)(this, "optionalContentConfig", null); 41609 } 41610 const groups = []; 41611 const groupRefs = []; 41612 for (const groupRef of groupsData) { 41613 if (!(groupRef instanceof _primitives.Ref)) { 41614 continue; 41615 } 41616 groupRefs.push(groupRef); 41617 const group = this.xref.fetchIfRef(groupRef); 41618 groups.push({ 41619 id: groupRef.toString(), 41620 name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null, 41621 intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null 41622 }); 41623 } 41624 config = this._readOptionalContentConfig(defaultConfig, groupRefs); 41625 config.groups = groups; 41626 } catch (ex) { 41627 if (ex instanceof _core_utils.MissingDataException) { 41628 throw ex; 41629 } 41630 (0, _util.warn)(`Unable to read optional content config: ${ex}`); 41631 } 41632 return (0, _util.shadow)(this, "optionalContentConfig", config); 41633 } 41634 _readOptionalContentConfig(config, contentGroupRefs) { 41635 function parseOnOff(refs) { 41636 const onParsed = []; 41637 if (Array.isArray(refs)) { 41638 for (const value of refs) { 41639 if (!(value instanceof _primitives.Ref)) { 41640 continue; 41641 } 41642 if (contentGroupRefs.includes(value)) { 41643 onParsed.push(value.toString()); 41644 } 41645 } 41646 } 41647 return onParsed; 41648 } 41649 function parseOrder(refs, nestedLevels = 0) { 41650 if (!Array.isArray(refs)) { 41651 return null; 41652 } 41653 const order = []; 41654 for (const value of refs) { 41655 if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) { 41656 parsedOrderRefs.put(value); 41657 order.push(value.toString()); 41658 continue; 41659 } 41660 const nestedOrder = parseNestedOrder(value, nestedLevels); 41661 if (nestedOrder) { 41662 order.push(nestedOrder); 41663 } 41664 } 41665 if (nestedLevels > 0) { 41666 return order; 41667 } 41668 const hiddenGroups = []; 41669 for (const groupRef of contentGroupRefs) { 41670 if (parsedOrderRefs.has(groupRef)) { 41671 continue; 41672 } 41673 hiddenGroups.push(groupRef.toString()); 41674 } 41675 if (hiddenGroups.length) { 41676 order.push({ 41677 name: null, 41678 order: hiddenGroups 41679 }); 41680 } 41681 return order; 41682 } 41683 function parseNestedOrder(ref, nestedLevels) { 41684 if (++nestedLevels > MAX_NESTED_LEVELS) { 41685 (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS."); 41686 return null; 41687 } 41688 const value = xref.fetchIfRef(ref); 41689 if (!Array.isArray(value)) { 41690 return null; 41691 } 41692 const nestedName = xref.fetchIfRef(value[0]); 41693 if (typeof nestedName !== "string") { 41694 return null; 41695 } 41696 const nestedOrder = parseOrder(value.slice(1), nestedLevels); 41697 if (!nestedOrder || !nestedOrder.length) { 41698 return null; 41699 } 41700 return { 41701 name: (0, _util.stringToPDFString)(nestedName), 41702 order: nestedOrder 41703 }; 41704 } 41705 const xref = this.xref, 41706 parsedOrderRefs = new _primitives.RefSet(), 41707 MAX_NESTED_LEVELS = 10; 41708 return { 41709 name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null, 41710 creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null, 41711 baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null, 41712 on: parseOnOff(config.get("ON")), 41713 off: parseOnOff(config.get("OFF")), 41714 order: parseOrder(config.get("Order")), 41715 groups: null 41716 }; 41717 } 41718 setActualNumPages(num = null) { 41719 this._actualNumPages = num; 41720 } 41721 get hasActualNumPages() { 41722 return this._actualNumPages !== null; 41723 } 41724 get _pagesCount() { 41725 const obj = this.toplevelPagesDict.get("Count"); 41726 if (!Number.isInteger(obj)) { 41727 throw new _util.FormatError("Page count in top-level pages dictionary is not an integer."); 41728 } 41729 return (0, _util.shadow)(this, "_pagesCount", obj); 41730 } 41731 get numPages() { 41732 return this.hasActualNumPages ? this._actualNumPages : this._pagesCount; 41733 } 41734 get destinations() { 41735 const obj = this._readDests(), 41736 dests = Object.create(null); 41737 if (obj instanceof _name_number_tree.NameTree) { 41738 for (const [key, value] of obj.getAll()) { 41739 const dest = fetchDestination(value); 41740 if (dest) { 41741 dests[(0, _util.stringToPDFString)(key)] = dest; 41742 } 41743 } 41744 } else if (obj instanceof _primitives.Dict) {
41745 obj.forEach(function (key, value) { 41746 const dest = fetchDestination(value); 41747 if (dest) { 41748 dests[key] = dest; 41749 } 41750 }); 41751 } 41752 return (0, _util.shadow)(this, "destinations", dests); 41753 } 41754 getDestination(id) { 41755 const obj = this._readDests(); 41756 if (obj instanceof _name_number_tree.NameTree) { 41757 const dest = fetchDestination(obj.get(id)); 41758 if (dest) { 41759 return dest; 41760 } 41761 const allDest = this.destinations[id]; 41762 if (allDest) { 41763 (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`); 41764 return allDest; 41765 } 41766 } else if (obj instanceof _primitives.Dict) { 41767 const dest = fetchDestination(obj.get(id)); 41768 if (dest) { 41769 return dest; 41770 } 41771 } 41772 return null; 41773 } 41774 _readDests() { 41775 const obj = this._catDict.get("Names"); 41776 if (obj?.has("Dests")) { 41777 return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref); 41778 } else if (this._catDict.has("Dests")) { 41779 return this._catDict.get("Dests"); 41780 } 41781 return undefined; 41782 } 41783 get pageLabels() { 41784 let obj = null; 41785 try { 41786 obj = this._readPageLabels(); 41787 } catch (ex) { 41788 if (ex instanceof _core_utils.MissingDataException) { 41789 throw ex; 41790 } 41791 (0, _util.warn)("Unable to read page labels."); 41792 } 41793 return (0, _util.shadow)(this, "pageLabels", obj); 41794 } 41795 _readPageLabels() { 41796 const obj = this._catDict.getRaw("PageLabels"); 41797 if (!obj) { 41798 return null; 41799 } 41800 const pageLabels = new Array(this.numPages); 41801 let style = null, 41802 prefix = ""; 41803 const numberTree = new _name_number_tree.NumberTree(obj, this.xref); 41804 const nums = numberTree.getAll(); 41805 let currentLabel = "", 41806 currentIndex = 1; 41807 for (let i = 0, ii = this.numPages; i < ii; i++) { 41808 const labelDict = nums.get(i); 41809 if (labelDict !== undefined) { 41810 if (!(labelDict instanceof _primitives.Dict)) { 41811 throw new _util.FormatError("PageLabel is not a dictionary."); 41812 } 41813 if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) { 41814 throw new _util.FormatError("Invalid type in PageLabel dictionary."); 41815 } 41816 if (labelDict.has("S")) { 41817 const s = labelDict.get("S"); 41818 if (!(s instanceof _primitives.Name)) { 41819 throw new _util.FormatError("Invalid style in PageLabel dictionary."); 41820 } 41821 style = s.name; 41822 } else { 41823 style = null; 41824 } 41825 if (labelDict.has("P")) { 41826 const p = labelDict.get("P"); 41827 if (typeof p !== "string") { 41828 throw new _util.FormatError("Invalid prefix in PageLabel dictionary."); 41829 } 41830 prefix = (0, _util.stringToPDFString)(p); 41831 } else { 41832 prefix = ""; 41833 } 41834 if (labelDict.has("St")) { 41835 const st = labelDict.get("St"); 41836 if (!(Number.isInteger(st) && st >= 1)) { 41837 throw new _util.FormatError("Invalid start in PageLabel dictionary."); 41838 } 41839 currentIndex = st; 41840 } else { 41841 currentIndex = 1; 41842 } 41843 } 41844 switch (style) { 41845 case "D": 41846 currentLabel = currentIndex; 41847 break; 41848 case "R": 41849 case "r": 41850 currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r"); 41851 break; 41852 case "A": 41853 case "a": 41854 const LIMIT = 26; 41855 const A_UPPER_CASE = 0x41, 41856 A_LOWER_CASE = 0x61; 41857 const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE; 41858 const letterIndex = currentIndex - 1; 41859 const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT); 41860 currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1); 41861 break; 41862 default: 41863 if (style) { 41864 throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`); 41865 } 41866 currentLabel = ""; 41867 } 41868 pageLabels[i] = prefix + currentLabel; 41869 currentIndex++; 41870 } 41871 return pageLabels; 41872 } 41873 get pageLayout() { 41874 const obj = this._catDict.get("PageLayout"); 41875 let pageLayout = ""; 41876 if (obj instanceof _primitives.Name) { 41877 switch (obj.name) { 41878 case "SinglePage": 41879 case "OneColumn": 41880 case "TwoColumnLeft": 41881 case "TwoColumnRight": 41882 case "TwoPageLeft": 41883 case "TwoPageRight": 41884 pageLayout = obj.name; 41885 } 41886 } 41887 return (0, _util.shadow)(this, "pageLayout", pageLayout); 41888 } 41889 get pageMode() { 41890 const obj = this._catDict.get("PageMode"); 41891 let pageMode = "UseNone"; 41892 if (obj instanceof _primitives.Name) { 41893 switch (obj.name) { 41894 case "UseNone": 41895 case "UseOutlines": 41896 case "UseThumbs": 41897 case "FullScreen": 41898 case "UseOC": 41899 case "UseAttachments": 41900 pageMode = obj.name; 41901 } 41902 } 41903 return (0, _util.shadow)(this, "pageMode", pageMode); 41904 } 41905 get viewerPreferences() { 41906 const obj = this._catDict.get("ViewerPreferences"); 41907 if (!(obj instanceof _primitives.Dict)) { 41908 return (0, _util.shadow)(this, "viewerPreferences", null); 41909 } 41910 let prefs = null; 41911 for (const key of obj.getKeys()) { 41912 const value = obj.get(key); 41913 let prefValue; 41914 switch (key) { 41915 case "HideToolbar": 41916 case "HideMenubar": 41917 case "HideWindowUI": 41918 case "FitWindow": 41919 case "CenterWindow": 41920 case "DisplayDocTitle": 41921 case "PickTrayByPDFSize": 41922 if (typeof value === "boolean") { 41923 prefValue = value; 41924 } 41925 break; 41926 case "NonFullScreenPageMode": 41927 if (value instanceof _primitives.Name) { 41928 switch (value.name) { 41929 case "UseNone": 41930 case "UseOutlines": 41931 case "UseThumbs": 41932 case "UseOC": 41933 prefValue = value.name; 41934 break; 41935 default: 41936 prefValue = "UseNone"; 41937 } 41938 } 41939 break; 41940 case "Direction": 41941 if (value instanceof _primitives.Name) { 41942 switch (value.name) { 41943 case "L2R": 41944 case "R2L": 41945 prefValue = value.name; 41946 break; 41947 default: 41948 prefValue = "L2R"; 41949 } 41950 } 41951 break; 41952 case "ViewArea": 41953 case "ViewClip": 41954 case "PrintArea": 41955 case "PrintClip": 41956 if (value instanceof _primitives.Name) { 41957 switch (value.name) { 41958 case "MediaBox": 41959 case "CropBox": 41960 case "BleedBox": 41961 case "TrimBox": 41962 case "ArtBox": 41963 prefValue = value.name; 41964 break; 41965 default: 41966 prefValue = "CropBox"; 41967 } 41968 } 41969 break; 41970 case "PrintScaling": 41971 if (value instanceof _primitives.Name) { 41972 switch (value.name) { 41973 case "None": 41974 case "AppDefault": 41975 prefValue = value.name; 41976 break; 41977 default: 41978 prefValue = "AppDefault"; 41979 } 41980 } 41981 break; 41982 case "Duplex": 41983 if (value instanceof _primitives.Name) { 41984 switch (value.name) { 41985 case "Simplex": 41986 case "DuplexFlipShortEdge": 41987 case "DuplexFlipLongEdge": 41988 prefValue = value.name; 41989 break; 41990 default: 41991 prefValue = "None"; 41992 } 41993 } 41994 break; 41995 case "PrintPageRange": 41996 if (Array.isArray(value) && value.length % 2 === 0) { 41997 const isValid = value.every((page, i, arr) => { 41998 return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages; 41999 }); 42000 if (isValid) { 42001 prefValue = value; 42002 } 42003 } 42004 break; 42005 case "NumCopies": 42006 if (Number.isInteger(value) && value > 0) { 42007 prefValue = value; 42008 } 42009 break; 42010 default: 42011 (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`); 42012 continue; 42013 } 42014 if (prefValue === undefined) { 42015 (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`); 42016 continue; 42017 } 42018 if (!prefs) { 42019 prefs = Object.create(null); 42020 } 42021 prefs[key] = prefValue; 42022 } 42023 return (0, _util.shadow)(this, "viewerPreferences", prefs); 42024 } 42025 get openAction() { 42026 const obj = this._catDict.get("OpenAction"); 42027 const openAction = Object.create(null); 42028 if (obj instanceof _primitives.Dict) { 42029 const destDict = new _primitives.Dict(this.xref); 42030 destDict.set("A", obj); 42031 const resultObj = { 42032 url: null, 42033 dest: null, 42034 action: null 42035 }; 42036 Catalog.parseDestDictionary({ 42037 destDict, 42038 resultObj 42039 }); 42040 if (Array.isArray(resultObj.dest)) { 42041 openAction.dest = resultObj.dest; 42042 } else if (resultObj.action) { 42043 openAction.action = resultObj.action; 42044 } 42045 } else if (Array.isArray(obj)) { 42046 openAction.dest = obj; 42047 } 42048 return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null); 42049 } 42050 get attachments() { 42051 const obj = this._catDict.get("Names"); 42052 let attachments = null; 42053 if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) { 42054 const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref); 42055 for (const [key, value] of nameTree.getAll()) { 42056 const fs = new _file_spec.FileSpec(value, this.xref); 42057 if (!attachments) { 42058 attachments = Object.create(null); 42059 } 42060 attachments[(0, _util.stringToPDFString)(key)] = fs.serializable; 42061 } 42062 } 42063 return (0, _util.shadow)(this, "attachments", attachments); 42064 } 42065 get xfaImages() { 42066 const obj = this._catDict.get("Names"); 42067 let xfaImages = null; 42068 if (obj instanceof _primitives.Dict && obj.has("XFAImages")) { 42069 const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref); 42070 for (const [key, value] of nameTree.getAll()) { 42071 if (!xfaImages) { 42072 xfaImages = new _primitives.Dict(this.xref); 42073 } 42074 xfaImages.set((0, _util.stringToPDFString)(key), value); 42075 } 42076 } 42077 return (0, _util.shadow)(this, "xfaImages", xfaImages); 42078 } 42079 _collectJavaScript() { 42080 const obj = this._catDict.get("Names"); 42081 let javaScript = null; 42082 function appendIfJavaScriptDict(name, jsDict) { 42083 if (!(jsDict instanceof _primitives.Dict)) { 42084 return; 42085 } 42086 if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) { 42087 return; 42088 } 42089 let js = jsDict.get("JS"); 42090 if (js instanceof _base_stream.BaseStream) { 42091 js = js.getString(); 42092 } else if (typeof js !== "string") { 42093 return; 42094 } 42095 js = (0, _util.stringToPDFString)(js).replaceAll("\x00", ""); 42096 if (js) { 42097 (javaScript ||= new Map()).set(name, js); 42098 } 42099 } 42100 if (obj instanceof _primitives.Dict && obj.has("JavaScript")) { 42101 const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref); 42102 for (const [key, value] of nameTree.getAll()) { 42103 appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value); 42104 } 42105 } 42106 const openAction = this._catDict.get("OpenAction"); 42107 if (openAction) { 42108 appendIfJavaScriptDict("OpenAction", openAction); 42109 } 42110 return javaScript; 42111 } 42112 get jsActions() { 42113 const javaScript = this._collectJavaScript(); 42114 let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType); 42115 if (javaScript) { 42116 actions ||= Object.create(null); 42117 for (const [key, val] of javaScript) { 42118 if (key in actions) { 42119 actions[key].push(val); 42120 } else { 42121 actions[key] = [val]; 42122 } 42123 } 42124 } 42125 return (0, _util.shadow)(this, "jsActions", actions); 42126 } 42127 async fontFallback(id, handler) { 42128 const translatedFonts = await Promise.all(this.fontCache); 42129 for (const translatedFont of translatedFonts) { 42130 if (translatedFont.loadedName === id) { 42131 translatedFont.fallback(handler); 42132 return; 42133 } 42134 } 42135 } 42136 async cleanup(manuallyTriggered = false) { 42137 (0, _cleanup_helper.clearGlobalCaches)(); 42138 this.globalImageCache.clear(manuallyTriggered); 42139 this.pageKidsCountCache.clear(); 42140 this.pageIndexCache.clear(); 42141 this.nonBlendModesSet.clear(); 42142 const translatedFonts = await Promise.all(this.fontCache); 42143 for (const { 42144 dict 42145 } of translatedFonts) { 42146 delete dict.cacheKey; 42147 } 42148 this.fontCache.clear(); 42149 this.builtInCMapCache.clear(); 42150 this.standardFontDataCache.clear(); 42151 this.systemFontCache.clear(); 42152 } 42153 async getPageDict(pageIndex) { 42154 const nodesToVisit = [this.toplevelPagesDict]; 42155 const visitedNodes = new _primitives.RefSet(); 42156 const pagesRef = this._catDict.getRaw("Pages"); 42157 if (pagesRef instanceof _primitives.Ref) { 42158 visitedNodes.put(pagesRef); 42159 } 42160 const xref = this.xref, 42161 pageKidsCountCache = this.pageKidsCountCache, 42162 pageIndexCache = this.pageIndexCache;
42163 let currentPageIndex = 0; 42164 while (nodesToVisit.length) { 42165 const currentNode = nodesToVisit.pop(); 42166 if (currentNode instanceof _primitives.Ref) { 42167 const count = pageKidsCountCache.get(currentNode); 42168 if (count >= 0 && currentPageIndex + count <= pageIndex) { 42169 currentPageIndex += count; 42170 continue; 42171 } 42172 if (visitedNodes.has(currentNode)) { 42173 throw new _util.FormatError("Pages tree contains circular reference."); 42174 } 42175 visitedNodes.put(currentNode); 42176 const obj = await xref.fetchAsync(currentNode); 42177 if (obj instanceof _primitives.Dict) { 42178 let type = obj.getRaw("Type"); 42179 if (type instanceof _primitives.Ref) { 42180 type = await xref.fetchAsync(type); 42181 } 42182 if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) { 42183 if (!pageKidsCountCache.has(currentNode)) { 42184 pageKidsCountCache.put(currentNode, 1); 42185 } 42186 if (!pageIndexCache.has(currentNode)) { 42187 pageIndexCache.put(currentNode, currentPageIndex); 42188 } 42189 if (currentPageIndex === pageIndex) { 42190 return [obj, currentNode]; 42191 } 42192 currentPageIndex++; 42193 continue; 42194 } 42195 } 42196 nodesToVisit.push(obj); 42197 continue; 42198 } 42199 if (!(currentNode instanceof _primitives.Dict)) { 42200 throw new _util.FormatError("Page dictionary kid reference points to wrong type of object."); 42201 } 42202 const { 42203 objId 42204 } = currentNode; 42205 let count = currentNode.getRaw("Count"); 42206 if (count instanceof _primitives.Ref) { 42207 count = await xref.fetchAsync(count); 42208 } 42209 if (Number.isInteger(count) && count >= 0) { 42210 if (objId && !pageKidsCountCache.has(objId)) { 42211 pageKidsCountCache.put(objId, count); 42212 } 42213 if (currentPageIndex + count <= pageIndex) { 42214 currentPageIndex += count; 42215 continue; 42216 } 42217 } 42218 let kids = currentNode.getRaw("Kids"); 42219 if (kids instanceof _primitives.Ref) { 42220 kids = await xref.fetchAsync(kids); 42221 } 42222 if (!Array.isArray(kids)) { 42223 let type = currentNode.getRaw("Type"); 42224 if (type instanceof _primitives.Ref) { 42225 type = await xref.fetchAsync(type); 42226 } 42227 if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) { 42228 if (currentPageIndex === pageIndex) { 42229 return [currentNode, null]; 42230 } 42231 currentPageIndex++; 42232 continue; 42233 } 42234 throw new _util.FormatError("Page dictionary kids object is not an array."); 42235 } 42236 for (let last = kids.length - 1; last >= 0; last--) { 42237 nodesToVisit.push(kids[last]); 42238 } 42239 } 42240 throw new Error(`Page index ${pageIndex} not found.`); 42241 } 42242 async getAllPageDicts(recoveryMode = false) { 42243 const { 42244 ignoreErrors 42245 } = this.pdfManager.evaluatorOptions; 42246 const queue = [{ 42247 currentNode: this.toplevelPagesDict, 42248 posInKids: 0 42249 }]; 42250 const visitedNodes = new _primitives.RefSet(); 42251 const pagesRef = this._catDict.getRaw("Pages"); 42252 if (pagesRef instanceof _primitives.Ref) { 42253 visitedNodes.put(pagesRef); 42254 } 42255 const map = new Map(), 42256 xref = this.xref, 42257 pageIndexCache = this.pageIndexCache; 42258 let pageIndex = 0; 42259 function addPageDict(pageDict, pageRef) { 42260 if (pageRef && !pageIndexCache.has(pageRef)) { 42261 pageIndexCache.put(pageRef, pageIndex); 42262 } 42263 map.set(pageIndex++, [pageDict, pageRef]); 42264 } 42265 function addPageError(error) { 42266 if (error instanceof _core_utils.XRefEntryException && !recoveryMode) { 42267 throw error; 42268 } 42269 if (recoveryMode && ignoreErrors && pageIndex === 0) { 42270 (0, _util.warn)(`getAllPageDicts - Skipping invalid first page: "${error}".`); 42271 error = _primitives.Dict.empty; 42272 } 42273 map.set(pageIndex++, [error, null]); 42274 } 42275 while (queue.length > 0) { 42276 const queueItem = queue.at(-1); 42277 const { 42278 currentNode, 42279 posInKids 42280 } = queueItem; 42281 let kids = currentNode.getRaw("Kids"); 42282 if (kids instanceof _primitives.Ref) { 42283 try { 42284 kids = await xref.fetchAsync(kids); 42285 } catch (ex) { 42286 addPageError(ex); 42287 break; 42288 } 42289 } 42290 if (!Array.isArray(kids)) { 42291 addPageError(new _util.FormatError("Page dictionary kids object is not an array.")); 42292 break; 42293 } 42294 if (posInKids >= kids.length) { 42295 queue.pop(); 42296 continue; 42297 }
42298 const kidObj = kids[posInKids]; 42299 let obj; 42300 if (kidObj instanceof _primitives.Ref) { 42301 if (visitedNodes.has(kidObj)) { 42302 addPageError(new _util.FormatError("Pages tree contains circular reference.")); 42303 break; 42304 } 42305 visitedNodes.put(kidObj); 42306 try { 42307 obj = await xref.fetchAsync(kidObj); 42308 } catch (ex) { 42309 addPageError(ex); 42310 break; 42311 } 42312 } else { 42313 obj = kidObj; 42314 } 42315 if (!(obj instanceof _primitives.Dict)) { 42316 addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object.")); 42317 break; 42318 } 42319 let type = obj.getRaw("Type"); 42320 if (type instanceof _primitives.Ref) { 42321 try { 42322 type = await xref.fetchAsync(type); 42323 } catch (ex) { 42324 addPageError(ex); 42325 break; 42326 } 42327 } 42328 if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) { 42329 addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null); 42330 } else { 42331 queue.push({ 42332 currentNode: obj, 42333 posInKids: 0 42334 }); 42335 } 42336 queueItem.posInKids++; 42337 } 42338 return map; 42339 } 42340 getPageIndex(pageRef) { 42341 const cachedPageIndex = this.pageIndexCache.get(pageRef); 42342 if (cachedPageIndex !== undefined) { 42343 return Promise.resolve(cachedPageIndex); 42344 } 42345 const xref = this.xref; 42346 function pagesBeforeRef(kidRef) { 42347 let total = 0, 42348 parentRef; 42349 return xref.fetchAsync(kidRef).then(function (node) { 42350 if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) { 42351 throw new _util.FormatError("The reference does not point to a /Page dictionary."); 42352 } 42353 if (!node) { 42354 return null; 42355 } 42356 if (!(node instanceof _primitives.Dict)) { 42357 throw new _util.FormatError("Node must be a dictionary."); 42358 } 42359 parentRef = node.getRaw("Parent"); 42360 return node.getAsync("Parent"); 42361 }).then(function (parent) { 42362 if (!parent) { 42363 return null; 42364 } 42365 if (!(parent instanceof _primitives.Dict)) { 42366 throw new _util.FormatError("Parent must be a dictionary."); 42367 } 42368 return parent.getAsync("Kids"); 42369 }).then(function (kids) { 42370 if (!kids) { 42371 return null; 42372 } 42373 const kidPromises = []; 42374 let found = false; 42375 for (const kid of kids) { 42376 if (!(kid instanceof _primitives.Ref)) { 42377 throw new _util.FormatError("Kid must be a reference."); 42378 } 42379 if ((0, _primitives.isRefsEqual)(kid, kidRef)) { 42380 found = true; 42381 break; 42382 } 42383 kidPromises.push(xref.fetchAsync(kid).then(function (obj) { 42384 if (!(obj instanceof _primitives.Dict)) { 42385 throw new _util.FormatError("Kid node must be a dictionary."); 42386 } 42387 if (obj.has("Count")) { 42388 total += obj.get("Count"); 42389 } else { 42390 total++; 42391 } 42392 })); 42393 } 42394 if (!found) { 42395 throw new _util.FormatError("Kid reference not found in parent's kids."); 42396 } 42397 return Promise.all(kidPromises).then(function () { 42398 return [total, parentRef]; 42399 }); 42400 }); 42401 } 42402 let total = 0; 42403 const next = ref => pagesBeforeRef(ref).then(args => { 42404 if (!args) { 42405 this.pageIndexCache.put(pageRef, total); 42406 return total; 42407 } 42408 const [count, parentRef] = args; 42409 total += count; 42410 return next(parentRef); 42411 }); 42412 return next(pageRef); 42413 } 42414 get baseUrl() { 42415 const uri = this._catDict.get("URI"); 42416 if (uri instanceof _primitives.Dict) { 42417 const base = uri.get("Base"); 42418 if (typeof base === "string") { 42419 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, { 42420 tryConvertEncoding: true 42421 }); 42422 if (absoluteUrl) { 42423 return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href); 42424 } 42425 } 42426 } 42427 return (0, _util.shadow)(this, "baseUrl", this.pdfManager.docBaseUrl); 42428 } 42429 static parseDestDictionary({ 42430 destDict, 42431 resultObj, 42432 docBaseUrl = null, 42433 docAttachments = null 42434 }) { 42435 if (!(destDict instanceof _primitives.Dict)) { 42436 (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary."); 42437 return; 42438 } 42439 let action = destDict.get("A"), 42440 url, 42441 dest; 42442 if (!(action instanceof _primitives.Dict)) { 42443 if (destDict.has("Dest")) { 42444 action = destDict.get("Dest"); 42445 } else { 42446 action = destDict.get("AA"); 42447 if (action instanceof _primitives.Dict) { 42448 if (action.has("D")) { 42449 action = action.get("D"); 42450 } else if (action.has("U")) { 42451 action = action.get("U"); 42452 } 42453 } 42454 } 42455 } 42456 if (action instanceof _primitives.Dict) { 42457 const actionType = action.get("S"); 42458 if (!(actionType instanceof _primitives.Name)) { 42459 (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary."); 42460 return; 42461 }
42462 const actionName = actionType.name; 42463 switch (actionName) { 42464 case "ResetForm": 42465 const flags = action.get("Flags"); 42466 const include = ((typeof flags === "number" ? flags : 0) & 1) === 0; 42467 const fields = []; 42468 const refs = []; 42469 for (const obj of action.get("Fields") || []) { 42470 if (obj instanceof _primitives.Ref) { 42471 refs.push(obj.toString()); 42472 } else if (typeof obj === "string") { 42473 fields.push((0, _util.stringToPDFString)(obj)); 42474 } 42475 } 42476 resultObj.resetForm = { 42477 fields, 42478 refs, 42479 include 42480 }; 42481 break; 42482 case "URI": 42483 url = action.get("URI"); 42484 if (url instanceof _primitives.Name) { 42485 url = "/" + url.name; 42486 } 42487 break; 42488 case "GoTo": 42489 dest = action.get("D"); 42490 break; 42491 case "Launch": 42492 case "GoToR": 42493 const urlDict = action.get("F"); 42494 if (urlDict instanceof _primitives.Dict) { 42495 url = urlDict.get("F") || null; 42496 } else if (typeof urlDict === "string") { 42497 url = urlDict; 42498 } 42499 let remoteDest = action.get("D"); 42500 if (remoteDest) { 42501 if (remoteDest instanceof _primitives.Name) { 42502 remoteDest = remoteDest.name; 42503 } 42504 if (typeof url === "string") { 42505 const baseUrl = url.split("#")[0]; 42506 if (typeof remoteDest === "string") { 42507 url = baseUrl + "#" + remoteDest; 42508 } else if (Array.isArray(remoteDest)) { 42509 url = baseUrl + "#" + JSON.stringify(remoteDest); 42510 } 42511 } 42512 } 42513 const newWindow = action.get("NewWindow"); 42514 if (typeof newWindow === "boolean") { 42515 resultObj.newWindow = newWindow; 42516 } 42517 break; 42518 case "GoToE": 42519 const target = action.get("T"); 42520 let attachment; 42521 if (docAttachments && target instanceof _primitives.Dict) { 42522 const relationship = target.get("R"); 42523 const name = target.get("N"); 42524 if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") { 42525 attachment = docAttachments[(0, _util.stringToPDFString)(name)]; 42526 } 42527 } 42528 if (attachment) { 42529 resultObj.attachment = attachment; 42530 } else { 42531 (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`); 42532 } 42533 break; 42534 case "Named": 42535 const namedAction = action.get("N"); 42536 if (namedAction instanceof _primitives.Name) { 42537 resultObj.action = namedAction.name; 42538 } 42539 break; 42540 case "SetOCGState": 42541 const state = action.get("State"); 42542 const preserveRB = action.get("PreserveRB"); 42543 if (!Array.isArray(state) || state.length === 0) { 42544 break; 42545 } 42546 const stateArr = []; 42547 for (const elem of state) { 42548 if (elem instanceof _primitives.Name) { 42549 switch (elem.name) { 42550 case "ON": 42551 case "OFF": 42552 case "Toggle": 42553 stateArr.push(elem.name); 42554 break; 42555 } 42556 } else if (elem instanceof _primitives.Ref) { 42557 stateArr.push(elem.toString()); 42558 } 42559 } 42560 if (stateArr.length !== state.length) { 42561 break; 42562 } 42563 resultObj.setOCGState = { 42564 state: stateArr, 42565 preserveRB: typeof preserveRB === "boolean" ? preserveRB : true 42566 }; 42567 break; 42568 case "JavaScript": 42569 const jsAction = action.get("JS"); 42570 let js; 42571 if (jsAction instanceof _base_stream.BaseStream) { 42572 js = jsAction.getString(); 42573 } else if (typeof jsAction === "string") { 42574 js = jsAction; 42575 } 42576 const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js)); 42577 if (jsURL) { 42578 url = jsURL.url; 42579 resultObj.newWindow = jsURL.newWindow; 42580 break; 42581 } 42582 default: 42583 if (actionName === "JavaScript" || actionName === "SubmitForm") { 42584 break; 42585 } 42586 (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`); 42587 break; 42588 } 42589 } else if (destDict.has("Dest")) { 42590 dest = destDict.get("Dest"); 42591 } 42592 if (typeof url === "string") { 42593 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, { 42594 addDefaultProtocol: true, 42595 tryConvertEncoding: true 42596 }); 42597 if (absoluteUrl) { 42598 resultObj.url = absoluteUrl.href; 42599 } 42600 resultObj.unsafeUrl = url; 42601 } 42602 if (dest) { 42603 if (dest instanceof _primitives.Name) { 42604 dest = dest.name; 42605 } 42606 if (typeof dest === "string") { 42607 resultObj.dest = (0, _util.stringToPDFString)(dest); 42608 } else if (Array.isArray(dest)) { 42609 resultObj.dest = dest; 42610 } 42611 } 42612 } 42613} 42614exports.Catalog = Catalog; 42615 42616/***/ }), 42617/* 67 */ 42618/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 42619 42620 42621 42622Object.defineProperty(exports, "__esModule", ({ 42623 value: true 42624})); 42625exports.NumberTree = exports.NameTree = void 0; 42626var _primitives = __w_pdfjs_require__(4); 42627var _util = __w_pdfjs_require__(2); 42628class NameOrNumberTree { 42629 constructor(root, xref, type) { 42630 if (this.constructor === NameOrNumberTree) { 42631 (0, _util.unreachable)("Cannot initialize NameOrNumberTree."); 42632 } 42633 this.root = root; 42634 this.xref = xref; 42635 this._type = type; 42636 } 42637 getAll() { 42638 const map = new Map(); 42639 if (!this.root) { 42640 return map; 42641 } 42642 const xref = this.xref; 42643 const processed = new _primitives.RefSet(); 42644 processed.put(this.root); 42645 const queue = [this.root]; 42646 while (queue.length > 0) { 42647 const obj = xref.fetchIfRef(queue.shift()); 42648 if (!(obj instanceof _primitives.Dict)) { 42649 continue; 42650 } 42651 if (obj.has("Kids")) {
42652 const kids = obj.get("Kids"); 42653 if (!Array.isArray(kids)) { 42654 continue; 42655 } 42656 for (const kid of kids) { 42657 if (processed.has(kid)) { 42658 throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`); 42659 } 42660 queue.push(kid); 42661 processed.put(kid); 42662 } 42663 continue; 42664 } 42665 const entries = obj.get(this._type); 42666 if (!Array.isArray(entries)) { 42667 continue; 42668 } 42669 for (let i = 0, ii = entries.length; i < ii; i += 2) { 42670 map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1])); 42671 } 42672 } 42673 return map; 42674 } 42675 get(key) { 42676 if (!this.root) { 42677 return null; 42678 } 42679 const xref = this.xref; 42680 let kidsOrEntries = xref.fetchIfRef(this.root); 42681 let loopCount = 0; 42682 const MAX_LEVELS = 10; 42683 while (kidsOrEntries.has("Kids")) { 42684 if (++loopCount > MAX_LEVELS) { 42685 (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`); 42686 return null; 42687 } 42688 const kids = kidsOrEntries.get("Kids"); 42689 if (!Array.isArray(kids)) { 42690 return null; 42691 } 42692 let l = 0, 42693 r = kids.length - 1; 42694 while (l <= r) { 42695 const m = l + r >> 1; 42696 const kid = xref.fetchIfRef(kids[m]); 42697 const limits = kid.get("Limits"); 42698 if (key < xref.fetchIfRef(limits[0])) { 42699 r = m - 1; 42700 } else if (key > xref.fetchIfRef(limits[1])) { 42701 l = m + 1; 42702 } else { 42703 kidsOrEntries = kid; 42704 break; 42705 } 42706 } 42707 if (l > r) { 42708 return null; 42709 } 42710 } 42711 const entries = kidsOrEntries.get(this._type); 42712 if (Array.isArray(entries)) { 42713 let l = 0, 42714 r = entries.length - 2; 42715 while (l <= r) { 42716 const tmp = l + r >> 1, 42717 m = tmp + (tmp & 1); 42718 const currentKey = xref.fetchIfRef(entries[m]); 42719 if (key < currentKey) { 42720 r = m - 2; 42721 } else if (key > currentKey) { 42722 l = m + 2; 42723 } else { 42724 return xref.fetchIfRef(entries[m + 1]); 42725 } 42726 } 42727 } 42728 return null; 42729 } 42730} 42731class NameTree extends NameOrNumberTree { 42732 constructor(root, xref) { 42733 super(root, xref, "Names"); 42734 } 42735} 42736exports.NameTree = NameTree; 42737class NumberTree extends NameOrNumberTree { 42738 constructor(root, xref) { 42739 super(root, xref, "Nums"); 42740 } 42741} 42742exports.NumberTree = NumberTree; 42743 42744/***/ }), 42745/* 68 */ 42746/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 42747 42748 42749 42750Object.defineProperty(exports, "__esModule", ({ 42751 value: true 42752})); 42753exports.clearGlobalCaches = clearGlobalCaches; 42754var _pattern = __w_pdfjs_require__(50); 42755var _primitives = __w_pdfjs_require__(4); 42756var _unicode = __w_pdfjs_require__(40); 42757function clearGlobalCaches() { 42758 (0, _pattern.clearPatternCaches)(); 42759 (0, _primitives.clearPrimitiveCaches)(); 42760 (0, _unicode.clearUnicodeCaches)(); 42761} 42762 42763/***/ }), 42764/* 69 */ 42765/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 42766 42767 42768 42769Object.defineProperty(exports, "__esModule", ({ 42770 value: true 42771})); 42772exports.FileSpec = void 0; 42773var _util = __w_pdfjs_require__(2); 42774var _base_stream = __w_pdfjs_require__(5); 42775var _primitives = __w_pdfjs_require__(4); 42776function pickPlatformItem(dict) { 42777 if (dict.has("UF")) { 42778 return dict.get("UF"); 42779 } else if (dict.has("F")) { 42780 return dict.get("F"); 42781 } else if (dict.has("Unix")) { 42782 return dict.get("Unix"); 42783 } else if (dict.has("Mac")) { 42784 return dict.get("Mac"); 42785 } else if (dict.has("DOS")) { 42786 return dict.get("DOS"); 42787 } 42788 return null; 42789} 42790class FileSpec { 42791 constructor(root, xref) { 42792 if (!(root instanceof _primitives.Dict)) { 42793 return; 42794 } 42795 this.xref = xref; 42796 this.root = root; 42797 if (root.has("FS")) { 42798 this.fs = root.get("FS"); 42799 } 42800 this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : ""; 42801 if (root.has("RF")) { 42802 (0, _util.warn)("Related file specifications are not supported"); 42803 } 42804 this.contentAvailable = true; 42805 if (!root.has("EF")) { 42806 this.contentAvailable = false; 42807 (0, _util.warn)("Non-embedded file specifications are not supported"); 42808 } 42809 } 42810 get filename() { 42811 if (!this._filename && this.root) { 42812 const filename = pickPlatformItem(this.root) || "unnamed"; 42813 this._filename = (0, _util.stringToPDFString)(filename).replaceAll("\\\\", "\\").replaceAll("\\/", "/").replaceAll("\\", "/"); 42814 } 42815 return this._filename; 42816 } 42817 get content() { 42818 if (!this.contentAvailable) { 42819 return null; 42820 } 42821 if (!this.contentRef && this.root) { 42822 this.contentRef = pickPlatformItem(this.root.get("EF")); 42823 }
vendor: 18,289 bytes, lines 42824-43467
42824 let content = null; 42825 if (this.contentRef) { 42826 const fileObj = this.xref.fetchIfRef(this.contentRef); 42827 if (fileObj instanceof _base_stream.BaseStream) { 42828 content = fileObj.getBytes(); 42829 } else { 42830 (0, _util.warn)("Embedded file specification points to non-existing/invalid content"); 42831 } 42832 } else { 42833 (0, _util.warn)("Embedded file specification does not have a content"); 42834 } 42835 return content; 42836 } 42837 get serializable() { 42838 return { 42839 filename: this.filename, 42840 content: this.content 42841 }; 42842 } 42843} 42844exports.FileSpec = FileSpec; 42845 42846/***/ }), 42847/* 70 */ 42848/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 42849 42850 42851 42852Object.defineProperty(exports, "__esModule", ({ 42853 value: true 42854})); 42855exports.MetadataParser = void 0; 42856var _xml_parser = __w_pdfjs_require__(71); 42857class MetadataParser { 42858 constructor(data) { 42859 data = this._repair(data); 42860 const parser = new _xml_parser.SimpleXMLParser({ 42861 lowerCaseName: true 42862 }); 42863 const xmlDocument = parser.parseFromString(data); 42864 this._metadataMap = new Map(); 42865 this._data = data; 42866 if (xmlDocument) { 42867 this._parse(xmlDocument); 42868 } 42869 } 42870 _repair(data) { 42871 return data.replace(/^[^<]+/, "").replaceAll(/>\\376\\377([^<]+)/g, function (all, codes) { 42872 const bytes = codes.replaceAll(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { 42873 return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); 42874 }).replaceAll(/&(amp|apos|gt|lt|quot);/g, function (str, name) { 42875 switch (name) { 42876 case "amp": 42877 return "&"; 42878 case "apos": 42879 return "'"; 42880 case "gt": 42881 return ">"; 42882 case "lt": 42883 return "<"; 42884 case "quot": 42885 return '"'; 42886 } 42887 throw new Error(`_repair: ${name} isn't defined.`); 42888 }); 42889 const charBuf = [">"]; 42890 for (let i = 0, ii = bytes.length; i < ii; i += 2) { 42891 const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); 42892 if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { 42893 charBuf.push(String.fromCharCode(code)); 42894 } else { 42895 charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";"); 42896 } 42897 } 42898 return charBuf.join(""); 42899 }); 42900 } 42901 _getSequence(entry) { 42902 const name = entry.nodeName; 42903 if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") { 42904 return null; 42905 } 42906 return entry.childNodes.filter(node => node.nodeName === "rdf:li"); 42907 } 42908 _parseArray(entry) { 42909 if (!entry.hasChildNodes()) { 42910 return; 42911 } 42912 const [seqNode] = entry.childNodes; 42913 const sequence = this._getSequence(seqNode) || []; 42914 this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim())); 42915 } 42916 _parse(xmlDocument) { 42917 let rdf = xmlDocument.documentElement; 42918 if (rdf.nodeName !== "rdf:rdf") { 42919 rdf = rdf.firstChild; 42920 while (rdf && rdf.nodeName !== "rdf:rdf") { 42921 rdf = rdf.nextSibling; 42922 } 42923 } 42924 if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) { 42925 return; 42926 } 42927 for (const desc of rdf.childNodes) { 42928 if (desc.nodeName !== "rdf:description") { 42929 continue; 42930 } 42931 for (const entry of desc.childNodes) { 42932 const name = entry.nodeName; 42933 switch (name) { 42934 case "#text": 42935 continue; 42936 case "dc:creator": 42937 case "dc:subject": 42938 this._parseArray(entry); 42939 continue; 42940 } 42941 this._metadataMap.set(name, entry.textContent.trim()); 42942 } 42943 } 42944 } 42945 get serializable() { 42946 return { 42947 parsedData: this._metadataMap, 42948 rawData: this._data 42949 }; 42950 } 42951} 42952exports.MetadataParser = MetadataParser; 42953 42954/***/ }), 42955/* 71 */ 42956/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 42957 42958 42959 42960Object.defineProperty(exports, "__esModule", ({ 42961 value: true 42962})); 42963exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0; 42964var _core_utils = __w_pdfjs_require__(3); 42965const XMLParserErrorCode = { 42966 NoError: 0, 42967 EndOfDocument: -1, 42968 UnterminatedCdat: -2, 42969 UnterminatedXmlDeclaration: -3, 42970 UnterminatedDoctypeDeclaration: -4, 42971 UnterminatedComment: -5, 42972 MalformedElement: -6, 42973 OutOfMemory: -7, 42974 UnterminatedAttributeValue: -8, 42975 UnterminatedElement: -9, 42976 ElementNeverBegun: -10 42977}; 42978exports.XMLParserErrorCode = XMLParserErrorCode; 42979function isWhitespace(s, index) { 42980 const ch = s[index]; 42981 return ch === " " || ch === "\n" || ch === "\r" || ch === "\t"; 42982} 42983function isWhitespaceString(s) { 42984 for (let i = 0, ii = s.length; i < ii; i++) { 42985 if (!isWhitespace(s, i)) { 42986 return false; 42987 } 42988 } 42989 return true; 42990} 42991class XMLParserBase { 42992 _resolveEntities(s) { 42993 return s.replaceAll(/&([^;]+);/g, (all, entity) => { 42994 if (entity.substring(0, 2) === "#x") { 42995 return String.fromCodePoint(parseInt(entity.substring(2), 16)); 42996 } else if (entity.substring(0, 1) === "#") { 42997 return String.fromCodePoint(parseInt(entity.substring(1), 10)); 42998 } 42999 switch (entity) { 43000 case "lt": 43001 return "<"; 43002 case "gt": 43003 return ">"; 43004 case "amp": 43005 return "&"; 43006 case "quot": 43007 return '"'; 43008 case "apos": 43009 return "'"; 43010 } 43011 return this.onResolveEntity(entity); 43012 }); 43013 } 43014 _parseContent(s, start) { 43015 const attributes = []; 43016 let pos = start; 43017 function skipWs() { 43018 while (pos < s.length && isWhitespace(s, pos)) { 43019 ++pos; 43020 } 43021 } 43022 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { 43023 ++pos; 43024 } 43025 const name = s.substring(start, pos); 43026 skipWs(); 43027 while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") { 43028 skipWs(); 43029 let attrName = "", 43030 attrValue = ""; 43031 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") { 43032 attrName += s[pos]; 43033 ++pos; 43034 } 43035 skipWs(); 43036 if (s[pos] !== "=") { 43037 return null; 43038 } 43039 ++pos; 43040 skipWs(); 43041 const attrEndChar = s[pos]; 43042 if (attrEndChar !== '"' && attrEndChar !== "'") { 43043 return null; 43044 } 43045 const attrEndIndex = s.indexOf(attrEndChar, ++pos); 43046 if (attrEndIndex < 0) { 43047 return null; 43048 } 43049 attrValue = s.substring(pos, attrEndIndex); 43050 attributes.push({ 43051 name: attrName, 43052 value: this._resolveEntities(attrValue) 43053 }); 43054 pos = attrEndIndex + 1; 43055 skipWs(); 43056 } 43057 return { 43058 name, 43059 attributes, 43060 parsed: pos - start 43061 }; 43062 } 43063 _parseProcessingInstruction(s, start) { 43064 let pos = start; 43065 function skipWs() { 43066 while (pos < s.length && isWhitespace(s, pos)) { 43067 ++pos; 43068 } 43069 } 43070 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") { 43071 ++pos; 43072 } 43073 const name = s.substring(start, pos); 43074 skipWs(); 43075 const attrStart = pos; 43076 while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) { 43077 ++pos; 43078 } 43079 const value = s.substring(attrStart, pos); 43080 return { 43081 name, 43082 value, 43083 parsed: pos - start 43084 }; 43085 } 43086 parseXml(s) { 43087 let i = 0; 43088 while (i < s.length) { 43089 const ch = s[i]; 43090 let j = i; 43091 if (ch === "<") { 43092 ++j; 43093 const ch2 = s[j]; 43094 let q; 43095 switch (ch2) { 43096 case "/": 43097 ++j; 43098 q = s.indexOf(">", j); 43099 if (q < 0) { 43100 this.onError(XMLParserErrorCode.UnterminatedElement); 43101 return; 43102 } 43103 this.onEndElement(s.substring(j, q)); 43104 j = q + 1; 43105 break; 43106 case "?": 43107 ++j; 43108 const pi = this._parseProcessingInstruction(s, j); 43109 if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") { 43110 this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration); 43111 return; 43112 } 43113 this.onPi(pi.name, pi.value); 43114 j += pi.parsed + 2; 43115 break; 43116 case "!": 43117 if (s.substring(j + 1, j + 3) === "--") { 43118 q = s.indexOf("-->", j + 3); 43119 if (q < 0) { 43120 this.onError(XMLParserErrorCode.UnterminatedComment); 43121 return; 43122 } 43123 this.onComment(s.substring(j + 3, q)); 43124 j = q + 3; 43125 } else if (s.substring(j + 1, j + 8) === "[CDATA[") { 43126 q = s.indexOf("]]>", j + 8); 43127 if (q < 0) { 43128 this.onError(XMLParserErrorCode.UnterminatedCdat); 43129 return; 43130 } 43131 this.onCdata(s.substring(j + 8, q)); 43132 j = q + 3; 43133 } else if (s.substring(j + 1, j + 8) === "DOCTYPE") { 43134 const q2 = s.indexOf("[", j + 8); 43135 let complexDoctype = false; 43136 q = s.indexOf(">", j + 8); 43137 if (q < 0) { 43138 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 43139 return; 43140 } 43141 if (q2 > 0 && q > q2) { 43142 q = s.indexOf("]>", j + 8); 43143 if (q < 0) { 43144 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 43145 return; 43146 } 43147 complexDoctype = true; 43148 } 43149 const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); 43150 this.onDoctype(doctypeContent); 43151 j = q + (complexDoctype ? 2 : 1); 43152 } else { 43153 this.onError(XMLParserErrorCode.MalformedElement); 43154 return; 43155 } 43156 break; 43157 default: 43158 const content = this._parseContent(s, j); 43159 if (content === null) { 43160 this.onError(XMLParserErrorCode.MalformedElement); 43161 return; 43162 } 43163 let isClosed = false; 43164 if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") { 43165 isClosed = true; 43166 } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") { 43167 this.onError(XMLParserErrorCode.UnterminatedElement); 43168 return; 43169 } 43170 this.onBeginElement(content.name, content.attributes, isClosed); 43171 j += content.parsed + (isClosed ? 2 : 1); 43172 break; 43173 } 43174 } else { 43175 while (j < s.length && s[j] !== "<") { 43176 j++; 43177 } 43178 const text = s.substring(i, j); 43179 this.onText(this._resolveEntities(text)); 43180 } 43181 i = j; 43182 } 43183 } 43184 onResolveEntity(name) { 43185 return `&${name};`; 43186 } 43187 onPi(name, value) {} 43188 onComment(text) {} 43189 onCdata(text) {} 43190 onDoctype(doctypeContent) {} 43191 onText(text) {} 43192 onBeginElement(name, attributes, isEmpty) {} 43193 onEndElement(name) {} 43194 onError(code) {} 43195} 43196exports.XMLParserBase = XMLParserBase; 43197class SimpleDOMNode { 43198 constructor(nodeName, nodeValue) { 43199 this.nodeName = nodeName; 43200 this.nodeValue = nodeValue; 43201 Object.defineProperty(this, "parentNode", { 43202 value: null, 43203 writable: true 43204 }); 43205 } 43206 get firstChild() { 43207 return this.childNodes?.[0]; 43208 } 43209 get nextSibling() { 43210 const childNodes = this.parentNode.childNodes; 43211 if (!childNodes) { 43212 return undefined; 43213 } 43214 const index = childNodes.indexOf(this); 43215 if (index === -1) { 43216 return undefined; 43217 } 43218 return childNodes[index + 1]; 43219 } 43220 get textContent() { 43221 if (!this.childNodes) { 43222 return this.nodeValue || ""; 43223 } 43224 return this.childNodes.map(function (child) { 43225 return child.textContent; 43226 }).join(""); 43227 } 43228 get children() { 43229 return this.childNodes || []; 43230 } 43231 hasChildNodes() { 43232 return this.childNodes?.length > 0; 43233 } 43234 searchNode(paths, pos) { 43235 if (pos >= paths.length) { 43236 return this; 43237 } 43238 const component = paths[pos]; 43239 if (component.name.startsWith("#") && pos < paths.length - 1) { 43240 return this.searchNode(paths, pos + 1); 43241 } 43242 const stack = []; 43243 let node = this; 43244 while (true) { 43245 if (component.name === node.nodeName) { 43246 if (component.pos === 0) { 43247 const res = node.searchNode(paths, pos + 1); 43248 if (res !== null) { 43249 return res; 43250 } 43251 } else if (stack.length === 0) { 43252 return null; 43253 } else { 43254 const [parent] = stack.pop(); 43255 let siblingPos = 0; 43256 for (const child of parent.childNodes) { 43257 if (component.name === child.nodeName) { 43258 if (siblingPos === component.pos) { 43259 return child.searchNode(paths, pos + 1); 43260 } 43261 siblingPos++; 43262 } 43263 } 43264 return node.searchNode(paths, pos + 1); 43265 } 43266 } 43267 if (node.childNodes?.length > 0) { 43268 stack.push([node, 0]); 43269 node = node.childNodes[0]; 43270 } else if (stack.length === 0) { 43271 return null; 43272 } else { 43273 while (stack.length !== 0) { 43274 const [parent, currentPos] = stack.pop(); 43275 const newPos = currentPos + 1; 43276 if (newPos < parent.childNodes.length) { 43277 stack.push([parent, newPos]); 43278 node = parent.childNodes[newPos]; 43279 break; 43280 } 43281 } 43282 if (stack.length === 0) { 43283 return null; 43284 } 43285 } 43286 } 43287 } 43288 dump(buffer) { 43289 if (this.nodeName === "#text") { 43290 buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue)); 43291 return; 43292 } 43293 buffer.push(`<${this.nodeName}`); 43294 if (this.attributes) { 43295 for (const attribute of this.attributes) { 43296 buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`); 43297 } 43298 } 43299 if (this.hasChildNodes()) { 43300 buffer.push(">"); 43301 for (const child of this.childNodes) { 43302 child.dump(buffer); 43303 } 43304 buffer.push(`</${this.nodeName}>`); 43305 } else if (this.nodeValue) { 43306 buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`); 43307 } else { 43308 buffer.push("/>"); 43309 } 43310 } 43311} 43312exports.SimpleDOMNode = SimpleDOMNode; 43313class SimpleXMLParser extends XMLParserBase { 43314 constructor({ 43315 hasAttributes = false, 43316 lowerCaseName = false 43317 }) { 43318 super(); 43319 this._currentFragment = null; 43320 this._stack = null; 43321 this._errorCode = XMLParserErrorCode.NoError; 43322 this._hasAttributes = hasAttributes; 43323 this._lowerCaseName = lowerCaseName; 43324 } 43325 parseFromString(data) { 43326 this._currentFragment = []; 43327 this._stack = []; 43328 this._errorCode = XMLParserErrorCode.NoError; 43329 this.parseXml(data); 43330 if (this._errorCode !== XMLParserErrorCode.NoError) { 43331 return undefined; 43332 } 43333 const [documentElement] = this._currentFragment; 43334 if (!documentElement) { 43335 return undefined; 43336 } 43337 return { 43338 documentElement 43339 }; 43340 } 43341 onText(text) { 43342 if (isWhitespaceString(text)) { 43343 return; 43344 } 43345 const node = new SimpleDOMNode("#text", text); 43346 this._currentFragment.push(node); 43347 } 43348 onCdata(text) { 43349 const node = new SimpleDOMNode("#text", text); 43350 this._currentFragment.push(node); 43351 } 43352 onBeginElement(name, attributes, isEmpty) { 43353 if (this._lowerCaseName) { 43354 name = name.toLowerCase(); 43355 } 43356 const node = new SimpleDOMNode(name); 43357 node.childNodes = []; 43358 if (this._hasAttributes) { 43359 node.attributes = attributes; 43360 } 43361 this._currentFragment.push(node); 43362 if (isEmpty) { 43363 return; 43364 } 43365 this._stack.push(this._currentFragment); 43366 this._currentFragment = node.childNodes; 43367 } 43368 onEndElement(name) { 43369 this._currentFragment = this._stack.pop() || []; 43370 const lastElement = this._currentFragment.at(-1); 43371 if (!lastElement) { 43372 return null; 43373 } 43374 for (const childNode of lastElement.childNodes) { 43375 childNode.parentNode = lastElement; 43376 } 43377 return lastElement; 43378 } 43379 onError(code) { 43380 this._errorCode = code; 43381 } 43382} 43383exports.SimpleXMLParser = SimpleXMLParser; 43384 43385/***/ }), 43386/* 72 */ 43387/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 43388 43389 43390 43391Object.defineProperty(exports, "__esModule", ({ 43392 value: true 43393})); 43394exports.StructTreeRoot = exports.StructTreePage = void 0; 43395var _util = __w_pdfjs_require__(2); 43396var _primitives = __w_pdfjs_require__(4); 43397var _name_number_tree = __w_pdfjs_require__(67); 43398var _writer = __w_pdfjs_require__(73); 43399const MAX_DEPTH = 40; 43400const StructElementType = { 43401 PAGE_CONTENT: 1, 43402 STREAM_CONTENT: 2, 43403 OBJECT: 3, 43404 ANNOTATION: 4, 43405 ELEMENT: 5 43406}; 43407class StructTreeRoot { 43408 constructor(rootDict, rootRef) { 43409 this.dict = rootDict; 43410 this.ref = rootRef instanceof _primitives.Ref ? rootRef : null; 43411 this.roleMap = new Map(); 43412 this.structParentIds = null; 43413 } 43414 init() { 43415 this.readRoleMap(); 43416 } 43417 #addIdToPage(pageRef, id, type) { 43418 if (!(pageRef instanceof _primitives.Ref) || id < 0) { 43419 return; 43420 } 43421 this.structParentIds ||= new _primitives.RefSetCache(); 43422 let ids = this.structParentIds.get(pageRef); 43423 if (!ids) { 43424 ids = []; 43425 this.structParentIds.put(pageRef, ids); 43426 } 43427 ids.push([id, type]); 43428 } 43429 addAnnotationIdToPage(pageRef, id) { 43430 this.#addIdToPage(pageRef, id, StructElementType.ANNOTATION); 43431 } 43432 readRoleMap() { 43433 const roleMapDict = this.dict.get("RoleMap"); 43434 if (!(roleMapDict instanceof _primitives.Dict)) { 43435 return; 43436 } 43437 roleMapDict.forEach((key, value) => { 43438 if (!(value instanceof _primitives.Name)) { 43439 return; 43440 } 43441 this.roleMap.set(key, value.name); 43442 }); 43443 } 43444 static async canCreateStructureTree({ 43445 catalogRef, 43446 pdfManager, 43447 newAnnotationsByPage 43448 }) { 43449 if (!(catalogRef instanceof _primitives.Ref)) { 43450 (0, _util.warn)("Cannot save the struct tree: no catalog reference."); 43451 return false; 43452 } 43453 let nextKey = 0; 43454 let hasNothingToUpdate = true; 43455 for (const [pageIndex, elements] of newAnnotationsByPage) { 43456 const { 43457 ref: pageRef 43458 } = await pdfManager.getPage(pageIndex); 43459 if (!(pageRef instanceof _primitives.Ref)) { 43460 (0, _util.warn)(`Cannot save the struct tree: page ${pageIndex} has no ref.`); 43461 hasNothingToUpdate = true; 43462 break; 43463 } 43464 for (const element of elements) { 43465 if (element.accessibilityData?.type) { 43466 element.parentTreeId = nextKey++; 43467 hasNothingToUpdate = false;
43468 } 43469 } 43470 } 43471 if (hasNothingToUpdate) { 43472 for (const elements of newAnnotationsByPage.values()) { 43473 for (const element of elements) { 43474 delete element.parentTreeId; 43475 } 43476 } 43477 return false; 43478 } 43479 return true; 43480 } 43481 static async createStructureTree({ 43482 newAnnotationsByPage, 43483 xref, 43484 catalogRef, 43485 pdfManager, 43486 newRefs 43487 }) { 43488 const root = pdfManager.catalog.cloneDict(); 43489 const structTreeRootRef = xref.getNewTemporaryRef(); 43490 root.set("StructTreeRoot", structTreeRootRef); 43491 const buffer = []; 43492 await (0, _writer.writeObject)(catalogRef, root, buffer, xref); 43493 newRefs.push({ 43494 ref: catalogRef, 43495 data: buffer.join("") 43496 }); 43497 const structTreeRoot = new _primitives.Dict(xref); 43498 structTreeRoot.set("Type", _primitives.Name.get("StructTreeRoot")); 43499 const parentTreeRef = xref.getNewTemporaryRef(); 43500 structTreeRoot.set("ParentTree", parentTreeRef); 43501 const kids = []; 43502 structTreeRoot.set("K", kids); 43503 const parentTree = new _primitives.Dict(xref); 43504 const nums = []; 43505 parentTree.set("Nums", nums); 43506 const nextKey = await this.#writeKids({ 43507 newAnnotationsByPage, 43508 structTreeRootRef, 43509 kids, 43510 nums, 43511 xref, 43512 pdfManager, 43513 newRefs, 43514 buffer 43515 }); 43516 structTreeRoot.set("ParentTreeNextKey", nextKey); 43517 buffer.length = 0; 43518 await (0, _writer.writeObject)(parentTreeRef, parentTree, buffer, xref); 43519 newRefs.push({ 43520 ref: parentTreeRef, 43521 data: buffer.join("") 43522 }); 43523 buffer.length = 0; 43524 await (0, _writer.writeObject)(structTreeRootRef, structTreeRoot, buffer, xref); 43525 newRefs.push({ 43526 ref: structTreeRootRef, 43527 data: buffer.join("") 43528 }); 43529 } 43530 async canUpdateStructTree({ 43531 pdfManager, 43532 newAnnotationsByPage 43533 }) { 43534 if (!this.ref) { 43535 (0, _util.warn)("Cannot update the struct tree: no root reference."); 43536 return false; 43537 } 43538 let nextKey = this.dict.get("ParentTreeNextKey"); 43539 if (!Number.isInteger(nextKey) || nextKey < 0) { 43540 (0, _util.warn)("Cannot update the struct tree: invalid next key."); 43541 return false; 43542 } 43543 const parentTree = this.dict.get("ParentTree"); 43544 if (!(parentTree instanceof _primitives.Dict)) { 43545 (0, _util.warn)("Cannot update the struct tree: ParentTree isn't a dict."); 43546 return false; 43547 } 43548 const nums = parentTree.get("Nums"); 43549 if (!Array.isArray(nums)) { 43550 (0, _util.warn)("Cannot update the struct tree: nums isn't an array."); 43551 return false; 43552 } 43553 const { 43554 numPages 43555 } = pdfManager.catalog; 43556 for (const pageIndex of newAnnotationsByPage.keys()) { 43557 const { 43558 pageDict, 43559 ref: pageRef 43560 } = await pdfManager.getPage(pageIndex); 43561 if (!(pageRef instanceof _primitives.Ref)) { 43562 (0, _util.warn)(`Cannot save the struct tree: page ${pageIndex} has no ref.`); 43563 return false; 43564 } 43565 const id = pageDict.get("StructParents"); 43566 if (!Number.isInteger(id) || id < 0 || id >= numPages) { 43567 (0, _util.warn)(`Cannot save the struct tree: page ${pageIndex} has no id.`); 43568 return false; 43569 } 43570 } 43571 let hasNothingToUpdate = true; 43572 for (const [pageIndex, elements] of newAnnotationsByPage) { 43573 const { 43574 pageDict 43575 } = await pdfManager.getPage(pageIndex); 43576 StructTreeRoot.#collectParents({ 43577 elements, 43578 xref: this.dict.xref, 43579 pageDict, 43580 parentTree 43581 }); 43582 for (const element of elements) { 43583 if (element.accessibilityData?.type) { 43584 element.parentTreeId = nextKey++; 43585 hasNothingToUpdate = false; 43586 } 43587 } 43588 } 43589 if (hasNothingToUpdate) { 43590 for (const elements of newAnnotationsByPage.values()) { 43591 for (const element of elements) { 43592 delete element.parentTreeId; 43593 delete element.structTreeParent; 43594 } 43595 } 43596 return false; 43597 } 43598 return true; 43599 } 43600 async updateStructureTree({ 43601 newAnnotationsByPage, 43602 pdfManager, 43603 newRefs 43604 }) { 43605 const xref = this.dict.xref; 43606 const structTreeRoot = this.dict.clone(); 43607 const structTreeRootRef = this.ref;
43608 let parentTreeRef = structTreeRoot.getRaw("ParentTree"); 43609 let parentTree; 43610 if (parentTreeRef instanceof _primitives.Ref) { 43611 parentTree = xref.fetch(parentTreeRef); 43612 } else { 43613 parentTree = parentTreeRef; 43614 parentTreeRef = xref.getNewTemporaryRef(); 43615 structTreeRoot.set("ParentTree", parentTreeRef); 43616 } 43617 parentTree = parentTree.clone(); 43618 let nums = parentTree.getRaw("Nums"); 43619 let numsRef = null; 43620 if (nums instanceof _primitives.Ref) { 43621 numsRef = nums; 43622 nums = xref.fetch(numsRef); 43623 } 43624 nums = nums.slice(); 43625 if (!numsRef) { 43626 parentTree.set("Nums", nums); 43627 } 43628 let kids = structTreeRoot.getRaw("K"); 43629 let kidsRef = null; 43630 if (kids instanceof _primitives.Ref) { 43631 kidsRef = kids; 43632 kids = xref.fetch(kidsRef); 43633 } else { 43634 kidsRef = xref.getNewTemporaryRef(); 43635 structTreeRoot.set("K", kidsRef); 43636 } 43637 kids = Array.isArray(kids) ? kids.slice() : [kids]; 43638 const buffer = []; 43639 const newNextkey = await StructTreeRoot.#writeKids({ 43640 newAnnotationsByPage, 43641 structTreeRootRef, 43642 kids, 43643 nums, 43644 xref, 43645 pdfManager, 43646 newRefs, 43647 buffer 43648 }); 43649 structTreeRoot.set("ParentTreeNextKey", newNextkey); 43650 buffer.length = 0; 43651 await (0, _writer.writeObject)(kidsRef, kids, buffer, xref); 43652 newRefs.push({ 43653 ref: kidsRef, 43654 data: buffer.join("") 43655 }); 43656 if (numsRef) { 43657 buffer.length = 0; 43658 await (0, _writer.writeObject)(numsRef, nums, buffer, xref); 43659 newRefs.push({ 43660 ref: numsRef, 43661 data: buffer.join("") 43662 }); 43663 } 43664 buffer.length = 0; 43665 await (0, _writer.writeObject)(parentTreeRef, parentTree, buffer, xref); 43666 newRefs.push({ 43667 ref: parentTreeRef, 43668 data: buffer.join("") 43669 }); 43670 buffer.length = 0; 43671 await (0, _writer.writeObject)(structTreeRootRef, structTreeRoot, buffer, xref); 43672 newRefs.push({ 43673 ref: structTreeRootRef, 43674 data: buffer.join("") 43675 }); 43676 } 43677 static async #writeKids({ 43678 newAnnotationsByPage, 43679 structTreeRootRef, 43680 kids, 43681 nums, 43682 xref, 43683 pdfManager, 43684 newRefs, 43685 buffer 43686 }) { 43687 const objr = _primitives.Name.get("OBJR"); 43688 let nextKey = -Infinity; 43689 for (const [pageIndex, elements] of newAnnotationsByPage) { 43690 const { 43691 ref: pageRef 43692 } = await pdfManager.getPage(pageIndex); 43693 for (const { 43694 accessibilityData: { 43695 type, 43696 title, 43697 lang, 43698 alt, 43699 expanded, 43700 actualText 43701 }, 43702 ref, 43703 parentTreeId, 43704 structTreeParent 43705 } of elements) { 43706 nextKey = Math.max(nextKey, parentTreeId); 43707 const tagRef = xref.getNewTemporaryRef(); 43708 const tagDict = new _primitives.Dict(xref); 43709 tagDict.set("S", _primitives.Name.get(type)); 43710 if (title) { 43711 tagDict.set("T", title); 43712 } 43713 if (lang) { 43714 tagDict.set("Lang", lang); 43715 } 43716 if (alt) { 43717 tagDict.set("Alt", alt); 43718 } 43719 if (expanded) { 43720 tagDict.set("E", expanded); 43721 } 43722 if (actualText) { 43723 tagDict.set("ActualText", actualText); 43724 } 43725 if (structTreeParent) { 43726 await this.#updateParentTag({ 43727 structTreeParent, 43728 tagDict, 43729 newTagRef: tagRef, 43730 fallbackRef: structTreeRootRef, 43731 xref, 43732 newRefs, 43733 buffer 43734 }); 43735 } else { 43736 tagDict.set("P", structTreeRootRef); 43737 } 43738 const objDict = new _primitives.Dict(xref); 43739 tagDict.set("K", objDict); 43740 objDict.set("Type", objr); 43741 objDict.set("Pg", pageRef); 43742 objDict.set("Obj", ref); 43743 buffer.length = 0; 43744 await (0, _writer.writeObject)(tagRef, tagDict, buffer, xref); 43745 newRefs.push({ 43746 ref: tagRef, 43747 data: buffer.join("") 43748 }); 43749 nums.push(parentTreeId, tagRef); 43750 kids.push(tagRef); 43751 } 43752 } 43753 return nextKey + 1; 43754 } 43755 static #collectParents({ 43756 elements, 43757 xref, 43758 pageDict, 43759 parentTree 43760 }) { 43761 const idToElement = new Map(); 43762 for (const element of elements) { 43763 if (element.structTreeParentId) { 43764 const id = parseInt(element.structTreeParentId.split("_mc")[1], 10); 43765 idToElement.set(id, element); 43766 } 43767 } 43768 const id = pageDict.get("StructParents"); 43769 const numberTree = new _name_number_tree.NumberTree(parentTree, xref); 43770 const parentArray = numberTree.get(id); 43771 if (!Array.isArray(parentArray)) { 43772 return; 43773 } 43774 const updateElement = (kid, pageKid, kidRef) => { 43775 const element = idToElement.get(kid); 43776 if (element) { 43777 const parentRef = pageKid.getRaw("P"); 43778 const parentDict = xref.fetchIfRef(parentRef); 43779 if (parentRef instanceof _primitives.Ref && parentDict instanceof _primitives.Dict) { 43780 element.structTreeParent = { 43781 ref: kidRef, 43782 dict: pageKid 43783 }; 43784 } 43785 return true; 43786 } 43787 return false;
43788 }; 43789 for (const kidRef of parentArray) { 43790 if (!(kidRef instanceof _primitives.Ref)) { 43791 continue; 43792 } 43793 const pageKid = xref.fetch(kidRef); 43794 const k = pageKid.get("K"); 43795 if (Number.isInteger(k)) { 43796 updateElement(k, pageKid, kidRef); 43797 continue; 43798 } 43799 if (!Array.isArray(k)) { 43800 continue; 43801 } 43802 for (let kid of k) { 43803 kid = xref.fetchIfRef(kid); 43804 if (Number.isInteger(kid) && updateElement(kid, pageKid, kidRef)) { 43805 break; 43806 } 43807 } 43808 } 43809 } 43810 static async #updateParentTag({ 43811 structTreeParent: { 43812 ref, 43813 dict 43814 }, 43815 tagDict, 43816 newTagRef, 43817 fallbackRef, 43818 xref, 43819 newRefs, 43820 buffer 43821 }) { 43822 const parentRef = dict.getRaw("P"); 43823 let parentDict = xref.fetchIfRef(parentRef); 43824 tagDict.set("P", parentRef); 43825 let saveParentDict = false; 43826 let parentKids; 43827 let parentKidsRef = parentDict.getRaw("K"); 43828 if (!(parentKidsRef instanceof _primitives.Ref)) { 43829 parentKids = parentKidsRef; 43830 parentKidsRef = xref.getNewTemporaryRef(); 43831 parentDict = parentDict.clone(); 43832 parentDict.set("K", parentKidsRef); 43833 saveParentDict = true; 43834 } else { 43835 parentKids = xref.fetch(parentKidsRef); 43836 } 43837 if (Array.isArray(parentKids)) { 43838 const index = parentKids.indexOf(ref); 43839 if (index >= 0) { 43840 parentKids = parentKids.slice(); 43841 parentKids.splice(index + 1, 0, newTagRef); 43842 } else { 43843 (0, _util.warn)("Cannot update the struct tree: parent kid not found."); 43844 tagDict.set("P", fallbackRef); 43845 return; 43846 } 43847 } else if (parentKids instanceof _primitives.Dict) { 43848 parentKids = [parentKidsRef, newTagRef]; 43849 parentKidsRef = xref.getNewTemporaryRef(); 43850 parentDict.set("K", parentKidsRef); 43851 saveParentDict = true; 43852 } 43853 buffer.length = 0; 43854 await (0, _writer.writeObject)(parentKidsRef, parentKids, buffer, xref); 43855 newRefs.push({ 43856 ref: parentKidsRef, 43857 data: buffer.join("") 43858 }); 43859 if (!saveParentDict) { 43860 return; 43861 } 43862 buffer.length = 0; 43863 await (0, _writer.writeObject)(parentRef, parentDict, buffer, xref); 43864 newRefs.push({ 43865 ref: parentRef, 43866 data: buffer.join("") 43867 }); 43868 } 43869} 43870exports.StructTreeRoot = StructTreeRoot; 43871class StructElementNode { 43872 constructor(tree, dict) { 43873 this.tree = tree; 43874 this.dict = dict; 43875 this.kids = []; 43876 this.parseKids(); 43877 } 43878 get role() { 43879 const nameObj = this.dict.get("S"); 43880 const name = nameObj instanceof _primitives.Name ? nameObj.name : ""; 43881 const { 43882 root 43883 } = this.tree; 43884 if (root.roleMap.has(name)) { 43885 return root.roleMap.get(name); 43886 } 43887 return name; 43888 } 43889 parseKids() { 43890 let pageObjId = null; 43891 const objRef = this.dict.getRaw("Pg"); 43892 if (objRef instanceof _primitives.Ref) { 43893 pageObjId = objRef.toString(); 43894 } 43895 const kids = this.dict.get("K"); 43896 if (Array.isArray(kids)) { 43897 for (const kid of kids) { 43898 const element = this.parseKid(pageObjId, kid); 43899 if (element) { 43900 this.kids.push(element); 43901 } 43902 } 43903 } else { 43904 const element = this.parseKid(pageObjId, kids); 43905 if (element) { 43906 this.kids.push(element); 43907 } 43908 } 43909 } 43910 parseKid(pageObjId, kid) { 43911 if (Number.isInteger(kid)) { 43912 if (this.tree.pageDict.objId !== pageObjId) { 43913 return null; 43914 } 43915 return new StructElement({ 43916 type: StructElementType.PAGE_CONTENT, 43917 mcid: kid, 43918 pageObjId 43919 }); 43920 } 43921 let kidDict = null; 43922 if (kid instanceof _primitives.Ref) { 43923 kidDict = this.dict.xref.fetch(kid); 43924 } else if (kid instanceof _primitives.Dict) { 43925 kidDict = kid; 43926 } 43927 if (!kidDict) { 43928 return null; 43929 } 43930 const pageRef = kidDict.getRaw("Pg"); 43931 if (pageRef instanceof _primitives.Ref) { 43932 pageObjId = pageRef.toString(); 43933 } 43934 const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null; 43935 if (type === "MCR") { 43936 if (this.tree.pageDict.objId !== pageObjId) { 43937 return null; 43938 }
vendor: 4,524 bytes, lines 43939-44101
43939 const kidRef = kidDict.getRaw("Stm"); 43940 return new StructElement({ 43941 type: StructElementType.STREAM_CONTENT, 43942 refObjId: kidRef instanceof _primitives.Ref ? kidRef.toString() : null, 43943 pageObjId, 43944 mcid: kidDict.get("MCID") 43945 }); 43946 } 43947 if (type === "OBJR") { 43948 if (this.tree.pageDict.objId !== pageObjId) { 43949 return null; 43950 } 43951 const kidRef = kidDict.getRaw("Obj"); 43952 return new StructElement({ 43953 type: StructElementType.OBJECT, 43954 refObjId: kidRef instanceof _primitives.Ref ? kidRef.toString() : null, 43955 pageObjId 43956 }); 43957 } 43958 return new StructElement({ 43959 type: StructElementType.ELEMENT, 43960 dict: kidDict 43961 }); 43962 } 43963} 43964class StructElement { 43965 constructor({ 43966 type, 43967 dict = null, 43968 mcid = null, 43969 pageObjId = null, 43970 refObjId = null 43971 }) { 43972 this.type = type; 43973 this.dict = dict; 43974 this.mcid = mcid; 43975 this.pageObjId = pageObjId; 43976 this.refObjId = refObjId; 43977 this.parentNode = null; 43978 } 43979} 43980class StructTreePage { 43981 constructor(structTreeRoot, pageDict) { 43982 this.root = structTreeRoot; 43983 this.rootDict = structTreeRoot ? structTreeRoot.dict : null; 43984 this.pageDict = pageDict; 43985 this.nodes = []; 43986 } 43987 parse(pageRef) { 43988 if (!this.root || !this.rootDict) { 43989 return; 43990 } 43991 const parentTree = this.rootDict.get("ParentTree"); 43992 if (!parentTree) { 43993 return; 43994 } 43995 const id = this.pageDict.get("StructParents"); 43996 const ids = pageRef instanceof _primitives.Ref && this.root.structParentIds?.get(pageRef); 43997 if (!Number.isInteger(id) && !ids) { 43998 return; 43999 } 44000 const map = new Map(); 44001 const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref); 44002 if (Number.isInteger(id)) { 44003 const parentArray = numberTree.get(id); 44004 if (Array.isArray(parentArray)) { 44005 for (const ref of parentArray) { 44006 if (ref instanceof _primitives.Ref) { 44007 this.addNode(this.rootDict.xref.fetch(ref), map); 44008 } 44009 } 44010 } 44011 } 44012 if (!ids) { 44013 return; 44014 } 44015 for (const [elemId, type] of ids) { 44016 const obj = numberTree.get(elemId); 44017 if (obj) { 44018 const elem = this.addNode(this.rootDict.xref.fetchIfRef(obj), map); 44019 if (elem?.kids?.length === 1 && elem.kids[0].type === StructElementType.OBJECT) { 44020 elem.kids[0].type = type; 44021 } 44022 } 44023 } 44024 } 44025 addNode(dict, map, level = 0) { 44026 if (level > MAX_DEPTH) { 44027 (0, _util.warn)("StructTree MAX_DEPTH reached."); 44028 return null; 44029 } 44030 if (map.has(dict)) { 44031 return map.get(dict); 44032 } 44033 const element = new StructElementNode(this, dict); 44034 map.set(dict, element); 44035 const parent = dict.get("P"); 44036 if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) { 44037 if (!this.addTopLevelNode(dict, element)) { 44038 map.delete(dict); 44039 } 44040 return element; 44041 } 44042 const parentNode = this.addNode(parent, map, level + 1); 44043 if (!parentNode) { 44044 return element; 44045 } 44046 let save = false; 44047 for (const kid of parentNode.kids) { 44048 if (kid.type === StructElementType.ELEMENT && kid.dict === dict) { 44049 kid.parentNode = element; 44050 save = true; 44051 } 44052 } 44053 if (!save) { 44054 map.delete(dict); 44055 } 44056 return element; 44057 } 44058 addTopLevelNode(dict, element) { 44059 const obj = this.rootDict.get("K"); 44060 if (!obj) { 44061 return false; 44062 } 44063 if (obj instanceof _primitives.Dict) { 44064 if (obj.objId !== dict.objId) { 44065 return false; 44066 } 44067 this.nodes[0] = element; 44068 return true; 44069 } 44070 if (!Array.isArray(obj)) { 44071 return true; 44072 } 44073 let save = false; 44074 for (let i = 0; i < obj.length; i++) { 44075 const kidRef = obj[i]; 44076 if (kidRef?.toString() === dict.objId) { 44077 this.nodes[i] = element; 44078 save = true; 44079 } 44080 } 44081 return save; 44082 } 44083 get serializable() { 44084 function nodeToSerializable(node, parent, level = 0) { 44085 if (level > MAX_DEPTH) { 44086 (0, _util.warn)("StructTree too deep to be fully serialized."); 44087 return; 44088 } 44089 const obj = Object.create(null); 44090 obj.role = node.role; 44091 obj.children = []; 44092 parent.children.push(obj); 44093 const alt = node.dict.get("Alt"); 44094 if (typeof alt === "string") { 44095 obj.alt = (0, _util.stringToPDFString)(alt); 44096 } 44097 const lang = node.dict.get("Lang"); 44098 if (typeof lang === "string") { 44099 obj.lang = (0, _util.stringToPDFString)(lang); 44100 } 44101 for (const kid of node.kids) {
44102 const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null; 44103 if (kidElement) { 44104 nodeToSerializable(kidElement, obj, level + 1); 44105 continue; 44106 } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) { 44107 obj.children.push({ 44108 type: "content", 44109 id: `p${kid.pageObjId}_mc${kid.mcid}` 44110 }); 44111 } else if (kid.type === StructElementType.OBJECT) { 44112 obj.children.push({ 44113 type: "object", 44114 id: kid.refObjId 44115 }); 44116 } else if (kid.type === StructElementType.ANNOTATION) { 44117 obj.children.push({ 44118 type: "annotation", 44119 id: `${_util.AnnotationPrefix}${kid.refObjId}` 44120 }); 44121 } 44122 } 44123 } 44124 const root = Object.create(null); 44125 root.children = []; 44126 root.role = "Root"; 44127 for (const child of this.nodes) { 44128 if (!child) { 44129 continue; 44130 } 44131 nodeToSerializable(child, root); 44132 } 44133 return root; 44134 } 44135} 44136exports.StructTreePage = StructTreePage; 44137 44138/***/ }), 44139/* 73 */ 44140/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 44141 44142 44143 44144Object.defineProperty(exports, "__esModule", ({ 44145 value: true 44146})); 44147exports.incrementalUpdate = incrementalUpdate; 44148exports.writeDict = writeDict; 44149exports.writeObject = writeObject; 44150var _util = __w_pdfjs_require__(2); 44151var _primitives = __w_pdfjs_require__(4); 44152var _core_utils = __w_pdfjs_require__(3); 44153var _xml_parser = __w_pdfjs_require__(71); 44154var _base_stream = __w_pdfjs_require__(5); 44155var _crypto = __w_pdfjs_require__(74); 44156async function writeObject(ref, obj, buffer, { 44157 encrypt = null 44158}) { 44159 const transform = encrypt?.createCipherTransform(ref.num, ref.gen); 44160 buffer.push(`${ref.num} ${ref.gen} obj\n`); 44161 if (obj instanceof _primitives.Dict) { 44162 await writeDict(obj, buffer, transform); 44163 } else if (obj instanceof _base_stream.BaseStream) { 44164 await writeStream(obj, buffer, transform); 44165 } else if (Array.isArray(obj)) { 44166 await writeArray(obj, buffer, transform); 44167 } 44168 buffer.push("\nendobj\n"); 44169} 44170async function writeDict(dict, buffer, transform) { 44171 buffer.push("<<"); 44172 for (const key of dict.getKeys()) { 44173 buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `); 44174 await writeValue(dict.getRaw(key), buffer, transform); 44175 } 44176 buffer.push(">>"); 44177} 44178async function writeStream(stream, buffer, transform) { 44179 let string = stream.getString(); 44180 const { 44181 dict 44182 } = stream; 44183 const [filter, params] = await Promise.all([dict.getAsync("Filter"), dict.getAsync("DecodeParms")]); 44184 const filterZero = Array.isArray(filter) ? await dict.xref.fetchIfRefAsync(filter[0]) : filter; 44185 const isFilterZeroFlateDecode = (0, _primitives.isName)(filterZero, "FlateDecode"); 44186 const MIN_LENGTH_FOR_COMPRESSING = 256; 44187 if (typeof CompressionStream !== "undefined" && (string.length >= MIN_LENGTH_FOR_COMPRESSING || isFilterZeroFlateDecode)) { 44188 try { 44189 const byteArray = (0, _util.stringToBytes)(string); 44190 const cs = new CompressionStream("deflate"); 44191 const writer = cs.writable.getWriter(); 44192 writer.write(byteArray); 44193 writer.close(); 44194 const buf = await new Response(cs.readable).arrayBuffer(); 44195 string = (0, _util.bytesToString)(new Uint8Array(buf)); 44196 let newFilter, newParams; 44197 if (!filter) { 44198 newFilter = _primitives.Name.get("FlateDecode"); 44199 } else if (!isFilterZeroFlateDecode) { 44200 newFilter = Array.isArray(filter) ? [_primitives.Name.get("FlateDecode"), ...filter] : [_primitives.Name.get("FlateDecode"), filter]; 44201 if (params) { 44202 newParams = Array.isArray(params) ? [null, ...params] : [null, params]; 44203 } 44204 } 44205 if (newFilter) { 44206 dict.set("Filter", newFilter); 44207 } 44208 if (newParams) { 44209 dict.set("DecodeParms", newParams); 44210 } 44211 } catch (ex) { 44212 (0, _util.info)(`writeStream - cannot compress data: "${ex}".`); 44213 } 44214 } 44215 if (transform) { 44216 string = transform.encryptString(string); 44217 } 44218 dict.set("Length", string.length); 44219 await writeDict(dict, buffer, transform); 44220 buffer.push(" stream\n", string, "\nendstream"); 44221} 44222async function writeArray(array, buffer, transform) { 44223 buffer.push("["); 44224 let first = true; 44225 for (const val of array) { 44226 if (!first) { 44227 buffer.push(" "); 44228 } else { 44229 first = false;
44230 } 44231 await writeValue(val, buffer, transform); 44232 } 44233 buffer.push("]"); 44234} 44235async function writeValue(value, buffer, transform) { 44236 if (value instanceof _primitives.Name) { 44237 buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`); 44238 } else if (value instanceof _primitives.Ref) { 44239 buffer.push(`${value.num} ${value.gen} R`); 44240 } else if (Array.isArray(value)) { 44241 await writeArray(value, buffer, transform); 44242 } else if (typeof value === "string") { 44243 if (transform) { 44244 value = transform.encryptString(value); 44245 } 44246 buffer.push(`(${(0, _core_utils.escapeString)(value)})`); 44247 } else if (typeof value === "number") { 44248 buffer.push((0, _core_utils.numberToString)(value)); 44249 } else if (typeof value === "boolean") { 44250 buffer.push(value.toString()); 44251 } else if (value instanceof _primitives.Dict) { 44252 await writeDict(value, buffer, transform); 44253 } else if (value instanceof _base_stream.BaseStream) { 44254 await writeStream(value, buffer, transform); 44255 } else if (value === null) { 44256 buffer.push("null"); 44257 } else { 44258 (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`); 44259 } 44260} 44261function writeInt(number, size, offset, buffer) { 44262 for (let i = size + offset - 1; i > offset - 1; i--) { 44263 buffer[i] = number & 0xff; 44264 number >>= 8; 44265 } 44266 return offset + size; 44267} 44268function writeString(string, offset, buffer) { 44269 for (let i = 0, len = string.length; i < len; i++) { 44270 buffer[offset + i] = string.charCodeAt(i) & 0xff; 44271 } 44272} 44273function computeMD5(filesize, xrefInfo) { 44274 const time = Math.floor(Date.now() / 1000); 44275 const filename = xrefInfo.filename || ""; 44276 const md5Buffer = [time.toString(), filename, filesize.toString()]; 44277 let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0); 44278 for (const value of Object.values(xrefInfo.info)) { 44279 md5Buffer.push(value); 44280 md5BufferLen += value.length; 44281 } 44282 const array = new Uint8Array(md5BufferLen); 44283 let offset = 0; 44284 for (const str of md5Buffer) { 44285 writeString(str, offset, array); 44286 offset += str.length; 44287 } 44288 return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array)); 44289} 44290function writeXFADataForAcroform(str, newRefs) { 44291 const xml = new _xml_parser.SimpleXMLParser({ 44292 hasAttributes: true 44293 }).parseFromString(str); 44294 for (const { 44295 xfa 44296 } of newRefs) { 44297 if (!xfa) { 44298 continue; 44299 } 44300 const { 44301 path, 44302 value 44303 } = xfa; 44304 if (!path) { 44305 continue; 44306 } 44307 const nodePath = (0, _core_utils.parseXFAPath)(path); 44308 let node = xml.documentElement.searchNode(nodePath, 0); 44309 if (!node && nodePath.length > 1) { 44310 node = xml.documentElement.searchNode([nodePath.at(-1)], 0); 44311 } 44312 if (node) { 44313 node.childNodes = Array.isArray(value) ? value.map(val => new _xml_parser.SimpleDOMNode("value", val)) : [new _xml_parser.SimpleDOMNode("#text", value)]; 44314 } else { 44315 (0, _util.warn)(`Node not found for path: ${path}`); 44316 } 44317 } 44318 const buffer = []; 44319 xml.documentElement.dump(buffer); 44320 return buffer.join(""); 44321} 44322async function updateAcroform({ 44323 xref, 44324 acroForm, 44325 acroFormRef, 44326 hasXfa, 44327 hasXfaDatasetsEntry, 44328 xfaDatasetsRef, 44329 needAppearances, 44330 newRefs 44331}) { 44332 if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) { 44333 (0, _util.warn)("XFA - Cannot save it"); 44334 } 44335 if (!needAppearances && (!hasXfa || !xfaDatasetsRef || hasXfaDatasetsEntry)) { 44336 return; 44337 } 44338 const dict = acroForm.clone(); 44339 if (hasXfa && !hasXfaDatasetsEntry) { 44340 const newXfa = acroForm.get("XFA").slice(); 44341 newXfa.splice(2, 0, "datasets"); 44342 newXfa.splice(3, 0, xfaDatasetsRef); 44343 dict.set("XFA", newXfa); 44344 } 44345 if (needAppearances) { 44346 dict.set("NeedAppearances", true); 44347 } 44348 const buffer = []; 44349 await writeObject(acroFormRef, dict, buffer, xref); 44350 newRefs.push({ 44351 ref: acroFormRef, 44352 data: buffer.join("") 44353 }); 44354} 44355function updateXFA({ 44356 xfaData, 44357 xfaDatasetsRef, 44358 newRefs, 44359 xref 44360}) { 44361 if (xfaData === null) { 44362 const datasets = xref.fetchIfRef(xfaDatasetsRef); 44363 xfaData = writeXFADataForAcroform(datasets.getString(), newRefs); 44364 } 44365 const encrypt = xref.encrypt; 44366 if (encrypt) { 44367 const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen); 44368 xfaData = transform.encryptString(xfaData); 44369 } 44370 const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n"; 44371 newRefs.push({ 44372 ref: xfaDatasetsRef, 44373 data 44374 }); 44375} 44376async function incrementalUpdate({ 44377 originalData, 44378 xrefInfo, 44379 newRefs, 44380 xref = null, 44381 hasXfa = false, 44382 xfaDatasetsRef = null, 44383 hasXfaDatasetsEntry = false, 44384 needAppearances, 44385 acroFormRef = null, 44386 acroForm = null, 44387 xfaData = null 44388}) { 44389 await updateAcroform({ 44390 xref, 44391 acroForm, 44392 acroFormRef, 44393 hasXfa, 44394 hasXfaDatasetsEntry, 44395 xfaDatasetsRef, 44396 needAppearances, 44397 newRefs 44398 }); 44399 if (hasXfa) { 44400 updateXFA({ 44401 xfaData, 44402 xfaDatasetsRef, 44403 newRefs, 44404 xref 44405 }); 44406 } 44407 const newXref = new _primitives.Dict(null); 44408 const refForXrefTable = xrefInfo.newRef; 44409 let buffer, baseOffset;
44410 const lastByte = originalData.at(-1); 44411 if (lastByte === 0x0a || lastByte === 0x0d) { 44412 buffer = []; 44413 baseOffset = originalData.length; 44414 } else { 44415 buffer = ["\n"]; 44416 baseOffset = originalData.length + 1; 44417 } 44418 newXref.set("Size", refForXrefTable.num + 1); 44419 newXref.set("Prev", xrefInfo.startXRef); 44420 newXref.set("Type", _primitives.Name.get("XRef")); 44421 if (xrefInfo.rootRef !== null) { 44422 newXref.set("Root", xrefInfo.rootRef); 44423 } 44424 if (xrefInfo.infoRef !== null) { 44425 newXref.set("Info", xrefInfo.infoRef); 44426 } 44427 if (xrefInfo.encryptRef !== null) { 44428 newXref.set("Encrypt", xrefInfo.encryptRef); 44429 } 44430 newRefs.push({ 44431 ref: refForXrefTable, 44432 data: "" 44433 }); 44434 newRefs = newRefs.sort((a, b) => { 44435 return a.ref.num - b.ref.num; 44436 }); 44437 const xrefTableData = [[0, 1, 0xffff]]; 44438 const indexes = [0, 1]; 44439 let maxOffset = 0; 44440 for (const { 44441 ref, 44442 data 44443 } of newRefs) { 44444 maxOffset = Math.max(maxOffset, baseOffset); 44445 xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]); 44446 baseOffset += data.length; 44447 indexes.push(ref.num, 1); 44448 buffer.push(data); 44449 } 44450 newXref.set("Index", indexes); 44451 if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) { 44452 const md5 = computeMD5(baseOffset, xrefInfo); 44453 newXref.set("ID", [xrefInfo.fileIds[0], md5]); 44454 } 44455 const offsetSize = Math.ceil(Math.log2(maxOffset) / 8); 44456 const sizes = [1, offsetSize, 2]; 44457 const structSize = sizes[0] + sizes[1] + sizes[2]; 44458 const tableLength = structSize * xrefTableData.length; 44459 newXref.set("W", sizes); 44460 newXref.set("Length", tableLength); 44461 buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`); 44462 await writeDict(newXref, buffer, null); 44463 buffer.push(" stream\n"); 44464 const bufferLen = buffer.reduce((a, str) => a + str.length, 0); 44465 const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`; 44466 const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length); 44467 array.set(originalData); 44468 let offset = originalData.length; 44469 for (const str of buffer) { 44470 writeString(str, offset, array); 44471 offset += str.length; 44472 } 44473 for (const [type, objOffset, gen] of xrefTableData) { 44474 offset = writeInt(type, sizes[0], offset, array); 44475 offset = writeInt(objOffset, sizes[1], offset, array); 44476 offset = writeInt(gen, sizes[2], offset, array); 44477 } 44478 writeString(footer, offset, array); 44479 return array; 44480} 44481 44482/***/ }), 44483/* 74 */ 44484/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 44485 44486 44487 44488Object.defineProperty(exports, "__esModule", ({ 44489 value: true 44490})); 44491exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0; 44492exports.calculateSHA384 = calculateSHA384; 44493exports.calculateSHA512 = void 0; 44494var _util = __w_pdfjs_require__(2); 44495var _primitives = __w_pdfjs_require__(4); 44496var _decrypt_stream = __w_pdfjs_require__(75); 44497class ARCFourCipher { 44498 constructor(key) { 44499 this.a = 0; 44500 this.b = 0; 44501 const s = new Uint8Array(256); 44502 const keyLength = key.length; 44503 for (let i = 0; i < 256; ++i) { 44504 s[i] = i; 44505 } 44506 for (let i = 0, j = 0; i < 256; ++i) { 44507 const tmp = s[i]; 44508 j = j + tmp + key[i % keyLength] & 0xff; 44509 s[i] = s[j]; 44510 s[j] = tmp; 44511 } 44512 this.s = s; 44513 } 44514 encryptBlock(data) { 44515 let a = this.a, 44516 b = this.b; 44517 const s = this.s; 44518 const n = data.length; 44519 const output = new Uint8Array(n); 44520 for (let i = 0; i < n; ++i) { 44521 a = a + 1 & 0xff; 44522 const tmp = s[a]; 44523 b = b + tmp & 0xff; 44524 const tmp2 = s[b]; 44525 s[a] = tmp2; 44526 s[b] = tmp; 44527 output[i] = data[i] ^ s[tmp + tmp2 & 0xff]; 44528 } 44529 this.a = a; 44530 this.b = b; 44531 return output; 44532 } 44533 decryptBlock(data) { 44534 return this.encryptBlock(data); 44535 }
44536 encrypt(data) { 44537 return this.encryptBlock(data); 44538 } 44539} 44540exports.ARCFourCipher = ARCFourCipher; 44541const calculateMD5 = function calculateMD5Closure() { 44542 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]); 44543 const k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]); 44544 function hash(data, offset, length) { 44545 let h0 = 1732584193, 44546 h1 = -271733879, 44547 h2 = -1732584194, 44548 h3 = 271733878; 44549 const paddedLength = length + 72 & ~63; 44550 const padded = new Uint8Array(paddedLength); 44551 let i, j; 44552 for (i = 0; i < length; ++i) { 44553 padded[i] = data[offset++]; 44554 } 44555 padded[i++] = 0x80; 44556 const n = paddedLength - 8; 44557 while (i < n) { 44558 padded[i++] = 0; 44559 } 44560 padded[i++] = length << 3 & 0xff; 44561 padded[i++] = length >> 5 & 0xff;
vendor: 5,488 bytes, lines 44562-44736
44562 padded[i++] = length >> 13 & 0xff; 44563 padded[i++] = length >> 21 & 0xff; 44564 padded[i++] = length >>> 29 & 0xff; 44565 padded[i++] = 0; 44566 padded[i++] = 0; 44567 padded[i++] = 0; 44568 const w = new Int32Array(16); 44569 for (i = 0; i < paddedLength;) { 44570 for (j = 0; j < 16; ++j, i += 4) { 44571 w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24; 44572 } 44573 let a = h0, 44574 b = h1, 44575 c = h2, 44576 d = h3, 44577 f, 44578 g; 44579 for (j = 0; j < 64; ++j) { 44580 if (j < 16) { 44581 f = b & c | ~b & d; 44582 g = j; 44583 } else if (j < 32) { 44584 f = d & b | ~d & c; 44585 g = 5 * j + 1 & 15; 44586 } else if (j < 48) { 44587 f = b ^ c ^ d; 44588 g = 3 * j + 5 & 15; 44589 } else { 44590 f = c ^ (b | ~d); 44591 g = 7 * j & 15; 44592 } 44593 const tmp = d, 44594 rotateArg = a + f + k[j] + w[g] | 0, 44595 rotate = r[j]; 44596 d = c; 44597 c = b; 44598 b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0; 44599 a = tmp; 44600 } 44601 h0 = h0 + a | 0; 44602 h1 = h1 + b | 0; 44603 h2 = h2 + c | 0; 44604 h3 = h3 + d | 0; 44605 } 44606 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]); 44607 } 44608 return hash; 44609}(); 44610exports.calculateMD5 = calculateMD5; 44611class Word64 { 44612 constructor(highInteger, lowInteger) { 44613 this.high = highInteger | 0; 44614 this.low = lowInteger | 0; 44615 } 44616 and(word) { 44617 this.high &= word.high; 44618 this.low &= word.low; 44619 } 44620 xor(word) { 44621 this.high ^= word.high; 44622 this.low ^= word.low; 44623 } 44624 or(word) { 44625 this.high |= word.high; 44626 this.low |= word.low; 44627 } 44628 shiftRight(places) { 44629 if (places >= 32) { 44630 this.low = this.high >>> places - 32 | 0; 44631 this.high = 0; 44632 } else { 44633 this.low = this.low >>> places | this.high << 32 - places; 44634 this.high = this.high >>> places | 0; 44635 } 44636 } 44637 shiftLeft(places) { 44638 if (places >= 32) { 44639 this.high = this.low << places - 32; 44640 this.low = 0; 44641 } else { 44642 this.high = this.high << places | this.low >>> 32 - places; 44643 this.low <<= places; 44644 } 44645 } 44646 rotateRight(places) { 44647 let low, high; 44648 if (places & 32) { 44649 high = this.low; 44650 low = this.high; 44651 } else { 44652 low = this.low; 44653 high = this.high; 44654 } 44655 places &= 31; 44656 this.low = low >>> places | high << 32 - places; 44657 this.high = high >>> places | low << 32 - places; 44658 } 44659 not() { 44660 this.high = ~this.high; 44661 this.low = ~this.low; 44662 } 44663 add(word) { 44664 const lowAdd = (this.low >>> 0) + (word.low >>> 0); 44665 let highAdd = (this.high >>> 0) + (word.high >>> 0); 44666 if (lowAdd > 0xffffffff) { 44667 highAdd += 1; 44668 } 44669 this.low = lowAdd | 0; 44670 this.high = highAdd | 0; 44671 } 44672 copyTo(bytes, offset) { 44673 bytes[offset] = this.high >>> 24 & 0xff; 44674 bytes[offset + 1] = this.high >> 16 & 0xff; 44675 bytes[offset + 2] = this.high >> 8 & 0xff; 44676 bytes[offset + 3] = this.high & 0xff; 44677 bytes[offset + 4] = this.low >>> 24 & 0xff; 44678 bytes[offset + 5] = this.low >> 16 & 0xff; 44679 bytes[offset + 6] = this.low >> 8 & 0xff; 44680 bytes[offset + 7] = this.low & 0xff; 44681 } 44682 assign(word) { 44683 this.high = word.high; 44684 this.low = word.low; 44685 } 44686} 44687const calculateSHA256 = function calculateSHA256Closure() { 44688 function rotr(x, n) { 44689 return x >>> n | x << 32 - n; 44690 } 44691 function ch(x, y, z) { 44692 return x & y ^ ~x & z; 44693 } 44694 function maj(x, y, z) { 44695 return x & y ^ x & z ^ y & z; 44696 } 44697 function sigma(x) { 44698 return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); 44699 } 44700 function sigmaPrime(x) { 44701 return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); 44702 } 44703 function littleSigma(x) { 44704 return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3; 44705 } 44706 function littleSigmaPrime(x) { 44707 return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10; 44708 } 44709 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]; 44710 function hash(data, offset, length) { 44711 let h0 = 0x6a09e667, 44712 h1 = 0xbb67ae85, 44713 h2 = 0x3c6ef372, 44714 h3 = 0xa54ff53a, 44715 h4 = 0x510e527f, 44716 h5 = 0x9b05688c, 44717 h6 = 0x1f83d9ab, 44718 h7 = 0x5be0cd19; 44719 const paddedLength = Math.ceil((length + 9) / 64) * 64; 44720 const padded = new Uint8Array(paddedLength); 44721 let i, j; 44722 for (i = 0; i < length; ++i) { 44723 padded[i] = data[offset++]; 44724 } 44725 padded[i++] = 0x80; 44726 const n = paddedLength - 8; 44727 while (i < n) { 44728 padded[i++] = 0; 44729 } 44730 padded[i++] = 0; 44731 padded[i++] = 0; 44732 padded[i++] = 0; 44733 padded[i++] = length >>> 29 & 0xff; 44734 padded[i++] = length >> 21 & 0xff; 44735 padded[i++] = length >> 13 & 0xff; 44736 padded[i++] = length >> 5 & 0xff;
vendor: 10,004 bytes, lines 44737-44994
44737 padded[i++] = length << 3 & 0xff; 44738 const w = new Uint32Array(64); 44739 for (i = 0; i < paddedLength;) { 44740 for (j = 0; j < 16; ++j) { 44741 w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 44742 i += 4; 44743 } 44744 for (j = 16; j < 64; ++j) { 44745 w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0; 44746 } 44747 let a = h0, 44748 b = h1, 44749 c = h2, 44750 d = h3, 44751 e = h4, 44752 f = h5, 44753 g = h6, 44754 h = h7, 44755 t1, 44756 t2; 44757 for (j = 0; j < 64; ++j) { 44758 t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j]; 44759 t2 = sigma(a) + maj(a, b, c); 44760 h = g; 44761 g = f; 44762 f = e; 44763 e = d + t1 | 0; 44764 d = c; 44765 c = b; 44766 b = a; 44767 a = t1 + t2 | 0; 44768 } 44769 h0 = h0 + a | 0; 44770 h1 = h1 + b | 0; 44771 h2 = h2 + c | 0; 44772 h3 = h3 + d | 0; 44773 h4 = h4 + e | 0; 44774 h5 = h5 + f | 0; 44775 h6 = h6 + g | 0; 44776 h7 = h7 + h | 0; 44777 } 44778 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]); 44779 } 44780 return hash; 44781}(); 44782exports.calculateSHA256 = calculateSHA256; 44783const calculateSHA512 = function calculateSHA512Closure() { 44784 function ch(result, x, y, z, tmp) { 44785 result.assign(x); 44786 result.and(y); 44787 tmp.assign(x); 44788 tmp.not(); 44789 tmp.and(z); 44790 result.xor(tmp); 44791 } 44792 function maj(result, x, y, z, tmp) { 44793 result.assign(x); 44794 result.and(y); 44795 tmp.assign(x); 44796 tmp.and(z); 44797 result.xor(tmp); 44798 tmp.assign(y); 44799 tmp.and(z); 44800 result.xor(tmp); 44801 } 44802 function sigma(result, x, tmp) { 44803 result.assign(x); 44804 result.rotateRight(28); 44805 tmp.assign(x); 44806 tmp.rotateRight(34); 44807 result.xor(tmp); 44808 tmp.assign(x); 44809 tmp.rotateRight(39); 44810 result.xor(tmp); 44811 } 44812 function sigmaPrime(result, x, tmp) { 44813 result.assign(x); 44814 result.rotateRight(14); 44815 tmp.assign(x); 44816 tmp.rotateRight(18); 44817 result.xor(tmp); 44818 tmp.assign(x); 44819 tmp.rotateRight(41); 44820 result.xor(tmp); 44821 } 44822 function littleSigma(result, x, tmp) { 44823 result.assign(x); 44824 result.rotateRight(1); 44825 tmp.assign(x); 44826 tmp.rotateRight(8); 44827 result.xor(tmp); 44828 tmp.assign(x); 44829 tmp.shiftRight(7); 44830 result.xor(tmp); 44831 } 44832 function littleSigmaPrime(result, x, tmp) { 44833 result.assign(x); 44834 result.rotateRight(19); 44835 tmp.assign(x); 44836 tmp.rotateRight(61); 44837 result.xor(tmp); 44838 tmp.assign(x); 44839 tmp.shiftRight(6); 44840 result.xor(tmp); 44841 } 44842 const k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)]; 44843 function hash(data, offset, length, mode384 = false) { 44844 let h0, h1, h2, h3, h4, h5, h6, h7; 44845 if (!mode384) { 44846 h0 = new Word64(0x6a09e667, 0xf3bcc908); 44847 h1 = new Word64(0xbb67ae85, 0x84caa73b); 44848 h2 = new Word64(0x3c6ef372, 0xfe94f82b); 44849 h3 = new Word64(0xa54ff53a, 0x5f1d36f1); 44850 h4 = new Word64(0x510e527f, 0xade682d1); 44851 h5 = new Word64(0x9b05688c, 0x2b3e6c1f); 44852 h6 = new Word64(0x1f83d9ab, 0xfb41bd6b); 44853 h7 = new Word64(0x5be0cd19, 0x137e2179); 44854 } else { 44855 h0 = new Word64(0xcbbb9d5d, 0xc1059ed8); 44856 h1 = new Word64(0x629a292a, 0x367cd507); 44857 h2 = new Word64(0x9159015a, 0x3070dd17); 44858 h3 = new Word64(0x152fecd8, 0xf70e5939); 44859 h4 = new Word64(0x67332667, 0xffc00b31); 44860 h5 = new Word64(0x8eb44a87, 0x68581511); 44861 h6 = new Word64(0xdb0c2e0d, 0x64f98fa7); 44862 h7 = new Word64(0x47b5481d, 0xbefa4fa4); 44863 } 44864 const paddedLength = Math.ceil((length + 17) / 128) * 128; 44865 const padded = new Uint8Array(paddedLength); 44866 let i, j; 44867 for (i = 0; i < length; ++i) { 44868 padded[i] = data[offset++]; 44869 } 44870 padded[i++] = 0x80; 44871 const n = paddedLength - 16; 44872 while (i < n) { 44873 padded[i++] = 0; 44874 } 44875 padded[i++] = 0; 44876 padded[i++] = 0; 44877 padded[i++] = 0; 44878 padded[i++] = 0; 44879 padded[i++] = 0; 44880 padded[i++] = 0; 44881 padded[i++] = 0; 44882 padded[i++] = 0; 44883 padded[i++] = 0; 44884 padded[i++] = 0; 44885 padded[i++] = 0; 44886 padded[i++] = length >>> 29 & 0xff; 44887 padded[i++] = length >> 21 & 0xff; 44888 padded[i++] = length >> 13 & 0xff; 44889 padded[i++] = length >> 5 & 0xff; 44890 padded[i++] = length << 3 & 0xff; 44891 const w = new Array(80); 44892 for (i = 0; i < 80; i++) { 44893 w[i] = new Word64(0, 0); 44894 } 44895 let a = new Word64(0, 0), 44896 b = new Word64(0, 0), 44897 c = new Word64(0, 0); 44898 let d = new Word64(0, 0), 44899 e = new Word64(0, 0), 44900 f = new Word64(0, 0); 44901 let g = new Word64(0, 0), 44902 h = new Word64(0, 0); 44903 const t1 = new Word64(0, 0), 44904 t2 = new Word64(0, 0); 44905 const tmp1 = new Word64(0, 0), 44906 tmp2 = new Word64(0, 0); 44907 let tmp3; 44908 for (i = 0; i < paddedLength;) { 44909 for (j = 0; j < 16; ++j) { 44910 w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 44911 w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7]; 44912 i += 8; 44913 } 44914 for (j = 16; j < 80; ++j) { 44915 tmp3 = w[j]; 44916 littleSigmaPrime(tmp3, w[j - 2], tmp2); 44917 tmp3.add(w[j - 7]); 44918 littleSigma(tmp1, w[j - 15], tmp2); 44919 tmp3.add(tmp1); 44920 tmp3.add(w[j - 16]); 44921 } 44922 a.assign(h0); 44923 b.assign(h1); 44924 c.assign(h2); 44925 d.assign(h3); 44926 e.assign(h4); 44927 f.assign(h5); 44928 g.assign(h6); 44929 h.assign(h7); 44930 for (j = 0; j < 80; ++j) { 44931 t1.assign(h); 44932 sigmaPrime(tmp1, e, tmp2); 44933 t1.add(tmp1); 44934 ch(tmp1, e, f, g, tmp2); 44935 t1.add(tmp1); 44936 t1.add(k[j]); 44937 t1.add(w[j]); 44938 sigma(t2, a, tmp2); 44939 maj(tmp1, a, b, c, tmp2); 44940 t2.add(tmp1); 44941 tmp3 = h; 44942 h = g; 44943 g = f; 44944 f = e; 44945 d.add(t1); 44946 e = d; 44947 d = c; 44948 c = b; 44949 b = a; 44950 tmp3.assign(t1); 44951 tmp3.add(t2); 44952 a = tmp3; 44953 } 44954 h0.add(a); 44955 h1.add(b); 44956 h2.add(c); 44957 h3.add(d); 44958 h4.add(e); 44959 h5.add(f); 44960 h6.add(g); 44961 h7.add(h); 44962 } 44963 let result; 44964 if (!mode384) { 44965 result = new Uint8Array(64); 44966 h0.copyTo(result, 0); 44967 h1.copyTo(result, 8); 44968 h2.copyTo(result, 16); 44969 h3.copyTo(result, 24); 44970 h4.copyTo(result, 32); 44971 h5.copyTo(result, 40); 44972 h6.copyTo(result, 48); 44973 h7.copyTo(result, 56); 44974 } else { 44975 result = new Uint8Array(48); 44976 h0.copyTo(result, 0); 44977 h1.copyTo(result, 8); 44978 h2.copyTo(result, 16); 44979 h3.copyTo(result, 24); 44980 h4.copyTo(result, 32); 44981 h5.copyTo(result, 40); 44982 } 44983 return result; 44984 } 44985 return hash; 44986}(); 44987exports.calculateSHA512 = calculateSHA512; 44988function calculateSHA384(data, offset, length) { 44989 return calculateSHA512(data, offset, length, true); 44990} 44991class NullCipher { 44992 decryptBlock(data) { 44993 return data; 44994 }
44995 encrypt(data) { 44996 return data; 44997 } 44998} 44999class AESBaseCipher { 45000 constructor() { 45001 if (this.constructor === AESBaseCipher) { 45002 (0, _util.unreachable)("Cannot initialize AESBaseCipher."); 45003 } 45004 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]); 45005 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, 0xfa, 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]); 45006 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, 0x51f4a
vendor: 8,043 bytes, lines 45006-45225
45006750, 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, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]); 45007 this._mixCol = new Uint8Array(256); 45008 for (let i = 0; i < 256; i++) { 45009 this._mixCol[i] = i < 128 ? i << 1 : i << 1 ^ 0x1b; 45010 } 45011 this.buffer = new Uint8Array(16); 45012 this.bufferPosition = 0; 45013 } 45014 _expandKey(cipherKey) { 45015 (0, _util.unreachable)("Cannot call `_expandKey` on the base class"); 45016 } 45017 _decrypt(input, key) { 45018 let t, u, v; 45019 const state = new Uint8Array(16); 45020 state.set(input); 45021 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 45022 state[j] ^= key[k]; 45023 } 45024 for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) { 45025 t = state[13]; 45026 state[13] = state[9]; 45027 state[9] = state[5]; 45028 state[5] = state[1]; 45029 state[1] = t; 45030 t = state[14]; 45031 u = state[10]; 45032 state[14] = state[6]; 45033 state[10] = state[2]; 45034 state[6] = t; 45035 state[2] = u; 45036 t = state[15]; 45037 u = state[11]; 45038 v = state[7]; 45039 state[15] = state[3]; 45040 state[11] = t; 45041 state[7] = u; 45042 state[3] = v; 45043 for (let j = 0; j < 16; ++j) { 45044 state[j] = this._inv_s[state[j]]; 45045 } 45046 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 45047 state[j] ^= key[k]; 45048 } 45049 for (let j = 0; j < 16; j += 4) { 45050 const s0 = this._mix[state[j]]; 45051 const s1 = this._mix[state[j + 1]]; 45052 const s2 = this._mix[state[j + 2]]; 45053 const s3 = this._mix[state[j + 3]]; 45054 t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8; 45055 state[j] = t >>> 24 & 0xff; 45056 state[j + 1] = t >> 16 & 0xff; 45057 state[j + 2] = t >> 8 & 0xff; 45058 state[j + 3] = t & 0xff; 45059 } 45060 } 45061 t = state[13]; 45062 state[13] = state[9]; 45063 state[9] = state[5]; 45064 state[5] = state[1]; 45065 state[1] = t; 45066 t = state[14]; 45067 u = state[10]; 45068 state[14] = state[6]; 45069 state[10] = state[2]; 45070 state[6] = t; 45071 state[2] = u; 45072 t = state[15]; 45073 u = state[11]; 45074 v = state[7]; 45075 state[15] = state[3]; 45076 state[11] = t; 45077 state[7] = u; 45078 state[3] = v; 45079 for (let j = 0; j < 16; ++j) { 45080 state[j] = this._inv_s[state[j]]; 45081 state[j] ^= key[j]; 45082 } 45083 return state; 45084 } 45085 _encrypt(input, key) { 45086 const s = this._s; 45087 let t, u, v; 45088 const state = new Uint8Array(16); 45089 state.set(input); 45090 for (let j = 0; j < 16; ++j) { 45091 state[j] ^= key[j]; 45092 } 45093 for (let i = 1; i < this._cyclesOfRepetition; i++) { 45094 for (let j = 0; j < 16; ++j) { 45095 state[j] = s[state[j]]; 45096 } 45097 v = state[1]; 45098 state[1] = state[5]; 45099 state[5] = state[9]; 45100 state[9] = state[13]; 45101 state[13] = v; 45102 v = state[2]; 45103 u = state[6]; 45104 state[2] = state[10]; 45105 state[6] = state[14]; 45106 state[10] = v; 45107 state[14] = u; 45108 v = state[3]; 45109 u = state[7]; 45110 t = state[11]; 45111 state[3] = state[15]; 45112 state[7] = v; 45113 state[11] = u; 45114 state[15] = t; 45115 for (let j = 0; j < 16; j += 4) { 45116 const s0 = state[j + 0]; 45117 const s1 = state[j + 1]; 45118 const s2 = state[j + 2]; 45119 const s3 = state[j + 3]; 45120 t = s0 ^ s1 ^ s2 ^ s3; 45121 state[j + 0] ^= t ^ this._mixCol[s0 ^ s1]; 45122 state[j + 1] ^= t ^ this._mixCol[s1 ^ s2]; 45123 state[j + 2] ^= t ^ this._mixCol[s2 ^ s3]; 45124 state[j + 3] ^= t ^ this._mixCol[s3 ^ s0]; 45125 } 45126 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 45127 state[j] ^= key[k]; 45128 } 45129 } 45130 for (let j = 0; j < 16; ++j) { 45131 state[j] = s[state[j]]; 45132 } 45133 v = state[1]; 45134 state[1] = state[5]; 45135 state[5] = state[9]; 45136 state[9] = state[13]; 45137 state[13] = v; 45138 v = state[2]; 45139 u = state[6]; 45140 state[2] = state[10]; 45141 state[6] = state[14]; 45142 state[10] = v; 45143 state[14] = u; 45144 v = state[3]; 45145 u = state[7]; 45146 t = state[11]; 45147 state[3] = state[15]; 45148 state[7] = v; 45149 state[11] = u; 45150 state[15] = t; 45151 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 45152 state[j] ^= key[k]; 45153 } 45154 return state; 45155 } 45156 _decryptBlock2(data, finalize) { 45157 const sourceLength = data.length; 45158 let buffer = this.buffer, 45159 bufferLength = this.bufferPosition; 45160 const result = []; 45161 let iv = this.iv; 45162 for (let i = 0; i < sourceLength; ++i) { 45163 buffer[bufferLength] = data[i]; 45164 ++bufferLength; 45165 if (bufferLength < 16) { 45166 continue; 45167 } 45168 const plain = this._decrypt(buffer, this._key); 45169 for (let j = 0; j < 16; ++j) { 45170 plain[j] ^= iv[j]; 45171 } 45172 iv = buffer; 45173 result.push(plain); 45174 buffer = new Uint8Array(16); 45175 bufferLength = 0; 45176 } 45177 this.buffer = buffer; 45178 this.bufferLength = bufferLength; 45179 this.iv = iv; 45180 if (result.length === 0) { 45181 return new Uint8Array(0); 45182 } 45183 let outputLength = 16 * result.length; 45184 if (finalize) { 45185 const lastBlock = result.at(-1); 45186 let psLen = lastBlock[15]; 45187 if (psLen <= 16) { 45188 for (let i = 15, ii = 16 - psLen; i >= ii; --i) { 45189 if (lastBlock[i] !== psLen) { 45190 psLen = 0; 45191 break; 45192 } 45193 } 45194 outputLength -= psLen; 45195 result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); 45196 } 45197 } 45198 const output = new Uint8Array(outputLength); 45199 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 45200 output.set(result[i], j); 45201 } 45202 return output; 45203 } 45204 decryptBlock(data, finalize, iv = null) { 45205 const sourceLength = data.length; 45206 const buffer = this.buffer; 45207 let bufferLength = this.bufferPosition; 45208 if (iv) { 45209 this.iv = iv; 45210 } else { 45211 for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) { 45212 buffer[bufferLength] = data[i]; 45213 } 45214 if (bufferLength < 16) { 45215 this.bufferLength = bufferLength; 45216 return new Uint8Array(0); 45217 } 45218 this.iv = buffer; 45219 data = data.subarray(16); 45220 } 45221 this.buffer = new Uint8Array(16); 45222 this.bufferLength = 0; 45223 this.decryptBlock = this._decryptBlock2; 45224 return this.decryptBlock(data, finalize); 45225 }
vendor: 8,515 bytes, lines 45226-45437
45226 encrypt(data, iv) { 45227 const sourceLength = data.length; 45228 let buffer = this.buffer, 45229 bufferLength = this.bufferPosition; 45230 const result = []; 45231 if (!iv) { 45232 iv = new Uint8Array(16); 45233 } 45234 for (let i = 0; i < sourceLength; ++i) { 45235 buffer[bufferLength] = data[i]; 45236 ++bufferLength; 45237 if (bufferLength < 16) { 45238 continue; 45239 } 45240 for (let j = 0; j < 16; ++j) { 45241 buffer[j] ^= iv[j]; 45242 } 45243 const cipher = this._encrypt(buffer, this._key); 45244 iv = cipher; 45245 result.push(cipher); 45246 buffer = new Uint8Array(16); 45247 bufferLength = 0; 45248 } 45249 this.buffer = buffer; 45250 this.bufferLength = bufferLength; 45251 this.iv = iv; 45252 if (result.length === 0) { 45253 return new Uint8Array(0); 45254 } 45255 const outputLength = 16 * result.length; 45256 const output = new Uint8Array(outputLength); 45257 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 45258 output.set(result[i], j); 45259 } 45260 return output; 45261 } 45262} 45263class AES128Cipher extends AESBaseCipher { 45264 constructor(key) { 45265 super(); 45266 this._cyclesOfRepetition = 10; 45267 this._keySize = 160; 45268 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]); 45269 this._key = this._expandKey(key); 45270 } 45271 _expandKey(cipherKey) { 45272 const b = 176; 45273 const s = this._s; 45274 const rcon = this._rcon; 45275 const result = new Uint8Array(b); 45276 result.set(cipherKey); 45277 for (let j = 16, i = 1; j < b; ++i) { 45278 let t1 = result[j - 3]; 45279 let t2 = result[j - 2]; 45280 let t3 = result[j - 1]; 45281 let t4 = result[j - 4]; 45282 t1 = s[t1]; 45283 t2 = s[t2]; 45284 t3 = s[t3]; 45285 t4 = s[t4]; 45286 t1 ^= rcon[i]; 45287 for (let n = 0; n < 4; ++n) { 45288 result[j] = t1 ^= result[j - 16]; 45289 j++; 45290 result[j] = t2 ^= result[j - 16]; 45291 j++; 45292 result[j] = t3 ^= result[j - 16]; 45293 j++; 45294 result[j] = t4 ^= result[j - 16]; 45295 j++; 45296 } 45297 } 45298 return result; 45299 } 45300} 45301exports.AES128Cipher = AES128Cipher; 45302class AES256Cipher extends AESBaseCipher { 45303 constructor(key) { 45304 super(); 45305 this._cyclesOfRepetition = 14; 45306 this._keySize = 224; 45307 this._key = this._expandKey(key); 45308 } 45309 _expandKey(cipherKey) { 45310 const b = 240; 45311 const s = this._s; 45312 const result = new Uint8Array(b); 45313 result.set(cipherKey); 45314 let r = 1; 45315 let t1, t2, t3, t4; 45316 for (let j = 32, i = 1; j < b; ++i) { 45317 if (j % 32 === 16) { 45318 t1 = s[t1]; 45319 t2 = s[t2]; 45320 t3 = s[t3]; 45321 t4 = s[t4]; 45322 } else if (j % 32 === 0) { 45323 t1 = result[j - 3]; 45324 t2 = result[j - 2]; 45325 t3 = result[j - 1]; 45326 t4 = result[j - 4]; 45327 t1 = s[t1]; 45328 t2 = s[t2]; 45329 t3 = s[t3]; 45330 t4 = s[t4]; 45331 t1 ^= r; 45332 if ((r <<= 1) >= 256) { 45333 r = (r ^ 0x1b) & 0xff; 45334 } 45335 } 45336 for (let n = 0; n < 4; ++n) { 45337 result[j] = t1 ^= result[j - 32]; 45338 j++; 45339 result[j] = t2 ^= result[j - 32]; 45340 j++; 45341 result[j] = t3 ^= result[j - 32]; 45342 j++; 45343 result[j] = t4 ^= result[j - 32]; 45344 j++; 45345 } 45346 } 45347 return result; 45348 } 45349} 45350exports.AES256Cipher = AES256Cipher; 45351class PDF17 { 45352 checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 45353 const hashData = new Uint8Array(password.length + 56); 45354 hashData.set(password, 0); 45355 hashData.set(ownerValidationSalt, password.length); 45356 hashData.set(userBytes, password.length + ownerValidationSalt.length); 45357 const result = calculateSHA256(hashData, 0, hashData.length); 45358 return (0, _util.isArrayEqual)(result, ownerPassword); 45359 } 45360 checkUserPassword(password, userValidationSalt, userPassword) { 45361 const hashData = new Uint8Array(password.length + 8); 45362 hashData.set(password, 0); 45363 hashData.set(userValidationSalt, password.length); 45364 const result = calculateSHA256(hashData, 0, hashData.length); 45365 return (0, _util.isArrayEqual)(result, userPassword); 45366 } 45367 getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 45368 const hashData = new Uint8Array(password.length + 56); 45369 hashData.set(password, 0); 45370 hashData.set(ownerKeySalt, password.length); 45371 hashData.set(userBytes, password.length + ownerKeySalt.length); 45372 const key = calculateSHA256(hashData, 0, hashData.length); 45373 const cipher = new AES256Cipher(key); 45374 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 45375 } 45376 getUserKey(password, userKeySalt, userEncryption) { 45377 const hashData = new Uint8Array(password.length + 8); 45378 hashData.set(password, 0); 45379 hashData.set(userKeySalt, password.length); 45380 const key = calculateSHA256(hashData, 0, hashData.length); 45381 const cipher = new AES256Cipher(key); 45382 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 45383 } 45384} 45385exports.PDF17 = PDF17; 45386class PDF20 { 45387 _hash(password, input, userBytes) { 45388 let k = calculateSHA256(input, 0, input.length).subarray(0, 32); 45389 let e = [0]; 45390 let i = 0; 45391 while (i < 64 || e.at(-1) > i - 32) { 45392 const combinedLength = password.length + k.length + userBytes.length, 45393 combinedArray = new Uint8Array(combinedLength); 45394 let writeOffset = 0; 45395 combinedArray.set(password, writeOffset); 45396 writeOffset += password.length; 45397 combinedArray.set(k, writeOffset); 45398 writeOffset += k.length; 45399 combinedArray.set(userBytes, writeOffset); 45400 const k1 = new Uint8Array(combinedLength * 64); 45401 for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) { 45402 k1.set(combinedArray, pos); 45403 } 45404 const cipher = new AES128Cipher(k.subarray(0, 16)); 45405 e = cipher.encrypt(k1, k.subarray(16, 32)); 45406 const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3; 45407 if (remainder === 0) { 45408 k = calculateSHA256(e, 0, e.length); 45409 } else if (remainder === 1) { 45410 k = calculateSHA384(e, 0, e.length); 45411 } else if (remainder === 2) { 45412 k = calculateSHA512(e, 0, e.length); 45413 } 45414 i++; 45415 } 45416 return k.subarray(0, 32); 45417 } 45418 checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 45419 const hashData = new Uint8Array(password.length + 56); 45420 hashData.set(password, 0); 45421 hashData.set(ownerValidationSalt, password.length); 45422 hashData.set(userBytes, password.length + ownerValidationSalt.length); 45423 const result = this._hash(password, hashData, userBytes); 45424 return (0, _util.isArrayEqual)(result, ownerPassword); 45425 } 45426 checkUserPassword(password, userValidationSalt, userPassword) { 45427 const hashData = new Uint8Array(password.length + 8); 45428 hashData.set(password, 0); 45429 hashData.set(userValidationSalt, password.length); 45430 const result = this._hash(password, hashData, []); 45431 return (0, _util.isArrayEqual)(result, userPassword); 45432 } 45433 getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 45434 const hashData = new Uint8Array(password.length + 56); 45435 hashData.set(password, 0); 45436 hashData.set(ownerKeySalt, password.length); 45437 hashData.set(userBytes, password.length + ownerKeySalt.length);
45438 const key = this._hash(password, hashData, userBytes); 45439 const cipher = new AES256Cipher(key); 45440 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 45441 } 45442 getUserKey(password, userKeySalt, userEncryption) { 45443 const hashData = new Uint8Array(password.length + 8); 45444 hashData.set(password, 0); 45445 hashData.set(userKeySalt, password.length); 45446 const key = this._hash(password, hashData, []); 45447 const cipher = new AES256Cipher(key); 45448 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 45449 } 45450} 45451exports.PDF20 = PDF20; 45452class CipherTransform { 45453 constructor(stringCipherConstructor, streamCipherConstructor) { 45454 this.StringCipherConstructor = stringCipherConstructor; 45455 this.StreamCipherConstructor = streamCipherConstructor; 45456 } 45457 createStream(stream, length) { 45458 const cipher = new this.StreamCipherConstructor(); 45459 return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) { 45460 return cipher.decryptBlock(data, finalize); 45461 }); 45462 } 45463 decryptString(s) { 45464 const cipher = new this.StringCipherConstructor(); 45465 let data = (0, _util.stringToBytes)(s); 45466 data = cipher.decryptBlock(data, true); 45467 return (0, _util.bytesToString)(data); 45468 } 45469 encryptString(s) { 45470 const cipher = new this.StringCipherConstructor(); 45471 if (cipher instanceof AESBaseCipher) { 45472 const strLen = s.length; 45473 const pad = 16 - strLen % 16; 45474 s += String.fromCharCode(pad).repeat(pad); 45475 const iv = new Uint8Array(16); 45476 if (typeof crypto !== "undefined") { 45477 crypto.getRandomValues(iv); 45478 } else { 45479 for (let i = 0; i < 16; i++) { 45480 iv[i] = Math.floor(256 * Math.random()); 45481 } 45482 } 45483 let data = (0, _util.stringToBytes)(s); 45484 data = cipher.encrypt(data, iv); 45485 const buf = new Uint8Array(16 + data.length); 45486 buf.set(iv); 45487 buf.set(data, 16); 45488 return (0, _util.bytesToString)(buf); 45489 } 45490 let data = (0, _util.stringToBytes)(s); 45491 data = cipher.encrypt(data); 45492 return (0, _util.bytesToString)(data); 45493 } 45494} 45495class CipherTransformFactory { 45496 static #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]); 45497 #createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) { 45498 if (password) { 45499 const passwordLength = Math.min(127, password.length); 45500 password = password.subarray(0, passwordLength); 45501 } else { 45502 password = []; 45503 } 45504 const pdfAlgorithm = revision === 6 ? new PDF20() : new PDF17(); 45505 if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) { 45506 return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption); 45507 } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) { 45508 return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption); 45509 } 45510 return null; 45511 } 45512 #prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) { 45513 const hashDataSize = 40 + ownerPassword.length + fileId.length; 45514 const hashData = new Uint8Array(hashDataSize); 45515 let i = 0, 45516 j, 45517 n; 45518 if (password) { 45519 n = Math.min(32, password.length); 45520 for (; i < n; ++i) { 45521 hashData[i] = password[i]; 45522 } 45523 } 45524 j = 0; 45525 while (i < 32) { 45526 hashData[i++] = CipherTransformFactory.#defaultPasswordBytes[j++]; 45527 } 45528 for (j = 0, n = ownerPassword.length; j < n; ++j) { 45529 hashData[i++] = ownerPassword[j]; 45530 } 45531 hashData[i++] = flags & 0xff; 45532 hashData[i++] = flags >> 8 & 0xff; 45533 hashData[i++] = flags >> 16 & 0xff; 45534 hashData[i++] = flags >>> 24 & 0xff; 45535 for (j = 0, n = fileId.length; j < n; ++j) { 45536 hashData[i++] = fileId[j]; 45537 } 45538 if (revision >= 4 && !encryptMetadata) { 45539 hashData[i++] = 0xff; 45540 hashData[i++] = 0xff; 45541 hashData[i++] = 0xff; 45542 hashData[i++] = 0xff; 45543 } 45544 let hash = calculateMD5(hashData, 0, i);
45545 const keyLengthInBytes = keyLength >> 3; 45546 if (revision >= 3) { 45547 for (j = 0; j < 50; ++j) { 45548 hash = calculateMD5(hash, 0, keyLengthInBytes); 45549 } 45550 } 45551 const encryptionKey = hash.subarray(0, keyLengthInBytes); 45552 let cipher, checkData; 45553 if (revision >= 3) { 45554 for (i = 0; i < 32; ++i) { 45555 hashData[i] = CipherTransformFactory.#defaultPasswordBytes[i]; 45556 } 45557 for (j = 0, n = fileId.length; j < n; ++j) { 45558 hashData[i++] = fileId[j]; 45559 } 45560 cipher = new ARCFourCipher(encryptionKey); 45561 checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i)); 45562 n = encryptionKey.length; 45563 const derivedKey = new Uint8Array(n); 45564 for (j = 1; j <= 19; ++j) { 45565 for (let k = 0; k < n; ++k) { 45566 derivedKey[k] = encryptionKey[k] ^ j; 45567 } 45568 cipher = new ARCFourCipher(derivedKey); 45569 checkData = cipher.encryptBlock(checkData); 45570 } 45571 for (j = 0, n = checkData.length; j < n; ++j) { 45572 if (userPassword[j] !== checkData[j]) { 45573 return null; 45574 } 45575 } 45576 } else { 45577 cipher = new ARCFourCipher(encryptionKey); 45578 checkData = cipher.encryptBlock(CipherTransformFactory.#defaultPasswordBytes); 45579 for (j = 0, n = checkData.length; j < n; ++j) { 45580 if (userPassword[j] !== checkData[j]) { 45581 return null; 45582 } 45583 } 45584 } 45585 return encryptionKey; 45586 } 45587 #decodeUserPassword(password, ownerPassword, revision, keyLength) { 45588 const hashData = new Uint8Array(32); 45589 let i = 0; 45590 const n = Math.min(32, password.length); 45591 for (; i < n; ++i) { 45592 hashData[i] = password[i]; 45593 } 45594 let j = 0; 45595 while (i < 32) { 45596 hashData[i++] = CipherTransformFactory.#defaultPasswordBytes[j++]; 45597 } 45598 let hash = calculateMD5(hashData, 0, i); 45599 const keyLengthInBytes = keyLength >> 3; 45600 if (revision >= 3) { 45601 for (j = 0; j < 50; ++j) { 45602 hash = calculateMD5(hash, 0, hash.length); 45603 } 45604 } 45605 let cipher, userPassword; 45606 if (revision >= 3) { 45607 userPassword = ownerPassword; 45608 const derivedKey = new Uint8Array(keyLengthInBytes); 45609 for (j = 19; j >= 0; j--) { 45610 for (let k = 0; k < keyLengthInBytes; ++k) { 45611 derivedKey[k] = hash[k] ^ j; 45612 } 45613 cipher = new ARCFourCipher(derivedKey); 45614 userPassword = cipher.encryptBlock(userPassword); 45615 } 45616 } else { 45617 cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes)); 45618 userPassword = cipher.encryptBlock(ownerPassword); 45619 } 45620 return userPassword; 45621 } 45622 #buildObjectKey(num, gen, encryptionKey, isAes = false) { 45623 const key = new Uint8Array(encryptionKey.length + 9); 45624 const n = encryptionKey.length; 45625 let i; 45626 for (i = 0; i < n; ++i) { 45627 key[i] = encryptionKey[i]; 45628 } 45629 key[i++] = num & 0xff; 45630 key[i++] = num >> 8 & 0xff; 45631 key[i++] = num >> 16 & 0xff; 45632 key[i++] = gen & 0xff; 45633 key[i++] = gen >> 8 & 0xff; 45634 if (isAes) { 45635 key[i++] = 0x73; 45636 key[i++] = 0x41; 45637 key[i++] = 0x6c; 45638 key[i++] = 0x54; 45639 } 45640 const hash = calculateMD5(key, 0, i); 45641 return hash.subarray(0, Math.min(encryptionKey.length + 5, 16)); 45642 } 45643 #buildCipherConstructor(cf, name, num, gen, key) { 45644 if (!(name instanceof _primitives.Name)) { 45645 throw new _util.FormatError("Invalid crypt filter name."); 45646 } 45647 const self = this; 45648 const cryptFilter = cf.get(name.name); 45649 const cfm = cryptFilter?.get("CFM"); 45650 if (!cfm || cfm.name === "None") { 45651 return function () { 45652 return new NullCipher(); 45653 }; 45654 } 45655 if (cfm.name === "V2") { 45656 return function () { 45657 return new ARCFourCipher(self.#buildObjectKey(num, gen, key, false)); 45658 }; 45659 } 45660 if (cfm.name === "AESV2") { 45661 return function () { 45662 return new AES128Cipher(self.#buildObjectKey(num, gen, key, true)); 45663 }; 45664 } 45665 if (cfm.name === "AESV3") { 45666 return function () { 45667 return new AES256Cipher(key); 45668 }; 45669 } 45670 throw new _util.FormatError("Unknown crypto method"); 45671 } 45672 constructor(dict, fileId, password) { 45673 const filter = dict.get("Filter"); 45674 if (!(0, _primitives.isName)(filter, "Standard")) { 45675 throw new _util.FormatError("unknown encryption method"); 45676 } 45677 this.filterName = filter.name; 45678 this.dict = dict; 45679 const algorithm = dict.get("V"); 45680 if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { 45681 throw new _util.FormatError("unsupported encryption algorithm"); 45682 } 45683 this.algorithm = algorithm; 45684 let keyLength = dict.get("Length"); 45685 if (!keyLength) { 45686 if (algorithm <= 3) { 45687 keyLength = 40; 45688 } else { 45689 const cfDict = dict.get("CF"); 45690 const streamCryptoName = dict.get("StmF"); 45691 if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) { 45692 cfDict.suppressEncryption = true; 45693 const handlerDict = cfDict.get(streamCryptoName.name); 45694 keyLength = handlerDict?.get("Length") || 128; 45695 if (keyLength < 40) { 45696 keyLength <<= 3; 45697 } 45698 } 45699 } 45700 } 45701 if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { 45702 throw new _util.FormatError("invalid key length"); 45703 } 45704 const ownerBytes = (0, _util.stringToBytes)(dict.get("O")), 45705 userBytes = (0, _util.stringToBytes)(dict.get("U")); 45706 const ownerPassword = ownerBytes.subarray(0, 32); 45707 const userPassword = userBytes.subarray(0, 32); 45708 const flags = dict.get("P"); 45709 const revision = dict.get("R"); 45710 const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false; 45711 this.encryptMetadata = encryptMetadata; 45712 const fileIdBytes = (0, _util.stringToBytes)(fileId); 45713 let passwordBytes; 45714 if (password) { 45715 if (revision === 6) { 45716 try { 45717 password = (0, _util.utf8StringToString)(password); 45718 } catch { 45719 (0, _util.warn)("CipherTransformFactory: Unable to convert UTF8 encoded password."); 45720 } 45721 } 45722 passwordBytes = (0, _util.stringToBytes)(password); 45723 } 45724 let encryptionKey; 45725 if (algorithm !== 5) { 45726 encryptionKey = this.#prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 45727 } else { 45728 const ownerValidationSalt = ownerBytes.subarray(32, 40); 45729 const ownerKeySalt = ownerBytes.subarray(40, 48); 45730 const uBytes = userBytes.subarray(0, 48); 45731 const userValidationSalt = userBytes.subarray(32, 40); 45732 const userKeySalt = userBytes.subarray(40, 48); 45733 const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE")); 45734 const userEncryption = (0, _util.stringToBytes)(dict.get("UE")); 45735 const perms = (0, _util.stringToBytes)(dict.get("Perms")); 45736 encryptionKey = this.#createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms); 45737 } 45738 if (!encryptionKey && !password) { 45739 throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD); 45740 } else if (!encryptionKey && password) {
45741 const decodedPassword = this.#decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength); 45742 encryptionKey = this.#prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 45743 } 45744 if (!encryptionKey) { 45745 throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD); 45746 } 45747 this.encryptionKey = encryptionKey; 45748 if (algorithm >= 4) { 45749 const cf = dict.get("CF"); 45750 if (cf instanceof _primitives.Dict) { 45751 cf.suppressEncryption = true; 45752 } 45753 this.cf = cf; 45754 this.stmf = dict.get("StmF") || _primitives.Name.get("Identity"); 45755 this.strf = dict.get("StrF") || _primitives.Name.get("Identity"); 45756 this.eff = dict.get("EFF") || this.stmf; 45757 } 45758 } 45759 createCipherTransform(num, gen) { 45760 if (this.algorithm === 4 || this.algorithm === 5) { 45761 return new CipherTransform(this.#buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), this.#buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey)); 45762 } 45763 const key = this.#buildObjectKey(num, gen, this.encryptionKey, false); 45764 const cipherConstructor = function () { 45765 return new ARCFourCipher(key); 45766 }; 45767 return new CipherTransform(cipherConstructor, cipherConstructor); 45768 } 45769} 45770exports.CipherTransformFactory = CipherTransformFactory; 45771 45772/***/ }), 45773/* 75 */ 45774/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 45775 45776 45777 45778Object.defineProperty(exports, "__esModule", ({ 45779 value: true 45780})); 45781exports.DecryptStream = void 0; 45782var _decode_stream = __w_pdfjs_require__(18); 45783const chunkSize = 512; 45784class DecryptStream extends _decode_stream.DecodeStream { 45785 constructor(str, maybeLength, decrypt) { 45786 super(maybeLength); 45787 this.str = str; 45788 this.dict = str.dict; 45789 this.decrypt = decrypt; 45790 this.nextChunk = null; 45791 this.initialized = false; 45792 } 45793 readBlock() {
45794 let chunk; 45795 if (this.initialized) { 45796 chunk = this.nextChunk; 45797 } else { 45798 chunk = this.str.getBytes(chunkSize); 45799 this.initialized = true; 45800 } 45801 if (!chunk || chunk.length === 0) { 45802 this.eof = true; 45803 return; 45804 } 45805 this.nextChunk = this.str.getBytes(chunkSize); 45806 const hasMoreData = this.nextChunk?.length > 0; 45807 const decrypt = this.decrypt; 45808 chunk = decrypt(chunk, !hasMoreData); 45809 const bufferLength = this.bufferLength, 45810 newLength = bufferLength + chunk.length, 45811 buffer = this.ensureBuffer(newLength); 45812 buffer.set(chunk, bufferLength); 45813 this.bufferLength = newLength; 45814 } 45815} 45816exports.DecryptStream = DecryptStream; 45817 45818/***/ }), 45819/* 76 */ 45820/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 45821 45822 45823 45824Object.defineProperty(exports, "__esModule", ({ 45825 value: true 45826})); 45827exports.ObjectLoader = void 0; 45828var _primitives = __w_pdfjs_require__(4); 45829var _base_stream = __w_pdfjs_require__(5); 45830var _core_utils = __w_pdfjs_require__(3); 45831var _util = __w_pdfjs_require__(2); 45832function mayHaveChildren(value) { 45833 return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value); 45834} 45835function addChildren(node, nodesToVisit) { 45836 if (node instanceof _primitives.Dict) { 45837 node = node.getRawValues(); 45838 } else if (node instanceof _base_stream.BaseStream) { 45839 node = node.dict.getRawValues(); 45840 } else if (!Array.isArray(node)) { 45841 return; 45842 } 45843 for (const rawValue of node) { 45844 if (mayHaveChildren(rawValue)) { 45845 nodesToVisit.push(rawValue); 45846 } 45847 } 45848} 45849class ObjectLoader { 45850 constructor(dict, keys, xref) { 45851 this.dict = dict; 45852 this.keys = keys; 45853 this.xref = xref; 45854 this.refSet = null; 45855 } 45856 async load() { 45857 if (this.xref.stream.isDataLoaded) { 45858 return undefined; 45859 } 45860 const { 45861 keys, 45862 dict 45863 } = this; 45864 this.refSet = new _primitives.RefSet(); 45865 const nodesToVisit = []; 45866 for (const key of keys) { 45867 const rawValue = dict.getRaw(key); 45868 if (rawValue !== undefined) { 45869 nodesToVisit.push(rawValue); 45870 } 45871 } 45872 return this._walk(nodesToVisit); 45873 } 45874 async _walk(nodesToVisit) { 45875 const nodesToRevisit = []; 45876 const pendingRequests = []; 45877 while (nodesToVisit.length) { 45878 let currentNode = nodesToVisit.pop(); 45879 if (currentNode instanceof _primitives.Ref) { 45880 if (this.refSet.has(currentNode)) { 45881 continue; 45882 } 45883 try { 45884 this.refSet.put(currentNode); 45885 currentNode = this.xref.fetch(currentNode); 45886 } catch (ex) { 45887 if (!(ex instanceof _core_utils.MissingDataException)) { 45888 (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`); 45889 this.refSet = null; 45890 const { 45891 manager 45892 } = this.xref.stream; 45893 return manager.requestAllChunks(); 45894 } 45895 nodesToRevisit.push(currentNode); 45896 pendingRequests.push({ 45897 begin: ex.begin, 45898 end: ex.end 45899 }); 45900 } 45901 } 45902 if (currentNode instanceof _base_stream.BaseStream) { 45903 const baseStreams = currentNode.getBaseStreams(); 45904 if (baseStreams) { 45905 let foundMissingData = false; 45906 for (const stream of baseStreams) { 45907 if (stream.isDataLoaded) { 45908 continue; 45909 } 45910 foundMissingData = true; 45911 pendingRequests.push({ 45912 begin: stream.start, 45913 end: stream.end 45914 }); 45915 } 45916 if (foundMissingData) { 45917 nodesToRevisit.push(currentNode); 45918 } 45919 } 45920 } 45921 addChildren(currentNode, nodesToVisit); 45922 } 45923 if (pendingRequests.length) { 45924 await this.xref.stream.manager.requestRanges(pendingRequests); 45925 for (const node of nodesToRevisit) { 45926 if (node instanceof _primitives.Ref) { 45927 this.refSet.remove(node); 45928 } 45929 } 45930 return this._walk(nodesToRevisit); 45931 } 45932 this.refSet = null; 45933 return undefined; 45934 } 45935} 45936exports.ObjectLoader = ObjectLoader; 45937 45938/***/ }), 45939/* 77 */ 45940/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 45941 45942 45943 45944Object.defineProperty(exports, "__esModule", ({ 45945 value: true 45946})); 45947exports.XFAFactory = void 0; 45948var _symbol_utils = __w_pdfjs_require__(78); 45949var _bind = __w_pdfjs_require__(79); 45950var _data = __w_pdfjs_require__(89); 45951var _fonts = __w_pdfjs_require__(85); 45952var _utils = __w_pdfjs_require__(84); 45953var _util = __w_pdfjs_require__(2); 45954var _parser = __w_pdfjs_require__(90); 45955var _xhtml = __w_pdfjs_require__(100); 45956class XFAFactory { 45957 constructor(data) { 45958 try { 45959 this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data)); 45960 const binder = new _bind.Binder(this.root); 45961 this.form = binder.bind(); 45962 this.dataHandler = new _data.DataHandler(this.root, binder.getData()); 45963 this.form[_symbol_utils.$globalData].template = this.form; 45964 } catch (e) { 45965 (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`); 45966 } 45967 } 45968 isValid() { 45969 return this.root && this.form; 45970 } 45971 _createPagesHelper() { 45972 const iterator = this.form[_symbol_utils.$toPages](); 45973 return new Promise((resolve, reject) => { 45974 const nextIteration = () => { 45975 try { 45976 const value = iterator.next(); 45977 if (value.done) { 45978 resolve(value.value); 45979 } else { 45980 setTimeout(nextIteration, 0); 45981 } 45982 } catch (e) { 45983 reject(e); 45984 } 45985 }; 45986 setTimeout(nextIteration, 0); 45987 }); 45988 } 45989 async _createPages() { 45990 try { 45991 this.pages = await this._createPagesHelper(); 45992 this.dims = this.pages.children.map(c => { 45993 const { 45994 width, 45995 height 45996 } = c.attributes.style; 45997 return [0, 0, parseInt(width), parseInt(height)]; 45998 }); 45999 } catch (e) { 46000 (0, _util.warn)(`XFA - an error occurred during layout: ${e}`); 46001 } 46002 } 46003 getBoundingBox(pageIndex) { 46004 return this.dims[pageIndex]; 46005 } 46006 async getNumPages() { 46007 if (!this.pages) { 46008 await this._createPages(); 46009 } 46010 return this.dims.length; 46011 } 46012 setImages(images) { 46013 this.form[_symbol_utils.$globalData].images = images; 46014 } 46015 setFonts(fonts) { 46016 this.form[_symbol_utils.$globalData].fontFinder = new _fonts.FontFinder(fonts); 46017 const missingFonts = []; 46018 for (let typeface of this.form[_symbol_utils.$globalData].usedTypefaces) { 46019 typeface = (0, _utils.stripQuotes)(typeface); 46020 const font = this.form[_symbol_utils.$globalData].fontFinder.find(typeface); 46021 if (!font) { 46022 missingFonts.push(typeface); 46023 } 46024 } 46025 if (missingFonts.length > 0) { 46026 return missingFonts; 46027 } 46028 return null; 46029 } 46030 appendFonts(fonts, reallyMissingFonts) { 46031 this.form[_symbol_utils.$globalData].fontFinder.add(fonts, reallyMissingFonts); 46032 } 46033 async getPages() { 46034 if (!this.pages) { 46035 await this._createPages(); 46036 } 46037 const pages = this.pages; 46038 this.pages = null; 46039 return pages; 46040 } 46041 serializeData(storage) { 46042 return this.dataHandler.serialize(storage); 46043 } 46044 static _createDocument(data) { 46045 if (!data["/xdp:xdp"]) { 46046 return data["xdp:xdp"]; 46047 } 46048 return Object.values(data).join(""); 46049 } 46050 static getRichTextAsHtml(rc) { 46051 if (!rc || typeof rc !== "string") { 46052 return null; 46053 } 46054 try { 46055 let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc
46055); 46056 if (!["body", "xhtml"].includes(root[_symbol_utils.$nodeName])) { 46057 const newRoot = _xhtml.XhtmlNamespace.body({}); 46058 newRoot[_symbol_utils.$appendChild](root); 46059 root = newRoot; 46060 } 46061 const result = root[_symbol_utils.$toHTML](); 46062 if (!result.success) { 46063 return null; 46064 } 46065 const { 46066 html 46067 } = result; 46068 const { 46069 attributes 46070 } = html; 46071 if (attributes) { 46072 if (attributes.class) { 46073 attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa")); 46074 } 46075 attributes.dir = "auto"; 46076 } 46077 return { 46078 html, 46079 str: root[_symbol_utils.$text]() 46080 }; 46081 } catch (e) { 46082 (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`); 46083 } 46084 return null; 46085 } 46086} 46087exports.XFAFactory = XFAFactory; 46088 46089/***/ }), 46090/* 78 */ 46091/***/ ((__unused_webpack_module, exports) => { 46092 46093 46094 46095Object.defineProperty(exports, "__esModule", ({ 46096 value: true 46097})); 46098exports.$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.$lastAttribute = 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; 46099const $acceptWhitespace = Symbol(); 46100exports.$acceptWhitespace = $acceptWhitespace; 46101const $addHTML = Symbol(); 46102exports.$addHTML = $addHTML; 46103const $appendChild = Symbol(); 46104exports.$appendChild = $appendChild; 46105const $childrenToHTML = Symbol(); 46106exports.$childrenToHTML = $childrenToHTML; 46107const $clean = Symbol(); 46108exports.$clean = $clean; 46109const $cleanPage = Symbol(); 46110exports.$cleanPage = $cleanPage; 46111const $cleanup = Symbol(); 46112exports.$cleanup = $cleanup; 46113const $clone = Symbol(); 46114exports.$clone = $clone; 46115const $consumed = Symbol(); 46116exports.$consumed = $consumed; 46117const $content = Symbol("content"); 46118exports.$content = $content; 46119const $data = Symbol("data"); 46120exports.$data = $data; 46121const $dump = Symbol(); 46122exports.$dump = $dump; 46123const $extra = Symbol("extra"); 46124exports.$extra = $extra; 46125const $finalize = Symbol(); 46126exports.$finalize = $finalize; 46127const $flushHTML = Symbol(); 46128exports.$flushHTML = $flushHTML; 46129const $getAttributeIt = Symbol(); 46130exports.$getAttributeIt = $getAttributeIt; 46131const $getAttributes = Symbol(); 46132exports.$getAttributes = $getAttributes; 46133const $getAvailableSpace = Symbol(); 46134exports.$getAvailableSpace = $getAvailableSpace; 46135const $getChildrenByClass = Symbol(); 46136exports.$getChildrenByClass = $getChildrenByClass; 46137const $getChildrenByName = Symbol(); 46138exports.$getChildrenByName = $getChildrenByName; 46139const $getChildrenByNameIt = Symbol(); 46140exports.$getChildrenByNameIt = $getChildrenByNameIt; 46141const $getDataValue = Symbol(); 46142exports.$getDataValue = $getDataValue; 46143const $getExtra = Symbol(); 46144exports.$getExtra = $getExtra; 46145const $getRealChildrenByNameIt = Symbol(); 46146exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt; 46147const $getChildren = Symbol(); 46148exports.$getChildren = $getChildren; 46149const $getContainedChildren = Symbol(); 46150exports.$getContainedChildren = $getContainedChildren; 46151const $getNextPage = Symbol(); 46152exports.$getNextPage = $getNextPage; 46153const $getSubformParent = Symbol(); 46154exports.$getSubformParent = $getSubformParent; 46155const $getParent = Symbol(); 46156exports.$getParent = $getParent; 46157const $getTemplateRoot = Symbol(); 46158exports.$getTemplateRoot = $getTemplateRoot; 46159const $globalData = Symbol(); 46160exports.$globalData = $globalData; 46161const $hasSettableValue = Symbol(); 46162exports.$hasSettableValue = $hasSettableValue; 46163const $ids = Symbol(); 46164exports.$ids = $ids; 46165const $indexOf = Symbol(); 46166exports.$indexOf = $indexOf; 46167const $insertAt = Symbol(); 46168exports.$insertAt = $insertAt; 46169const $isCDATAXml = Symbol(); 46170exports.$isCDATAXml = $isCDATAXml; 46171const $isBindable = Symbol(); 46172exports.$isBindable = $isBindable; 46173const $isDataValue = Symbol(); 46174exports.$isDataValue = $isDataValue; 46175const $isDescendent = Symbol(); 46176exports.$isDescendent = $isDescendent; 46177const $isNsAgnostic = Symbol(); 46178exports.$isNsAgnostic = $isNsAgnostic; 46179const $isSplittable = Symbol(); 46180exports.$isSplittable = $isSplittable; 46181const $isThereMoreWidth = Symbol(); 46182exports.$isThereMoreWidth = $isThereMoreWidth; 46183const $isTransparent = Symbol(); 46184exports.$isTransparent = $isTransparent; 46185const $isUsable = Symbol(); 46186exports.$isUsable = $isUsable; 46187const $lastAttribute = Symbol(); 46188exports.$lastAttribute = $lastAttribute; 46189const $namespaceId = Symbol("namespaceId"); 46190exports.$namespaceId = $namespaceId; 46191const $nodeName = Symbol("nodeName"); 46192exports.$nodeName = $nodeName; 46193const $nsAttributes = Symbol(); 46194exports.$nsAttributes = $nsAttributes;
46195const $onChild = Symbol(); 46196exports.$onChild = $onChild; 46197const $onChildCheck = Symbol(); 46198exports.$onChildCheck = $onChildCheck; 46199const $onText = Symbol(); 46200exports.$onText = $onText; 46201const $pushGlyphs = Symbol(); 46202exports.$pushGlyphs = $pushGlyphs; 46203const $popPara = Symbol(); 46204exports.$popPara = $popPara; 46205const $pushPara = Symbol(); 46206exports.$pushPara = $pushPara; 46207const $removeChild = Symbol(); 46208exports.$removeChild = $removeChild; 46209const $root = Symbol("root"); 46210exports.$root = $root; 46211const $resolvePrototypes = Symbol(); 46212exports.$resolvePrototypes = $resolvePrototypes; 46213const $searchNode = Symbol(); 46214exports.$searchNode = $searchNode; 46215const $setId = Symbol(); 46216exports.$setId = $setId; 46217const $setSetAttributes = Symbol(); 46218exports.$setSetAttributes = $setSetAttributes; 46219const $setValue = Symbol(); 46220exports.$setValue = $setValue; 46221const $tabIndex = Symbol(); 46222exports.$tabIndex = $tabIndex; 46223const $text = Symbol(); 46224exports.$text = $text; 46225const $toPages = Symbol(); 46226exports.$toPages = $toPages; 46227const $toHTML = Symbol(); 46228exports.$toHTML = $toHTML; 46229const $toString = Symbol(); 46230exports.$toString = $toString; 46231const $toStyle = Symbol(); 46232exports.$toStyle = $toStyle; 46233const $uid = Symbol("uid"); 46234exports.$uid = $uid; 46235 46236/***/ }), 46237/* 79 */ 46238/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 46239 46240 46241 46242Object.defineProperty(exports, "__esModule", ({ 46243 value: true 46244})); 46245exports.Binder = void 0; 46246var _symbol_utils = __w_pdfjs_require__(78); 46247var _template = __w_pdfjs_require__(80); 46248var _som = __w_pdfjs_require__(88); 46249var _xfa_object = __w_pdfjs_require__(87); 46250var _namespaces = __w_pdfjs_require__(81); 46251var _util = __w_pdfjs_require__(2); 46252const NS_DATASETS = _namespaces.NamespaceIds.datasets.id; 46253function createText(content) { 46254 const node = new _template.Text({}); 46255 node[_symbol_utils.$content] = content; 46256 return node; 46257} 46258class Binder { 46259 constructor(root) { 46260 this.root = root; 46261 this.datasets = root.datasets; 46262 this.data = root.datasets?.data || new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data"); 46263 this.emptyMerge = this.data[_symbol_utils.$getChildren]().length === 0; 46264 this.root.form = this.form = root.template[_symbol_utils.$clone](); 46265 } 46266 _isConsumeData() { 46267 return !this.emptyMerge && this._mergeMode; 46268 } 46269 _isMatchTemplate() { 46270 return !this._isConsumeData(); 46271 } 46272 bind() { 46273 this._bindElement(this.form, this.data); 46274 return this.form; 46275 } 46276 getData() { 46277 return this.data; 46278 } 46279 _bindValue(formNode, data, picture) { 46280 formNode[_symbol_utils.$data] = data; 46281 if (formNode[_symbol_utils.$hasSettableValue]()) { 46282 if (data[_symbol_utils.$isDataValue]()) { 46283 const value = data[_symbol_utils.$getDataValue](); 46284 formNode[_symbol_utils.$setValue](createText(value)); 46285 } else if (formNode instanceof _template.Field && formNode.ui?.choiceList?.open === "multiSelect") { 46286 const value = data[_symbol_utils.$getChildren]().map(child => child[_symbol_utils.$content].trim()).join("\n"); 46287 formNode[_symbol_utils.$setValue](createText(value)); 46288 } else if (this._isConsumeData()) { 46289 (0, _util.warn)(`XFA - Nodes haven't the same type.`); 46290 } 46291 } else if (!data[_symbol_utils.$isDataValue]() || this._isMatchTemplate()) { 46292 this._bindElement(formNode, data); 46293 } else { 46294 (0, _util.warn)(`XFA - Nodes haven't the same type.`); 46295 } 46296 } 46297 _findDataByNameToConsume(name, isValue, dataNode, global) { 46298 if (!name) { 46299 return null; 46300 } 46301 let generator, match; 46302 for (let i = 0; i < 3; i++) { 46303 generator = dataNode[_symbol_utils.$getRealChildrenByNameIt](name, false, true); 46304 while (true) { 46305 match = generator.next().value; 46306 if (!match) { 46307 break; 46308 } 46309 if (isValue === match[_symbol_utils.$isDataValue]()) { 46310 return match; 46311 } 46312 } 46313 if (dataNode[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_symbol_utils.$nodeName] === "data") { 46314 break; 46315 } 46316 dataNode = dataNode[_symbol_utils.$getParent](); 46317 } 46318 if (!global) { 46319 return null; 46320 } 46321 generator = this.data[_symbol_utils.$getRealChildrenByNameIt](name, true, false); 46322 match = generator.next().value; 46323 if (match) { 46324 return match; 46325 } 46326 generator = this.data[_symbol_utils.$getAttributeIt](name, true); 46327 match = generator.next().value; 46328 if (match?.[_symbol_utils.$isDataValue]()) { 46329 return match; 46330 } 46331 return null; 46332 } 46333 _setProperties(formNode, dataNode) { 46334 if (!formNode.hasOwnProperty("setProperty")) { 46335 return; 46336 } 46337 for (const { 46338 ref, 46339 target, 46340 connection 46341 } of formNode.setProperty.children) { 46342 if (connection) { 46343 continue; 46344 } 46345 if (!ref) { 46346 continue; 46347 } 46348 const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
46349 if (!nodes) { 46350 (0, _util.warn)(`XFA - Invalid reference: ${ref}.`); 46351 continue; 46352 } 46353 const [node] = nodes; 46354 if (!node[_symbol_utils.$isDescendent](this.data)) { 46355 (0, _util.warn)(`XFA - Invalid node: must be a data node.`); 46356 continue; 46357 } 46358 const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false); 46359 if (!targetNodes) { 46360 (0, _util.warn)(`XFA - Invalid target: ${target}.`); 46361 continue; 46362 } 46363 const [targetNode] = targetNodes; 46364 if (!targetNode[_symbol_utils.$isDescendent](formNode)) { 46365 (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`); 46366 continue; 46367 } 46368 const targetParent = targetNode[_symbol_utils.$getParent](); 46369 if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) { 46370 (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`); 46371 continue; 46372 } 46373 if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) { 46374 (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`); 46375 continue; 46376 } 46377 const content = node[_symbol_utils.$text](); 46378 const name = targetNode[_symbol_utils.$nodeName]; 46379 if (targetNode instanceof _xfa_object.XFAAttribute) { 46380 const attrs = Object.create(null); 46381 attrs[name] = content; 46382 const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]); 46383 targetParent[name] = obj[name]; 46384 continue; 46385 } 46386 if (!targetNode.hasOwnProperty(_symbol_utils.$content)) { 46387 (0, _util.warn)(`XFA - Invalid node to use in setProperty`); 46388 continue; 46389 } 46390 targetNode[_symbol_utils.$data] = node; 46391 targetNode[_symbol_utils.$content] = content; 46392 targetNode[_symbol_utils.$finalize](); 46393 } 46394 } 46395 _bindItems(formNode, dataNode) { 46396 if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) { 46397 return; 46398 } 46399 for (const item of formNode.items.children) { 46400 formNode[_symbol_utils.$removeChild](item); 46401 } 46402 formNode.items.clear(); 46403 const labels = new _template.Items({}); 46404 const values = new _template.Items({}); 46405 formNode[_symbol_utils.$appendChild](labels); 46406 formNode.items.push(labels); 46407 formNode[_symbol_utils.$appendChild](values); 46408 formNode.items.push(values); 46409 for (const { 46410 ref, 46411 labelRef, 46412 valueRef, 46413 connection 46414 } of formNode.bindItems.children) { 46415 if (connection) { 46416 continue; 46417 } 46418 if (!ref) { 46419 continue; 46420 } 46421 const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false); 46422 if (!nodes) { 46423 (0, _util.warn)(`XFA - Invalid reference: ${ref}.`); 46424 continue; 46425 } 46426 for (const node of nodes) { 46427 if (!node[_symbol_utils.$isDescendent](this.datasets)) { 46428 (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`); 46429 continue; 46430 } 46431 const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false); 46432 if (!labelNodes) { 46433 (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`); 46434 continue; 46435 } 46436 const [labelNode] = labelNodes; 46437 if (!labelNode[_symbol_utils.$isDescendent](this.datasets)) { 46438 (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`); 46439 continue; 46440 } 46441 const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false); 46442 if (!valueNodes) { 46443 (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`); 46444 continue; 46445 } 46446 const [valueNode] = valueNodes; 46447 if (!valueNode[_symbol_utils.$isDescendent](this.datasets)) { 46448 (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`); 46449 continue; 46450 } 46451 const label = createText(labelNode[_symbol_utils.$text]()); 46452 const value = createText(valueNode[_symbol_utils.$text]()); 46453 labels[_symbol_utils.$appendChild](label); 46454 labels.text.push(label); 46455 values[_symbol_utils.$appendChild](value); 46456 values.text.push(value); 46457 } 46458 } 46459 } 46460 _bindOccurrences(formNode, matches, picture) { 46461 let baseClone; 46462 if (matches.length > 1) { 46463 baseClone = formNode[_symbol_utils.$clone](); 46464 baseClone[_symbol_utils.$removeChild](baseClone.occur); 46465 baseClone.occur = null; 46466 } 46467 this._bindValue(formNode, matches[0], picture); 46468 this._setProperties(formNode, matches[0]); 46469 this._bindItems(formNode, matches[0]); 46470 if (matches.length === 1) { 46471 return; 46472 } 46473 const parent = formNode[_symbol_utils.$getParent](); 46474 const name = formNode[_symbol_utils.$nodeName]; 46475 const pos = parent[_symbol_utils.$indexOf](formNode); 46476 for (let i = 1, ii = matches.length; i < ii; i++) { 46477 const match = matches[i]; 46478 const clone = baseClone[_symbol_utils.$clone](); 46479 parent[name].push(clone); 46480 parent[_symbol_utils.$insertAt](pos + i, clone); 46481 this._bindValue(clone, match, picture); 46482 this._setProperties(clone, match); 46483 this._bindItems(clone, match); 46484 } 46485 } 46486 _createOccurrences(formNode) { 46487 if (!this.emptyMerge) { 46488 return; 46489 } 46490 const { 46491 occur 46492 } = formNode; 46493 if (!occur || occur.initial <= 1) { 46494 return; 46495 } 46496 const parent = formNode[_symbol_utils.$getParent](); 46497 const name = formNode[_symbol_utils.$nodeName]; 46498 if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) { 46499 return; 46500 }
46501 let currentNumber; 46502 if (formNode.name) { 46503 currentNumber = parent[name].children.filter(e => e.name === formNode.name).length; 46504 } else { 46505 currentNumber = parent[name].children.length; 46506 } 46507 const pos = parent[_symbol_utils.$indexOf](formNode) + 1; 46508 const ii = occur.initial - currentNumber; 46509 if (ii) { 46510 const nodeClone = formNode[_symbol_utils.$clone](); 46511 nodeClone[_symbol_utils.$removeChild](nodeClone.occur); 46512 nodeClone.occur = null; 46513 parent[name].push(nodeClone); 46514 parent[_symbol_utils.$insertAt](pos, nodeClone); 46515 for (let i = 1; i < ii; i++) { 46516 const clone = nodeClone[_symbol_utils.$clone](); 46517 parent[name].push(clone); 46518 parent[_symbol_utils.$insertAt](pos + i, clone); 46519 } 46520 } 46521 } 46522 _getOccurInfo(formNode) { 46523 const { 46524 name, 46525 occur 46526 } = formNode; 46527 if (!occur || !name) { 46528 return [1, 1]; 46529 } 46530 const max = occur.max === -1 ? Infinity : occur.max; 46531 return [occur.min, max]; 46532 } 46533 _setAndBind(formNode, dataNode) { 46534 this._setProperties(formNode, dataNode); 46535 this._bindItems(formNode, dataNode); 46536 this._bindElement(formNode, dataNode); 46537 } 46538 _bindElement(formNode, dataNode) { 46539 const uselessNodes = []; 46540 this._createOccurrences(formNode); 46541 for (const child of formNode[_symbol_utils.$getChildren]()) { 46542 if (child[_symbol_utils.$data]) { 46543 continue; 46544 } 46545 if (this._mergeMode === undefined && child[_symbol_utils.$nodeName] === "subform") { 46546 this._mergeMode = child.mergeMode === "consumeData"; 46547 const dataChildren = dataNode[_symbol_utils.$getChildren](); 46548 if (dataChildren.length > 0) { 46549 this._bindOccurrences(child, [dataChildren[0]], null); 46550 } else if (this.emptyMerge) { 46551 const nsId = dataNode[_symbol_utils.$namespaceId] === NS_DATASETS ? -1 : dataNode[_symbol_utils.$namespaceId]; 46552 const dataChild = child[_symbol_utils.$data] = new _xfa_object.XmlObject(nsId, child.name || "root"); 46553 dataNode[_symbol_utils.$appendChild](dataChild); 46554 this._bindElement(child, dataChild); 46555 } 46556 continue; 46557 } 46558 if (!child[_symbol_utils.$isBindable]()) { 46559 continue; 46560 } 46561 let global = false; 46562 let picture = null; 46563 let ref = null; 46564 let match = null; 46565 if (child.bind) { 46566 switch (child.bind.match) { 46567 case "none": 46568 this._setAndBind(child, dataNode); 46569 continue; 46570 case "global": 46571 global = true; 46572 break; 46573 case "dataRef": 46574 if (!child.bind.ref) { 46575 (0, _util.warn)(`XFA - ref is empty in node ${child[_symbol_utils.$nodeName]}.`); 46576 this._setAndBind(child, dataNode); 46577 continue; 46578 } 46579 ref = child.bind.ref; 46580 break; 46581 default: 46582 break; 46583 } 46584 if (child.bind.picture) { 46585 picture = child.bind.picture[_symbol_utils.$content]; 46586 } 46587 } 46588 const [min, max] = this._getOccurInfo(child); 46589 if (ref) { 46590 match = (0, _som.searchNode)(this.root, dataNode, ref, true, false); 46591 if (match === null) { 46592 match = (0, _som.createDataNode)(this.data, dataNode, ref); 46593 if (!match) { 46594 continue; 46595 } 46596 if (this._isConsumeData()) { 46597 match[_symbol_utils.$consumed] = true; 46598 } 46599 this._setAndBind(child, match); 46600 continue; 46601 } else { 46602 if (this._isConsumeData()) { 46603 match = match.filter(node => !node[_symbol_utils.$consumed]); 46604 } 46605 if (match.length > max) { 46606 match = match.slice(0, max); 46607 } else if (match.length === 0) { 46608 match = null; 46609 } 46610 if (match && this._isConsumeData()) { 46611 match.forEach(node => { 46612 node[_symbol_utils.$consumed] = true; 46613 }); 46614 } 46615 } 46616 } else { 46617 if (!child.name) { 46618 this._setAndBind(child, dataNode); 46619 continue; 46620 } 46621 if (this._isConsumeData()) { 46622 const matches = []; 46623 while (matches.length < max) { 46624 const found = this._findDataByNameToConsume(child.name, child[_symbol_utils.$hasSettableValue](), dataNode, global); 46625 if (!found) { 46626 break; 46627 } 46628 found[_symbol_utils.$consumed] = true; 46629 matches.push(found); 46630 } 46631 match = matches.length > 0 ? matches : null; 46632 } else { 46633 match = dataNode[_symbol_utils.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value; 46634 if (!match) { 46635 if (min === 0) { 46636 uselessNodes.push(child); 46637 continue; 46638 } 46639 const nsId = dataNode[_symbol_utils.$namespaceId] === NS_DATASETS ? -1 : dataNode[_symbol_utils.$namespaceId]; 46640 match = child[_symbol_utils.$data] = new _xfa_object.XmlObject(nsId, child.name); 46641 if (this.emptyMerge) { 46642 match[_symbol_utils.$consumed] = true; 46643 } 46644 dataNode[_symbol_utils.$appendChild](match); 46645 this._setAndBind(child, match); 46646 continue; 46647 } 46648 if (this.emptyMerge) { 46649 match[_symbol_utils.$consumed] = true; 46650 } 46651 match = [match]; 46652 } 46653 } 46654 if (match) { 46655 this._bindOccurrences(child, match, picture); 46656 } else if (min > 0) { 46657 this._setAndBind(child, dataNode); 46658 } else { 46659 uselessNodes.push(child); 46660 } 46661 }
46662 uselessNodes.forEach(node => node[_symbol_utils.$getParent]()[_symbol_utils.$removeChild](node)); 46663 } 46664} 46665exports.Binder = Binder; 46666 46667/***/ }), 46668/* 80 */ 46669/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 46670 46671 46672 46673Object.defineProperty(exports, "__esModule", ({ 46674 value: true 46675})); 46676exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0; 46677var _symbol_utils = __w_pdfjs_require__(78); 46678var _namespaces = __w_pdfjs_require__(81); 46679var _layout = __w_pdfjs_require__(82); 46680var _html_utils = __w_pdfjs_require__(83); 46681var _xfa_object = __w_pdfjs_require__(87); 46682var _utils = __w_pdfjs_require__(84); 46683var _util = __w_pdfjs_require__(2); 46684var _fonts = __w_pdfjs_require__(85); 46685var _core_utils = __w_pdfjs_require__(3); 46686var _som = __w_pdfjs_require__(88); 46687const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id; 46688const SVG_NS = "http://www.w3.org/2000/svg"; 46689const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2; 46690const MAX_EMPTY_PAGES = 3; 46691const DEFAULT_TAB_INDEX = 5000; 46692const HEADING_PATTERN = /^H(\d+)$/;
46693const 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"]); 46694const 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"]]; 46695function getBorderDims(node) { 46696 if (!node || !node.border) { 46697 return { 46698 w: 0, 46699 h: 0 46700 }; 46701 } 46702 const borderExtra = node.border[_symbol_utils.$getExtra](); 46703 if (!borderExtra) { 46704 return { 46705 w: 0, 46706 h: 0 46707 }; 46708 } 46709 return { 46710 w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2], 46711 h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3] 46712 }; 46713} 46714function hasMargin(node) { 46715 return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset); 46716} 46717function _setValue(templateNode, value) { 46718 if (!templateNode.value) { 46719 const nodeValue = new Value({}); 46720 templateNode[_symbol_utils.$appendChild](nodeValue); 46721 templateNode.value = nodeValue; 46722 } 46723 templateNode.value[_symbol_utils.$setValue](value); 46724} 46725function* getContainedChildren(node) { 46726 for (const child of node[_symbol_utils.$getChildren]()) { 46727 if (child instanceof SubformSet) { 46728 yield* child[_symbol_utils.$getContainedChildren](); 46729 continue; 46730 } 46731 yield child; 46732 } 46733} 46734function isRequired(node) { 46735 return node.validate?.nullTest === "error"; 46736} 46737function setTabIndex(node) { 46738 while (node) { 46739 if (!node.traversal) { 46740 node[_symbol_utils.$tabIndex] = node[_symbol_utils.$getParent]()[_symbol_utils.$tabIndex]; 46741 return; 46742 } 46743 if (node[_symbol_utils.$tabIndex]) { 46744 return; 46745 } 46746 let next = null; 46747 for (const child of node.traversal[_symbol_utils.$getChildren]()) { 46748 if (child.operation === "next") { 46749 next = child; 46750 break; 46751 } 46752 } 46753 if (!next || !next.ref) { 46754 node[_symbol_utils.$tabIndex] = node[_symbol_utils.$getParent]()[_symbol_utils.$tabIndex]; 46755 return; 46756 } 46757 const root = node[_symbol_utils.$getTemplateRoot](); 46758 node[_symbol_utils.$tabIndex] = ++root[_symbol_utils.$tabIndex]; 46759 const ref = root[_symbol_utils.$searchNode](next.ref, node); 46760 if (!ref) { 46761 return; 46762 } 46763 node = ref[0]; 46764 } 46765} 46766function applyAssist(obj, attributes) { 46767 const assist = obj.assist; 46768 if (assist) { 46769 const assistTitle = assist[_symbol_utils.$toHTML](); 46770 if (assistTitle) { 46771 attributes.title = assistTitle; 46772 } 46773 const role = assist.role; 46774 const match = role.match(HEADING_PATTERN); 46775 if (match) { 46776 const ariaRole = "heading"; 46777 const ariaLevel = match[1]; 46778 attributes.role = ariaRole; 46779 attributes["aria-level"] = ariaLevel; 46780 } 46781 } 46782 if (obj.layout === "table") { 46783 attributes.role = "table"; 46784 } else if (obj.layout === "row") { 46785 attributes.role = "row"; 46786 } else { 46787 const parent = obj[_symbol_utils.$getParent](); 46788 if (parent.layout === "row") { 46789 attributes.role = parent.assist?.role === "TH" ? "columnheader" : "cell"; 46790 } 46791 } 46792} 46793function ariaLabel(obj) { 46794 if (!obj.assist) { 46795 return null; 46796 } 46797 const assist = obj.assist; 46798 if (assist.speak && assist.speak[_symbol_utils.$content] !== "") { 46799 return assist.speak[_symbol_utils.$content]; 46800 } 46801 if (assist.toolTip) { 46802 return assist.toolTip[_symbol_utils.$content]; 46803 } 46804 return null; 46805} 46806function valueToHtml(value) { 46807 return _utils.HTMLResult.success({ 46808 name: "div", 46809 attributes: { 46810 class: ["xfaRich"], 46811 style: Object.create(null) 46812 }, 46813 children: [{ 46814 name: "span", 46815 attributes: { 46816 style: Object.create(null) 46817 }, 46818 value 46819 }] 46820 }); 46821} 46822function setFirstUnsplittable(node) { 46823 const root = node[_symbol_utils.$getTemplateRoot](); 46824 if (root[_symbol_utils.$extra].firstUnsplittable === null) { 46825 root[_symbol_utils.$extra].firstUnsplittable = node; 46826 root[_symbol_utils.$extra].noLayoutFailure = true; 46827 } 46828} 46829function unsetFirstUnsplittable(node) { 46830 const root = node[_symbol_utils.$getTemplateRoot](); 46831 if (root[_symbol_utils.$extra].firstUnsplittable === node) { 46832 root[_symbol_utils.$extra].noLayoutFailure = false;
46833 } 46834} 46835function handleBreak(node) { 46836 if (node[_symbol_utils.$extra]) { 46837 return false; 46838 } 46839 node[_symbol_utils.$extra] = Object.create(null); 46840 if (node.targetType === "auto") { 46841 return false; 46842 } 46843 const root = node[_symbol_utils.$getTemplateRoot](); 46844 let target = null; 46845 if (node.target) { 46846 target = root[_symbol_utils.$searchNode](node.target, node[_symbol_utils.$getParent]()); 46847 if (!target) { 46848 return false; 46849 } 46850 target = target[0]; 46851 } 46852 const { 46853 currentPageArea, 46854 currentContentArea 46855 } = root[_symbol_utils.$extra]; 46856 if (node.targetType === "pageArea") { 46857 if (!(target instanceof PageArea)) { 46858 target = null; 46859 } 46860 if (node.startNew) { 46861 node[_symbol_utils.$extra].target = target || currentPageArea; 46862 return true; 46863 } else if (target && target !== currentPageArea) { 46864 node[_symbol_utils.$extra].target = target; 46865 return true; 46866 } 46867 return false; 46868 } 46869 if (!(target instanceof ContentArea)) { 46870 target = null; 46871 } 46872 const pageArea = target && target[_symbol_utils.$getParent](); 46873 let index; 46874 let nextPageArea = pageArea; 46875 if (node.startNew) { 46876 if (target) { 46877 const contentAreas = pageArea.contentArea.children; 46878 const indexForCurrent = contentAreas.indexOf(currentContentArea); 46879 const indexForTarget = contentAreas.indexOf(target); 46880 if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) { 46881 nextPageArea = null; 46882 } 46883 index = indexForTarget - 1; 46884 } else { 46885 index = currentPageArea.contentArea.children.indexOf(currentContentArea); 46886 } 46887 } else if (target && target !== currentContentArea) { 46888 const contentAreas = pageArea.contentArea.children; 46889 index = contentAreas.indexOf(target) - 1; 46890 nextPageArea = pageArea === currentPageArea ? null : pageArea; 46891 } else { 46892 return false; 46893 } 46894 node[_symbol_utils.$extra].target = nextPageArea; 46895 node[_symbol_utils.$extra].index = index; 46896 return true; 46897} 46898function handleOverflow(node, extraNode, space) { 46899 const root = node[_symbol_utils.$getTemplateRoot](); 46900 const saved = root[_symbol_utils.$extra].noLayoutFailure; 46901 const savedMethod = extraNode[_symbol_utils.$getSubformParent]; 46902 extraNode[_symbol_utils.$getSubformParent] = () => node; 46903 root[_symbol_utils.$extra].noLayoutFailure = true; 46904 const res = extraNode[_symbol_utils.$toHTML](space); 46905 node[_symbol_utils.$addHTML](res.html, res.bbox); 46906 root[_symbol_utils.$extra].noLayoutFailure = saved; 46907 extraNode[_symbol_utils.$getSubformParent] = savedMethod; 46908} 46909class AppearanceFilter extends _xfa_object.StringObject { 46910 constructor(attributes) { 46911 super(TEMPLATE_NS_ID, "appearanceFilter"); 46912 this.id = attributes.id || ""; 46913 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 46914 this.use = attributes.use || ""; 46915 this.usehref = attributes.usehref || ""; 46916 } 46917} 46918class Arc extends _xfa_object.XFAObject { 46919 constructor(attributes) { 46920 super(TEMPLATE_NS_ID, "arc", true); 46921 this.circular = (0, _utils.getInteger)({ 46922 data: attributes.circular, 46923 defaultValue: 0, 46924 validate: x => x === 1 46925 }); 46926 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 46927 this.id = attributes.id || ""; 46928 this.startAngle = (0, _utils.getFloat)({ 46929 data: attributes.startAngle, 46930 defaultValue: 0, 46931 validate: x => true 46932 }); 46933 this.sweepAngle = (0, _utils.getFloat)({ 46934 data: attributes.sweepAngle, 46935 defaultValue: 360, 46936 validate: x => true 46937 }); 46938 this.use = attributes.use || ""; 46939 this.usehref = attributes.usehref || ""; 46940 this.edge = null; 46941 this.fill = null; 46942 } 46943 [_symbol_utils.$toHTML]() { 46944 const edge = this.edge || new Edge({}); 46945 const edgeStyle = edge[_symbol_utils.$toStyle](); 46946 const style = Object.create(null); 46947 if (this.fill?.presence === "visible") { 46948 Object.assign(style, this.fill[_symbol_utils.$toStyle]()); 46949 } else { 46950 style.fill = "transparent"; 46951 } 46952 style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0); 46953 style.stroke = edgeStyle.color; 46954 let arc; 46955 const attributes = { 46956 xmlns: SVG_NS, 46957 style: { 46958 width: "100%", 46959 height: "100%", 46960 overflow: "visible" 46961 } 46962 }; 46963 if (this.sweepAngle === 360) { 46964 arc = { 46965 name: "ellipse", 46966 attributes: { 46967 xmlns: SVG_NS, 46968 cx: "50%", 46969 cy: "50%", 46970 rx: "50%", 46971 ry: "50%", 46972 style 46973 } 46974 }; 46975 } else { 46976 const startAngle = this.startAngle * Math.PI / 180; 46977 const sweepAngle = this.sweepAngle * Math.PI / 180; 46978 const largeArc = this.sweepAngle > 180 ? 1 : 0;
46979 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))]; 46980 arc = { 46981 name: "path", 46982 attributes: { 46983 xmlns: SVG_NS, 46984 d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`, 46985 vectorEffect: "non-scaling-stroke", 46986 style 46987 } 46988 }; 46989 Object.assign(attributes, { 46990 viewBox: "0 0 100 100", 46991 preserveAspectRatio: "none" 46992 }); 46993 } 46994 const svg = { 46995 name: "svg", 46996 children: [arc], 46997 attributes 46998 }; 46999 const parent = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent](); 47000 if (hasMargin(parent)) { 47001 return _utils.HTMLResult.success({ 47002 name: "div", 47003 attributes: { 47004 style: { 47005 display: "inline", 47006 width: "100%", 47007 height: "100%" 47008 } 47009 }, 47010 children: [svg] 47011 }); 47012 } 47013 svg.attributes.style.position = "absolute"; 47014 return _utils.HTMLResult.success(svg); 47015 } 47016} 47017class Area extends _xfa_object.XFAObject { 47018 constructor(attributes) { 47019 super(TEMPLATE_NS_ID, "area", true); 47020 this.colSpan = (0, _utils.getInteger)({ 47021 data: attributes.colSpan, 47022 defaultValue: 1, 47023 validate: n => n >= 1 || n === -1 47024 }); 47025 this.id = attributes.id || ""; 47026 this.name = attributes.name || ""; 47027 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 47028 this.use = attributes.use || ""; 47029 this.usehref = attributes.usehref || ""; 47030 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 47031 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 47032 this.desc = null; 47033 this.extras = null; 47034 this.area = new _xfa_object.XFAObjectArray(); 47035 this.draw = new _xfa_object.XFAObjectArray(); 47036 this.exObject = new _xfa_object.XFAObjectArray(); 47037 this.exclGroup = new _xfa_object.XFAObjectArray(); 47038 this.field = new _xfa_object.XFAObjectArray(); 47039 this.subform = new _xfa_object.XFAObjectArray(); 47040 this.subformSet = new _xfa_object.XFAObjectArray(); 47041 } 47042 *[_symbol_utils.$getContainedChildren]() { 47043 yield* getContainedChildren(this); 47044 } 47045 [_symbol_utils.$isTransparent]() { 47046 return true; 47047 } 47048 [_symbol_utils.$isBindable]() { 47049 return true; 47050 } 47051 [_symbol_utils.$addHTML](html, bbox) { 47052 const [x, y, w, h] = bbox; 47053 this[_symbol_utils.$extra].width = Math.max(this[_symbol_utils.$extra].width, x + w); 47054 this[_symbol_utils.$extra].height = Math.max(this[_symbol_utils.$extra].height, y + h); 47055 this[_symbol_utils.$extra].children.push(html); 47056 } 47057 [_symbol_utils.$getAvailableSpace]() { 47058 return this[_symbol_utils.$extra].availableSpace; 47059 } 47060 [_symbol_utils.$toHTML](availableSpace) { 47061 const style = (0, _html_utils.toStyle)(this, "position"); 47062 const attributes = { 47063 style, 47064 id: this[_symbol_utils.$uid], 47065 class: ["xfaArea"] 47066 }; 47067 if ((0, _html_utils.isPrintOnly)(this)) { 47068 attributes.class.push("xfaPrintOnly"); 47069 } 47070 if (this.name) { 47071 attributes.xfaName = this.name; 47072 } 47073 const children = []; 47074 this[_symbol_utils.$extra] = { 47075 children, 47076 width: 0, 47077 height: 0, 47078 availableSpace 47079 }; 47080 const result = this[_symbol_utils.$childrenToHTML]({ 47081 filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]), 47082 include: true 47083 }); 47084 if (!result.success) { 47085 if (result.isBreak()) { 47086 return result; 47087 } 47088 delete this[_symbol_utils.$extra]; 47089 return _utils.HTMLResult.FAILURE; 47090 } 47091 style.width = (0, _html_utils.measureToString)(this[_symbol_utils.$extra].width); 47092 style.height = (0, _html_utils.measureToString)(this[_symbol_utils.$extra].height); 47093 const html = { 47094 name: "div", 47095 attributes, 47096 children 47097 }; 47098 const bbox = [this.x, this.y, this[_symbol_utils.$extra].width, this[_symbol_utils.$extra].height]; 47099 delete this[_symbol_utils.$extra]; 47100 return _utils.HTMLResult.success(html, bbox); 47101 } 47102} 47103class Assist extends _xfa_object.XFAObject { 47104 constructor(attributes) { 47105 super(TEMPLATE_NS_ID, "assist", true); 47106 this.id = attributes.id || ""; 47107 this.role = attributes.role || ""; 47108 this.use = attributes.use || ""; 47109 this.usehref = attributes.usehref || ""; 47110 this.speak = null; 47111 this.toolTip = null; 47112 } 47113 [_symbol_utils.$toHTML]() { 47114 return this.toolTip?.[_symbol_utils.$content] || null; 47115 } 47116} 47117class Barcode extends _xfa_object.XFAObject { 47118 constructor(attributes) { 47119 super(TEMPLATE_NS_ID, "barcode", true); 47120 this.charEncoding = (0, _utils.getKeyword)({ 47121 data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "", 47122 defaultValue: "", 47123 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}/) 47124 }); 47125 this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]); 47126 this.dataColumnCount = (0, _utils.getInteger)({ 47127 data: attributes.dataColumnCount, 47128 defaultValue: -1, 47129 validate: x => x >= 0 47130 }); 47131 this.dataLength = (0, _utils.getInteger)({ 47132 data: attributes.dataLength, 47133 defaultValue: -1, 47134 validate: x => x >= 0 47135 }); 47136 this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]); 47137 this.dataRowCount = (0, _utils.getInteger)({ 47138 data: attributes.dataRowCount, 47139 defaultValue: -1, 47140 validate: x => x >= 0 47141 }); 47142 this.endChar = attributes.endChar || ""; 47143 this.errorCorrectionLevel = (0, _utils.getInteger)({ 47144 data: attributes.errorCorrectionLevel, 47145 defaultValue: -1, 47146 validate: x => x >= 0 && x <= 8 47147 }); 47148 this.id = attributes.id || ""; 47149 this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm"); 47150 this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm"); 47151 this.printCheckDigit = (0, _utils.getInteger)({ 47152 data: attributes.printCheckDigit, 47153 defaultValue: 0, 47154 validate: x => x === 1 47155 }); 47156 this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio); 47157 this.startChar = attributes.startChar || ""; 47158 this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]); 47159 this.truncate = (0, _utils.getInteger)({ 47160 data: attributes.truncate, 47161 defaultValue: 0, 47162 validate: x => x === 1 47163 }); 47164 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
47164scust2", "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"]); 47165 this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]); 47166 this.use = attributes.use || ""; 47167 this.usehref = attributes.usehref || ""; 47168 this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio); 47169 this.encrypt = null; 47170 this.extras = null; 47171 } 47172} 47173class Bind extends _xfa_object.XFAObject { 47174 constructor(attributes) { 47175 super(TEMPLATE_NS_ID, "bind", true); 47176 this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]); 47177 this.ref = attributes.ref || ""; 47178 this.picture = null; 47179 } 47180} 47181class BindItems extends _xfa_object.XFAObject { 47182 constructor(attributes) { 47183 super(TEMPLATE_NS_ID, "bindItems"); 47184 this.connection = attributes.connection || ""; 47185 this.labelRef = attributes.labelRef || ""; 47186 this.ref = attributes.ref || ""; 47187 this.valueRef = attributes.valueRef || ""; 47188 } 47189} 47190exports.BindItems = BindItems; 47191class Bookend extends _xfa_object.XFAObject { 47192 constructor(attributes) { 47193 super(TEMPLATE_NS_ID, "bookend"); 47194 this.id = attributes.id || ""; 47195 this.leader = attributes.leader || ""; 47196 this.trailer = attributes.trailer || ""; 47197 this.use = attributes.use || ""; 47198 this.usehref = attributes.usehref || ""; 47199 } 47200} 47201class BooleanElement extends _xfa_object.Option01 { 47202 constructor(attributes) { 47203 super(TEMPLATE_NS_ID, "boolean"); 47204 this.id = attributes.id || ""; 47205 this.name = attributes.name || ""; 47206 this.use = attributes.use || ""; 47207 this.usehref = attributes.usehref || ""; 47208 } 47209 [_symbol_utils.$toHTML](availableSpace) { 47210 return valueToHtml(this[_symbol_utils.$content] === 1 ? "1" : "0"); 47211 } 47212} 47213class Border extends _xfa_object.XFAObject { 47214 constructor(attributes) { 47215 super(TEMPLATE_NS_ID, "border", true); 47216 this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]); 47217 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 47218 this.id = attributes.id || ""; 47219 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 47220 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 47221 this.use = attributes.use || ""; 47222 this.usehref = attributes.usehref || ""; 47223 this.corner = new _xfa_object.XFAObjectArray(4); 47224 this.edge = new _xfa_object.XFAObjectArray(4); 47225 this.extras = null; 47226 this.fill = null; 47227 this.margin = null; 47228 } 47229 [_symbol_utils.$getExtra]() { 47230 if (!this[_symbol_utils.$extra]) { 47231 const edges = this.edge.children.slice(); 47232 if (edges.length < 4) { 47233 const defaultEdge = edges.at(-1) || new Edge({}); 47234 for (let i = edges.length; i < 4; i++) { 47235 edges.push(defaultEdge); 47236 } 47237 } 47238 const widths = edges.map(edge => edge.thickness); 47239 const insets = [0, 0, 0, 0]; 47240 if (this.margin) { 47241 insets[0] = this.margin.topInset; 47242 insets[1] = this.margin.rightInset; 47243 insets[2] = this.margin.bottomInset; 47244 insets[3] = this.margin.leftInset; 47245 } 47246 this[_symbol_utils.$extra] = { 47247 widths, 47248 insets, 47249 edges 47250 }; 47251 } 47252 return this[_symbol_utils.$extra]; 47253 } 47254 [_symbol_utils.$toStyle]() { 47255 const { 47256 edges 47257 } = this[_symbol_utils.$getExtra](); 47258 const edgeStyles = edges.map(node => { 47259 const style = node[_symbol_utils.$toStyle](); 47260 style.color ||= "#000000"; 47261 return style; 47262 }); 47263 const style = Object.create(null); 47264 if (this.margin) { 47265 Object.assign(style, this.margin[_symbol_utils.$toStyle]()); 47266 } 47267 if (this.fill?.presence === "visible") { 47268 Object.assign(style, this.fill[_symbol_utils.$toStyle]()); 47269 } 47270 if (this.corner.children.some(node =>
47270 node.radius !== 0)) { 47271 const cornerStyles = this.corner.children.map(node => node[_symbol_utils.$toStyle]()); 47272 if (cornerStyles.length === 2 || cornerStyles.length === 3) { 47273 const last = cornerStyles.at(-1); 47274 for (let i = cornerStyles.length; i < 4; i++) { 47275 cornerStyles.push(last); 47276 } 47277 } 47278 style.borderRadius = cornerStyles.map(s => s.radius).join(" "); 47279 } 47280 switch (this.presence) { 47281 case "invisible": 47282 case "hidden": 47283 style.borderStyle = ""; 47284 break; 47285 case "inactive": 47286 style.borderStyle = "none"; 47287 break; 47288 default: 47289 style.borderStyle = edgeStyles.map(s => s.style).join(" "); 47290 break; 47291 } 47292 style.borderWidth = edgeStyles.map(s => s.width).join(" "); 47293 style.borderColor = edgeStyles.map(s => s.color).join(" "); 47294 return style; 47295 } 47296} 47297class Break extends _xfa_object.XFAObject { 47298 constructor(attributes) { 47299 super(TEMPLATE_NS_ID, "break", true); 47300 this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); 47301 this.afterTarget = attributes.afterTarget || ""; 47302 this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); 47303 this.beforeTarget = attributes.beforeTarget || ""; 47304 this.bookendLeader = attributes.bookendLeader || ""; 47305 this.bookendTrailer = attributes.bookendTrailer || ""; 47306 this.id = attributes.id || ""; 47307 this.overflowLeader = attributes.overflowLeader || ""; 47308 this.overflowTarget = attributes.overflowTarget || ""; 47309 this.overflowTrailer = attributes.overflowTrailer || ""; 47310 this.startNew = (0, _utils.getInteger)({ 47311 data: attributes.startNew, 47312 defaultValue: 0, 47313 validate: x => x === 1 47314 }); 47315 this.use = attributes.use || ""; 47316 this.usehref = attributes.usehref || ""; 47317 this.extras = null; 47318 } 47319} 47320class BreakAfter extends _xfa_object.XFAObject { 47321 constructor(attributes) { 47322 super(TEMPLATE_NS_ID, "breakAfter", true); 47323 this.id = attributes.id || ""; 47324 this.leader = attributes.leader || ""; 47325 this.startNew = (0, _utils.getInteger)({ 47326 data: attributes.startNew, 47327 defaultValue: 0, 47328 validate: x => x === 1 47329 }); 47330 this.target = attributes.target || ""; 47331 this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]); 47332 this.trailer = attributes.trailer || ""; 47333 this.use = attributes.use || ""; 47334 this.usehref = attributes.usehref || ""; 47335 this.script = null; 47336 } 47337} 47338class BreakBefore extends _xfa_object.XFAObject { 47339 constructor(attributes) { 47340 super(TEMPLATE_NS_ID, "breakBefore", true); 47341 this.id = attributes.id || ""; 47342 this.leader = attributes.leader || ""; 47343 this.startNew = (0, _utils.getInteger)({ 47344 data: attributes.startNew, 47345 defaultValue: 0, 47346 validate: x => x === 1 47347 }); 47348 this.target = attributes.target || ""; 47349 this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]); 47350 this.trailer = attributes.trailer || ""; 47351 this.use = attributes.use || ""; 47352 this.usehref = attributes.usehref || ""; 47353 this.script = null; 47354 } 47355 [_symbol_utils.$toHTML](availableSpace) { 47356 this[_symbol_utils.$extra] = {}; 47357 return _utils.HTMLResult.FAILURE; 47358 } 47359} 47360class Button extends _xfa_object.XFAObject { 47361 constructor(attributes) { 47362 super(TEMPLATE_NS_ID, "button", true); 47363 this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]); 47364 this.id = attributes.id || ""; 47365 this.use = attributes.use || ""; 47366 this.usehref = attributes.usehref || ""; 47367 this.extras = null; 47368 } 47369 [_symbol_utils.$toHTML](availableSpace) { 47370 const parent = this[_symbol_utils.$getParent](); 47371 const grandpa = parent[_symbol_utils.$getParent](); 47372 const htmlButton = { 47373 name: "button", 47374 attributes: { 47375 id: this[_symbol_utils.$uid], 47376 class: ["xfaButton"], 47377 style: {} 47378 }, 47379 children: [] 47380 }; 47381 for (const event of grandpa.event.children) { 47382 if (event.activity !== "click" || !event.script) { 47383 continue; 47384 } 47385 const jsURL = (0, _core_utils.recoverJsURL)(event.script[_symbol_utils.$content]); 47386 if (!jsURL) { 47387 continue; 47388 } 47389 const href = (0, _html_utils.fixURL)(jsURL.url); 47390 if (!href) { 47391 continue; 47392 } 47393 htmlButton.children.push({ 47394 name: "a", 47395 attributes: { 47396 id: "link" + this[_symbol_utils.$uid], 47397 href, 47398 newWindow: jsURL.newWindow, 47399 class: ["xfaLink"], 47400 style: {} 47401 }, 47402 children: [] 47403 }); 47404 } 47405 return _utils.HTMLResult.success(htmlButton); 47406 } 47407} 47408class Calculate extends _xfa_object.XFAObject { 47409 constructor(attributes) { 47410 super(TEMPLATE_NS_ID, "calculate", true); 47411 this.id = attributes.id || ""; 47412 this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]); 47413 this.use = attributes.use || ""; 47414 this.usehref = attributes.usehref || ""; 47415 this.extras = null; 47416 this.message = null; 47417 this.script = null; 47418 } 47419} 47420class Caption extends _xfa_object.XFAObject { 47421 constructor(attributes) { 47422 super(TEMPLATE_NS_ID, "caption", true); 47423 this.id = attributes.id || ""; 47424 this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]); 47425 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
47426 this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve)); 47427 this.use = attributes.use || ""; 47428 this.usehref = attributes.usehref || ""; 47429 this.extras = null; 47430 this.font = null; 47431 this.margin = null; 47432 this.para = null; 47433 this.value = null; 47434 } 47435 [_symbol_utils.$setValue](value) { 47436 _setValue(this, value); 47437 } 47438 [_symbol_utils.$getExtra](availableSpace) { 47439 if (!this[_symbol_utils.$extra]) { 47440 let { 47441 width, 47442 height 47443 } = availableSpace; 47444 switch (this.placement) { 47445 case "left": 47446 case "right": 47447 case "inline": 47448 width = this.reserve <= 0 ? width : this.reserve; 47449 break; 47450 case "top": 47451 case "bottom": 47452 height = this.reserve <= 0 ? height : this.reserve; 47453 break; 47454 } 47455 this[_symbol_utils.$extra] = (0, _html_utils.layoutNode)(this, { 47456 width, 47457 height 47458 }); 47459 } 47460 return this[_symbol_utils.$extra]; 47461 } 47462 [_symbol_utils.$toHTML](availableSpace) { 47463 if (!this.value) { 47464 return _utils.HTMLResult.EMPTY; 47465 } 47466 this[_symbol_utils.$pushPara](); 47467 const value = this.value[_symbol_utils.$toHTML](availableSpace).html; 47468 if (!value) { 47469 this[_symbol_utils.$popPara](); 47470 return _utils.HTMLResult.EMPTY; 47471 } 47472 const savedReserve = this.reserve; 47473 if (this.reserve <= 0) { 47474 const { 47475 w, 47476 h 47477 } = this[_symbol_utils.$getExtra](availableSpace); 47478 switch (this.placement) { 47479 case "left": 47480 case "right": 47481 case "inline": 47482 this.reserve = w; 47483 break; 47484 case "top": 47485 case "bottom": 47486 this.reserve = h; 47487 break; 47488 } 47489 } 47490 const children = []; 47491 if (typeof value === "string") { 47492 children.push({ 47493 name: "#text", 47494 value 47495 }); 47496 } else { 47497 children.push(value); 47498 } 47499 const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility"); 47500 switch (this.placement) { 47501 case "left": 47502 case "right": 47503 if (this.reserve > 0) { 47504 style.width = (0, _html_utils.measureToString)(this.reserve); 47505 } 47506 break; 47507 case "top": 47508 case "bottom": 47509 if (this.reserve > 0) { 47510 style.height = (0, _html_utils.measureToString)(this.reserve); 47511 } 47512 break; 47513 } 47514 (0, _html_utils.setPara)(this, null, value); 47515 this[_symbol_utils.$popPara](); 47516 this.reserve = savedReserve; 47517 return _utils.HTMLResult.success({ 47518 name: "div", 47519 attributes: { 47520 style, 47521 class: ["xfaCaption"] 47522 }, 47523 children 47524 }); 47525 } 47526} 47527class Certificate extends _xfa_object.StringObject { 47528 constructor(attributes) { 47529 super(TEMPLATE_NS_ID, "certificate"); 47530 this.id = attributes.id || ""; 47531 this.name = attributes.name || ""; 47532 this.use = attributes.use || ""; 47533 this.usehref = attributes.usehref || ""; 47534 } 47535} 47536class Certificates extends _xfa_object.XFAObject { 47537 constructor(attributes) { 47538 super(TEMPLATE_NS_ID, "certificates", true); 47539 this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]); 47540 this.id = attributes.id || ""; 47541 this.url = attributes.url || ""; 47542 this.urlPolicy = attributes.urlPolicy || ""; 47543 this.use = attributes.use || ""; 47544 this.usehref = attributes.usehref || ""; 47545 this.encryption = null; 47546 this.issuers = null; 47547 this.keyUsage = null; 47548 this.oids = null; 47549 this.signing = null; 47550 this.subjectDNs = null; 47551 } 47552} 47553class CheckButton extends _xfa_object.XFAObject { 47554 constructor(attributes) { 47555 super(TEMPLATE_NS_ID, "checkButton", true); 47556 this.id = attributes.id || ""; 47557 this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]); 47558 this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]); 47559 this.size = (0, _utils.getMeasurement)(attributes.size, "10pt"); 47560 this.use = attributes.use || ""; 47561 this.usehref = attributes.usehref || ""; 47562 this.border = null; 47563 this.extras = null; 47564 this.margin = null; 47565 } 47566 [_symbol_utils.$toHTML](availableSpace) { 47567 const style = (0, _html_utils.toStyle)("margin"); 47568 const size = (0, _html_utils.measureToString)(this.size); 47569 style.width = style.height = size; 47570 let type;
47571 let className; 47572 let groupId; 47573 const field = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent](); 47574 const items = field.items.children.length && field.items.children[0][_symbol_utils.$toHTML]().html || []; 47575 const exportedValue = { 47576 on: (items[0] !== undefined ? items[0] : "on").toString(), 47577 off: (items[1] !== undefined ? items[1] : "off").toString() 47578 }; 47579 const value = field.value?.[_symbol_utils.$text]() || "off"; 47580 const checked = value === exportedValue.on || undefined; 47581 const container = field[_symbol_utils.$getSubformParent](); 47582 const fieldId = field[_symbol_utils.$uid]; 47583 let dataId; 47584 if (container instanceof ExclGroup) { 47585 groupId = container[_symbol_utils.$uid]; 47586 type = "radio"; 47587 className = "xfaRadio"; 47588 dataId = container[_symbol_utils.$data]?.[_symbol_utils.$uid] || container[_symbol_utils.$uid]; 47589 } else { 47590 type = "checkbox"; 47591 className = "xfaCheckbox"; 47592 dataId = field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid]; 47593 } 47594 const input = { 47595 name: "input", 47596 attributes: { 47597 class: [className], 47598 style, 47599 fieldId, 47600 dataId, 47601 type, 47602 checked, 47603 xfaOn: exportedValue.on, 47604 xfaOff: exportedValue.off, 47605 "aria-label": ariaLabel(field), 47606 "aria-required": false 47607 } 47608 }; 47609 if (groupId) { 47610 input.attributes.name = groupId; 47611 } 47612 if (isRequired(field)) { 47613 input.attributes["aria-required"] = true; 47614 input.attributes.required = true; 47615 } 47616 return _utils.HTMLResult.success({ 47617 name: "label", 47618 attributes: { 47619 class: ["xfaLabel"] 47620 }, 47621 children: [input] 47622 }); 47623 } 47624} 47625class ChoiceList extends _xfa_object.XFAObject { 47626 constructor(attributes) { 47627 super(TEMPLATE_NS_ID, "choiceList", true); 47628 this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]); 47629 this.id = attributes.id || ""; 47630 this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]); 47631 this.textEntry = (0, _utils.getInteger)({ 47632 data: attributes.textEntry, 47633 defaultValue: 0, 47634 validate: x => x === 1 47635 }); 47636 this.use = attributes.use || ""; 47637 this.usehref = attributes.usehref || ""; 47638 this.border = null; 47639 this.extras = null; 47640 this.margin = null; 47641 } 47642 [_symbol_utils.$toHTML](availableSpace) { 47643 const style = (0, _html_utils.toStyle)(this, "border", "margin"); 47644 const ui = this[_symbol_utils.$getParent](); 47645 const field = ui[_symbol_utils.$getParent](); 47646 const fontSize = field.font?.size || 10; 47647 const optionStyle = { 47648 fontSize: `calc(${fontSize}px * var(--scale-factor))` 47649 }; 47650 const children = []; 47651 if (field.items.children.length > 0) { 47652 const items = field.items; 47653 let displayedIndex = 0; 47654 let saveIndex = 0; 47655 if (items.children.length === 2) { 47656 displayedIndex = items.children[0].save; 47657 saveIndex = 1 - displayedIndex; 47658 } 47659 const displayed = items.children[displayedIndex][_symbol_utils.$toHTML]().html; 47660 const values = items.children[saveIndex][_symbol_utils.$toHTML]().html; 47661 let selected = false; 47662 const value = field.value?.[_symbol_utils.$text]() || ""; 47663 for (let i = 0, ii = displayed.length; i < ii; i++) { 47664 const option = { 47665 name: "option", 47666 attributes: { 47667 value: values[i] || displayed[i], 47668 style: optionStyle 47669 }, 47670 value: displayed[i] 47671 }; 47672 if (values[i] === value) { 47673 option.attributes.selected = selected = true; 47674 } 47675 children.push(option); 47676 } 47677 if (!selected) { 47678 children.splice(0, 0, { 47679 name: "option", 47680 attributes: { 47681 hidden: true, 47682 selected: true 47683 }, 47684 value: " " 47685 }); 47686 } 47687 } 47688 const selectAttributes = { 47689 class: ["xfaSelect"], 47690 fieldId: field[_symbol_utils.$uid], 47691 dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid], 47692 style, 47693 "aria-label": ariaLabel(field), 47694 "aria-required": false 47695 }; 47696 if (isRequired(field)) { 47697 selectAttributes["aria-required"] = true; 47698 selectAttributes.required = true; 47699 } 47700 if (this.open === "multiSelect") { 47701 selectAttributes.multiple = true; 47702 } 47703 return _utils.HTMLResult.success({ 47704 name: "label", 47705 attributes: { 47706 class: ["xfaLabel"] 47707 }, 47708 children: [{ 47709 name: "select", 47710 children, 47711 attributes: selectAttributes 47712 }] 47713 }); 47714 } 47715} 47716class Color extends _xfa_object.XFAObject { 47717 constructor(attributes) { 47718 super(TEMPLATE_NS_ID, "color", true); 47719 this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]); 47720 this.id = attributes.id || ""; 47721 this.use = attributes.use || ""; 47722 this.usehref = attributes.usehref || ""; 47723 this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : ""; 47724 this.extras = null; 47725 } 47726 [_symbol_utils.$hasSettableValue]() { 47727 return false;
47728 } 47729 [_symbol_utils.$toStyle]() { 47730 return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null; 47731 } 47732} 47733class Comb extends _xfa_object.XFAObject { 47734 constructor(attributes) { 47735 super(TEMPLATE_NS_ID, "comb"); 47736 this.id = attributes.id || ""; 47737 this.numberOfCells = (0, _utils.getInteger)({ 47738 data: attributes.numberOfCells, 47739 defaultValue: 0, 47740 validate: x => x >= 0 47741 }); 47742 this.use = attributes.use || ""; 47743 this.usehref = attributes.usehref || ""; 47744 } 47745} 47746class Connect extends _xfa_object.XFAObject { 47747 constructor(attributes) { 47748 super(TEMPLATE_NS_ID, "connect", true); 47749 this.connection = attributes.connection || ""; 47750 this.id = attributes.id || ""; 47751 this.ref = attributes.ref || ""; 47752 this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]); 47753 this.use = attributes.use || ""; 47754 this.usehref = attributes.usehref || ""; 47755 this.picture = null; 47756 } 47757} 47758class ContentArea extends _xfa_object.XFAObject { 47759 constructor(attributes) { 47760 super(TEMPLATE_NS_ID, "contentArea", true); 47761 this.h = (0, _utils.getMeasurement)(attributes.h); 47762 this.id = attributes.id || ""; 47763 this.name = attributes.name || ""; 47764 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 47765 this.use = attributes.use || ""; 47766 this.usehref = attributes.usehref || ""; 47767 this.w = (0, _utils.getMeasurement)(attributes.w); 47768 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 47769 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 47770 this.desc = null; 47771 this.extras = null; 47772 } 47773 [_symbol_utils.$toHTML](availableSpace) { 47774 const left = (0, _html_utils.measureToString)(this.x); 47775 const top = (0, _html_utils.measureToString)(this.y); 47776 const style = { 47777 left, 47778 top, 47779 width: (0, _html_utils.measureToString)(this.w), 47780 height: (0, _html_utils.measureToString)(this.h) 47781 }; 47782 const classNames = ["xfaContentarea"]; 47783 if ((0, _html_utils.isPrintOnly)(this)) { 47784 classNames.push("xfaPrintOnly"); 47785 } 47786 return _utils.HTMLResult.success({ 47787 name: "div", 47788 children: [], 47789 attributes: { 47790 style, 47791 class: classNames, 47792 id: this[_symbol_utils.$uid] 47793 } 47794 }); 47795 } 47796} 47797class Corner extends _xfa_object.XFAObject { 47798 constructor(attributes) { 47799 super(TEMPLATE_NS_ID, "corner", true); 47800 this.id = attributes.id || ""; 47801 this.inverted = (0, _utils.getInteger)({ 47802 data: attributes.inverted, 47803 defaultValue: 0, 47804 validate: x => x === 1 47805 }); 47806 this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]); 47807 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 47808 this.radius = (0, _utils.getMeasurement)(attributes.radius); 47809 this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]); 47810 this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt"); 47811 this.use = attributes.use || ""; 47812 this.usehref = attributes.usehref || ""; 47813 this.color = null; 47814 this.extras = null; 47815 } 47816 [_symbol_utils.$toStyle]() { 47817 const style = (0, _html_utils.toStyle)(this, "visibility"); 47818 style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius); 47819 return style; 47820 } 47821} 47822class DateElement extends _xfa_object.ContentObject { 47823 constructor(attributes) { 47824 super(TEMPLATE_NS_ID, "date"); 47825 this.id = attributes.id || ""; 47826 this.name = attributes.name || ""; 47827 this.use = attributes.use || ""; 47828 this.usehref = attributes.usehref || ""; 47829 } 47830 [_symbol_utils.$finalize]() { 47831 const date = this[_symbol_utils.$content].trim(); 47832 this[_symbol_utils.$content] = date ? new Date(date) : null; 47833 } 47834 [_symbol_utils.$toHTML](availableSpace) { 47835 return valueToHtml(this[_symbol_utils.$content] ? this[_symbol_utils.$content].toString() : ""); 47836 } 47837} 47838class DateTime extends _xfa_object.ContentObject { 47839 constructor(attributes) { 47840 super(TEMPLATE_NS_ID, "dateTime"); 47841 this.id = attributes.id || ""; 47842 this.name = attributes.name || ""; 47843 this.use = attributes.use || ""; 47844 this.usehref = attributes.usehref || ""; 47845 } 47846 [_symbol_utils.$finalize]() { 47847 const date = this[_symbol_utils.$content].trim(); 47848 this[_symbol_utils.$content] = date ? new Date(date) : null; 47849 } 47850 [_symbol_utils.$toHTML](availableSpace) { 47851 return valueToHtml(this[_symbol_utils.$content] ? this[_symbol_utils.$content].toString() : ""); 47852 } 47853} 47854class DateTimeEdit extends _xfa_object.XFAObject { 47855 constructor(attributes) { 47856 super(TEMPLATE_NS_ID, "dateTimeEdit", true); 47857 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 47858 this.id = attributes.id || ""; 47859 this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]); 47860 this.use = attributes.use || ""; 47861 this.usehref = attributes.usehref || ""; 47862 this.border = null; 47863 this.comb = null; 47864 this.extras = null; 47865 this.margin = null; 47866 } 47867 [_symbol_utils.$toHTML](availableSpace) { 47868 const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); 47869 const field = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent](); 47870 const html = { 47871 name: "input", 47872 attributes: { 47873 type: "text", 47874 fieldId: field[_symbol_utils.$uid], 47875 dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid], 47876 class: ["xfaTextfield"], 47877 style, 47878 "aria-label": ariaLabel(field), 47879 "aria-required": false 47880 } 47881 }; 47882 if (isRequired(field)) { 47883 html.attributes["aria-required"] = true; 47884 html.attributes.required = true; 47885 } 47886 return _utils.HTMLResult.success({ 47887 name: "label", 47888 attributes: { 47889 class: ["xfaLabel"] 47890 }, 47891 children: [html] 47892 }); 47893 } 47894} 47895class Decimal extends _xfa_object.ContentObject { 47896 constructor(attributes) { 47897 super(TEMPLATE_NS_ID, "decimal"); 47898 this.fracDigits = (0, _utils.getInteger)({ 47899 data: attributes.fracDigits, 47900 defaultValue: 2, 47901 validate: x => true 47902 }); 47903 this.id = attributes.id || ""; 47904 this.leadDigits = (0, _utils.getInteger)({ 47905 data: attributes.leadDigits, 47906 defaultValue: -1, 47907 validate: x => true 47908 }); 47909 this.name = attributes.name || ""; 47910 this.use = attributes.use || ""; 47911 this.usehref = attributes.usehref || ""; 47912 } 47913 [_symbol_utils.$finalize]() { 47914 const number = parseFloat(this[_symbol_utils.$content].trim()); 47915 this[_symbol_utils.$content] = isNaN(number) ? null : number; 47916 } 47917 [_symbol_utils.$toHTML](availableSpace) { 47918 return valueToHtml(this[_symbol_utils.$content] !== null ? this[_symbol_utils.$content].toString() : ""); 47919 } 47920} 47921class DefaultUi extends _xfa_object.XFAObject { 47922 constructor(attributes) { 47923 super(TEMPLATE_NS_ID, "defaultUi", true); 47924 this.id = attributes.id || ""; 47925 this.use = attributes.use || ""; 47926 this.usehref = attributes.usehref || ""; 47927 this.extras = null; 47928 } 47929} 47930class Desc extends _xfa_object.XFAObject { 47931 constructor(attributes) { 47932 super(TEMPLATE_NS_ID, "desc", true); 47933 this.id = attributes.id || ""; 47934 this.use = attributes.use || ""; 47935 this.usehref = attributes.usehref || ""; 47936 this.boolean = new _xfa_object.XFAObjectArray(); 47937 this.date = new _xfa_object.XFAObjectArray(); 47938 this.dateTime = new _xfa_object.XFAObjectArray(); 47939 this.decimal = new _xfa_object.XFAObjectArray(); 47940 this.exData = new _xfa_object.XFAObjectArray(); 47941 this.float = new _xfa_object.XFAObjectArray(); 47942 this.image = new _xfa_object.XFAObjectArray(); 47943 this.integer = new _xfa_object.XFAObjectArray(); 47944 this.text = new _xfa_object.XFAObjectArray(); 47945 this.time = new _xfa_object.XFAObjectArray(); 47946 } 47947} 47948class DigestMethod extends _xfa_object.OptionObject { 47949 constructor(attributes) { 47950 super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]); 47951 this.id = attributes.id || ""; 47952 this.use = attributes.use || ""; 47953 this.usehref = attributes.usehref || ""; 47954 } 47955} 47956class DigestMethods extends _xfa_object.XFAObject { 47957 constructor(attributes) { 47958 super(TEMPLATE_NS_ID, "digestMethods", true); 47959 this.id = attributes.id || ""; 47960 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 47961 this.use = attributes.use || ""; 47962 this.usehref = attributes.usehref || ""; 47963 this.digestMethod = new _xfa_object.XFAObjectArray(); 47964 } 47965} 47966class Draw extends _xfa_object.XFAObject { 47967 constructor(attributes) { 47968 super(TEMPLATE_NS_ID, "draw", true); 47969 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 47970 this.colSpan = (0, _utils.getInteger)({ 47971 data: attributes.colSpan, 47972 defaultValue: 1, 47973 validate: n => n >= 1 || n === -1 47974 }); 47975 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 47976 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 47977 this.id = attributes.id || ""; 47978 this.locale = attributes.locale || ""; 47979 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 47980 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 47981 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 47982 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 47983 this.name = attributes.name || ""; 47984 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 47985 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 47986 this.rotate = (0, _utils.getInteger)({ 47987 data: attributes.rotate, 47988 defaultValue: 0, 47989 validate: x => x % 90 === 0 47990 }); 47991 this.use = attributes.use || ""; 47992 this.usehref = attributes.usehref || ""; 47993 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 47994 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 47995 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 47996 this.assist = null; 47997 this.border = null; 47998 this.caption = null; 47999 this.desc = null; 48000 this.extras = null; 48001 this.font = null; 48002 this.keep = null; 48003 this.margin = null; 48004 this.para = null; 48005 this.traversal = null; 48006 this.ui = null; 48007 this.value = null; 48008 this.setProperty = new _xfa_object.XFAObjectArray(); 48009 } 48010 [_symbol_utils.$setValue](value) { 48011 _setValue(this, value); 48012 } 48013 [_symbol_utils.$toHTML](availableSpace) { 48014 setTabIndex(this); 48015 if (this.presence === "hidden" || this.presence === "inactive") { 48016 return _utils.HTMLResult.EMPTY; 48017 } 48018 (0, _html_utils.fixDimensions)(this); 48019 this[_symbol_utils.$pushPara](); 48020 const savedW = this.w; 48021 const savedH = this.h; 48022 const { 48023 w, 48024 h, 48025 isBroken 48026 } = (0, _html_utils.layoutNode)(this, availableSpace); 48027 if (w && this.w === "") { 48028 if (isBroken && this[_symbol_utils.$getSubformParent]()[_symbol_utils.$isThereMoreWidth]()) { 48029 this[_symbol_utils.$popPara](); 48030 return _utils.HTMLResult.FAILURE; 48031 } 48032 this.w = w; 48033 } 48034 if (h && this.h === "") { 48035 this.h = h; 48036 } 48037 setFirstUnsplittable(this); 48038 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 48039 this.w = savedW; 48040 this.h = savedH; 48041 this[_symbol_utils.$popPara](); 48042 return _utils.HTMLResult.FAILURE; 48043 } 48044 unsetFirstUnsplittable(this); 48045 const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin"); 48046 (0, _html_utils.setMinMaxDimensions)(this, style); 48047 if (style.margin) { 48048 style.padding = style.margin; 48049 delete style.margin; 48050 } 48051 const classNames = ["xfaDraw"]; 48052 if (this.font) { 48053 classNames.push("xfaFont"); 48054 } 48055 if ((0, _html_utils.isPrintOnly)(this)) { 48056 classNames.push("xfaPrintOnly"); 48057 } 48058 const attributes = { 48059 style, 48060 id: this[_symbol_utils.$uid], 48061 class: classNames 48062 }; 48063 if (this.name) { 48064 attributes.xfaName = this.name; 48065 } 48066 const html = { 48067 name: "div", 48068 attributes, 48069 children: [] 48070 }; 48071 applyAssist(this, attributes); 48072 const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace); 48073 const value = this.value ? this.value[_symbol_utils.$toHTML](availableSpace).html : null; 48074 if (value === null) { 48075 this.w = savedW; 48076 this.h = savedH; 48077 this[_symbol_utils.$popPara](); 48078 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 48079 } 48080 html.children.push(value); 48081 (0, _html_utils.setPara)(this, style, value); 48082 this.w = savedW; 48083 this.h = savedH; 48084 this[_symbol_utils.$popPara](); 48085 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 48086 } 48087} 48088class Edge extends _xfa_object.XFAObject { 48089 constructor(attributes) { 48090 super(TEMPLATE_NS_ID, "edge", true); 48091 this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]); 48092 this.id = attributes.id || ""; 48093 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 48094 this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]); 48095 this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt"); 48096 this.use = attributes.use || ""; 48097 this.usehref = attributes.usehref || ""; 48098 this.color = null; 48099 this.extras = null; 48100 } 48101 [_symbol_utils.$toStyle]() { 48102 const style = (0, _html_utils.toStyle)(this, "visibility");
48103 Object.assign(style, { 48104 linecap: this.cap, 48105 width: (0, _html_utils.measureToString)(this.thickness), 48106 color: this.color ? this.color[_symbol_utils.$toStyle]() : "#000000", 48107 style: "" 48108 }); 48109 if (this.presence !== "visible") { 48110 style.style = "none"; 48111 } else { 48112 switch (this.stroke) { 48113 case "solid": 48114 style.style = "solid"; 48115 break; 48116 case "dashDot": 48117 style.style = "dashed"; 48118 break; 48119 case "dashDotDot": 48120 style.style = "dashed"; 48121 break; 48122 case "dashed": 48123 style.style = "dashed"; 48124 break; 48125 case "dotted": 48126 style.style = "dotted"; 48127 break; 48128 case "embossed": 48129 style.style = "ridge"; 48130 break; 48131 case "etched": 48132 style.style = "groove"; 48133 break; 48134 case "lowered": 48135 style.style = "inset"; 48136 break; 48137 case "raised": 48138 style.style = "outset"; 48139 break; 48140 } 48141 } 48142 return style; 48143 } 48144} 48145class Encoding extends _xfa_object.OptionObject { 48146 constructor(attributes) { 48147 super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]); 48148 this.id = attributes.id || ""; 48149 this.use = attributes.use || ""; 48150 this.usehref = attributes.usehref || ""; 48151 } 48152} 48153class Encodings extends _xfa_object.XFAObject { 48154 constructor(attributes) { 48155 super(TEMPLATE_NS_ID, "encodings", true); 48156 this.id = attributes.id || ""; 48157 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 48158 this.use = attributes.use || ""; 48159 this.usehref = attributes.usehref || ""; 48160 this.encoding = new _xfa_object.XFAObjectArray(); 48161 } 48162} 48163class Encrypt extends _xfa_object.XFAObject { 48164 constructor(attributes) { 48165 super(TEMPLATE_NS_ID, "encrypt", true); 48166 this.id = attributes.id || ""; 48167 this.use = attributes.use || ""; 48168 this.usehref = attributes.usehref || ""; 48169 this.certificate = null; 48170 } 48171} 48172class EncryptData extends _xfa_object.XFAObject { 48173 constructor(attributes) { 48174 super(TEMPLATE_NS_ID, "encryptData", true); 48175 this.id = attributes.id || ""; 48176 this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]); 48177 this.target = attributes.target || ""; 48178 this.use = attributes.use || ""; 48179 this.usehref = attributes.usehref || ""; 48180 this.filter = null; 48181 this.manifest = null; 48182 } 48183} 48184class Encryption extends _xfa_object.XFAObject { 48185 constructor(attributes) { 48186 super(TEMPLATE_NS_ID, "encryption", true); 48187 this.id = attributes.id || ""; 48188 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 48189 this.use = attributes.use || ""; 48190 this.usehref = attributes.usehref || ""; 48191 this.certificate = new _xfa_object.XFAObjectArray(); 48192 } 48193} 48194class EncryptionMethod extends _xfa_object.OptionObject { 48195 constructor(attributes) { 48196 super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]); 48197 this.id = attributes.id || ""; 48198 this.use = attributes.use || ""; 48199 this.usehref = attributes.usehref || ""; 48200 } 48201} 48202class EncryptionMethods extends _xfa_object.XFAObject { 48203 constructor(attributes) { 48204 super(TEMPLATE_NS_ID, "encryptionMethods", true); 48205 this.id = attributes.id || ""; 48206 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 48207 this.use = attributes.use || ""; 48208 this.usehref = attributes.usehref || ""; 48209 this.encryptionMethod = new _xfa_object.XFAObjectArray(); 48210 } 48211} 48212class Event extends _xfa_object.XFAObject { 48213 constructor(attributes) { 48214 super(TEMPLATE_NS_ID, "event", true); 48215 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"]); 48216 this.id = attributes.id || ""; 48217 this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]); 48218 this.name = attributes.name || ""; 48219 this.ref = attributes.ref || ""; 48220 this.use = attributes.use || ""; 48221 this.usehref = attributes.usehref || ""; 48222 this.extras = null; 48223 this.encryptData = null; 48224 this.execute = null; 48225 this.script = null; 48226 this.signData = null; 48227 this.submit = null; 48228 } 48229} 48230class ExData extends _xfa_object.ContentObject { 48231 constructor(attributes) { 48232 super(TEMPLATE_NS_ID, "exData"); 48233 this.contentType = attributes.contentType || ""; 48234 this.href = attributes.href || ""; 48235 this.id = attributes.id || ""; 48236 this.maxLength = (0, _utils.getInteger)({ 48237 data: attributes.maxLength,
48238 defaultValue: -1, 48239 validate: x => x >= -1 48240 }); 48241 this.name = attributes.name || ""; 48242 this.rid = attributes.rid || ""; 48243 this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]); 48244 this.use = attributes.use || ""; 48245 this.usehref = attributes.usehref || ""; 48246 } 48247 [_symbol_utils.$isCDATAXml]() { 48248 return this.contentType === "text/html"; 48249 } 48250 [_symbol_utils.$onChild](child) { 48251 if (this.contentType === "text/html" && child[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { 48252 this[_symbol_utils.$content] = child; 48253 return true; 48254 } 48255 if (this.contentType === "text/xml") { 48256 this[_symbol_utils.$content] = child; 48257 return true; 48258 } 48259 return false; 48260 } 48261 [_symbol_utils.$toHTML](availableSpace) { 48262 if (this.contentType !== "text/html" || !this[_symbol_utils.$content]) { 48263 return _utils.HTMLResult.EMPTY; 48264 } 48265 return this[_symbol_utils.$content][_symbol_utils.$toHTML](availableSpace); 48266 } 48267} 48268class ExObject extends _xfa_object.XFAObject { 48269 constructor(attributes) { 48270 super(TEMPLATE_NS_ID, "exObject", true); 48271 this.archive = attributes.archive || ""; 48272 this.classId = attributes.classId || ""; 48273 this.codeBase = attributes.codeBase || ""; 48274 this.codeType = attributes.codeType || ""; 48275 this.id = attributes.id || ""; 48276 this.name = attributes.name || ""; 48277 this.use = attributes.use || ""; 48278 this.usehref = attributes.usehref || ""; 48279 this.extras = null; 48280 this.boolean = new _xfa_object.XFAObjectArray(); 48281 this.date = new _xfa_object.XFAObjectArray(); 48282 this.dateTime = new _xfa_object.XFAObjectArray(); 48283 this.decimal = new _xfa_object.XFAObjectArray(); 48284 this.exData = new _xfa_object.XFAObjectArray(); 48285 this.exObject = new _xfa_object.XFAObjectArray(); 48286 this.float = new _xfa_object.XFAObjectArray(); 48287 this.image = new _xfa_object.XFAObjectArray(); 48288 this.integer = new _xfa_object.XFAObjectArray(); 48289 this.text = new _xfa_object.XFAObjectArray(); 48290 this.time = new _xfa_object.XFAObjectArray(); 48291 } 48292} 48293class ExclGroup extends _xfa_object.XFAObject { 48294 constructor(attributes) { 48295 super(TEMPLATE_NS_ID, "exclGroup", true); 48296 this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 48297 this.accessKey = attributes.accessKey || ""; 48298 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 48299 this.colSpan = (0, _utils.getInteger)({ 48300 data: attributes.colSpan, 48301 defaultValue: 1, 48302 validate: n => n >= 1 || n === -1 48303 }); 48304 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 48305 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 48306 this.id = attributes.id || ""; 48307 this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]); 48308 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 48309 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 48310 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 48311 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 48312 this.name = attributes.name || ""; 48313 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 48314 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 48315 this.use = attributes.use || ""; 48316 this.usehref = attributes.usehref || ""; 48317 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 48318 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 48319 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 48320 this.assist = null; 48321 this.bind = null; 48322 this.border = null; 48323 this.calculate = null; 48324 this.caption = null; 48325 this.desc = null; 48326 this.extras = null; 48327 this.margin = null; 48328 this.para = null; 48329 this.traversal = null; 48330 this.validate = null; 48331 this.connect = new _xfa_object.XFAObjectArray(); 48332 this.event = new _xfa_object.XFAObjectArray(); 48333 this.field = new _xfa_object.XFAObjectArray(); 48334 this.setProperty = new _xfa_object.XFAObjectArray(); 48335 } 48336 [_symbol_utils.$isBindable]() { 48337 return true; 48338 } 48339 [_symbol_utils.$hasSettableValue]() { 48340 return true; 48341 } 48342 [_symbol_utils.$setValue](value) { 48343 for (const field of this.field.children) { 48344 if (!field.value) { 48345 const nodeValue = new Value({}); 48346 field[_symbol_utils.$appendChild](nodeValue); 48347 field.value = nodeValue; 48348 } 48349 field.value[_symbol_utils.$setValue](value); 48350 } 48351 } 48352 [_symbol_utils.$isThereMoreWidth]() { 48353 return this.layout.endsWith("-tb") && this[_symbol_utils.$extra].attempt === 0 && this[_symbol_utils.$extra].numberInLine > 0 || this[_symbol_utils.$getParent]()[_symbol_utils.$isThereMoreWidth](); 48354 } 48355 [_symbol_utils.$isSplittable]() { 48356 const parent = this[_symbol_utils.$getSubformParent](); 48357 if (!parent[_symbol_utils.$isSplittable]()) { 48358 return false;
48359 } 48360 if (this[_symbol_utils.$extra]._isSplittable !== undefined) { 48361 return this[_symbol_utils.$extra]._isSplittable; 48362 } 48363 if (this.layout === "position" || this.layout.includes("row")) { 48364 this[_symbol_utils.$extra]._isSplittable = false; 48365 return false; 48366 } 48367 if (parent.layout?.endsWith("-tb") && parent[_symbol_utils.$extra].numberInLine !== 0) { 48368 return false; 48369 } 48370 this[_symbol_utils.$extra]._isSplittable = true; 48371 return true; 48372 } 48373 [_symbol_utils.$flushHTML]() { 48374 return (0, _layout.flushHTML)(this); 48375 } 48376 [_symbol_utils.$addHTML](html, bbox) { 48377 (0, _layout.addHTML)(this, html, bbox); 48378 } 48379 [_symbol_utils.$getAvailableSpace]() { 48380 return (0, _layout.getAvailableSpace)(this); 48381 } 48382 [_symbol_utils.$toHTML](availableSpace) { 48383 setTabIndex(this); 48384 if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { 48385 return _utils.HTMLResult.EMPTY; 48386 } 48387 (0, _html_utils.fixDimensions)(this); 48388 const children = []; 48389 const attributes = { 48390 id: this[_symbol_utils.$uid], 48391 class: [] 48392 }; 48393 (0, _html_utils.setAccess)(this, attributes.class); 48394 if (!this[_symbol_utils.$extra]) { 48395 this[_symbol_utils.$extra] = Object.create(null); 48396 } 48397 Object.assign(this[_symbol_utils.$extra], { 48398 children, 48399 attributes, 48400 attempt: 0, 48401 line: null, 48402 numberInLine: 0, 48403 availableSpace: { 48404 width: Math.min(this.w || Infinity, availableSpace.width), 48405 height: Math.min(this.h || Infinity, availableSpace.height) 48406 }, 48407 width: 0, 48408 height: 0, 48409 prevHeight: 0, 48410 currentWidth: 0 48411 }); 48412 const isSplittable = this[_symbol_utils.$isSplittable](); 48413 if (!isSplittable) { 48414 setFirstUnsplittable(this); 48415 } 48416 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 48417 return _utils.HTMLResult.FAILURE; 48418 } 48419 const filter = new Set(["field"]); 48420 if (this.layout.includes("row")) { 48421 const columnWidths = this[_symbol_utils.$getSubformParent]().columnWidths; 48422 if (Array.isArray(columnWidths) && columnWidths.length > 0) { 48423 this[_symbol_utils.$extra].columnWidths = columnWidths; 48424 this[_symbol_utils.$extra].currentColumn = 0; 48425 } 48426 } 48427 const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); 48428 const classNames = ["xfaExclgroup"]; 48429 const cl = (0, _html_utils.layoutClass)(this); 48430 if (cl) { 48431 classNames.push(cl); 48432 } 48433 if ((0, _html_utils.isPrintOnly)(this)) { 48434 classNames.push("xfaPrintOnly"); 48435 } 48436 attributes.style = style; 48437 attributes.class = classNames; 48438 if (this.name) { 48439 attributes.xfaName = this.name; 48440 } 48441 this[_symbol_utils.$pushPara](); 48442 const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; 48443 const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; 48444 for (; this[_symbol_utils.$extra].attempt < maxRun; this[_symbol_utils.$extra].attempt++) { 48445 if (isLrTb && this[_symbol_utils.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { 48446 this[_symbol_utils.$extra].numberInLine = 0; 48447 } 48448 const result = this[_symbol_utils.$childrenToHTML]({ 48449 filter, 48450 include: true 48451 }); 48452 if (result.success) { 48453 break; 48454 } 48455 if (result.isBreak()) { 48456 this[_symbol_utils.$popPara](); 48457 return result; 48458 } 48459 if (isLrTb && this[_symbol_utils.$extra].attempt === 0 && this[_symbol_utils.$extra].numberInLine === 0 && !this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) { 48460 this[_symbol_utils.$extra].attempt = maxRun; 48461 break; 48462 } 48463 } 48464 this[_symbol_utils.$popPara](); 48465 if (!isSplittable) { 48466 unsetFirstUnsplittable(this); 48467 } 48468 if (this[_symbol_utils.$extra].attempt === maxRun) { 48469 if (!isSplittable) { 48470 delete this[_symbol_utils.$extra]; 48471 } 48472 return _utils.HTMLResult.FAILURE; 48473 } 48474 let marginH = 0; 48475 let marginV = 0; 48476 if (this.margin) { 48477 marginH = this.margin.leftInset + this.margin.rightInset; 48478 marginV = this.margin.topInset + this.margin.bottomInset; 48479 } 48480 const width = Math.max(this[_symbol_utils.$extra].width + marginH, this.w || 0); 48481 const height = Math.max(this[_symbol_utils.$extra].height + marginV, this.h || 0); 48482 const bbox = [this.x, this.y, width, height]; 48483 if (this.w === "") { 48484 style.width = (0, _html_utils.measureToString)(width); 48485 } 48486 if (this.h === "") { 48487 style.height = (0, _html_utils.measureToString)(height); 48488 } 48489 const html = { 48490 name: "div", 48491 attributes, 48492 children 48493 }; 48494 applyAssist(this, attributes); 48495 delete this[_symbol_utils.$extra]; 48496 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 48497 } 48498} 48499class Execute extends _xfa_object.XFAObject { 48500 constructor(attributes) { 48501 super(TEMPLATE_NS_ID, "execute"); 48502 this.connection = attributes.connection || ""; 48503 this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]); 48504 this.id = attributes.id || ""; 48505 this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]); 48506 this.use = attributes.use || ""; 48507 this.usehref = attributes.usehref || ""; 48508 } 48509} 48510class Extras extends _xfa_object.XFAObject { 48511 constructor(attributes) { 48512 super(TEMPLATE_NS_ID, "extras", true); 48513 this.id = attributes.id || ""; 48514 this.name = attributes.name || ""; 48515 this.use = attributes.use || ""; 48516 this.usehref = attributes.usehref || ""; 48517 this.boolean = new _xfa_object.XFAObjectArray(); 48518 this.date = new _xfa_object.XFAObjectArray(); 48519 this.dateTime = new _xfa_object.XFAObjectArray(); 48520 this.decimal = new _xfa_object.XFAObjectArray(); 48521 this.exData = new _xfa_object.XFAObjectArray(); 48522 this.extras = new _xfa_object.XFAObjectArray(); 48523 this.float = new _xfa_object.XFAObjectArray(); 48524 this.image = new _xfa_object.XFAObjectArray(); 48525 this.integer = new _xfa_object.XFAObjectArray(); 48526 this.text = new _xfa_object.XFAObjectArray(); 48527 this.time = new _xfa_object.XFAObjectArray(); 48528 } 48529} 48530class Field extends _xfa_object.XFAObject { 48531 constructor(attributes) { 48532 super(TEMPLATE_NS_ID, "field", true); 48533 this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 48534 this.accessKey = attributes.accessKey || ""; 48535 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 48536 this.colSpan = (0, _utils.getInteger)({ 48537 data: attributes.colSpan, 48538 defaultValue: 1, 48539 validate: n => n >= 1 || n === -1 48540 }); 48541 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 48542 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 48543 this.id = attributes.id || ""; 48544 this.locale = attributes.locale || ""; 48545 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 48546 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 48547 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 48548 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 48549 this.name = attributes.name || ""; 48550 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 48551 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 48552 this.rotate = (0, _utils.getInteger)({ 48553 data: attributes.rotate, 48554 defaultValue: 0, 48555 validate: x => x % 90 === 0 48556 }); 48557 this.use = attributes.use || ""; 48558 this.usehref = attributes.usehref || ""; 48559 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 48560 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 48561 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 48562 this.assist = null; 48563 this.bind = null; 48564 this.border = null; 48565 this.calculate = null; 48566 this.caption = null; 48567 this.desc = null; 48568 this.extras = null; 48569 this.font = null; 48570 this.format = null; 48571 this.items = new _xfa_object.XFAObjectArray(2); 48572 this.keep = null; 48573 this.margin = null; 48574 this.para = null; 48575 this.traversal = null; 48576 this.ui = null; 48577 this.validate = null; 48578 this.value = null; 48579 this.bindItems = new _xfa_object.XFAObjectArray(); 48580 this.connect = new _xfa_object.XFAObjectArray(); 48581 this.event = new _xfa_object.XFAObjectArray(); 48582 this.setProperty = new _xfa_object.XFAObjectArray(); 48583 } 48584 [_symbol_utils.$isBindable]() { 48585 return true; 48586 } 48587 [_symbol_utils.$setValue](value) { 48588 _setValue(this, value); 48589 } 48590 [_symbol_utils.$toHTML](availableSpace) { 48591 setTabIndex(this); 48592 if (!this.ui) { 48593 this.ui = new Ui({}); 48594 this.ui[_symbol_utils.$globalData] = this[_symbol_utils.$globalData]; 48595 this[_symbol_utils.$appendChild](this.ui); 48596 let node; 48597 switch (this.items.children.length) { 48598 case 0: 48599 node = new TextEdit({}); 48600 this.ui.textEdit = node; 48601 break; 48602 case 1: 48603 node = new CheckButton({}); 48604 this.ui.checkButton = node; 48605 break; 48606 case 2: 48607 node = new ChoiceList({}); 48608 this.ui.choiceList = node; 48609 break; 48610 } 48611 this.ui[_symbol_utils.$appendChild](node); 48612 } 48613 if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { 48614 return _utils.HTMLResult.EMPTY; 48615 } 48616 if (this.caption) { 48617 delete this.caption[_symbol_utils.$extra]; 48618 } 48619 this[_symbol_utils.$pushPara](); 48620 const caption = this.caption ? this.caption[_symbol_utils.$toHTML](availableSpace).html : null; 48621 const savedW = this.w; 48622 const savedH = this.h; 48623 let marginH = 0; 48624 let marginV = 0; 48625 if (this.margin) { 48626 marginH = this.margin.leftInset + this.margin.rightInset; 48627 marginV = this.margin.topInset + this.margin.bottomInset; 48628 } 48629 let borderDims = null; 48630 if (this.w === "" || this.h === "") { 48631 let width = null; 48632 let height = null; 48633 let uiW = 0; 48634 let uiH = 0; 48635 if (this.ui.checkButton) { 48636 uiW = uiH = this.ui.checkButton.size; 48637 } else { 48638 const { 48639 w, 48640 h 48641 } = (0, _html_utils.layoutNode)(this, availableSpace); 48642 if (w !== null) { 48643 uiW = w; 48644 uiH = h; 48645 } else { 48646 uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap; 48647 } 48648 } 48649 borderDims = getBorderDims(this.ui[_symbol_utils.$getExtra]()); 48650 uiW += borderDims.w; 48651 uiH += borderDims.h; 48652 if (this.caption) { 48653 const { 48654 w, 48655 h, 48656 isBroken 48657 } = this.caption[_symbol_utils.$getExtra](availableSpace); 48658 if (isBroken && this[_symbol_utils.$getSubformParent]()[_symbol_utils.$isThereMoreWidth]()) { 48659 this[_symbol_utils.$popPara](); 48660 return _utils.HTMLResult.FAILURE; 48661 } 48662 width = w; 48663 height = h; 48664 switch (this.caption.placement) {
48665 case "left": 48666 case "right": 48667 case "inline": 48668 width += uiW; 48669 break; 48670 case "top": 48671 case "bottom": 48672 height += uiH; 48673 break; 48674 } 48675 } else { 48676 width = uiW; 48677 height = uiH; 48678 } 48679 if (width && this.w === "") { 48680 width += marginH; 48681 this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW); 48682 } 48683 if (height && this.h === "") { 48684 height += marginV; 48685 this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH); 48686 } 48687 } 48688 this[_symbol_utils.$popPara](); 48689 (0, _html_utils.fixDimensions)(this); 48690 setFirstUnsplittable(this); 48691 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 48692 this.w = savedW; 48693 this.h = savedH; 48694 this[_symbol_utils.$popPara](); 48695 return _utils.HTMLResult.FAILURE; 48696 } 48697 unsetFirstUnsplittable(this); 48698 const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign"); 48699 (0, _html_utils.setMinMaxDimensions)(this, style); 48700 const classNames = ["xfaField"]; 48701 if (this.font) { 48702 classNames.push("xfaFont"); 48703 } 48704 if ((0, _html_utils.isPrintOnly)(this)) { 48705 classNames.push("xfaPrintOnly"); 48706 } 48707 const attributes = { 48708 style, 48709 id: this[_symbol_utils.$uid], 48710 class: classNames 48711 }; 48712 if (style.margin) { 48713 style.padding = style.margin; 48714 delete style.margin; 48715 } 48716 (0, _html_utils.setAccess)(this, classNames); 48717 if (this.name) { 48718 attributes.xfaName = this.name; 48719 } 48720 const children = []; 48721 const html = { 48722 name: "div", 48723 attributes, 48724 children 48725 }; 48726 applyAssist(this, attributes); 48727 const borderStyle = this.border ? this.border[_symbol_utils.$toStyle]() : null; 48728 const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace); 48729 const ui = this.ui[_symbol_utils.$toHTML]().html; 48730 if (!ui) { 48731 Object.assign(style, borderStyle); 48732 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 48733 } 48734 if (this[_symbol_utils.$tabIndex]) { 48735 if (ui.children?.[0]) { 48736 ui.children[0].attributes.tabindex = this[_symbol_utils.$tabIndex]; 48737 } else { 48738 ui.attributes.tabindex = this[_symbol_utils.$tabIndex]; 48739 } 48740 } 48741 if (!ui.attributes.style) { 48742 ui.attributes.style = Object.create(null); 48743 } 48744 let aElement = null; 48745 if (this.ui.button) { 48746 if (ui.children.length === 1) { 48747 [aElement] = ui.children.splice(0, 1); 48748 } 48749 Object.assign(ui.attributes.style, borderStyle); 48750 } else { 48751 Object.assign(style, borderStyle); 48752 } 48753 children.push(ui); 48754 if (this.value) { 48755 if (this.ui.imageEdit) { 48756 ui.children.push(this.value[_symbol_utils.$toHTML]().html); 48757 } else if (!this.ui.button) { 48758 let value = ""; 48759 if (this.value.exData) { 48760 value = this.value.exData[_symbol_utils.$text](); 48761 } else if (this.value.text) { 48762 value = this.value.text[_symbol_utils.$getExtra](); 48763 } else { 48764 const htmlValue = this.value[_symbol_utils.$toHTML]().html; 48765 if (htmlValue !== null) { 48766 value = htmlValue.children[0].value; 48767 } 48768 } 48769 if (this.ui.textEdit && this.value.text?.maxChars) { 48770 ui.children[0].attributes.maxLength = this.value.text.maxChars; 48771 } 48772 if (value) { 48773 if (this.ui.numericEdit) { 48774 value = parseFloat(value); 48775 value = isNaN(value) ? "" : value.toString(); 48776 } 48777 if (ui.children[0].name === "textarea") { 48778 ui.children[0].attributes.textContent = value; 48779 } else { 48780 ui.children[0].attributes.value = value; 48781 } 48782 } 48783 } 48784 } 48785 if (!this.ui.imageEdit && ui.children?.[0] && this.h) { 48786 borderDims = borderDims || getBorderDims(this.ui[_symbol_utils.$getExtra]()); 48787 let captionHeight = 0; 48788 if (this.caption && ["top", "bottom"].includes(this.caption.placement)) { 48789 captionHeight = this.caption.reserve; 48790 if (captionHeight <= 0) { 48791 captionHeight = this.caption[_symbol_utils.$getExtra](availableSpace).h; 48792 } 48793 const inputHeight = this.h - captionHeight - marginV - borderDims.h; 48794 ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight); 48795 } else { 48796 ui.children[0].attributes.style.height = "100%"; 48797 } 48798 } 48799 if (aElement) { 48800 ui.children.push(aElement); 48801 } 48802 if (!caption) { 48803 if (ui.attributes.class) { 48804 ui.attributes.class.push("xfaLeft"); 48805 } 48806 this.w = savedW; 48807 this.h = savedH; 48808 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 48809 } 48810 if (this.ui.button) { 48811 if (style.padding) { 48812 delete style.padding; 48813 } 48814 if (caption.name === "div") { 48815 caption.name = "span"; 48816 } 48817 ui.children.push(caption); 48818 return _utils.HTMLResult.success(html, bbox); 48819 } else if (this.ui.checkButton) { 48820 caption.attributes.class[0] = "xfaCaptionForCheckButton"; 48821 } 48822 if (!ui.attributes.class) { 48823 ui.attributes.class = []; 48824 } 48825 ui.children.splice(0, 0, caption); 48826 switch (this.caption.placement) {
48827 case "left": 48828 ui.attributes.class.push("xfaLeft"); 48829 break; 48830 case "right": 48831 ui.attributes.class.push("xfaRight"); 48832 break; 48833 case "top": 48834 ui.attributes.class.push("xfaTop"); 48835 break; 48836 case "bottom": 48837 ui.attributes.class.push("xfaBottom"); 48838 break; 48839 case "inline": 48840 ui.attributes.class.push("xfaLeft"); 48841 break; 48842 } 48843 this.w = savedW; 48844 this.h = savedH; 48845 return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 48846 } 48847} 48848exports.Field = Field; 48849class Fill extends _xfa_object.XFAObject { 48850 constructor(attributes) { 48851 super(TEMPLATE_NS_ID, "fill", true); 48852 this.id = attributes.id || ""; 48853 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 48854 this.use = attributes.use || ""; 48855 this.usehref = attributes.usehref || ""; 48856 this.color = null; 48857 this.extras = null; 48858 this.linear = null; 48859 this.pattern = null; 48860 this.radial = null; 48861 this.solid = null; 48862 this.stipple = null; 48863 } 48864 [_symbol_utils.$toStyle]() { 48865 const parent = this[_symbol_utils.$getParent](); 48866 const grandpa = parent[_symbol_utils.$getParent](); 48867 const ggrandpa = grandpa[_symbol_utils.$getParent](); 48868 const style = Object.create(null); 48869 let propName = "color"; 48870 let altPropName = propName; 48871 if (parent instanceof Border) { 48872 propName = "background-color"; 48873 altPropName = "background"; 48874 if (ggrandpa instanceof Ui) { 48875 style.backgroundColor = "white"; 48876 } 48877 } 48878 if (parent instanceof Rectangle || parent instanceof Arc) { 48879 propName = altPropName = "fill"; 48880 style.fill = "white"; 48881 } 48882 for (const name of Object.getOwnPropertyNames(this)) { 48883 if (name === "extras" || name === "color") { 48884 continue; 48885 } 48886 const obj = this[name]; 48887 if (!(obj instanceof _xfa_object.XFAObject)) { 48888 continue; 48889 } 48890 const color = obj[_symbol_utils.$toStyle](this.color); 48891 if (color) { 48892 style[color.startsWith("#") ? propName : altPropName] = color; 48893 } 48894 return style; 48895 } 48896 if (this.color?.value) { 48897 const color = this.color[_symbol_utils.$toStyle](); 48898 style[color.startsWith("#") ? propName : altPropName] = color; 48899 } 48900 return style; 48901 } 48902} 48903class Filter extends _xfa_object.XFAObject { 48904 constructor(attributes) { 48905 super(TEMPLATE_NS_ID, "filter", true); 48906 this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]); 48907 this.id = attributes.id || ""; 48908 this.name = attributes.name || ""; 48909 this.use = attributes.use || ""; 48910 this.usehref = attributes.usehref || ""; 48911 this.version = (0, _utils.getInteger)({ 48912 data: this.version, 48913 defaultValue: 5, 48914 validate: x => x >= 1 && x <= 5 48915 }); 48916 this.appearanceFilter = null; 48917 this.certificates = null; 48918 this.digestMethods = null; 48919 this.encodings = null; 48920 this.encryptionMethods = null; 48921 this.handler = null; 48922 this.lockDocument = null; 48923 this.mdp = null; 48924 this.reasons = null; 48925 this.timeStamp = null; 48926 } 48927} 48928class Float extends _xfa_object.ContentObject { 48929 constructor(attributes) { 48930 super(TEMPLATE_NS_ID, "float"); 48931 this.id = attributes.id || ""; 48932 this.name = attributes.name || ""; 48933 this.use = attributes.use || ""; 48934 this.usehref = attributes.usehref || ""; 48935 } 48936 [_symbol_utils.$finalize]() { 48937 const number = parseFloat(this[_symbol_utils.$content].trim()); 48938 this[_symbol_utils.$content] = isNaN(number) ? null : number; 48939 } 48940 [_symbol_utils.$toHTML](availableSpace) { 48941 return valueToHtml(this[_symbol_utils.$content] !== null ? this[_symbol_utils.$content].toString() : ""); 48942 } 48943} 48944class Font extends _xfa_object.XFAObject { 48945 constructor(attributes) { 48946 super(TEMPLATE_NS_ID, "font", true); 48947 this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift); 48948 this.fontHorizontalScale = (0, _utils.getFloat)({ 48949 data: attributes.fontHorizontalScale, 48950 defaultValue: 100, 48951 validate: x => x >= 0 48952 }); 48953 this.fontVerticalScale = (0, _utils.getFloat)({ 48954 data: attributes.fontVerticalScale, 48955 defaultValue: 100, 48956 validate: x => x >= 0 48957 }); 48958 this.id = attributes.id || ""; 48959 this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]); 48960 this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0"); 48961 this.lineThrough = (0, _utils.getInteger)({ 48962 data: attributes.lineThrough, 48963 defaultValue: 0, 48964 validate: x => x === 1 || x === 2 48965 }); 48966 this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]); 48967 this.overline = (0, _utils.getInteger)({ 48968 data: attributes.overline, 48969 defaultValue: 0, 48970 validate: x => x === 1 || x === 2 48971 }); 48972 this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]); 48973 this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]); 48974 this.size = (0, _utils.getMeasurement)(attributes.size, "10pt"); 48975 this.typeface = attributes.typeface || "Courier"; 48976 this.underline = (0, _utils.getInteger)({ 48977 data: attributes.underline, 48978 defaultValue: 0, 48979 validate: x => x === 1 || x === 2 48980 }); 48981 this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]); 48982 this.use = attributes.use || ""; 48983 this.usehref = attributes.usehref || ""; 48984 this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]); 48985 this.extras = null; 48986 this.fill = null; 48987 } 48988 [_symbol_utils.$clean](builder) { 48989 super[_symbol_utils.$clean](builder); 48990 this[_symbol_utils.$globalData].usedTypefaces.add(this.typeface); 48991 } 48992 [_symbol_utils.$toStyle]() { 48993 const style = (0, _html_utils.toStyle)(this, "fill"); 48994 const color = style.color; 48995 if (color) { 48996 if (color === "#000000") { 48997 delete style.color; 48998 } else if (!color.startsWith("#")) { 48999 style.background = color; 49000 style.backgroundClip = "text"; 49001 style.color = "transparent";
49002 } 49003 } 49004 if (this.baselineShift) { 49005 style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift); 49006 } 49007 style.fontKerning = this.kerningMode === "none" ? "none" : "normal"; 49008 style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing); 49009 if (this.lineThrough !== 0) { 49010 style.textDecoration = "line-through"; 49011 if (this.lineThrough === 2) { 49012 style.textDecorationStyle = "double"; 49013 } 49014 } 49015 if (this.overline !== 0) { 49016 style.textDecoration = "overline"; 49017 if (this.overline === 2) { 49018 style.textDecorationStyle = "double"; 49019 } 49020 } 49021 style.fontStyle = this.posture; 49022 style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size); 49023 (0, _html_utils.setFontFamily)(this, this, this[_symbol_utils.$globalData].fontFinder, style); 49024 if (this.underline !== 0) { 49025 style.textDecoration = "underline"; 49026 if (this.underline === 2) { 49027 style.textDecorationStyle = "double"; 49028 } 49029 } 49030 style.fontWeight = this.weight; 49031 return style; 49032 } 49033} 49034class Format extends _xfa_object.XFAObject { 49035 constructor(attributes) { 49036 super(TEMPLATE_NS_ID, "format", true); 49037 this.id = attributes.id || ""; 49038 this.use = attributes.use || ""; 49039 this.usehref = attributes.usehref || ""; 49040 this.extras = null; 49041 this.picture = null; 49042 } 49043} 49044class Handler extends _xfa_object.StringObject { 49045 constructor(attributes) { 49046 super(TEMPLATE_NS_ID, "handler"); 49047 this.id = attributes.id || ""; 49048 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 49049 this.use = attributes.use || ""; 49050 this.usehref = attributes.usehref || ""; 49051 } 49052} 49053class Hyphenation extends _xfa_object.XFAObject { 49054 constructor(attributes) { 49055 super(TEMPLATE_NS_ID, "hyphenation"); 49056 this.excludeAllCaps = (0, _utils.getInteger)({ 49057 data: attributes.excludeAllCaps, 49058 defaultValue: 0, 49059 validate: x => x === 1 49060 }); 49061 this.excludeInitialCap = (0, _utils.getInteger)({ 49062 data: attributes.excludeInitialCap, 49063 defaultValue: 0, 49064 validate: x => x === 1 49065 }); 49066 this.hyphenate = (0, _utils.getInteger)({ 49067 data: attributes.hyphenate, 49068 defaultValue: 0, 49069 validate: x => x === 1 49070 }); 49071 this.id = attributes.id || ""; 49072 this.pushCharacterCount = (0, _utils.getInteger)({ 49073 data: attributes.pushCharacterCount, 49074 defaultValue: 3, 49075 validate: x => x >= 0 49076 }); 49077 this.remainCharacterCount = (0, _utils.getInteger)({ 49078 data: attributes.remainCharacterCount, 49079 defaultValue: 3, 49080 validate: x => x >= 0 49081 }); 49082 this.use = attributes.use || ""; 49083 this.usehref = attributes.usehref || ""; 49084 this.wordCharacterCount = (0, _utils.getInteger)({ 49085 data: attributes.wordCharacterCount, 49086 defaultValue: 7, 49087 validate: x => x >= 0 49088 }); 49089 } 49090} 49091class Image extends _xfa_object.StringObject { 49092 constructor(attributes) { 49093 super(TEMPLATE_NS_ID, "image"); 49094 this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]); 49095 this.contentType = attributes.contentType || ""; 49096 this.href = attributes.href || ""; 49097 this.id = attributes.id || ""; 49098 this.name = attributes.name || ""; 49099 this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]); 49100 this.use = attributes.use || ""; 49101 this.usehref = attributes.usehref || ""; 49102 } 49103 [_symbol_utils.$toHTML]() { 49104 if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) { 49105 return _utils.HTMLResult.EMPTY; 49106 } 49107 let buffer = this[_symbol_utils.$globalData].images && this[_symbol_utils.$globalData].images.get(this.href); 49108 if (!buffer && (this.href || !this[_symbol_utils.$content])) { 49109 return _utils.HTMLResult.EMPTY; 49110 } 49111 if (!buffer && this.transferEncoding === "base64") { 49112 buffer = (0, _util.stringToBytes)(atob(this[_symbol_utils.$content])); 49113 } 49114 if (!buffer) { 49115 return _utils.HTMLResult.EMPTY; 49116 } 49117 if (!this.contentType) { 49118 for (const [header, type] of IMAGES_HEADERS) { 49119 if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) { 49120 this.contentType = type; 49121 break; 49122 } 49123 } 49124 if (!this.contentType) { 49125 return _utils.HTMLResult.EMPTY; 49126 } 49127 } 49128 const blob = new Blob([buffer], { 49129 type: this.contentType 49130 }); 49131 let style; 49132 switch (this.aspect) { 49133 case "fit": 49134 case "actual": 49135 break; 49136 case "height": 49137 style = { 49138 height: "100%", 49139 objectFit: "fill" 49140 }; 49141 break; 49142 case "none": 49143 style = { 49144 width: "100%", 49145 height: "100%", 49146 objectFit: "fill" 49147 }; 49148 break; 49149 case "width": 49150 style = { 49151 width: "100%", 49152 objectFit: "fill" 49153 }; 49154 break; 49155 } 49156 const parent = this[_symbol_utils.$getParent](); 49157 return _utils.HTMLResult.success({ 49158 name: "img", 49159 attributes: { 49160 class: ["xfaImage"], 49161 style, 49162 src: URL.createObjectURL(blob), 49163 alt: parent ? ariaLabel(parent[_symbol_utils.$getParent]()) : null 49164 } 49165 }); 49166 } 49167} 49168class ImageEdit extends _xfa_object.XFAObject { 49169 constructor(attributes) { 49170 super(TEMPLATE_NS_ID, "imageEdit", true); 49171 this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]); 49172 this.id = attributes.id || ""; 49173 this.use = attributes.use || ""; 49174 this.usehref = attributes.usehref || ""; 49175 this.border = null; 49176 this.extras = null; 49177 this.margin = null; 49178 } 49179 [_symbol_utils.$toHTML](availableSpace) { 49180 if (this.data === "embed") { 49181 return _utils.HTMLResult.success({ 49182 name: "div", 49183 children: [], 49184 attributes: {} 49185 }); 49186 } 49187 return _utils.HTMLResult.EMPTY; 49188 } 49189} 49190class Integer extends _xfa_object.ContentObject { 49191 constructor(attributes) { 49192 super(TEMPLATE_NS_ID, "integer"); 49193 this.id = attributes.id || ""; 49194 this.name = attributes.name || ""; 49195 this.use = attributes.use || ""; 49196 this.usehref = attributes.usehref || ""; 49197 } 49198 [_symbol_utils.$finalize]() { 49199 const number = parseInt(this[_symbol_utils.$content].trim(), 10); 49200 this[_symbol_utils.$content] = isNaN(number) ? null : number; 49201 } 49202 [_symbol_utils.$toHTML](availableSpace) { 49203 return valueToHtml(this[_symbol_utils.$content] !== null ? this[_symbol_utils.$content].toString() : ""); 49204 } 49205} 49206class Issuers extends _xfa_object.XFAObject { 49207 constructor(attributes) { 49208 super(TEMPLATE_NS_ID, "issuers", true); 49209 this.id = attributes.id || ""; 49210 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 49211 this.use = attributes.use || ""; 49212 this.usehref = attributes.usehref || ""; 49213 this.certificate = new _xfa_object.XFAObjectArray(); 49214 } 49215} 49216class Items extends _xfa_object.XFAObject { 49217 constructor(attributes) { 49218 super(TEMPLATE_NS_ID, "items", true); 49219 this.id = attributes.id || ""; 49220 this.name = attributes.name || ""; 49221 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 49222 this.ref = attributes.ref || ""; 49223 this.save = (0, _utils.getInteger)({ 49224 data: attributes.save, 49225 defaultValue: 0, 49226 validate: x => x === 1 49227 }); 49228 this.use = attributes.use || ""; 49229 this.usehref = attributes.usehref || ""; 49230 this.boolean = new _xfa_object.XFAObjectArray(); 49231 this.date = new _xfa_object.XFAObjectArray(); 49232 this.dateTime = new _xfa_object.XFAObjectArray(); 49233 this.decimal = new _xfa_object.XFAObjectArray(); 49234 this.exData = new _xfa_object.XFAObjectArray(); 49235 this.float = new _xfa_object.XFAObjectArray(); 49236 this.image = new _xfa_object.XFAObjectArray(); 49237 this.integer = new _xfa_object.XFAObjectArray(); 49238 this.text = new _xfa_object.XFAObjectArray(); 49239 this.time = new _xfa_object.XFAObjectArray(); 49240 } 49241 [_symbol_utils.$toHTML]() { 49242 const output = []; 49243 for (const child of this[_symbol_utils.$getChildren]()) { 49244 output.push(child[_symbol_utils.$text]()); 49245 } 49246 return _utils.HTMLResult.success(output); 49247 } 49248} 49249exports.Items = Items; 49250class Keep extends _xfa_object.XFAObject { 49251 constructor(attributes) { 49252 super(TEMPLATE_NS_ID, "keep", true); 49253 this.id = attributes.id || ""; 49254 const options = ["none", "contentArea", "pageArea"]; 49255 this.intact = (0, _utils.getStringOption)(attributes.intact, options); 49256 this.next = (0, _utils.getStringOption)(attributes.next, options); 49257 this.previous = (0, _utils.getStringOption)(attributes.previous, options); 49258 this.use = attributes.use || ""; 49259 this.usehref = attributes.usehref || ""; 49260 this.extras = null; 49261 } 49262} 49263class KeyUsage extends _xfa_object.XFAObject { 49264 constructor(attributes) { 49265 super(TEMPLATE_NS_ID, "keyUsage"); 49266 const options = ["", "yes", "no"]; 49267 this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options); 49268 this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options); 49269 this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options); 49270 this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options); 49271 this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options); 49272 this.id = attributes.id || ""; 49273 this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options); 49274 this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options); 49275 this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options); 49276 this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options); 49277 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 49278 this.use = attributes.use || ""; 49279 this.usehref = attributes.usehref || ""; 49280 } 49281} 49282class Line extends _xfa_object.XFAObject { 49283 constructor(attributes) { 49284 super(TEMPLATE_NS_ID, "line", true); 49285 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 49286 this.id = attributes.id || ""; 49287 this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]); 49288 this.use = attributes.use || ""; 49289 this.usehref = attributes.usehref || ""; 49290 this.edge = null; 49291 } 49292 [_symbol_utils.$toHTML]() { 49293 const parent = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent](); 49294 const edge = this.edge || new Edge({}); 49295 const edgeStyle = edge[_symbol_utils.$toStyle](); 49296 const style = Object.create(null); 49297 const thickness = edge.presence === "visible" ? edge.thickness : 0; 49298 style.strokeWidth = (0, _html_utils.measureToString)(thickness); 49299 style.stroke = edgeStyle.color; 49300 let x1, y1, x2, y2; 49301 let width = "100%"; 49302 let height = "100%"; 49303 if (parent.w <= thickness) { 49304 [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"]; 49305 width = style.strokeWidth; 49306 } else if (parent.h <= thickness) { 49307 [x1, y1, x2, y2] = [0, "50%", "100%", "50%"]; 49308 height = style.strokeWidth; 49309 } else if (this.slope === "\\") { 49310 [x1, y1, x2, y2] = [0, 0, "100%", "100%"]; 49311 } else { 49312 [x1, y1, x2, y2] = [0, "100%", "100%", 0]; 49313 } 49314 const line = { 49315 name: "line", 49316 attributes: { 49317 xmlns: SVG_NS, 49318 x1, 49319 y1, 49320 x2, 49321 y2, 49322 style 49323 } 49324 }; 49325 const svg = { 49326 name: "svg", 49327 children: [line], 49328 attributes: { 49329 xmlns: SVG_NS, 49330 width, 49331 height, 49332 style: { 49333 overflow: "visible" 49334 } 49335 } 49336 }; 49337 if (hasMargin(parent)) { 49338 return _utils.HTMLResult.success({ 49339 name: "div", 49340 attributes: { 49341 style: { 49342 display: "inline", 49343 width: "100%", 49344 height: "100%" 49345 } 49346 }, 49347 children: [svg] 49348 }); 49349 } 49350 svg.attributes.style.position = "absolute"; 49351 return _utils.HTMLResult.success(svg); 49352 } 49353} 49354class Linear extends _xfa_object.XFAObject { 49355 constructor(attributes) { 49356 super(TEMPLATE_NS_ID, "linear", true); 49357 this.id = attributes.id || ""; 49358 this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]); 49359 this.use = attributes.use || ""; 49360 this.usehref = attributes.usehref || ""; 49361 this.color = null; 49362 this.extras = null; 49363 } 49364 [_symbol_utils.$toStyle](startColor) { 49365 startColor = startColor ? startColor[_symbol_utils.$toStyle]() : "#FFFFFF"; 49366 const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase(); 49367 const endColor = this.color ? this.color[_symbol_utils.$toStyle]() : "#000000"; 49368 return `linear-gradient(${transf}, ${startColor}, ${endColor})`; 49369 } 49370} 49371class LockDocument extends _xfa_object.ContentObject { 49372 constructor(attributes) { 49373 super(TEMPLATE_NS_ID, "lockDocument"); 49374 this.id = attributes.id || ""; 49375 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 49376 this.use = attributes.use || ""; 49377 this.usehref = attributes.usehref || ""; 49378 } 49379 [_symbol_utils.$finalize]() { 49380 this[_symbol_utils.$content] = (0, _utils.getStringOption)(this[_symbol_utils.$content], ["auto", "0", "1"]); 49381 } 49382} 49383class Manifest extends _xfa_object.XFAObject { 49384 constructor(attributes) { 49385 super(TEMPLATE_NS_ID, "manifest", true); 49386 this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]); 49387 this.id = attributes.id || ""; 49388 this.name = attributes.name || ""; 49389 this.use = attributes.use || ""; 49390 this.usehref = attributes.usehref || ""; 49391 this.extras = null; 49392 this.ref = new _xfa_object.XFAObjectArray(); 49393 } 49394} 49395class Margin extends _xfa_object.XFAObject { 49396 constructor(attributes) { 49397 super(TEMPLATE_NS_ID, "margin", true); 49398 this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0"); 49399 this.id = attributes.id || ""; 49400 this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0"); 49401 this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0"); 49402 this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0"); 49403 this.use = attributes.use || ""; 49404 this.usehref = attributes.usehref || ""; 49405 this.extras = null; 49406 } 49407 [_symbol_utils.$toStyle]() { 49408 return { 49409 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) 49410 }; 49411 } 49412} 49413class Mdp extends _xfa_object.XFAObject { 49414 constructor(attributes) { 49415 super(TEMPLATE_NS_ID, "mdp"); 49416 this.id = attributes.id || ""; 49417 this.permissions = (0, _utils.getInteger)({ 49418 data: attributes.permissions, 49419 defaultValue: 2, 49420 validate: x => x === 1 || x === 3 49421 }); 49422 this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]); 49423 this.use = attributes.use || ""; 49424 this.usehref = attributes.usehref || ""; 49425 } 49426} 49427class Medium extends _xfa_object.XFAObject { 49428 constructor(attributes) { 49429 super(TEMPLATE_NS_ID, "medium"); 49430 this.id = attributes.id || ""; 49431 this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox); 49432 this.long = (0, _utils.getMeasurement)(attributes.long); 49433 this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]); 49434 this.short = (0, _utils.getMeasurement)(attributes.short); 49435 this.stock = attributes.stock || ""; 49436 this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]); 49437 this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]); 49438 this.use = attributes.use || ""; 49439 this.usehref = attributes.usehref || ""; 49440 } 49441} 49442class Message extends _xfa_object.XFAObject { 49443 constructor(attributes) { 49444 super(TEMPLATE_NS_ID, "message", true); 49445 this.id = attributes.id || ""; 49446 this.use = attributes.use || ""; 49447 this.usehref = attributes.usehref || ""; 49448 this.text = new _xfa_object.XFAObjectArray(); 49449 } 49450} 49451class NumericEdit extends _xfa_object.XFAObject { 49452 constructor(attributes) { 49453 super(TEMPLATE_NS_ID, "numericEdit", true); 49454 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 49455 this.id = attributes.id || ""; 49456 this.use = attributes.use || ""; 49457 this.usehref = attributes.usehref || ""; 49458 this.border = null; 49459 this.comb = null;
49460 this.extras = null; 49461 this.margin = null; 49462 } 49463 [_symbol_utils.$toHTML](availableSpace) { 49464 const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); 49465 const field = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent](); 49466 const html = { 49467 name: "input", 49468 attributes: { 49469 type: "text", 49470 fieldId: field[_symbol_utils.$uid], 49471 dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid], 49472 class: ["xfaTextfield"], 49473 style, 49474 "aria-label": ariaLabel(field), 49475 "aria-required": false 49476 } 49477 }; 49478 if (isRequired(field)) { 49479 html.attributes["aria-required"] = true; 49480 html.attributes.required = true; 49481 } 49482 return _utils.HTMLResult.success({ 49483 name: "label", 49484 attributes: { 49485 class: ["xfaLabel"] 49486 }, 49487 children: [html] 49488 }); 49489 } 49490} 49491class Occur extends _xfa_object.XFAObject { 49492 constructor(attributes) { 49493 super(TEMPLATE_NS_ID, "occur", true); 49494 this.id = attributes.id || ""; 49495 this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({ 49496 data: attributes.initial, 49497 defaultValue: "", 49498 validate: x => true 49499 }) : ""; 49500 this.max = attributes.max !== "" ? (0, _utils.getInteger)({ 49501 data: attributes.max, 49502 defaultValue: 1, 49503 validate: x => true 49504 }) : ""; 49505 this.min = attributes.min !== "" ? (0, _utils.getInteger)({ 49506 data: attributes.min, 49507 defaultValue: 1, 49508 validate: x => true 49509 }) : ""; 49510 this.use = attributes.use || ""; 49511 this.usehref = attributes.usehref || ""; 49512 this.extras = null; 49513 } 49514 [_symbol_utils.$clean]() { 49515 const parent = this[_symbol_utils.$getParent](); 49516 const originalMin = this.min; 49517 if (this.min === "") { 49518 this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1; 49519 } 49520 if (this.max === "") { 49521 if (originalMin === "") { 49522 this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1; 49523 } else { 49524 this.max = this.min; 49525 } 49526 } 49527 if (this.max !== -1 && this.max < this.min) { 49528 this.max = this.min; 49529 } 49530 if (this.initial === "") { 49531 this.initial = parent instanceof Template ? 1 : this.min; 49532 } 49533 } 49534} 49535class Oid extends _xfa_object.StringObject { 49536 constructor(attributes) { 49537 super(TEMPLATE_NS_ID, "oid"); 49538 this.id = attributes.id || ""; 49539 this.name = attributes.name || ""; 49540 this.use = attributes.use || ""; 49541 this.usehref = attributes.usehref || ""; 49542 } 49543} 49544class Oids extends _xfa_object.XFAObject { 49545 constructor(attributes) { 49546 super(TEMPLATE_NS_ID, "oids", true); 49547 this.id = attributes.id || ""; 49548 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 49549 this.use = attributes.use || ""; 49550 this.usehref = attributes.usehref || ""; 49551 this.oid = new _xfa_object.XFAObjectArray(); 49552 } 49553} 49554class Overflow extends _xfa_object.XFAObject { 49555 constructor(attributes) { 49556 super(TEMPLATE_NS_ID, "overflow"); 49557 this.id = attributes.id || ""; 49558 this.leader = attributes.leader || ""; 49559 this.target = attributes.target || ""; 49560 this.trailer = attributes.trailer || ""; 49561 this.use = attributes.use || ""; 49562 this.usehref = attributes.usehref || ""; 49563 } 49564 [_symbol_utils.$getExtra]() { 49565 if (!this[_symbol_utils.$extra]) { 49566 const parent = this[_symbol_utils.$getParent](); 49567 const root = this[_symbol_utils.$getTemplateRoot](); 49568 const target = root[_symbol_utils.$searchNode](this.target, parent); 49569 const leader = root[_symbol_utils.$searchNode](this.leader, parent); 49570 const trailer = root[_symbol_utils.$searchNode](this.trailer, parent); 49571 this[_symbol_utils.$extra] = { 49572 target: target?.[0] || null, 49573 leader: leader?.[0] || null, 49574 trailer: trailer?.[0] || null, 49575 addLeader: false, 49576 addTrailer: false 49577 }; 49578 } 49579 return this[_symbol_utils.$extra]; 49580 } 49581} 49582class PageArea extends _xfa_object.XFAObject { 49583 constructor(attributes) { 49584 super(TEMPLATE_NS_ID, "pageArea", true); 49585 this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]); 49586 this.id = attributes.id || ""; 49587 this.initialNumber = (0, _utils.getInteger)({ 49588 data: attributes.initialNumber, 49589 defaultValue: 1, 49590 validate: x => true 49591 }); 49592 this.name = attributes.name || ""; 49593 this.numbered = (0, _utils.getInteger)({ 49594 data: attributes.numbered, 49595 defaultValue: 1, 49596 validate: x => true 49597 }); 49598 this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]); 49599 this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]); 49600 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 49601 this.use = attributes.use || ""; 49602 this.usehref = attributes.usehref || ""; 49603 this.desc = null; 49604 this.extras = null; 49605 this.medium = null; 49606 this.occur = null; 49607 this.area = new _xfa_object.XFAObjectArray(); 49608 this.contentArea = new _xfa_object.XFAObjectArray(); 49609 this.draw = new _xfa_object.XFAObjectArray(); 49610 this.exclGroup = new _xfa_object.XFAObjectArray(); 49611 this.field = new _xfa_object.XFAObjectArray(); 49612 this.subform = new _xfa_object.XFAObjectArray(); 49613 } 49614 [_symbol_utils.$isUsable]() { 49615 if (!this[_symbol_utils.$extra]) { 49616 this[_symbol_utils.$extra] = { 49617 numberOfUse: 0 49618 }; 49619 return true; 49620 } 49621 return !this.occur || this.occur.max === -1 || this[_symbol_utils.$extra].numberOfUse < this.occur.max; 49622 } 49623 [_symbol_utils.$cleanPage]() { 49624 delete this[_symbol_utils.$extra]; 49625 } 49626 [_symbol_utils.$getNextPage]() { 49627 if (!this[_symbol_utils.$extra]) { 49628 this[_symbol_utils.$extra] = { 49629 numberOfUse: 0 49630 }; 49631 } 49632 const parent = this[_symbol_utils.$getParent]();
49633 if (parent.relation === "orderedOccurrence") { 49634 if (this[_symbol_utils.$isUsable]()) { 49635 this[_symbol_utils.$extra].numberOfUse += 1; 49636 return this; 49637 } 49638 } 49639 return parent[_symbol_utils.$getNextPage](); 49640 } 49641 [_symbol_utils.$getAvailableSpace]() { 49642 return this[_symbol_utils.$extra].space || { 49643 width: 0, 49644 height: 0 49645 }; 49646 } 49647 [_symbol_utils.$toHTML]() { 49648 if (!this[_symbol_utils.$extra]) { 49649 this[_symbol_utils.$extra] = { 49650 numberOfUse: 1 49651 }; 49652 } 49653 const children = []; 49654 this[_symbol_utils.$extra].children = children; 49655 const style = Object.create(null); 49656 if (this.medium && this.medium.short && this.medium.long) { 49657 style.width = (0, _html_utils.measureToString)(this.medium.short); 49658 style.height = (0, _html_utils.measureToString)(this.medium.long); 49659 this[_symbol_utils.$extra].space = { 49660 width: this.medium.short, 49661 height: this.medium.long 49662 }; 49663 if (this.medium.orientation === "landscape") { 49664 const x = style.width; 49665 style.width = style.height; 49666 style.height = x; 49667 this[_symbol_utils.$extra].space = { 49668 width: this.medium.long, 49669 height: this.medium.short 49670 }; 49671 } 49672 } else { 49673 (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug."); 49674 } 49675 this[_symbol_utils.$childrenToHTML]({ 49676 filter: new Set(["area", "draw", "field", "subform"]), 49677 include: true 49678 }); 49679 this[_symbol_utils.$childrenToHTML]({ 49680 filter: new Set(["contentArea"]), 49681 include: true 49682 }); 49683 return _utils.HTMLResult.success({ 49684 name: "div", 49685 children, 49686 attributes: { 49687 class: ["xfaPage"], 49688 id: this[_symbol_utils.$uid], 49689 style, 49690 xfaName: this.name 49691 } 49692 }); 49693 } 49694} 49695class PageSet extends _xfa_object.XFAObject { 49696 constructor(attributes) { 49697 super(TEMPLATE_NS_ID, "pageSet", true); 49698 this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]); 49699 this.id = attributes.id || ""; 49700 this.name = attributes.name || ""; 49701 this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]); 49702 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 49703 this.use = attributes.use || ""; 49704 this.usehref = attributes.usehref || ""; 49705 this.extras = null; 49706 this.occur = null; 49707 this.pageArea = new _xfa_object.XFAObjectArray(); 49708 this.pageSet = new _xfa_object.XFAObjectArray(); 49709 } 49710 [_symbol_utils.$cleanPage]() { 49711 for (const page of this.pageArea.children) { 49712 page[_symbol_utils.$cleanPage](); 49713 } 49714 for (const page of this.pageSet.children) { 49715 page[_symbol_utils.$cleanPage](); 49716 } 49717 } 49718 [_symbol_utils.$isUsable]() { 49719 return !this.occur || this.occur.max === -1 || this[_symbol_utils.$extra].numberOfUse < this.occur.max; 49720 } 49721 [_symbol_utils.$getNextPage]() { 49722 if (!this[_symbol_utils.$extra]) { 49723 this[_symbol_utils.$extra] = { 49724 numberOfUse: 1, 49725 pageIndex: -1, 49726 pageSetIndex: -1 49727 }; 49728 } 49729 if (this.relation === "orderedOccurrence") { 49730 if (this[_symbol_utils.$extra].pageIndex + 1 < this.pageArea.children.length) { 49731 this[_symbol_utils.$extra].pageIndex += 1; 49732 const pageArea = this.pageArea.children[this[_symbol_utils.$extra].pageIndex]; 49733 return pageArea[_symbol_utils.$getNextPage](); 49734 } 49735 if (this[_symbol_utils.$extra].pageSetIndex + 1 < this.pageSet.children.length) { 49736 this[_symbol_utils.$extra].pageSetIndex += 1; 49737 return this.pageSet.children[this[_symbol_utils.$extra].pageSetIndex][_symbol_utils.$getNextPage](); 49738 } 49739 if (this[_symbol_utils.$isUsable]()) { 49740 this[_symbol_utils.$extra].numberOfUse += 1; 49741 this[_symbol_utils.$extra].pageIndex = -1; 49742 this[_symbol_utils.$extra].pageSetIndex = -1; 49743 return this[_symbol_utils.$getNextPage](); 49744 } 49745 const parent = this[_symbol_utils.$getParent](); 49746 if (parent instanceof PageSet) { 49747 return parent[_symbol_utils.$getNextPage](); 49748 } 49749 this[_symbol_utils.$cleanPage](); 49750 return this[_symbol_utils.$getNextPage](); 49751 } 49752 const pageNumber = this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].pageNumber; 49753 const parity = pageNumber % 2 === 0 ? "even" : "odd"; 49754 const position = pageNumber === 0 ? "first" : "rest"; 49755 let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position); 49756 if (page) { 49757 return page; 49758 } 49759 page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position); 49760 if (page) { 49761 return page; 49762 } 49763 page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any"); 49764 if (page) { 49765 return page; 49766 } 49767 return this.pageArea.children[0]; 49768 } 49769} 49770class Para extends _xfa_object.XFAObject { 49771 constructor(attributes) { 49772 super(TEMPLATE_NS_ID, "para", true); 49773 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 49774 this.id = attributes.id || ""; 49775 this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : ""; 49776 this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : ""; 49777 this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : ""; 49778 this.orphans = (0, _utils.getInteger)({ 49779 data: attributes.orphans, 49780 defaultValue: 0, 49781 validate: x => x >= 0 49782 }); 49783 this.preserve = attributes.preserve || ""; 49784 this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : ""; 49785 this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : ""; 49786 this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : ""; 49787 this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : ""; 49788 this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x); 49789 this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : ""; 49790 this.use = attributes.use || ""; 49791 this.usehref = attributes.usehref || ""; 49792 this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]); 49793 this.widows = (0, _utils.getInteger)({ 49794 data: attributes.widows, 49795 defaultValue: 0, 49796 validate: x => x >= 0 49797 }); 49798 this.hyphenation = null; 49799 } 49800 [_symbol_utils.$toStyle]() { 49801 const style = (0, _html_utils.toStyle)(this, "hAlign"); 49802 if (this.marginLeft !== "") { 49803 style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft); 49804 } 49805 if (this.marginRight !== "") { 49806 style.paddingight = (0, _html_utils.measureToString)(this.marginRight); 49807 } 49808 if (this.spaceAbove !== "") { 49809 style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove); 49810 } 49811 if (this.spaceBelow !== "") { 49812 style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow); 49813 } 49814 if (this.textIndent !== "") { 49815 style.textIndent = (0, _html_utils.measureToString)(this.textIndent); 49816 (0, _html_utils.fixTextIndent)(style); 49817 } 49818 if (this.lineHeight > 0) { 49819 style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight); 49820 } 49821 if (this.tabDefault !== "") { 49822 style.tabSize = (0, _html_utils.measureToString)(this.tabDefault); 49823 } 49824 if (this.tabStops.length > 0) {} 49825 if (this.hyphenatation) { 49826 Object.assign(style, this.hyphenatation[_symbol_utils.$toStyle]()); 49827 } 49828 return style; 49829 } 49830} 49831class PasswordEdit extends _xfa_object.XFAObject { 49832 constructor(attributes) { 49833 super(TEMPLATE_NS_ID, "passwordEdit", true); 49834 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 49835 this.id = attributes.id || ""; 49836 this.passwordChar = attributes.passwordChar || "*"; 49837 this.use = attributes.use || ""; 49838 this.usehref = attributes.usehref || ""; 49839 this.border = null; 49840 this.extras = null; 49841 this.margin = null; 49842 } 49843} 49844class Pattern extends _xfa_object.XFAObject { 49845 constructor(attributes) { 49846 super(TEMPLATE_NS_ID, "pattern", true); 49847 this.id = attributes.id || ""; 49848 this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]); 49849 this.use = attributes.use || ""; 49850 this.usehref = attributes.usehref || ""; 49851 this.color = null; 49852 this.extras = null; 49853 } 49854 [_symbol_utils.$toStyle](startColor) { 49855 startColor = startColor ? startColor[_symbol_utils.$toStyle]() : "#FFFFFF"; 49856 const endColor = this.color ? this.color[_symbol_utils.$toStyle]() : "#000000"; 49857 const width = 5; 49858 const cmd = "repeating-linear-gradient"; 49859 const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`; 49860 switch (this.type) { 49861 case "crossHatch": 49862 return `${cmd}
49862(to top,${colors}) ${cmd}(to right,${colors})`; 49863 case "crossDiagonal": 49864 return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`; 49865 case "diagonalLeft": 49866 return `${cmd}(45deg,${colors})`; 49867 case "diagonalRight": 49868 return `${cmd}(-45deg,${colors})`; 49869 case "horizontal": 49870 return `${cmd}(to top,${colors})`; 49871 case "vertical": 49872 return `${cmd}(to right,${colors})`; 49873 } 49874 return ""; 49875 } 49876} 49877class Picture extends _xfa_object.StringObject { 49878 constructor(attributes) { 49879 super(TEMPLATE_NS_ID, "picture"); 49880 this.id = attributes.id || ""; 49881 this.use = attributes.use || ""; 49882 this.usehref = attributes.usehref || ""; 49883 } 49884} 49885class Proto extends _xfa_object.XFAObject { 49886 constructor(attributes) { 49887 super(TEMPLATE_NS_ID, "proto", true); 49888 this.appearanceFilter = new _xfa_object.XFAObjectArray(); 49889 this.arc = new _xfa_object.XFAObjectArray(); 49890 this.area = new _xfa_object.XFAObjectArray(); 49891 this.assist = new _xfa_object.XFAObjectArray(); 49892 this.barcode = new _xfa_object.XFAObjectArray(); 49893 this.bindItems = new _xfa_object.XFAObjectArray(); 49894 this.bookend = new _xfa_object.XFAObjectArray(); 49895 this.boolean = new _xfa_object.XFAObjectArray(); 49896 this.border = new _xfa_object.XFAObjectArray(); 49897 this.break = new _xfa_object.XFAObjectArray(); 49898 this.breakAfter = new _xfa_object.XFAObjectArray(); 49899 this.breakBefore = new _xfa_object.XFAObjectArray(); 49900 this.button = new _xfa_object.XFAObjectArray(); 49901 this.calculate = new _xfa_object.XFAObjectArray(); 49902 this.caption = new _xfa_object.XFAObjectArray(); 49903 this.certificate = new _xfa_object.XFAObjectArray(); 49904 this.certificates = new _xfa_object.XFAObjectArray(); 49905 this.checkButton = new _xfa_object.XFAObjectArray(); 49906 this.choiceList = new _xfa_object.XFAObjectArray(); 49907 this.color = new _xfa_object.XFAObjectArray(); 49908 this.comb = new _xfa_object.XFAObjectArray(); 49909 this.connect = new _xfa_object.XFAObjectArray(); 49910 this.contentArea = new _xfa_object.XFAObjectArray(); 49911 this.corner = new _xfa_object.XFAObjectArray(); 49912 this.date = new _xfa_object.XFAObjectArray(); 49913 this.dateTime = new _xfa_object.XFAObjectArray(); 49914 this.dateTimeEdit = new _xfa_object.XFAObjectArray(); 49915 this.decimal = new _xfa_object.XFAObjectArray(); 49916 this.defaultUi = new _xfa_object.XFAObjectArray(); 49917 this.desc = new _xfa_object.XFAObjectArray(); 49918 this.digestMethod = new _xfa_object.XFAObjectArray(); 49919 this.digestMethods = new _xfa_object.XFAObjectArray(); 49920 this.draw = new _xfa_object.XFAObjectArray(); 49921 this.edge = new _xfa_object.XFAObjectArray(); 49922 this.encoding = new _xfa_object.XFAObjectArray(); 49923 this.encodings = new _xfa_object.XFAObjectArray(); 49924 this.encrypt = new _xfa_object.XFAObjectArray(); 49925 this.encryptData = new _xfa_object.XFAObjectArray(); 49926 this.encryption = new _xfa_object.XFAObjectArray(); 49927 this.encryptionMethod = new _xfa_object.XFAObjectArray(); 49928 this.encryptionMethods = new _xfa_object.XFAObjectArray(); 49929 this.event = new _xfa_object.XFAObjectArray(); 49930 this.exData = new _xfa_object.XFAObjectArray(); 49931 this.exObject = new _xfa_object.XFAObjectArray(); 49932 this.exclGroup = new _xfa_object.XFAObjectArray(); 49933 this.execute = new _xfa_object.XFAObjectArray(); 49934 this.extras = new _xfa_object.XFAObjectArray(); 49935 this.field = new _xfa_object.XFAObjectArray(); 49936 this.fill = new _xfa_object.XFAObjectArray(); 49937 this.filter = new _xfa_object.XFAObjectArray(); 49938 this.float = new _xfa_object.XFAObjectArray(); 49939 this.font = new _xfa_object.XFAObjectArray(); 49940 this.format = new _xfa_object.XFAObjectArray(); 49941 this.handler = new _xfa_object.XFAObjectArray(); 49942 this.hyphenation = new _xfa_object.XFAObjectArray(); 49943 this.image = new _xfa_object.XFAObjectArray(); 49944 this.imageEdit = new _xfa_object.XFAObjectArray(); 49945 this.integer = new _xfa_object.XFAObjectArray(); 49946 this.issuers = new _xfa_object.XFAObjectArray(); 49947 this.items = new _xfa_object.XFAObjectArray(); 49948 this.keep = new _xfa_object.XFAObjectArray(); 49949 this.keyUsage = new _xfa_object.XFAObjectArray(); 49950 this.line = new _xfa_object.XFAObjectArray(); 49951 this.linear = new _xfa_object.XFAObjectArray(); 49952 this.lockDocument = new _xfa_object.XFAObjectArray(); 49953 this.manifest = new _xfa_object.XFAObjectArray(); 49954 this.margin = new _xfa_object.XFAObjectArray(); 49955 this.mdp = new _xfa_object.XFAObjectArray(); 49956 this.medium = new _xfa_object.XFAObjectArray(); 49957 this.message = new _xfa_object.XFAObjectArray(); 49958 this.numericEdit = new _xfa_object.XFAObjectArray(); 49959 this.occur = new _xfa_object.XFAObjectArray(); 49960 this.oid = new _xfa_object.XFAObjectArray(); 49961 this.oids = new _xfa_object.XFAObjectArray(); 49962 this.overflow = new _xfa_object.XFAObjectArray(); 49963 this.pageArea = new _xfa_object.XFAObjectArray(); 49964 this.pageSet = new _xfa_object.XFAObjectArray(); 49965 this.para = new _xfa_object.XFAObjectArray(); 49966 this.passwordEdit = new _xfa_object.XFAObjectArray(); 49967 this.pattern = new _xfa_object.XFAObjectArray(); 49968 this.picture = new _xfa_object.XFAObjectArray(); 49969 this.radial = new _xfa_object.XFAObjectArray(); 49970 this.reason = new _xfa_object.XFAObjectArray(); 49971 this.reasons = new _xfa_object.XFAObjectArray(); 49972 this.rectangle = new _xfa_object.XFAObjectArray(); 49973 this.ref = new _xfa_object.XFAObjectArray(); 49974 this.script = new _xfa_object.XFAObjectArray(); 49975 this.setProperty = new _xfa_object.XFAObjectArray(); 49976 this.signData = new _xfa_object.XFAObjectArray(); 49977 this.signature = new _xfa_object.XFAObjectArray(); 49978 this.signing = new _xfa_object.XFAObjectArray(); 49979 this.solid = new _xfa_object.XFAObjectArray(); 49980 this.speak = new _xfa_object.XFAObjectArray(); 49981 this.stipple = new _xfa_object.XFAObjectArray(); 49982 this.subform = new _xfa_object.XFAObjectArray(); 49983 this.subformSet = new _xfa_object.XFAObjectArray(); 49984 this.subjectDN = new _xfa_object.XFAObjectArray(); 49985 this.subjectDNs = new _xfa_object.XFAObjectArray(); 49986 this.submit = new _xfa_object.XFAObjectArray(); 49987 this.text = new _xfa_object.XFAObjectArray(); 49988 this.textEdit = new _xfa_object.XFAObjectArray(); 49989 this.time = new _xfa_object.XFAObjectArray(); 49990 this.timeStamp = new _xfa_object.XFAObjectArray(); 49991 this.toolTip = new _xfa_object.XFAObjectArray(); 49992 this.traversal = new _xfa_object.XFAObjectArray(); 49993 this.traverse = new _xfa_object.XFAObjectArray(); 49994 this.ui = new _xfa_object.XFAObjectArray(); 49995 this.validate = new _xfa_object.XFAObjectArray(); 49996 this.value = new _xfa_object.XFAObjectArray(); 49997 this.variables = new _xfa_object.XFAObjectArray(); 49998 } 49999} 50000class Radial extends _xfa_object.XFAObject { 50001 constructor(attributes) { 50002 super(TEMPLATE_NS_ID, "radial", true); 50003 this.id = attributes.id || ""; 50004 this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]); 50005 this.use = attributes.use || ""; 50006 this.usehref = attributes.usehref || ""; 50007 this.color = null; 50008 this.extras = null; 50009 } 50010 [_symbol_utils.$toStyle](startColor) { 50011 startColor = startColor ? startColor[_symbol_utils.$toStyle]() : "#FFFFFF"; 50012 const endColor = this.color ? this.color[_symbol_utils.$toStyle]() : "#000000"; 50013 const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`; 50014 return `radial-gradient(circle at center, ${colors})`; 50015 } 50016} 50017class Reason extends _xfa_object.StringObject { 50018 constructor(attributes) { 50019 super(TEMPLATE_NS_ID, "reason"); 50020 this.id = attributes.id || ""; 50021 this.name = attributes.name || ""; 50022 this.use = attributes.use || ""; 50023 this.usehref = attributes.usehref || ""; 50024 } 50025} 50026class Reasons extends _xfa_object.XFAObject { 50027 constructor(attributes) { 50028 super(TEMPLATE_NS_ID, "reasons", true); 50029 this.id = attributes.id || ""; 50030 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 50031 this.use = attributes.use || ""; 50032 this.usehref = attributes.usehref || ""; 50033 this.reason = new _xfa_object.XFAObjectArray(); 50034 } 50035} 50036class Rectangle extends _xfa_object.XFAObject { 50037 constructor(attributes) { 50038 super(TEMPLATE_NS_ID, "rectangle", true); 50039 this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]); 50040 this.id = attributes.id || ""; 50041 this.use = attributes.use || ""; 50042 this.usehref = attributes.usehref || ""; 50043 this.corner = new _xfa_object.XFAObjectArray(4); 50044 this.edge = new _xfa_object.XFAObjectArray(4); 50045 this.fill = null; 50046 } 50047 [_symbol_utils.$toHTML]() { 50048 const edge = this.edge.children.length ? this.edge.children[0] : new Edge({}); 50049 const edgeStyle = edge[_symbol_utils.$toStyle](); 50050 const style = Object.create(null); 50051 if (this.fill?.presence === "visible") { 50052 Object.assign(style, this.fill[_symbol_utils.$toStyle]()); 50053 } else { 50054 style.fill = "transparent";
50055 } 50056 style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0); 50057 style.stroke = edgeStyle.color; 50058 const corner = this.corner.children.length ? this.corner.children[0] : new Corner({}); 50059 const cornerStyle = corner[_symbol_utils.$toStyle](); 50060 const rect = { 50061 name: "rect", 50062 attributes: { 50063 xmlns: SVG_NS, 50064 width: "100%", 50065 height: "100%", 50066 x: 0, 50067 y: 0, 50068 rx: cornerStyle.radius, 50069 ry: cornerStyle.radius, 50070 style 50071 } 50072 }; 50073 const svg = { 50074 name: "svg", 50075 children: [rect], 50076 attributes: { 50077 xmlns: SVG_NS, 50078 style: { 50079 overflow: "visible" 50080 }, 50081 width: "100%", 50082 height: "100%" 50083 } 50084 }; 50085 const parent = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent](); 50086 if (hasMargin(parent)) { 50087 return _utils.HTMLResult.success({ 50088 name: "div", 50089 attributes: { 50090 style: { 50091 display: "inline", 50092 width: "100%", 50093 height: "100%" 50094 } 50095 }, 50096 children: [svg] 50097 }); 50098 } 50099 svg.attributes.style.position = "absolute"; 50100 return _utils.HTMLResult.success(svg); 50101 } 50102} 50103class RefElement extends _xfa_object.StringObject { 50104 constructor(attributes) { 50105 super(TEMPLATE_NS_ID, "ref"); 50106 this.id = attributes.id || ""; 50107 this.use = attributes.use || ""; 50108 this.usehref = attributes.usehref || ""; 50109 } 50110} 50111class Script extends _xfa_object.StringObject { 50112 constructor(attributes) { 50113 super(TEMPLATE_NS_ID, "script"); 50114 this.binding = attributes.binding || ""; 50115 this.contentType = attributes.contentType || ""; 50116 this.id = attributes.id || ""; 50117 this.name = attributes.name || ""; 50118 this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]); 50119 this.use = attributes.use || ""; 50120 this.usehref = attributes.usehref || ""; 50121 } 50122} 50123class SetProperty extends _xfa_object.XFAObject { 50124 constructor(attributes) { 50125 super(TEMPLATE_NS_ID, "setProperty"); 50126 this.connection = attributes.connection || ""; 50127 this.ref = attributes.ref || ""; 50128 this.target = attributes.target || ""; 50129 } 50130} 50131exports.SetProperty = SetProperty; 50132class SignData extends _xfa_object.XFAObject { 50133 constructor(attributes) { 50134 super(TEMPLATE_NS_ID, "signData", true); 50135 this.id = attributes.id || ""; 50136 this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]); 50137 this.ref = attributes.ref || ""; 50138 this.target = attributes.target || ""; 50139 this.use = attributes.use || ""; 50140 this.usehref = attributes.usehref || ""; 50141 this.filter = null; 50142 this.manifest = null; 50143 } 50144} 50145class Signature extends _xfa_object.XFAObject { 50146 constructor(attributes) { 50147 super(TEMPLATE_NS_ID, "signature", true); 50148 this.id = attributes.id || ""; 50149 this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]); 50150 this.use = attributes.use || ""; 50151 this.usehref = attributes.usehref || ""; 50152 this.border = null; 50153 this.extras = null; 50154 this.filter = null; 50155 this.manifest = null; 50156 this.margin = null; 50157 } 50158} 50159class Signing extends _xfa_object.XFAObject { 50160 constructor(attributes) { 50161 super(TEMPLATE_NS_ID, "signing", true); 50162 this.id = attributes.id || ""; 50163 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 50164 this.use = attributes.use || ""; 50165 this.usehref = attributes.usehref || ""; 50166 this.certificate = new _xfa_object.XFAObjectArray(); 50167 } 50168} 50169class Solid extends _xfa_object.XFAObject { 50170 constructor(attributes) { 50171 super(TEMPLATE_NS_ID, "solid", true); 50172 this.id = attributes.id || ""; 50173 this.use = attributes.use || ""; 50174 this.usehref = attributes.usehref || ""; 50175 this.extras = null; 50176 } 50177 [_symbol_utils.$toStyle](startColor) { 50178 return startColor ? startColor[_symbol_utils.$toStyle]() : "#FFFFFF"; 50179 } 50180} 50181class Speak extends _xfa_object.StringObject { 50182 constructor(attributes) { 50183 super(TEMPLATE_NS_ID, "speak"); 50184 this.disable = (0, _utils.getInteger)({ 50185 data: attributes.disable, 50186 defaultValue: 0, 50187 validate: x => x === 1 50188 }); 50189 this.id = attributes.id || ""; 50190 this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]); 50191 this.rid = attributes.rid || ""; 50192 this.use = attributes.use || ""; 50193 this.usehref = attributes.usehref || ""; 50194 } 50195} 50196class Stipple extends _xfa_object.XFAObject { 50197 constructor(attributes) { 50198 super(TEMPLATE_NS_ID, "stipple", true); 50199 this.id = attributes.id || ""; 50200 this.rate = (0, _utils.getInteger)({ 50201 data: attributes.rate, 50202 defaultValue: 50, 50203 validate: x => x >= 0 && x <= 100 50204 }); 50205 this.use = attributes.use || ""; 50206 this.usehref = attributes.usehref || ""; 50207 this.color = null; 50208 this.extras = null; 50209 } 50210 [_symbol_utils.$toStyle](bgColor) {
50211 const alpha = this.rate / 100; 50212 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)); 50213 } 50214} 50215class Subform extends _xfa_object.XFAObject { 50216 constructor(attributes) { 50217 super(TEMPLATE_NS_ID, "subform", true); 50218 this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 50219 this.allowMacro = (0, _utils.getInteger)({ 50220 data: attributes.allowMacro, 50221 defaultValue: 0, 50222 validate: x => x === 1 50223 }); 50224 this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 50225 this.colSpan = (0, _utils.getInteger)({ 50226 data: attributes.colSpan, 50227 defaultValue: 1, 50228 validate: n => n >= 1 || n === -1 50229 }); 50230 this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x)); 50231 this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : ""; 50232 this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 50233 this.id = attributes.id || ""; 50234 this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]); 50235 this.locale = attributes.locale || ""; 50236 this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt"); 50237 this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt"); 50238 this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]); 50239 this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt"); 50240 this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt"); 50241 this.name = attributes.name || ""; 50242 this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 50243 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 50244 this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]); 50245 this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]); 50246 this.use = attributes.use || ""; 50247 this.usehref = attributes.usehref || ""; 50248 this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : ""; 50249 this.x = (0, _utils.getMeasurement)(attributes.x, "0pt"); 50250 this.y = (0, _utils.getMeasurement)(attributes.y, "0pt"); 50251 this.assist = null; 50252 this.bind = null; 50253 this.bookend = null; 50254 this.border = null; 50255 this.break = null; 50256 this.calculate = null; 50257 this.desc = null; 50258 this.extras = null; 50259 this.keep = null; 50260 this.margin = null; 50261 this.occur = null; 50262 this.overflow = null; 50263 this.pageSet = null; 50264 this.para = null; 50265 this.traversal = null; 50266 this.validate = null; 50267 this.variables = null; 50268 this.area = new _xfa_object.XFAObjectArray(); 50269 this.breakAfter = new _xfa_object.XFAObjectArray(); 50270 this.breakBefore = new _xfa_object.XFAObjectArray(); 50271 this.connect = new _xfa_object.XFAObjectArray(); 50272 this.draw = new _xfa_object.XFAObjectArray(); 50273 this.event = new _xfa_object.XFAObjectArray(); 50274 this.exObject = new _xfa_object.XFAObjectArray(); 50275 this.exclGroup = new _xfa_object.XFAObjectArray(); 50276 this.field = new _xfa_object.XFAObjectArray(); 50277 this.proto = new _xfa_object.XFAObjectArray(); 50278 this.setProperty = new _xfa_object.XFAObjectArray(); 50279 this.subform = new _xfa_object.XFAObjectArray(); 50280 this.subformSet = new _xfa_object.XFAObjectArray(); 50281 } 50282 [_symbol_utils.$getSubformParent]() { 50283 const parent = this[_symbol_utils.$getParent](); 50284 if (parent instanceof SubformSet) { 50285 return parent[_symbol_utils.$getSubformParent](); 50286 } 50287 return parent; 50288 } 50289 [_symbol_utils.$isBindable]() { 50290 return true; 50291 } 50292 [_symbol_utils.$isThereMoreWidth]() { 50293 return this.layout.endsWith("-tb") && this[_symbol_utils.$extra].attempt === 0 && this[_symbol_utils.$extra].numberInLine > 0 || this[_symbol_utils.$getParent]()[_symbol_utils.$isThereMoreWidth](); 50294 } 50295 *[_symbol_utils.$getContainedChildren]() { 50296 yield* getContainedChildren(this); 50297 } 50298 [_symbol_utils.$flushHTML]() { 50299 return (0, _layout.flushHTML)(this); 50300 } 50301 [_symbol_utils.$addHTML](html, bbox) { 50302 (0, _layout.addHTML)(this, html, bbox); 50303 } 50304 [_symbol_utils.$getAvailableSpace]() { 50305 return (0, _layout.getAvailableSpace)(this); 50306 } 50307 [_symbol_utils.$isSplittable]() { 50308 const parent = this[_symbol_utils.$getSubformParent](); 50309 if (!parent[_symbol_utils.$isSplittable]()) { 50310 return false;
50311 } 50312 if (this[_symbol_utils.$extra]._isSplittable !== undefined) { 50313 return this[_symbol_utils.$extra]._isSplittable; 50314 } 50315 if (this.layout === "position" || this.layout.includes("row")) { 50316 this[_symbol_utils.$extra]._isSplittable = false; 50317 return false; 50318 } 50319 if (this.keep && this.keep.intact !== "none") { 50320 this[_symbol_utils.$extra]._isSplittable = false; 50321 return false; 50322 } 50323 if (parent.layout?.endsWith("-tb") && parent[_symbol_utils.$extra].numberInLine !== 0) { 50324 return false; 50325 } 50326 this[_symbol_utils.$extra]._isSplittable = true; 50327 return true; 50328 } 50329 [_symbol_utils.$toHTML](availableSpace) { 50330 setTabIndex(this); 50331 if (this.break) { 50332 if (this.break.after !== "auto" || this.break.afterTarget !== "") { 50333 const node = new BreakAfter({ 50334 targetType: this.break.after, 50335 target: this.break.afterTarget, 50336 startNew: this.break.startNew.toString() 50337 }); 50338 node[_symbol_utils.$globalData] = this[_symbol_utils.$globalData]; 50339 this[_symbol_utils.$appendChild](node); 50340 this.breakAfter.push(node); 50341 } 50342 if (this.break.before !== "auto" || this.break.beforeTarget !== "") { 50343 const node = new BreakBefore({ 50344 targetType: this.break.before, 50345 target: this.break.beforeTarget, 50346 startNew: this.break.startNew.toString() 50347 }); 50348 node[_symbol_utils.$globalData] = this[_symbol_utils.$globalData]; 50349 this[_symbol_utils.$appendChild](node); 50350 this.breakBefore.push(node); 50351 } 50352 if (this.break.overflowTarget !== "") { 50353 const node = new Overflow({ 50354 target: this.break.overflowTarget, 50355 leader: this.break.overflowLeader, 50356 trailer: this.break.overflowTrailer 50357 }); 50358 node[_symbol_utils.$globalData] = this[_symbol_utils.$globalData]; 50359 this[_symbol_utils.$appendChild](node); 50360 this.overflow.push(node); 50361 } 50362 this[_symbol_utils.$removeChild](this.break); 50363 this.break = null; 50364 } 50365 if (this.presence === "hidden" || this.presence === "inactive") { 50366 return _utils.HTMLResult.EMPTY; 50367 } 50368 if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) { 50369 (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug."); 50370 } 50371 if (this.breakBefore.children.length >= 1) { 50372 const breakBefore = this.breakBefore.children[0]; 50373 if (handleBreak(breakBefore)) { 50374 return _utils.HTMLResult.breakNode(breakBefore); 50375 } 50376 } 50377 if (this[_symbol_utils.$extra]?.afterBreakAfter) { 50378 return _utils.HTMLResult.EMPTY; 50379 } 50380 (0, _html_utils.fixDimensions)(this); 50381 const children = []; 50382 const attributes = { 50383 id: this[_symbol_utils.$uid], 50384 class: [] 50385 }; 50386 (0, _html_utils.setAccess)(this, attributes.class); 50387 if (!this[_symbol_utils.$extra]) { 50388 this[_symbol_utils.$extra] = Object.create(null); 50389 } 50390 Object.assign(this[_symbol_utils.$extra], { 50391 children, 50392 line: null, 50393 attributes, 50394 attempt: 0, 50395 numberInLine: 0, 50396 availableSpace: { 50397 width: Math.min(this.w || Infinity, availableSpace.width), 50398 height: Math.min(this.h || Infinity, availableSpace.height) 50399 }, 50400 width: 0, 50401 height: 0, 50402 prevHeight: 0, 50403 currentWidth: 0 50404 }); 50405 const root = this[_symbol_utils.$getTemplateRoot](); 50406 const savedNoLayoutFailure = root[_symbol_utils.$extra].noLayoutFailure; 50407 const isSplittable = this[_symbol_utils.$isSplittable](); 50408 if (!isSplittable) { 50409 setFirstUnsplittable(this); 50410 } 50411 if (!(0, _layout.checkDimensions)(this, availableSpace)) { 50412 return _utils.HTMLResult.FAILURE; 50413 } 50414 const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]); 50415 if (this.layout.includes("row")) { 50416 const columnWidths = this[_symbol_utils.$getSubformParent]().columnWidths; 50417 if (Array.isArray(columnWidths) && columnWidths.length > 0) { 50418 this[_symbol_utils.$extra].columnWidths = columnWidths; 50419 this[_symbol_utils.$extra].currentColumn = 0; 50420 } 50421 } 50422 const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); 50423 const classNames = ["xfaSubform"]; 50424 const cl = (0, _html_utils.layoutClass)(this); 50425 if (cl) { 50426 classNames.push(cl); 50427 } 50428 attributes.style = style; 50429 attributes.class = classNames; 50430 if (this.name) { 50431 attributes.xfaName = this.name; 50432 } 50433 if (this.overflow) { 50434 const overflowExtra = this.overflow[_symbol_utils.$getExtra](); 50435 if (overflowExtra.addLeader) { 50436 overflowExtra.addLeader = false;
50437 handleOverflow(this, overflowExtra.leader, availableSpace); 50438 } 50439 } 50440 this[_symbol_utils.$pushPara](); 50441 const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; 50442 const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; 50443 for (; this[_symbol_utils.$extra].attempt < maxRun; this[_symbol_utils.$extra].attempt++) { 50444 if (isLrTb && this[_symbol_utils.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { 50445 this[_symbol_utils.$extra].numberInLine = 0; 50446 } 50447 const result = this[_symbol_utils.$childrenToHTML]({ 50448 filter, 50449 include: true 50450 }); 50451 if (result.success) { 50452 break; 50453 } 50454 if (result.isBreak()) { 50455 this[_symbol_utils.$popPara](); 50456 return result; 50457 } 50458 if (isLrTb && this[_symbol_utils.$extra].attempt === 0 && this[_symbol_utils.$extra].numberInLine === 0 && !root[_symbol_utils.$extra].noLayoutFailure) { 50459 this[_symbol_utils.$extra].attempt = maxRun; 50460 break; 50461 } 50462 } 50463 this[_symbol_utils.$popPara](); 50464 if (!isSplittable) { 50465 unsetFirstUnsplittable(this); 50466 } 50467 root[_symbol_utils.$extra].noLayoutFailure = savedNoLayoutFailure; 50468 if (this[_symbol_utils.$extra].attempt === maxRun) { 50469 if (this.overflow) { 50470 this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].overflowNode = this.overflow; 50471 } 50472 if (!isSplittable) { 50473 delete this[_symbol_utils.$extra]; 50474 } 50475 return _utils.HTMLResult.FAILURE; 50476 } 50477 if (this.overflow) { 50478 const overflowExtra = this.overflow[_symbol_utils.$getExtra](); 50479 if (overflowExtra.addTrailer) { 50480 overflowExtra.addTrailer = false; 50481 handleOverflow(this, overflowExtra.trailer, availableSpace); 50482 } 50483 } 50484 let marginH = 0; 50485 let marginV = 0; 50486 if (this.margin) { 50487 marginH = this.margin.leftInset + this.margin.rightInset; 50488 marginV = this.margin.topInset + this.margin.bottomInset; 50489 } 50490 const width = Math.max(this[_symbol_utils.$extra].width + marginH, this.w || 0); 50491 const height = Math.max(this[_symbol_utils.$extra].height + marginV, this.h || 0); 50492 const bbox = [this.x, this.y, width, height]; 50493 if (this.w === "") { 50494 style.width = (0, _html_utils.measureToString)(width); 50495 } 50496 if (this.h === "") { 50497 style.height = (0, _html_utils.measureToString)(height); 50498 } 50499 if ((style.width === "0px" || style.height === "0px") && children.length === 0) { 50500 return _utils.HTMLResult.EMPTY; 50501 } 50502 const html = { 50503 name: "div", 50504 attributes, 50505 children 50506 }; 50507 applyAssist(this, attributes); 50508 const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); 50509 if (this.breakAfter.children.length >= 1) { 50510 const breakAfter = this.breakAfter.children[0]; 50511 if (handleBreak(breakAfter)) { 50512 this[_symbol_utils.$extra].afterBreakAfter = result; 50513 return _utils.HTMLResult.breakNode(breakAfter); 50514 } 50515 } 50516 delete this[_symbol_utils.$extra]; 50517 return result; 50518 } 50519} 50520class SubformSet extends _xfa_object.XFAObject { 50521 constructor(attributes) { 50522 super(TEMPLATE_NS_ID, "subformSet", true); 50523 this.id = attributes.id || ""; 50524 this.name = attributes.name || ""; 50525 this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]); 50526 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 50527 this.use = attributes.use || ""; 50528 this.usehref = attributes.usehref || ""; 50529 this.bookend = null; 50530 this.break = null; 50531 this.desc = null; 50532 this.extras = null; 50533 this.occur = null; 50534 this.overflow = null; 50535 this.breakAfter = new _xfa_object.XFAObjectArray(); 50536 this.breakBefore = new _xfa_object.XFAObjectArray(); 50537 this.subform = new _xfa_object.XFAObjectArray(); 50538 this.subformSet = new _xfa_object.XFAObjectArray(); 50539 } 50540 *[_symbol_utils.$getContainedChildren]() { 50541 yield* getContainedChildren(this); 50542 } 50543 [_symbol_utils.$getSubformParent]() { 50544 let parent = this[_symbol_utils.$getParent](); 50545 while (!(parent instanceof Subform)) { 50546 parent = parent[_symbol_utils.$getParent](); 50547 } 50548 return parent; 50549 } 50550 [_symbol_utils.$isBindable]() { 50551 return true; 50552 } 50553} 50554class SubjectDN extends _xfa_object.ContentObject { 50555 constructor(attributes) { 50556 super(TEMPLATE_NS_ID, "subjectDN"); 50557 this.delimiter = attributes.delimiter || ","; 50558 this.id = attributes.id || ""; 50559 this.name = attributes.name || ""; 50560 this.use = attributes.use || ""; 50561 this.usehref = attributes.usehref || ""; 50562 } 50563 [_symbol_utils.$finalize]() { 50564 this[_symbol_utils.$content] = new Map(this[_symbol_utils.$content].split(this.delimiter).map(kv => { 50565 kv = kv.split("=", 2); 50566 kv[0] = kv[0].trim(); 50567 return kv; 50568 })); 50569 } 50570} 50571class SubjectDNs extends _xfa_object.XFAObject { 50572 constructor(attributes) { 50573 super(TEMPLATE_NS_ID, "subjectDNs", true); 50574 this.id = attributes.id || ""; 50575 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 50576 this.use = attributes.use || ""; 50577 this.usehref = attributes.usehref || ""; 50578 this.subjectDN = new _xfa_object.XFAObjectArray(); 50579 } 50580} 50581class Submit extends _xfa_object.XFAObject { 50582 constructor(attributes) { 50583 super(TEMPLATE_NS_ID, "submit", true); 50584 this.embedPDF = (0, _utils.getInteger)({ 50585 data: attributes.embedPDF, 50586 defaultValue: 0, 50587 validate: x => x === 1 50588 }); 50589 this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]); 50590 this.id = attributes.id || ""; 50591 this.target = attributes.target || ""; 50592 this.textEncoding = (0, _utils.getKeyword)({ 50593 data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "", 50594 defaultValue: "", 50595 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}/) 50596 }); 50597 this.use = attributes.use || ""; 50598 this.usehref = attributes.usehref || ""; 50599 this.xdpContent = attributes.xdpContent || ""; 50600 this.encrypt = null; 50601 this.encryptData = new _xfa_object.XFAObjectArray(); 50602 this.signData = new _xfa_object.XFAObjectArray(); 50603 } 50604} 50605class Template extends _xfa_object.XFAObject { 50606 constructor(attributes) { 50607 super(TEMPLATE_NS_ID, "template", true); 50608 this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]); 50609 this.extras = null; 50610 this.subform = new _xfa_object.XFAObjectArray(); 50611 } 50612 [_symbol_utils.$finalize]() { 50613 if (this.subform.children.length === 0) { 50614 (0, _util.warn)("XFA - No subforms in template node."); 50615 } 50616 if (this.subform.children.length >= 2) { 50617 (0, _util.warn)("XFA - Several subforms in template node: please file a bug."); 50618 } 50619 this[_symbol_utils.$tabIndex] = DEFAULT_TAB_INDEX; 50620 } 50621 [_symbol_utils.$isSplittable]() { 50622 return true; 50623 } 50624 [_symbol_utils.$searchNode](expr, container) { 50625 if (expr.startsWith("#")) { 50626 return [this[_symbol_utils.$ids].get(expr.slice(1))]; 50627 } 50628 return (0, _som.searchNode)(this, container, expr, true, true); 50629 } 50630 *[_symbol_utils.$toPages]() { 50631 if (!this.subform.children.length) { 50632 return _utils.HTMLResult.success({ 50633 name: "div", 50634 children: [] 50635 }); 50636 } 50637 this[_symbol_utils.$extra] = { 50638 overflowNode: null, 50639 firstUnsplittable: null, 50640 currentContentArea: null, 50641 currentPageArea: null, 50642 noLayoutFailure: false, 50643 pageNumber: 1, 50644 pagePosition: "first", 50645 oddOrEven: "odd", 50646 blankOrNotBlank: "nonBlank", 50647 paraStack: [] 50648 }; 50649 const root = this.subform.children[0]; 50650 root.pageSet[_symbol_utils.$cleanPage](); 50651 const pageAreas = root.pageSet.pageArea.children; 50652 const mainHtml = { 50653 name: "div", 50654 children: [] 50655 }; 50656 let pageArea = null; 50657 let breakBefore = null; 50658 let breakBeforeTarget = null; 50659 if (root.breakBefore.children.length >= 1) { 50660 breakBefore = root.breakBefore.children[0]; 50661 breakBeforeTarget = breakBefore.target; 50662 } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) { 50663 breakBefore = root.subform.children[0].breakBefore.children[0]; 50664 breakBeforeTarget = breakBefore.target; 50665 } else if (root.break?.beforeTarget) { 50666 breakBefore = root.break; 50667 breakBeforeTarget = breakBefore.beforeTarget; 50668 } else if (root.subform.children.length >= 1 && root.subform.children[0].break?.beforeTarget) { 50669 breakBefore = root.subform.children[0].break; 50670 breakBeforeTarget = breakBefore.beforeTarget; 50671 } 50672 if (breakBefore) { 50673 const target = this[_symbol_utils.$searchNode](breakBeforeTarget, breakBefore[_symbol_utils.$getParent]()); 50674 if (target instanceof PageArea) { 50675 pageArea = target; 50676 breakBefore[_symbol_utils.$extra] = {}; 50677 } 50678 } 50679 if (!pageArea) { 50680 pageArea = pageAreas[0]; 50681 } 50682 pageArea[_symbol_utils.$extra] = { 50683 numberOfUse: 1 50684 }; 50685 const pageAreaParent = pageArea[_symbol_utils.$getParent](); 50686 pageAreaParent[_symbol_utils.$extra] = { 50687 numberOfUse: 1, 50688 pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea), 50689 pageSetIndex: 0 50690 }; 50691 let targetPageArea; 50692 let leader = null; 50693 let trailer = null; 50694 let hasSomething = true; 50695 let hasSomethingCounter = 0; 50696 let startIndex = 0; 50697 while (true) { 50698 if (!hasSomething) { 50699 mainHtml.children.pop(); 50700 if (++hasSomethingCounter === MAX_EMPTY_PAGES) { 50701 (0, _util.warn)("XFA - Something goes wrong: please file a bug."); 50702 return mainHtml; 50703 } 50704 } else { 50705 hasSomethingCounter = 0; 50706 } 50707 targetPageArea = null; 50708 this[_symbol_utils.$extra].currentPageArea = pageArea; 50709 const page = pageArea[_symbol_utils.$toHTML]().html; 50710 mainHtml.children.push(page); 50711 if (leader) { 50712 this[_symbol_utils.$extra].noLayoutFailure = true; 50713 page.children.push(leader[_symbol_utils.$toHTML](pageArea[_symbol_utils.$extra].space).html); 50714 leader = null; 50715 } 50716 if (trailer) { 50717 this[_symbol_utils.$extra].noLayoutFailure = true; 50718 page.children.push(trailer[_symbol_utils.$toHTML](pageArea[_symbol_utils.$extra].space).html); 50719 trailer = null; 50720 } 50721 const contentAreas = pageArea.contentArea.children; 50722 const htmlContentAreas = page.children.filter(node =>
50722 node.attributes.class.includes("xfaContentarea")); 50723 hasSomething = false; 50724 this[_symbol_utils.$extra].firstUnsplittable = null; 50725 this[_symbol_utils.$extra].noLayoutFailure = false; 50726 const flush = index => { 50727 const html = root[_symbol_utils.$flushHTML](); 50728 if (html) { 50729 hasSomething ||= html.children?.length > 0; 50730 htmlContentAreas[index].children.push(html); 50731 } 50732 }; 50733 for (let i = startIndex, ii = contentAreas.length; i < ii; i++) { 50734 const contentArea = this[_symbol_utils.$extra].currentContentArea = contentAreas[i]; 50735 const space = { 50736 width: contentArea.w, 50737 height: contentArea.h 50738 }; 50739 startIndex = 0; 50740 if (leader) { 50741 htmlContentAreas[i].children.push(leader[_symbol_utils.$toHTML](space).html); 50742 leader = null; 50743 } 50744 if (trailer) { 50745 htmlContentAreas[i].children.push(trailer[_symbol_utils.$toHTML](space).html); 50746 trailer = null; 50747 } 50748 const html = root[_symbol_utils.$toHTML](space); 50749 if (html.success) { 50750 if (html.html) { 50751 hasSomething ||= html.html.children?.length > 0; 50752 htmlContentAreas[i].children.push(html.html); 50753 } else if (!hasSomething && mainHtml.children.length > 1) { 50754 mainHtml.children.pop(); 50755 } 50756 return mainHtml; 50757 } 50758 if (html.isBreak()) { 50759 const node = html.breakNode; 50760 flush(i); 50761 if (node.targetType === "auto") { 50762 continue; 50763 } 50764 if (node.leader) { 50765 leader = this[_symbol_utils.$searchNode](node.leader, node[_symbol_utils.$getParent]()); 50766 leader = leader ? leader[0] : null; 50767 } 50768 if (node.trailer) { 50769 trailer = this[_symbol_utils.$searchNode](node.trailer, node[_symbol_utils.$getParent]()); 50770 trailer = trailer ? trailer[0] : null; 50771 } 50772 if (node.targetType === "pageArea") { 50773 targetPageArea = node[_symbol_utils.$extra].target; 50774 i = Infinity; 50775 } else if (!node[_symbol_utils.$extra].target) { 50776 i = node[_symbol_utils.$extra].index; 50777 } else { 50778 targetPageArea = node[_symbol_utils.$extra].target; 50779 startIndex = node[_symbol_utils.$extra].index + 1; 50780 i = Infinity; 50781 } 50782 continue; 50783 } 50784 if (this[_symbol_utils.$extra].overflowNode) { 50785 const node = this[_symbol_utils.$extra].overflowNode; 50786 this[_symbol_utils.$extra].overflowNode = null; 50787 const overflowExtra = node[_symbol_utils.$getExtra](); 50788 const target = overflowExtra.target; 50789 overflowExtra.addLeader = overflowExtra.leader !== null; 50790 overflowExtra.addTrailer = overflowExtra.trailer !== null; 50791 flush(i); 50792 const currentIndex = i; 50793 i = Infinity; 50794 if (target instanceof PageArea) { 50795 targetPageArea = target; 50796 } else if (target instanceof ContentArea) { 50797 const index = contentAreas.indexOf(target); 50798 if (index !== -1) { 50799 if (index > currentIndex) { 50800 i = index - 1; 50801 } else { 50802 startIndex = index; 50803 } 50804 } else { 50805 targetPageArea = target[_symbol_utils.$getParent](); 50806 startIndex = targetPageArea.contentArea.children.indexOf(target); 50807 } 50808 } 50809 continue; 50810 } 50811 flush(i); 50812 } 50813 this[_symbol_utils.$extra].pageNumber += 1; 50814 if (targetPageArea) { 50815 if (targetPageArea[_symbol_utils.$isUsable]()) { 50816 targetPageArea[_symbol_utils.$extra].numberOfUse += 1; 50817 } else { 50818 targetPageArea = null; 50819 } 50820 } 50821 pageArea = targetPageArea || pageArea[_symbol_utils.$getNextPage](); 50822 yield null; 50823 } 50824 } 50825} 50826exports.Template = Template; 50827class Text extends _xfa_object.ContentObject { 50828 constructor(attributes) { 50829 super(TEMPLATE_NS_ID, "text"); 50830 this.id = attributes.id || ""; 50831 this.maxChars = (0, _utils.getInteger)({ 50832 data: attributes.maxChars, 50833 defaultValue: 0, 50834 validate: x => x >= 0 50835 }); 50836 this.name = attributes.name || ""; 50837 this.rid = attributes.rid || ""; 50838 this.use = attributes.use || ""; 50839 this.usehref = attributes.usehref || ""; 50840 } 50841 [_symbol_utils.$acceptWhitespace]() { 50842 return true; 50843 } 50844 [_symbol_utils.$onChild](child) { 50845 if (child[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { 50846 this[_symbol_utils.$content] = child; 50847 return true; 50848 } 50849 (0, _util.warn)(`XFA - Invalid content in Text: ${child[_symbol_utils.$nodeName]}.`); 50850 return false;
50851 } 50852 [_symbol_utils.$onText](str) { 50853 if (this[_symbol_utils.$content] instanceof _xfa_object.XFAObject) { 50854 return; 50855 } 50856 super[_symbol_utils.$onText](str); 50857 } 50858 [_symbol_utils.$finalize]() { 50859 if (typeof this[_symbol_utils.$content] === "string") { 50860 this[_symbol_utils.$content] = this[_symbol_utils.$content].replaceAll("\r\n", "\n"); 50861 } 50862 } 50863 [_symbol_utils.$getExtra]() { 50864 if (typeof this[_symbol_utils.$content] === "string") { 50865 return this[_symbol_utils.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => { 50866 if (line) { 50867 acc.push(line); 50868 } 50869 return acc; 50870 }, []).join("\n"); 50871 } 50872 return this[_symbol_utils.$content][_symbol_utils.$text](); 50873 } 50874 [_symbol_utils.$toHTML](availableSpace) { 50875 if (typeof this[_symbol_utils.$content] === "string") { 50876 const html = valueToHtml(this[_symbol_utils.$content]).html; 50877 if (this[_symbol_utils.$content].includes("\u2029")) { 50878 html.name = "div"; 50879 html.children = []; 50880 this[_symbol_utils.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => { 50881 acc.push({ 50882 name: "span", 50883 value: line 50884 }, { 50885 name: "br" 50886 }); 50887 return acc; 50888 }, [])).forEach(lines => { 50889 html.children.push({ 50890 name: "p", 50891 children: lines 50892 }); 50893 }); 50894 } else if (/[\u2028\n]/.test(this[_symbol_utils.$content])) { 50895 html.name = "div"; 50896 html.children = []; 50897 this[_symbol_utils.$content].split(/[\u2028\n]/).forEach(line => { 50898 html.children.push({ 50899 name: "span", 50900 value: line 50901 }, { 50902 name: "br" 50903 }); 50904 }); 50905 } 50906 return _utils.HTMLResult.success(html); 50907 } 50908 return this[_symbol_utils.$content][_symbol_utils.$toHTML](availableSpace); 50909 } 50910} 50911exports.Text = Text; 50912class TextEdit extends _xfa_object.XFAObject { 50913 constructor(attributes) { 50914 super(TEMPLATE_NS_ID, "textEdit", true); 50915 this.allowRichText = (0, _utils.getInteger)({ 50916 data: attributes.allowRichText, 50917 defaultValue: 0, 50918 validate: x => x === 1 50919 }); 50920 this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); 50921 this.id = attributes.id || ""; 50922 this.multiLine = (0, _utils.getInteger)({ 50923 data: attributes.multiLine, 50924 defaultValue: "", 50925 validate: x => x === 0 || x === 1 50926 }); 50927 this.use = attributes.use || ""; 50928 this.usehref = attributes.usehref || ""; 50929 this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]); 50930 this.border = null; 50931 this.comb = null; 50932 this.extras = null; 50933 this.margin = null; 50934 } 50935 [_symbol_utils.$toHTML](availableSpace) { 50936 const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); 50937 let html; 50938 const field = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent](); 50939 if (this.multiLine === "") { 50940 this.multiLine = field instanceof Draw ? 1 : 0; 50941 } 50942 if (this.multiLine === 1) { 50943 html = { 50944 name: "textarea", 50945 attributes: { 50946 dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid], 50947 fieldId: field[_symbol_utils.$uid], 50948 class: ["xfaTextfield"], 50949 style, 50950 "aria-label": ariaLabel(field), 50951 "aria-required": false 50952 } 50953 }; 50954 } else { 50955 html = { 50956 name: "input", 50957 attributes: { 50958 type: "text", 50959 dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid], 50960 fieldId: field[_symbol_utils.$uid], 50961 class: ["xfaTextfield"], 50962 style, 50963 "aria-label": ariaLabel(field), 50964 "aria-required": false 50965 } 50966 }; 50967 } 50968 if (isRequired(field)) { 50969 html.attributes["aria-required"] = true; 50970 html.attributes.required = true; 50971 } 50972 return _utils.HTMLResult.success({ 50973 name: "label", 50974 attributes: { 50975 class: ["xfaLabel"] 50976 }, 50977 children: [html] 50978 }); 50979 } 50980} 50981class Time extends _xfa_object.StringObject { 50982 constructor(attributes) { 50983 super(TEMPLATE_NS_ID, "time"); 50984 this.id = attributes.id || ""; 50985 this.name = attributes.name || ""; 50986 this.use = attributes.use || ""; 50987 this.usehref = attributes.usehref || ""; 50988 } 50989 [_symbol_utils.$finalize]() { 50990 const date = this[_symbol_utils.$content].trim(); 50991 this[_symbol_utils.$content] = date ? new Date(date) : null; 50992 } 50993 [_symbol_utils.$toHTML](availableSpace) { 50994 return valueToHtml(this[_symbol_utils.$content] ? this[_symbol_utils.$content].toString() : ""); 50995 } 50996} 50997class TimeStamp extends _xfa_object.XFAObject { 50998 constructor(attributes) { 50999 super(TEMPLATE_NS_ID, "timeStamp"); 51000 this.id = attributes.id || ""; 51001 this.server = attributes.server || ""; 51002 this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]); 51003 this.use = attributes.use || ""; 51004 this.usehref = attributes.usehref || ""; 51005 } 51006} 51007class ToolTip extends _xfa_object.StringObject { 51008 constructor(attributes) { 51009 super(TEMPLATE_NS_ID, "toolTip"); 51010 this.id = attributes.id || ""; 51011 this.rid = attributes.rid || ""; 51012 this.use = attributes.use || ""; 51013 this.usehref = attributes.usehref || ""; 51014 } 51015} 51016class Traversal extends _xfa_object.XFAObject { 51017 constructor(attributes) { 51018 super(TEMPLATE_NS_ID, "traversal", true); 51019 this.id = attributes.id || ""; 51020 this.use = attributes.use || ""; 51021 this.usehref = attributes.usehref || ""; 51022 this.extras = null; 51023 this.traverse = new _xfa_object.XFAObjectArray(); 51024 } 51025} 51026class Traverse extends _xfa_object.XFAObject { 51027 constructor(attributes) { 51028 super(TEMPLATE_NS_ID, "traverse", true); 51029 this.id = attributes.id || ""; 51030 this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]); 51031 this.ref = attributes.ref || ""; 51032 this.use = attributes.use || ""; 51033 this.usehref = attributes.usehref || ""; 51034 this.extras = null; 51035 this.script = null; 51036 } 51037 get name() { 51038 return this.operation; 51039 } 51040 [_symbol_utils.$isTransparent]() { 51041 return false;
51042 } 51043} 51044class Ui extends _xfa_object.XFAObject { 51045 constructor(attributes) { 51046 super(TEMPLATE_NS_ID, "ui", true); 51047 this.id = attributes.id || ""; 51048 this.use = attributes.use || ""; 51049 this.usehref = attributes.usehref || ""; 51050 this.extras = null; 51051 this.picture = null; 51052 this.barcode = null; 51053 this.button = null; 51054 this.checkButton = null; 51055 this.choiceList = null; 51056 this.dateTimeEdit = null; 51057 this.defaultUi = null; 51058 this.imageEdit = null; 51059 this.numericEdit = null; 51060 this.passwordEdit = null; 51061 this.signature = null; 51062 this.textEdit = null; 51063 } 51064 [_symbol_utils.$getExtra]() { 51065 if (this[_symbol_utils.$extra] === undefined) { 51066 for (const name of Object.getOwnPropertyNames(this)) { 51067 if (name === "extras" || name === "picture") { 51068 continue; 51069 } 51070 const obj = this[name]; 51071 if (!(obj instanceof _xfa_object.XFAObject)) { 51072 continue; 51073 } 51074 this[_symbol_utils.$extra] = obj; 51075 return obj; 51076 } 51077 this[_symbol_utils.$extra] = null; 51078 } 51079 return this[_symbol_utils.$extra]; 51080 } 51081 [_symbol_utils.$toHTML](availableSpace) { 51082 const obj = this[_symbol_utils.$getExtra](); 51083 if (obj) { 51084 return obj[_symbol_utils.$toHTML](availableSpace); 51085 } 51086 return _utils.HTMLResult.EMPTY; 51087 } 51088} 51089class Validate extends _xfa_object.XFAObject { 51090 constructor(attributes) { 51091 super(TEMPLATE_NS_ID, "validate", true); 51092 this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]); 51093 this.id = attributes.id || ""; 51094 this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]); 51095 this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]); 51096 this.use = attributes.use || ""; 51097 this.usehref = attributes.usehref || ""; 51098 this.extras = null; 51099 this.message = null; 51100 this.picture = null; 51101 this.script = null; 51102 } 51103} 51104class Value extends _xfa_object.XFAObject { 51105 constructor(attributes) { 51106 super(TEMPLATE_NS_ID, "value", true); 51107 this.id = attributes.id || ""; 51108 this.override = (0, _utils.getInteger)({ 51109 data: attributes.override, 51110 defaultValue: 0, 51111 validate: x => x === 1 51112 }); 51113 this.relevant = (0, _utils.getRelevant)(attributes.relevant); 51114 this.use = attributes.use || ""; 51115 this.usehref = attributes.usehref || ""; 51116 this.arc = null; 51117 this.boolean = null; 51118 this.date = null; 51119 this.dateTime = null; 51120 this.decimal = null; 51121 this.exData = null; 51122 this.float = null; 51123 this.image = null; 51124 this.integer = null; 51125 this.line = null; 51126 this.rectangle = null; 51127 this.text = null; 51128 this.time = null; 51129 } 51130 [_symbol_utils.$setValue](value) { 51131 const parent = this[_symbol_utils.$getParent](); 51132 if (parent instanceof Field) { 51133 if (parent.ui?.imageEdit) { 51134 if (!this.image) { 51135 this.image = new Image({}); 51136 this[_symbol_utils.$appendChild](this.image); 51137 } 51138 this.image[_symbol_utils.$content] = value[_symbol_utils.$content]; 51139 return; 51140 } 51141 } 51142 const valueName = value[_symbol_utils.$nodeName]; 51143 if (this[valueName] !== null) { 51144 this[valueName][_symbol_utils.$content] = value[_symbol_utils.$content]; 51145 return; 51146 } 51147 for (const name of Object.getOwnPropertyNames(this)) { 51148 const obj = this[name]; 51149 if (obj instanceof _xfa_object.XFAObject) { 51150 this[name] = null; 51151 this[_symbol_utils.$removeChild](obj); 51152 } 51153 } 51154 this[value[_symbol_utils.$nodeName]] = value; 51155 this[_symbol_utils.$appendChild](value); 51156 } 51157 [_symbol_utils.$text]() { 51158 if (this.exData) { 51159 if (typeof this.exData[_symbol_utils.$content] === "string") { 51160 return this.exData[_symbol_utils.$content].trim(); 51161 } 51162 return this.exData[_symbol_utils.$content][_symbol_utils.$text]().trim(); 51163 } 51164 for (const name of Object.getOwnPropertyNames(this)) { 51165 if (name === "image") { 51166 continue; 51167 } 51168 const obj = this[name]; 51169 if (obj instanceof _xfa_object.XFAObject) { 51170 return (obj[_symbol_utils.$content] || "").toString().trim(); 51171 } 51172 } 51173 return null; 51174 } 51175 [_symbol_utils.$toHTML](availableSpace) {
51176 for (const name of Object.getOwnPropertyNames(this)) { 51177 const obj = this[name]; 51178 if (!(obj instanceof _xfa_object.XFAObject)) { 51179 continue; 51180 } 51181 return obj[_symbol_utils.$toHTML](availableSpace); 51182 } 51183 return _utils.HTMLResult.EMPTY; 51184 } 51185} 51186exports.Value = Value; 51187class Variables extends _xfa_object.XFAObject { 51188 constructor(attributes) { 51189 super(TEMPLATE_NS_ID, "variables", true); 51190 this.id = attributes.id || ""; 51191 this.use = attributes.use || ""; 51192 this.usehref = attributes.usehref || ""; 51193 this.boolean = new _xfa_object.XFAObjectArray(); 51194 this.date = new _xfa_object.XFAObjectArray(); 51195 this.dateTime = new _xfa_object.XFAObjectArray(); 51196 this.decimal = new _xfa_object.XFAObjectArray(); 51197 this.exData = new _xfa_object.XFAObjectArray(); 51198 this.float = new _xfa_object.XFAObjectArray(); 51199 this.image = new _xfa_object.XFAObjectArray(); 51200 this.integer = new _xfa_object.XFAObjectArray(); 51201 this.manifest = new _xfa_object.XFAObjectArray(); 51202 this.script = new _xfa_object.XFAObjectArray(); 51203 this.text = new _xfa_object.XFAObjectArray(); 51204 this.time = new _xfa_object.XFAObjectArray(); 51205 } 51206 [_symbol_utils.$isTransparent]() { 51207 return true; 51208 } 51209} 51210class TemplateNamespace { 51211 static [_namespaces.$buildXFAObject](name, attributes) { 51212 if (TemplateNamespace.hasOwnProperty(name)) { 51213 const node = TemplateNamespace[name](attributes); 51214 node[_symbol_utils.$setSetAttributes](attributes); 51215 return node; 51216 } 51217 return undefined; 51218 } 51219 static appearanceFilter(attrs) { 51220 return new AppearanceFilter(attrs); 51221 } 51222 static arc(attrs) { 51223 return new Arc(attrs); 51224 } 51225 static area(attrs) { 51226 return new Area(attrs); 51227 } 51228 static assist(attrs) { 51229 return new Assist(attrs); 51230 } 51231 static barcode(attrs) { 51232 return new Barcode(attrs); 51233 } 51234 static bind(attrs) { 51235 return new Bind(attrs); 51236 } 51237 static bindItems(attrs) { 51238 return new BindItems(attrs); 51239 } 51240 static bookend(attrs) { 51241 return new Bookend(attrs); 51242 } 51243 static boolean(attrs) { 51244 return new BooleanElement(attrs); 51245 } 51246 static border(attrs) { 51247 return new Border(attrs); 51248 } 51249 static break(attrs) { 51250 return new Break(attrs); 51251 } 51252 static breakAfter(attrs) { 51253 return new BreakAfter(attrs); 51254 } 51255 static breakBefore(attrs) { 51256 return new BreakBefore(attrs); 51257 } 51258 static button(attrs) { 51259 return new Button(attrs); 51260 } 51261 static calculate(attrs) { 51262 return new Calculate(attrs); 51263 } 51264 static caption(attrs) { 51265 return new Caption(attrs); 51266 } 51267 static certificate(attrs) { 51268 return new Certificate(attrs); 51269 } 51270 static certificates(attrs) { 51271 return new Certificates(attrs); 51272 } 51273 static checkButton(attrs) { 51274 return new CheckButton(attrs); 51275 } 51276 static choiceList(attrs) { 51277 return new ChoiceList(attrs); 51278 } 51279 static color(attrs) { 51280 return new Color(attrs); 51281 } 51282 static comb(attrs) { 51283 return new Comb(attrs); 51284 } 51285 static connect(attrs) { 51286 return new Connect(attrs); 51287 } 51288 static contentArea(attrs) { 51289 return new ContentArea(attrs); 51290 } 51291 static corner(attrs) { 51292 return new Corner(attrs); 51293 } 51294 static date(attrs) { 51295 return new DateElement(attrs); 51296 } 51297 static dateTime(attrs) { 51298 return new DateTime(attrs); 51299 } 51300 static dateTimeEdit(attrs) { 51301 return new DateTimeEdit(attrs); 51302 } 51303 static decimal(attrs) { 51304 return new Decimal(attrs); 51305 } 51306 static defaultUi(attrs) { 51307 return new DefaultUi(attrs); 51308 } 51309 static desc(attrs) { 51310 return new Desc(attrs); 51311 } 51312 static digestMethod(attrs) { 51313 return new DigestMethod(attrs); 51314 } 51315 static digestMethods(attrs) { 51316 return new DigestMethods(attrs); 51317 } 51318 static draw(attrs) { 51319 return new Draw(attrs); 51320 } 51321 static edge(attrs) { 51322 return new Edge(attrs); 51323 } 51324 static encoding(attrs) { 51325 return new Encoding(attrs); 51326 } 51327 static encodings(attrs) { 51328 return new Encodings(attrs); 51329 } 51330 static encrypt(attrs) { 51331 return new Encrypt(attrs); 51332 } 51333 static encryptData(attrs) { 51334 return new EncryptData(attrs); 51335 } 51336 static encryption(attrs) { 51337 return new Encryption(attrs); 51338 } 51339 static encryptionMethod(attrs) { 51340 return new EncryptionMethod(attrs); 51341 } 51342 static encryptionMethods(attrs) { 51343 return new EncryptionMethods(attrs); 51344 } 51345 static event(attrs) { 51346 return new Event(attrs); 51347 } 51348 static exData(attrs) { 51349 return new ExData(attrs); 51350 } 51351 static exObject(attrs) { 51352 return new ExObject(attrs); 51353 } 51354 static exclGroup(attrs) { 51355 return new ExclGroup(attrs); 51356 } 51357 static execute(attrs) { 51358 return new Execute(attrs); 51359 } 51360 static extras(attrs) { 51361 return new Extras(attrs); 51362 } 51363 static field(attrs) { 51364 return new Field(attrs); 51365 } 51366 static fill(attrs) { 51367 return new Fill(attrs); 51368 } 51369 static filter(attrs) { 51370 return new Filter(attrs); 51371 } 51372 static float(attrs) { 51373 return new Float(attrs); 51374 } 51375 static font(attrs) { 51376 return new Font(attrs); 51377 } 51378 static format(attrs) { 51379 return new Format(attrs); 51380 } 51381 static handler(attrs) { 51382 return new Handler(attrs); 51383 } 51384 static hyphenation(attrs) { 51385 return new Hyphenation(attrs); 51386 } 51387 static image(attrs) { 51388 return new Image(attrs); 51389 } 51390 static imageEdit(attrs) { 51391 return new ImageEdit(attrs); 51392 } 51393 static integer(attrs) { 51394 return new Integer(attrs); 51395 } 51396 static issuers(attrs) { 51397 return new Issuers(attrs); 51398 } 51399 static items(attrs) { 51400 return new Items(attrs); 51401 } 51402 static keep(attrs) { 51403 return new Keep(attrs); 51404 } 51405 static keyUsage(attrs) { 51406 return new KeyUsage(attrs); 51407 } 51408 static line(attrs) { 51409 return new Line(attrs); 51410 } 51411 static linear(attrs) { 51412 return new Linear(attrs); 51413 } 51414 static lockDocument(attrs) { 51415 return new LockDocument(attrs); 51416 } 51417 static manifest(attrs) { 51418 return new Manifest(attrs); 51419 } 51420 static margin(attrs) { 51421 return new Margin(attrs); 51422 } 51423 static mdp(attrs) { 51424 return new Mdp(attrs); 51425 } 51426 static medium(attrs) { 51427 return new Medium(attrs); 51428 } 51429 static message(attrs) {
51430 return new Message(attrs); 51431 } 51432 static numericEdit(attrs) { 51433 return new NumericEdit(attrs); 51434 } 51435 static occur(attrs) { 51436 return new Occur(attrs); 51437 } 51438 static oid(attrs) { 51439 return new Oid(attrs); 51440 } 51441 static oids(attrs) { 51442 return new Oids(attrs); 51443 } 51444 static overflow(attrs) { 51445 return new Overflow(attrs); 51446 } 51447 static pageArea(attrs) { 51448 return new PageArea(attrs); 51449 } 51450 static pageSet(attrs) { 51451 return new PageSet(attrs); 51452 } 51453 static para(attrs) { 51454 return new Para(attrs); 51455 } 51456 static passwordEdit(attrs) { 51457 return new PasswordEdit(attrs); 51458 } 51459 static pattern(attrs) { 51460 return new Pattern(attrs); 51461 } 51462 static picture(attrs) { 51463 return new Picture(attrs); 51464 } 51465 static proto(attrs) { 51466 return new Proto(attrs); 51467 } 51468 static radial(attrs) { 51469 return new Radial(attrs); 51470 } 51471 static reason(attrs) { 51472 return new Reason(attrs); 51473 } 51474 static reasons(attrs) { 51475 return new Reasons(attrs); 51476 } 51477 static rectangle(attrs) { 51478 return new Rectangle(attrs); 51479 } 51480 static ref(attrs) { 51481 return new RefElement(attrs); 51482 } 51483 static script(attrs) { 51484 return new Script(attrs); 51485 } 51486 static setProperty(attrs) { 51487 return new SetProperty(attrs); 51488 } 51489 static signData(attrs) { 51490 return new SignData(attrs); 51491 } 51492 static signature(attrs) { 51493 return new Signature(attrs); 51494 } 51495 static signing(attrs) { 51496 return new Signing(attrs); 51497 } 51498 static solid(attrs) { 51499 return new Solid(attrs); 51500 } 51501 static speak(attrs) { 51502 return new Speak(attrs); 51503 } 51504 static stipple(attrs) { 51505 return new Stipple(attrs); 51506 } 51507 static subform(attrs) { 51508 return new Subform(attrs); 51509 } 51510 static subformSet(attrs) { 51511 return new SubformSet(attrs); 51512 } 51513 static subjectDN(attrs) { 51514 return new SubjectDN(attrs); 51515 } 51516 static subjectDNs(attrs) { 51517 return new SubjectDNs(attrs); 51518 } 51519 static submit(attrs) { 51520 return new Submit(attrs); 51521 } 51522 static template(attrs) { 51523 return new Template(attrs); 51524 } 51525 static text(attrs) { 51526 return new Text(attrs); 51527 } 51528 static textEdit(attrs) { 51529 return new TextEdit(attrs); 51530 } 51531 static time(attrs) { 51532 return new Time(attrs); 51533 } 51534 static timeStamp(attrs) { 51535 return new TimeStamp(attrs); 51536 } 51537 static toolTip(attrs) { 51538 return new ToolTip(attrs); 51539 } 51540 static traversal(attrs) { 51541 return new Traversal(attrs); 51542 } 51543 static traverse(attrs) { 51544 return new Traverse(attrs); 51545 } 51546 static ui(attrs) { 51547 return new Ui(attrs); 51548 } 51549 static validate(attrs) { 51550 return new Validate(attrs); 51551 } 51552 static value(attrs) { 51553 return new Value(attrs); 51554 } 51555 static variables(attrs) { 51556 return new Variables(attrs); 51557 } 51558} 51559exports.TemplateNamespace = TemplateNamespace; 51560 51561/***/ }), 51562/* 81 */ 51563/***/ ((__unused_webpack_module, exports) => { 51564 51565 51566 51567Object.defineProperty(exports, "__esModule", ({ 51568 value: true 51569})); 51570exports.NamespaceIds = exports.$buildXFAObject = void 0; 51571const $buildXFAObject = Symbol(); 51572exports.$buildXFAObject = $buildXFAObject; 51573const NamespaceIds = { 51574 config: { 51575 id: 0, 51576 check: ns => ns.startsWith("http://www.xfa.org/schema/xci/") 51577 }, 51578 connectionSet: { 51579 id: 1, 51580 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/") 51581 }, 51582 datasets: { 51583 id: 2, 51584 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/") 51585 }, 51586 form: { 51587 id: 3, 51588 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/") 51589 }, 51590 localeSet: { 51591 id: 4, 51592 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/") 51593 }, 51594 pdf: { 51595 id: 5, 51596 check: ns => ns === "http://ns.adobe.com/xdp/pdf/" 51597 }, 51598 signature: { 51599 id: 6, 51600 check: ns => ns === "http://www.w3.org/2000/09/xmldsig#" 51601 }, 51602 sourceSet: { 51603 id: 7, 51604 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/") 51605 }, 51606 stylesheet: { 51607 id: 8, 51608 check: ns => ns === "http://www.w3.org/1999/XSL/Transform" 51609 }, 51610 template: { 51611 id: 9, 51612 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/") 51613 }, 51614 xdc: { 51615 id: 10, 51616 check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/") 51617 }, 51618 xdp: { 51619 id: 11, 51620 check: ns => ns === "http://ns.adobe.com/xdp/" 51621 }, 51622 xfdf: { 51623 id: 12, 51624 check: ns => ns === "http://ns.adobe.com/xfdf/" 51625 }, 51626 xhtml: { 51627 id: 13, 51628 check: ns => ns === "http://www.w3.org/1999/xhtml" 51629 }, 51630 xmpmeta: { 51631 id: 14, 51632 check: ns => ns === "http://ns.adobe.com/xmpmeta/" 51633 } 51634}; 51635exports.NamespaceIds = NamespaceIds; 51636 51637/***/ }), 51638/* 82 */ 51639/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 51640 51641 51642 51643Object.defineProperty(exports, "__esModule", ({ 51644 value: true 51645})); 51646exports.addHTML = addHTML;
vendor: 4,486 bytes, lines 51647-51794
51647exports.checkDimensions = checkDimensions; 51648exports.flushHTML = flushHTML; 51649exports.getAvailableSpace = getAvailableSpace; 51650var _symbol_utils = __w_pdfjs_require__(78); 51651var _html_utils = __w_pdfjs_require__(83); 51652function createLine(node, children) { 51653 return { 51654 name: "div", 51655 attributes: { 51656 class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"] 51657 }, 51658 children 51659 }; 51660} 51661function flushHTML(node) { 51662 if (!node[_symbol_utils.$extra]) { 51663 return null; 51664 } 51665 const attributes = node[_symbol_utils.$extra].attributes; 51666 const html = { 51667 name: "div", 51668 attributes, 51669 children: node[_symbol_utils.$extra].children 51670 }; 51671 if (node[_symbol_utils.$extra].failingNode) { 51672 const htmlFromFailing = node[_symbol_utils.$extra].failingNode[_symbol_utils.$flushHTML](); 51673 if (htmlFromFailing) { 51674 if (node.layout.endsWith("-tb")) { 51675 html.children.push(createLine(node, [htmlFromFailing])); 51676 } else { 51677 html.children.push(htmlFromFailing); 51678 } 51679 } 51680 } 51681 if (html.children.length === 0) { 51682 return null; 51683 } 51684 return html; 51685} 51686function addHTML(node, html, bbox) { 51687 const extra = node[_symbol_utils.$extra]; 51688 const availableSpace = extra.availableSpace; 51689 const [x, y, w, h] = bbox; 51690 switch (node.layout) { 51691 case "position": 51692 { 51693 extra.width = Math.max(extra.width, x + w); 51694 extra.height = Math.max(extra.height, y + h); 51695 extra.children.push(html); 51696 break; 51697 } 51698 case "lr-tb": 51699 case "rl-tb": 51700 if (!extra.line || extra.attempt === 1) { 51701 extra.line = createLine(node, []); 51702 extra.children.push(extra.line); 51703 extra.numberInLine = 0; 51704 } 51705 extra.numberInLine += 1; 51706 extra.line.children.push(html); 51707 if (extra.attempt === 0) { 51708 extra.currentWidth += w; 51709 extra.height = Math.max(extra.height, extra.prevHeight + h); 51710 } else { 51711 extra.currentWidth = w; 51712 extra.prevHeight = extra.height; 51713 extra.height += h; 51714 extra.attempt = 0; 51715 } 51716 extra.width = Math.max(extra.width, extra.currentWidth); 51717 break; 51718 case "rl-row": 51719 case "row": 51720 { 51721 extra.children.push(html); 51722 extra.width += w; 51723 extra.height = Math.max(extra.height, h); 51724 const height = (0, _html_utils.measureToString)(extra.height); 51725 for (const child of extra.children) { 51726 child.attributes.style.height = height; 51727 } 51728 break; 51729 } 51730 case "table": 51731 { 51732 extra.width = Math.min(availableSpace.width, Math.max(extra.width, w)); 51733 extra.height += h; 51734 extra.children.push(html); 51735 break; 51736 } 51737 case "tb": 51738 { 51739 extra.width = Math.min(availableSpace.width, Math.max(extra.width, w)); 51740 extra.height += h; 51741 extra.children.push(html); 51742 break; 51743 } 51744 } 51745} 51746function getAvailableSpace(node) { 51747 const availableSpace = node[_symbol_utils.$extra].availableSpace; 51748 const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0; 51749 const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0; 51750 switch (node.layout) { 51751 case "lr-tb": 51752 case "rl-tb": 51753 if (node[_symbol_utils.$extra].attempt === 0) { 51754 return { 51755 width: availableSpace.width - marginH - node[_symbol_utils.$extra].currentWidth, 51756 height: availableSpace.height - marginV - node[_symbol_utils.$extra].prevHeight 51757 }; 51758 } 51759 return { 51760 width: availableSpace.width - marginH, 51761 height: availableSpace.height - marginV - node[_symbol_utils.$extra].height 51762 }; 51763 case "rl-row": 51764 case "row": 51765 const width = node[_symbol_utils.$extra].columnWidths.slice(node[_symbol_utils.$extra].currentColumn).reduce((a, x) => a + x); 51766 return { 51767 width, 51768 height: availableSpace.height - marginH 51769 }; 51770 case "table": 51771 case "tb": 51772 return { 51773 width: availableSpace.width - marginH, 51774 height: availableSpace.height - marginV - node[_symbol_utils.$extra].height 51775 }; 51776 case "position": 51777 default: 51778 return availableSpace; 51779 } 51780} 51781function getTransformedBBox(node) { 51782 let w = node.w === "" ? NaN : node.w; 51783 let h = node.h === "" ? NaN : node.h; 51784 let [centerX, centerY] = [0, 0]; 51785 switch (node.anchorType || "") { 51786 case "bottomCenter": 51787 [centerX, centerY] = [w / 2, h]; 51788 break; 51789 case "bottomLeft": 51790 [centerX, centerY] = [0, h]; 51791 break; 51792 case "bottomRight": 51793 [centerX, centerY] = [w, h]; 51794 break;
51795 case "middleCenter": 51796 [centerX, centerY] = [w / 2, h / 2]; 51797 break; 51798 case "middleLeft": 51799 [centerX, centerY] = [0, h / 2]; 51800 break; 51801 case "middleRight": 51802 [centerX, centerY] = [w, h / 2]; 51803 break; 51804 case "topCenter": 51805 [centerX, centerY] = [w / 2, 0]; 51806 break; 51807 case "topRight": 51808 [centerX, centerY] = [w, 0]; 51809 break; 51810 } 51811 let x, y; 51812 switch (node.rotate || 0) { 51813 case 0: 51814 [x, y] = [-centerX, -centerY]; 51815 break; 51816 case 90: 51817 [x, y] = [-centerY, centerX]; 51818 [w, h] = [h, -w]; 51819 break; 51820 case 180: 51821 [x, y] = [centerX, centerY]; 51822 [w, h] = [-w, -h]; 51823 break; 51824 case 270: 51825 [x, y] = [centerY, -centerX]; 51826 [w, h] = [-h, w]; 51827 break; 51828 } 51829 return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)]; 51830} 51831function checkDimensions(node, space) { 51832 if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].firstUnsplittable === null) { 51833 return true; 51834 } 51835 if (node.w === 0 || node.h === 0) { 51836 return true; 51837 } 51838 const ERROR = 2; 51839 const parent = node[_symbol_utils.$getSubformParent](); 51840 const attempt = parent[_symbol_utils.$extra]?.attempt || 0; 51841 const [, y, w, h] = getTransformedBBox(node); 51842 switch (parent.layout) { 51843 case "lr-tb": 51844 case "rl-tb": 51845 if (attempt === 0) { 51846 if (!node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) { 51847 if (node.h !== "" && Math.round(h - space.height) > ERROR) { 51848 return false; 51849 } 51850 if (node.w !== "") { 51851 if (Math.round(w - space.width) <= ERROR) { 51852 return true; 51853 } 51854 if (parent[_symbol_utils.$extra].numberInLine === 0) { 51855 return space.height > ERROR; 51856 } 51857 return false; 51858 } 51859 return space.width > ERROR; 51860 } 51861 if (node.w !== "") { 51862 return Math.round(w - space.width) <= ERROR; 51863 } 51864 return space.width > ERROR; 51865 } 51866 if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) { 51867 return true; 51868 } 51869 if (node.h !== "" && Math.round(h - space.height) > ERROR) { 51870 return false; 51871 } 51872 if (node.w === "" || Math.round(w - space.width) <= ERROR) { 51873 return space.height > ERROR; 51874 } 51875 if (parent[_symbol_utils.$isThereMoreWidth]()) { 51876 return false; 51877 } 51878 return space.height > ERROR; 51879 case "table": 51880 case "tb": 51881 if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) { 51882 return true; 51883 } 51884 if (node.h !== "" && !node[_symbol_utils.$isSplittable]()) { 51885 return Math.round(h - space.height) <= ERROR; 51886 } 51887 if (node.w === "" || Math.round(w - space.width) <= ERROR) { 51888 return space.height > ERROR; 51889 } 51890 if (parent[_symbol_utils.$isThereMoreWidth]()) { 51891 return false; 51892 } 51893 return space.height > ERROR; 51894 case "position": 51895 if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) { 51896 return true; 51897 } 51898 if (node.h === "" || Math.round(h + y - space.height) <= ERROR) { 51899 return true; 51900 } 51901 const area = node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].currentContentArea; 51902 return h + y > area.h; 51903 case "rl-row": 51904 case "row": 51905 if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) { 51906 return true; 51907 } 51908 if (node.h !== "") { 51909 return Math.round(h - space.height) <= ERROR; 51910 } 51911 return true; 51912 default: 51913 return true; 51914 } 51915} 51916 51917/***/ }), 51918/* 83 */ 51919/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 51920 51921 51922 51923Object.defineProperty(exports, "__esModule", ({ 51924 value: true 51925})); 51926exports.computeBbox = computeBbox; 51927exports.createWrapper = createWrapper; 51928exports.fixDimensions = fixDimensions; 51929exports.fixTextIndent = fixTextIndent; 51930exports.fixURL = fixURL; 51931exports.isPrintOnly = isPrintOnly; 51932exports.layoutClass = layoutClass; 51933exports.layoutNode = layoutNode; 51934exports.measureToString = measureToString; 51935exports.setAccess = setAccess; 51936exports.setFontFamily = setFontFamily; 51937exports.setMinMaxDimensions = setMinMaxDimensions; 51938exports.setPara = setPara; 51939exports.toStyle = toStyle; 51940var _symbol_utils = __w_pdfjs_require__(78); 51941var _util = __w_pdfjs_require__(2); 51942var _utils = __w_pdfjs_require__(84); 51943var _fonts = __w_pdfjs_require__(85); 51944var _text = __w_pdfjs_require__(86); 51945var _xfa_object = __w_pdfjs_require__(87); 51946function measureToString(m) { 51947 if (typeof m === "string") { 51948 return "0px"; 51949 } 51950 return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`; 51951} 51952const converters = { 51953 anchorType(node, style) { 51954 const parent = node[_symbol_utils.$getSubformParent](); 51955 if (!parent || parent.layout && parent.layout !== "position") { 51956 return; 51957 } 51958 if (!("transform" in style)) { 51959 style.transform = ""; 51960 } 51961 switch (node.anchorType) { 51962 case "bottomCenter": 51963 style.transform += "translate(-50%, -100%)"; 51964 break; 51965 case "bottomLeft": 51966 style.transform += "translate(0,-100%)"; 51967 break; 51968 case "bottomRight": 51969 style.transform += "translate(-100%,-100%)"; 51970 break;
vendor: 28,037 bytes, lines 51971-52982
51971 case "middleCenter": 51972 style.transform += "translate(-50%,-50%)"; 51973 break; 51974 case "middleLeft": 51975 style.transform += "translate(0,-50%)"; 51976 break; 51977 case "middleRight": 51978 style.transform += "translate(-100%,-50%)"; 51979 break; 51980 case "topCenter": 51981 style.transform += "translate(-50%,0)"; 51982 break; 51983 case "topRight": 51984 style.transform += "translate(-100%,0)"; 51985 break; 51986 } 51987 }, 51988 dimensions(node, style) { 51989 const parent = node[_symbol_utils.$getSubformParent](); 51990 let width = node.w; 51991 const height = node.h; 51992 if (parent.layout?.includes("row")) { 51993 const extra = parent[_symbol_utils.$extra]; 51994 const colSpan = node.colSpan; 51995 let w; 51996 if (colSpan === -1) { 51997 w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0); 51998 extra.currentColumn = 0; 51999 } else { 52000 w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0); 52001 extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length; 52002 } 52003 if (!isNaN(w)) { 52004 width = node.w = w; 52005 } 52006 } 52007 style.width = width !== "" ? measureToString(width) : "auto"; 52008 style.height = height !== "" ? measureToString(height) : "auto"; 52009 }, 52010 position(node, style) { 52011 const parent = node[_symbol_utils.$getSubformParent](); 52012 if (parent?.layout && parent.layout !== "position") { 52013 return; 52014 } 52015 style.position = "absolute"; 52016 style.left = measureToString(node.x); 52017 style.top = measureToString(node.y); 52018 }, 52019 rotate(node, style) { 52020 if (node.rotate) { 52021 if (!("transform" in style)) { 52022 style.transform = ""; 52023 } 52024 style.transform += `rotate(-${node.rotate}deg)`; 52025 style.transformOrigin = "top left"; 52026 } 52027 }, 52028 presence(node, style) { 52029 switch (node.presence) { 52030 case "invisible": 52031 style.visibility = "hidden"; 52032 break; 52033 case "hidden": 52034 case "inactive": 52035 style.display = "none"; 52036 break; 52037 } 52038 }, 52039 hAlign(node, style) { 52040 if (node[_symbol_utils.$nodeName] === "para") { 52041 switch (node.hAlign) { 52042 case "justifyAll": 52043 style.textAlign = "justify-all"; 52044 break; 52045 case "radix": 52046 style.textAlign = "left"; 52047 break; 52048 default: 52049 style.textAlign = node.hAlign; 52050 } 52051 } else { 52052 switch (node.hAlign) { 52053 case "left": 52054 style.alignSelf = "start"; 52055 break; 52056 case "center": 52057 style.alignSelf = "center"; 52058 break; 52059 case "right": 52060 style.alignSelf = "end"; 52061 break; 52062 } 52063 } 52064 }, 52065 margin(node, style) { 52066 if (node.margin) { 52067 style.margin = node.margin[_symbol_utils.$toStyle]().margin; 52068 } 52069 } 52070}; 52071function setMinMaxDimensions(node, style) { 52072 const parent = node[_symbol_utils.$getSubformParent](); 52073 if (parent.layout === "position") { 52074 if (node.minW > 0) { 52075 style.minWidth = measureToString(node.minW); 52076 } 52077 if (node.maxW > 0) { 52078 style.maxWidth = measureToString(node.maxW); 52079 } 52080 if (node.minH > 0) { 52081 style.minHeight = measureToString(node.minH); 52082 } 52083 if (node.maxH > 0) { 52084 style.maxHeight = measureToString(node.maxH); 52085 } 52086 } 52087} 52088function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) { 52089 const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder); 52090 if (typeof text === "string") { 52091 measure.addString(text); 52092 } else { 52093 text[_symbol_utils.$pushGlyphs](measure); 52094 } 52095 return measure.compute(width); 52096} 52097function layoutNode(node, availableSpace) { 52098 let height = null; 52099 let width = null; 52100 let isBroken = false; 52101 if ((!node.w || !node.h) && node.value) { 52102 let marginH = 0; 52103 let marginV = 0; 52104 if (node.margin) { 52105 marginH = node.margin.leftInset + node.margin.rightInset; 52106 marginV = node.margin.topInset + node.margin.bottomInset; 52107 } 52108 let lineHeight = null; 52109 let margin = null; 52110 if (node.para) { 52111 margin = Object.create(null); 52112 lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight; 52113 margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove; 52114 margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow; 52115 margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft; 52116 margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight; 52117 } 52118 let font = node.font; 52119 if (!font) { 52120 const root = node[_symbol_utils.$getTemplateRoot](); 52121 let parent = node[_symbol_utils.$getParent](); 52122 while (parent && parent !== root) { 52123 if (parent.font) { 52124 font = parent.font; 52125 break; 52126 } 52127 parent = parent[_symbol_utils.$getParent](); 52128 } 52129 } 52130 const maxWidth = (node.w || availableSpace.width) - marginH; 52131 const fontFinder = node[_symbol_utils.$globalData].fontFinder; 52132 if (node.value.exData && node.value.exData[_symbol_utils.$content] && node.value.exData.contentType === "text/html") { 52133 const res = layoutText(node.value.exData[_symbol_utils.$content], font, margin, lineHeight, fontFinder, maxWidth); 52134 width = res.width; 52135 height = res.height; 52136 isBroken = res.isBroken; 52137 } else { 52138 const text = node.value[_symbol_utils.$text](); 52139 if (text) { 52140 const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth); 52141 width = res.width; 52142 height = res.height; 52143 isBroken = res.isBroken; 52144 } 52145 } 52146 if (width !== null && !node.w) { 52147 width += marginH; 52148 } 52149 if (height !== null && !node.h) { 52150 height += marginV; 52151 } 52152 } 52153 return { 52154 w: width, 52155 h: height, 52156 isBroken 52157 }; 52158} 52159function computeBbox(node, html, availableSpace) { 52160 let bbox; 52161 if (node.w !== "" && node.h !== "") { 52162 bbox = [node.x, node.y, node.w, node.h]; 52163 } else { 52164 if (!availableSpace) { 52165 return null; 52166 } 52167 let width = node.w; 52168 if (width === "") { 52169 if (node.maxW === 0) { 52170 const parent = node[_symbol_utils.$getSubformParent](); 52171 width = parent.layout === "position" && parent.w !== "" ? 0 : node.minW; 52172 } else { 52173 width = Math.min(node.maxW, availableSpace.width); 52174 } 52175 html.attributes.style.width = measureToString(width); 52176 } 52177 let height = node.h; 52178 if (height === "") { 52179 if (node.maxH === 0) { 52180 const parent = node[_symbol_utils.$getSubformParent](); 52181 height = parent.layout === "position" && parent.h !== "" ? 0 : node.minH; 52182 } else { 52183 height = Math.min(node.maxH, availableSpace.height); 52184 } 52185 html.attributes.style.height = measureToString(height); 52186 } 52187 bbox = [node.x, node.y, width, height]; 52188 } 52189 return bbox; 52190} 52191function fixDimensions(node) { 52192 const parent = node[_symbol_utils.$getSubformParent](); 52193 if (parent.layout?.includes("row")) { 52194 const extra = parent[_symbol_utils.$extra]; 52195 const colSpan = node.colSpan; 52196 let width; 52197 if (colSpan === -1) { 52198 width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0); 52199 } else { 52200 width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0); 52201 } 52202 if (!isNaN(width)) { 52203 node.w = width; 52204 } 52205 } 52206 if (parent.layout && parent.layout !== "position") { 52207 node.x = node.y = 0; 52208 } 52209 if (node.layout === "table") { 52210 if (node.w === "" && Array.isArray(node.columnWidths)) { 52211 node.w = node.columnWidths.reduce((a, x) => a + x, 0); 52212 } 52213 } 52214} 52215function layoutClass(node) { 52216 switch (node.layout) { 52217 case "position": 52218 return "xfaPosition"; 52219 case "lr-tb": 52220 return "xfaLrTb"; 52221 case "rl-row": 52222 return "xfaRlRow"; 52223 case "rl-tb": 52224 return "xfaRlTb"; 52225 case "row": 52226 return "xfaRow"; 52227 case "table": 52228 return "xfaTable"; 52229 case "tb": 52230 return "xfaTb"; 52231 default: 52232 return "xfaPosition"; 52233 } 52234} 52235function toStyle(node, ...names) { 52236 const style = Object.create(null); 52237 for (const name of names) { 52238 const value = node[name]; 52239 if (value === null) { 52240 continue; 52241 } 52242 if (converters.hasOwnProperty(name)) { 52243 converters[name](node, style); 52244 continue; 52245 } 52246 if (value instanceof _xfa_object.XFAObject) { 52247 const newStyle = value[_symbol_utils.$toStyle](); 52248 if (newStyle) { 52249 Object.assign(style, newStyle); 52250 } else { 52251 (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`); 52252 } 52253 } 52254 } 52255 return style; 52256} 52257function createWrapper(node, html) { 52258 const { 52259 attributes 52260 } = html; 52261 const { 52262 style 52263 } = attributes; 52264 const wrapper = { 52265 name: "div", 52266 attributes: { 52267 class: ["xfaWrapper"], 52268 style: Object.create(null) 52269 }, 52270 children: [] 52271 }; 52272 attributes.class.push("xfaWrapped"); 52273 if (node.border) { 52274 const { 52275 widths, 52276 insets 52277 } = node.border[_symbol_utils.$extra]; 52278 let width, height; 52279 let top = insets[0]; 52280 let left = insets[3]; 52281 const insetsH = insets[0] + insets[2]; 52282 const insetsW = insets[1] + insets[3]; 52283 switch (node.border.hand) { 52284 case "even": 52285 top -= widths[0] / 2; 52286 left -= widths[3] / 2; 52287 width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`; 52288 height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`; 52289 break; 52290 case "left": 52291 top -= widths[0]; 52292 left -= widths[3]; 52293 width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`; 52294 height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`; 52295 break; 52296 case "right": 52297 width = insetsW ? `calc(100% - ${insetsW}px)` : "100%"; 52298 height = insetsH ? `calc(100% - ${insetsH}px)` : "100%"; 52299 break; 52300 } 52301 const classNames = ["xfaBorder"]; 52302 if (isPrintOnly(node.border)) { 52303 classNames.push("xfaPrintOnly"); 52304 } 52305 const border = { 52306 name: "div", 52307 attributes: { 52308 class: classNames, 52309 style: { 52310 top: `${top}px`, 52311 left: `${left}px`, 52312 width, 52313 height 52314 } 52315 }, 52316 children: [] 52317 }; 52318 for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) { 52319 if (style[key] !== undefined) { 52320 border.attributes.style[key] = style[key]; 52321 delete style[key]; 52322 } 52323 } 52324 wrapper.children.push(border, html); 52325 } else { 52326 wrapper.children.push(html); 52327 } 52328 for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) { 52329 if (style[key] !== undefined) { 52330 wrapper.attributes.style[key] = style[key]; 52331 delete style[key]; 52332 } 52333 } 52334 wrapper.attributes.style.position = style.position === "absolute" ? "absolute" : "relative"; 52335 delete style.position; 52336 if (style.alignSelf) { 52337 wrapper.attributes.style.alignSelf = style.alignSelf; 52338 delete style.alignSelf; 52339 } 52340 return wrapper; 52341} 52342function fixTextIndent(styles) { 52343 const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px"); 52344 if (indent >= 0) { 52345 return; 52346 } 52347 const align = styles.textAlign === "right" ? "right" : "left"; 52348 const name = "padding" + (align === "left" ? "Left" : "Right"); 52349 const padding = (0, _utils.getMeasurement)(styles[name], "0px"); 52350 styles[name] = `${padding - indent}px`; 52351} 52352function setAccess(node, classNames) { 52353 switch (node.access) { 52354 case "nonInteractive": 52355 classNames.push("xfaNonInteractive"); 52356 break; 52357 case "readOnly": 52358 classNames.push("xfaReadOnly"); 52359 break; 52360 case "protected": 52361 classNames.push("xfaDisabled"); 52362 break; 52363 } 52364} 52365function isPrintOnly(node) { 52366 return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print"; 52367} 52368function getCurrentPara(node) { 52369 const stack = node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].paraStack; 52370 return stack.length ? stack.at(-1) : null; 52371} 52372function setPara(node, nodeStyle, value) { 52373 if (value.attributes.class?.includes("xfaRich")) { 52374 if (nodeStyle) { 52375 if (node.h === "") { 52376 nodeStyle.height = "auto"; 52377 } 52378 if (node.w === "") { 52379 nodeStyle.width = "auto"; 52380 } 52381 } 52382 const para = getCurrentPara(node); 52383 if (para) { 52384 const valueStyle = value.attributes.style; 52385 valueStyle.display = "flex"; 52386 valueStyle.flexDirection = "column"; 52387 switch (para.vAlign) { 52388 case "top": 52389 valueStyle.justifyContent = "start"; 52390 break; 52391 case "bottom": 52392 valueStyle.justifyContent = "end"; 52393 break; 52394 case "middle": 52395 valueStyle.justifyContent = "center"; 52396 break; 52397 } 52398 const paraStyle = para[_symbol_utils.$toStyle](); 52399 for (const [key, val] of Object.entries(paraStyle)) { 52400 if (!(key in valueStyle)) { 52401 valueStyle[key] = val; 52402 } 52403 } 52404 } 52405 } 52406} 52407function setFontFamily(xfaFont, node, fontFinder, style) { 52408 if (!fontFinder) { 52409 delete style.fontFamily; 52410 return; 52411 } 52412 const name = (0, _utils.stripQuotes)(xfaFont.typeface); 52413 style.fontFamily = `"${name}"`; 52414 const typeface = fontFinder.find(name); 52415 if (typeface) { 52416 const { 52417 fontFamily 52418 } = typeface.regular.cssFontInfo; 52419 if (fontFamily !== name) { 52420 style.fontFamily = `"${fontFamily}"`; 52421 } 52422 const para = getCurrentPara(node); 52423 if (para && para.lineHeight !== "") { 52424 return; 52425 } 52426 if (style.lineHeight) { 52427 return; 52428 } 52429 const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface); 52430 if (pdfFont) { 52431 style.lineHeight = Math.max(1.2, pdfFont.lineHeight); 52432 } 52433 } 52434} 52435function fixURL(str) { 52436 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, { 52437 addDefaultProtocol: true, 52438 tryConvertEncoding: true 52439 }); 52440 return absoluteUrl ? absoluteUrl.href : null; 52441} 52442 52443/***/ }), 52444/* 84 */ 52445/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 52446 52447 52448 52449Object.defineProperty(exports, "__esModule", ({ 52450 value: true 52451})); 52452exports.HTMLResult = void 0; 52453exports.getBBox = getBBox; 52454exports.getColor = getColor; 52455exports.getFloat = getFloat; 52456exports.getInteger = getInteger; 52457exports.getKeyword = getKeyword; 52458exports.getMeasurement = getMeasurement; 52459exports.getRatio = getRatio; 52460exports.getRelevant = getRelevant; 52461exports.getStringOption = getStringOption; 52462exports.stripQuotes = stripQuotes; 52463var _util = __w_pdfjs_require__(2); 52464const dimConverters = { 52465 pt: x => x, 52466 cm: x => x / 2.54 * 72, 52467 mm: x => x / (10 * 2.54) * 72, 52468 in: x => x * 72, 52469 px: x => x 52470}; 52471const measurementPattern = /([+-]?\d+\.?\d*)(.*)/; 52472function stripQuotes(str) { 52473 if (str.startsWith("'") || str.startsWith('"')) { 52474 return str.slice(1, -1); 52475 } 52476 return str; 52477} 52478function getInteger({ 52479 data, 52480 defaultValue, 52481 validate 52482}) { 52483 if (!data) { 52484 return defaultValue; 52485 } 52486 data = data.trim(); 52487 const n = parseInt(data, 10); 52488 if (!isNaN(n) && validate(n)) { 52489 return n; 52490 } 52491 return defaultValue; 52492} 52493function getFloat({ 52494 data, 52495 defaultValue, 52496 validate 52497}) { 52498 if (!data) { 52499 return defaultValue; 52500 } 52501 data = data.trim(); 52502 const n = parseFloat(data); 52503 if (!isNaN(n) && validate(n)) { 52504 return n; 52505 } 52506 return defaultValue; 52507} 52508function getKeyword({ 52509 data, 52510 defaultValue, 52511 validate 52512}) { 52513 if (!data) { 52514 return defaultValue; 52515 } 52516 data = data.trim(); 52517 if (validate(data)) { 52518 return data; 52519 } 52520 return defaultValue; 52521} 52522function getStringOption(data, options) { 52523 return getKeyword({ 52524 data, 52525 defaultValue: options[0], 52526 validate: k => options.includes(k) 52527 }); 52528} 52529function getMeasurement(str, def = "0") { 52530 def ||= "0"; 52531 if (!str) { 52532 return getMeasurement(def); 52533 } 52534 const match = str.trim().match(measurementPattern); 52535 if (!match) { 52536 return getMeasurement(def); 52537 } 52538 const [, valueStr, unit] = match; 52539 const value = parseFloat(valueStr); 52540 if (isNaN(value)) { 52541 return getMeasurement(def); 52542 } 52543 if (value === 0) { 52544 return 0; 52545 } 52546 const conv = dimConverters[unit]; 52547 if (conv) { 52548 return conv(value); 52549 } 52550 return value; 52551} 52552function getRatio(data) { 52553 if (!data) { 52554 return { 52555 num: 1, 52556 den: 1 52557 }; 52558 } 52559 const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x)); 52560 if (ratio.length === 1) { 52561 ratio.push(1); 52562 } 52563 if (ratio.length === 0) { 52564 return { 52565 num: 1, 52566 den: 1 52567 }; 52568 } 52569 const [num, den] = ratio; 52570 return { 52571 num, 52572 den 52573 }; 52574} 52575function getRelevant(data) { 52576 if (!data) { 52577 return []; 52578 } 52579 return data.trim().split(/\s+/).map(e => { 52580 return { 52581 excluded: e[0] === "-", 52582 viewname: e.substring(1) 52583 }; 52584 }); 52585} 52586function getColor(data, def = [0, 0, 0]) { 52587 let [r, g, b] = def; 52588 if (!data) { 52589 return { 52590 r, 52591 g, 52592 b 52593 }; 52594 } 52595 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); 52596 if (color.length < 3) { 52597 return { 52598 r, 52599 g, 52600 b 52601 }; 52602 } 52603 [r, g, b] = color; 52604 return { 52605 r, 52606 g, 52607 b 52608 }; 52609} 52610function getBBox(data) { 52611 const def = -1; 52612 if (!data) { 52613 return { 52614 x: def, 52615 y: def, 52616 width: def, 52617 height: def 52618 }; 52619 } 52620 const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1")); 52621 if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) { 52622 return { 52623 x: def, 52624 y: def, 52625 width: def, 52626 height: def 52627 }; 52628 } 52629 const [x, y, width, height] = bbox; 52630 return { 52631 x, 52632 y, 52633 width, 52634 height 52635 }; 52636} 52637class HTMLResult { 52638 static get FAILURE() { 52639 return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null)); 52640 } 52641 static get EMPTY() { 52642 return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null)); 52643 } 52644 constructor(success, html, bbox, breakNode) { 52645 this.success = success; 52646 this.html = html; 52647 this.bbox = bbox; 52648 this.breakNode = breakNode; 52649 } 52650 isBreak() { 52651 return !!this.breakNode; 52652 } 52653 static breakNode(node) { 52654 return new HTMLResult(false, null, null, node); 52655 } 52656 static success(html, bbox = null) { 52657 return new HTMLResult(true, html, bbox, null); 52658 } 52659} 52660exports.HTMLResult = HTMLResult; 52661 52662/***/ }), 52663/* 85 */ 52664/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 52665 52666 52667 52668Object.defineProperty(exports, "__esModule", ({ 52669 value: true 52670})); 52671exports.FontFinder = void 0; 52672exports.getMetrics = getMetrics; 52673exports.selectFont = selectFont; 52674var _symbol_utils = __w_pdfjs_require__(78); 52675var _utils = __w_pdfjs_require__(84); 52676var _util = __w_pdfjs_require__(2); 52677class FontFinder { 52678 constructor(pdfFonts) { 52679 this.fonts = new Map(); 52680 this.cache = new Map(); 52681 this.warned = new Set(); 52682 this.defaultFont = null; 52683 this.add(pdfFonts); 52684 } 52685 add(pdfFonts, reallyMissingFonts = null) { 52686 for (const pdfFont of pdfFonts) { 52687 this.addPdfFont(pdfFont); 52688 } 52689 for (const pdfFont of this.fonts.values()) { 52690 if (!pdfFont.regular) { 52691 pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic; 52692 } 52693 } 52694 if (!reallyMissingFonts || reallyMissingFonts.size === 0) { 52695 return; 52696 } 52697 const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA"); 52698 for (const missing of reallyMissingFonts) { 52699 this.fonts.set(missing, myriad); 52700 } 52701 } 52702 addPdfFont(pdfFont) { 52703 const cssFontInfo = pdfFont.cssFontInfo; 52704 const name = cssFontInfo.fontFamily; 52705 let font = this.fonts.get(name); 52706 if (!font) { 52707 font = Object.create(null); 52708 this.fonts.set(name, font); 52709 if (!this.defaultFont) { 52710 this.defaultFont = font; 52711 } 52712 } 52713 let property = ""; 52714 const fontWeight = parseFloat(cssFontInfo.fontWeight); 52715 if (parseFloat(cssFontInfo.italicAngle) !== 0) { 52716 property = fontWeight >= 700 ? "bolditalic" : "italic"; 52717 } else if (fontWeight >= 700) { 52718 property = "bold"; 52719 } 52720 if (!property) { 52721 if (pdfFont.name.includes("Bold") || pdfFont.psName?.includes("Bold")) { 52722 property = "bold"; 52723 } 52724 if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName?.includes("Italic") || pdfFont.psName?.endsWith("It")) { 52725 property += "italic"; 52726 } 52727 } 52728 if (!property) { 52729 property = "regular"; 52730 } 52731 font[property] = pdfFont; 52732 } 52733 getDefault() { 52734 return this.defaultFont; 52735 } 52736 find(fontName, mustWarn = true) { 52737 let font = this.fonts.get(fontName) || this.cache.get(fontName); 52738 if (font) { 52739 return font; 52740 } 52741 const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi; 52742 let name = fontName.replaceAll(pattern, ""); 52743 font = this.fonts.get(name); 52744 if (font) { 52745 this.cache.set(fontName, font); 52746 return font; 52747 } 52748 name = name.toLowerCase(); 52749 const maybe = []; 52750 for (const [family, pdfFont] of this.fonts.entries()) { 52751 if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) { 52752 maybe.push(pdfFont); 52753 } 52754 } 52755 if (maybe.length === 0) { 52756 for (const [, pdfFont] of this.fonts.entries()) { 52757 if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) { 52758 maybe.push(pdfFont); 52759 } 52760 } 52761 } 52762 if (maybe.length === 0) { 52763 name = name.replaceAll(/psmt|mt/gi, ""); 52764 for (const [family, pdfFont] of this.fonts.entries()) { 52765 if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) { 52766 maybe.push(pdfFont); 52767 } 52768 } 52769 } 52770 if (maybe.length === 0) { 52771 for (const pdfFont of this.fonts.values()) { 52772 if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) { 52773 maybe.push(pdfFont); 52774 } 52775 } 52776 } 52777 if (maybe.length >= 1) { 52778 if (maybe.length !== 1 && mustWarn) { 52779 (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`); 52780 } 52781 this.cache.set(fontName, maybe[0]); 52782 return maybe[0]; 52783 } 52784 if (mustWarn && !this.warned.has(fontName)) { 52785 this.warned.add(fontName); 52786 (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`); 52787 } 52788 return null; 52789 } 52790} 52791exports.FontFinder = FontFinder; 52792function selectFont(xfaFont, typeface) { 52793 if (xfaFont.posture === "italic") { 52794 if (xfaFont.weight === "bold") { 52795 return typeface.bolditalic; 52796 } 52797 return typeface.italic; 52798 } else if (xfaFont.weight === "bold") { 52799 return typeface.bold; 52800 } 52801 return typeface.regular; 52802} 52803function getMetrics(xfaFont, real = false) { 52804 let pdfFont = null; 52805 if (xfaFont) { 52806 const name = (0, _utils.stripQuotes)(xfaFont.typeface); 52807 const typeface = xfaFont[_symbol_utils.$globalData].fontFinder.find(name); 52808 pdfFont = selectFont(xfaFont, typeface); 52809 } 52810 if (!pdfFont) { 52811 return { 52812 lineHeight: 12, 52813 lineGap: 2, 52814 lineNoGap: 10 52815 }; 52816 } 52817 const size = xfaFont.size || 10; 52818 const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2; 52819 const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap; 52820 return { 52821 lineHeight: lineHeight * size, 52822 lineGap: lineGap * size, 52823 lineNoGap: Math.max(1, lineHeight - lineGap) * size 52824 }; 52825} 52826 52827/***/ }), 52828/* 86 */ 52829/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 52830 52831 52832 52833Object.defineProperty(exports, "__esModule", ({ 52834 value: true 52835})); 52836exports.TextMeasure = void 0; 52837var _fonts = __w_pdfjs_require__(85); 52838const WIDTH_FACTOR = 1.02; 52839class FontInfo { 52840 constructor(xfaFont, margin, lineHeight, fontFinder) { 52841 this.lineHeight = lineHeight; 52842 this.paraMargin = margin || { 52843 top: 0, 52844 bottom: 0, 52845 left: 0, 52846 right: 0 52847 }; 52848 if (!xfaFont) { 52849 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 52850 return; 52851 } 52852 this.xfaFont = { 52853 typeface: xfaFont.typeface, 52854 posture: xfaFont.posture, 52855 weight: xfaFont.weight, 52856 size: xfaFont.size, 52857 letterSpacing: xfaFont.letterSpacing 52858 }; 52859 const typeface = fontFinder.find(xfaFont.typeface); 52860 if (!typeface) { 52861 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 52862 return; 52863 } 52864 this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface); 52865 if (!this.pdfFont) { 52866 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 52867 } 52868 } 52869 defaultFont(fontFinder) { 52870 const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault(); 52871 if (font?.regular) { 52872 const pdfFont = font.regular; 52873 const info = pdfFont.cssFontInfo; 52874 const xfaFont = { 52875 typeface: info.fontFamily, 52876 posture: "normal", 52877 weight: "normal", 52878 size: 10, 52879 letterSpacing: 0 52880 }; 52881 return [pdfFont, xfaFont]; 52882 } 52883 const xfaFont = { 52884 typeface: "Courier", 52885 posture: "normal", 52886 weight: "normal", 52887 size: 10, 52888 letterSpacing: 0 52889 }; 52890 return [null, xfaFont]; 52891 } 52892} 52893class FontSelector { 52894 constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) { 52895 this.fontFinder = fontFinder; 52896 this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)]; 52897 } 52898 pushData(xfaFont, margin, lineHeight) { 52899 const lastFont = this.stack.at(-1); 52900 for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) { 52901 if (!xfaFont[name]) { 52902 xfaFont[name] = lastFont.xfaFont[name]; 52903 } 52904 } 52905 for (const name of ["top", "bottom", "left", "right"]) { 52906 if (isNaN(margin[name])) { 52907 margin[name] = lastFont.paraMargin[name]; 52908 } 52909 } 52910 const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder); 52911 if (!fontInfo.pdfFont) { 52912 fontInfo.pdfFont = lastFont.pdfFont; 52913 } 52914 this.stack.push(fontInfo); 52915 } 52916 popFont() { 52917 this.stack.pop(); 52918 } 52919 topFont() { 52920 return this.stack.at(-1); 52921 } 52922} 52923class TextMeasure { 52924 constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) { 52925 this.glyphs = []; 52926 this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts); 52927 this.extraHeight = 0; 52928 } 52929 pushData(xfaFont, margin, lineHeight) { 52930 this.fontSelector.pushData(xfaFont, margin, lineHeight); 52931 } 52932 popFont(xfaFont) { 52933 return this.fontSelector.popFont(); 52934 } 52935 addPara() { 52936 const lastFont = this.fontSelector.topFont(); 52937 this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom; 52938 } 52939 addString(str) { 52940 if (!str) { 52941 return; 52942 } 52943 const lastFont = this.fontSelector.topFont(); 52944 const fontSize = lastFont.xfaFont.size; 52945 if (lastFont.pdfFont) { 52946 const letterSpacing = lastFont.xfaFont.letterSpacing; 52947 const pdfFont = lastFont.pdfFont; 52948 const fontLineHeight = pdfFont.lineHeight || 1.2; 52949 const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize; 52950 const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap; 52951 const noGap = fontLineHeight - lineGap; 52952 const firstLineHeight = Math.max(1, noGap) * fontSize; 52953 const scale = fontSize / 1000; 52954 const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width; 52955 for (const line of str.split(/[\u2029\n]/)) { 52956 const encodedLine = pdfFont.encodeString(line).join(""); 52957 const glyphs = pdfFont.charsToGlyphs(encodedLine); 52958 for (const glyph of glyphs) { 52959 const width = glyph.width || fallbackWidth; 52960 this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]); 52961 } 52962 this.glyphs.push([0, 0, 0, "\n", true]); 52963 } 52964 this.glyphs.pop(); 52965 return; 52966 } 52967 for (const line of str.split(/[\u2029\n]/)) { 52968 for (const char of line.split("")) { 52969 this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]); 52970 } 52971 this.glyphs.push([0, 0, 0, "\n", true]); 52972 } 52973 this.glyphs.pop(); 52974 } 52975 compute(maxWidth) { 52976 let lastSpacePos = -1, 52977 lastSpaceWidth = 0, 52978 width = 0, 52979 height = 0, 52980 currentLineWidth = 0, 52981 currentLineHeight = 0; 52982 let isBroken = false;
52983 let isFirstLine = true; 52984 for (let i = 0, ii = this.glyphs.length; i < ii; i++) { 52985 const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i]; 52986 const isSpace = char === " "; 52987 const glyphHeight = isFirstLine ? firstLineHeight : lineHeight; 52988 if (isEOL) { 52989 width = Math.max(width, currentLineWidth); 52990 currentLineWidth = 0; 52991 height += currentLineHeight; 52992 currentLineHeight = glyphHeight; 52993 lastSpacePos = -1; 52994 lastSpaceWidth = 0; 52995 isFirstLine = false; 52996 continue; 52997 } 52998 if (isSpace) { 52999 if (currentLineWidth + glyphWidth > maxWidth) { 53000 width = Math.max(width, currentLineWidth); 53001 currentLineWidth = 0; 53002 height += currentLineHeight; 53003 currentLineHeight = glyphHeight; 53004 lastSpacePos = -1; 53005 lastSpaceWidth = 0; 53006 isBroken = true; 53007 isFirstLine = false; 53008 } else { 53009 currentLineHeight = Math.max(glyphHeight, currentLineHeight); 53010 lastSpaceWidth = currentLineWidth; 53011 currentLineWidth += glyphWidth; 53012 lastSpacePos = i; 53013 } 53014 continue; 53015 } 53016 if (currentLineWidth + glyphWidth > maxWidth) { 53017 height += currentLineHeight; 53018 currentLineHeight = glyphHeight; 53019 if (lastSpacePos !== -1) { 53020 i = lastSpacePos; 53021 width = Math.max(width, lastSpaceWidth); 53022 currentLineWidth = 0; 53023 lastSpacePos = -1; 53024 lastSpaceWidth = 0; 53025 } else { 53026 width = Math.max(width, currentLineWidth); 53027 currentLineWidth = glyphWidth; 53028 } 53029 isBroken = true; 53030 isFirstLine = false; 53031 continue; 53032 } 53033 currentLineWidth += glyphWidth; 53034 currentLineHeight = Math.max(glyphHeight, currentLineHeight); 53035 } 53036 width = Math.max(width, currentLineWidth); 53037 height += currentLineHeight + this.extraHeight; 53038 return { 53039 width: WIDTH_FACTOR * width, 53040 height, 53041 isBroken 53042 }; 53043 } 53044} 53045exports.TextMeasure = TextMeasure; 53046 53047/***/ }), 53048/* 87 */ 53049/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 53050 53051 53052 53053Object.defineProperty(exports, "__esModule", ({ 53054 value: true 53055})); 53056exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject = exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject = void 0; 53057var _symbol_utils = __w_pdfjs_require__(78); 53058var _utils = __w_pdfjs_require__(84); 53059var _util = __w_pdfjs_require__(2); 53060var _core_utils = __w_pdfjs_require__(3); 53061var _namespaces = __w_pdfjs_require__(81); 53062var _som = __w_pdfjs_require__(88); 53063const _applyPrototype = Symbol(); 53064const _attributes = Symbol(); 53065const _attributeNames = Symbol(); 53066const _children = Symbol("_children"); 53067const _cloneAttribute = Symbol(); 53068const _dataValue = Symbol(); 53069const _defaultValue = Symbol(); 53070const _filteredChildrenGenerator = Symbol(); 53071const _getPrototype = Symbol(); 53072const _getUnsetAttributes = Symbol(); 53073const _hasChildren = Symbol(); 53074const _max = Symbol(); 53075const _options = Symbol(); 53076const _parent = Symbol("parent"); 53077const _resolvePrototypesHelper = Symbol(); 53078const _setAttributes = Symbol(); 53079const _validator = Symbol(); 53080let uid = 0; 53081const NS_DATASETS = _namespaces.NamespaceIds.datasets.id; 53082class XFAObject { 53083 constructor(nsId, name, hasChildren = false) { 53084 this[_symbol_utils.$namespaceId] = nsId; 53085 this[_symbol_utils.$nodeName] = name; 53086 this[_hasChildren] = hasChildren; 53087 this[_parent] = null; 53088 this[_children] = []; 53089 this[_symbol_utils.$uid] = `${name}${uid++}`; 53090 this[_symbol_utils.$globalData] = null; 53091 } 53092 get isXFAObject() { 53093 return true; 53094 } 53095 get isXFAObjectArray() { 53096 return false; 53097 } 53098 createNodes(path) { 53099 let root = this, 53100 node = null; 53101 for (const { 53102 name, 53103 index 53104 } of path) { 53105 for (let i = 0, ii = isFinite(index) ? index : 0; i <= ii; i++) { 53106 const nsId = root[_symbol_utils.$namespaceId] === NS_DATASETS ? -1 : root[_symbol_utils.$namespaceId]; 53107 node = new XmlObject(nsId, name); 53108 root[_symbol_utils.$appendChild](node); 53109 } 53110 root = node; 53111 } 53112 return node; 53113 } 53114 [_symbol_utils.$onChild](child) { 53115 if (!this[_hasChildren] || !this[_symbol_utils.$onChildCheck](child)) { 53116 return false;
53117 } 53118 const name = child[_symbol_utils.$nodeName]; 53119 const node = this[name]; 53120 if (node instanceof XFAObjectArray) { 53121 if (node.push(child)) { 53122 this[_symbol_utils.$appendChild](child); 53123 return true; 53124 } 53125 } else { 53126 if (node !== null) { 53127 this[_symbol_utils.$removeChild](node); 53128 } 53129 this[name] = child; 53130 this[_symbol_utils.$appendChild](child); 53131 return true; 53132 } 53133 let id = ""; 53134 if (this.id) { 53135 id = ` (id: ${this.id})`; 53136 } else if (this.name) { 53137 id = ` (name: ${this.name} ${this.h.value})`; 53138 } 53139 (0, _util.warn)(`XFA - node "${this[_symbol_utils.$nodeName]}"${id} has already enough "${name}"!`); 53140 return false; 53141 } 53142 [_symbol_utils.$onChildCheck](child) { 53143 return this.hasOwnProperty(child[_symbol_utils.$nodeName]) && child[_symbol_utils.$namespaceId] === this[_symbol_utils.$namespaceId]; 53144 } 53145 [_symbol_utils.$isNsAgnostic]() { 53146 return false; 53147 } 53148 [_symbol_utils.$acceptWhitespace]() { 53149 return false; 53150 } 53151 [_symbol_utils.$isCDATAXml]() { 53152 return false; 53153 } 53154 [_symbol_utils.$isBindable]() { 53155 return false; 53156 } 53157 [_symbol_utils.$popPara]() { 53158 if (this.para) { 53159 this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].paraStack.pop(); 53160 } 53161 } 53162 [_symbol_utils.$pushPara]() { 53163 this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].paraStack.push(this.para); 53164 } 53165 [_symbol_utils.$setId](ids) { 53166 if (this.id && this[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.template.id) { 53167 ids.set(this.id, this); 53168 } 53169 } 53170 [_symbol_utils.$getTemplateRoot]() { 53171 return this[_symbol_utils.$globalData].template; 53172 } 53173 [_symbol_utils.$isSplittable]() { 53174 return false; 53175 } 53176 [_symbol_utils.$isThereMoreWidth]() { 53177 return false; 53178 } 53179 [_symbol_utils.$appendChild](child) { 53180 child[_parent] = this; 53181 this[_children].push(child); 53182 if (!child[_symbol_utils.$globalData] && this[_symbol_utils.$globalData]) { 53183 child[_symbol_utils.$globalData] = this[_symbol_utils.$globalData]; 53184 } 53185 } 53186 [_symbol_utils.$removeChild](child) { 53187 const i = this[_children].indexOf(child); 53188 this[_children].splice(i, 1); 53189 } 53190 [_symbol_utils.$hasSettableValue]() { 53191 return this.hasOwnProperty("value"); 53192 } 53193 [_symbol_utils.$setValue](_) {} 53194 [_symbol_utils.$onText](_) {} 53195 [_symbol_utils.$finalize]() {} 53196 [_symbol_utils.$clean](builder) { 53197 delete this[_hasChildren]; 53198 if (this[_symbol_utils.$cleanup]) { 53199 builder.clean(this[_symbol_utils.$cleanup]); 53200 delete this[_symbol_utils.$cleanup]; 53201 } 53202 } 53203 [_symbol_utils.$indexOf](child) { 53204 return this[_children].indexOf(child); 53205 } 53206 [_symbol_utils.$insertAt](i, child) { 53207 child[_parent] = this; 53208 this[_children].splice(i, 0, child); 53209 if (!child[_symbol_utils.$globalData] && this[_symbol_utils.$globalData]) { 53210 child[_symbol_utils.$globalData] = this[_symbol_utils.$globalData]; 53211 } 53212 } 53213 [_symbol_utils.$isTransparent]() { 53214 return !this.name; 53215 } 53216 [_symbol_utils.$lastAttribute]() { 53217 return ""; 53218 } 53219 [_symbol_utils.$text]() { 53220 if (this[_children].length === 0) { 53221 return this[_symbol_utils.$content]; 53222 } 53223 return this[_children].map(c => c[_symbol_utils.$text]()).join(""); 53224 } 53225 get [_attributeNames]() { 53226 const proto = Object.getPrototypeOf(this); 53227 if (!proto._attributes) { 53228 const attributes = proto._attributes = new Set(); 53229 for (const name of Object.getOwnPropertyNames(this)) { 53230 if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) { 53231 break; 53232 } 53233 attributes.add(name); 53234 } 53235 } 53236 return (0, _util.shadow)(this, _attributeNames, proto._attributes); 53237 } 53238 [_symbol_utils.$isDescendent](parent) { 53239 let node = this; 53240 while (node) { 53241 if (node === parent) { 53242 return true; 53243 } 53244 node = node[_symbol_utils.$getParent](); 53245 } 53246 return false; 53247 } 53248 [_symbol_utils.$getParent]() { 53249 return this[_parent]; 53250 } 53251 [_symbol_utils.$getSubformParent]() { 53252 return this[_symbol_utils.$getParent](); 53253 } 53254 [_symbol_utils.$getChildren](name = null) { 53255 if (!name) { 53256 return this[_children]; 53257 } 53258 return this[name]; 53259 } 53260 [_symbol_utils.$dump]() { 53261 const dumped = Object.create(null); 53262 if (this[_symbol_utils.$content]) { 53263 dumped.$content = this[_symbol_utils.$content]; 53264 }
53265 for (const name of Object.getOwnPropertyNames(this)) { 53266 const value = this[name]; 53267 if (value === null) { 53268 continue; 53269 } 53270 if (value instanceof XFAObject) { 53271 dumped[name] = value[_symbol_utils.$dump](); 53272 } else if (value instanceof XFAObjectArray) { 53273 if (!value.isEmpty()) { 53274 dumped[name] = value.dump(); 53275 } 53276 } else { 53277 dumped[name] = value; 53278 } 53279 } 53280 return dumped; 53281 } 53282 [_symbol_utils.$toStyle]() { 53283 return null; 53284 } 53285 [_symbol_utils.$toHTML]() { 53286 return _utils.HTMLResult.EMPTY; 53287 } 53288 *[_symbol_utils.$getContainedChildren]() { 53289 for (const node of this[_symbol_utils.$getChildren]()) { 53290 yield node; 53291 } 53292 } 53293 *[_filteredChildrenGenerator](filter, include) { 53294 for (const node of this[_symbol_utils.$getContainedChildren]()) { 53295 if (!filter || include === filter.has(node[_symbol_utils.$nodeName])) { 53296 const availableSpace = this[_symbol_utils.$getAvailableSpace](); 53297 const res = node[_symbol_utils.$toHTML](availableSpace); 53298 if (!res.success) { 53299 this[_symbol_utils.$extra].failingNode = node; 53300 } 53301 yield res; 53302 } 53303 } 53304 } 53305 [_symbol_utils.$flushHTML]() { 53306 return null; 53307 } 53308 [_symbol_utils.$addHTML](html, bbox) { 53309 this[_symbol_utils.$extra].children.push(html); 53310 } 53311 [_symbol_utils.$getAvailableSpace]() {} 53312 [_symbol_utils.$childrenToHTML]({ 53313 filter = null, 53314 include = true 53315 }) { 53316 if (!this[_symbol_utils.$extra].generator) { 53317 this[_symbol_utils.$extra].generator = this[_filteredChildrenGenerator](filter, include); 53318 } else { 53319 const availableSpace = this[_symbol_utils.$getAvailableSpace](); 53320 const res = this[_symbol_utils.$extra].failingNode[_symbol_utils.$toHTML](availableSpace); 53321 if (!res.success) { 53322 return res; 53323 } 53324 if (res.html) { 53325 this[_symbol_utils.$addHTML](res.html, res.bbox); 53326 } 53327 delete this[_symbol_utils.$extra].failingNode; 53328 } 53329 while (true) { 53330 const gen = this[_symbol_utils.$extra].generator.next(); 53331 if (gen.done) { 53332 break; 53333 } 53334 const res = gen.value; 53335 if (!res.success) { 53336 return res; 53337 } 53338 if (res.html) { 53339 this[_symbol_utils.$addHTML](res.html, res.bbox); 53340 } 53341 } 53342 this[_symbol_utils.$extra].generator = null; 53343 return _utils.HTMLResult.EMPTY; 53344 } 53345 [_symbol_utils.$setSetAttributes](attributes) { 53346 this[_setAttributes] = new Set(Object.keys(attributes)); 53347 } 53348 [_getUnsetAttributes](protoAttributes) { 53349 const allAttr = this[_attributeNames]; 53350 const setAttr = this[_setAttributes]; 53351 return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x)); 53352 } 53353 [_symbol_utils.$resolvePrototypes](ids, ancestors = new Set()) { 53354 for (const child of this[_children]) { 53355 child[_resolvePrototypesHelper](ids, ancestors); 53356 } 53357 } 53358 [_resolvePrototypesHelper](ids, ancestors) { 53359 const proto = this[_getPrototype](ids, ancestors); 53360 if (proto) { 53361 this[_applyPrototype](proto, ids, ancestors); 53362 } else { 53363 this[_symbol_utils.$resolvePrototypes](ids, ancestors); 53364 } 53365 } 53366 [_getPrototype](ids, ancestors) { 53367 const { 53368 use, 53369 usehref 53370 } = this; 53371 if (!use && !usehref) { 53372 return null; 53373 } 53374 let proto = null; 53375 let somExpression = null; 53376 let id = null; 53377 let ref = use; 53378 if (usehref) { 53379 ref = usehref; 53380 if (usehref.startsWith("#som(") && usehref.endsWith(")")) { 53381 somExpression = usehref.slice("#som(".length, -1); 53382 } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) { 53383 somExpression = usehref.slice(".#som(".length, -1); 53384 } else if (usehref.startsWith("#")) { 53385 id = usehref.slice(1); 53386 } else if (usehref.startsWith(".#")) { 53387 id = usehref.slice(2); 53388 } 53389 } else if (use.startsWith("#")) { 53390 id = use.slice(1); 53391 } else { 53392 somExpression = use; 53393 } 53394 this.use = this.usehref = ""; 53395 if (id) { 53396 proto = ids.get(id); 53397 } else { 53398 proto = (0, _som.searchNode)(ids.get(_symbol_utils.$root), this, somExpression, true, false); 53399 if (proto) { 53400 proto = proto[0]; 53401 } 53402 } 53403 if (!proto) { 53404 (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`); 53405 return null; 53406 } 53407 if (proto[_symbol_utils.$nodeName] !== this[_symbol_utils.$nodeName]) { 53408 (0, _util.warn)(`XFA - Incompatible prototype: ${proto[_symbol_utils.$nodeName]} !== ${this[_symbol_utils.$nodeName]}.`); 53409 return null; 53410 } 53411 if (ancestors.has(proto)) { 53412 (0, _util.warn)(`XFA - Cycle detected in prototypes use.`); 53413 return null; 53414 } 53415 ancestors.add(proto); 53416 const protoProto = proto[_getPrototype](ids, ancestors); 53417 if (protoProto) { 53418 proto[_applyPrototype](protoProto, ids, ancestors); 53419 } 53420 proto[_symbol_utils.$resolvePrototypes](ids, ancestors); 53421 ancestors.delete(proto); 53422 return proto; 53423 } 53424 [_applyPrototype](proto, ids, ancestors) { 53425 if (ancestors.has(proto)) { 53426 (0, _util.warn)(`XFA - Cycle detected in prototypes use.`); 53427 return; 53428 } 53429 if (!this[_symbol_utils.$content] && proto[_symbol_utils.$content]) { 53430 this[_symbol_utils.$content] = proto[_symbol_utils.$content]; 53431 } 53432 const newAncestors = new Set(ancestors); 53433 newAncestors.add(proto); 53434 for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) { 53435 this[unsetAttrName] = proto[unsetAttrName]; 53436 if (this[_setAttributes]) { 53437 this[_setAttributes].add(unsetAttrName); 53438 } 53439 }
53440 for (const name of Object.getOwnPropertyNames(this)) { 53441 if (this[_attributeNames].has(name)) { 53442 continue; 53443 } 53444 const value = this[name]; 53445 const protoValue = proto[name]; 53446 if (value instanceof XFAObjectArray) { 53447 for (const child of value[_children]) { 53448 child[_resolvePrototypesHelper](ids, ancestors); 53449 } 53450 for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) { 53451 const child = proto[_children][i][_symbol_utils.$clone](); 53452 if (value.push(child)) { 53453 child[_parent] = this; 53454 this[_children].push(child); 53455 child[_resolvePrototypesHelper](ids, ancestors); 53456 } else { 53457 break; 53458 } 53459 } 53460 continue; 53461 } 53462 if (value !== null) { 53463 value[_symbol_utils.$resolvePrototypes](ids, ancestors); 53464 if (protoValue) { 53465 value[_applyPrototype](protoValue, ids, ancestors); 53466 } 53467 continue; 53468 } 53469 if (protoValue !== null) { 53470 const child = protoValue[_symbol_utils.$clone](); 53471 child[_parent] = this; 53472 this[name] = child; 53473 this[_children].push(child); 53474 child[_resolvePrototypesHelper](ids, ancestors); 53475 } 53476 } 53477 } 53478 static [_cloneAttribute](obj) { 53479 if (Array.isArray(obj)) { 53480 return obj.map(x => XFAObject[_cloneAttribute](x)); 53481 } 53482 if (typeof obj === "object" && obj !== null) { 53483 return Object.assign({}, obj); 53484 } 53485 return obj; 53486 } 53487 [_symbol_utils.$clone]() { 53488 const clone = Object.create(Object.getPrototypeOf(this)); 53489 for (const $symbol of Object.getOwnPropertySymbols(this)) { 53490 try { 53491 clone[$symbol] = this[$symbol]; 53492 } catch { 53493 (0, _util.shadow)(clone, $symbol, this[$symbol]); 53494 } 53495 } 53496 clone[_symbol_utils.$uid] = `${clone[_symbol_utils.$nodeName]}${uid++}`; 53497 clone[_children] = []; 53498 for (const name of Object.getOwnPropertyNames(this)) { 53499 if (this[_attributeNames].has(name)) { 53500 clone[name] = XFAObject[_cloneAttribute](this[name]); 53501 continue; 53502 } 53503 const value = this[name]; 53504 clone[name] = value instanceof XFAObjectArray ? new XFAObjectArray(value[_max]) : null; 53505 } 53506 for (const child of this[_children]) { 53507 const name = child[_symbol_utils.$nodeName]; 53508 const clonedChild = child[_symbol_utils.$clone](); 53509 clone[_children].push(clonedChild); 53510 clonedChild[_parent] = clone; 53511 if (clone[name] === null) { 53512 clone[name] = clonedChild; 53513 } else { 53514 clone[name][_children].push(clonedChild); 53515 } 53516 } 53517 return clone; 53518 } 53519 [_symbol_utils.$getChildren](name = null) { 53520 if (!name) { 53521 return this[_children]; 53522 } 53523 return this[_children].filter(c => c[_symbol_utils.$nodeName] === name); 53524 } 53525 [_symbol_utils.$getChildrenByClass](name) { 53526 return this[name]; 53527 } 53528 [_symbol_utils.$getChildrenByName](name, allTransparent, first = true) { 53529 return Array.from(this[_symbol_utils.$getChildrenByNameIt](name, allTransparent, first)); 53530 } 53531 *[_symbol_utils.$getChildrenByNameIt](name, allTransparent, first = true) { 53532 if (name === "parent") { 53533 yield this[_parent]; 53534 return; 53535 } 53536 for (const child of this[_children]) { 53537 if (child[_symbol_utils.$nodeName] === name) { 53538 yield child; 53539 } 53540 if (child.name === name) { 53541 yield child; 53542 } 53543 if (allTransparent || child[_symbol_utils.$isTransparent]()) { 53544 yield* child[_symbol_utils.$getChildrenByNameIt](name, allTransparent, false); 53545 } 53546 } 53547 if (first && this[_attributeNames].has(name)) { 53548 yield new XFAAttribute(this, name, this[name]); 53549 } 53550 } 53551} 53552exports.XFAObject = XFAObject; 53553class XFAObjectArray { 53554 constructor(max = Infinity) { 53555 this[_max] = max; 53556 this[_children] = []; 53557 } 53558 get isXFAObject() { 53559 return false; 53560 } 53561 get isXFAObjectArray() { 53562 return true; 53563 } 53564 push(child) { 53565 const len = this[_children].length; 53566 if (len <= this[_max]) { 53567 this[_children].push(child); 53568 return true; 53569 } 53570 (0, _util.warn)(`XFA - node "${child[_symbol_utils.$nodeName]}" accepts no more than ${this[_max]} children`); 53571 return false;
53572 } 53573 isEmpty() { 53574 return this[_children].length === 0; 53575 } 53576 dump() { 53577 return this[_children].length === 1 ? this[_children][0][_symbol_utils.$dump]() : this[_children].map(x => x[_symbol_utils.$dump]()); 53578 } 53579 [_symbol_utils.$clone]() { 53580 const clone = new XFAObjectArray(this[_max]); 53581 clone[_children] = this[_children].map(c => c[_symbol_utils.$clone]()); 53582 return clone; 53583 } 53584 get children() { 53585 return this[_children]; 53586 } 53587 clear() { 53588 this[_children].length = 0; 53589 } 53590} 53591exports.XFAObjectArray = XFAObjectArray; 53592class XFAAttribute { 53593 constructor(node, name, value) { 53594 this[_parent] = node; 53595 this[_symbol_utils.$nodeName] = name; 53596 this[_symbol_utils.$content] = value; 53597 this[_symbol_utils.$consumed] = false; 53598 this[_symbol_utils.$uid] = `attribute${uid++}`; 53599 } 53600 [_symbol_utils.$getParent]() { 53601 return this[_parent]; 53602 } 53603 [_symbol_utils.$isDataValue]() { 53604 return true; 53605 } 53606 [_symbol_utils.$getDataValue]() { 53607 return this[_symbol_utils.$content].trim(); 53608 } 53609 [_symbol_utils.$setValue](value) { 53610 value = value.value || ""; 53611 this[_symbol_utils.$content] = value.toString(); 53612 } 53613 [_symbol_utils.$text]() { 53614 return this[_symbol_utils.$content]; 53615 } 53616 [_symbol_utils.$isDescendent](parent) { 53617 return this[_parent] === parent || this[_parent][_symbol_utils.$isDescendent](parent); 53618 } 53619} 53620exports.XFAAttribute = XFAAttribute; 53621class XmlObject extends XFAObject { 53622 constructor(nsId, name, attributes = {}) { 53623 super(nsId, name); 53624 this[_symbol_utils.$content] = ""; 53625 this[_dataValue] = null; 53626 if (name !== "#text") { 53627 const map = new Map(); 53628 this[_attributes] = map; 53629 for (const [attrName, value] of Object.entries(attributes)) { 53630 map.set(attrName, new XFAAttribute(this, attrName, value)); 53631 } 53632 if (attributes.hasOwnProperty(_symbol_utils.$nsAttributes)) { 53633 const dataNode = attributes[_symbol_utils.$nsAttributes].xfa.dataNode; 53634 if (dataNode !== undefined) { 53635 if (dataNode === "dataGroup") { 53636 this[_dataValue] = false; 53637 } else if (dataNode === "dataValue") { 53638 this[_dataValue] = true; 53639 } 53640 } 53641 } 53642 } 53643 this[_symbol_utils.$consumed] = false; 53644 } 53645 [_symbol_utils.$toString](buf) { 53646 const tagName = this[_symbol_utils.$nodeName]; 53647 if (tagName === "#text") { 53648 buf.push((0, _core_utils.encodeToXmlString)(this[_symbol_utils.$content])); 53649 return; 53650 } 53651 const utf8TagName = (0, _util.utf8StringToString)(tagName); 53652 const prefix = this[_symbol_utils.$namespaceId] === NS_DATASETS ? "xfa:" : ""; 53653 buf.push(`<${prefix}${utf8TagName}`); 53654 for (const [name, value] of this[_attributes].entries()) { 53655 const utf8Name = (0, _util.utf8StringToString)(name); 53656 buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[_symbol_utils.$content])}"`); 53657 } 53658 if (this[_dataValue] !== null) { 53659 if (this[_dataValue]) { 53660 buf.push(` xfa:dataNode="dataValue"`); 53661 } else { 53662 buf.push(` xfa:dataNode="dataGroup"`); 53663 } 53664 } 53665 if (!this[_symbol_utils.$content] && this[_children].length === 0) { 53666 buf.push("/>"); 53667 return; 53668 } 53669 buf.push(">"); 53670 if (this[_symbol_utils.$content]) { 53671 if (typeof this[_symbol_utils.$content] === "string") { 53672 buf.push((0, _core_utils.encodeToXmlString)(this[_symbol_utils.$content])); 53673 } else { 53674 this[_symbol_utils.$content][_symbol_utils.$toString](buf); 53675 } 53676 } else { 53677 for (const child of this[_children]) { 53678 child[_symbol_utils.$toString](buf); 53679 } 53680 } 53681 buf.push(`</${prefix}${utf8TagName}>`); 53682 } 53683 [_symbol_utils.$onChild](child) { 53684 if (this[_symbol_utils.$content]) { 53685 const node = new XmlObject(this[_symbol_utils.$namespaceId], "#text"); 53686 this[_symbol_utils.$appendChild](node); 53687 node[_symbol_utils.$content] = this[_symbol_utils.$content]; 53688 this[_symbol_utils.$content] = ""; 53689 } 53690 this[_symbol_utils.$appendChild](child); 53691 return true; 53692 } 53693 [_symbol_utils.$onText](str) { 53694 this[_symbol_utils.$content] += str; 53695 } 53696 [_symbol_utils.$finalize]() { 53697 if (this[_symbol_utils.$content] && this[_children].length > 0) { 53698 const node = new XmlObject(this[_symbol_utils.$namespaceId], "#text"); 53699 this[_symbol_utils.$appendChild](node); 53700 node[_symbol_utils.$content] = this[_symbol_utils.$content]; 53701 delete this[_symbol_utils.$content]; 53702 } 53703 } 53704 [_symbol_utils.$toHTML]() { 53705 if (this[_symbol_utils.$nodeName] === "#text") { 53706 return _utils.HTMLResult.success({ 53707 name: "#text", 53708 value: this[_symbol_utils.$content] 53709 }); 53710 } 53711 return _utils.HTMLResult.EMPTY; 53712 } 53713 [_symbol_utils.$getChildren](name = null) { 53714 if (!name) { 53715 return this[_children]; 53716 } 53717 return this[_children].filter(c => c[_symbol_utils.$nodeName] === name); 53718 } 53719 [_symbol_utils.$getAttributes]() { 53720 return this[_attributes]; 53721 } 53722 [_symbol_utils.$getChildrenByClass](name) { 53723 const value = this[_attributes].get(name); 53724 if (value !== undefined) { 53725 return value; 53726 } 53727 return this[_symbol_utils.$getChildren](name); 53728 } 53729 *[_symbol_utils.$getChildrenByNameIt](name, allTransparent) { 53730 const value = this[_attributes].get(name); 53731 if (value) { 53732 yield value; 53733 } 53734 for (const child of this[_children]) { 53735 if (child[_symbol_utils.$nodeName] === name) { 53736 yield child; 53737 }
53738 if (allTransparent) { 53739 yield* child[_symbol_utils.$getChildrenByNameIt](name, allTransparent); 53740 } 53741 } 53742 } 53743 *[_symbol_utils.$getAttributeIt](name, skipConsumed) { 53744 const value = this[_attributes].get(name); 53745 if (value && (!skipConsumed || !value[_symbol_utils.$consumed])) { 53746 yield value; 53747 } 53748 for (const child of this[_children]) { 53749 yield* child[_symbol_utils.$getAttributeIt](name, skipConsumed); 53750 } 53751 } 53752 *[_symbol_utils.$getRealChildrenByNameIt](name, allTransparent, skipConsumed) { 53753 for (const child of this[_children]) { 53754 if (child[_symbol_utils.$nodeName] === name && (!skipConsumed || !child[_symbol_utils.$consumed])) { 53755 yield child; 53756 } 53757 if (allTransparent) { 53758 yield* child[_symbol_utils.$getRealChildrenByNameIt](name, allTransparent, skipConsumed); 53759 } 53760 } 53761 } 53762 [_symbol_utils.$isDataValue]() { 53763 if (this[_dataValue] === null) { 53764 return this[_children].length === 0 || this[_children][0][_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.xhtml.id; 53765 } 53766 return this[_dataValue]; 53767 } 53768 [_symbol_utils.$getDataValue]() { 53769 if (this[_dataValue] === null) { 53770 if (this[_children].length === 0) { 53771 return this[_symbol_utils.$content].trim(); 53772 } 53773 if (this[_children][0][_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { 53774 return this[_children][0][_symbol_utils.$text]().trim(); 53775 } 53776 return null; 53777 } 53778 return this[_symbol_utils.$content].trim(); 53779 } 53780 [_symbol_utils.$setValue](value) { 53781 value = value.value || ""; 53782 this[_symbol_utils.$content] = value.toString(); 53783 } 53784 [_symbol_utils.$dump](hasNS = false) { 53785 const dumped = Object.create(null); 53786 if (hasNS) { 53787 dumped.$ns = this[_symbol_utils.$namespaceId]; 53788 } 53789 if (this[_symbol_utils.$content]) { 53790 dumped.$content = this[_symbol_utils.$content]; 53791 } 53792 dumped.$name = this[_symbol_utils.$nodeName]; 53793 dumped.children = []; 53794 for (const child of this[_children]) { 53795 dumped.children.push(child[_symbol_utils.$dump](hasNS)); 53796 } 53797 dumped.attributes = Object.create(null); 53798 for (const [name, value] of this[_attributes]) { 53799 dumped.attributes[name] = value[_symbol_utils.$content]; 53800 } 53801 return dumped; 53802 } 53803} 53804exports.XmlObject = XmlObject; 53805class ContentObject extends XFAObject { 53806 constructor(nsId, name) { 53807 super(nsId, name); 53808 this[_symbol_utils.$content] = ""; 53809 } 53810 [_symbol_utils.$onText](text) { 53811 this[_symbol_utils.$content] += text; 53812 } 53813 [_symbol_utils.$finalize]() {} 53814} 53815exports.ContentObject = ContentObject; 53816class OptionObject extends ContentObject { 53817 constructor(nsId, name, options) { 53818 super(nsId, name); 53819 this[_options] = options; 53820 } 53821 [_symbol_utils.$finalize]() { 53822 this[_symbol_utils.$content] = (0, _utils.getKeyword)({ 53823 data: this[_symbol_utils.$content], 53824 defaultValue: this[_options][0], 53825 validate: k => this[_options].includes(k) 53826 }); 53827 } 53828 [_symbol_utils.$clean](builder) { 53829 super[_symbol_utils.$clean](builder); 53830 delete this[_options]; 53831 } 53832} 53833exports.OptionObject = OptionObject; 53834class StringObject extends ContentObject { 53835 [_symbol_utils.$finalize]() { 53836 this[_symbol_utils.$content] = this[_symbol_utils.$content].trim(); 53837 } 53838} 53839exports.StringObject = StringObject; 53840class IntegerObject extends ContentObject { 53841 constructor(nsId, name, defaultValue, validator) { 53842 super(nsId, name); 53843 this[_defaultValue] = defaultValue; 53844 this[_validator] = validator; 53845 } 53846 [_symbol_utils.$finalize]() { 53847 this[_symbol_utils.$content] = (0, _utils.getInteger)({ 53848 data: this[_symbol_utils.$content], 53849 defaultValue: this[_defaultValue], 53850 validate: this[_validator] 53851 }); 53852 } 53853 [_symbol_utils.$clean](builder) { 53854 super[_symbol_utils.$clean](builder); 53855 delete this[_defaultValue]; 53856 delete this[_validator]; 53857 } 53858} 53859exports.IntegerObject = IntegerObject; 53860class Option01 extends IntegerObject { 53861 constructor(nsId, name) { 53862 super(nsId, name, 0, n => n === 1); 53863 } 53864} 53865exports.Option01 = Option01; 53866class Option10 extends IntegerObject { 53867 constructor(nsId, name) { 53868 super(nsId, name, 1, n => n === 0); 53869 } 53870} 53871exports.Option10 = Option10; 53872 53873/***/ }), 53874/* 88 */ 53875/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 53876 53877 53878 53879Object.defineProperty(exports, "__esModule", ({ 53880 value: true 53881})); 53882exports.createDataNode = createDataNode; 53883exports.searchNode = searchNode; 53884var _symbol_utils = __w_pdfjs_require__(78); 53885var _util = __w_pdfjs_require__(2); 53886const namePattern = /^[^.[]+/; 53887const indexPattern = /^[^\]]+/; 53888const operators = { 53889 dot: 0, 53890 dotDot: 1, 53891 dotHash: 2, 53892 dotBracket: 3, 53893 dotParen: 4 53894}; 53895const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[_symbol_utils.$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]]); 53896const somCache = new WeakMap(); 53897function parseIndex(index) { 53898 index = index.trim(); 53899 if (index === "*") { 53900 return Infinity; 53901 } 53902 return parseInt(index, 10) || 0; 53903} 53904function parseExpression(expr, dotDotAllowed, noExpr = true) { 53905 let match = expr.match(namePattern); 53906 if (!match) { 53907 return null; 53908 } 53909 let [name] = match; 53910 const parsed = [{ 53911 name, 53912 cacheName: "." + name, 53913 index: 0, 53914 js: null, 53915 formCalc: null, 53916 operator: operators.dot 53917 }]; 53918 let pos = name.length; 53919 while (pos < expr.length) { 53920 const spos = pos; 53921 const char = expr.charAt(pos++); 53922 if (char === "[") { 53923 match = expr.slice(pos).match(indexPattern); 53924 if (!match) { 53925 (0, _util.warn)("XFA - Invalid index in SOM expression"); 53926 return null; 53927 } 53928 parsed.at(-1).index = parseIndex(match[0]); 53929 pos += match[0].length + 1; 53930 continue; 53931 } 53932 let operator; 53933 switch (expr.charAt(pos)) { 53934 case ".": 53935 if (!dotDotAllowed) { 53936 return null; 53937 } 53938 pos++; 53939 operator = operators.dotDot; 53940 break; 53941 case "#": 53942 pos++; 53943 operator = operators.dotHash; 53944 break; 53945 case "[": 53946 if (noExpr) { 53947 (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now."); 53948 return null; 53949 } 53950 operator = operators.dotBracket; 53951 break; 53952 case "(": 53953 if (noExpr) { 53954 (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now."); 53955 return null; 53956 } 53957 operator = operators.dotParen; 53958 break; 53959 default: 53960 operator = operators.dot; 53961 break; 53962 } 53963 match = expr.slice(pos).match(namePattern); 53964 if (!match) { 53965 break; 53966 } 53967 [name] = match; 53968 pos += name.length; 53969 parsed.push({ 53970 name, 53971 cacheName: expr.slice(spos, pos), 53972 operator, 53973 index: 0, 53974 js: null, 53975 formCalc: null 53976 }); 53977 } 53978 return parsed; 53979} 53980function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) { 53981 const parsed = parseExpression(expr, dotDotAllowed); 53982 if (!parsed) { 53983 return null; 53984 } 53985 const fn = shortcuts.get(parsed[0].name); 53986 let i = 0; 53987 let isQualified; 53988 if (fn) { 53989 isQualified = true; 53990 root = [fn(root, container)]; 53991 i = 1; 53992 } else { 53993 isQualified = container === null; 53994 root = [container || root]; 53995 } 53996 for (let ii = parsed.length; i < ii; i++) { 53997 const { 53998 name, 53999 cacheName, 54000 operator, 54001 index 54002 } = parsed[i]; 54003 const nodes = []; 54004 for (const node of root) { 54005 if (!node.isXFAObject) { 54006 continue; 54007 }
54008 let children, cached; 54009 if (useCache) { 54010 cached = somCache.get(node); 54011 if (!cached) { 54012 cached = new Map(); 54013 somCache.set(node, cached); 54014 } 54015 children = cached.get(cacheName); 54016 } 54017 if (!children) { 54018 switch (operator) { 54019 case operators.dot: 54020 children = node[_symbol_utils.$getChildrenByName](name, false); 54021 break; 54022 case operators.dotDot: 54023 children = node[_symbol_utils.$getChildrenByName](name, true); 54024 break; 54025 case operators.dotHash: 54026 children = node[_symbol_utils.$getChildrenByClass](name); 54027 children = children.isXFAObjectArray ? children.children : [children]; 54028 break; 54029 default: 54030 break; 54031 } 54032 if (useCache) { 54033 cached.set(cacheName, children); 54034 } 54035 } 54036 if (children.length > 0) { 54037 nodes.push(children); 54038 } 54039 } 54040 if (nodes.length === 0 && !isQualified && i === 0) { 54041 const parent = container[_symbol_utils.$getParent](); 54042 container = parent; 54043 if (!container) { 54044 return null; 54045 } 54046 i = -1; 54047 root = [container]; 54048 continue; 54049 } 54050 root = isFinite(index) ? nodes.filter(node => index < node.length).map(node => node[index]) : nodes.flat(); 54051 } 54052 if (root.length === 0) { 54053 return null; 54054 } 54055 return root; 54056} 54057function createDataNode(root, container, expr) { 54058 const parsed = parseExpression(expr); 54059 if (!parsed) { 54060 return null; 54061 } 54062 if (parsed.some(x => x.operator === operators.dotDot)) { 54063 return null; 54064 } 54065 const fn = shortcuts.get(parsed[0].name); 54066 let i = 0; 54067 if (fn) { 54068 root = fn(root, container); 54069 i = 1; 54070 } else { 54071 root = container || root; 54072 } 54073 for (let ii = parsed.length; i < ii; i++) { 54074 const { 54075 name, 54076 operator, 54077 index 54078 } = parsed[i]; 54079 if (!isFinite(index)) { 54080 parsed[i].index = 0; 54081 return root.createNodes(parsed.slice(i)); 54082 } 54083 let children; 54084 switch (operator) { 54085 case operators.dot: 54086 children = root[_symbol_utils.$getChildrenByName](name, false); 54087 break; 54088 case operators.dotDot: 54089 children = root[_symbol_utils.$getChildrenByName](name, true); 54090 break; 54091 case operators.dotHash: 54092 children = root[_symbol_utils.$getChildrenByClass](name); 54093 children = children.isXFAObjectArray ? children.children : [children]; 54094 break; 54095 default: 54096 break; 54097 } 54098 if (children.length === 0) { 54099 return root.createNodes(parsed.slice(i)); 54100 } 54101 if (index < children.length) { 54102 const child = children[index]; 54103 if (!child.isXFAObject) { 54104 (0, _util.warn)(`XFA - Cannot create a node.`); 54105 return null; 54106 } 54107 root = child; 54108 } else { 54109 parsed[i].index = index - children.length; 54110 return root.createNodes(parsed.slice(i)); 54111 } 54112 } 54113 return null; 54114} 54115 54116/***/ }), 54117/* 89 */ 54118/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54119 54120 54121 54122Object.defineProperty(exports, "__esModule", ({ 54123 value: true 54124})); 54125exports.DataHandler = void 0; 54126var _symbol_utils = __w_pdfjs_require__(78); 54127class DataHandler { 54128 constructor(root, data) { 54129 this.data = data; 54130 this.dataset = root.datasets || null; 54131 } 54132 serialize(storage) { 54133 const stack = [[-1, this.data[_symbol_utils.$getChildren]()]]; 54134 while (stack.length > 0) { 54135 const last = stack.at(-1); 54136 const [i, children] = last; 54137 if (i + 1 === children.length) { 54138 stack.pop(); 54139 continue; 54140 } 54141 const child = children[++last[0]]; 54142 const storageEntry = storage.get(child[_symbol_utils.$uid]); 54143 if (storageEntry) { 54144 child[_symbol_utils.$setValue](storageEntry); 54145 } else { 54146 const attributes = child[_symbol_utils.$getAttributes](); 54147 for (const value of attributes.values()) { 54148 const entry = storage.get(value[_symbol_utils.$uid]); 54149 if (entry) { 54150 value[_symbol_utils.$setValue](entry); 54151 break; 54152 } 54153 } 54154 } 54155 const nodes = child[_symbol_utils.$getChildren](); 54156 if (nodes.length > 0) { 54157 stack.push([-1, nodes]); 54158 } 54159 } 54160 const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`]; 54161 if (this.dataset) { 54162 for (const child of this.dataset[_symbol_utils.$getChildren]()) { 54163 if (child[_symbol_utils.$nodeName] !== "data") { 54164 child[_symbol_utils.$toString](buf); 54165 } 54166 } 54167 } 54168 this.data[_symbol_utils.$toString](buf); 54169 buf.push("</xfa:datasets>"); 54170 return buf.join(""); 54171 } 54172} 54173exports.DataHandler = DataHandler; 54174 54175/***/ }), 54176/* 90 */ 54177/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54178 54179 54180 54181Object.defineProperty(exports, "__esModule", ({ 54182 value: true 54183})); 54184exports.XFAParser = void 0; 54185var _symbol_utils = __w_pdfjs_require__(78); 54186var _xml_parser = __w_pdfjs_require__(71); 54187var _builder = __w_pdfjs_require__(91); 54188var _util = __w_pdfjs_require__(2); 54189class XFAParser extends _xml_parser.XMLParserBase {
54190 constructor(rootNameSpace = null, richText = false) { 54191 super(); 54192 this._builder = new _builder.Builder(rootNameSpace); 54193 this._stack = []; 54194 this._globalData = { 54195 usedTypefaces: new Set() 54196 }; 54197 this._ids = new Map(); 54198 this._current = this._builder.buildRoot(this._ids); 54199 this._errorCode = _xml_parser.XMLParserErrorCode.NoError; 54200 this._whiteRegex = /^\s+$/; 54201 this._nbsps = /\xa0+/g; 54202 this._richText = richText; 54203 } 54204 parse(data) { 54205 this.parseXml(data); 54206 if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) { 54207 return undefined; 54208 } 54209 this._current[_symbol_utils.$finalize](); 54210 return this._current.element; 54211 } 54212 onText(text) { 54213 text = text.replace(this._nbsps, match => match.slice(1) + " "); 54214 if (this._richText || this._current[_symbol_utils.$acceptWhitespace]()) { 54215 this._current[_symbol_utils.$onText](text, this._richText); 54216 return; 54217 } 54218 if (this._whiteRegex.test(text)) { 54219 return; 54220 } 54221 this._current[_symbol_utils.$onText](text.trim()); 54222 } 54223 onCdata(text) { 54224 this._current[_symbol_utils.$onText](text); 54225 } 54226 _mkAttributes(attributes, tagName) { 54227 let namespace = null; 54228 let prefixes = null; 54229 const attributeObj = Object.create({}); 54230 for (const { 54231 name, 54232 value 54233 } of attributes) { 54234 if (name === "xmlns") { 54235 if (!namespace) { 54236 namespace = value; 54237 } else { 54238 (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`); 54239 } 54240 } else if (name.startsWith("xmlns:")) { 54241 const prefix = name.substring("xmlns:".length); 54242 if (!prefixes) { 54243 prefixes = []; 54244 } 54245 prefixes.push({ 54246 prefix, 54247 value 54248 }); 54249 } else { 54250 const i = name.indexOf(":"); 54251 if (i === -1) { 54252 attributeObj[name] = value; 54253 } else { 54254 let nsAttrs = attributeObj[_symbol_utils.$nsAttributes]; 54255 if (!nsAttrs) { 54256 nsAttrs = attributeObj[_symbol_utils.$nsAttributes] = Object.create(null); 54257 } 54258 const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)]; 54259 const attrs = nsAttrs[ns] ||= Object.create(null); 54260 attrs[attrName] = value; 54261 } 54262 } 54263 } 54264 return [namespace, prefixes, attributeObj]; 54265 } 54266 _getNameAndPrefix(name, nsAgnostic) { 54267 const i = name.indexOf(":"); 54268 if (i === -1) { 54269 return [name, null]; 54270 } 54271 return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)]; 54272 } 54273 onBeginElement(tagName, attributes, isEmpty) { 54274 const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName); 54275 const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic()); 54276 const node = this._builder.build({ 54277 nsPrefix, 54278 name, 54279 attributes: attributesObj, 54280 namespace, 54281 prefixes 54282 }); 54283 node[_symbol_utils.$globalData] = this._globalData; 54284 if (isEmpty) { 54285 node[_symbol_utils.$finalize](); 54286 if (this._current[_symbol_utils.$onChild](node)) { 54287 node[_symbol_utils.$setId](this._ids); 54288 } 54289 node[_symbol_utils.$clean](this._builder); 54290 return; 54291 } 54292 this._stack.push(this._current); 54293 this._current = node; 54294 } 54295 onEndElement(name) { 54296 const node = this._current; 54297 if (node[_symbol_utils.$isCDATAXml]() && typeof node[_symbol_utils.$content] === "string") { 54298 const parser = new XFAParser(); 54299 parser._globalData = this._globalData; 54300 const root = parser.parse(node[_symbol_utils.$content]); 54301 node[_symbol_utils.$content] = null; 54302 node[_symbol_utils.$onChild](root); 54303 } 54304 node[_symbol_utils.$finalize](); 54305 this._current = this._stack.pop(); 54306 if (this._current[_symbol_utils.$onChild](node)) { 54307 node[_symbol_utils.$setId](this._ids); 54308 } 54309 node[_symbol_utils.$clean](this._builder); 54310 } 54311 onError(code) { 54312 this._errorCode = code; 54313 } 54314} 54315exports.XFAParser = XFAParser; 54316 54317/***/ }), 54318/* 91 */ 54319/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54320 54321 54322 54323Object.defineProperty(exports, "__esModule", ({ 54324 value: true 54325})); 54326exports.Builder = void 0; 54327var _namespaces = __w_pdfjs_require__(81); 54328var _symbol_utils = __w_pdfjs_require__(78); 54329var _setup = __w_pdfjs_require__(92); 54330var _template = __w_pdfjs_require__(80); 54331var _unknown = __w_pdfjs_require__(101); 54332var _util = __w_pdfjs_require__(2); 54333var _xfa_object = __w_pdfjs_require__(87); 54334class Root extends _xfa_object.XFAObject { 54335 constructor(ids) { 54336 super(-1, "root", Object.create(null)); 54337 this.element = null; 54338 this[_symbol_utils.$ids] = ids; 54339 } 54340 [_symbol_utils.$onChild](child) { 54341 this.element = child; 54342 return true; 54343 } 54344 [_symbol_utils.$finalize]() { 54345 super[_symbol_utils.$finalize](); 54346 if (this.element.template instanceof _template.Template) { 54347 this[_symbol_utils.$ids].set(_symbol_utils.$root, this.element); 54348 this.element.template[_symbol_utils.$resolvePrototypes](this[_symbol_utils.$ids]); 54349 this.element.template[_symbol_utils.$ids] = this[_symbol_utils.$ids]; 54350 } 54351 } 54352} 54353class Empty extends _xfa_object.XFAObject { 54354 constructor() { 54355 super(-1, "", Object.create(null)); 54356 } 54357 [_symbol_utils.$onChild](_) { 54358 return false;
54359 } 54360} 54361class Builder { 54362 constructor(rootNameSpace = null) { 54363 this._namespaceStack = []; 54364 this._nsAgnosticLevel = 0; 54365 this._namespacePrefixes = new Map(); 54366 this._namespaces = new Map(); 54367 this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({ 54368 id 54369 }) => id)); 54370 this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId); 54371 } 54372 buildRoot(ids) { 54373 return new Root(ids); 54374 } 54375 build({ 54376 nsPrefix, 54377 name, 54378 attributes, 54379 namespace, 54380 prefixes 54381 }) { 54382 const hasNamespaceDef = namespace !== null; 54383 if (hasNamespaceDef) { 54384 this._namespaceStack.push(this._currentNamespace); 54385 this._currentNamespace = this._searchNamespace(namespace); 54386 } 54387 if (prefixes) { 54388 this._addNamespacePrefix(prefixes); 54389 } 54390 if (attributes.hasOwnProperty(_symbol_utils.$nsAttributes)) { 54391 const dataTemplate = _setup.NamespaceSetUp.datasets; 54392 const nsAttrs = attributes[_symbol_utils.$nsAttributes]; 54393 let xfaAttrs = null; 54394 for (const [ns, attrs] of Object.entries(nsAttrs)) { 54395 const nsToUse = this._getNamespaceToUse(ns); 54396 if (nsToUse === dataTemplate) { 54397 xfaAttrs = { 54398 xfa: attrs 54399 }; 54400 break; 54401 } 54402 } 54403 if (xfaAttrs) { 54404 attributes[_symbol_utils.$nsAttributes] = xfaAttrs; 54405 } else { 54406 delete attributes[_symbol_utils.$nsAttributes]; 54407 } 54408 } 54409 const namespaceToUse = this._getNamespaceToUse(nsPrefix); 54410 const node = namespaceToUse?.[_namespaces.$buildXFAObject](name, attributes) || new Empty(); 54411 if (node[_symbol_utils.$isNsAgnostic]()) { 54412 this._nsAgnosticLevel++; 54413 } 54414 if (hasNamespaceDef || prefixes || node[_symbol_utils.$isNsAgnostic]()) { 54415 node[_symbol_utils.$cleanup] = { 54416 hasNamespace: hasNamespaceDef, 54417 prefixes, 54418 nsAgnostic: node[_symbol_utils.$isNsAgnostic]() 54419 }; 54420 } 54421 return node; 54422 } 54423 isNsAgnostic() { 54424 return this._nsAgnosticLevel > 0; 54425 } 54426 _searchNamespace(nsName) { 54427 let ns = this._namespaces.get(nsName); 54428 if (ns) { 54429 return ns; 54430 } 54431 for (const [name, { 54432 check 54433 }] of Object.entries(_namespaces.NamespaceIds)) { 54434 if (check(nsName)) { 54435 ns = _setup.NamespaceSetUp[name]; 54436 if (ns) { 54437 this._namespaces.set(nsName, ns); 54438 return ns; 54439 } 54440 break; 54441 } 54442 } 54443 ns = new _unknown.UnknownNamespace(++this._nextNsId); 54444 this._namespaces.set(nsName, ns); 54445 return ns; 54446 } 54447 _addNamespacePrefix(prefixes) { 54448 for (const { 54449 prefix, 54450 value 54451 } of prefixes) { 54452 const namespace = this._searchNamespace(value); 54453 let prefixStack = this._namespacePrefixes.get(prefix); 54454 if (!prefixStack) { 54455 prefixStack = []; 54456 this._namespacePrefixes.set(prefix, prefixStack); 54457 } 54458 prefixStack.push(namespace); 54459 } 54460 } 54461 _getNamespaceToUse(prefix) { 54462 if (!prefix) { 54463 return this._currentNamespace; 54464 } 54465 const prefixStack = this._namespacePrefixes.get(prefix); 54466 if (prefixStack?.length > 0) { 54467 return prefixStack.at(-1); 54468 } 54469 (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`); 54470 return null; 54471 } 54472 clean(data) { 54473 const { 54474 hasNamespace, 54475 prefixes, 54476 nsAgnostic 54477 } = data; 54478 if (hasNamespace) { 54479 this._currentNamespace = this._namespaceStack.pop(); 54480 } 54481 if (prefixes) { 54482 prefixes.forEach(({ 54483 prefix 54484 }) => { 54485 this._namespacePrefixes.get(prefix).pop(); 54486 }); 54487 } 54488 if (nsAgnostic) { 54489 this._nsAgnosticLevel--; 54490 } 54491 } 54492} 54493exports.Builder = Builder; 54494 54495/***/ }), 54496/* 92 */ 54497/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54498 54499 54500 54501Object.defineProperty(exports, "__esModule", ({ 54502 value: true 54503})); 54504exports.NamespaceSetUp = void 0; 54505var _config = __w_pdfjs_require__(93); 54506var _connection_set = __w_pdfjs_require__(94); 54507var _datasets = __w_pdfjs_require__(95); 54508var _locale_set = __w_pdfjs_require__(96); 54509var _signature = __w_pdfjs_require__(97); 54510var _stylesheet = __w_pdfjs_require__(98); 54511var _template = __w_pdfjs_require__(80); 54512var _xdp = __w_pdfjs_require__(99); 54513var _xhtml = __w_pdfjs_require__(100); 54514const NamespaceSetUp = { 54515 config: _config.ConfigNamespace, 54516 connection: _connection_set.ConnectionSetNamespace, 54517 datasets: _datasets.DatasetsNamespace,
54518 localeSet: _locale_set.LocaleSetNamespace, 54519 signature: _signature.SignatureNamespace, 54520 stylesheet: _stylesheet.StylesheetNamespace, 54521 template: _template.TemplateNamespace, 54522 xdp: _xdp.XdpNamespace, 54523 xhtml: _xhtml.XhtmlNamespace 54524}; 54525exports.NamespaceSetUp = NamespaceSetUp; 54526 54527/***/ }), 54528/* 93 */ 54529/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 54530 54531 54532 54533Object.defineProperty(exports, "__esModule", ({ 54534 value: true 54535})); 54536exports.ConfigNamespace = void 0; 54537var _namespaces = __w_pdfjs_require__(81); 54538var _symbol_utils = __w_pdfjs_require__(78); 54539var _xfa_object = __w_pdfjs_require__(87); 54540var _utils = __w_pdfjs_require__(84); 54541var _util = __w_pdfjs_require__(2); 54542const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id; 54543class Acrobat extends _xfa_object.XFAObject { 54544 constructor(attributes) { 54545 super(CONFIG_NS_ID, "acrobat", true); 54546 this.acrobat7 = null; 54547 this.autoSave = null; 54548 this.common = null; 54549 this.validate = null; 54550 this.validateApprovalSignatures = null; 54551 this.submitUrl = new _xfa_object.XFAObjectArray(); 54552 } 54553} 54554class Acrobat7 extends _xfa_object.XFAObject { 54555 constructor(attributes) { 54556 super(CONFIG_NS_ID, "acrobat7", true); 54557 this.dynamicRender = null; 54558 } 54559} 54560class ADBE_JSConsole extends _xfa_object.OptionObject { 54561 constructor(attributes) { 54562 super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]); 54563 } 54564} 54565class ADBE_JSDebugger extends _xfa_object.OptionObject { 54566 constructor(attributes) { 54567 super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]); 54568 } 54569} 54570class AddSilentPrint extends _xfa_object.Option01 { 54571 constructor(attributes) { 54572 super(CONFIG_NS_ID, "addSilentPrint"); 54573 } 54574} 54575class AddViewerPreferences extends _xfa_object.Option01 { 54576 constructor(attributes) { 54577 super(CONFIG_NS_ID, "addViewerPreferences"); 54578 } 54579} 54580class AdjustData extends _xfa_object.Option10 { 54581 constructor(attributes) { 54582 super(CONFIG_NS_ID, "adjustData"); 54583 } 54584} 54585class AdobeExtensionLevel extends _xfa_object.IntegerObject { 54586 constructor(attributes) { 54587 super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8); 54588 } 54589} 54590class Agent extends _xfa_object.XFAObject { 54591 constructor(attributes) { 54592 super(CONFIG_NS_ID, "agent", true); 54593 this.name = attributes.name ? attributes.name.trim() : ""; 54594 this.common = new _xfa_object.XFAObjectArray(); 54595 } 54596} 54597class AlwaysEmbed extends _xfa_object.ContentObject { 54598 constructor(attributes) { 54599 super(CONFIG_NS_ID, "alwaysEmbed"); 54600 } 54601} 54602class Amd extends _xfa_object.StringObject { 54603 constructor(attributes) { 54604 super(CONFIG_NS_ID, "amd"); 54605 } 54606} 54607class Area extends _xfa_object.XFAObject { 54608 constructor(attributes) { 54609 super(CONFIG_NS_ID, "area"); 54610 this.level = (0, _utils.getInteger)({ 54611 data: attributes.level, 54612 defaultValue: 0, 54613 validate: n => n >= 1 && n <= 3 54614 }); 54615 this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]); 54616 } 54617} 54618class Attributes extends _xfa_object.OptionObject { 54619 constructor(attributes) { 54620 super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]); 54621 } 54622} 54623class AutoSave extends _xfa_object.OptionObject { 54624 constructor(attributes) { 54625 super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]); 54626 } 54627} 54628class Base extends _xfa_object.StringObject { 54629 constructor(attributes) { 54630 super(CONFIG_NS_ID, "base"); 54631 } 54632} 54633class BatchOutput extends _xfa_object.XFAObject { 54634 constructor(attributes) { 54635 super(CONFIG_NS_ID, "batchOutput"); 54636 this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]); 54637 } 54638} 54639class BehaviorOverride extends _xfa_object.ContentObject { 54640 constructor(attributes) { 54641 super(CONFIG_NS_ID, "behaviorOverride"); 54642 } 54643 [_symbol_utils.$finalize]() { 54644 this[_symbol_utils.$content] = new Map(this[_symbol_utils.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2))); 54645 } 54646} 54647class Cache extends _xfa_object.XFAObject { 54648 constructor(attributes) { 54649 super(CONFIG_NS_ID, "cache", true); 54650 this.templateCache = null; 54651 } 54652} 54653class Change extends _xfa_object.Option01 { 54654 constructor(attributes) { 54655 super(CONFIG_NS_ID, "change"); 54656 } 54657} 54658class Common extends _xfa_object.XFAObject { 54659 constructor(attributes) { 54660 super(CONFIG_NS_ID, "common", true); 54661 this.data = null; 54662 this.locale = null; 54663 this.localeSet = null; 54664 this.messaging = null; 54665 this.suppressBanner = null; 54666 this.template = null; 54667 this.validationMessaging = null; 54668 this.versionControl = null; 54669 this.log = new _xfa_object.XFAObjectArray(); 54670 } 54671} 54672class Compress extends _xfa_object.XFAObject { 54673 constructor(attributes) { 54674 super(CONFIG_NS_ID, "compress"); 54675 this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]); 54676 } 54677} 54678class CompressLogicalStructure extends _xfa_object.Option01 { 54679 constructor(attributes) { 54680 super(CONFIG_NS_ID, "compressLogicalStructure"); 54681 } 54682} 54683class CompressObjectStream extends _xfa_object.Option10 { 54684 constructor(attributes) { 54685 super(CONFIG_NS_ID, "compressObjectStream"); 54686 } 54687} 54688class Compression extends _xfa_object.XFAObject { 54689 constructor(attributes) { 54690 super(CONFIG_NS_ID, "compression", true); 54691 this.compressLogicalStructure = null; 54692 this.compressObjectStream = null; 54693 this.level = null; 54694 this.type = null; 54695 } 54696} 54697class Config extends _xfa_object.XFAObject { 54698 constructor(attributes) { 54699 super(CONFIG_NS_ID, "config", true); 54700 this.acrobat = null; 54701 this.present = null; 54702 this.trace = null; 54703 this.agent = new _xfa_object.XFAObjectArray(); 54704 } 54705} 54706class Conformance extends _xfa_object.OptionObject { 54707 constructor(attributes) { 54708 super(CONFIG_NS_ID, "conformance", ["A", "B"]); 54709 } 54710} 54711class ContentCopy extends _xfa_object.Option01 { 54712 constructor(attributes) { 54713 super(CONFIG_NS_ID, "contentCopy"); 54714 } 54715} 54716class Copies extends _xfa_object.IntegerObject { 54717 constructor(attributes) { 54718 super(CONFIG_NS_ID, "copies", 1, n => n >= 1); 54719 } 54720} 54721class Creator extends _xfa_object.StringObject { 54722 constructor(attributes) { 54723 super(CONFIG_NS_ID, "creator"); 54724 } 54725} 54726class CurrentPage extends _xfa_object.IntegerObject { 54727 constructor(attributes) { 54728 super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0); 54729 } 54730} 54731class Data extends _xfa_object.XFAObject { 54732 constructor(attributes) { 54733 super(CONFIG_NS_ID, "data", true); 54734 this.adjustData = null; 54735 this.attributes = null; 54736 this.incrementalLoad = null; 54737 this.outputXSL = null; 54738 this.range = null; 54739 this.record = null; 54740 this.startNode = null; 54741 this.uri = null; 54742 this.window = null; 54743 this.xsl = null; 54744 this.excludeNS = new _xfa_object.XFAObjectArray(); 54745 this.transform = new _xfa_object.XFAObjectArray(); 54746 } 54747} 54748class Debug extends _xfa_object.XFAObject { 54749 constructor(attributes) { 54750 super(CONFIG_NS_ID, "debug", true); 54751 this.uri = null; 54752 } 54753} 54754class DefaultTypeface extends _xfa_object.ContentObject { 54755 constructor(attributes) { 54756 super(CONFIG_NS_ID, "defaultTypeface"); 54757 this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]); 54758 } 54759} 54760class Destination extends _xfa_object.OptionObject { 54761 constructor(attributes) { 54762 super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]); 54763 } 54764} 54765class DocumentAssembly extends _xfa_object.Option01 { 54766 constructor(attributes) { 54767 super(CONFIG_NS_ID, "documentAssembly"); 54768 } 54769} 54770class Driver extends _xfa_object.XFAObject { 54771 constructor(attributes) { 54772 super(CONFIG_NS_ID, "driver", true); 54773 this.name = attributes.name ? attributes.name.trim() : ""; 54774 this.fontInfo = null; 54775 this.xdc = null; 54776 } 54777} 54778class DuplexOption extends _xfa_object.OptionObject { 54779 constructor(attributes) { 54780 super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]); 54781 } 54782} 54783class DynamicRender extends _xfa_object.OptionObject { 54784 constructor(attributes) { 54785 super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]); 54786 } 54787} 54788class Embed extends _xfa_object.Option01 { 54789 constructor(attributes) { 54790 super(CONFIG_NS_ID, "embed"); 54791 } 54792} 54793class Encrypt extends _xfa_object.Option01 { 54794 constructor(attributes) { 54795 super(CONFIG_NS_ID, "encrypt"); 54796 } 54797} 54798class Encryption extends _xfa_object.XFAObject { 54799 constructor(attributes) { 54800 super(CONFIG_NS_ID, "encryption", true); 54801 this.encrypt = null; 54802 this.encryptionLevel = null; 54803 this.permissions = null; 54804 } 54805} 54806class EncryptionLevel extends _xfa_object.OptionObject { 54807 constructor(attributes) { 54808 super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]); 54809 } 54810} 54811class Enforce extends _xfa_object.StringObject { 54812 constructor(attributes) { 54813 super(CONFIG_NS_ID, "enforce"); 54814 } 54815} 54816class Equate extends _xfa_object.XFAObject { 54817 constructor(attributes) { 54818 super(CONFIG_NS_ID, "equate"); 54819 this.force = (0, _utils.getInteger)({ 54820 data: attributes.force, 54821 defaultValue: 1, 54822 validate: n => n === 0 54823 }); 54824 this.from = attributes.from || ""; 54825 this.to = attributes.to || ""; 54826 } 54827} 54828class EquateRange extends _xfa_object.XFAObject { 54829 constructor(attributes) { 54830 super(CONFIG_NS_ID, "equateRange"); 54831 this.from = attributes.from || ""; 54832 this.to = attributes.to || ""; 54833 this._unicodeRange = attributes.unicodeRange || ""; 54834 } 54835 get unicodeRange() { 54836 const ranges = []; 54837 const unicodeRegex = /U\+([0-9a-fA-F]+)/; 54838 const unicodeRange = this._unicodeRange; 54839 for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) { 54840 range = range.split("-", 2).map(x => { 54841 const found = x.match(unicodeRegex); 54842 if (!found) { 54843 return 0; 54844 } 54845 return parseInt(found[1], 16); 54846 }); 54847 if (range.length === 1) { 54848 range.push(range[0]); 54849 } 54850 ranges.push(range); 54851 } 54852 return (0, _util.shadow)(this, "unicodeRange", ranges); 54853 } 54854} 54855class Exclude extends _xfa_object.ContentObject { 54856 constructor(attributes) { 54857 super(CONFIG_NS_ID, "exclude"); 54858 } 54859 [_symbol_utils.$finalize]() { 54860 this[_symbol_utils.$content] = this[_symbol_utils.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x)); 54861 } 54862} 54863class ExcludeNS extends _xfa_object.StringObject { 54864 constructor(attributes) { 54865 super(CONFIG_NS_ID, "excludeNS"); 54866 } 54867} 54868class FlipLabel extends _xfa_object.OptionObject { 54869 constructor(attributes) { 54870 super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]); 54871 } 54872} 54873class FontInfo extends _xfa_object.XFAObject { 54874 constructor(attributes) { 54875 super(CONFIG_NS_ID, "fontInfo", true); 54876 this.embed = null; 54877 this.map = null; 54878 this.subsetBelow = null; 54879 this.alwaysEmbed = new _xfa_object.XFAObjectArray(); 54880 this.defaultTypeface = new _xfa_object.XFAObjectArray(); 54881 this.neverEmbed = new _xfa_object.XFAObjectArray(); 54882 } 54883}
54884class FormFieldFilling extends _xfa_object.Option01 { 54885 constructor(attributes) { 54886 super(CONFIG_NS_ID, "formFieldFilling"); 54887 } 54888} 54889class GroupParent extends _xfa_object.StringObject { 54890 constructor(attributes) { 54891 super(CONFIG_NS_ID, "groupParent"); 54892 } 54893} 54894class IfEmpty extends _xfa_object.OptionObject { 54895 constructor(attributes) { 54896 super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]); 54897 } 54898} 54899class IncludeXDPContent extends _xfa_object.StringObject { 54900 constructor(attributes) { 54901 super(CONFIG_NS_ID, "includeXDPContent"); 54902 } 54903} 54904class IncrementalLoad extends _xfa_object.OptionObject { 54905 constructor(attributes) { 54906 super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]); 54907 } 54908} 54909class IncrementalMerge extends _xfa_object.Option01 { 54910 constructor(attributes) { 54911 super(CONFIG_NS_ID, "incrementalMerge"); 54912 } 54913} 54914class Interactive extends _xfa_object.Option01 { 54915 constructor(attributes) { 54916 super(CONFIG_NS_ID, "interactive"); 54917 } 54918} 54919class Jog extends _xfa_object.OptionObject { 54920 constructor(attributes) { 54921 super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]); 54922 } 54923} 54924class LabelPrinter extends _xfa_object.XFAObject { 54925 constructor(attributes) { 54926 super(CONFIG_NS_ID, "labelPrinter", true); 54927 this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]); 54928 this.batchOutput = null; 54929 this.flipLabel = null; 54930 this.fontInfo = null; 54931 this.xdc = null; 54932 } 54933} 54934class Layout extends _xfa_object.OptionObject { 54935 constructor(attributes) { 54936 super(CONFIG_NS_ID, "layout", ["paginate", "panel"]); 54937 } 54938} 54939class Level extends _xfa_object.IntegerObject { 54940 constructor(attributes) { 54941 super(CONFIG_NS_ID, "level", 0, n => n > 0); 54942 } 54943} 54944class Linearized extends _xfa_object.Option01 { 54945 constructor(attributes) { 54946 super(CONFIG_NS_ID, "linearized"); 54947 } 54948} 54949class Locale extends _xfa_object.StringObject { 54950 constructor(attributes) { 54951 super(CONFIG_NS_ID, "locale"); 54952 } 54953} 54954class LocaleSet extends _xfa_object.StringObject { 54955 constructor(attributes) { 54956 super(CONFIG_NS_ID, "localeSet"); 54957 } 54958} 54959class Log extends _xfa_object.XFAObject { 54960 constructor(attributes) { 54961 super(CONFIG_NS_ID, "log", true); 54962 this.mode = null; 54963 this.threshold = null; 54964 this.to = null; 54965 this.uri = null; 54966 } 54967} 54968class MapElement extends _xfa_object.XFAObject { 54969 constructor(attributes) { 54970 super(CONFIG_NS_ID, "map", true); 54971 this.equate = new _xfa_object.XFAObjectArray(); 54972 this.equateRange = new _xfa_object.XFAObjectArray(); 54973 } 54974} 54975class MediumInfo extends _xfa_object.XFAObject { 54976 constructor(attributes) { 54977 super(CONFIG_NS_ID, "mediumInfo", true); 54978 this.map = null; 54979 } 54980} 54981class Message extends _xfa_object.XFAObject { 54982 constructor(attributes) { 54983 super(CONFIG_NS_ID, "message", true); 54984 this.msgId = null; 54985 this.severity = null; 54986 } 54987} 54988class Messaging extends _xfa_object.XFAObject { 54989 constructor(attributes) { 54990 super(CONFIG_NS_ID, "messaging", true); 54991 this.message = new _xfa_object.XFAObjectArray(); 54992 } 54993} 54994class Mode extends _xfa_object.OptionObject { 54995 constructor(attributes) { 54996 super(CONFIG_NS_ID, "mode", ["append", "overwrite"]); 54997 } 54998} 54999class ModifyAnnots extends _xfa_object.Option01 { 55000 constructor(attributes) { 55001 super(CONFIG_NS_ID, "modifyAnnots"); 55002 } 55003} 55004class MsgId extends _xfa_object.IntegerObject { 55005 constructor(attributes) { 55006 super(CONFIG_NS_ID, "msgId", 1, n => n >= 1); 55007 } 55008} 55009class NameAttr extends _xfa_object.StringObject { 55010 constructor(attributes) { 55011 super(CONFIG_NS_ID, "nameAttr"); 55012 } 55013} 55014class NeverEmbed extends _xfa_object.ContentObject { 55015 constructor(attributes) { 55016 super(CONFIG_NS_ID, "neverEmbed"); 55017 } 55018} 55019class NumberOfCopies extends _xfa_object.IntegerObject { 55020 constructor(attributes) { 55021 super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5); 55022 } 55023} 55024class OpenAction extends _xfa_object.XFAObject { 55025 constructor(attributes) { 55026 super(CONFIG_NS_ID, "openAction", true); 55027 this.destination = null; 55028 } 55029} 55030class Output extends _xfa_object.XFAObject { 55031 constructor(attributes) { 55032 super(CONFIG_NS_ID, "output", true); 55033 this.to = null; 55034 this.type = null; 55035 this.uri = null; 55036 } 55037} 55038class OutputBin extends _xfa_object.StringObject { 55039 constructor(attributes) { 55040 super(CONFIG_NS_ID, "outputBin"); 55041 } 55042} 55043class OutputXSL extends _xfa_object.XFAObject { 55044 constructor(attributes) { 55045 super(CONFIG_NS_ID, "outputXSL", true); 55046 this.uri = null; 55047 } 55048} 55049class Overprint extends _xfa_object.OptionObject { 55050 constructor(attributes) { 55051 super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]); 55052 } 55053} 55054class Packets extends _xfa_object.StringObject { 55055 constructor(attributes) { 55056 super(CONFIG_NS_ID, "packets"); 55057 } 55058 [_symbol_utils.$finalize]() { 55059 if (this[_symbol_utils.$content] === "*") { 55060 return; 55061 } 55062 this[_symbol_utils.$content] = this[_symbol_utils.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x)); 55063 } 55064} 55065class PageOffset extends _xfa_object.XFAObject { 55066 constructor(attributes) { 55067 super(CONFIG_NS_ID, "pageOffset"); 55068 this.x = (0, _utils.getInteger)({ 55069 data: attributes.x, 55070 defaultValue: "useXDCSetting", 55071 validate: n => true 55072 }); 55073 this.y = (0, _utils.getInteger)({ 55074 data: attributes.y, 55075 defaultValue: "useXDCSetting", 55076 validate: n => true 55077 }); 55078 } 55079} 55080class PageRange extends _xfa_object.StringObject { 55081 constructor(attributes) { 55082 super(CONFIG_NS_ID, "pageRange"); 55083 } 55084 [_symbol_utils.$finalize]() { 55085 const numbers = this[_symbol_utils.$content].trim().split(/\s+/).map(x => parseInt(x, 10)); 55086 const ranges = []; 55087 for (let i = 0, ii = numbers.length; i < ii; i += 2) { 55088 ranges.push(numbers.slice(i, i + 2)); 55089 } 55090 this[_symbol_utils.$content] = ranges; 55091 } 55092} 55093class Pagination extends _xfa_object.OptionObject { 55094 constructor(attributes) { 55095 super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]); 55096 } 55097} 55098class PaginationOverride extends _xfa_object.OptionObject { 55099 constructor(attributes) { 55100 super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]); 55101 } 55102} 55103class Part extends _xfa_object.IntegerObject { 55104 constructor(attributes) { 55105 super(CONFIG_NS_ID, "part", 1, n => false); 55106 } 55107} 55108class Pcl extends _xfa_object.XFAObject { 55109 constructor(attributes) { 55110 super(CONFIG_NS_ID, "pcl", true); 55111 this.name = attributes.name || ""; 55112 this.batchOutput = null; 55113 this.fontInfo = null; 55114 this.jog = null; 55115 this.mediumInfo = null; 55116 this.outputBin = null; 55117 this.pageOffset = null; 55118 this.staple = null; 55119 this.xdc = null; 55120 } 55121} 55122class Pdf extends _xfa_object.XFAObject { 55123 constructor(attributes) { 55124 super(CONFIG_NS_ID, "pdf", true); 55125 this.name = attributes.name || ""; 55126 this.adobeExtensionLevel = null; 55127 this.batchOutput = null; 55128 this.compression = null; 55129 this.creator = null; 55130 this.encryption = null; 55131 this.fontInfo = null; 55132 this.interactive = null; 55133 this.linearized = null; 55134 this.openAction = null; 55135 this.pdfa = null; 55136 this.producer = null; 55137 this.renderPolicy = null; 55138 this.scriptModel = null; 55139 this.silentPrint = null; 55140 this.submitFormat = null; 55141 this.tagged = null; 55142 this.version = null; 55143 this.viewerPreferences = null; 55144 this.xdc = null; 55145 } 55146} 55147class Pdfa extends _xfa_object.XFAObject { 55148 constructor(attributes) { 55149 super(CONFIG_NS_ID, "pdfa", true); 55150 this.amd = null; 55151 this.conformance = null; 55152 this.includeXDPContent = null; 55153 this.part = null; 55154 } 55155} 55156class Permissions extends _xfa_object.XFAObject { 55157 constructor(attributes) { 55158 super(CONFIG_NS_ID, "permissions", true); 55159 this.accessibleContent = null; 55160 this.change = null; 55161 this.contentCopy = null; 55162 this.documentAssembly = null; 55163 this.formFieldFilling = null; 55164 this.modifyAnnots = null; 55165 this.plaintextMetadata = null; 55166 this.print = null; 55167 this.printHighQuality = null; 55168 } 55169} 55170class PickTrayByPDFSize extends _xfa_object.Option01 { 55171 constructor(attributes) { 55172 super(CONFIG_NS_ID, "pickTrayByPDFSize"); 55173 } 55174} 55175class Picture extends _xfa_object.StringObject { 55176 constructor(attributes) { 55177 super(CONFIG_NS_ID, "picture"); 55178 } 55179} 55180class PlaintextMetadata extends _xfa_object.Option01 { 55181 constructor(attributes) { 55182 super(CONFIG_NS_ID, "plaintextMetadata"); 55183 } 55184} 55185class Presence extends _xfa_object.OptionObject { 55186 constructor(attributes) { 55187 super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]); 55188 } 55189} 55190class Present extends _xfa_object.XFAObject { 55191 constructor(attributes) { 55192 super(CONFIG_NS_ID, "present", true); 55193 this.behaviorOverride = null; 55194 this.cache = null; 55195 this.common = null; 55196 this.copies = null; 55197 this.destination = null; 55198 this.incrementalMerge = null; 55199 this.layout = null; 55200 this.output = null; 55201 this.overprint = null; 55202 this.pagination = null; 55203 this.paginationOverride = null; 55204 this.script = null; 55205 this.validate = null; 55206 this.xdp = null; 55207 this.driver = new _xfa_object.XFAObjectArray(); 55208 this.labelPrinter = new _xfa_object.XFAObjectArray(); 55209 this.pcl = new _xfa_object.XFAObjectArray(); 55210 this.pdf = new _xfa_object.XFAObjectArray(); 55211 this.ps = new _xfa_object.XFAObjectArray(); 55212 this.submitUrl = new _xfa_object.XFAObjectArray(); 55213 this.webClient = new _xfa_object.XFAObjectArray(); 55214 this.zpl = new _xfa_object.XFAObjectArray(); 55215 } 55216} 55217class Print extends _xfa_object.Option01 { 55218 constructor(attributes) { 55219 super(CONFIG_NS_ID, "print"); 55220 } 55221} 55222class PrintHighQuality extends _xfa_object.Option01 { 55223 constructor(attributes) { 55224 super(CONFIG_NS_ID, "printHighQuality"); 55225 } 55226} 55227class PrintScaling extends _xfa_object.OptionObject { 55228 constructor(attributes) { 55229 super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]); 55230 } 55231} 55232class PrinterName extends _xfa_object.StringObject { 55233 constructor(attributes) { 55234 super(CONFIG_NS_ID, "printerName"); 55235 } 55236} 55237class Producer extends _xfa_object.StringObject { 55238 constructor(attributes) { 55239 super(CONFIG_NS_ID, "producer"); 55240 } 55241} 55242class Ps extends _xfa_object.XFAObject { 55243 constructor(attributes) { 55244 super(CONFIG_NS_ID, "ps", true); 55245 this.name = attributes.name || ""; 55246 this.batchOutput = null; 55247 this.fontInfo = null; 55248 this.jog = null; 55249 this.mediumInfo = null; 55250 this.outputBin = null; 55251 this.staple = null; 55252 this.xdc = null; 55253 } 55254} 55255class Range extends _xfa_object.ContentObject { 55256 constructor(attributes) { 55257 super(CONFIG_NS_ID, "range"); 55258 } 55259 [_symbol_utils.$finalize]() { 55260 this[_symbol_utils.$content] = this[_symbol_utils.$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 => { 55261 if (range.length === 1) { 55262 range.push(range[0]); 55263 } 55264 return range; 55265 }); 55266 } 55267} 55268class Record extends _xfa_object.ContentObject { 55269 constructor(attributes) { 55270 super(CONFIG_NS_ID, "record"); 55271 } 55272 [_symbol_utils.$finalize]() { 55273 this[_symbol_utils.$content] = this[_symbol_utils.$content].trim(); 55274 const n = parseInt(this[_symbol_utils.$content], 10); 55275 if (!isNaN(n) && n >= 0) { 55276 this[_symbol_utils.$content] = n; 55277 } 55278 } 55279} 55280class Relevant extends _xfa_object.ContentObject { 55281 constructor(attributes) { 55282 super(CONFIG_NS_ID, "relevant"); 55283 } 55284 [_symbol_utils.$finalize]() { 55285 this[_symbol_utils.$content] = this[_symbol_utils.$content].trim().split(/\s+/); 55286 } 55287} 55288class Rename extends _xfa_object.ContentObject { 55289 constructor(attributes) { 55290 super(CONFIG_NS_ID, "rename"); 55291 } 55292 [_symbol_utils.$finalize]() { 55293 this[_symbol_utils.$content] = this[_symbol_utils.$content].trim(); 55294 if (this[_symbol_utils.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_symbol_utils.$content])) { 55295 (0, _util.warn)("XFA - Rename: invalid XFA name"); 55296 } 55297 } 55298} 55299class RenderPolicy extends _xfa_object.OptionObject { 55300 constructor(attributes) { 55301 super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]); 55302 } 55303} 55304class RunScripts extends _xfa_object.OptionObject { 55305 constructor(attributes) { 55306 super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]); 55307 } 55308} 55309class Script extends _xfa_object.XFAObject { 55310 constructor(attributes) { 55311 super(CONFIG_NS_ID, "script", true); 55312 this.currentPage = null; 55313 this.exclude = null; 55314 this.runScripts = null; 55315 } 55316} 55317class ScriptModel extends _xfa_object.OptionObject { 55318 constructor(attributes) { 55319 super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]); 55320 } 55321} 55322class Severity extends _xfa_object.OptionObject { 55323 constructor(attributes) { 55324 super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]); 55325 } 55326} 55327class SilentPrint extends _xfa_object.XFAObject { 55328 constructor(attributes) { 55329 super(CONFIG_NS_ID, "silentPrint", true); 55330 this.addSilentPrint = null; 55331 this.printerName = null; 55332 } 55333} 55334class Staple extends _xfa_object.XFAObject { 55335 constructor(attributes) { 55336 super(CONFIG_NS_ID, "staple"); 55337 this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]); 55338 } 55339} 55340class StartNode extends _xfa_object.StringObject { 55341 constructor(attributes) { 55342 super(CONFIG_NS_ID, "startNode"); 55343 } 55344} 55345class StartPage extends _xfa_object.IntegerObject { 55346 constructor(attributes) { 55347 super(CONFIG_NS_ID, "startPage", 0, n => true); 55348 } 55349} 55350class SubmitFormat extends _xfa_object.OptionObject { 55351 constructor(attributes) { 55352 super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]); 55353 } 55354} 55355class SubmitUrl extends _xfa_object.StringObject { 55356 constructor(attributes) { 55357 super(CONFIG_NS_ID, "submitUrl"); 55358 } 55359} 55360class SubsetBelow extends _xfa_object.IntegerObject { 55361 constructor(attributes) { 55362 super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100); 55363 } 55364} 55365class SuppressBanner extends _xfa_object.Option01 { 55366 constructor(attributes) { 55367 super(CONFIG_NS_ID, "suppressBanner"); 55368 } 55369} 55370class Tagged extends _xfa_object.Option01 { 55371 constructor(attributes) { 55372 super(CONFIG_NS_ID, "tagged"); 55373 } 55374} 55375class Template extends _xfa_object.XFAObject { 55376 constructor(attributes) { 55377 super(CONFIG_NS_ID, "template", true); 55378 this.base = null; 55379 this.relevant = null; 55380 this.startPage = null; 55381 this.uri = null; 55382 this.xsl = null; 55383 } 55384} 55385class Threshold extends _xfa_object.OptionObject { 55386 constructor(attributes) { 55387 super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]); 55388 } 55389} 55390class To extends _xfa_object.OptionObject { 55391 constructor(attributes) { 55392 super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]); 55393 } 55394} 55395class TemplateCache extends _xfa_object.XFAObject { 55396 constructor(attributes) { 55397 super(CONFIG_NS_ID, "templateCache"); 55398 this.maxEntries = (0, _utils.getInteger)({ 55399 data: attributes.maxEntries, 55400 defaultValue: 5, 55401 validate: n => n >= 0 55402 }); 55403 } 55404} 55405class Trace extends _xfa_object.XFAObject { 55406 constructor(attributes) { 55407 super(CONFIG_NS_ID, "trace", true); 55408 this.area = new _xfa_object.XFAObjectArray(); 55409 } 55410} 55411class Transform extends _xfa_object.XFAObject { 55412 constructor(attributes) { 55413 super(CONFIG_NS_ID, "transform", true); 55414 this.groupParent = null; 55415 this.ifEmpty = null; 55416 this.nameAttr = null; 55417 this.picture = null; 55418 this.presence = null; 55419 this.rename = null; 55420 this.whitespace = null; 55421 } 55422} 55423class Type extends _xfa_object.OptionObject { 55424 constructor(attributes) { 55425 super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]); 55426 } 55427} 55428class Uri extends _xfa_object.StringObject { 55429 constructor(attributes) { 55430 super(CONFIG_NS_ID, "uri"); 55431 } 55432} 55433class Validate extends _xfa_object.OptionObject { 55434 constructor(attributes) { 55435 super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]); 55436 } 55437} 55438class ValidateApprovalSignatures extends _xfa_object.ContentObject { 55439 constructor(attributes) { 55440 super(CONFIG_NS_ID, "validateApprovalSignatures"); 55441 } 55442 [_symbol_utils.$finalize]() { 55443 this[_symbol_utils.$content] = this[_symbol_utils.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x)); 55444 } 55445} 55446class ValidationMessaging extends _xfa
55446_object.OptionObject { 55447 constructor(attributes) { 55448 super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]); 55449 } 55450} 55451class Version extends _xfa_object.OptionObject { 55452 constructor(attributes) { 55453 super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]); 55454 } 55455} 55456class VersionControl extends _xfa_object.XFAObject { 55457 constructor(attributes) { 55458 super(CONFIG_NS_ID, "VersionControl"); 55459 this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]); 55460 this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]); 55461 this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]); 55462 } 55463} 55464class ViewerPreferences extends _xfa_object.XFAObject { 55465 constructor(attributes) { 55466 super(CONFIG_NS_ID, "viewerPreferences", true); 55467 this.ADBE_JSConsole = null; 55468 this.ADBE_JSDebugger = null; 55469 this.addViewerPreferences = null; 55470 this.duplexOption = null; 55471 this.enforce = null; 55472 this.numberOfCopies = null; 55473 this.pageRange = null; 55474 this.pickTrayByPDFSize = null; 55475 this.printScaling = null; 55476 } 55477} 55478class WebClient extends _xfa_object.XFAObject { 55479 constructor(attributes) { 55480 super(CONFIG_NS_ID, "webClient", true); 55481 this.name = attributes.name ? attributes.name.trim() : ""; 55482 this.fontInfo = null; 55483 this.xdc = null; 55484 } 55485} 55486class Whitespace extends _xfa_object.OptionObject { 55487 constructor(attributes) { 55488 super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]); 55489 } 55490} 55491class Window extends _xfa_object.ContentObject { 55492 constructor(attributes) { 55493 super(CONFIG_NS_ID, "window"); 55494 } 55495 [_symbol_utils.$finalize]() { 55496 const pair = this[_symbol_utils.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10)); 55497 if (pair.some(x => isNaN(x))) { 55498 this[_symbol_utils.$content] = [0, 0]; 55499 return; 55500 } 55501 if (pair.length === 1) { 55502 pair.push(pair[0]); 55503 } 55504 this[_symbol_utils.$content] = pair; 55505 } 55506} 55507class Xdc extends _xfa_object.XFAObject { 55508 constructor(attributes) { 55509 super(CONFIG_NS_ID, "xdc", true); 55510 this.uri = new _xfa_object.XFAObjectArray(); 55511 this.xsl = new _xfa_object.XFAObjectArray(); 55512 } 55513} 55514class Xdp extends _xfa_object.XFAObject { 55515 constructor(attributes) { 55516 super(CONFIG_NS_ID, "xdp", true); 55517 this.packets = null; 55518 } 55519} 55520class Xsl extends _xfa_object.XFAObject { 55521 constructor(attributes) { 55522 super(CONFIG_NS_ID, "xsl", true); 55523 this.debug = null; 55524 this.uri = null; 55525 } 55526} 55527class Zpl extends _xfa_object.XFAObject { 55528 constructor(attributes) { 55529 super(CONFIG_NS_ID, "zpl", true); 55530 this.name = attributes.name ? attributes.name.trim() : ""; 55531 this.batchOutput = null; 55532 this.flipLabel = null; 55533 this.fontInfo = null; 55534 this.xdc = null; 55535 } 55536} 55537class ConfigNamespace { 55538 static [_namespaces.$buildXFAObject](name, attributes) { 55539 if (ConfigNamespace.hasOwnProperty(name)) { 55540 return ConfigNamespace[name](attributes); 55541 } 55542 return undefined; 55543 } 55544 static acrobat(attrs) { 55545 return new Acrobat(attrs); 55546 } 55547 static acrobat7(attrs) { 55548 return new Acrobat7(attrs); 55549 } 55550 static ADBE_JSConsole(attrs) { 55551 return new ADBE_JSConsole(attrs); 55552 } 55553 static ADBE_JSDebugger(attrs) { 55554 return new ADBE_JSDebugger(attrs); 55555 } 55556 static addSilentPrint(attrs) { 55557 return new AddSilentPrint(attrs); 55558 } 55559 static addViewerPreferences(attrs) { 55560 return new AddViewerPreferences(attrs); 55561 } 55562 static adjustData(attrs) { 55563 return new AdjustData(attrs); 55564 } 55565 static adobeExtensionLevel(attrs) { 55566 return new AdobeExtensionLevel(attrs); 55567 } 55568 static agent(attrs) { 55569 return new Agent(attrs); 55570 } 55571 static alwaysEmbed(attrs) { 55572 return new AlwaysEmbed(attrs); 55573 } 55574 static amd(attrs) { 55575 return new Amd(attrs); 55576 } 55577 static area(attrs) { 55578 return new Area(attrs); 55579 } 55580 static attributes(attrs) { 55581 return new Attributes(attrs); 55582 } 55583 static autoSave(attrs) { 55584 return new AutoSave(attrs); 55585 } 55586 static base(attrs) { 55587 return new Base(attrs); 55588 } 55589 static batchOutput(attrs) { 55590 return new BatchOutput(attrs); 55591 } 55592 static behaviorOverride(attrs) { 55593 return new BehaviorOverride(attrs); 55594 } 55595 static cache(attrs) { 55596 return new Cache(attrs); 55597 } 55598 static change(attrs) { 55599 return new Change(attrs); 55600 } 55601 static common(attrs) { 55602 return new Common(attrs); 55603 } 55604 static compress(attrs) { 55605 return new Compress(attrs); 55606 } 55607 static compressLogicalStructure(attrs) { 55608 return new CompressLogicalStructure(attrs); 55609 } 55610 static compressObjectStream(attrs) { 55611 return new CompressObjectStream(attrs); 55612 } 55613 static compression(attrs) { 55614 return new Compression(attrs); 55615 } 55616 static config(attrs) { 55617 return new Config(attrs); 55618 } 55619 static conformance(attrs) { 55620 return new Conformance(attrs); 55621 } 55622 static contentCopy(attrs) { 55623 return new ContentCopy(attrs); 55624 } 55625 static copies(attrs) { 55626 return new Copies(attrs); 55627 } 55628 static creator(attrs) { 55629 return new Creator(attrs); 55630 } 55631 static currentPage(attrs) { 55632 return new CurrentPage(attrs); 55633 } 55634 static data(attrs) { 55635 return new Data(attrs); 55636 } 55637 static debug(attrs) { 55638 return new Debug(attrs); 55639 } 55640 static defaultTypeface(attrs) { 55641 return new DefaultTypeface(attrs); 55642 } 55643 static destination(attrs) { 55644 return new Destination(attrs); 55645 } 55646 static documentAssembly(attrs) { 55647 return new DocumentAssembly(attrs); 55648 } 55649 static driver(attrs) { 55650 return new Driver(attrs); 55651 } 55652 static duplexOption(attrs) { 55653 return new DuplexOption(attrs); 55654 } 55655 static dynamicRender(attrs) { 55656 return new DynamicRender(attrs); 55657 } 55658 static embed(attrs) { 55659 return new Embed(attrs); 55660 } 55661 static encrypt(attrs) { 55662 return new Encrypt(attrs); 55663 } 55664 static encryption(attrs) { 55665 return new Encryption(attrs); 55666 } 55667 static encryptionLevel(attrs) { 55668 return new EncryptionLevel(attrs); 55669 } 55670 static enforce(attrs) { 55671 return new Enforce(attrs); 55672 } 55673 static equate(attrs) { 55674 return new Equate(attrs); 55675 } 55676 static equateRange(attrs) { 55677 return new EquateRange(attrs); 55678 } 55679 static exclude(attrs) { 55680 return new Exclude(attrs); 55681 } 55682 static excludeNS(attrs) { 55683 return new ExcludeNS(attrs); 55684 } 55685 static flipLabel(attrs) { 55686 return new FlipLabel(attrs); 55687 } 55688 static fontInfo(attrs) { 55689 return new FontInfo(attrs); 55690 } 55691 static formFieldFilling(attrs) {
55692 return new FormFieldFilling(attrs); 55693 } 55694 static groupParent(attrs) { 55695 return new GroupParent(attrs); 55696 } 55697 static ifEmpty(attrs) { 55698 return new IfEmpty(attrs); 55699 } 55700 static includeXDPContent(attrs) { 55701 return new IncludeXDPContent(attrs); 55702 } 55703 static incrementalLoad(attrs) { 55704 return new IncrementalLoad(attrs); 55705 } 55706 static incrementalMerge(attrs) { 55707 return new IncrementalMerge(attrs); 55708 } 55709 static interactive(attrs) { 55710 return new Interactive(attrs); 55711 } 55712 static jog(attrs) { 55713 return new Jog(attrs); 55714 } 55715 static labelPrinter(attrs) { 55716 return new LabelPrinter(attrs); 55717 } 55718 static layout(attrs) { 55719 return new Layout(attrs); 55720 } 55721 static level(attrs) { 55722 return new Level(attrs); 55723 } 55724 static linearized(attrs) { 55725 return new Linearized(attrs); 55726 } 55727 static locale(attrs) { 55728 return new Locale(attrs); 55729 } 55730 static localeSet(attrs) { 55731 return new LocaleSet(attrs); 55732 } 55733 static log(attrs) { 55734 return new Log(attrs); 55735 } 55736 static map(attrs) { 55737 return new MapElement(attrs); 55738 } 55739 static mediumInfo(attrs) { 55740 return new MediumInfo(attrs); 55741 } 55742 static message(attrs) { 55743 return new Message(attrs); 55744 } 55745 static messaging(attrs) { 55746 return new Messaging(attrs); 55747 } 55748 static mode(attrs) { 55749 return new Mode(attrs); 55750 } 55751 static modifyAnnots(attrs) { 55752 return new ModifyAnnots(attrs); 55753 } 55754 static msgId(attrs) { 55755 return new MsgId(attrs); 55756 } 55757 static nameAttr(attrs) { 55758 return new NameAttr(attrs); 55759 } 55760 static neverEmbed(attrs) { 55761 return new NeverEmbed(attrs); 55762 } 55763 static numberOfCopies(attrs) { 55764 return new NumberOfCopies(attrs); 55765 } 55766 static openAction(attrs) { 55767 return new OpenAction(attrs); 55768 } 55769 static output(attrs) { 55770 return new Output(attrs); 55771 } 55772 static outputBin(attrs) { 55773 return new OutputBin(attrs); 55774 } 55775 static outputXSL(attrs) { 55776 return new OutputXSL(attrs); 55777 } 55778 static overprint(attrs) { 55779 return new Overprint(attrs); 55780 } 55781 static packets(attrs) { 55782 return new Packets(attrs); 55783 } 55784 static pageOffset(attrs) { 55785 return new PageOffset(attrs); 55786 } 55787 static pageRange(attrs) { 55788 return new PageRange(attrs); 55789 } 55790 static pagination(attrs) { 55791 return new Pagination(attrs); 55792 } 55793 static paginationOverride(attrs) { 55794 return new PaginationOverride(attrs); 55795 } 55796 static part(attrs) { 55797 return new Part(attrs); 55798 } 55799 static pcl(attrs) { 55800 return new Pcl(attrs); 55801 } 55802 static pdf(attrs) { 55803 return new Pdf(attrs); 55804 } 55805 static pdfa(attrs) { 55806 return new Pdfa(attrs); 55807 } 55808 static permissions(attrs) { 55809 return new Permissions(attrs); 55810 } 55811 static pickTrayByPDFSize(attrs) { 55812 return new PickTrayByPDFSize(attrs); 55813 } 55814 static picture(attrs) { 55815 return new Picture(attrs); 55816 } 55817 static plaintextMetadata(attrs) { 55818 return new PlaintextMetadata(attrs); 55819 } 55820 static presence(attrs) { 55821 return new Presence(attrs); 55822 } 55823 static present(attrs) { 55824 return new Present(attrs); 55825 } 55826 static print(attrs) { 55827 return new Print(attrs); 55828 } 55829 static printHighQuality(attrs) { 55830 return new PrintHighQuality(attrs); 55831 } 55832 static printScaling(attrs) { 55833 return new PrintScaling(attrs); 55834 } 55835 static printerName(attrs) { 55836 return new PrinterName(attrs); 55837 } 55838 static producer(attrs) { 55839 return new Producer(attrs); 55840 } 55841 static ps(attrs) { 55842 return new Ps(attrs); 55843 } 55844 static range(attrs) { 55845 return new Range(attrs); 55846 } 55847 static record(attrs) { 55848 return new Record(attrs); 55849 } 55850 static relevant(attrs) { 55851 return new Relevant(attrs); 55852 } 55853 static rename(attrs) { 55854 return new Rename(attrs); 55855 } 55856 static renderPolicy(attrs) { 55857 return new RenderPolicy(attrs); 55858 } 55859 static runScripts(attrs) { 55860 return new RunScripts(attrs); 55861 } 55862 static script(attrs) { 55863 return new Script(attrs); 55864 } 55865 static scriptModel(attrs) { 55866 return new ScriptModel(attrs); 55867 } 55868 static severity(attrs) { 55869 return new Severity(attrs); 55870 } 55871 static silentPrint(attrs) { 55872 return new SilentPrint(attrs); 55873 } 55874 static staple(attrs) { 55875 return new Staple(attrs); 55876 } 55877 static startNode(attrs) { 55878 return new StartNode(attrs); 55879 } 55880 static startPage(attrs) { 55881 return new StartPage(attrs); 55882 } 55883 static submitFormat(attrs) { 55884 return new SubmitFormat(attrs); 55885 } 55886 static submitUrl(attrs) { 55887 return new SubmitUrl(attrs); 55888 } 55889 static subsetBelow(attrs) { 55890 return new SubsetBelow(attrs); 55891 } 55892 static suppressBanner(attrs) { 55893 return new SuppressBanner(attrs); 55894 } 55895 static tagged(attrs) { 55896 return new Tagged(attrs); 55897 } 55898 static template(attrs) { 55899 return new Template(attrs); 55900 } 55901 static templateCache(attrs) { 55902 return new TemplateCache(attrs); 55903 } 55904 static threshold(attrs) { 55905 return new Threshold(attrs); 55906 } 55907 static to(attrs) { 55908 return new To(attrs); 55909 } 55910 static trace(attrs) { 55911 return new Trace(attrs); 55912 } 55913 static transform(attrs) { 55914 return new Transform(attrs); 55915 } 55916 static type(attrs) { 55917 return new Type(attrs); 55918 } 55919 static uri(attrs) { 55920 return new Uri(attrs); 55921 } 55922 static validate(attrs) {
55923 return new Validate(attrs); 55924 } 55925 static validateApprovalSignatures(attrs) { 55926 return new ValidateApprovalSignatures(attrs); 55927 } 55928 static validationMessaging(attrs) { 55929 return new ValidationMessaging(attrs); 55930 } 55931 static version(attrs) { 55932 return new Version(attrs); 55933 } 55934 static versionControl(attrs) { 55935 return new VersionControl(attrs); 55936 } 55937 static viewerPreferences(attrs) { 55938 return new ViewerPreferences(attrs); 55939 } 55940 static webClient(attrs) { 55941 return new WebClient(attrs); 55942 } 55943 static whitespace(attrs) { 55944 return new Whitespace(attrs); 55945 } 55946 static window(attrs) { 55947 return new Window(attrs); 55948 } 55949 static xdc(attrs) { 55950 return new Xdc(attrs); 55951 } 55952 static xdp(attrs) { 55953 return new Xdp(attrs); 55954 } 55955 static xsl(attrs) { 55956 return new Xsl(attrs); 55957 } 55958 static zpl(attrs) { 55959 return new Zpl(attrs); 55960 } 55961} 55962exports.ConfigNamespace = ConfigNamespace; 55963 55964/***/ }), 55965/* 94 */ 55966/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 55967 55968 55969 55970Object.defineProperty(exports, "__esModule", ({ 55971 value: true 55972})); 55973exports.ConnectionSetNamespace = void 0; 55974var _namespaces = __w_pdfjs_require__(81); 55975var _xfa_object = __w_pdfjs_require__(87); 55976const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id; 55977class ConnectionSet extends _xfa_object.XFAObject { 55978 constructor(attributes) { 55979 super(CONNECTION_SET_NS_ID, "connectionSet", true); 55980 this.wsdlConnection = new _xfa_object.XFAObjectArray(); 55981 this.xmlConnection = new _xfa_object.XFAObjectArray(); 55982 this.xsdConnection = new _xfa_object.XFAObjectArray(); 55983 } 55984} 55985class EffectiveInputPolicy extends _xfa_object.XFAObject { 55986 constructor(attributes) { 55987 super(CONNECTION_SET_NS_ID, "effectiveInputPolicy"); 55988 this.id = attributes.id || ""; 55989 this.name = attributes.name || ""; 55990 this.use = attributes.use || ""; 55991 this.usehref = attributes.usehref || ""; 55992 } 55993} 55994class EffectiveOutputPolicy extends _xfa_object.XFAObject { 55995 constructor(attributes) { 55996 super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy"); 55997 this.id = attributes.id || ""; 55998 this.name = attributes.name || ""; 55999 this.use = attributes.use || ""; 56000 this.usehref = attributes.usehref || ""; 56001 } 56002} 56003class Operation extends _xfa_object.StringObject { 56004 constructor(attributes) { 56005 super(CONNECTION_SET_NS_ID, "operation"); 56006 this.id = attributes.id || ""; 56007 this.input = attributes.input || ""; 56008 this.name = attributes.name || ""; 56009 this.output = attributes.output || ""; 56010 this.use = attributes.use || ""; 56011 this.usehref = attributes.usehref || ""; 56012 } 56013} 56014class RootElement extends _xfa_object.StringObject { 56015 constructor(attributes) { 56016 super(CONNECTION_SET_NS_ID, "rootElement"); 56017 this.id = attributes.id || ""; 56018 this.name = attributes.name || ""; 56019 this.use = attributes.use || ""; 56020 this.usehref = attributes.usehref || ""; 56021 } 56022} 56023class SoapAction extends _xfa_object.StringObject { 56024 constructor(attributes) { 56025 super(CONNECTION_SET_NS_ID, "soapAction"); 56026 this.id = attributes.id || ""; 56027 this.name = attributes.name || ""; 56028 this.use = attributes.use || ""; 56029 this.usehref = attributes.usehref || ""; 56030 } 56031} 56032class SoapAddress extends _xfa_object.StringObject { 56033 constructor(attributes) { 56034 super(CONNECTION_SET_NS_ID, "soapAddress"); 56035 this.id = attributes.id || ""; 56036 this.name = attributes.name || ""; 56037 this.use = attributes.use || ""; 56038 this.usehref = attributes.usehref || ""; 56039 } 56040} 56041class Uri extends _xfa_object.StringObject { 56042 constructor(attributes) { 56043 super(CONNECTION_SET_NS_ID, "uri"); 56044 this.id = attributes.id || ""; 56045 this.name = attributes.name || ""; 56046 this.use = attributes.use || ""; 56047 this.usehref = attributes.usehref || ""; 56048 } 56049} 56050class WsdlAddress extends _xfa_object.StringObject { 56051 constructor(attributes) { 56052 super(CONNECTION_SET_NS_ID, "wsdlAddress"); 56053 this.id = attributes.id || ""; 56054 this.name = attributes.name || ""; 56055 this.use = attributes.use || ""; 56056 this.usehref = attributes.usehref || ""; 56057 } 56058} 56059class WsdlConnection extends _xfa_object.XFAObject { 56060 constructor(attributes) { 56061 super(CONNECTION_SET_NS_ID, "wsdlConnection", true); 56062 this.dataDescription = attributes.dataDescription || ""; 56063 this.name = attributes.name || ""; 56064 this.effectiveInputPolicy = null; 56065 this.effectiveOutputPolicy = null; 56066 this.operation = null; 56067 this.soapAction = null; 56068 this.soapAddress = null; 56069 this.wsdlAddress = null; 56070 } 56071} 56072class XmlConnection extends _xfa_object.XFAObject { 56073 constructor(attributes) { 56074 super(CONNECTION_SET_NS_ID, "xmlConnection", true); 56075 this.dataDescription = attributes.dataDescription || ""; 56076 this.name = attributes.name || ""; 56077 this.uri = null; 56078 } 56079} 56080class XsdConnection extends _xfa_object.XFAObject { 56081 constructor(attributes) { 56082 super(CONNECTION_SET_NS_ID, "xsdConnection", true); 56083 this.dataDescription = attributes.dataDescription || ""; 56084 this.name = attributes.name || ""; 56085 this.rootElement = null; 56086 this.uri = null; 56087 } 56088} 56089class ConnectionSetNamespace { 56090 static [_namespaces.$buildXFAObject](name, attributes) { 56091 if (ConnectionSetNamespace.hasOwnProperty(name)) { 56092 return ConnectionSetNamespace[name](attributes); 56093 } 56094 return undefined; 56095 } 56096 static connectionSet(attrs) { 56097 return new ConnectionSet(attrs); 56098 } 56099 static effectiveInputPolicy(attrs) { 56100 return new EffectiveInputPolicy(attrs); 56101 } 56102 static effectiveOutputPolicy(attrs) { 56103 return new EffectiveOutputPolicy(attrs); 56104 } 56105 static operation(attrs) { 56106 return new Operation(attrs); 56107 } 56108 static rootElement(attrs) { 56109 return new RootElement(attrs); 56110 } 56111 static soapAction(attrs) { 56112 return new SoapAction(attrs); 56113 } 56114 static soapAddress(attrs) { 56115 return new SoapAddress(attrs); 56116 } 56117 static uri(attrs) { 56118 return new Uri(attrs); 56119 } 56120 static wsdlAddress(attrs) { 56121 return new WsdlAddress(attrs); 56122 } 56123 static wsdlConnection(attrs) { 56124 return new WsdlConnection(attrs); 56125 } 56126 static xmlConnection(attrs) { 56127 return new XmlConnection(attrs); 56128 } 56129 static xsdConnection(attrs) { 56130 return new XsdConnection(attrs); 56131 } 56132} 56133exports.ConnectionSetNamespace = ConnectionSetNamespace; 56134 56135/***/ }), 56136/* 95 */ 56137/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56138 56139 56140 56141Object.defineProperty(exports, "__esModule", ({ 56142 value: true 56143})); 56144exports.DatasetsNamespace = void 0; 56145var _symbol_utils = __w_pdfjs_require__(78); 56146var _namespaces = __w_pdfjs_require__(81); 56147var _xfa_object = __w_pdfjs_require__(87); 56148const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id; 56149class Data extends _xfa_object.XmlObject { 56150 constructor(attributes) { 56151 super(DATASETS_NS_ID, "data", attributes); 56152 } 56153 [_symbol_utils.$isNsAgnostic]() { 56154 return true; 56155 } 56156} 56157class Datasets extends _xfa_object.XFAObject { 56158 constructor(attributes) { 56159 super(DATASETS_NS_ID, "datasets", true); 56160 this.data = null; 56161 this.Signature = null; 56162 } 56163 [_symbol_utils.$onChild](child) { 56164 const name = child[_symbol_utils.$nodeName]; 56165 if (name === "data" && child[_symbol_utils.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.signature.id) { 56166 this[name] = child; 56167 } 56168 this[_symbol_utils.$appendChild](child); 56169 } 56170} 56171class DatasetsNamespace { 56172 static [_namespaces.$buildXFAObject](name, attributes) { 56173 if (DatasetsNamespace.hasOwnProperty(name)) { 56174 return DatasetsNamespace[name](attributes); 56175 } 56176 return undefined; 56177 } 56178 static datasets(attributes) { 56179 return new Datasets(attributes); 56180 } 56181 static data(attributes) { 56182 return new Data(attributes); 56183 } 56184} 56185exports.DatasetsNamespace = DatasetsNamespace; 56186 56187/***/ }), 56188/* 96 */ 56189/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56190 56191 56192 56193Object.defineProperty(exports, "__esModule", ({ 56194 value: true 56195})); 56196exports.LocaleSetNamespace = void 0; 56197var _namespaces = __w_pdfjs_require__(81); 56198var _xfa_object = __w_pdfjs_require__(87); 56199var _utils = __w_pdfjs_require__(84); 56200const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id; 56201class CalendarSymbols extends _xfa_object.XFAObject { 56202 constructor(attributes) { 56203 super(LOCALE_SET_NS_ID, "calendarSymbols", true); 56204 this.name = "gregorian"; 56205 this.dayNames = new _xfa_object.XFAObjectArray(2); 56206 this.eraNames = null; 56207 this.meridiemNames = null; 56208 this.monthNames = new _xfa_object.XFAObjectArray(2); 56209 } 56210} 56211class CurrencySymbol extends _xfa_object.StringObject { 56212 constructor(attributes) { 56213 super(LOCALE_SET_NS_ID, "currencySymbol"); 56214 this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]); 56215 } 56216}
56217class CurrencySymbols extends _xfa_object.XFAObject { 56218 constructor(attributes) { 56219 super(LOCALE_SET_NS_ID, "currencySymbols", true); 56220 this.currencySymbol = new _xfa_object.XFAObjectArray(3); 56221 } 56222} 56223class DatePattern extends _xfa_object.StringObject { 56224 constructor(attributes) { 56225 super(LOCALE_SET_NS_ID, "datePattern"); 56226 this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]); 56227 } 56228} 56229class DatePatterns extends _xfa_object.XFAObject { 56230 constructor(attributes) { 56231 super(LOCALE_SET_NS_ID, "datePatterns", true); 56232 this.datePattern = new _xfa_object.XFAObjectArray(4); 56233 } 56234} 56235class DateTimeSymbols extends _xfa_object.ContentObject { 56236 constructor(attributes) { 56237 super(LOCALE_SET_NS_ID, "dateTimeSymbols"); 56238 } 56239} 56240class Day extends _xfa_object.StringObject { 56241 constructor(attributes) { 56242 super(LOCALE_SET_NS_ID, "day"); 56243 } 56244} 56245class DayNames extends _xfa_object.XFAObject { 56246 constructor(attributes) { 56247 super(LOCALE_SET_NS_ID, "dayNames", true); 56248 this.abbr = (0, _utils.getInteger)({ 56249 data: attributes.abbr, 56250 defaultValue: 0, 56251 validate: x => x === 1 56252 }); 56253 this.day = new _xfa_object.XFAObjectArray(7); 56254 } 56255} 56256class Era extends _xfa_object.StringObject { 56257 constructor(attributes) { 56258 super(LOCALE_SET_NS_ID, "era"); 56259 } 56260} 56261class EraNames extends _xfa_object.XFAObject { 56262 constructor(attributes) { 56263 super(LOCALE_SET_NS_ID, "eraNames", true); 56264 this.era = new _xfa_object.XFAObjectArray(2); 56265 } 56266} 56267class Locale extends _xfa_object.XFAObject { 56268 constructor(attributes) { 56269 super(LOCALE_SET_NS_ID, "locale", true); 56270 this.desc = attributes.desc || ""; 56271 this.name = "isoname"; 56272 this.calendarSymbols = null; 56273 this.currencySymbols = null; 56274 this.datePatterns = null; 56275 this.dateTimeSymbols = null; 56276 this.numberPatterns = null; 56277 this.numberSymbols = null; 56278 this.timePatterns = null; 56279 this.typeFaces = null; 56280 } 56281} 56282class LocaleSet extends _xfa_object.XFAObject { 56283 constructor(attributes) { 56284 super(LOCALE_SET_NS_ID, "localeSet", true); 56285 this.locale = new _xfa_object.XFAObjectArray(); 56286 } 56287} 56288class Meridiem extends _xfa_object.StringObject { 56289 constructor(attributes) { 56290 super(LOCALE_SET_NS_ID, "meridiem"); 56291 } 56292} 56293class MeridiemNames extends _xfa_object.XFAObject { 56294 constructor(attributes) { 56295 super(LOCALE_SET_NS_ID, "meridiemNames", true); 56296 this.meridiem = new _xfa_object.XFAObjectArray(2); 56297 } 56298} 56299class Month extends _xfa_object.StringObject { 56300 constructor(attributes) { 56301 super(LOCALE_SET_NS_ID, "month"); 56302 } 56303} 56304class MonthNames extends _xfa_object.XFAObject { 56305 constructor(attributes) { 56306 super(LOCALE_SET_NS_ID, "monthNames", true); 56307 this.abbr = (0, _utils.getInteger)({ 56308 data: attributes.abbr, 56309 defaultValue: 0, 56310 validate: x => x === 1 56311 }); 56312 this.month = new _xfa_object.XFAObjectArray(12); 56313 } 56314} 56315class NumberPattern extends _xfa_object.StringObject { 56316 constructor(attributes) { 56317 super(LOCALE_SET_NS_ID, "numberPattern"); 56318 this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]); 56319 } 56320} 56321class NumberPatterns extends _xfa_object.XFAObject { 56322 constructor(attributes) { 56323 super(LOCALE_SET_NS_ID, "numberPatterns", true); 56324 this.numberPattern = new _xfa_object.XFAObjectArray(4); 56325 } 56326} 56327class NumberSymbol extends _xfa_object.StringObject { 56328 constructor(attributes) { 56329 super(LOCALE_SET_NS_ID, "numberSymbol"); 56330 this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]); 56331 } 56332} 56333class NumberSymbols extends _xfa_object.XFAObject { 56334 constructor(attributes) { 56335 super(LOCALE_SET_NS_ID, "numberSymbols", true); 56336 this.numberSymbol = new _xfa_object.XFAObjectArray(5); 56337 } 56338} 56339class TimePattern extends _xfa_object.StringObject { 56340 constructor(attributes) { 56341 super(LOCALE_SET_NS_ID, "timePattern"); 56342 this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]); 56343 } 56344} 56345class TimePatterns extends _xfa_object.XFAObject { 56346 constructor(attributes) { 56347 super(LOCALE_SET_NS_ID, "timePatterns", true); 56348 this.timePattern = new _xfa_object.XFAObjectArray(4); 56349 } 56350} 56351class TypeFace extends _xfa_object.XFAObject { 56352 constructor(attributes) { 56353 super(LOCALE_SET_NS_ID, "typeFace", true); 56354 this.name = attributes.name | ""; 56355 } 56356} 56357class TypeFaces extends _xfa_object.XFAObject { 56358 constructor(attributes) { 56359 super(LOCALE_SET_NS_ID, "typeFaces", true); 56360 this.typeFace = new _xfa_object.XFAObjectArray(); 56361 } 56362} 56363class LocaleSetNamespace { 56364 static [_namespaces.$buildXFAObject](name, attributes) { 56365 if (LocaleSetNamespace.hasOwnProperty(name)) { 56366 return LocaleSetNamespace[name](attributes); 56367 } 56368 return undefined; 56369 } 56370 static calendarSymbols(attrs) { 56371 return new CalendarSymbols(attrs); 56372 } 56373 static currencySymbol(attrs) { 56374 return new CurrencySymbol(attrs); 56375 }
56376 static currencySymbols(attrs) { 56377 return new CurrencySymbols(attrs); 56378 } 56379 static datePattern(attrs) { 56380 return new DatePattern(attrs); 56381 } 56382 static datePatterns(attrs) { 56383 return new DatePatterns(attrs); 56384 } 56385 static dateTimeSymbols(attrs) { 56386 return new DateTimeSymbols(attrs); 56387 } 56388 static day(attrs) { 56389 return new Day(attrs); 56390 } 56391 static dayNames(attrs) { 56392 return new DayNames(attrs); 56393 } 56394 static era(attrs) { 56395 return new Era(attrs); 56396 } 56397 static eraNames(attrs) { 56398 return new EraNames(attrs); 56399 } 56400 static locale(attrs) { 56401 return new Locale(attrs); 56402 } 56403 static localeSet(attrs) { 56404 return new LocaleSet(attrs); 56405 } 56406 static meridiem(attrs) { 56407 return new Meridiem(attrs); 56408 } 56409 static meridiemNames(attrs) { 56410 return new MeridiemNames(attrs); 56411 } 56412 static month(attrs) { 56413 return new Month(attrs); 56414 } 56415 static monthNames(attrs) { 56416 return new MonthNames(attrs); 56417 } 56418 static numberPattern(attrs) { 56419 return new NumberPattern(attrs); 56420 } 56421 static numberPatterns(attrs) { 56422 return new NumberPatterns(attrs); 56423 } 56424 static numberSymbol(attrs) { 56425 return new NumberSymbol(attrs); 56426 } 56427 static numberSymbols(attrs) { 56428 return new NumberSymbols(attrs); 56429 } 56430 static timePattern(attrs) { 56431 return new TimePattern(attrs); 56432 } 56433 static timePatterns(attrs) { 56434 return new TimePatterns(attrs); 56435 } 56436 static typeFace(attrs) { 56437 return new TypeFace(attrs); 56438 } 56439 static typeFaces(attrs) { 56440 return new TypeFaces(attrs); 56441 } 56442} 56443exports.LocaleSetNamespace = LocaleSetNamespace; 56444 56445/***/ }), 56446/* 97 */ 56447/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56448 56449 56450 56451Object.defineProperty(exports, "__esModule", ({ 56452 value: true 56453})); 56454exports.SignatureNamespace = void 0; 56455var _namespaces = __w_pdfjs_require__(81); 56456var _xfa_object = __w_pdfjs_require__(87); 56457const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id; 56458class Signature extends _xfa_object.XFAObject { 56459 constructor(attributes) { 56460 super(SIGNATURE_NS_ID, "signature", true); 56461 } 56462} 56463class SignatureNamespace { 56464 static [_namespaces.$buildXFAObject](name, attributes) { 56465 if (SignatureNamespace.hasOwnProperty(name)) { 56466 return SignatureNamespace[name](attributes); 56467 } 56468 return undefined; 56469 } 56470 static signature(attributes) { 56471 return new Signature(attributes); 56472 } 56473} 56474exports.SignatureNamespace = SignatureNamespace; 56475 56476/***/ }), 56477/* 98 */ 56478/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56479 56480 56481 56482Object.defineProperty(exports, "__esModule", ({ 56483 value: true 56484})); 56485exports.StylesheetNamespace = void 0; 56486var _namespaces = __w_pdfjs_require__(81); 56487var _xfa_object = __w_pdfjs_require__(87); 56488const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id; 56489class Stylesheet extends _xfa_object.XFAObject { 56490 constructor(attributes) { 56491 super(STYLESHEET_NS_ID, "stylesheet", true); 56492 } 56493} 56494class StylesheetNamespace { 56495 static [_namespaces.$buildXFAObject](name, attributes) { 56496 if (StylesheetNamespace.hasOwnProperty(name)) { 56497 return StylesheetNamespace[name](attributes); 56498 } 56499 return undefined; 56500 } 56501 static stylesheet(attributes) { 56502 return new Stylesheet(attributes); 56503 } 56504} 56505exports.StylesheetNamespace = StylesheetNamespace; 56506 56507/***/ }), 56508/* 99 */ 56509/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56510 56511 56512 56513Object.defineProperty(exports, "__esModule", ({ 56514 value: true 56515})); 56516exports.XdpNamespace = void 0; 56517var _namespaces = __w_pdfjs_require__(81); 56518var _symbol_utils = __w_pdfjs_require__(78); 56519var _xfa_object = __w_pdfjs_require__(87); 56520const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id; 56521class Xdp extends _xfa_object.XFAObject { 56522 constructor(attributes) { 56523 super(XDP_NS_ID, "xdp", true); 56524 this.uuid = attributes.uuid || ""; 56525 this.timeStamp = attributes.timeStamp || ""; 56526 this.config = null; 56527 this.connectionSet = null; 56528 this.datasets = null; 56529 this.localeSet = null; 56530 this.stylesheet = new _xfa_object.XFAObjectArray(); 56531 this.template = null; 56532 } 56533 [_symbol_utils.$onChildCheck](child) { 56534 const ns = _namespaces.NamespaceIds[child[_symbol_utils.$nodeName]]; 56535 return ns && child[_symbol_utils.$namespaceId] === ns.id; 56536 } 56537} 56538class XdpNamespace { 56539 static [_namespaces.$buildXFAObject](name, attributes) { 56540 if (XdpNamespace.hasOwnProperty(name)) { 56541 return XdpNamespace[name](attributes); 56542 } 56543 return undefined; 56544 } 56545 static xdp(attributes) { 56546 return new Xdp(attributes); 56547 } 56548} 56549exports.XdpNamespace = XdpNamespace; 56550 56551/***/ }), 56552/* 100 */ 56553/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56554 56555 56556 56557Object.defineProperty(exports, "__esModule", ({ 56558 value: true 56559})); 56560exports.XhtmlNamespace = void 0; 56561var _symbol_utils = __w_pdfjs_require__(78); 56562var _namespaces = __w_pdfjs_require__(81); 56563var _html_utils = __w_pdfjs_require__(83); 56564var _utils = __w_pdfjs_require__(84); 56565var _xfa_object = __w_pdfjs_require__(87); 56566const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id; 56567const $richText = Symbol(); 56568const 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"]); 56569const 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) => { 56570 value = original.fontSize = (0, _utils.getMeasurement)(value); 56571 return (0, _html_utils.measureToString)(0.99 * value); 56572}], ["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))]]);
56573const spacesRegExp = /\s+/g; 56574const crlfRegExp = /[\r\n]+/g; 56575const crlfForRichTextRegExp = /\r\n?/g; 56576function mapStyle(styleStr, node, richText) { 56577 const style = Object.create(null); 56578 if (!styleStr) { 56579 return style; 56580 } 56581 const original = Object.create(null); 56582 for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) { 56583 const mapping = StyleMapping.get(key); 56584 if (mapping === "") { 56585 continue; 56586 } 56587 let newValue = value; 56588 if (mapping) { 56589 newValue = typeof mapping === "string" ? mapping : mapping(value, original); 56590 } 56591 if (key.endsWith("scale")) { 56592 style.transform = style.transform ? `${style[key]} ${newValue}` : newValue; 56593 } else { 56594 style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue; 56595 } 56596 } 56597 if (style.fontFamily) { 56598 (0, _html_utils.setFontFamily)({ 56599 typeface: style.fontFamily, 56600 weight: style.fontWeight || "normal", 56601 posture: style.fontStyle || "normal", 56602 size: original.fontSize || 0 56603 }, node, node[_symbol_utils.$globalData].fontFinder, style); 56604 } 56605 if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) { 56606 const SUB_SUPER_SCRIPT_FACTOR = 0.583; 56607 const VERTICAL_FACTOR = 0.333; 56608 const fontSize = (0, _utils.getMeasurement)(style.fontSize); 56609 style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR); 56610 style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR); 56611 } 56612 if (richText && style.fontSize) { 56613 style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`; 56614 } 56615 (0, _html_utils.fixTextIndent)(style); 56616 return style; 56617} 56618function checkStyle(node) { 56619 if (!node.style) { 56620 return ""; 56621 } 56622 return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => { 56623 if (key === "font-family") { 56624 node[_symbol_utils.$globalData].usedTypefaces.add(value); 56625 } 56626 return VALID_STYLES.has(key); 56627 }).map(kv => kv.join(":")).join(";"); 56628} 56629const NoWhites = new Set(["body", "html"]); 56630class XhtmlObject extends _xfa_object.XmlObject { 56631 constructor(attributes, name) { 56632 super(XHTML_NS_ID, name); 56633 this[$richText] = false; 56634 this.style = attributes.style || ""; 56635 } 56636 [_symbol_utils.$clean](builder) { 56637 super[_symbol_utils.$clean](builder); 56638 this.style = checkStyle(this); 56639 } 56640 [_symbol_utils.$acceptWhitespace]() { 56641 return !NoWhites.has(this[_symbol_utils.$nodeName]); 56642 } 56643 [_symbol_utils.$onText](str, richText = false) { 56644 if (!richText) { 56645 str = str.replaceAll(crlfRegExp, ""); 56646 if (!this.style.includes("xfa-spacerun:yes")) { 56647 str = str.replaceAll(spacesRegExp, " "); 56648 } 56649 } else { 56650 this[$richText] = true; 56651 } 56652 if (str) { 56653 this[_symbol_utils.$content] += str; 56654 } 56655 } 56656 [_symbol_utils.$pushGlyphs](measure, mustPop = true) { 56657 const xfaFont = Object.create(null); 56658 const margin = { 56659 top: NaN, 56660 bottom: NaN, 56661 left: NaN, 56662 right: NaN 56663 }; 56664 let lineHeight = null; 56665 for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) { 56666 switch (key) { 56667 case "font-family": 56668 xfaFont.typeface = (0, _utils.stripQuotes)(value); 56669 break; 56670 case "font-size": 56671 xfaFont.size = (0, _utils.getMeasurement)(value); 56672 break; 56673 case "font-weight": 56674 xfaFont.weight = value; 56675 break; 56676 case "font-style": 56677 xfaFont.posture = value; 56678 break; 56679 case "letter-spacing": 56680 xfaFont.letterSpacing = (0, _utils.getMeasurement)(value); 56681 break; 56682 case "margin": 56683 const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x)); 56684 switch (values.length) { 56685 case 1: 56686 margin.top = margin.bottom = margin.left = margin.right = values[0]; 56687 break; 56688 case 2: 56689 margin.top = margin.bottom = values[0]; 56690 margin.left = margin.right = values[1]; 56691 break; 56692 case 3: 56693 margin.top = values[0]; 56694 margin.bottom = values[2]; 56695 margin.left = margin.right = values[1]; 56696 break; 56697 case 4: 56698 margin.top = values[0]; 56699 margin.left = values[1]; 56700 margin.bottom = values[2]; 56701 margin.right = values[3]; 56702 break; 56703 } 56704 break; 56705 case "margin-top": 56706 margin.top = (0, _utils.getMeasurement)(value); 56707 break; 56708 case "margin-bottom": 56709 margin.bottom = (0, _utils.getMeasurement)(value); 56710 break; 56711 case "margin-left": 56712 margin.left = (0, _utils.getMeasurement)(value); 56713 break; 56714 case "margin-right": 56715 margin.right = (0, _utils.getMeasurement)(value); 56716 break; 56717 case "line-height": 56718 lineHeight = (0, _utils.getMeasurement)(value); 56719 break; 56720 } 56721 }
56722 measure.pushData(xfaFont, margin, lineHeight); 56723 if (this[_symbol_utils.$content]) { 56724 measure.addString(this[_symbol_utils.$content]); 56725 } else { 56726 for (const child of this[_symbol_utils.$getChildren]()) { 56727 if (child[_symbol_utils.$nodeName] === "#text") { 56728 measure.addString(child[_symbol_utils.$content]); 56729 continue; 56730 } 56731 child[_symbol_utils.$pushGlyphs](measure); 56732 } 56733 } 56734 if (mustPop) { 56735 measure.popFont(); 56736 } 56737 } 56738 [_symbol_utils.$toHTML](availableSpace) { 56739 const children = []; 56740 this[_symbol_utils.$extra] = { 56741 children 56742 }; 56743 this[_symbol_utils.$childrenToHTML]({}); 56744 if (children.length === 0 && !this[_symbol_utils.$content]) { 56745 return _utils.HTMLResult.EMPTY; 56746 } 56747 let value; 56748 if (this[$richText]) { 56749 value = this[_symbol_utils.$content] ? this[_symbol_utils.$content].replaceAll(crlfForRichTextRegExp, "\n") : undefined; 56750 } else { 56751 value = this[_symbol_utils.$content] || undefined; 56752 } 56753 return _utils.HTMLResult.success({ 56754 name: this[_symbol_utils.$nodeName], 56755 attributes: { 56756 href: this.href, 56757 style: mapStyle(this.style, this, this[$richText]) 56758 }, 56759 children, 56760 value 56761 }); 56762 } 56763} 56764class A extends XhtmlObject { 56765 constructor(attributes) { 56766 super(attributes, "a"); 56767 this.href = (0, _html_utils.fixURL)(attributes.href) || ""; 56768 } 56769} 56770class B extends XhtmlObject { 56771 constructor(attributes) { 56772 super(attributes, "b"); 56773 } 56774 [_symbol_utils.$pushGlyphs](measure) { 56775 measure.pushFont({ 56776 weight: "bold" 56777 }); 56778 super[_symbol_utils.$pushGlyphs](measure); 56779 measure.popFont(); 56780 } 56781} 56782class Body extends XhtmlObject { 56783 constructor(attributes) { 56784 super(attributes, "body"); 56785 } 56786 [_symbol_utils.$toHTML](availableSpace) { 56787 const res = super[_symbol_utils.$toHTML](availableSpace); 56788 const { 56789 html 56790 } = res; 56791 if (!html) { 56792 return _utils.HTMLResult.EMPTY; 56793 } 56794 html.name = "div"; 56795 html.attributes.class = ["xfaRich"]; 56796 return res; 56797 } 56798} 56799class Br extends XhtmlObject { 56800 constructor(attributes) { 56801 super(attributes, "br"); 56802 } 56803 [_symbol_utils.$text]() { 56804 return "\n"; 56805 } 56806 [_symbol_utils.$pushGlyphs](measure) { 56807 measure.addString("\n"); 56808 } 56809 [_symbol_utils.$toHTML](availableSpace) { 56810 return _utils.HTMLResult.success({ 56811 name: "br" 56812 }); 56813 } 56814} 56815class Html extends XhtmlObject { 56816 constructor(attributes) { 56817 super(attributes, "html"); 56818 } 56819 [_symbol_utils.$toHTML](availableSpace) { 56820 const children = []; 56821 this[_symbol_utils.$extra] = { 56822 children 56823 }; 56824 this[_symbol_utils.$childrenToHTML]({}); 56825 if (children.length === 0) { 56826 return _utils.HTMLResult.success({ 56827 name: "div", 56828 attributes: { 56829 class: ["xfaRich"], 56830 style: {} 56831 }, 56832 value: this[_symbol_utils.$content] || "" 56833 }); 56834 } 56835 if (children.length === 1) { 56836 const child = children[0]; 56837 if (child.attributes?.class.includes("xfaRich")) { 56838 return _utils.HTMLResult.success(child); 56839 } 56840 } 56841 return _utils.HTMLResult.success({ 56842 name: "div", 56843 attributes: { 56844 class: ["xfaRich"], 56845 style: {} 56846 }, 56847 children 56848 }); 56849 } 56850} 56851class I extends XhtmlObject { 56852 constructor(attributes) { 56853 super(attributes, "i"); 56854 } 56855 [_symbol_utils.$pushGlyphs](measure) { 56856 measure.pushFont({ 56857 posture: "italic" 56858 }); 56859 super[_symbol_utils.$pushGlyphs](measure); 56860 measure.popFont(); 56861 } 56862} 56863class Li extends XhtmlObject { 56864 constructor(attributes) { 56865 super(attributes, "li"); 56866 } 56867} 56868class Ol extends XhtmlObject { 56869 constructor(attributes) { 56870 super(attributes, "ol"); 56871 } 56872} 56873class P extends XhtmlObject { 56874 constructor(attributes) { 56875 super(attributes, "p"); 56876 } 56877 [_symbol_utils.$pushGlyphs](measure) { 56878 super[_symbol_utils.$pushGlyphs](measure, false); 56879 measure.addString("\n"); 56880 measure.addPara(); 56881 measure.popFont(); 56882 } 56883 [_symbol_utils.$text]() { 56884 const siblings = this[_symbol_utils.$getParent]()[_symbol_utils.$getChildren](); 56885 if (siblings.at(-1) === this) { 56886 return super[_symbol_utils.$text](); 56887 } 56888 return super[_symbol_utils.$text]() + "\n"; 56889 } 56890} 56891class Span extends XhtmlObject { 56892 constructor(attributes) { 56893 super(attributes, "span"); 56894 } 56895} 56896class Sub extends XhtmlObject { 56897 constructor(attributes) { 56898 super(attributes, "sub"); 56899 } 56900} 56901class Sup extends XhtmlObject { 56902 constructor(attributes) { 56903 super(attributes, "sup"); 56904 } 56905} 56906class Ul extends XhtmlObject { 56907 constructor(attributes) { 56908 super(attributes, "ul"); 56909 } 56910} 56911class XhtmlNamespace { 56912 static [_namespaces.$buildXFAObject](name, attributes) { 56913 if (XhtmlNamespace.hasOwnProperty(name)) { 56914 return XhtmlNamespace[name](attributes); 56915 } 56916 return undefined; 56917 } 56918 static a(attributes) { 56919 return new A(attributes); 56920 } 56921 static b(attributes) { 56922 return new B(attributes); 56923 } 56924 static body(attributes) { 56925 return new Body(attributes); 56926 } 56927 static br(attributes) { 56928 return new Br(attributes); 56929 } 56930 static html(attributes) { 56931 return new Html(attributes); 56932 } 56933 static i(attributes) { 56934 return new I(attributes); 56935 } 56936 static li(attributes) { 56937 return new Li(attributes); 56938 } 56939 static ol(attributes) { 56940 return new Ol(attributes); 56941 } 56942 static p(attributes) { 56943 return new P(attributes); 56944 } 56945 static span(attributes) { 56946 return new Span(attributes); 56947 } 56948 static sub(attributes) { 56949 return new Sub(attributes); 56950 } 56951 static sup(attributes) { 56952 return new Sup(attributes); 56953 } 56954 static ul(attributes) { 56955 return new Ul(attributes); 56956 } 56957} 56958exports.XhtmlNamespace = XhtmlNamespace; 56959 56960/***/ }), 56961/* 101 */ 56962/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56963 56964 56965 56966Object.defineProperty(exports, "__esModule", ({ 56967 value: true 56968})); 56969exports.UnknownNamespace = void 0; 56970var _namespaces = __w_pdfjs_require__(81); 56971var _xfa_object = __w_pdfjs_require__(87); 56972class UnknownNamespace { 56973 constructor(nsId) { 56974 this.namespaceId = nsId; 56975 } 56976 [_namespaces.$buildXFAObject](name, attributes) { 56977 return new _xfa_object.XmlObject(this.namespaceId, name, attributes); 56978 } 56979} 56980exports.UnknownNamespace = UnknownNamespace; 56981 56982/***/ }), 56983/* 102 */ 56984/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 56985 56986 56987 56988Object.defineProperty(exports, "__esModule", ({ 56989 value: true 56990})); 56991exports.DatasetReader = void 0; 56992var _util = __w_pdfjs_require__(2); 56993var _core_utils = __w_pdfjs_require__(3); 56994var _xml_parser = __w_pdfjs_require__(71); 56995function decodeString(str) { 56996 try { 56997 return (0, _util.stringToUTF8String)(str); 56998 } catch (ex) { 56999 (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`); 57000 return str; 57001 } 57002} 57003class DatasetXMLParser extends _xml_parser.SimpleXMLParser { 57004 constructor(options) { 57005 super(options); 57006 this.node = null; 57007 } 57008 onEndElement(name) { 57009 const node = super.onEndElement(name); 57010 if (node && name === "xfa:datasets") { 57011 this.node = node; 57012 throw new Error("Aborting DatasetXMLParser."); 57013 } 57014 } 57015} 57016class DatasetReader { 57017 constructor(data) { 57018 if (data.datasets) { 57019 this.node = new _xml_parser.SimpleXMLParser({ 57020 hasAttributes: true 57021 }).parseFromString(data.datasets).documentElement; 57022 } else { 57023 const parser = new DatasetXMLParser({ 57024 hasAttributes: true 57025 });
57026 try { 57027 parser.parseFromString(data["xdp:xdp"]); 57028 } catch {} 57029 this.node = parser.node; 57030 } 57031 } 57032 getValue(path) { 57033 if (!this.node || !path) { 57034 return ""; 57035 } 57036 const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0); 57037 if (!node) { 57038 return ""; 57039 } 57040 const first = node.firstChild; 57041 if (first?.nodeName === "value") { 57042 return node.children.map(child => decodeString(child.textContent)); 57043 } 57044 return decodeString(node.textContent); 57045 } 57046} 57047exports.DatasetReader = DatasetReader; 57048 57049/***/ }), 57050/* 103 */ 57051/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 57052 57053 57054 57055Object.defineProperty(exports, "__esModule", ({ 57056 value: true 57057})); 57058exports.XRef = void 0; 57059var _util = __w_pdfjs_require__(2); 57060var _primitives = __w_pdfjs_require__(4); 57061var _parser = __w_pdfjs_require__(16); 57062var _core_utils = __w_pdfjs_require__(3); 57063var _base_stream = __w_pdfjs_require__(5); 57064var _crypto = __w_pdfjs_require__(74); 57065class XRef { 57066 #firstXRefStmPos = null; 57067 constructor(stream, pdfManager) { 57068 this.stream = stream; 57069 this.pdfManager = pdfManager; 57070 this.entries = []; 57071 this._xrefStms = new Set(); 57072 this._cacheMap = new Map(); 57073 this._pendingRefs = new _primitives.RefSet(); 57074 this._newPersistentRefNum = null; 57075 this._newTemporaryRefNum = null; 57076 } 57077 getNewPersistentRef(obj) { 57078 if (this._newPersistentRefNum === null) { 57079 this._newPersistentRefNum = this.entries.length || 1; 57080 } 57081 const num = this._newPersistentRefNum++; 57082 this._cacheMap.set(num, obj); 57083 return _primitives.Ref.get(num, 0); 57084 } 57085 getNewTemporaryRef() { 57086 if (this._newTemporaryRefNum === null) { 57087 this._newTemporaryRefNum = this.entries.length || 1; 57088 } 57089 return _primitives.Ref.get(this._newTemporaryRefNum++, 0); 57090 } 57091 resetNewTemporaryRef() { 57092 this._newTemporaryRefNum = null; 57093 } 57094 setStartXRef(startXRef) { 57095 this.startXRefQueue = [startXRef]; 57096 } 57097 parse(recoveryMode = false) { 57098 let trailerDict; 57099 if (!recoveryMode) { 57100 trailerDict = this.readXRef(); 57101 } else { 57102 (0, _util.warn)("Indexing all PDF objects"); 57103 trailerDict = this.indexObjects(); 57104 } 57105 trailerDict.assignXref(this); 57106 this.trailer = trailerDict; 57107 let encrypt; 57108 try { 57109 encrypt = trailerDict.get("Encrypt"); 57110 } catch (ex) { 57111 if (ex instanceof _core_utils.MissingDataException) { 57112 throw ex; 57113 } 57114 (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`); 57115 } 57116 if (encrypt instanceof _primitives.Dict) { 57117 const ids = trailerDict.get("ID"); 57118 const fileId = ids?.length ? ids[0] : ""; 57119 encrypt.suppressEncryption = true; 57120 this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password); 57121 } 57122 let root; 57123 try { 57124 root = trailerDict.get("Root"); 57125 } catch (ex) { 57126 if (ex instanceof _core_utils.MissingDataException) { 57127 throw ex; 57128 } 57129 (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`); 57130 } 57131 if (root instanceof _primitives.Dict) { 57132 try { 57133 const pages = root.get("Pages"); 57134 if (pages instanceof _primitives.Dict) { 57135 this.root = root; 57136 return; 57137 } 57138 } catch (ex) { 57139 if (ex instanceof _core_utils.MissingDataException) { 57140 throw ex; 57141 } 57142 (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`); 57143 } 57144 } 57145 if (!recoveryMode) { 57146 throw new _core_utils.XRefParseException(); 57147 } 57148 throw new _util.InvalidPDFException("Invalid Root reference."); 57149 } 57150 processXRefTable(parser) { 57151 if (!("tableState" in this)) { 57152 this.tableState = { 57153 entryNum: 0, 57154 streamPos: parser.lexer.stream.pos, 57155 parserBuf1: parser.buf1, 57156 parserBuf2: parser.buf2 57157 }; 57158 } 57159 const obj = this.readXRefTable(parser); 57160 if (!(0, _primitives.isCmd)(obj, "trailer")) { 57161 throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary"); 57162 } 57163 let dict = parser.getObj(); 57164 if (!(dict instanceof _primitives.Dict) && dict.dict) { 57165 dict = dict.dict; 57166 } 57167 if (!(dict instanceof _primitives.Dict)) { 57168 throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary"); 57169 } 57170 delete this.tableState; 57171 return dict; 57172 } 57173 readXRefTable(parser) { 57174 const stream = parser.lexer.stream; 57175 const tableState = this.tableState; 57176 stream.pos = tableState.streamPos; 57177 parser.buf1 = tableState.parserBuf1; 57178 parser.buf2 = tableState.parserBuf2; 57179 let obj; 57180 while (true) { 57181 if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) { 57182 if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) { 57183 break; 57184 } 57185 tableState.firstEntryNum = obj; 57186 tableState.entryCount = parser.getObj(); 57187 } 57188 let first = tableState.firstEntryNum; 57189 const count = tableState.entryCount; 57190 if (!Number.isInteger(first) || !Number.isInteger(count)) { 57191 throw new _util.FormatError("Invalid XRef table: wrong types in subsection header"); 57192 } 57193 for (let i = tableState.entryNum; i < count; i++) { 57194 tableState.streamPos = stream.pos; 57195 tableState.entryNum = i; 57196 tableState.parserBuf1 = parser.buf1; 57197 tableState.parserBuf2 = parser.buf2; 57198 const entry = {}; 57199 entry.offset = parser.getObj(); 57200 entry.gen = parser.getObj(); 57201 const type = parser.getObj(); 57202 if (type instanceof _primitives.Cmd) { 57203 switch (type.cmd) { 57204 case "f": 57205 entry.free = true; 57206 break; 57207 case "n": 57208 entry.uncompressed = true; 57209 break; 57210 } 57211 } 57212 if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) { 57213 throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`); 57214 } 57215 if (i === 0 && entry.free && first === 1) { 57216 first = 0; 57217 } 57218 if (!this.entries[i + first]) { 57219 this.entries[i + first] = entry; 57220 } 57221 } 57222 tableState.entryNum = 0; 57223 tableState.streamPos = stream.pos; 57224 tableState.parserBuf1 = parser.buf1; 57225 tableState.parserBuf2 = parser.buf2; 57226 delete tableState.firstEntryNum; 57227 delete tableState.entryCount; 57228 } 57229 if (this.entries[0] && !this.entries[0].free) { 57230 throw new _util.FormatError("Invalid XRef table: unexpected first object"); 57231 } 57232 return obj; 57233 } 57234 processXRefStream(stream) { 57235 if (!("streamState" in this)) { 57236 const streamParameters = stream.dict;
vendor: 9,900 bytes, lines 57237-57534
57237 const byteWidths = streamParameters.get("W"); 57238 let range = streamParameters.get("Index"); 57239 if (!range) { 57240 range = [0, streamParameters.get("Size")]; 57241 } 57242 this.streamState = { 57243 entryRanges: range, 57244 byteWidths, 57245 entryNum: 0, 57246 streamPos: stream.pos 57247 }; 57248 } 57249 this.readXRefStream(stream); 57250 delete this.streamState; 57251 return stream.dict; 57252 } 57253 readXRefStream(stream) { 57254 const streamState = this.streamState; 57255 stream.pos = streamState.streamPos; 57256 const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths; 57257 const entryRanges = streamState.entryRanges; 57258 while (entryRanges.length > 0) { 57259 const [first, n] = entryRanges; 57260 if (!Number.isInteger(first) || !Number.isInteger(n)) { 57261 throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`); 57262 } 57263 if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) { 57264 throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`); 57265 } 57266 for (let i = streamState.entryNum; i < n; ++i) { 57267 streamState.entryNum = i; 57268 streamState.streamPos = stream.pos; 57269 let type = 0, 57270 offset = 0, 57271 generation = 0; 57272 for (let j = 0; j < typeFieldWidth; ++j) { 57273 const typeByte = stream.getByte(); 57274 if (typeByte === -1) { 57275 throw new _util.FormatError("Invalid XRef byteWidths 'type'."); 57276 } 57277 type = type << 8 | typeByte; 57278 } 57279 if (typeFieldWidth === 0) { 57280 type = 1; 57281 } 57282 for (let j = 0; j < offsetFieldWidth; ++j) { 57283 const offsetByte = stream.getByte(); 57284 if (offsetByte === -1) { 57285 throw new _util.FormatError("Invalid XRef byteWidths 'offset'."); 57286 } 57287 offset = offset << 8 | offsetByte; 57288 } 57289 for (let j = 0; j < generationFieldWidth; ++j) { 57290 const generationByte = stream.getByte(); 57291 if (generationByte === -1) { 57292 throw new _util.FormatError("Invalid XRef byteWidths 'generation'."); 57293 } 57294 generation = generation << 8 | generationByte; 57295 } 57296 const entry = {}; 57297 entry.offset = offset; 57298 entry.gen = generation; 57299 switch (type) { 57300 case 0: 57301 entry.free = true; 57302 break; 57303 case 1: 57304 entry.uncompressed = true; 57305 break; 57306 case 2: 57307 break; 57308 default: 57309 throw new _util.FormatError(`Invalid XRef entry type: ${type}`); 57310 } 57311 if (!this.entries[first + i]) { 57312 this.entries[first + i] = entry; 57313 } 57314 } 57315 streamState.entryNum = 0; 57316 streamState.streamPos = stream.pos; 57317 entryRanges.splice(0, 2); 57318 } 57319 } 57320 indexObjects() { 57321 const TAB = 0x9, 57322 LF = 0xa, 57323 CR = 0xd, 57324 SPACE = 0x20; 57325 const PERCENT = 0x25, 57326 LT = 0x3c; 57327 function readToken(data, offset) { 57328 let token = "", 57329 ch = data[offset]; 57330 while (ch !== LF && ch !== CR && ch !== LT) { 57331 if (++offset >= data.length) { 57332 break; 57333 } 57334 token += String.fromCharCode(ch); 57335 ch = data[offset]; 57336 } 57337 return token; 57338 } 57339 function skipUntil(data, offset, what) { 57340 const length = what.length, 57341 dataLength = data.length; 57342 let skipped = 0; 57343 while (offset < dataLength) { 57344 let i = 0; 57345 while (i < length && data[offset + i] === what[i]) { 57346 ++i; 57347 } 57348 if (i >= length) { 57349 break; 57350 } 57351 offset++; 57352 skipped++; 57353 } 57354 return skipped; 57355 } 57356 const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g; 57357 const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g; 57358 const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/; 57359 const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]); 57360 const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]); 57361 const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]); 57362 this.entries.length = 0; 57363 this._cacheMap.clear(); 57364 const stream = this.stream; 57365 stream.pos = 0; 57366 const buffer = stream.getBytes(), 57367 bufferStr = (0, _util.bytesToString)(buffer), 57368 length = buffer.length; 57369 let position = stream.start; 57370 const trailers = [], 57371 xrefStms = []; 57372 while (position < length) { 57373 let ch = buffer[position]; 57374 if (ch === TAB || ch === LF || ch === CR || ch === SPACE) { 57375 ++position; 57376 continue; 57377 } 57378 if (ch === PERCENT) { 57379 do { 57380 ++position; 57381 if (position >= length) { 57382 break; 57383 } 57384 ch = buffer[position]; 57385 } while (ch !== LF && ch !== CR); 57386 continue; 57387 } 57388 const token = readToken(buffer, position); 57389 let m; 57390 if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) { 57391 position += skipUntil(buffer, position, trailerBytes); 57392 trailers.push(position); 57393 position += skipUntil(buffer, position, startxrefBytes); 57394 } else if (m = objRegExp.exec(token)) { 57395 const num = m[1] | 0, 57396 gen = m[2] | 0; 57397 const startPos = position + token.length; 57398 let contentLength, 57399 updateEntries = false; 57400 if (!this.entries[num]) { 57401 updateEntries = true; 57402 } else if (this.entries[num].gen === gen) { 57403 try { 57404 const parser = new _parser.Parser({ 57405 lexer: new _parser.Lexer(stream.makeSubStream(startPos)) 57406 }); 57407 parser.getObj(); 57408 updateEntries = true; 57409 } catch (ex) { 57410 if (ex instanceof _core_utils.ParserEOFException) { 57411 (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`); 57412 } else { 57413 updateEntries = true; 57414 } 57415 } 57416 } 57417 if (updateEntries) { 57418 this.entries[num] = { 57419 offset: position - stream.start, 57420 gen, 57421 uncompressed: true 57422 }; 57423 } 57424 gEndobjRegExp.lastIndex = startPos; 57425 const match = gEndobjRegExp.exec(bufferStr); 57426 if (match) { 57427 const endPos = gEndobjRegExp.lastIndex + 1; 57428 contentLength = endPos - position; 57429 if (match[1] !== "endobj") { 57430 (0, _util.warn)(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.'); 57431 contentLength -= match[1].length + 1; 57432 } 57433 } else { 57434 contentLength = length - position; 57435 } 57436 const content = buffer.subarray(position, position + contentLength); 57437 const xrefTagOffset = skipUntil(content, 0, xrefBytes); 57438 if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) { 57439 xrefStms.push(position - stream.start); 57440 this._xrefStms.add(position - stream.start); 57441 } 57442 position += contentLength; 57443 } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) { 57444 trailers.push(position); 57445 const startPos = position + token.length; 57446 let contentLength; 57447 gStartxrefRegExp.lastIndex = startPos; 57448 const match = gStartxrefRegExp.exec(bufferStr); 57449 if (match) { 57450 const endPos = gStartxrefRegExp.lastIndex + 1; 57451 contentLength = endPos - position; 57452 if (match[1] !== "startxref") { 57453 (0, _util.warn)(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.'); 57454 contentLength -= match[1].length + 1; 57455 } 57456 } else { 57457 contentLength = length - position; 57458 } 57459 position += contentLength; 57460 } else { 57461 position += token.length + 1; 57462 } 57463 } 57464 for (const xrefStm of xrefStms) { 57465 this.startXRefQueue.push(xrefStm); 57466 this.readXRef(true); 57467 } 57468 const trailerDicts = []; 57469 let isEncrypted = false; 57470 for (const trailer of trailers) { 57471 stream.pos = trailer; 57472 const parser = new _parser.Parser({ 57473 lexer: new _parser.Lexer(stream), 57474 xref: this, 57475 allowStreams: true, 57476 recoveryMode: true 57477 }); 57478 const obj = parser.getObj(); 57479 if (!(0, _primitives.isCmd)(obj, "trailer")) { 57480 continue; 57481 } 57482 const dict = parser.getObj(); 57483 if (!(dict instanceof _primitives.Dict)) { 57484 continue; 57485 } 57486 trailerDicts.push(dict); 57487 if (dict.has("Encrypt")) { 57488 isEncrypted = true; 57489 } 57490 } 57491 let trailerDict, trailerError; 57492 for (const dict of [...trailerDicts, "genFallback", ...trailerDicts]) { 57493 if (dict === "genFallback") { 57494 if (!trailerError) { 57495 break; 57496 } 57497 this._generationFallback = true; 57498 continue; 57499 } 57500 let validPagesDict = false; 57501 try { 57502 const rootDict = dict.get("Root"); 57503 if (!(rootDict instanceof _primitives.Dict)) { 57504 continue; 57505 } 57506 const pagesDict = rootDict.get("Pages"); 57507 if (!(pagesDict instanceof _primitives.Dict)) { 57508 continue; 57509 } 57510 const pagesCount = pagesDict.get("Count"); 57511 if (Number.isInteger(pagesCount)) { 57512 validPagesDict = true; 57513 } 57514 } catch (ex) { 57515 trailerError = ex; 57516 continue; 57517 } 57518 if (validPagesDict && (!isEncrypted || dict.has("Encrypt")) && dict.has("ID")) { 57519 return dict; 57520 } 57521 trailerDict = dict; 57522 } 57523 if (trailerDict) { 57524 return trailerDict; 57525 } 57526 if (this.topDict) { 57527 return this.topDict; 57528 } 57529 throw new _util.InvalidPDFException("Invalid PDF structure."); 57530 } 57531 readXRef(recoveryMode = false) { 57532 const stream = this.stream; 57533 const startXRefParsedCache = new Set(); 57534 while (this.startXRefQueue.length) {
57535 try { 57536 const startXRef = this.startXRefQueue[0]; 57537 if (startXRefParsedCache.has(startXRef)) { 57538 (0, _util.warn)("readXRef - skipping XRef table since it was already parsed."); 57539 this.startXRefQueue.shift(); 57540 continue; 57541 } 57542 startXRefParsedCache.add(startXRef); 57543 stream.pos = startXRef + stream.start; 57544 const parser = new _parser.Parser({ 57545 lexer: new _parser.Lexer(stream), 57546 xref: this, 57547 allowStreams: true 57548 }); 57549 let obj = parser.getObj(); 57550 let dict; 57551 if ((0, _primitives.isCmd)(obj, "xref")) { 57552 dict = this.processXRefTable(parser); 57553 if (!this.topDict) { 57554 this.topDict = dict; 57555 } 57556 obj = dict.get("XRefStm"); 57557 if (Number.isInteger(obj) && !this._xrefStms.has(obj)) { 57558 this._xrefStms.add(obj); 57559 this.startXRefQueue.push(obj); 57560 this.#firstXRefStmPos ??= obj; 57561 } 57562 } else if (Number.isInteger(obj)) { 57563 if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) { 57564 throw new _util.FormatError("Invalid XRef stream"); 57565 } 57566 dict = this.processXRefStream(obj); 57567 if (!this.topDict) { 57568 this.topDict = dict; 57569 } 57570 if (!dict) { 57571 throw new _util.FormatError("Failed to read XRef stream"); 57572 } 57573 } else { 57574 throw new _util.FormatError("Invalid XRef stream header"); 57575 } 57576 obj = dict.get("Prev"); 57577 if (Number.isInteger(obj)) { 57578 this.startXRefQueue.push(obj); 57579 } else if (obj instanceof _primitives.Ref) { 57580 this.startXRefQueue.push(obj.num); 57581 } 57582 } catch (e) { 57583 if (e instanceof _core_utils.MissingDataException) { 57584 throw e; 57585 } 57586 (0, _util.info)("(while reading XRef): " + e); 57587 } 57588 this.startXRefQueue.shift(); 57589 } 57590 if (this.topDict) { 57591 return this.topDict; 57592 } 57593 if (recoveryMode) { 57594 return undefined; 57595 } 57596 throw new _core_utils.XRefParseException(); 57597 } 57598 get lastXRefStreamPos() { 57599 return this.#firstXRefStmPos ?? (this._xrefStms.size > 0 ? Math.max(...this._xrefStms) : null); 57600 } 57601 getEntry(i) { 57602 const xrefEntry = this.entries[i]; 57603 if (xrefEntry && !xrefEntry.free && xrefEntry.offset) { 57604 return xrefEntry; 57605 } 57606 return null; 57607 } 57608 fetchIfRef(obj, suppressEncryption = false) { 57609 if (obj instanceof _primitives.Ref) { 57610 return this.fetch(obj, suppressEncryption); 57611 } 57612 return obj; 57613 } 57614 fetch(ref, suppressEncryption = false) { 57615 if (!(ref instanceof _primitives.Ref)) { 57616 throw new Error("ref object is not a reference"); 57617 } 57618 const num = ref.num; 57619 const cacheEntry = this._cacheMap.get(num); 57620 if (cacheEntry !== undefined) { 57621 if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) { 57622 cacheEntry.objId = ref.toString(); 57623 } 57624 return cacheEntry; 57625 } 57626 let xrefEntry = this.getEntry(num); 57627 if (xrefEntry === null) { 57628 this._cacheMap.set(num, xrefEntry); 57629 return xrefEntry; 57630 } 57631 if (this._pendingRefs.has(ref)) { 57632 this._pendingRefs.remove(ref); 57633 (0, _util.warn)(`Ignoring circular reference: ${ref}.`); 57634 return _primitives.CIRCULAR_REF; 57635 } 57636 this._pendingRefs.put(ref); 57637 try { 57638 xrefEntry = xrefEntry.uncompressed ? this.fetchUncompressed(ref, xrefEntry, suppressEncryption) : this.fetchCompressed(ref, xrefEntry, suppressEncryption); 57639 this._pendingRefs.remove(ref); 57640 } catch (ex) { 57641 this._pendingRefs.remove(ref); 57642 throw ex; 57643 } 57644 if (xrefEntry instanceof _primitives.Dict) { 57645 xrefEntry.objId = ref.toString(); 57646 } else if (xrefEntry instanceof _base_stream.BaseStream) { 57647 xrefEntry.dict.objId = ref.toString(); 57648 } 57649 return xrefEntry; 57650 } 57651 fetchUncompressed(ref, xrefEntry, suppressEncryption = false) { 57652 const gen = ref.gen; 57653 let num = ref.num; 57654 if (xrefEntry.gen !== gen) { 57655 const msg = `Inconsistent generation in XRef: ${ref}`; 57656 if (this._generationFallback && xrefEntry.gen < gen) { 57657 (0, _util.warn)(msg); 57658 return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption); 57659 } 57660 throw new _core_utils.XRefEntryException(msg); 57661 } 57662 const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start); 57663 const parser = new _parser.Parser({ 57664 lexer: new _parser.Lexer(stream), 57665 xref: this, 57666 allowStreams: true 57667 }); 57668 const obj1 = parser.getObj(); 57669 const obj2 = parser.getObj(); 57670 const obj3 = parser.getObj(); 57671 if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) { 57672 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 57673 } 57674 if (obj3.cmd !== "obj") { 57675 if (obj3.cmd.startsWith("obj")) { 57676 num = parseInt(obj3.cmd.substring(3), 10); 57677 if (!Number.isNaN(num)) { 57678 return num; 57679 } 57680 } 57681 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 57682 } 57683 xrefEntry = this.encrypt && !suppressEncryption ? parser.getObj(this.encrypt.createCipherTransform(num, gen)) : parser.getObj(); 57684 if (!(xrefEntry instanceof _base_stream.BaseStream)) { 57685 this._cacheMap.set(num, xrefEntry); 57686 } 57687 return xrefEntry; 57688 } 57689 fetchCompressed(ref, xrefEntry, suppressEncryption = false) { 57690 const tableOffset = xrefEntry.offset; 57691 const stream = this.fetch(_primitives.Ref.get(tableOffset, 0)); 57692 if (!(stream instanceof _base_stream.BaseStream)) { 57693 throw new _util.FormatError("bad ObjStm stream"); 57694 } 57695 const first = stream.dict.get("First"); 57696 const n = stream.dict.get("N"); 57697 if (!Number.isInteger(first) || !Number.isInteger(n)) { 57698 throw new _util.FormatError("invalid first and n parameters for ObjStm stream"); 57699 } 57700 let parser = new _parser.Parser({ 57701 lexer: new _parser.Lexer(stream), 57702 xref: this, 57703 allowStreams: true 57704 }); 57705 const nums = new Array(n); 57706 const offsets = new Array(n); 57707 for (let i = 0; i < n; ++i) { 57708 const num = parser.getObj(); 57709 if (!Number.isInteger(num)) { 57710 throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`); 57711 } 57712 const offset = parser.getObj(); 57713 if (!Number.isInteger(offset)) { 57714 throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`); 57715 } 57716 nums[i] = num; 57717 offsets[i] = offset; 57718 } 57719 const start = (stream.start || 0) + first; 57720 const entries = new Array(n); 57721 for (let i = 0; i < n; ++i) { 57722 const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined; 57723 if (length < 0) { 57724 throw new _util.FormatError("Invalid offset in the ObjStm stream."); 57725 } 57726 parser = new _parser.Parser({ 57727 lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)), 57728 xref: this, 57729 allowStreams: true 57730 }); 57731 const obj = parser.getObj();
57732 entries[i] = obj; 57733 if (obj instanceof _base_stream.BaseStream) { 57734 continue; 57735 } 57736 const num = nums[i], 57737 entry = this.entries[num]; 57738 if (entry && entry.offset === tableOffset && entry.gen === i) { 57739 this._cacheMap.set(num, obj); 57740 } 57741 } 57742 xrefEntry = entries[xrefEntry.gen]; 57743 if (xrefEntry === undefined) { 57744 throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`); 57745 } 57746 return xrefEntry; 57747 } 57748 async fetchIfRefAsync(obj, suppressEncryption) { 57749 if (obj instanceof _primitives.Ref) { 57750 return this.fetchAsync(obj, suppressEncryption); 57751 } 57752 return obj; 57753 } 57754 async fetchAsync(ref, suppressEncryption) { 57755 try { 57756 return this.fetch(ref, suppressEncryption); 57757 } catch (ex) { 57758 if (!(ex instanceof _core_utils.MissingDataException)) { 57759 throw ex; 57760 } 57761 await this.pdfManager.requestRange(ex.begin, ex.end); 57762 return this.fetchAsync(ref, suppressEncryption); 57763 } 57764 } 57765 getCatalogObj() { 57766 return this.root; 57767 } 57768} 57769exports.XRef = XRef; 57770 57771/***/ }), 57772/* 104 */ 57773/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 57774 57775 57776 57777Object.defineProperty(exports, "__esModule", ({ 57778 value: true 57779})); 57780exports.MessageHandler = void 0; 57781var _util = __w_pdfjs_require__(2); 57782const CallbackKind = { 57783 UNKNOWN: 0, 57784 DATA: 1, 57785 ERROR: 2 57786}; 57787const StreamKind = { 57788 UNKNOWN: 0, 57789 CANCEL: 1, 57790 CANCEL_COMPLETE: 2, 57791 CLOSE: 3, 57792 ENQUEUE: 4, 57793 ERROR: 5, 57794 PULL: 6, 57795 PULL_COMPLETE: 7, 57796 START_COMPLETE: 8 57797}; 57798function wrapReason(reason) { 57799 if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) { 57800 (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'); 57801 } 57802 switch (reason.name) { 57803 case "AbortException": 57804 return new _util.AbortException(reason.message); 57805 case "MissingPDFException": 57806 return new _util.MissingPDFException(reason.message); 57807 case "PasswordException": 57808 return new _util.PasswordException(reason.message, reason.code); 57809 case "UnexpectedResponseException": 57810 return new _util.UnexpectedResponseException(reason.message, reason.status); 57811 case "UnknownErrorException": 57812 return new _util.UnknownErrorException(reason.message, reason.details); 57813 default: 57814 return new _util.UnknownErrorException(reason.message, reason.toString()); 57815 } 57816} 57817class MessageHandler { 57818 constructor(sourceName, targetName, comObj) { 57819 this.sourceName = sourceName; 57820 this.targetName = targetName; 57821 this.comObj = comObj; 57822 this.callbackId = 1; 57823 this.streamId = 1; 57824 this.streamSinks = Object.create(null); 57825 this.streamControllers = Object.create(null); 57826 this.callbackCapabilities = Object.create(null); 57827 this.actionHandler = Object.create(null); 57828 this._onComObjOnMessage = event => { 57829 const data = event.data; 57830 if (data.targetName !== this.sourceName) { 57831 return; 57832 } 57833 if (data.stream) { 57834 this.#processStreamMessage(data); 57835 return; 57836 } 57837 if (data.callback) { 57838 const callbackId = data.callbackId; 57839 const capability = this.callbackCapabilities[callbackId]; 57840 if (!capability) { 57841 throw new Error(`Cannot resolve callback ${callbackId}`); 57842 } 57843 delete this.callbackCapabilities[callbackId]; 57844 if (data.callback === CallbackKind.DATA) { 57845 capability.resolve(data.data); 57846 } else if (data.callback === CallbackKind.ERROR) { 57847 capability.reject(wrapReason(data.reason)); 57848 } else { 57849 throw new Error("Unexpected callback case"); 57850 } 57851 return; 57852 } 57853 const action = this.actionHandler[data.action]; 57854 if (!action) { 57855 throw new Error(`Unknown action from worker: ${data.action}`); 57856 } 57857 if (data.callbackId) { 57858 const cbSourceName = this.sourceName; 57859 const cbTargetName = data.sourceName; 57860 new Promise(function (resolve) { 57861 resolve(action(data.data)); 57862 }).then(function (result) { 57863 comObj.postMessage({ 57864 sourceName: cbSourceName, 57865 targetName: cbTargetName, 57866 callback: CallbackKind.DATA, 57867 callbackId: data.callbackId, 57868 data: result 57869 }); 57870 }, function (reason) { 57871 comObj.postMessage({ 57872 sourceName: cbSourceName, 57873 targetName: cbTargetName, 57874 callback: CallbackKind.ERROR, 57875 callbackId: data.callbackId, 57876 reason: wrapReason(reason) 57877 }); 57878 }); 57879 return; 57880 } 57881 if (data.streamId) { 57882 this.#createStreamSink(data); 57883 return; 57884 } 57885 action(data.data); 57886 }; 57887 comObj.addEventListener("message", this._onComObjOnMessage); 57888 } 57889 on(actionName, handler) { 57890 const ah = this.actionHandler; 57891 if (ah[actionName]) { 57892 throw new Error(`There is already an actionName called "${actionName}"`); 57893 } 57894 ah[actionName] = handler; 57895 } 57896 send(actionName, data, transfers) { 57897 this.comObj.postMessage({ 57898 sourceName: this.sourceName, 57899 targetName: this.targetName, 57900 action: actionName, 57901 data 57902 }, transfers); 57903 }
vendor: 9,994 bytes, lines 57904-58225
57904 sendWithPromise(actionName, data, transfers) { 57905 const callbackId = this.callbackId++; 57906 const capability = new _util.PromiseCapability(); 57907 this.callbackCapabilities[callbackId] = capability; 57908 try { 57909 this.comObj.postMessage({ 57910 sourceName: this.sourceName, 57911 targetName: this.targetName, 57912 action: actionName, 57913 callbackId, 57914 data 57915 }, transfers); 57916 } catch (ex) { 57917 capability.reject(ex); 57918 } 57919 return capability.promise; 57920 } 57921 sendWithStream(actionName, data, queueingStrategy, transfers) { 57922 const streamId = this.streamId++, 57923 sourceName = this.sourceName, 57924 targetName = this.targetName, 57925 comObj = this.comObj; 57926 return new ReadableStream({ 57927 start: controller => { 57928 const startCapability = new _util.PromiseCapability(); 57929 this.streamControllers[streamId] = { 57930 controller, 57931 startCall: startCapability, 57932 pullCall: null, 57933 cancelCall: null, 57934 isClosed: false 57935 }; 57936 comObj.postMessage({ 57937 sourceName, 57938 targetName, 57939 action: actionName, 57940 streamId, 57941 data, 57942 desiredSize: controller.desiredSize 57943 }, transfers); 57944 return startCapability.promise; 57945 }, 57946 pull: controller => { 57947 const pullCapability = new _util.PromiseCapability(); 57948 this.streamControllers[streamId].pullCall = pullCapability; 57949 comObj.postMessage({ 57950 sourceName, 57951 targetName, 57952 stream: StreamKind.PULL, 57953 streamId, 57954 desiredSize: controller.desiredSize 57955 }); 57956 return pullCapability.promise; 57957 }, 57958 cancel: reason => { 57959 (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason"); 57960 const cancelCapability = new _util.PromiseCapability(); 57961 this.streamControllers[streamId].cancelCall = cancelCapability; 57962 this.streamControllers[streamId].isClosed = true; 57963 comObj.postMessage({ 57964 sourceName, 57965 targetName, 57966 stream: StreamKind.CANCEL, 57967 streamId, 57968 reason: wrapReason(reason) 57969 }); 57970 return cancelCapability.promise; 57971 } 57972 }, queueingStrategy); 57973 } 57974 #createStreamSink(data) { 57975 const streamId = data.streamId, 57976 sourceName = this.sourceName, 57977 targetName = data.sourceName, 57978 comObj = this.comObj; 57979 const self = this, 57980 action = this.actionHandler[data.action]; 57981 const streamSink = { 57982 enqueue(chunk, size = 1, transfers) { 57983 if (this.isCancelled) { 57984 return; 57985 } 57986 const lastDesiredSize = this.desiredSize; 57987 this.desiredSize -= size; 57988 if (lastDesiredSize > 0 && this.desiredSize <= 0) { 57989 this.sinkCapability = new _util.PromiseCapability(); 57990 this.ready = this.sinkCapability.promise; 57991 } 57992 comObj.postMessage({ 57993 sourceName, 57994 targetName, 57995 stream: StreamKind.ENQUEUE, 57996 streamId, 57997 chunk 57998 }, transfers); 57999 }, 58000 close() { 58001 if (this.isCancelled) { 58002 return; 58003 } 58004 this.isCancelled = true; 58005 comObj.postMessage({ 58006 sourceName, 58007 targetName, 58008 stream: StreamKind.CLOSE, 58009 streamId 58010 }); 58011 delete self.streamSinks[streamId]; 58012 }, 58013 error(reason) { 58014 (0, _util.assert)(reason instanceof Error, "error must have a valid reason"); 58015 if (this.isCancelled) { 58016 return; 58017 } 58018 this.isCancelled = true; 58019 comObj.postMessage({ 58020 sourceName, 58021 targetName, 58022 stream: StreamKind.ERROR, 58023 streamId, 58024 reason: wrapReason(reason) 58025 }); 58026 }, 58027 sinkCapability: new _util.PromiseCapability(), 58028 onPull: null, 58029 onCancel: null, 58030 isCancelled: false, 58031 desiredSize: data.desiredSize, 58032 ready: null 58033 }; 58034 streamSink.sinkCapability.resolve(); 58035 streamSink.ready = streamSink.sinkCapability.promise; 58036 this.streamSinks[streamId] = streamSink; 58037 new Promise(function (resolve) { 58038 resolve(action(data.data, streamSink)); 58039 }).then(function () { 58040 comObj.postMessage({ 58041 sourceName, 58042 targetName, 58043 stream: StreamKind.START_COMPLETE, 58044 streamId, 58045 success: true 58046 }); 58047 }, function (reason) { 58048 comObj.postMessage({ 58049 sourceName, 58050 targetName, 58051 stream: StreamKind.START_COMPLETE, 58052 streamId, 58053 reason: wrapReason(reason) 58054 }); 58055 }); 58056 } 58057 #processStreamMessage(data) { 58058 const streamId = data.streamId, 58059 sourceName = this.sourceName, 58060 targetName = data.sourceName, 58061 comObj = this.comObj; 58062 const streamController = this.streamControllers[streamId], 58063 streamSink = this.streamSinks[streamId]; 58064 switch (data.stream) { 58065 case StreamKind.START_COMPLETE: 58066 if (data.success) { 58067 streamController.startCall.resolve(); 58068 } else { 58069 streamController.startCall.reject(wrapReason(data.reason)); 58070 } 58071 break; 58072 case StreamKind.PULL_COMPLETE: 58073 if (data.success) { 58074 streamController.pullCall.resolve(); 58075 } else { 58076 streamController.pullCall.reject(wrapReason(data.reason)); 58077 } 58078 break; 58079 case StreamKind.PULL: 58080 if (!streamSink) { 58081 comObj.postMessage({ 58082 sourceName, 58083 targetName, 58084 stream: StreamKind.PULL_COMPLETE, 58085 streamId, 58086 success: true 58087 }); 58088 break; 58089 } 58090 if (streamSink.desiredSize <= 0 && data.desiredSize > 0) { 58091 streamSink.sinkCapability.resolve(); 58092 } 58093 streamSink.desiredSize = data.desiredSize; 58094 new Promise(function (resolve) { 58095 resolve(streamSink.onPull?.()); 58096 }).then(function () { 58097 comObj.postMessage({ 58098 sourceName, 58099 targetName, 58100 stream: StreamKind.PULL_COMPLETE, 58101 streamId, 58102 success: true 58103 }); 58104 }, function (reason) { 58105 comObj.postMessage({ 58106 sourceName, 58107 targetName, 58108 stream: StreamKind.PULL_COMPLETE, 58109 streamId, 58110 reason: wrapReason(reason) 58111 }); 58112 }); 58113 break; 58114 case StreamKind.ENQUEUE: 58115 (0, _util.assert)(streamController, "enqueue should have stream controller"); 58116 if (streamController.isClosed) { 58117 break; 58118 } 58119 streamController.controller.enqueue(data.chunk); 58120 break; 58121 case StreamKind.CLOSE: 58122 (0, _util.assert)(streamController, "close should have stream controller"); 58123 if (streamController.isClosed) { 58124 break; 58125 } 58126 streamController.isClosed = true; 58127 streamController.controller.close(); 58128 this.#deleteStreamController(streamController, streamId); 58129 break; 58130 case StreamKind.ERROR: 58131 (0, _util.assert)(streamController, "error should have stream controller"); 58132 streamController.controller.error(wrapReason(data.reason)); 58133 this.#deleteStreamController(streamController, streamId); 58134 break; 58135 case StreamKind.CANCEL_COMPLETE: 58136 if (data.success) { 58137 streamController.cancelCall.resolve(); 58138 } else { 58139 streamController.cancelCall.reject(wrapReason(data.reason)); 58140 } 58141 this.#deleteStreamController(streamController, streamId); 58142 break; 58143 case StreamKind.CANCEL: 58144 if (!streamSink) { 58145 break; 58146 } 58147 new Promise(function (resolve) { 58148 resolve(streamSink.onCancel?.(wrapReason(data.reason))); 58149 }).then(function () { 58150 comObj.postMessage({ 58151 sourceName, 58152 targetName, 58153 stream: StreamKind.CANCEL_COMPLETE, 58154 streamId, 58155 success: true 58156 }); 58157 }, function (reason) { 58158 comObj.postMessage({ 58159 sourceName, 58160 targetName, 58161 stream: StreamKind.CANCEL_COMPLETE, 58162 streamId, 58163 reason: wrapReason(reason) 58164 }); 58165 }); 58166 streamSink.sinkCapability.reject(wrapReason(data.reason)); 58167 streamSink.isCancelled = true; 58168 delete this.streamSinks[streamId]; 58169 break; 58170 default: 58171 throw new Error("Unexpected stream case"); 58172 } 58173 } 58174 async #deleteStreamController(streamController, streamId) { 58175 await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]); 58176 delete this.streamControllers[streamId]; 58177 } 58178 destroy() { 58179 this.comObj.removeEventListener("message", this._onComObjOnMessage); 58180 } 58181} 58182exports.MessageHandler = MessageHandler; 58183 58184/***/ }), 58185/* 105 */ 58186/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { 58187 58188 58189 58190Object.defineProperty(exports, "__esModule", ({ 58191 value: true 58192})); 58193exports.PDFWorkerStream = void 0; 58194var _util = __w_pdfjs_require__(2); 58195class PDFWorkerStream { 58196 constructor(msgHandler) { 58197 this._msgHandler = msgHandler; 58198 this._contentLength = null; 58199 this._fullRequestReader = null; 58200 this._rangeRequestReaders = []; 58201 } 58202 getFullReader() { 58203 (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once."); 58204 this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler); 58205 return this._fullRequestReader; 58206 } 58207 getRangeReader(begin, end) { 58208 const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler); 58209 this._rangeRequestReaders.push(reader); 58210 return reader; 58211 } 58212 cancelAllRequests(reason) { 58213 this._fullRequestReader?.cancel(reason); 58214 for (const reader of this._rangeRequestReaders.slice(0)) { 58215 reader.cancel(reason); 58216 } 58217 } 58218} 58219exports.PDFWorkerStream = PDFWorkerStream; 58220class PDFWorkerStreamReader { 58221 constructor(msgHandler) { 58222 this._msgHandler = msgHandler; 58223 this.onProgress = null; 58224 this._contentLength = null; 58225 this._isRangeSupported = false;
58226 this._isStreamingSupported = false; 58227 const readableStream = this._msgHandler.sendWithStream("GetReader"); 58228 this._reader = readableStream.getReader(); 58229 this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => { 58230 this._isStreamingSupported = data.isStreamingSupported; 58231 this._isRangeSupported = data.isRangeSupported; 58232 this._contentLength = data.contentLength; 58233 }); 58234 } 58235 get headersReady() { 58236 return this._headersReady; 58237 } 58238 get contentLength() { 58239 return this._contentLength; 58240 } 58241 get isStreamingSupported() { 58242 return this._isStreamingSupported; 58243 } 58244 get isRangeSupported() { 58245 return this._isRangeSupported; 58246 } 58247 async read() { 58248 const { 58249 value, 58250 done 58251 } = await this._reader.read(); 58252 if (done) { 58253 return { 58254 value: undefined, 58255 done: true 58256 }; 58257 } 58258 return { 58259 value: value.buffer, 58260 done: false 58261 }; 58262 } 58263 cancel(reason) { 58264 this._reader.cancel(reason); 58265 } 58266} 58267class PDFWorkerStreamRangeReader { 58268 constructor(begin, end, msgHandler) { 58269 this._msgHandler = msgHandler; 58270 this.onProgress = null; 58271 const readableStream = this._msgHandler.sendWithStream("GetRangeReader", { 58272 begin, 58273 end 58274 }); 58275 this._reader = readableStream.getReader(); 58276 } 58277 get isStreamingSupported() { 58278 return false; 58279 } 58280 async read() { 58281 const { 58282 value, 58283 done 58284 } = await this._reader.read(); 58285 if (done) { 58286 return { 58287 value: undefined, 58288 done: true 58289 }; 58290 } 58291 return { 58292 value: value.buffer, 58293 done: false 58294 }; 58295 } 58296 cancel(reason) { 58297 this._reader.cancel(reason); 58298 } 58299} 58300 58301/***/ }) 58302/******/ ]); 58303/************************************************************************/ 58304/******/ // The module cache 58305/******/ var __webpack_module_cache__ = {}; 58306/******/ 58307/******/ // The require function 58308/******/ function __w_pdfjs_require__(moduleId) { 58309/******/ // Check if module is in cache 58310/******/ var cachedModule = __webpack_module_cache__[moduleId]; 58311/******/ if (cachedModule !== undefined) { 58312/******/ return cachedModule.exports; 58313/******/ } 58314/******/ // Create a new module (and put it into the cache) 58315/******/ var module = __webpack_module_cache__[moduleId] = { 58316/******/ // no module.id needed 58317/******/ // no module.loaded needed 58318/******/ exports: {} 58319/******/ }; 58320/******/ 58321/******/ // Execute the module function 58322/******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__); 58323/******/ 58324/******/ // Return the exports of the module 58325/******/ return module.exports; 58326/******/ } 58327/******/ 58328/************************************************************************/ 58329var __webpack_exports__ = {}; 58330// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 58331(() => { 58332var exports = __webpack_exports__; 58333 58334 58335Object.defineProperty(exports, "__esModule", ({ 58336 value: true 58337})); 58338Object.defineProperty(exports, "WorkerMessageHandler", ({ 58339 enumerable: true, 58340 get: function () { 58341 return _worker.WorkerMessageHandler; 58342 } 58343})); 58344var _worker = __w_pdfjs_require__(1); 58345const pdfjsVersion = '3.11.174'; 58346const pdfjsBuild = 'ce8716743'; 58347})(); 58348 58349/******/ return __webpack_exports__; 58350/******/ })() 58351; 58352}); 58353//# 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.