diff options
Diffstat (limited to 'js/pdfjs/build/pdf.worker.js')
-rw-r--r-- | js/pdfjs/build/pdf.worker.js | 7777 |
1 files changed, 5656 insertions, 2121 deletions
diff --git a/js/pdfjs/build/pdf.worker.js b/js/pdfjs/build/pdf.worker.js index 9f567ee..f8e32ab 100644 --- a/js/pdfjs/build/pdf.worker.js +++ b/js/pdfjs/build/pdf.worker.js @@ -50,13 +50,13 @@ var _primitives = __w_pdfjs_require__(5); var _pdf_manager = __w_pdfjs_require__(7); -var _writer = __w_pdfjs_require__(64); +var _writer = __w_pdfjs_require__(71); var _is_node = __w_pdfjs_require__(4); -var _message_handler = __w_pdfjs_require__(89); +var _message_handler = __w_pdfjs_require__(99); -var _worker_stream = __w_pdfjs_require__(90); +var _worker_stream = __w_pdfjs_require__(100); var _core_utils = __w_pdfjs_require__(9); @@ -125,7 +125,7 @@ class WorkerMessageHandler { const WorkerTasks = []; const verbosity = (0, _util.getVerbosityLevel)(); const apiVersion = docParams.apiVersion; - const workerVersion = '2.9.359'; + const workerVersion = '2.10.377'; if (apiVersion !== workerVersion) { throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); @@ -176,18 +176,20 @@ class WorkerMessageHandler { await pdfManager.ensureDoc("checkFirstPage"); } - const [numPages, fingerprint, isPureXfa] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint"), pdfManager.ensureDoc("isPureXfa")]); + const isPureXfa = await pdfManager.ensureDoc("isPureXfa"); if (isPureXfa) { const task = new WorkerTask("loadXfaFonts"); startWorkerTask(task); - await pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)); + await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]); } + const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]); + const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null; return { numPages, - fingerprint, - isPureXfa + fingerprints, + htmlForXfa }; } @@ -369,7 +371,10 @@ class WorkerMessageHandler { disableFontFace: data.disableFontFace, ignoreErrors: data.ignoreErrors, isEvalSupported: data.isEvalSupported, - fontExtraProperties: data.fontExtraProperties + fontExtraProperties: data.fontExtraProperties, + useSystemFonts: data.useSystemFonts, + cMapUrl: data.cMapUrl, + standardFontDataUrl: data.standardFontDataUrl }; getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) { if (terminated) { @@ -442,13 +447,6 @@ class WorkerMessageHandler { return pdfManager.ensure(page, "jsActions"); }); }); - handler.on("GetPageXfa", function wphSetupGetXfa({ - pageIndex - }) { - return pdfManager.getPage(pageIndex).then(function (page) { - return pdfManager.ensure(page, "xfaData"); - }); - }); handler.on("GetOutline", function wphSetupGetOutline(data) { return pdfManager.ensureCatalog("documentOutline"); }); @@ -491,6 +489,7 @@ class WorkerMessageHandler { return pdfManager.ensureDoc("calculationOrderIds"); }); handler.on("SaveDocument", function ({ + isPureXfa, numPages, annotationStorage, filename @@ -498,25 +497,37 @@ class WorkerMessageHandler { pdfManager.requestLoadedStream(); const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")]; - for (let pageIndex = 0; pageIndex < numPages; pageIndex++) { - promises.push(pdfManager.getPage(pageIndex).then(function (page) { - const task = new WorkerTask(`Save: page ${pageIndex}`); - startWorkerTask(task); - return page.save(handler, task, annotationStorage).finally(function () { - finishWorkerTask(task); - }); - })); + if (isPureXfa) { + promises.push(pdfManager.serializeXfaData(annotationStorage)); + } else { + for (let pageIndex = 0; pageIndex < numPages; pageIndex++) { + promises.push(pdfManager.getPage(pageIndex).then(function (page) { + const task = new WorkerTask(`Save: page ${pageIndex}`); + return page.save(handler, task, annotationStorage).finally(function () { + finishWorkerTask(task); + }); + })); + } } return Promise.all(promises).then(function ([stream, acroForm, xref, startXRef, ...refs]) { let newRefs = []; + let xfaData = null; - for (const ref of refs) { - newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs); - } + if (isPureXfa) { + xfaData = refs[0]; - if (newRefs.length === 0) { - return stream.bytes; + if (!xfaData) { + return stream.bytes; + } + } else { + for (const ref of refs) { + newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs); + } + + if (newRefs.length === 0) { + return stream.bytes; + } } const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || []; @@ -564,7 +575,8 @@ class WorkerMessageHandler { xrefInfo: newXrefInfo, newRefs, xref, - datasetsRef: xfaDatasets + datasetsRef: xfaDatasets, + xfaData }); }); }); @@ -922,6 +934,7 @@ exports.StreamType = StreamType; const FontType = { UNKNOWN: "UNKNOWN", TYPE1: "TYPE1", + TYPE1STANDARD: "TYPE1STANDARD", TYPE1C: "TYPE1C", CIDFONTTYPE0: "CIDFONTTYPE0", CIDFONTTYPE0C: "CIDFONTTYPE0C", @@ -1826,25 +1839,8 @@ class Dict { dictArray, mergeSubDicts = false }) { - const mergedDict = new Dict(xref); - - if (!mergeSubDicts) { - for (const dict of dictArray) { - if (!(dict instanceof Dict)) { - continue; - } - - for (const [key, value] of Object.entries(dict._map)) { - if (mergedDict._map[key] === undefined) { - mergedDict._map[key] = value; - } - } - } - - return mergedDict.size > 0 ? mergedDict : Dict.empty; - } - - const properties = new Map(); + const mergedDict = new Dict(xref), + properties = new Map(); for (const dict of dictArray) { if (!(dict instanceof Dict)) { @@ -1857,6 +1853,8 @@ class Dict { if (property === undefined) { property = []; properties.set(key, property); + } else if (!mergeSubDicts) { + continue; } property.push(value); @@ -2225,6 +2223,14 @@ class BasePdfManager { return this.pdfDocument.loadXfaFonts(handler, task); } + loadXfaImages() { + return this.pdfDocument.loadXfaImages(); + } + + serializeXfaData(annotationStorage) { + return this.pdfDocument.serializeXfaData(annotationStorage); + } + cleanup(manuallyTriggered = false) { return this.pdfDocument.cleanup(manuallyTriggered); } @@ -2949,7 +2955,7 @@ exports.readUint16 = readUint16; exports.readUint32 = readUint32; exports.toRomanNumerals = toRomanNumerals; exports.validateCSSFont = validateCSSFont; -exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0; +exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = void 0; var _util = __w_pdfjs_require__(2); @@ -2998,6 +3004,10 @@ class MissingDataException extends _util.BaseException { exports.MissingDataException = MissingDataException; +class ParserEOFException extends _util.BaseException {} + +exports.ParserEOFException = ParserEOFException; + class XRefEntryException extends _util.BaseException {} exports.XRefEntryException = XRefEntryException; @@ -3451,25 +3461,27 @@ var _annotation = __w_pdfjs_require__(12); var _base_stream = __w_pdfjs_require__(6); -var _crypto = __w_pdfjs_require__(65); +var _crypto = __w_pdfjs_require__(72); -var _catalog = __w_pdfjs_require__(57); +var _catalog = __w_pdfjs_require__(64); + +var _xfa_fonts = __w_pdfjs_require__(55); var _parser = __w_pdfjs_require__(17); -var _object_loader = __w_pdfjs_require__(63); +var _object_loader = __w_pdfjs_require__(70); -var _operator_list = __w_pdfjs_require__(55); +var _operator_list = __w_pdfjs_require__(62); var _evaluator = __w_pdfjs_require__(15); var _decode_stream = __w_pdfjs_require__(19); -var _struct_tree = __w_pdfjs_require__(62); +var _struct_tree = __w_pdfjs_require__(69); -var _factory = __w_pdfjs_require__(67); +var _factory = __w_pdfjs_require__(74); -var _xref = __w_pdfjs_require__(88); +var _xref = __w_pdfjs_require__(98); const DEFAULT_USER_UNIT = 1.0; const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792]; @@ -3484,6 +3496,7 @@ class Page { globalIdFactory, fontCache, builtInCMapCache, + standardFontDataCache, globalImageCache, nonBlendModesSet, xfaFactory @@ -3495,6 +3508,7 @@ class Page { this.ref = ref; this.fontCache = fontCache; this.builtInCMapCache = builtInCMapCache; + this.standardFontDataCache = standardFontDataCache; this.globalImageCache = globalImageCache; this.nonBlendModesSet = nonBlendModesSet; this.evaluatorOptions = pdfManager.evaluatorOptions; @@ -3547,11 +3561,7 @@ class Page { _getBoundingBox(name) { if (this.xfaData) { - const { - width, - height - } = this.xfaData.attributes.style; - return [0, 0, parseInt(width), parseInt(height)]; + return this.xfaData.bbox; } const box = this._getInheritableProperty(name, true); @@ -3613,7 +3623,7 @@ class Page { if (rotate % 90 !== 0) { rotate = 0; } else if (rotate >= 360) { - rotate = rotate % 360; + rotate %= 360; } else if (rotate < 0) { rotate = (rotate % 360 + 360) % 360; } @@ -3637,7 +3647,9 @@ class Page { get xfaData() { if (this.xfaFactory) { - return (0, _util.shadow)(this, "xfaData", this.xfaFactory.getPage(this.pageIndex)); + return (0, _util.shadow)(this, "xfaData", { + bbox: this.xfaFactory.getBoundingBox(this.pageIndex) + }); } return (0, _util.shadow)(this, "xfaData", null); @@ -3651,6 +3663,7 @@ class Page { idFactory: this._localIdFactory, fontCache: this.fontCache, builtInCMapCache: this.builtInCMapCache, + standardFontDataCache: this.standardFontDataCache, globalImageCache: this.globalImageCache, options: this.evaluatorOptions }); @@ -3700,6 +3713,7 @@ class Page { idFactory: this._localIdFactory, fontCache: this.fontCache, builtInCMapCache: this.builtInCMapCache, + standardFontDataCache: this.standardFontDataCache, globalImageCache: this.globalImageCache, options: this.evaluatorOptions }); @@ -3728,10 +3742,11 @@ class Page { }; } + const annotationIntent = intent.startsWith("oplist-") ? intent.split("-")[1] : intent; const opListPromises = []; for (const annotation of annotations) { - if (intent === "display" && annotation.mustBeViewed(annotationStorage) || intent === "print" && annotation.mustBePrinted(annotationStorage)) { + if (annotationIntent === "display" && annotation.mustBeViewed(annotationStorage) || annotationIntent === "print" && annotation.mustBePrinted(annotationStorage)) { opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms, annotationStorage).catch(function (reason) { (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); return null; @@ -3774,6 +3789,7 @@ class Page { idFactory: this._localIdFactory, fontCache: this.fontCache, builtInCMapCache: this.builtInCMapCache, + standardFontDataCache: this.standardFontDataCache, globalImageCache: this.globalImageCache, options: this.evaluatorOptions }); @@ -4175,7 +4191,40 @@ class PDFDocument { } get isPureXfa() { - return this.xfaFactory !== null; + return this.xfaFactory && this.xfaFactory.isValid(); + } + + get htmlForXfa() { + if (this.xfaFactory) { + return this.xfaFactory.getPages(); + } + + return null; + } + + async loadXfaImages() { + const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages"); + + if (!xfaImagesDict) { + return; + } + + const keys = xfaImagesDict.getKeys(); + const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref); + await objectLoader.load(); + const xfaImages = new Map(); + + for (const key of keys) { + const stream = xfaImagesDict.get(key); + + if (!(0, _primitives.isStream)(stream)) { + continue; + } + + xfaImages.set(key, stream.getBytes()); + } + + this.xfaFactory.setImages(xfaImages); } async loadXfaFonts(handler, task) { @@ -4199,17 +4248,28 @@ class PDFDocument { return; } + const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions); + options.useSystemFonts = false; const partialEvaluator = new _evaluator.PartialEvaluator({ xref: this.xref, handler, pageIndex: -1, idFactory: this._globalIdFactory, fontCache: this.catalog.fontCache, - builtInCMapCache: this.catalog.builtInCMapCache + builtInCMapCache: this.catalog.builtInCMapCache, + standardFontDataCache: this.catalog.standardFontDataCache, + options }); const operatorList = new _operator_list.OperatorList(); + const pdfFonts = []; const initialState = { - font: null, + get font() { + return pdfFonts[pdfFonts.length - 1]; + }, + + set font(font) { + pdfFonts.push(font); + }, clone() { return this; @@ -4229,7 +4289,8 @@ class PDFDocument { continue; } - const fontFamily = descriptor.get("FontFamily"); + let fontFamily = descriptor.get("FontFamily"); + fontFamily = fontFamily.replace(/[ ]+([0-9])/g, "$1"); const fontWeight = descriptor.get("FontWeight"); const italicAngle = -descriptor.get("ItalicAngle"); const cssFontInfo = { @@ -4249,6 +4310,80 @@ class PDFDocument { } await Promise.all(promises); + const missingFonts = this.xfaFactory.setFonts(pdfFonts); + + if (!missingFonts) { + return; + } + + options.ignoreErrors = true; + promises.length = 0; + pdfFonts.length = 0; + const reallyMissingFonts = new Set(); + + for (const missing of missingFonts) { + if (!(0, _xfa_fonts.getXfaFontWidths)(`${missing}-Regular`)) { + reallyMissingFonts.add(missing); + } + } + + if (reallyMissingFonts.size) { + missingFonts.push("PdfJS-Fallback"); + } + + for (const missing of missingFonts) { + if (reallyMissingFonts.has(missing)) { + continue; + } + + for (const fontInfo of [{ + name: "Regular", + fontWeight: 400, + italicAngle: 0 + }, { + name: "Bold", + fontWeight: 700, + italicAngle: 0 + }, { + name: "Italic", + fontWeight: 400, + italicAngle: 12 + }, { + name: "BoldItalic", + fontWeight: 700, + italicAngle: 12 + }]) { + const name = `${missing}-${fontInfo.name}`; + const widths = (0, _xfa_fonts.getXfaFontWidths)(name); + const dict = new _primitives.Dict(null); + dict.set("BaseFont", _primitives.Name.get(name)); + dict.set("Type", _primitives.Name.get("Font")); + dict.set("Subtype", _primitives.Name.get("TrueType")); + dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); + const descriptor = new _primitives.Dict(null); + descriptor.set("Widths", widths); + dict.set("FontDescriptor", descriptor); + promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, { + fontFamily: missing, + fontWeight: fontInfo.fontWeight, + italicAngle: fontInfo.italicAngle + }).catch(function (reason) { + (0, _util.warn)(`loadXfaFonts: "${reason}".`); + return null; + })); + } + } + + await Promise.all(promises); + this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts); + } + + async serializeXfaData(annotationStorage) { + if (this.xfaFactory) { + return this.xfaFactory.serializeData(annotationStorage); + } + + return null; } get formInfo() { @@ -4361,24 +4496,36 @@ class PDFDocument { return (0, _util.shadow)(this, "documentInfo", docInfo); } - get fingerprint() { - let hash; - const idArray = this.xref.trailer.get("ID"); + get fingerprints() { + function validate(data) { + return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT; + } - if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) { - hash = (0, _util.stringToBytes)(idArray[0]); - } else { - hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); + function hexString(hash) { + const buf = []; + + for (let i = 0, ii = hash.length; i < ii; i++) { + const hex = hash[i].toString(16); + buf.push(hex.padStart(2, "0")); + } + + return buf.join(""); } - const fingerprintBuf = []; + const idArray = this.xref.trailer.get("ID"); + let hashOriginal, hashModified; + + if (Array.isArray(idArray) && validate(idArray[0])) { + hashOriginal = (0, _util.stringToBytes)(idArray[0]); - for (let i = 0, ii = hash.length; i < ii; i++) { - const hex = hash[i].toString(16); - fingerprintBuf.push(hex.padStart(2, "0")); + if (idArray[1] !== idArray[0] && validate(idArray[1])) { + hashModified = (0, _util.stringToBytes)(idArray[1]); + } + } else { + hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); } - return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join("")); + return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]); } _getLinearizationPage(pageIndex) { @@ -4425,6 +4572,7 @@ class PDFDocument { globalIdFactory: this._globalIdFactory, fontCache: catalog.fontCache, builtInCMapCache: catalog.builtInCMapCache, + standardFontDataCache: catalog.standardFontDataCache, globalImageCache: catalog.globalImageCache, nonBlendModesSet: catalog.nonBlendModesSet, xfaFactory: this.xfaFactory @@ -4442,6 +4590,7 @@ class PDFDocument { globalIdFactory: this._globalIdFactory, fontCache: catalog.fontCache, builtInCMapCache: catalog.builtInCMapCache, + standardFontDataCache: catalog.standardFontDataCache, globalImageCache: catalog.globalImageCache, nonBlendModesSet: catalog.nonBlendModesSet, xfaFactory: null @@ -4590,19 +4739,19 @@ var _default_appearance = __w_pdfjs_require__(13); var _primitives = __w_pdfjs_require__(5); -var _catalog = __w_pdfjs_require__(57); +var _catalog = __w_pdfjs_require__(64); var _colorspace = __w_pdfjs_require__(14); -var _file_spec = __w_pdfjs_require__(59); +var _file_spec = __w_pdfjs_require__(66); -var _object_loader = __w_pdfjs_require__(63); +var _object_loader = __w_pdfjs_require__(70); -var _operator_list = __w_pdfjs_require__(55); +var _operator_list = __w_pdfjs_require__(62); var _stream = __w_pdfjs_require__(10); -var _writer = __w_pdfjs_require__(64); +var _writer = __w_pdfjs_require__(71); class AnnotationFactory { static create(xref, ref, pdfManager, idFactory, collectFields) { @@ -5063,7 +5212,7 @@ class Annotation { const transform = getTransformMatrix(data.rect, bbox, matrix); return resourcesPromise.then(resources => { const opList = new _operator_list.OperatorList(); - opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]); + opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix]); return evaluator.getOperatorList({ stream: appearance, task, @@ -5510,7 +5659,7 @@ class WidgetAnnotation extends Annotation { const matrix = [1, 0, 0, 1, 0, 0]; const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]; const transform = getTransformMatrix(this.data.rect, bbox, matrix); - operatorList.addOp(_util.OPS.beginAnnotation, [this.data.rect, transform, matrix]); + operatorList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, matrix]); const stream = new _stream.StringStream(content); return evaluator.getOperatorList({ stream, @@ -6149,6 +6298,10 @@ class ButtonWidgetAnnotation extends WidgetAnnotation { exportValues.push("Off"); } + if (!exportValues.includes(this.data.fieldValue)) { + this.data.fieldValue = null; + } + if (exportValues.length !== 2) { return; } @@ -8084,21 +8237,23 @@ var _fonts_utils = __w_pdfjs_require__(38); var _encodings = __w_pdfjs_require__(37); -var _unicode = __w_pdfjs_require__(40); - var _standard_fonts = __w_pdfjs_require__(41); -var _pattern = __w_pdfjs_require__(48); +var _unicode = __w_pdfjs_require__(40); + +var _pattern = __w_pdfjs_require__(49); var _to_unicode_map = __w_pdfjs_require__(42); -var _function = __w_pdfjs_require__(49); +var _function = __w_pdfjs_require__(50); var _parser = __w_pdfjs_require__(17); -var _image_utils = __w_pdfjs_require__(51); +var _image_utils = __w_pdfjs_require__(52); + +var _stream = __w_pdfjs_require__(10); -var _bidi = __w_pdfjs_require__(52); +var _bidi = __w_pdfjs_require__(53); var _colorspace = __w_pdfjs_require__(14); @@ -8108,22 +8263,25 @@ var _glyphlist = __w_pdfjs_require__(39); var _core_utils = __w_pdfjs_require__(9); -var _metrics = __w_pdfjs_require__(53); +var _metrics = __w_pdfjs_require__(54); -var _murmurhash = __w_pdfjs_require__(54); +var _xfa_fonts = __w_pdfjs_require__(55); -var _stream = __w_pdfjs_require__(10); +var _murmurhash = __w_pdfjs_require__(61); -var _operator_list = __w_pdfjs_require__(55); +var _operator_list = __w_pdfjs_require__(62); -var _image = __w_pdfjs_require__(56); +var _image = __w_pdfjs_require__(63); const DefaultPartialEvaluatorOptions = Object.freeze({ maxImageSize: -1, disableFontFace: false, ignoreErrors: false, isEvalSupported: true, - fontExtraProperties: false + fontExtraProperties: false, + useSystemFonts: true, + cMapUrl: null, + standardFontDataUrl: null }); const PatternType = { TILING: 1, @@ -8249,6 +8407,7 @@ class PartialEvaluator { idFactory, fontCache, builtInCMapCache, + standardFontDataCache, globalImageCache, options = null }) { @@ -8258,6 +8417,7 @@ class PartialEvaluator { this.idFactory = idFactory; this.fontCache = fontCache; this.builtInCMapCache = builtInCMapCache; + this.standardFontDataCache = standardFontDataCache; this.globalImageCache = globalImageCache; this.options = options || DefaultPartialEvaluatorOptions; this.parsingType3Font = false; @@ -8272,9 +8432,9 @@ class PartialEvaluator { return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory); } - clone(newOptions = DefaultPartialEvaluatorOptions) { + clone(newOptions = null) { const newEvaluator = Object.create(this); - newEvaluator.options = newOptions; + newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions); return newEvaluator; } @@ -8404,27 +8564,25 @@ class PartialEvaluator { return cachedData; } - const readableStream = this.handler.sendWithStream("FetchBuiltInCMap", { - name - }); - const reader = readableStream.getReader(); - const data = await new Promise(function (resolve, reject) { - function pump() { - reader.read().then(function ({ - value, - done - }) { - if (done) { - return; - } + let data; - resolve(value); - pump(); - }, reject); + if (this.options.cMapUrl !== null) { + const url = `${this.options.cMapUrl}${name}.bcmap`; + const response = await fetch(url); + + if (!response.ok) { + throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`); } - pump(); - }); + data = { + cMapData: new Uint8Array(await response.arrayBuffer()), + compressionType: _util.CMapCompressionType.BINARY + }; + } else { + data = await this.handler.sendWithPromise("FetchBuiltInCMap", { + name + }); + } if (data.compressionType !== _util.CMapCompressionType.NONE) { this.builtInCMapCache.set(name, data); @@ -8433,6 +8591,48 @@ class PartialEvaluator { return data; } + async fetchStandardFontData(name) { + const cachedData = this.standardFontDataCache.get(name); + + if (cachedData) { + return new _stream.Stream(cachedData); + } + + if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") { + return null; + } + + const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(), + filename = standardFontNameToFileName[name]; + let data; + + if (this.options.standardFontDataUrl !== null) { + const url = `${this.options.standardFontDataUrl}${filename}`; + const response = await fetch(url); + + if (!response.ok) { + (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`); + } else { + data = await response.arrayBuffer(); + } + } else { + try { + data = await this.handler.sendWithPromise("FetchStandardFontData", { + filename + }); + } catch (e) { + (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`); + } + } + + if (!data) { + return null; + } + + this.standardFontDataCache.set(name, data); + return new _stream.Stream(data); + } + async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) { const dict = xobj.dict; const matrix = dict.getArray("Matrix"); @@ -9159,7 +9359,29 @@ class PartialEvaluator { }); } - handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache) { + parseShading({ + keyObj, + shading, + resources, + localColorSpaceCache, + localShadingPatternCache, + matrix = null + }) { + let id = localShadingPatternCache.get(keyObj); + + if (!id) { + var shadingFill = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache); + + const patternIR = shadingFill.getIR(); + id = `pattern_${this.idFactory.createObjId()}`; + localShadingPatternCache.set(keyObj, id); + this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]); + } + + return id; + } + + handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) { const patternName = args.pop(); if (patternName instanceof _primitives.Name) { @@ -9175,7 +9397,7 @@ class PartialEvaluator { } catch (ex) {} } - let pattern = patterns.get(name); + const pattern = patterns.get(name); if (pattern) { const dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern; @@ -9187,8 +9409,15 @@ class PartialEvaluator { } else if (typeNum === PatternType.SHADING) { const shading = dict.get("Shading"); const matrix = dict.getArray("Matrix"); - pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache); - operatorList.addOp(fn, pattern.getIR()); + const objId = this.parseShading({ + keyObj: pattern, + shading, + matrix, + resources, + localColorSpaceCache, + localShadingPatternCache + }); + operatorList.addOp(fn, ["Shading", objId]); return undefined; } @@ -9329,6 +9558,7 @@ class PartialEvaluator { const localColorSpaceCache = new _image_utils.LocalColorSpaceCache(); const localGStateCache = new _image_utils.LocalGStateCache(); const localTilingPatternCache = new _image_utils.LocalTilingPatternCache(); + const localShadingPatternCache = new Map(); const xobjs = resources.get("XObject") || _primitives.Dict.empty; @@ -9358,7 +9588,7 @@ class PartialEvaluator { task.ensureNotTerminated(); timeSlotManager.reset(); const operation = {}; - let stop, i, ii, cs, name; + let stop, i, ii, cs, name, isValidName; while (!(stop = timeSlotManager.check())) { operation.args = null; @@ -9372,9 +9602,10 @@ class PartialEvaluator { switch (fn | 0) { case _util.OPS.paintXObject: + isValidName = args[0] instanceof _primitives.Name; name = args[0].name; - if (name) { + if (isValidName) { const localImage = localImageCache.getByName(name); if (localImage) { @@ -9385,7 +9616,7 @@ class PartialEvaluator { } next(new Promise(function (resolveXObject, rejectXObject) { - if (!name) { + if (!isValidName) { throw new _util.FormatError("XObject must be referred to by name."); } @@ -9657,7 +9888,7 @@ class PartialEvaluator { cs = stateManager.state.fillColorSpace; if (cs.name === "Pattern") { - next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache)); + next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); return; } @@ -9669,7 +9900,7 @@ class PartialEvaluator { cs = stateManager.state.strokeColorSpace; if (cs.name === "Pattern") { - next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache)); + next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); return; } @@ -9690,17 +9921,22 @@ class PartialEvaluator { throw new _util.FormatError("No shading object found"); } - var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self._pdfFunctionFactory, localColorSpaceCache); - - var patternIR = shadingFill.getIR(); - args = [patternIR]; + const patternId = self.parseShading({ + keyObj: shading, + shading, + resources, + localColorSpaceCache, + localShadingPatternCache + }); + args = [patternId]; fn = _util.OPS.shadingFill; break; case _util.OPS.setGState: + isValidName = args[0] instanceof _primitives.Name; name = args[0].name; - if (name) { + if (isValidName) { const localGStateObj = localGStateCache.getByName(name); if (localGStateObj) { @@ -9714,7 +9950,7 @@ class PartialEvaluator { } next(new Promise(function (resolveGState, rejectGState) { - if (!name) { + if (!isValidName) { throw new _util.FormatError("GState must be referred to by name."); } @@ -9903,7 +10139,7 @@ class PartialEvaluator { const font = textState.font; const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise]; - if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) { + if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) { const glyphHeight = font.bbox[3] - font.bbox[1]; if (glyphHeight > 0) { @@ -10019,6 +10255,14 @@ class PartialEvaluator { function handleSetFont(fontName, fontRef) { return self.loadFont(fontName, fontRef, resources).then(function (translated) { + if (!translated.font.isType3Font) { + return translated; + } + + return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () { + return translated; + }); + }).then(function (translated) { textState.font = translated.font; textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX; }); @@ -10490,14 +10734,15 @@ class PartialEvaluator { xobjs = resources.get("XObject") || _primitives.Dict.empty; } + var isValidName = args[0] instanceof _primitives.Name; var name = args[0].name; - if (name && emptyXObjectCache.getByName(name)) { + if (isValidName && emptyXObjectCache.getByName(name)) { break; } next(new Promise(function (resolveXObject, rejectXObject) { - if (!name) { + if (!isValidName) { throw new _util.FormatError("XObject must be referred to by name."); } @@ -10593,14 +10838,15 @@ class PartialEvaluator { return; case _util.OPS.setGState: + isValidName = args[0] instanceof _primitives.Name; name = args[0].name; - if (name && emptyGStateCache.getByName(name)) { + if (isValidName && emptyGStateCache.getByName(name)) { break; } next(new Promise(function (resolveGState, rejectGState) { - if (!name) { + if (!isValidName) { throw new _util.FormatError("GState must be referred to by name."); } @@ -10786,7 +11032,7 @@ class PartialEvaluator { if (isSymbolicFont) { encoding = _encodings.MacRomanEncoding; - if (!properties.file) { + if (!properties.file || properties.isInternalFont) { if (/Symbol/i.test(properties.name)) { encoding = _encodings.SymbolSetEncoding; } else if (/Dingbats|Wingdings/i.test(properties.name)) { @@ -10816,7 +11062,7 @@ class PartialEvaluator { }); } - _buildSimpleFontToUnicode(properties, forceGlyphs = false) { + _simpleFontToUnicode(properties, forceGlyphs = false) { (0, _util.assert)(!properties.composite, "Must be a simple font."); const toUnicode = []; const encoding = properties.defaultEncoding.slice(); @@ -10871,7 +11117,7 @@ class PartialEvaluator { code = +codeStr; if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) { - return this._buildSimpleFontToUnicode(properties, true); + return this._simpleFontToUnicode(properties, true); } } @@ -10905,53 +11151,53 @@ class PartialEvaluator { toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); } - return new _to_unicode_map.ToUnicodeMap(toUnicode); + return toUnicode; } - buildToUnicode(properties) { + async buildToUnicode(properties) { properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0; if (properties.hasIncludedToUnicodeMap) { if (!properties.composite && properties.hasEncoding) { - properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties); + properties.fallbackToUnicode = this._simpleFontToUnicode(properties); } - return Promise.resolve(properties.toUnicode); + return properties.toUnicode; } if (!properties.composite) { - return Promise.resolve(this._buildSimpleFontToUnicode(properties)); + return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties)); } 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"))) { - const registry = properties.cidSystemInfo.registry; - const ordering = properties.cidSystemInfo.ordering; + const { + registry, + ordering + } = properties.cidSystemInfo; - const ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2"); + const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`); - return _cmap.CMapFactory.create({ + const ucs2CMap = await _cmap.CMapFactory.create({ encoding: ucs2CMapName, fetchBuiltInCMap: this._fetchBuiltInCMapBound, useCMap: null - }).then(function (ucs2CMap) { - const cMap = properties.cMap; - const toUnicode = []; - cMap.forEach(function (charcode, cid) { - if (cid > 0xffff) { - throw new _util.FormatError("Max size of CID is 65,535"); - } + }); + const toUnicode = []; + properties.cMap.forEach(function (charcode, cid) { + if (cid > 0xffff) { + throw new _util.FormatError("Max size of CID is 65,535"); + } - const ucs2 = ucs2CMap.lookup(cid); + const ucs2 = ucs2CMap.lookup(cid); - if (ucs2) { - toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1)); - } - }); - return new _to_unicode_map.ToUnicodeMap(toUnicode); + if (ucs2) { + toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1)); + } }); + return new _to_unicode_map.ToUnicodeMap(toUnicode); } - return Promise.resolve(new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar)); + return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar); } readToUnicode(cmapObj) { @@ -11373,15 +11619,28 @@ class PartialEvaluator { properties = { type, name: baseFontName, + loadedName: baseDict.loadedName, widths: metrics.widths, defaultWidth: metrics.defaultWidth, flags, firstChar, lastChar, toUnicode, + xHeight: 0, + capHeight: 0, + italicAngle: 0, isType3Font }; const widths = dict.get("Widths"); + const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName); + let file = null; + + if (standardFontName) { + properties.isStandardFont = true; + file = await this.fetchStandardFontData(standardFontName); + properties.isInternalFont = !!file; + } + return this.extractDataStructures(dict, dict, properties).then(newProperties => { if (widths) { const glyphWidths = []; @@ -11396,7 +11655,7 @@ class PartialEvaluator { newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties); } - return new _fonts.Font(baseFontName, null, newProperties); + return new _fonts.Font(baseFontName, file, newProperties); }); } } @@ -11444,6 +11703,10 @@ class PartialEvaluator { fontFile = new _stream.NullStream(); } + let isStandardFont = false; + let isInternalFont = false; + let glyphScaleFactors = null; + if (fontFile) { if (fontFile.dict) { const subtypeEntry = fontFile.dict.get("Subtype"); @@ -11456,6 +11719,25 @@ class PartialEvaluator { length2 = fontFile.dict.get("Length2"); length3 = fontFile.dict.get("Length3"); } + } else if (cssFontInfo) { + const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name); + + if (standardFontName) { + cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`; + cssFontInfo.lineHeight = standardFontName.lineHeight || null; + glyphScaleFactors = standardFontName.factors || null; + fontFile = await this.fetchStandardFontData(standardFontName.name); + isInternalFont = !!fontFile; + type = "TrueType"; + } + } else if (!isType3Font) { + const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name); + + if (standardFontName) { + isStandardFont = true; + fontFile = await this.fetchStandardFontData(standardFontName); + isInternalFont = !!fontFile; + } } properties = { @@ -11466,6 +11748,8 @@ class PartialEvaluator { length1, length2, length3, + isStandardFont, + isInternalFont, loadedName: baseDict.loadedName, composite, fixedPitch: false, @@ -11473,15 +11757,16 @@ class PartialEvaluator { firstChar, lastChar, toUnicode, - bbox: descriptor.getArray("FontBBox"), + bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"), ascent: descriptor.get("Ascent"), descent: descriptor.get("Descent"), - xHeight: descriptor.get("XHeight"), - capHeight: descriptor.get("CapHeight"), + xHeight: descriptor.get("XHeight") || 0, + capHeight: descriptor.get("CapHeight") || 0, flags: descriptor.get("Flags"), - italicAngle: descriptor.get("ItalicAngle"), + italicAngle: descriptor.get("ItalicAngle") || 0, isType3Font, - cssFontInfo + cssFontInfo, + scaleFactors: glyphScaleFactors }; if (composite) { @@ -11595,9 +11880,9 @@ class TranslatedFont { throw new Error("Must be a Type3 font."); } - const type3Options = Object.create(evaluator.options); - type3Options.ignoreErrors = false; - const type3Evaluator = evaluator.clone(type3Options); + const type3Evaluator = evaluator.clone({ + ignoreErrors: false + }); type3Evaluator.parsingType3Font = true; const translatedFont = this.font, type3Dependencies = this.type3Dependencies; @@ -11605,6 +11890,7 @@ class TranslatedFont { const charProcs = this.dict.get("CharProcs"); const fontResources = this.dict.get("Resources") || resources; const charProcOperatorList = Object.create(null); + const isEmptyBBox = !translatedFont.bbox || (0, _util.isArrayEqual)(translatedFont.bbox, [0, 0, 0, 0]); for (const key of charProcs.getKeys()) { loadCharProcsPromise = loadCharProcsPromise.then(() => { @@ -11617,7 +11903,7 @@ class TranslatedFont { operatorList }).then(() => { if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) { - this._removeType3ColorOperators(operatorList); + this._removeType3ColorOperators(operatorList, isEmptyBBox); } charProcOperatorList[key] = operatorList.getIR(); @@ -11633,13 +11919,31 @@ class TranslatedFont { }); } - this.type3Loaded = loadCharProcsPromise.then(function () { + this.type3Loaded = loadCharProcsPromise.then(() => { translatedFont.charProcOperatorList = charProcOperatorList; + + if (this._bbox) { + translatedFont.isCharBBox = true; + translatedFont.bbox = this._bbox; + } }); return this.type3Loaded; } - _removeType3ColorOperators(operatorList) { + _removeType3ColorOperators(operatorList, isEmptyBBox = false) { + if (isEmptyBBox) { + if (!this._bbox) { + this._bbox = [Infinity, Infinity, -Infinity, -Infinity]; + } + + const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)); + + this._bbox[0] = Math.min(this._bbox[0], charBBox[0]); + this._bbox[1] = Math.min(this._bbox[1], charBBox[1]); + this._bbox[2] = Math.max(this._bbox[2], charBBox[2]); + this._bbox[3] = Math.max(this._bbox[3], charBBox[3]); + } + let i = 1, ii = operatorList.length; @@ -12672,7 +12976,7 @@ const BinaryCMapReader = function BinaryCMapReaderClosure() { while (i >= 0) { while (bufferSize < 8 && stack.length > 0) { - buffer = stack[--sp] << bufferSize | buffer; + buffer |= stack[--sp] << bufferSize; bufferSize += 7; } @@ -13333,11 +13637,11 @@ class Parser { } if ((0, _primitives.isEOF)(this.buf1)) { - if (!this.recoveryMode) { - throw new _util.FormatError("End of file inside array"); + if (this.recoveryMode) { + return array; } - return array; + throw new _core_utils.ParserEOFException("End of file inside array."); } this.shift(); @@ -13364,11 +13668,11 @@ class Parser { } if ((0, _primitives.isEOF)(this.buf1)) { - if (!this.recoveryMode) { - throw new _util.FormatError("End of file inside dictionary"); + if (this.recoveryMode) { + return dict; } - return dict; + throw new _core_utils.ParserEOFException("End of file inside dictionary."); } if ((0, _primitives.isCmd)(this.buf2, "stream")) { @@ -14272,6 +14576,8 @@ class Lexer { if (strBuf.length > 127) { (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`); + } else if (strBuf.length === 0) { + (0, _util.warn)("Name token is empty."); } return _primitives.Name.get(strBuf.join("")); @@ -14591,7 +14897,7 @@ var _core_utils = __w_pdfjs_require__(9); class Ascii85Stream extends _decode_stream.DecodeStream { constructor(str, maybeLength) { if (maybeLength) { - maybeLength = 0.8 * maybeLength; + maybeLength *= 0.8; } super(maybeLength); @@ -14868,7 +15174,7 @@ var _decode_stream = __w_pdfjs_require__(19); class AsciiHexStream extends _decode_stream.DecodeStream { constructor(str, maybeLength) { if (maybeLength) { - maybeLength = 0.5 * maybeLength; + maybeLength *= 0.5; } super(maybeLength); @@ -17013,7 +17319,7 @@ function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight patternIndex = 0; for (j = bitsPerValue - 1; j >= 0; j--) { - bit = grayScaleBitPlanes[j][mg][ng] ^ bit; + bit ^= grayScaleBitPlanes[j][mg][ng]; patternIndex |= bit << j; } @@ -22289,7 +22595,7 @@ class Transform { class IrreversibleTransform extends Transform { filter(x, offset, length) { const len = length >> 1; - offset = offset | 0; + offset |= 0; let j, n, current, next; const alpha = -1.586134342059924; const beta = -0.052980118572961; @@ -22375,7 +22681,7 @@ class IrreversibleTransform extends Transform { class ReversibleTransform extends Transform { filter(x, offset, length) { const len = length >> 1; - offset = offset | 0; + offset |= 0; let j, n; for (j = offset, n = len + 1; n--; j += 2) { @@ -22880,15 +23186,17 @@ var _cff_font = __w_pdfjs_require__(43); var _font_renderer = __w_pdfjs_require__(44); +var _glyf = __w_pdfjs_require__(45); + var _cmap = __w_pdfjs_require__(16); -var _opentype_file_builder = __w_pdfjs_require__(45); +var _opentype_file_builder = __w_pdfjs_require__(46); var _core_utils = __w_pdfjs_require__(9); var _stream = __w_pdfjs_require__(10); -var _type1_font = __w_pdfjs_require__(46); +var _type1_font = __w_pdfjs_require__(47); const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]]; const PDF_GLYPH_SPACE_UNITS = 1000; @@ -22915,7 +23223,7 @@ function adjustWidths(properties) { } function adjustToUnicode(properties, builtInEncoding) { - if (properties.hasIncludedToUnicodeMap) { + if (properties.isInternalFont) { return; } @@ -22931,8 +23239,14 @@ function adjustToUnicode(properties, builtInEncoding) { glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); for (const charCode in builtInEncoding) { - if (properties.hasEncoding && properties.differences[charCode] !== undefined) { - continue; + if (properties.hasIncludedToUnicodeMap) { + if (properties.toUnicode.has(charCode)) { + continue; + } + } else { + if (properties.hasEncoding && properties.differences[charCode] !== undefined) { + continue; + } } const glyphName = builtInEncoding[charCode]; @@ -22943,11 +23257,38 @@ function adjustToUnicode(properties, builtInEncoding) { } } - properties.toUnicode.amend(toUnicode); + if (toUnicode.length > 0) { + properties.toUnicode.amend(toUnicode); + } +} + +function amendFallbackToUnicode(properties) { + if (!properties.fallbackToUnicode) { + return; + } + + if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) { + return; + } + + const toUnicode = []; + + for (const charCode in properties.fallbackToUnicode) { + if (properties.toUnicode.has(charCode)) { + continue; + } + + toUnicode[charCode] = properties.fallbackToUnicode[charCode]; + } + + if (toUnicode.length > 0) { + properties.toUnicode.amend(toUnicode); + } } class Glyph { - constructor(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { + constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { + this.originalCharCode = originalCharCode; this.fontChar = fontChar; this.unicode = unicode; this.accent = accent; @@ -22958,8 +23299,8 @@ class Glyph { this.isInFont = isInFont; } - matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { - return this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont; + matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { + return this.originalCharCode === originalCharCode && this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont; } } @@ -23390,7 +23731,7 @@ function createOS2Table(properties, charstrings, override) { function createPostTable(properties) { const angle = Math.floor(properties.italicAngle * 2 ** 16); - return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00"; + 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"; } function createPostscriptName(name) { @@ -23443,6 +23784,7 @@ function createNameTable(name, proto) { class Font { constructor(name, file, properties) { this.name = name; + this.psName = null; this.mimetype = null; this.disableFontFace = false; this.loadedName = properties.loadedName; @@ -23475,11 +23817,11 @@ class Font { this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS; this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; + this.lineHeight = this.ascent - this.descent; this.fontMatrix = properties.fontMatrix; this.bbox = properties.bbox; this.defaultEncoding = properties.defaultEncoding; this.toUnicode = properties.toUnicode; - this.fallbackToUnicode = properties.fallbackToUnicode || new _to_unicode_map.ToUnicodeMap(); this.toFontChar = []; if (properties.type === "Type3") { @@ -23551,8 +23893,9 @@ class Font { return; } + amendFallbackToUnicode(properties); this.data = data; - this.fontType = (0, _fonts_utils.getFontType)(type, subtype); + this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont); this.fontMatrix = properties.fontMatrix; this.widths = properties.widths; this.defaultWidth = properties.defaultWidth; @@ -23587,7 +23930,7 @@ class Font { const name = this.name; const type = this.type; const subtype = this.subtype; - let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, ""); + let fontName = (0, _fonts_utils.normalizeFontName)(name); const stdFontMap = (0, _standard_fonts.getStdFontMap)(), nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)(); const isStandardFont = !!stdFontMap[fontName]; @@ -23681,8 +24024,9 @@ class Font { this.toFontChar = map; } + amendFallbackToUnicode(properties); this.loadedName = fontName.split("-")[0]; - this.fontType = (0, _fonts_utils.getFontType)(type, subtype); + this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont); } checkAndRepair(name, font, properties) { @@ -23888,7 +24232,20 @@ class Font { } } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { useTable = true; - canBreak = true; + let correctlySorted = true; + + if (i < numTables - 1) { + const nextBytes = file.peekBytes(2), + nextPlatformId = int16(nextBytes[0], nextBytes[1]); + + if (nextPlatformId < platformId) { + correctlySorted = false; + } + } + + if (correctlySorted) { + canBreak = true; + } } if (useTable) { @@ -24045,7 +24402,7 @@ class Font { }; } - function sanitizeMetrics(file, header, metrics, numGlyphs, dupFirstEntry) { + function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) { if (!header) { if (metrics) { metrics.data = null; @@ -24065,13 +24422,22 @@ class Font { file.pos += 2; file.pos += 2; file.pos += 2; - file.pos += 2; + const caretOffset = file.getUint16(); file.pos += 8; file.pos += 2; let numOfMetrics = file.getUint16(); + if (caretOffset !== 0) { + const macStyle = int16(headTable.data[44], headTable.data[45]); + + if (!(macStyle & 2)) { + header.data[22] = 0; + header.data[23] = 0; + } + } + if (numOfMetrics > numGlyphs) { - (0, _util.info)("The numOfMetrics (" + numOfMetrics + ") should not be " + "greater than the numGlyphs (" + numGlyphs + ")"); + (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`); numOfMetrics = numGlyphs; header.data[34] = (numOfMetrics & 0xff00) >> 8; header.data[35] = numOfMetrics & 0x00ff; @@ -24841,6 +25207,44 @@ class Font { font.pos = (font.start || 0) + tables.maxp.offset; const version = font.getInt32(); const numGlyphs = font.getUint16(); + + if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) { + const { + scaleFactors + } = properties; + const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); + const glyphs = new _glyf.GlyfTable({ + glyfTable: tables.glyf.data, + isGlyphLocationsLong, + locaTable: tables.loca.data, + numGlyphs + }); + glyphs.scale(scaleFactors); + const { + glyf, + loca, + isLocationLong + } = glyphs.write(); + tables.glyf.data = glyf; + tables.loca.data = loca; + + if (isLocationLong !== !!isGlyphLocationsLong) { + tables.head.data[50] = 0; + tables.head.data[51] = isLocationLong ? 1 : 0; + } + + const metrics = tables.hmtx.data; + + for (let i = 0; i < numGlyphs; i++) { + const j = 4 * i; + const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1])); + metrics[j] = advanceWidth >> 8 & 0xff; + metrics[j + 1] = advanceWidth & 0xff; + const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3])); + writeSignedInt16(metrics, j + 2, lsb); + } + } + let numGlyphsOut = numGlyphs + 1; let dupFirstEntry = true; @@ -24878,7 +25282,7 @@ class Font { delete tables["cvt "]; } - sanitizeMetrics(font, tables.hhea, tables.hmtx, numGlyphsOut, dupFirstEntry); + sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry); if (!tables.head) { throw new _util.FormatError('Required "head" table is not found'); @@ -24911,11 +25315,19 @@ class Font { unitsPerEm: int16(tables.head.data[18], tables.head.data[19]), yMax: int16(tables.head.data[42], tables.head.data[43]), yMin: signedInt16(tables.head.data[38], tables.head.data[39]), - ascent: int16(tables.hhea.data[4], tables.hhea.data[5]), - descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]) + ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]), + descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]), + lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9]) }; this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm; this.descent = metricsOverride.descent / metricsOverride.unitsPerEm; + this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm; + + if (this.cssFontInfo && this.cssFontInfo.lineHeight) { + this.lineHeight = this.cssFontInfo.lineHeight; + } else { + this.lineHeight = this.ascent - this.descent + this.lineGap; + } if (tables.post) { readPostScriptTable(tables.post, properties, numGlyphs); @@ -24969,9 +25381,9 @@ class Font { for (let charCode = 0; charCode < 256; charCode++) { let glyphName; - if (this.differences && charCode in this.differences) { + if (this.differences[charCode] !== undefined) { glyphName = this.differences[charCode]; - } else if (charCode in baseEncoding && baseEncoding[charCode] !== "") { + } else if (baseEncoding[charCode] !== "") { glyphName = baseEncoding[charCode]; } else { glyphName = _encodings.StandardEncoding[charCode]; @@ -25083,6 +25495,7 @@ class Font { } else { const namePrototype = readNameTable(tables.name); tables.name.data = createNameTable(name, namePrototype); + this.psName = namePrototype[0][6] || null; } const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version); @@ -25274,13 +25687,13 @@ class Font { width = this.widths[widthCode]; width = (0, _util.isNum)(width) ? width : this.defaultWidth; const vmetric = this.vmetrics && this.vmetrics[widthCode]; - let unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode; + let unicode = this.toUnicode.get(charcode) || charcode; if (typeof unicode === "number") { unicode = String.fromCharCode(unicode); } - let isInFont = (charcode in this.toFontChar); + let isInFont = this.toFontChar[charcode] !== undefined; fontCharCode = this.toFontChar[charcode] || charcode; if (this.missingFile) { @@ -25321,8 +25734,8 @@ class Font { let glyph = this._glyphCache[charcode]; - if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) { - glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); + if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) { + glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); this._glyphCache[charcode] = glyph; } @@ -26061,6 +26474,9 @@ const CFFParser = function CFFParserClosure() { } else if (value === 11) { state.stackSize = stackSize; return true; + } else if (value === 0 && j === data.length) { + data[j - 1] = 14; + validationCommand = CharstringValidationData[14]; } else { validationCommand = CharstringValidationData[value]; } @@ -26080,6 +26496,12 @@ const CFFParser = function CFFParserClosure() { if ("min" in validationCommand) { if (!state.undefStack && stackSize < validationCommand.min) { (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min); + + if (stackSize === 0) { + data[j - 1] = 14; + return true; + } + return false; } } @@ -26379,7 +26801,7 @@ const CFFParser = function CFFParserClosure() { raw = bytes.subarray(dataStart, dataEnd); } - format = format & 0x7f; + format &= 0x7f; return new CFFEncoding(predefined, format, encoding, raw); } @@ -26942,7 +27364,7 @@ class CFFCompiler { if (value >= -107 && value <= 107) { code = [value + 139]; } else if (value >= 108 && value <= 1131) { - value = value - 108; + value -= 108; code = [(value >> 8) + 247, value & 0xff]; } else if (value >= -1131 && value <= -108) { value = -value - 108; @@ -27384,6 +27806,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getFontType = getFontType; +exports.normalizeFontName = normalizeFontName; exports.recoverGlyphName = recoverGlyphName; exports.type1FontGlyphMapping = type1FontGlyphMapping; exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0; @@ -27413,9 +27836,13 @@ exports.FontFlags = FontFlags; const MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"]; exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering; -function getFontType(type, subtype) { +function getFontType(type, subtype, isStandardFont = false) { switch (type) { case "Type1": + if (isStandardFont) { + return _util.FontType.TYPE1STANDARD; + } + return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1; case "CIDFontType0": @@ -27465,7 +27892,19 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { let glyphId, charCode, baseEncoding; const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); - if (properties.baseEncodingName) { + if (properties.isInternalFont) { + baseEncoding = builtInEncoding; + + for (charCode = 0; charCode < baseEncoding.length; charCode++) { + glyphId = glyphNames.indexOf(baseEncoding[charCode]); + + if (glyphId >= 0) { + charCodeToGlyphId[charCode] = glyphId; + } else { + charCodeToGlyphId[charCode] = 0; + } + } + } else if (properties.baseEncodingName) { baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); for (charCode = 0; charCode < baseEncoding.length; charCode++) { @@ -27526,6 +27965,10 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { return charCodeToGlyphId; } +function normalizeFontName(name) { + return name.replace(/[,_]/g, "-").replace(/\s/g, ""); +} + /***/ }), /* 39 */ /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => { @@ -39968,11 +40411,28 @@ function reverseIfRtl(chars) { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = void 0; +exports.getStandardFontName = getStandardFontName; +exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0; var _core_utils = __w_pdfjs_require__(9); +var _fonts_utils = __w_pdfjs_require__(38); + const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { + t["Times-Roman"] = "Times-Roman"; + t.Helvetica = "Helvetica"; + t.Courier = "Courier"; + t.Symbol = "Symbol"; + t["Times-Bold"] = "Times-Bold"; + t["Helvetica-Bold"] = "Helvetica-Bold"; + t["Courier-Bold"] = "Courier-Bold"; + t.ZapfDingbats = "ZapfDingbats"; + t["Times-Italic"] = "Times-Italic"; + t["Helvetica-Oblique"] = "Helvetica-Oblique"; + t["Courier-Oblique"] = "Courier-Oblique"; + t["Times-BoldItalic"] = "Times-BoldItalic"; + t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique"; + t["Courier-BoldOblique"] = "Courier-BoldOblique"; t.ArialNarrow = "Helvetica"; t["ArialNarrow-Bold"] = "Helvetica-Bold"; t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique"; @@ -39993,7 +40453,6 @@ const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { t["Arial-BoldMT"] = "Helvetica-Bold"; t["Arial-ItalicMT"] = "Helvetica-Oblique"; t.ArialMT = "Helvetica"; - t["Courier-Bold"] = "Courier-Bold"; t["Courier-BoldItalic"] = "Courier-BoldOblique"; t["Courier-Italic"] = "Courier-Oblique"; t.CourierNew = "Courier"; @@ -40004,12 +40463,8 @@ const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { t["CourierNewPS-BoldMT"] = "Courier-Bold"; t["CourierNewPS-ItalicMT"] = "Courier-Oblique"; t.CourierNewPSMT = "Courier"; - t.Helvetica = "Helvetica"; - t["Helvetica-Bold"] = "Helvetica-Bold"; t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique"; - t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique"; t["Helvetica-Italic"] = "Helvetica-Oblique"; - t["Helvetica-Oblique"] = "Helvetica-Oblique"; t["Symbol-Bold"] = "Symbol"; t["Symbol-BoldItalic"] = "Symbol"; t["Symbol-Italic"] = "Symbol"; @@ -40030,6 +40485,27 @@ const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { t["TimesNewRomanPSMT-Italic"] = "Times-Italic"; }); exports.getStdFontMap = getStdFontMap; +const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) { + t.Courier = "FoxitFixed.pfb"; + t["Courier-Bold"] = "FoxitFixedBold.pfb"; + t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb"; + t["Courier-Oblique"] = "FoxitFixedItalic.pfb"; + t.Helvetica = "FoxitSans.pfb"; + t["Helvetica-Bold"] = "FoxitSansBold.pfb"; + t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb"; + t["Helvetica-Oblique"] = "FoxitSansItalic.pfb"; + t["Times-Roman"] = "FoxitSerif.pfb"; + t["Times-Bold"] = "FoxitSerifBold.pfb"; + t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb"; + t["Times-Italic"] = "FoxitSerifItalic.pfb"; + t.Symbol = "FoxitSymbol.pfb"; + t.ZapfDingbats = "FoxitDingbats.pfb"; + t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf"; + t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf"; + t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf"; + t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf"; +}); +exports.getFontNameToFileMap = getFontNameToFileMap; const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { t.Calibri = "Helvetica"; t["Calibri-Bold"] = "Helvetica-Bold"; @@ -40702,6 +41178,12 @@ const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory) }); exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri; +function getStandardFontName(name) { + const fontName = (0, _fonts_utils.normalizeFontName)(name); + const stdFontMap = getStdFontMap(); + return stdFontMap[fontName]; +} + /***/ }), /* 42 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -40875,7 +41357,12 @@ class CFFFont { return charCodeToGlyphId; } - const encoding = cff.encoding ? cff.encoding.encoding : null; + let encoding = cff.encoding ? cff.encoding.encoding : null; + + if (properties.isInternalFont) { + encoding = properties.defaultEncoding; + } + charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets); return charCodeToGlyphId; } @@ -41896,6 +42383,662 @@ exports.FontRendererFactory = FontRendererFactory; /***/ }), /* 45 */ +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.GlyfTable = void 0; +const ON_CURVE_POINT = 1 << 0; +const X_SHORT_VECTOR = 1 << 1; +const Y_SHORT_VECTOR = 1 << 2; +const REPEAT_FLAG = 1 << 3; +const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4; +const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5; +const OVERLAP_SIMPLE = 1 << 6; +const ARG_1_AND_2_ARE_WORDS = 1 << 0; +const ARGS_ARE_XY_VALUES = 1 << 1; +const WE_HAVE_A_SCALE = 1 << 3; +const MORE_COMPONENTS = 1 << 5; +const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6; +const WE_HAVE_A_TWO_BY_TWO = 1 << 7; +const WE_HAVE_INSTRUCTIONS = 1 << 8; + +class GlyfTable { + constructor({ + glyfTable, + isGlyphLocationsLong, + locaTable, + numGlyphs + }) { + this.glyphs = []; + const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength); + const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength); + const offsetSize = isGlyphLocationsLong ? 4 : 2; + let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0); + let pos = 0; + + for (let i = 0; i < numGlyphs; i++) { + pos += offsetSize; + const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos); + + if (next === prev) { + this.glyphs.push(new Glyph({})); + continue; + } + + const glyph = Glyph.parse(prev, glyf); + this.glyphs.push(glyph); + prev = next; + } + } + + getSize() { + return this.glyphs.reduce((a, g) => { + const size = g.getSize(); + return a + (size + 3 & ~3); + }, 0); + } + + write() { + const totalSize = this.getSize(); + const glyfTable = new DataView(new ArrayBuffer(totalSize)); + const isLocationLong = totalSize > 0x1fffe; + const offsetSize = isLocationLong ? 4 : 2; + const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize)); + + if (isLocationLong) { + locaTable.setUint32(0, 0); + } else { + locaTable.setUint16(0, 0); + } + + let pos = 0; + let locaIndex = 0; + + for (const glyph of this.glyphs) { + pos += glyph.write(pos, glyfTable); + pos = pos + 3 & ~3; + locaIndex += offsetSize; + + if (isLocationLong) { + locaTable.setUint32(locaIndex, pos); + } else { + locaTable.setUint16(locaIndex, pos >> 1); + } + } + + return { + isLocationLong, + loca: new Uint8Array(locaTable.buffer), + glyf: new Uint8Array(glyfTable.buffer) + }; + } + + scale(factors) { + for (let i = 0, ii = this.glyphs.length; i < ii; i++) { + this.glyphs[i].scale(factors[i]); + } + } + +} + +exports.GlyfTable = GlyfTable; + +class Glyph { + constructor({ + header = null, + simple = null, + composites = null + }) { + this.header = header; + this.simple = simple; + this.composites = composites; + } + + static parse(pos, glyf) { + const [read, header] = GlyphHeader.parse(pos, glyf); + pos += read; + + if (header.numberOfContours < 0) { + const composites = []; + + while (true) { + const [n, composite] = CompositeGlyph.parse(pos, glyf); + pos += n; + composites.push(composite); + + if (!(composite.flags & MORE_COMPONENTS)) { + break; + } + } + + return new Glyph({ + header, + composites + }); + } + + const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours); + return new Glyph({ + header, + simple + }); + } + + getSize() { + if (!this.header) { + return 0; + } + + const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0); + return this.header.getSize() + size; + } + + write(pos, buf) { + if (!this.header) { + return 0; + } + + const spos = pos; + pos += this.header.write(pos, buf); + + if (this.simple) { + pos += this.simple.write(pos, buf); + } else { + for (const composite of this.composites) { + pos += composite.write(pos, buf); + } + } + + return pos - spos; + } + + scale(factor) { + if (!this.header) { + return; + } + + const xMiddle = (this.header.xMin + this.header.xMax) / 2; + this.header.scale(xMiddle, factor); + + if (this.simple) { + this.simple.scale(xMiddle, factor); + } else { + for (const composite of this.composites) { + composite.scale(xMiddle, factor); + } + } + } + +} + +class GlyphHeader { + constructor({ + numberOfContours, + xMin, + yMin, + xMax, + yMax + }) { + this.numberOfContours = numberOfContours; + this.xMin = xMin; + this.yMin = yMin; + this.xMax = xMax; + this.yMax = yMax; + } + + static parse(pos, glyf) { + return [10, new GlyphHeader({ + numberOfContours: glyf.getInt16(pos), + xMin: glyf.getInt16(pos + 2), + yMin: glyf.getInt16(pos + 4), + xMax: glyf.getInt16(pos + 6), + yMax: glyf.getInt16(pos + 8) + })]; + } + + getSize() { + return 10; + } + + write(pos, buf) { + buf.setInt16(pos, this.numberOfContours); + buf.setInt16(pos + 2, this.xMin); + buf.setInt16(pos + 4, this.yMin); + buf.setInt16(pos + 6, this.xMax); + buf.setInt16(pos + 8, this.yMax); + return 10; + } + + scale(x, factor) { + this.xMin = Math.round(x + (this.xMin - x) * factor); + this.xMax = Math.round(x + (this.xMax - x) * factor); + } + +} + +class Contour { + constructor({ + flags, + xCoordinates, + yCoordinates + }) { + this.xCoordinates = xCoordinates; + this.yCoordinates = yCoordinates; + this.flags = flags; + } + +} + +class SimpleGlyph { + constructor({ + contours, + instructions + }) { + this.contours = contours; + this.instructions = instructions; + } + + static parse(pos, glyf, numberOfContours) { + const endPtsOfContours = []; + + for (let i = 0; i < numberOfContours; i++) { + const endPt = glyf.getUint16(pos); + pos += 2; + endPtsOfContours.push(endPt); + } + + const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1; + const instructionLength = glyf.getUint16(pos); + pos += 2; + const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); + pos += instructionLength; + const flags = []; + + for (let i = 0; i < numberOfPt; pos++, i++) { + let flag = glyf.getUint8(pos); + flags.push(flag); + + if (flag & REPEAT_FLAG) { + const count = glyf.getUint8(++pos); + flag ^= REPEAT_FLAG; + + for (let m = 0; m < count; m++) { + flags.push(flag); + } + + i += count; + } + } + + const allXCoordinates = []; + let xCoordinates = []; + let yCoordinates = []; + let pointFlags = []; + const contours = []; + let endPtsOfContoursIndex = 0; + let lastCoordinate = 0; + + for (let i = 0; i < numberOfPt; i++) { + const flag = flags[i]; + + if (flag & X_SHORT_VECTOR) { + const x = glyf.getUint8(pos++); + lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x; + xCoordinates.push(lastCoordinate); + } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) { + xCoordinates.push(lastCoordinate); + } else { + lastCoordinate += glyf.getInt16(pos); + pos += 2; + xCoordinates.push(lastCoordinate); + } + + if (endPtsOfContours[endPtsOfContoursIndex] === i) { + endPtsOfContoursIndex++; + allXCoordinates.push(xCoordinates); + xCoordinates = []; + } + } + + lastCoordinate = 0; + endPtsOfContoursIndex = 0; + + for (let i = 0; i < numberOfPt; i++) { + const flag = flags[i]; + + if (flag & Y_SHORT_VECTOR) { + const y = glyf.getUint8(pos++); + lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y; + yCoordinates.push(lastCoordinate); + } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) { + yCoordinates.push(lastCoordinate); + } else { + lastCoordinate += glyf.getInt16(pos); + pos += 2; + yCoordinates.push(lastCoordinate); + } + + pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE); + + if (endPtsOfContours[endPtsOfContoursIndex] === i) { + xCoordinates = allXCoordinates[endPtsOfContoursIndex]; + endPtsOfContoursIndex++; + contours.push(new Contour({ + flags: pointFlags, + xCoordinates, + yCoordinates + })); + yCoordinates = []; + pointFlags = []; + } + } + + return new SimpleGlyph({ + contours, + instructions + }); + } + + getSize() { + let size = this.contours.length * 2 + 2 + this.instructions.length; + let lastX = 0; + let lastY = 0; + + for (const contour of this.contours) { + size += contour.flags.length; + + for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { + const x = contour.xCoordinates[i]; + const y = contour.yCoordinates[i]; + let abs = Math.abs(x - lastX); + + if (abs > 255) { + size += 2; + } else if (abs > 0) { + size += 1; + } + + lastX = x; + abs = Math.abs(y - lastY); + + if (abs > 255) { + size += 2; + } else if (abs > 0) { + size += 1; + } + + lastY = y; + } + } + + return size; + } + + write(pos, buf) { + const spos = pos; + const xCoordinates = []; + const yCoordinates = []; + const flags = []; + let lastX = 0; + let lastY = 0; + + for (const contour of this.contours) { + for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { + let flag = contour.flags[i]; + const x = contour.xCoordinates[i]; + let delta = x - lastX; + + if (delta === 0) { + flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR; + xCoordinates.push(0); + } else { + const abs = Math.abs(delta); + + if (abs <= 255) { + flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR; + xCoordinates.push(abs); + } else { + xCoordinates.push(delta); + } + } + + lastX = x; + const y = contour.yCoordinates[i]; + delta = y - lastY; + + if (delta === 0) { + flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR; + yCoordinates.push(0); + } else { + const abs = Math.abs(delta); + + if (abs <= 255) { + flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR; + yCoordinates.push(abs); + } else { + yCoordinates.push(delta); + } + } + + lastY = y; + flags.push(flag); + } + + buf.setUint16(pos, xCoordinates.length - 1); + pos += 2; + } + + buf.setUint16(pos, this.instructions.length); + pos += 2; + + if (this.instructions.length) { + new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); + pos += this.instructions.length; + } + + for (const flag of flags) { + buf.setUint8(pos++, flag); + } + + for (let i = 0, ii = xCoordinates.length; i < ii; i++) { + const x = xCoordinates[i]; + const flag = flags[i]; + + if (flag & X_SHORT_VECTOR) { + buf.setUint8(pos++, x); + } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) { + buf.setInt16(pos, x); + pos += 2; + } + } + + for (let i = 0, ii = yCoordinates.length; i < ii; i++) { + const y = yCoordinates[i]; + const flag = flags[i]; + + if (flag & Y_SHORT_VECTOR) { + buf.setUint8(pos++, y); + } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) { + buf.setInt16(pos, y); + pos += 2; + } + } + + return pos - spos; + } + + scale(x, factor) { + for (const contour of this.contours) { + if (contour.xCoordinates.length === 0) { + continue; + } + + for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { + contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor); + } + } + } + +} + +class CompositeGlyph { + constructor({ + flags, + glyphIndex, + argument1, + argument2, + transf, + instructions + }) { + this.flags = flags; + this.glyphIndex = glyphIndex; + this.argument1 = argument1; + this.argument2 = argument2; + this.transf = transf; + this.instructions = instructions; + } + + static parse(pos, glyf) { + const spos = pos; + const transf = []; + let flags = glyf.getUint16(pos); + const glyphIndex = glyf.getUint16(pos + 2); + pos += 4; + let argument1, argument2; + + if (flags & ARG_1_AND_2_ARE_WORDS) { + if (flags & ARGS_ARE_XY_VALUES) { + argument1 = glyf.getInt16(pos); + argument2 = glyf.getInt16(pos + 2); + } else { + argument1 = glyf.getUint16(pos); + argument2 = glyf.getUint16(pos + 2); + } + + pos += 4; + flags ^= ARG_1_AND_2_ARE_WORDS; + } else { + argument1 = glyf.getUint8(pos); + argument2 = glyf.getUint8(pos + 1); + + if (flags & ARGS_ARE_XY_VALUES) { + const abs1 = argument1 & 0x7f; + argument1 = argument1 & 0x80 ? -abs1 : abs1; + const abs2 = argument2 & 0x7f; + argument2 = argument2 & 0x80 ? -abs2 : abs2; + } + + pos += 2; + } + + if (flags & WE_HAVE_A_SCALE) { + transf.push(glyf.getUint16(pos)); + pos += 2; + } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { + transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2)); + pos += 4; + } else if (flags & WE_HAVE_A_TWO_BY_TWO) { + transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6)); + pos += 8; + } + + let instructions = null; + + if (flags & WE_HAVE_INSTRUCTIONS) { + const instructionLength = glyf.getUint16(pos); + pos += 2; + instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); + pos += instructionLength; + } + + return [pos - spos, new CompositeGlyph({ + flags, + glyphIndex, + argument1, + argument2, + transf, + instructions + })]; + } + + getSize() { + let size = 2 + 2 + this.transf.length * 2; + + if (this.flags & WE_HAVE_INSTRUCTIONS) { + size += 2 + this.instructions.length; + } + + size += 2; + + if (this.flags & 2) { + if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { + size += 2; + } + } else { + if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { + size += 2; + } + } + + return size; + } + + write(pos, buf) { + const spos = pos; + + if (this.flags & ARGS_ARE_XY_VALUES) { + if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { + this.flags |= ARG_1_AND_2_ARE_WORDS; + } + } else { + if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { + this.flags |= ARG_1_AND_2_ARE_WORDS; + } + } + + buf.setUint16(pos, this.flags); + buf.setUint16(pos + 2, this.glyphIndex); + pos += 4; + + if (this.flags & ARG_1_AND_2_ARE_WORDS) { + if (this.flags & ARGS_ARE_XY_VALUES) { + buf.setInt16(pos, this.argument1); + buf.setInt16(pos + 2, this.argument2); + } else { + buf.setUint16(pos, this.argument1); + buf.setUint16(pos + 2, this.argument2); + } + + pos += 4; + } else { + buf.setUint8(pos, this.argument1); + buf.setUint8(pos + 1, this.argument2); + pos += 2; + } + + if (this.flags & WE_HAVE_INSTRUCTIONS) { + buf.setUint16(pos, this.instructions.length); + pos += 2; + + if (this.instructions.length) { + new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); + pos += this.instructions.length; + } + } + + return pos - spos; + } + + scale(x, factor) {} + +} + +/***/ }), +/* 46 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -42035,7 +43178,7 @@ class OpenTypeFileBuilder { exports.OpenTypeFileBuilder = OpenTypeFileBuilder; /***/ }), -/* 46 */ +/* 47 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -42053,7 +43196,7 @@ var _core_utils = __w_pdfjs_require__(9); var _stream = __w_pdfjs_require__(10); -var _type1_parser = __w_pdfjs_require__(47); +var _type1_parser = __w_pdfjs_require__(48); var _util = __w_pdfjs_require__(2); @@ -42400,7 +43543,7 @@ class Type1Font { exports.Type1Font = Type1Font; /***/ }), -/* 47 */ +/* 48 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -42677,7 +43820,7 @@ const Type1CharString = function Type1CharStringClosure() { continue; } else if (value <= 246) { - value = value - 139; + value -= 139; } else if (value <= 250) { value = (value - 247) * 256 + encoded[++i] + 108; } else if (value <= 254) { @@ -43123,7 +44266,7 @@ const Type1Parser = function Type1ParserClosure() { exports.Type1Parser = Type1Parser; /***/ }), -/* 48 */ +/* 49 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -44068,7 +45211,7 @@ function getTilingPatternIR(operatorList, dict, color) { } /***/ }), -/* 49 */ +/* 50 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -44083,9 +45226,9 @@ var _primitives = __w_pdfjs_require__(5); var _util = __w_pdfjs_require__(2); -var _ps_parser = __w_pdfjs_require__(50); +var _ps_parser = __w_pdfjs_require__(51); -var _image_utils = __w_pdfjs_require__(51); +var _image_utils = __w_pdfjs_require__(52); class PDFFunctionFactory { constructor({ @@ -44204,506 +45347,410 @@ function toNumberArray(arr) { return arr; } -const PDFFunction = function PDFFunctionClosure() { - const CONSTRUCT_SAMPLED = 0; - const CONSTRUCT_INTERPOLATED = 2; - const CONSTRUCT_STICHED = 3; - const CONSTRUCT_POSTSCRIPT = 4; - return { - getSampleArray(size, outputSize, bps, stream) { - let i, ii; - let length = 1; - - for (i = 0, ii = size.length; i < ii; i++) { - length *= size[i]; - } +class PDFFunction { + static getSampleArray(size, outputSize, bps, stream) { + let i, ii; + let length = 1; - length *= outputSize; - const array = new Array(length); - let codeSize = 0; - let codeBuf = 0; - const sampleMul = 1.0 / (2.0 ** bps - 1); - const strBytes = stream.getBytes((length * bps + 7) / 8); - let strIdx = 0; + for (i = 0, ii = size.length; i < ii; i++) { + length *= size[i]; + } - for (i = 0; i < length; i++) { - while (codeSize < bps) { - codeBuf <<= 8; - codeBuf |= strBytes[strIdx++]; - codeSize += 8; - } + length *= outputSize; + const array = new Array(length); + let codeSize = 0; + let codeBuf = 0; + const sampleMul = 1.0 / (2.0 ** bps - 1); + const strBytes = stream.getBytes((length * bps + 7) / 8); + let strIdx = 0; - codeSize -= bps; - array[i] = (codeBuf >> codeSize) * sampleMul; - codeBuf &= (1 << codeSize) - 1; + for (i = 0; i < length; i++) { + while (codeSize < bps) { + codeBuf <<= 8; + codeBuf |= strBytes[strIdx++]; + codeSize += 8; } - return array; - }, - - getIR({ - xref, - isEvalSupported, - fn - }) { - let dict = fn.dict; - - if (!dict) { - dict = fn; - } + codeSize -= bps; + array[i] = (codeBuf >> codeSize) * sampleMul; + codeBuf &= (1 << codeSize) - 1; + } - const types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript]; - const typeNum = dict.get("FunctionType"); - const typeFn = types[typeNum]; + return array; + } - if (!typeFn) { - throw new _util.FormatError("Unknown type of function"); - } + static parse({ + xref, + isEvalSupported, + fn + }) { + const dict = fn.dict || fn; + const typeNum = dict.get("FunctionType"); - return typeFn.call(this, { - xref, - isEvalSupported, - fn, - dict - }); - }, + switch (typeNum) { + case 0: + return this.constructSampled({ + xref, + isEvalSupported, + fn, + dict + }); - fromIR({ - xref, - isEvalSupported, - IR - }) { - const type = IR[0]; + case 1: + break; - switch (type) { - case CONSTRUCT_SAMPLED: - return this.constructSampledFromIR({ - xref, - isEvalSupported, - IR - }); + case 2: + return this.constructInterpolated({ + xref, + isEvalSupported, + dict + }); - case CONSTRUCT_INTERPOLATED: - return this.constructInterpolatedFromIR({ - xref, - isEvalSupported, - IR - }); + case 3: + return this.constructStiched({ + xref, + isEvalSupported, + dict + }); - case CONSTRUCT_STICHED: - return this.constructStichedFromIR({ - xref, - isEvalSupported, - IR - }); + case 4: + return this.constructPostScript({ + xref, + isEvalSupported, + fn, + dict + }); + } - default: - return this.constructPostScriptFromIR({ - xref, - isEvalSupported, - IR - }); - } - }, + throw new _util.FormatError("Unknown type of function"); + } - parse({ - xref, - isEvalSupported, - fn - }) { - const IR = this.getIR({ + static parseArray({ + xref, + isEvalSupported, + fnObj + }) { + if (!Array.isArray(fnObj)) { + return this.parse({ xref, isEvalSupported, - fn + fn: fnObj }); - return this.fromIR({ + } + + const fnArray = []; + + for (let j = 0, jj = fnObj.length; j < jj; j++) { + fnArray.push(this.parse({ xref, isEvalSupported, - IR - }); - }, + fn: xref.fetchIfRef(fnObj[j]) + })); + } - parseArray({ - xref, - isEvalSupported, - fnObj - }) { - if (!Array.isArray(fnObj)) { - return this.parse({ - xref, - isEvalSupported, - fn: fnObj - }); + return function (src, srcOffset, dest, destOffset) { + for (let i = 0, ii = fnArray.length; i < ii; i++) { + fnArray[i](src, srcOffset, dest, destOffset + i); } + }; + } - const fnArray = []; + static constructSampled({ + xref, + isEvalSupported, + fn, + dict + }) { + function toMultiArray(arr) { + const inputLength = arr.length; + const out = []; + let index = 0; - for (let j = 0, jj = fnObj.length; j < jj; j++) { - fnArray.push(this.parse({ - xref, - isEvalSupported, - fn: xref.fetchIfRef(fnObj[j]) - })); + for (let i = 0; i < inputLength; i += 2) { + out[index++] = [arr[i], arr[i + 1]]; } - return function (src, srcOffset, dest, destOffset) { - for (let i = 0, ii = fnArray.length; i < ii; i++) { - fnArray[i](src, srcOffset, dest, destOffset + i); - } - }; - }, + return out; + } - constructSampled({ - xref, - isEvalSupported, - fn, - dict - }) { - function toMultiArray(arr) { - const inputLength = arr.length; - const out = []; - let index = 0; + function interpolate(x, xmin, xmax, ymin, ymax) { + return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin)); + } - for (let i = 0; i < inputLength; i += 2) { - out[index] = [arr[i], arr[i + 1]]; - ++index; - } + let domain = toNumberArray(dict.getArray("Domain")); + let range = toNumberArray(dict.getArray("Range")); - return out; - } + if (!domain || !range) { + throw new _util.FormatError("No domain or range"); + } - let domain = toNumberArray(dict.getArray("Domain")); - let range = toNumberArray(dict.getArray("Range")); + const inputSize = domain.length / 2; + const outputSize = range.length / 2; + domain = toMultiArray(domain); + range = toMultiArray(range); + const size = toNumberArray(dict.getArray("Size")); + const bps = dict.get("BitsPerSample"); + const order = dict.get("Order") || 1; - if (!domain || !range) { - throw new _util.FormatError("No domain or range"); - } + if (order !== 1) { + (0, _util.info)("No support for cubic spline interpolation: " + order); + } - const inputSize = domain.length / 2; - const outputSize = range.length / 2; - domain = toMultiArray(domain); - range = toMultiArray(range); - const size = toNumberArray(dict.getArray("Size")); - const bps = dict.get("BitsPerSample"); - const order = dict.get("Order") || 1; + let encode = toNumberArray(dict.getArray("Encode")); - if (order !== 1) { - (0, _util.info)("No support for cubic spline interpolation: " + order); - } + if (!encode) { + encode = []; - let encode = toNumberArray(dict.getArray("Encode")); + for (let i = 0; i < inputSize; ++i) { + encode.push([0, size[i] - 1]); + } + } else { + encode = toMultiArray(encode); + } - if (!encode) { - encode = []; + let decode = toNumberArray(dict.getArray("Decode")); - for (let i = 0; i < inputSize; ++i) { - encode.push([0, size[i] - 1]); - } - } else { - encode = toMultiArray(encode); - } + if (!decode) { + decode = range; + } else { + decode = toMultiArray(decode); + } - let decode = toNumberArray(dict.getArray("Decode")); + const samples = this.getSampleArray(size, outputSize, bps, fn); + return function constructSampledFn(src, srcOffset, dest, destOffset) { + const cubeVertices = 1 << inputSize; + const cubeN = new Float64Array(cubeVertices); + const cubeVertex = new Uint32Array(cubeVertices); + let i, j; - if (!decode) { - decode = range; - } else { - decode = toMultiArray(decode); + for (j = 0; j < cubeVertices; j++) { + cubeN[j] = 1; } - const samples = this.getSampleArray(size, outputSize, bps, fn); - return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range]; - }, + let k = outputSize, + pos = 1; - constructSampledFromIR({ - xref, - isEvalSupported, - IR - }) { - function interpolate(x, xmin, xmax, ymin, ymax) { - return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin)); - } - - return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) { - const m = IR[1]; - const domain = IR[2]; - const encode = IR[3]; - const decode = IR[4]; - const samples = IR[5]; - const size = IR[6]; - const n = IR[7]; - const range = IR[9]; - const cubeVertices = 1 << m; - const cubeN = new Float64Array(cubeVertices); - const cubeVertex = new Uint32Array(cubeVertices); - let i, j; + for (i = 0; i < inputSize; ++i) { + const domain_2i = domain[i][0]; + const domain_2i_1 = domain[i][1]; + const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1); + let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]); + const size_i = size[i]; + e = Math.min(Math.max(e, 0), size_i - 1); + const e0 = e < size_i - 1 ? Math.floor(e) : e - 1; + const n0 = e0 + 1 - e; + const n1 = e - e0; + const offset0 = e0 * k; + const offset1 = offset0 + k; for (j = 0; j < cubeVertices; j++) { - cubeN[j] = 1; - } - - let k = n, - pos = 1; - - for (i = 0; i < m; ++i) { - const domain_2i = domain[i][0]; - const domain_2i_1 = domain[i][1]; - const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1); - let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]); - const size_i = size[i]; - e = Math.min(Math.max(e, 0), size_i - 1); - const e0 = e < size_i - 1 ? Math.floor(e) : e - 1; - const n0 = e0 + 1 - e; - const n1 = e - e0; - const offset0 = e0 * k; - const offset1 = offset0 + k; - - for (j = 0; j < cubeVertices; j++) { - if (j & pos) { - cubeN[j] *= n1; - cubeVertex[j] += offset1; - } else { - cubeN[j] *= n0; - cubeVertex[j] += offset0; - } - } - - k *= size_i; - pos <<= 1; - } - - for (j = 0; j < n; ++j) { - let rj = 0; - - for (i = 0; i < cubeVertices; i++) { - rj += samples[cubeVertex[i] + j] * cubeN[i]; + if (j & pos) { + cubeN[j] *= n1; + cubeVertex[j] += offset1; + } else { + cubeN[j] *= n0; + cubeVertex[j] += offset0; } - - rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]); - dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]); } - }; - }, - constructInterpolated({ - xref, - isEvalSupported, - fn, - dict - }) { - const c0 = toNumberArray(dict.getArray("C0")) || [0]; - const c1 = toNumberArray(dict.getArray("C1")) || [1]; - const n = dict.get("N"); - const length = c0.length; - const diff = []; - - for (let i = 0; i < length; ++i) { - diff.push(c1[i] - c0[i]); + k *= size_i; + pos <<= 1; } - return [CONSTRUCT_INTERPOLATED, c0, diff, n]; - }, - - constructInterpolatedFromIR({ - xref, - isEvalSupported, - IR - }) { - const c0 = IR[1]; - const diff = IR[2]; - const n = IR[3]; - const length = diff.length; - return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) { - const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n; + for (j = 0; j < outputSize; ++j) { + let rj = 0; - for (let j = 0; j < length; ++j) { - dest[destOffset + j] = c0[j] + x * diff[j]; + for (i = 0; i < cubeVertices; i++) { + rj += samples[cubeVertex[i] + j] * cubeN[i]; } - }; - }, - constructStiched({ - xref, - isEvalSupported, - fn, - dict - }) { - const domain = toNumberArray(dict.getArray("Domain")); - - if (!domain) { - throw new _util.FormatError("No domain"); + rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]); + dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]); } + }; + } - const inputSize = domain.length / 2; + static constructInterpolated({ + xref, + isEvalSupported, + dict + }) { + const c0 = toNumberArray(dict.getArray("C0")) || [0]; + const c1 = toNumberArray(dict.getArray("C1")) || [1]; + const n = dict.get("N"); + const diff = []; - if (inputSize !== 1) { - throw new _util.FormatError("Bad domain for stiched function"); - } + for (let i = 0, ii = c0.length; i < ii; ++i) { + diff.push(c1[i] - c0[i]); + } - const fnRefs = dict.get("Functions"); - const fns = []; + const length = diff.length; + return function constructInterpolatedFn(src, srcOffset, dest, destOffset) { + const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n; - for (let i = 0, ii = fnRefs.length; i < ii; ++i) { - fns.push(this.parse({ - xref, - isEvalSupported, - fn: xref.fetchIfRef(fnRefs[i]) - })); + for (let j = 0; j < length; ++j) { + dest[destOffset + j] = c0[j] + x * diff[j]; } + }; + } - const bounds = toNumberArray(dict.getArray("Bounds")); - const encode = toNumberArray(dict.getArray("Encode")); - return [CONSTRUCT_STICHED, domain, bounds, encode, fns]; - }, + static constructStiched({ + xref, + isEvalSupported, + dict + }) { + const domain = toNumberArray(dict.getArray("Domain")); - constructStichedFromIR({ - xref, - isEvalSupported, - IR - }) { - const domain = IR[1]; - const bounds = IR[2]; - const encode = IR[3]; - const fns = IR[4]; - const tmpBuf = new Float32Array(1); - return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) { - const clip = function constructStichedFromIRClip(v, min, max) { - if (v > max) { - v = max; - } else if (v < min) { - v = min; - } + if (!domain) { + throw new _util.FormatError("No domain"); + } - return v; - }; + const inputSize = domain.length / 2; - const v = clip(src[srcOffset], domain[0], domain[1]); - const length = bounds.length; - let i; + if (inputSize !== 1) { + throw new _util.FormatError("Bad domain for stiched function"); + } - for (i = 0; i < length; ++i) { - if (v < bounds[i]) { - break; - } - } + const fnRefs = dict.get("Functions"); + const fns = []; - let dmin = domain[0]; + for (let i = 0, ii = fnRefs.length; i < ii; ++i) { + fns.push(this.parse({ + xref, + isEvalSupported, + fn: xref.fetchIfRef(fnRefs[i]) + })); + } - if (i > 0) { - dmin = bounds[i - 1]; + const bounds = toNumberArray(dict.getArray("Bounds")); + const encode = toNumberArray(dict.getArray("Encode")); + const tmpBuf = new Float32Array(1); + return function constructStichedFn(src, srcOffset, dest, destOffset) { + const clip = function constructStichedFromIRClip(v, min, max) { + if (v > max) { + v = max; + } else if (v < min) { + v = min; } - let dmax = domain[1]; + return v; + }; - if (i < bounds.length) { - dmax = bounds[i]; - } + const v = clip(src[srcOffset], domain[0], domain[1]); + const length = bounds.length; + let i; - const rmin = encode[2 * i]; - const rmax = encode[2 * i + 1]; - tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); - fns[i](tmpBuf, 0, dest, destOffset); - }; - }, + for (i = 0; i < length; ++i) { + if (v < bounds[i]) { + break; + } + } - constructPostScript({ - xref, - isEvalSupported, - fn, - dict - }) { - const domain = toNumberArray(dict.getArray("Domain")); - const range = toNumberArray(dict.getArray("Range")); + let dmin = domain[0]; - if (!domain) { - throw new _util.FormatError("No domain."); + if (i > 0) { + dmin = bounds[i - 1]; } - if (!range) { - throw new _util.FormatError("No range."); + let dmax = domain[1]; + + if (i < bounds.length) { + dmax = bounds[i]; } - const lexer = new _ps_parser.PostScriptLexer(fn); - const parser = new _ps_parser.PostScriptParser(lexer); - const code = parser.parse(); - return [CONSTRUCT_POSTSCRIPT, domain, range, code]; - }, + const rmin = encode[2 * i]; + const rmax = encode[2 * i + 1]; + tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); + fns[i](tmpBuf, 0, dest, destOffset); + }; + } - constructPostScriptFromIR({ - xref, - isEvalSupported, - IR - }) { - const domain = IR[1]; - const range = IR[2]; - const code = IR[3]; + static constructPostScript({ + xref, + isEvalSupported, + fn, + dict + }) { + const domain = toNumberArray(dict.getArray("Domain")); + const range = toNumberArray(dict.getArray("Range")); - if (isEvalSupported && _util.IsEvalSupportedCached.value) { - const compiled = new PostScriptCompiler().compile(code, domain, range); + if (!domain) { + throw new _util.FormatError("No domain."); + } - if (compiled) { - return new Function("src", "srcOffset", "dest", "destOffset", compiled); - } + if (!range) { + throw new _util.FormatError("No range."); + } + + const lexer = new _ps_parser.PostScriptLexer(fn); + const parser = new _ps_parser.PostScriptParser(lexer); + const code = parser.parse(); + + if (isEvalSupported && _util.IsEvalSupportedCached.value) { + const compiled = new PostScriptCompiler().compile(code, domain, range); + + if (compiled) { + return new Function("src", "srcOffset", "dest", "destOffset", compiled); } + } - (0, _util.info)("Unable to compile PS function"); - const numOutputs = range.length >> 1; - const numInputs = domain.length >> 1; - const evaluator = new PostScriptEvaluator(code); - const cache = Object.create(null); - const MAX_CACHE_SIZE = 2048 * 4; - let cache_available = MAX_CACHE_SIZE; - const tmpBuf = new Float32Array(numInputs); - return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) { - let i, value; - let key = ""; - const input = tmpBuf; + (0, _util.info)("Unable to compile PS function"); + const numOutputs = range.length >> 1; + const numInputs = domain.length >> 1; + const evaluator = new PostScriptEvaluator(code); + const cache = Object.create(null); + const MAX_CACHE_SIZE = 2048 * 4; + let cache_available = MAX_CACHE_SIZE; + const tmpBuf = new Float32Array(numInputs); + return function constructPostScriptFn(src, srcOffset, dest, destOffset) { + let i, value; + let key = ""; + const input = tmpBuf; - for (i = 0; i < numInputs; i++) { - value = src[srcOffset + i]; - input[i] = value; - key += value + "_"; - } + for (i = 0; i < numInputs; i++) { + value = src[srcOffset + i]; + input[i] = value; + key += value + "_"; + } - const cachedValue = cache[key]; + const cachedValue = cache[key]; - if (cachedValue !== undefined) { - dest.set(cachedValue, destOffset); - return; - } + if (cachedValue !== undefined) { + dest.set(cachedValue, destOffset); + return; + } - const output = new Float32Array(numOutputs); - const stack = evaluator.execute(input); - const stackIndex = stack.length - numOutputs; + const output = new Float32Array(numOutputs); + const stack = evaluator.execute(input); + const stackIndex = stack.length - numOutputs; - for (i = 0; i < numOutputs; i++) { - value = stack[stackIndex + i]; - let bound = range[i * 2]; + for (i = 0; i < numOutputs; i++) { + value = stack[stackIndex + i]; + let bound = range[i * 2]; - if (value < bound) { - value = bound; - } else { - bound = range[i * 2 + 1]; + if (value < bound) { + value = bound; + } else { + bound = range[i * 2 + 1]; - if (value > bound) { - value = bound; - } + if (value > bound) { + value = bound; } - - output[i] = value; } - if (cache_available > 0) { - cache_available--; - cache[key] = output; - } + output[i] = value; + } - dest.set(output, destOffset); - }; - } + if (cache_available > 0) { + cache_available--; + cache[key] = output; + } - }; -}(); + dest.set(output, destOffset); + }; + } + +} function isPDFFunction(v) { let fnDict; @@ -44721,75 +45768,73 @@ function isPDFFunction(v) { return fnDict.has("FunctionType"); } -const PostScriptStack = function PostScriptStackClosure() { - const MAX_STACK_SIZE = 100; - - class PostScriptStack { - constructor(initialStack) { - this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0); - } +class PostScriptStack { + static get MAX_STACK_SIZE() { + return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100); + } - push(value) { - if (this.stack.length >= MAX_STACK_SIZE) { - throw new Error("PostScript function stack overflow."); - } + constructor(initialStack) { + this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0); + } - this.stack.push(value); + push(value) { + if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) { + throw new Error("PostScript function stack overflow."); } - pop() { - if (this.stack.length <= 0) { - throw new Error("PostScript function stack underflow."); - } + this.stack.push(value); + } - return this.stack.pop(); + pop() { + if (this.stack.length <= 0) { + throw new Error("PostScript function stack underflow."); } - copy(n) { - if (this.stack.length + n >= MAX_STACK_SIZE) { - throw new Error("PostScript function stack overflow."); - } - - const stack = this.stack; + return this.stack.pop(); + } - for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) { - stack.push(stack[i]); - } + copy(n) { + if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) { + throw new Error("PostScript function stack overflow."); } - index(n) { - this.push(this.stack[this.stack.length - n - 1]); + const stack = this.stack; + + for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) { + stack.push(stack[i]); } + } - roll(n, p) { - const stack = this.stack; - const l = stack.length - n; - const r = stack.length - 1; - const c = l + (p - Math.floor(p / n) * n); + index(n) { + this.push(this.stack[this.stack.length - n - 1]); + } - for (let i = l, j = r; i < j; i++, j--) { - const t = stack[i]; - stack[i] = stack[j]; - stack[j] = t; - } + roll(n, p) { + const stack = this.stack; + const l = stack.length - n; + const r = stack.length - 1; + const c = l + (p - Math.floor(p / n) * n); - for (let i = l, j = c - 1; i < j; i++, j--) { - const t = stack[i]; - stack[i] = stack[j]; - stack[j] = t; - } + for (let i = l, j = r; i < j; i++, j--) { + const t = stack[i]; + stack[i] = stack[j]; + stack[j] = t; + } - for (let i = c, j = r; i < j; i++, j--) { - const t = stack[i]; - stack[i] = stack[j]; - stack[j] = t; - } + for (let i = l, j = c - 1; i < j; i++, j--) { + const t = stack[i]; + stack[i] = stack[j]; + stack[j] = t; } + for (let i = c, j = r; i < j; i++, j--) { + const t = stack[i]; + stack[i] = stack[j]; + stack[j] = t; + } } - return PostScriptStack; -}(); +} class PostScriptEvaluator { constructor(operators) { @@ -45501,7 +46546,7 @@ const PostScriptCompiler = function PostScriptCompilerClosure() { exports.PostScriptCompiler = PostScriptCompiler; /***/ }), -/* 50 */ +/* 51 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -45606,45 +46651,43 @@ const PostScriptTokenTypes = { IFELSE: 5 }; -const PostScriptToken = function PostScriptTokenClosure() { - const opCache = Object.create(null); - - class PostScriptToken { - constructor(type, value) { - this.type = type; - this.value = value; - } +class PostScriptToken { + static get opCache() { + return (0, _util.shadow)(this, "opCache", Object.create(null)); + } - static getOperator(op) { - const opValue = opCache[op]; + constructor(type, value) { + this.type = type; + this.value = value; + } - if (opValue) { - return opValue; - } + static getOperator(op) { + const opValue = PostScriptToken.opCache[op]; - return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op); + if (opValue) { + return opValue; } - static get LBRACE() { - return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{")); - } + return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op); + } - static get RBRACE() { - return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}")); - } + static get LBRACE() { + return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{")); + } - static get IF() { - return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF")); - } + static get RBRACE() { + return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}")); + } - static get IFELSE() { - return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE")); - } + static get IF() { + return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF")); + } + static get IFELSE() { + return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE")); } - return PostScriptToken; -}(); +} class PostScriptLexer { constructor(stream) { @@ -45754,7 +46797,7 @@ class PostScriptLexer { exports.PostScriptLexer = PostScriptLexer; /***/ }), -/* 51 */ +/* 52 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -45804,7 +46847,7 @@ class BaseLocalCache { class LocalImageCache extends BaseLocalCache { set(name, ref = null, data) { - if (!name) { + if (typeof name !== "string") { throw new Error('LocalImageCache.set - expected "name" argument.'); } @@ -45833,7 +46876,7 @@ exports.LocalImageCache = LocalImageCache; class LocalColorSpaceCache extends BaseLocalCache { set(name = null, ref = null, data) { - if (!name && !ref) { + if (typeof name !== "string" && !ref) { throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.'); } @@ -45842,7 +46885,7 @@ class LocalColorSpaceCache extends BaseLocalCache { return; } - if (name) { + if (name !== null) { this._nameRefMap.set(name, ref); } @@ -45891,7 +46934,7 @@ exports.LocalFunctionCache = LocalFunctionCache; class LocalGStateCache extends BaseLocalCache { set(name, ref = null, data) { - if (!name) { + if (typeof name !== "string") { throw new Error('LocalGStateCache.set - expected "name" argument.'); } @@ -45920,7 +46963,7 @@ exports.LocalGStateCache = LocalGStateCache; class LocalTilingPatternCache extends BaseLocalCache { set(name, ref = null, data) { - if (!name) { + if (typeof name !== "string") { throw new Error('LocalTilingPatternCache.set - expected "name" argument.'); } @@ -46080,7 +47123,7 @@ class GlobalImageCache { exports.GlobalImageCache = GlobalImageCache; /***/ }), -/* 52 */ +/* 53 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -46391,7 +47434,7 @@ function bidi(str, startLevel, vertical) { } /***/ }), -/* 53 */ +/* 54 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -49344,7 +50387,300 @@ const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) { exports.getMetrics = getMetrics; /***/ }), -/* 54 */ +/* 55 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.getXfaFontName = getXfaFontName; +exports.getXfaFontWidths = getXfaFontWidths; + +var _calibri_factors = __w_pdfjs_require__(56); + +var _helvetica_factors = __w_pdfjs_require__(57); + +var _liberationsans_widths = __w_pdfjs_require__(58); + +var _myriadpro_factors = __w_pdfjs_require__(59); + +var _segoeui_factors = __w_pdfjs_require__(60); + +var _core_utils = __w_pdfjs_require__(9); + +var _fonts_utils = __w_pdfjs_require__(38); + +const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { + t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = { + name: "LiberationSans-Regular", + factors: _myriadpro_factors.MyriadProRegularFactors, + baseWidths: _liberationsans_widths.LiberationSansRegularWidths, + lineHeight: _myriadpro_factors.MyriadProRegularLineHeight + }; + t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = { + name: "LiberationSans-Bold", + factors: _myriadpro_factors.MyriadProBoldFactors, + baseWidths: _liberationsans_widths.LiberationSansBoldWidths, + lineHeight: _myriadpro_factors.MyriadProBoldLineHeight + }; + t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = { + name: "LiberationSans-Italic", + factors: _myriadpro_factors.MyriadProItalicFactors, + baseWidths: _liberationsans_widths.LiberationSansItalicWidths, + lineHeight: _myriadpro_factors.MyriadProItalicLineHeight + }; + t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = { + name: "LiberationSans-BoldItalic", + factors: _myriadpro_factors.MyriadProBoldItalicFactors, + baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, + lineHeight: _myriadpro_factors.MyriadProBoldItalicLineHeight + }; + t.ArialMT = t.Arial = t["Arial-Regular"] = { + name: "LiberationSans-Regular", + baseWidths: _liberationsans_widths.LiberationSansRegularWidths + }; + t["Arial-BoldMT"] = t["Arial-Bold"] = { + name: "LiberationSans-Bold", + baseWidths: _liberationsans_widths.LiberationSansBoldWidths + }; + t["Arial-ItalicMT"] = t["Arial-Italic"] = { + name: "LiberationSans-Italic", + baseWidths: _liberationsans_widths.LiberationSansItalicWidths + }; + t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = { + name: "LiberationSans-BoldItalic", + baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths + }; + t["Calibri-Regular"] = { + name: "LiberationSans-Regular", + factors: _calibri_factors.CalibriRegularFactors, + baseWidths: _liberationsans_widths.LiberationSansRegularWidths, + lineHeight: _calibri_factors.CalibriRegularLineHeight + }; + t["Calibri-Bold"] = { + name: "LiberationSans-Bold", + factors: _calibri_factors.CalibriBoldFactors, + baseWidths: _liberationsans_widths.LiberationSansBoldWidths, + lineHeight: _calibri_factors.CalibriBoldLineHeight + }; + t["Calibri-Italic"] = { + name: "LiberationSans-Italic", + factors: _calibri_factors.CalibriItalicFactors, + baseWidths: _liberationsans_widths.LiberationSansItalicWidths, + lineHeight: _calibri_factors.CalibriItalicLineHeight + }; + t["Calibri-BoldItalic"] = { + name: "LiberationSans-BoldItalic", + factors: _calibri_factors.CalibriBoldItalicFactors, + baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, + lineHeight: _calibri_factors.CalibriBoldItalicLineHeight + }; + t["Segoeui-Regular"] = { + name: "LiberationSans-Regular", + factors: _segoeui_factors.SegoeuiRegularFactors, + baseWidths: _liberationsans_widths.LiberationSansRegularWidths, + lineHeight: _segoeui_factors.SegoeuiRegularLineHeight + }; + t["Segoeui-Bold"] = { + name: "LiberationSans-Bold", + factors: _segoeui_factors.SegoeuiBoldFactors, + baseWidths: _liberationsans_widths.LiberationSansBoldWidths, + lineHeight: _segoeui_factors.SegoeuiBoldLineHeight + }; + t["Segoeui-Italic"] = { + name: "LiberationSans-Italic", + factors: _segoeui_factors.SegoeuiItalicFactors, + baseWidths: _liberationsans_widths.LiberationSansItalicWidths, + lineHeight: _segoeui_factors.SegoeuiItalicLineHeight + }; + t["Segoeui-BoldItalic"] = { + name: "LiberationSans-BoldItalic", + factors: _segoeui_factors.SegoeuiBoldItalicFactors, + baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, + lineHeight: _segoeui_factors.SegoeuiBoldItalicLineHeight + }; + t["Helvetica-Regular"] = t.Helvetica = { + name: "LiberationSans-Regular", + factors: _helvetica_factors.HelveticaRegularFactors, + baseWidths: _liberationsans_widths.LiberationSansRegularWidths, + lineHeight: _helvetica_factors.HelveticaRegularLineHeight + }; + t["Helvetica-Bold"] = { + name: "LiberationSans-Bold", + factors: _helvetica_factors.HelveticaBoldFactors, + baseWidths: _liberationsans_widths.LiberationSansBoldWidths, + lineHeight: _helvetica_factors.HelveticaBoldLineHeight + }; + t["Helvetica-Italic"] = { + name: "LiberationSans-Italic", + factors: _helvetica_factors.HelveticaItalicFactors, + baseWidths: _liberationsans_widths.LiberationSansItalicWidths, + lineHeight: _helvetica_factors.HelveticaItalicLineHeight + }; + t["Helvetica-BoldItalic"] = { + name: "LiberationSans-BoldItalic", + factors: _helvetica_factors.HelveticaBoldItalicFactors, + baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths, + lineHeight: _helvetica_factors.HelveticaBoldItalicLineHeight + }; +}); + +function getXfaFontName(name) { + const fontName = (0, _fonts_utils.normalizeFontName)(name); + const fontMap = getXFAFontMap(); + return fontMap[fontName]; +} + +function getXfaFontWidths(name) { + const info = getXfaFontName(name); + + if (!info) { + return null; + } + + const { + baseWidths, + factors + } = info; + + if (!factors) { + return baseWidths; + } + + return baseWidths.map((w, i) => w * factors[i]); +} + +/***/ }), +/* 56 */ +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.CalibriRegularLineHeight = exports.CalibriRegularFactors = exports.CalibriItalicLineHeight = exports.CalibriItalicFactors = exports.CalibriBoldLineHeight = exports.CalibriBoldItalicLineHeight = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0; +const CalibriBoldFactors = [1.3877, 1, 0.83908, 0.77539, 0.77539, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.7762, 0.7762, 0.73293, 0.73293, 0.73293, 0.73293, 0.73293, 0.73293, 0.82577, 0.87289, 0.87289, 0.88506, 0.80367, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.88656, 0.73133, 0.73133, 0.57184, 0.87356, 0.6965, 0.88506, 0.91133, 0.7514, 0.81921, 0.68156, 0.81921, 0.81921, 1, 0.81921, 0.87356, 1, 0.99862, 0.99862, 1, 0.91075, 0.87356, 0.95958, 0.76229, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.56289, 0.95958, 0.59526, 0.59526, 0.75727, 0.75727, 1, 0.69225, 0.69225, 0.89019, 0.70424, 1, 0.91926, 0.70823, 1.04924, 1.04924, 0.9121, 0.9121, 0.9121, 1, 0.9121, 0.9121, 0.86943, 0.87402, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.84896, 0.81235, 0.86943, 0.82001, 0.87508, 0.87508, 0.86943, 0.79795, 0.9762, 0.87356, 0.99819, 0.88198, 0.77958, 0.77958, 0.77958, 1, 0.79795, 0.70864, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 0.70572, 0.8, 1, 1, 1, 1, 1, 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.70864, 0.70864, 0.70864, 0.70864, 1, 0.78275, 0.81055, 0.81055, 0.81055, 0.81055, 1, 0.86943, 0.79795, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.77892, 0.56029, 0.90399, 0.90399, 0.88653, 0.96017, 0.96017, 0.96017, 0.96017, 0.96017, 0.82577, 0.7648, 0.77892, 0.77892, 0.77892, 0.77892, 0.77892, 0.78257, 0.78257, 0.78257, 0.78257, 0.78257, 0.88762, 0.88762, 0.88762, 0.88762, 0.90323, 1, 0.88762, 0.8715, 0.8715, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.88762, 0.96108, 0.96108, 0.88762, 0.97566, 0.80352, 0.88762, 0.90747, 0.88762, 0.88762, 1.31006, 1.81055, 0.90527, 0.90527, 1.81055, 1.53711, 0.94434, 0.85284, 0.85284, 1.2798, 0.92138, 0.88762, 0.8785, 1.54657, 1.69808, 0.8936, 1, 0.88331, 0.88331, 0.97507, 0.97507, 1.15543, 1, 1.7801, 1.42259, 0.75241, 0.75241, 1.20528, 1, 1, 0.75241, 0.75241, 0.75241, 0.75241, 0.91056, 0.89552, 0.78287, 0.91027, 1.20528, 1, 1, 0.82845, 0.92794, 1, 1, 1.13254, 0.89552, 1, 0.8785, 0.89552, 0.89552, 0.83016, 0.93125, 0.85592, 0.87842, 1, 1.24487, 1, 1.06303, 0.90747, 1, 1, 0.91133, 0.70674, 0.88401, 0.90518, 0.90518, 0.90518, 0.90518, 0.90518, 0.90518, 0.90518, 0.90518, 0.91133, 1, 0.71143, 0.90518, 0.90527, 0.89552, 0.8785, 0.90518, 0.96399, 1.01407, 0.85284, 0.85356, 1.23108, 0.89049, 0.89049, 0.8785, 0.97801, 0.97171, 0.97801, 0.95015, 1, 1, 1, 0.91133, 0.88525, 1, 0.56892, 0.91133, 1, 0.83406, 0.77618, 0.84021, 0.77618, 0.77618, 1, 0.77618, 0.90807, 0.90176, 1, 0.85284, 0.90747, 0.96839, 0.96839, 1.03372, 1.03372, 0.8785, 0.89608, 0.8785, 1, 1.44947, 1.45894, 1, 0.88401, 0.88401, 0.88401, 0.88401, 0.88401, 0.88401, 0.90167, 0.88401, 1.17534, 1.37077, 0.8941, 0.8941, 0.9716, 1, 1, 1, 0.88401, 1.02988, 1.02988, 1.02988, 1.02988, 0.88401, 0.91916, 0.91916, 0.86304, 0.86077, 1, 0.86304, 0.88401, 0.88401, 0.87445, 0.79468, 1, 0.88175, 0.85284, 0.90747, 1, 0.91133, 0.85284, 0.9297, 1.08004, 0.94903, 1, 0.91488, 0.70645, 1, 1, 0.85284, 1, 0.92099, 0.85284, 1, 1, 0.8785, 0.8785, 0.87802, 0.8785, 1, 0.91133, 1, 0.90747, 0.8785, 0.84723, 0.89552, 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.89291, 0.94721, 0.8801, 0.8801, 0.8801, 0.84971, 0.84971, 0.8801, 0.8801, 0.91133, 0.83489, 0.82845, 0.78864, 0.99862, 1.12401, 1.19118, 0.69825, 0.89049, 0.89049, 0.8801, 0.8785, 1.07463, 0.93548, 0.93548, 1.08696, 0.81988, 0.96134, 1.06152, 0.84107, 0.97747, 0.75638, 0.85284, 0.90747, 0.95018, 0.97926, 0.8785, 0.75859, 0.75859, 0.92482, 0.87012, 0.87012, 0.87012, 0.92794, 0.92794, 0.92794, 0.92794, 0.98152, 0.91343, 0.91343, 0.90747, 0.91343, 1, 0.68787, 0.85284, 0.85714, 0.98387, 1, 0.7173, 0.7173, 0.7173, 0.7173, 0.7173, 1, 1, 0.89552, 0.91133, 0.81499, 1, 1, 0.79586, 0.78216, 0.91133, 1.54657, 1, 1, 0.91133, 0.77192, 1, 1.04106, 0.87965, 1.06452, 0.75841, 1, 1.00813, 0.8785, 0.91133, 0.88525, 0.84133, 1.33431, 1, 0.95161, 0.72021, 1, 1, 1, 1, 0.91133, 0.8785, 0.8785, 0.8785, 0.8785, 0.8785, 0.8785, 0.8785, 0.8785, 0.89552, 0.90363, 1, 1, 1.01466, 1.0088, 1, 0.75806, 0.81055, 1.04106, 1, 0.82845, 0.73133, 0.90264, 0.90518, 0.90548, 1, 1, 1.4956, 0.93835, 1, 1, 2.2807, 1, 1, 1, 0.90727, 0.90727, 0.8785, 1, 0.94211, 0.94211, 0.94211, 0.94211, 0.8785, 0.8785, 0.85075, 0.95794, 0.95794, 0.95794, 0.95794, 0.95794, 0.82616, 0.86513, 0.85162, 0.85162, 0.85162, 0.85162, 0.91133, 0.85162, 0.79492, 0.79492, 0.79492, 0.79492, 0.91133, 0.79109]; +exports.CalibriBoldFactors = CalibriBoldFactors; +const CalibriBoldLineHeight = 1.2207; +exports.CalibriBoldLineHeight = CalibriBoldLineHeight; +const CalibriBoldItalicFactors = [1.3877, 1, 0.83908, 0.77539, 0.77539, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.7762, 0.7762, 0.71805, 0.71805, 0.71805, 0.71805, 0.71805, 0.71805, 0.82577, 0.87289, 0.87289, 0.88506, 0.86036, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.73133, 0.88116, 0.73133, 0.73133, 0.57118, 0.87356, 0.6965, 0.88506, 0.91133, 0.7514, 0.81921, 0.67174, 0.81921, 0.81921, 1, 0.81921, 0.87356, 1, 0.99862, 0.99862, 1, 0.91075, 0.87356, 0.95958, 0.76467, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.95958, 0.56347, 0.95958, 0.59526, 0.59526, 0.75727, 0.75727, 1, 0.69225, 0.69225, 0.89019, 0.70424, 1, 0.91926, 0.70823, 1.04924, 1.04924, 0.90872, 0.90872, 0.90872, 1, 0.90872, 0.90872, 0.85938, 0.87402, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.87179, 0.80346, 0.85938, 0.79179, 0.87068, 0.87068, 0.85938, 0.79795, 0.97447, 0.87891, 0.97466, 0.87068, 0.77958, 0.77958, 0.77958, 1, 0.79795, 0.69766, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 0.70572, 0.8, 1, 1, 1, 1, 1, 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.69766, 0.69766, 0.69766, 0.69766, 1, 0.7957, 0.81055, 0.81055, 0.81055, 0.81055, 1, 0.86441, 0.79795, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.77892, 0.55853, 0.90399, 0.90399, 0.88653, 0.96068, 0.96068, 0.96068, 0.96068, 0.96068, 0.82577, 0.74889, 0.77892, 0.77892, 0.77892, 0.77892, 0.77892, 0.78257, 0.78257, 0.78257, 0.78257, 0.78257, 0.94908, 0.94908, 0.94908, 0.94908, 0.90323, 1, 0.94908, 0.85887, 0.85887, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.94908, 0.94252, 0.94252, 0.94908, 0.97566, 0.80352, 0.94908, 0.90747, 0.94908, 0.94908, 1.3107, 1.81055, 0.90616, 0.90527, 1.81055, 1.53711, 0.94434, 0.85284, 0.85284, 1.2798, 0.92138, 0.94908, 0.86411, 1.529, 1.69808, 0.87411, 1, 0.88331, 0.88331, 0.97507, 0.97507, 1.15543, 1, 1.7801, 1.42259, 0.74012, 0.74012, 1.20528, 1, 1, 0.74012, 0.74012, 0.74012, 0.74012, 0.91056, 0.89552, 0.78022, 0.91027, 1.20528, 1, 1, 0.82845, 0.92794, 1, 1, 1.13254, 0.89552, 1, 0.86411, 0.89552, 0.89552, 0.79538, 0.92726, 0.85592, 0.8728, 1, 1.24487, 1, 1.48387, 0.90747, 1, 1, 0.91133, 0.70088, 0.88401, 0.88323, 0.88323, 0.88323, 0.88323, 0.88323, 0.88323, 0.88323, 0.88323, 0.91133, 1, 0.71094, 0.88323, 0.90527, 0.89552, 0.86331, 0.88323, 0.95612, 0.95612, 0.85284, 0.85356, 1.23108, 0.8753, 0.8753, 0.8785, 0.97801, 0.97171, 0.97801, 0.95015, 1, 1, 1, 0.91133, 0.88525, 1, 0.56892, 0.91133, 1, 0.83406, 0.86411, 0.84021, 0.86411, 0.86411, 1, 0.86411, 0.90807, 0.90176, 1, 0.85284, 0.90747, 0.96839, 0.96839, 1.03372, 1.03372, 0.86331, 0.8777, 0.86331, 1, 1.44947, 1.45894, 1, 0.88401, 0.88401, 0.88401, 0.88401, 0.88401, 0.88401, 0.90167, 0.88401, 1.17534, 1.37077, 0.8941, 0.8941, 0.9716, 1, 1, 1, 0.88401, 1.02988, 1.02988, 1.02988, 1.02988, 0.88401, 0.91916, 0.91916, 0.86304, 0.84814, 1, 0.86304, 0.88401, 0.88401, 0.87445, 0.77312, 1, 0.88175, 0.85284, 0.90747, 1, 0.91133, 0.85284, 0.9297, 1.08004, 0.94903, 1, 0.9039, 0.70645, 1, 1, 0.85284, 1, 0.91822, 0.85284, 1, 1, 0.86331, 0.86331, 0.86906, 0.86331, 1, 0.91133, 1, 0.90747, 0.86331, 0.84723, 0.89552, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86549, 0.94721, 0.86331, 0.86331, 0.86331, 0.86015, 0.86015, 0.86331, 0.86331, 0.91133, 0.83489, 0.82845, 0.78864, 0.99862, 1.19129, 1.19118, 0.69825, 0.89049, 0.89049, 0.86331, 0.86411, 1.07463, 0.93548, 0.93548, 1.08696, 0.81988, 0.96134, 1.06152, 0.83326, 0.99375, 0.81344, 0.85284, 0.90747, 0.95018, 0.95452, 0.86411, 0.75859, 0.75859, 0.92482, 0.87012, 0.87012, 0.87012, 0.92794, 0.89807, 0.92794, 0.92794, 0.98152, 0.90464, 0.90464, 0.90747, 0.90464, 1, 0.68787, 0.85284, 0.87581, 0.98387, 1, 0.70852, 0.70852, 0.70852, 0.70852, 0.70852, 1, 1, 0.89552, 0.91133, 0.81499, 1, 1, 0.82046, 0.76422, 0.91133, 1.56239, 1, 1, 0.91133, 0.77192, 1, 1.04106, 0.96057, 1.06452, 0.75841, 1, 1.02189, 0.86411, 0.91133, 0.88525, 0.84133, 1.33431, 1, 0.95161, 0.72021, 1, 1, 1, 1, 0.91133, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.89552, 0.90363, 1, 1, 1.01466, 1.0088, 1, 0.75806, 0.81055, 1.04106, 1, 0.82845, 0.73133, 0.90631, 0.88323, 0.85174, 1, 1, 1.4956, 0.92972, 1, 1, 2.2807, 1, 1, 1, 0.90727, 0.90727, 0.86331, 1, 0.92733, 0.92733, 0.92733, 0.92733, 0.86331, 0.86331, 0.84372, 0.95794, 0.95794, 0.95794, 0.95794, 0.95794, 0.82616, 0.85668, 0.84548, 0.84548, 0.84548, 0.84548, 0.91133, 0.84548, 0.79492, 0.79492, 0.79492, 0.79492, 0.91133, 0.74081]; +exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors; +const CalibriBoldItalicLineHeight = 1.2207; +exports.CalibriBoldItalicLineHeight = CalibriBoldItalicLineHeight; +const CalibriItalicFactors = [1.3877, 1, 0.8675, 0.76318, 0.76318, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.81552, 0.81552, 0.72346, 0.72346, 0.72346, 0.72346, 0.72346, 0.72346, 0.77818, 0.85193, 0.85193, 0.86477, 0.84134, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.86698, 0.73206, 0.73206, 0.6192, 0.86275, 0.7363, 0.86477, 0.91133, 0.7522, 0.81105, 0.7286, 0.81105, 0.81105, 1, 0.81105, 0.86275, 1, 0.99862, 0.99862, 1, 0.90872, 0.86275, 0.90685, 0.77896, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.64824, 0.90685, 0.6377, 0.6377, 0.77892, 0.77892, 1, 0.75593, 0.75593, 0.85871, 0.76032, 1, 0.98156, 0.77261, 1.02638, 1.02638, 0.89249, 0.89249, 0.89249, 1, 0.89249, 0.89249, 0.84118, 0.8667, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.87291, 0.85696, 0.84118, 0.82411, 0.84557, 0.84557, 0.84118, 0.77452, 0.90782, 0.85984, 0.903, 0.85374, 0.75186, 0.75186, 0.75186, 1, 0.77452, 0.67789, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 0.70572, 0.8, 1, 1, 1, 1, 1, 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.67789, 0.67789, 0.67789, 0.67789, 1, 0.76466, 0.79776, 0.79776, 0.79776, 0.79776, 1, 0.84369, 0.77452, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.7306, 0.56321, 0.88844, 0.88844, 0.85066, 0.94309, 0.94309, 0.94309, 0.94309, 0.94309, 0.77818, 0.75828, 0.7306, 0.7306, 0.7306, 0.7306, 0.7306, 0.76659, 0.76659, 0.76659, 0.76659, 0.76659, 0.9245, 0.9245, 0.9245, 0.9245, 0.87683, 1, 0.9245, 0.84843, 0.84843, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.9245, 0.99058, 0.99058, 0.9245, 1.02269, 0.90861, 0.9245, 0.90747, 0.9245, 0.9245, 1.28809, 1.81055, 0.90572, 0.90749, 1.81055, 1.55469, 0.94434, 1.06139, 0.85284, 1.2798, 0.88071, 0.9245, 0.9245, 1.38313, 1.77256, 0.92393, 1, 0.94152, 0.94152, 1.10369, 1.10369, 1.1437, 1, 1.91729, 1.42259, 0.83203, 0.83203, 1.18622, 1, 1, 0.83203, 0.83203, 0.83203, 0.83203, 0.92229, 0.89552, 0.78086, 0.91027, 1.18622, 1, 1, 0.96309, 0.89807, 1, 1, 1.13254, 0.89552, 1, 0.9245, 0.89552, 0.89552, 0.8875, 0.99034, 0.84737, 0.942, 1, 1.17889, 1, 1.48387, 0.90747, 1, 1, 0.91133, 0.67009, 0.82601, 0.85865, 0.85865, 0.85865, 0.85865, 0.85865, 0.85865, 0.85865, 0.85865, 0.91133, 1, 0.68994, 0.85865, 0.90527, 0.89552, 0.9245, 0.85865, 1.03667, 1.03667, 0.85284, 0.85284, 1.23108, 0.94635, 0.94635, 0.94469, 1.17223, 1.11523, 0.97801, 1.09842, 1, 1, 1, 0.91133, 0.84426, 1, 0.54873, 0.91133, 1, 0.82616, 0.9245, 0.8916, 0.9245, 0.9245, 1, 0.9245, 0.86331, 0.8739, 1, 0.85284, 0.90747, 0.92098, 0.92098, 1.0176, 1.0176, 0.9245, 0.93591, 0.9245, 1, 1.44947, 1.40909, 1, 1.03297, 0.82601, 0.82601, 0.82601, 0.82601, 0.82601, 1.05611, 0.82601, 1.19658, 1.33512, 0.8941, 0.8941, 0.97622, 1, 1, 1, 1.03297, 1.23516, 1.23516, 1.23516, 1.23516, 0.82601, 1.07692, 1.07692, 0.90918, 0.90918, 1, 0.90918, 1.03297, 1.03297, 0.94048, 0.9375, 1, 0.93407, 0.85284, 0.90747, 1, 0.91133, 0.85284, 1.09231, 1.0336, 1.11429, 1, 0.94959, 0.71353, 1, 1, 0.85284, 1, 0.98217, 0.85284, 1, 1, 0.9245, 0.9245, 0.92534, 0.9245, 1, 0.91133, 1, 0.90747, 0.9245, 0.89746, 0.89552, 0.92274, 0.92274, 0.92274, 0.92274, 0.92274, 0.86291, 0.93695, 0.92274, 0.92274, 0.92274, 0.89404, 0.89404, 0.92274, 0.92274, 0.91133, 0.79801, 0.80504, 0.76288, 0.99862, 1.16359, 1.15642, 0.69825, 0.86651, 0.86651, 0.92274, 0.9245, 1.09091, 0.91056, 0.91056, 1.07806, 0.80395, 0.90861, 1.03809, 0.83437, 1.00225, 0.82507, 0.85284, 0.90747, 0.97094, 0.97248, 0.9245, 0.83319, 0.75859, 1.1293, 1.2566, 1.2566, 1.2566, 1.12308, 1.12308, 1.12308, 1.12308, 1.15601, 1.02933, 1.02933, 0.90747, 1.02933, 1, 0.68787, 0.85284, 0.88832, 0.96334, 1, 0.77832, 0.77832, 0.77832, 0.77832, 0.77832, 1, 1, 0.89552, 0.91133, 0.774, 1, 1, 0.88178, 0.84438, 0.91133, 1.39543, 1, 1, 0.91133, 0.7589, 1, 1.20562, 1.03525, 1.23023, 0.97655, 1, 1.0297, 0.9245, 0.91133, 0.84426, 0.80972, 1.35191, 1, 0.95161, 0.70508, 1, 1, 1, 1, 0.91133, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.89552, 0.90186, 1, 1, 1.0088, 1.0044, 1, 0.739, 0.79776, 1.20562, 1, 0.96309, 0.73206, 0.89693, 0.85865, 0.90933, 1, 1, 1.4956, 0.97858, 1, 1, 2.01462, 1, 1, 1, 1.05859, 1.05859, 0.9245, 1, 0.9849, 0.9849, 0.9849, 0.9849, 0.9245, 0.9245, 0.8916, 0.98986, 0.98986, 0.98986, 0.98986, 0.98986, 0.86621, 0.84153, 0.89453, 0.89453, 0.89453, 0.89453, 0.91133, 0.89453, 0.79004, 0.79004, 0.79004, 0.79004, 0.91133, 0.75026]; +exports.CalibriItalicFactors = CalibriItalicFactors; +const CalibriItalicLineHeight = 1.2207; +exports.CalibriItalicLineHeight = CalibriItalicLineHeight; +const CalibriRegularFactors = [1.3877, 1, 0.8675, 0.76318, 0.76318, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.86686, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.81552, 0.81552, 0.73834, 0.73834, 0.73834, 0.73834, 0.73834, 0.73834, 0.77818, 0.85193, 0.85193, 0.86477, 0.84503, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.73206, 0.86901, 0.73206, 0.73206, 0.62267, 0.86275, 0.74359, 0.86477, 0.91133, 0.7522, 0.81105, 0.75443, 0.81105, 0.81105, 1, 0.81105, 0.86275, 1, 0.99862, 0.99862, 1, 0.90872, 0.86275, 0.90685, 0.77741, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.90685, 0.65649, 0.90685, 0.6377, 0.6377, 0.77892, 0.77892, 1, 0.75593, 0.75593, 0.85746, 0.76032, 1, 0.98156, 0.77261, 1.02638, 1.02638, 0.89385, 0.89385, 0.89385, 1, 0.89385, 0.89385, 0.85122, 0.8667, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.88831, 0.88254, 0.85122, 0.85498, 0.85311, 0.85311, 0.85122, 0.77452, 0.95165, 0.86275, 0.89772, 0.86503, 0.75186, 0.75186, 0.75186, 1, 0.77452, 0.68887, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 0.70572, 0.8, 1, 1, 1, 1, 1, 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.68887, 0.68887, 0.68887, 0.68887, 1, 0.74171, 0.79776, 0.79776, 0.79776, 0.79776, 1, 0.85122, 0.77452, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.7306, 0.56963, 0.88844, 0.88844, 0.85066, 0.94258, 0.94258, 0.94258, 0.94258, 0.94258, 0.77818, 0.75657, 0.7306, 0.7306, 0.7306, 0.7306, 0.7306, 0.76659, 0.76659, 0.76659, 0.76659, 0.76659, 0.86128, 0.86128, 0.86128, 0.86128, 0.87683, 0.86128, 0.8693, 0.8693, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.86128, 0.98142, 0.98142, 0.86128, 1.02269, 0.90861, 0.86128, 0.90747, 0.86128, 0.86128, 1.28809, 1.81055, 0.90527, 0.90527, 1.81055, 1.55469, 0.94434, 1.06139, 0.85284, 1.2798, 0.88071, 0.86128, 0.94469, 1.39016, 1.77256, 0.9236, 1, 0.94152, 0.94152, 1.10369, 1.10369, 1.1437, 1.91729, 1.42259, 0.8457, 0.8457, 1.18622, 0.8457, 0.8457, 0.8457, 0.8457, 0.92229, 0.89552, 0.81209, 0.91027, 1.18622, 1, 0.96309, 0.89807, 1.13254, 0.89552, 0.94469, 0.89552, 0.89552, 0.92454, 0.9921, 0.84737, 0.94035, 1, 1.17889, 1.48387, 0.90747, 1, 1, 0.91133, 0.67742, 0.82601, 0.89464, 0.89464, 0.89464, 0.89464, 0.89464, 0.89464, 0.89464, 0.89464, 0.91133, 0.69043, 0.89464, 0.90527, 0.89552, 0.94469, 0.89464, 1.02191, 1.02191, 0.85284, 0.85356, 1.23108, 0.96576, 0.96576, 0.94469, 1.17223, 1.11523, 0.97801, 1.09842, 1, 1, 1, 0.91133, 0.84426, 0.54873, 0.91133, 0.82616, 0.84636, 0.89258, 0.84636, 0.84636, 1, 0.84636, 0.86331, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.8739, 0.85284, 0.90747, 0.92098, 0.92098, 1.0176, 1.0176, 0.94469, 0.95786, 0.94469, 1, 1.44947, 1.40909, 1.03297, 0.82601, 0.82601, 0.82601, 0.82601, 0.82601, 1.05611, 0.82601, 1.19658, 1.33512, 0.8941, 0.8941, 0.97622, 1, 1, 1, 1.03297, 1.23516, 1.23516, 1.23516, 1.23516, 0.82601, 1.07692, 1.07692, 0.90918, 0.90918, 1, 0.90918, 1.03297, 1.03297, 0.92578, 0.90452, 1, 1.11842, 0.85284, 0.90747, 1, 0.91133, 0.85284, 1.09231, 1.0336, 1.11429, 1, 0.95897, 0.71353, 1, 1, 0.85284, 1, 0.95424, 0.85284, 1, 1, 0.94469, 0.94469, 0.95877, 0.94469, 1, 0.91133, 1, 0.90747, 0.94469, 0.89746, 0.89552, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90016, 0.93695, 0.9482, 0.9482, 0.9482, 0.89181, 0.89181, 0.9482, 0.9482, 0.91133, 0.79801, 0.80504, 0.76288, 0.99862, 1.08707, 1.15642, 0.69825, 0.86651, 0.86651, 0.9482, 0.94469, 1.09091, 0.91056, 0.91056, 1.07806, 0.80395, 0.90861, 1.03809, 0.84286, 1.00452, 0.80113, 0.85284, 0.90747, 0.97094, 0.99247, 0.94469, 0.83319, 0.75859, 1.1293, 1.2566, 1.2566, 1.2566, 1.12308, 1.12308, 1.12308, 1.12308, 1.15601, 1.04692, 1.04692, 0.90747, 1.04692, 1, 0.68787, 0.85284, 0.89442, 0.96334, 1, 0.78223, 0.78223, 0.78223, 0.78223, 0.78223, 1, 1, 0.89552, 0.91133, 0.774, 1, 0.86155, 0.85208, 0.91133, 1.39016, 1, 1, 0.91133, 0.7589, 1, 1.20562, 0.98022, 1.23023, 0.92188, 1, 0.9561, 0.94469, 0.91133, 0.84426, 0.80972, 1.35191, 0.95161, 0.70508, 1, 1, 1, 1, 0.91133, 0.94469, 0.94469, 0.94469, 0.94469, 0.94469, 0.94469, 0.94469, 0.94469, 0.89552, 0.90186, 1, 1, 1.0088, 1.0044, 1, 0.739, 0.79776, 1.20562, 1, 0.96309, 0.73206, 0.88844, 0.89464, 0.96766, 1, 1, 1.4956, 1.07185, 0.99413, 0.96334, 1.08065, 0.99331, 1, 1, 2.01462, 1, 1, 1, 1, 1.05859, 1.05859, 0.94469, 1, 0.99018, 0.99018, 0.99018, 0.99018, 0.94469, 0.94469, 0.90332, 0.98986, 0.98986, 0.98986, 0.98986, 0.98986, 0.86621, 0.83969, 0.90527, 0.90527, 0.90527, 0.90527, 0.91133, 0.90527, 0.79004, 0.79004, 0.79004, 0.79004, 0.91133, 0.78848]; +exports.CalibriRegularFactors = CalibriRegularFactors; +const CalibriRegularLineHeight = 1.2207; +exports.CalibriRegularLineHeight = CalibriRegularLineHeight; + +/***/ }), +/* 57 */ +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.HelveticaRegularLineHeight = exports.HelveticaRegularFactors = exports.HelveticaItalicLineHeight = exports.HelveticaItalicFactors = exports.HelveticaBoldLineHeight = exports.HelveticaBoldItalicLineHeight = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0; +const HelveticaBoldFactors = [0.76116, 1, 0.99977, 1, 1, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 0.99977, 0.99977, 0.99977, 0.85148, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.9998, 1.00001, 1.00001, 0.99997, 0.99977, 1.00026, 0.99977, 0.99973, 1.00026, 1.00022, 0.99988, 1.00022, 1.00022, 1.00022, 1.00022, 0.99977, 0.99999, 0.99861, 0.99861, 1, 0.99977, 0.99977, 1.0006, 1.00042, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00078, 1.0006, 0.99973, 0.99973, 0.99977, 0.99977, 0.99977, 1.00026, 1.00026, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 0.99999, 0.99999, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00022, 1, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1, 1.00013, 1.00022, 1.00036, 1.00022, 1.00022, 1.00022, 1.00001, 1.00024, 0.99977, 0.9999, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 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.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99984, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00022, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 0.99973, 0.99977, 0.99977, 1.00001, 1.00016, 1.00016, 1.00016, 1.00016, 1.00016, 1.00001, 1.00069, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 0.99982, 0.99982, 1, 0.99977, 1.00035, 0.99977, 1.00019, 0.99944, 1.00001, 1.00008, 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, 1.00038, 0.99971, 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047, 1, 0.99942, 0.99989, 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 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, 1.0005, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911, 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 0.99973, 1.00035, 1, 0.99999, 1, 0.99971, 1.00047, 1.00023, 0.99973, 1.00041, 1.00041, 0.99973, 0.99977, 1, 0.99973, 1.00031, 0.99973, 0.99973, 1, 1, 1, 1, 1, 1, 1, 1.00003, 1.00003, 0.99959, 0.9999, 0.99973, 1.00026, 1.0006, 1.00077, 0.99942, 1.41144, 0.99959, 0.99959, 0.99998, 0.99998, 0.99998, 1, 1.00077, 0.99972, 0.99973, 0.99973, 0.99998, 1, 1, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 0.99973, 1.00055, 0.99999, 0.99998, 1, 0.99962, 0.99998, 1.0006, 1, 1, 1.00025, 0.99973, 1, 1.00026, 0.99973, 0.99973, 1.03374, 1.00026, 1.00024, 0.99927, 0.9995, 0.99998, 1, 1.00034, 1.06409, 1.36625, 1.41144, 0.99973, 0.99998, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 1, 0.99973, 1.00026, 0.99973, 1.00082, 0.99962, 1.00003, 0.99915, 0.99984, 1.00026, 1.00026, 1.00026, 0.99998, 0.99999, 0.99998, 0.99998, 1, 0.99999, 1, 0.99973, 1.00002, 0.99998, 0.99973, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99998, 1, 1.00003, 1.00031, 0.99973, 0.99973, 0.99998, 0.99998, 1.00026, 1.00026, 1.00026, 1.00042, 0.99999, 0.99998, 1, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 1.0006, 1.00015, 1.00027, 0.99999, 0.99999, 0.99561, 0.99999, 0.99999, 0.99977, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 1.00069, 0.99973, 0.99973, 1.0006, 1.0006, 0.99973, 1.03828, 1.0006, 0.99999, 1.00003, 1.00031, 1.41144, 0.99973, 1.00003, 1.0006, 0.99972, 1.0006, 1.40579, 0.99982, 0.60299, 1, 1, 1.00003, 1.00106, 0.99867, 1.00003, 1, 1, 1.00026, 1.00026, 0.9993, 1.00026, 1.00026, 0.99973, 1, 1.00031, 1.00026, 0.99973, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00016, 0.99998, 1.00026, 1.00026, 1.00026, 1.00032, 1.00032, 1.00026, 1.00026, 0.99973, 1.00002, 1.00002, 1.00002, 1.40483, 0.99968, 0.99936, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99998, 0.99998, 0.99972, 0.99982, 1.0006, 1, 1.00023, 0.99954, 1.00049, 1.00003, 1.06409, 1.20985, 0.99945, 1.00026, 1.00026, 1.00026, 0.99974, 1, 1, 1, 1.0006, 1.0006, 1.0006, 1.0006, 1.00087, 0.99959, 0.99959, 1.00031, 0.99959, 0.99959, 1.00025, 1.00003, 1.00056, 0.99998, 1.41144, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99999, 0.99973, 0.99973, 1.00002, 0.99998, 1.40579, 0.99988, 1, 0.99973, 1.0006, 1, 0.99953, 0.99973, 1.39713, 1.00054, 0.99998, 0.99935, 0.99998, 0.8121, 0.99998, 1.00087, 1.00026, 0.99973, 1.00002, 1.00002, 0.99998, 1, 0.99998, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99955, 1.0006, 0.99998, 1, 1, 1, 1, 1.00026, 0.99998, 0.99998, 1, 1.00001, 0.99561, 0.99973, 1.00041, 1, 1, 0.99998, 1, 0.99991, 1, 1.66475, 1.0006, 1, 1, 1, 1, 1.00026, 1.41144, 0.99995, 0.99995, 0.99995, 0.99995, 1.00026, 1.00026, 0.99973, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 0.99973, 0.9993, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1, 1, 1, 1, 0.99973, 0.99902]; +exports.HelveticaBoldFactors = HelveticaBoldFactors; +const HelveticaBoldLineHeight = 1.2; +exports.HelveticaBoldLineHeight = HelveticaBoldLineHeight; +const HelveticaBoldItalicFactors = [0.76116, 1, 0.99977, 1, 1, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 0.99977, 0.99977, 0.99977, 0.91155, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.9998, 1.00001, 1.00001, 1, 0.99977, 1.00026, 0.99977, 0.99973, 1.00026, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 0.99977, 0.99999, 0.99861, 0.99861, 1, 0.99977, 0.99977, 1.0006, 0.99971, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99969, 1.0006, 0.99973, 0.99973, 0.99977, 0.99977, 0.99977, 1.00026, 1.00026, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 0.99999, 0.99999, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00022, 1, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1, 0.9998, 1.00022, 0.99972, 1.00022, 1.00022, 1.00022, 1.00001, 0.99968, 1.00032, 1.00047, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 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.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99944, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00022, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 0.99981, 0.99977, 0.99977, 1.00001, 1.00016, 1.00016, 1.00016, 1.00016, 1.00016, 1.00001, 0.99966, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 0.99982, 0.99982, 1, 0.99977, 0.99999, 0.99977, 1.00038, 0.99977, 1.00001, 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.99966, 1.00029, 1.00038, 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057, 0.99989, 0.99964, 0.99973, 0.99977, 0.99999, 1.00058, 0.99973, 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, 1.00044, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006, 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.99973, 0.99967, 1, 1.00026, 1, 0.99971, 0.99978, 1, 0.99973, 0.99981, 0.99981, 0.99973, 0.99977, 1, 0.99973, 1.00031, 0.99973, 0.99973, 1.00049, 1, 1.00098, 1, 1, 1, 1, 1.00003, 1.00003, 0.99959, 0.9999, 0.99973, 1.00026, 1.0006, 1.00077, 1.00064, 1.41144, 0.99959, 0.99959, 0.99998, 0.99998, 0.99998, 1, 1.00077, 0.99972, 0.99973, 0.99973, 0.99998, 1, 1, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 0.99973, 1.00063, 0.99999, 0.99998, 1, 0.99962, 0.99998, 1.0006, 1, 1, 1.00025, 0.99973, 1, 1.00026, 0.99973, 0.99973, 1.0044, 1.00026, 1.00024, 0.99942, 0.9995, 0.99998, 1, 0.99998, 1.06409, 1.36625, 1.41144, 0.99973, 0.99998, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 1, 0.99973, 1.00026, 0.99973, 1.00101, 1.00101, 1.00003, 0.99915, 0.99984, 1.00026, 1.00026, 1.00026, 0.99998, 0.99999, 0.99998, 0.99998, 1, 0.99999, 1, 0.99973, 1.00002, 0.99998, 0.99973, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99998, 1, 1.00003, 1.00031, 0.99973, 0.99973, 0.99998, 0.99998, 1.00026, 1.00026, 1.00026, 1.00042, 0.99999, 0.99998, 1, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 1.0006, 1.00015, 1.00027, 0.99999, 0.99999, 0.99561, 0.99999, 0.99999, 0.99977, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 1.00014, 0.99973, 0.99973, 1.0006, 1.0006, 0.99973, 1.01011, 1.0006, 0.99999, 1.00003, 1.00031, 1.41144, 0.99973, 1.00003, 1.0006, 0.99972, 1.0006, 1.40579, 0.99982, 0.60299, 1, 1, 1.00003, 1.00106, 1.01322, 1.00003, 1, 1, 1.00026, 1.00026, 0.9993, 1.00026, 1.00026, 0.99973, 1, 1.00031, 1.00026, 0.99973, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00016, 0.99998, 1.00026, 1.00026, 1.00026, 0.99943, 0.99943, 1.00026, 1.00026, 0.99973, 1.00002, 1.00002, 1.00002, 1.40483, 0.99968, 0.99936, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99998, 0.99998, 0.99972, 0.99982, 1.0006, 1, 1, 1.00055, 1.00012, 1.00003, 1.06409, 1.20985, 1.00007, 1.00026, 1.00026, 1.00026, 0.99974, 1, 1, 1, 1.0006, 1.0006, 1.0006, 1.0006, 1.00087, 0.99959, 0.99959, 1.00031, 0.99959, 0.99959, 1.00025, 1.00003, 0.99923, 0.99998, 1.41144, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99999, 0.99973, 0.99973, 1.00002, 0.99998, 1.40579, 1.00064, 1, 0.99973, 1.0006, 1, 0.99953, 0.99973, 1.39713, 1.00054, 0.99998, 1.00076, 0.99998, 0.8121, 0.99998, 1.00069, 1.00026, 0.99973, 1.00002, 1.00002, 0.99998, 1, 0.99998, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99955, 1.0006, 0.99998, 1, 1, 1, 1, 1.00026, 0.99998, 0.99998, 1, 1.00001, 0.99967, 0.99973, 0.98685, 1, 1, 0.99998, 1, 0.99991, 1, 1.66475, 1.0006, 1, 1, 1, 1, 1.00026, 1.41144, 0.99948, 0.99948, 0.99948, 0.99948, 1.00026, 1.00026, 0.99973, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 0.99973, 1.00065, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1, 1, 1, 1, 0.99973, 1.00061]; +exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors; +const HelveticaBoldItalicLineHeight = 1.35; +exports.HelveticaBoldItalicLineHeight = HelveticaBoldItalicLineHeight; +const HelveticaItalicFactors = [0.76116, 1, 1.00001, 1, 1, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 0.99977, 0.99977, 0.99977, 0.91221, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.9998, 1.00001, 1.00001, 1.00054, 0.99977, 0.99977, 0.99977, 0.99973, 1.00026, 1.00022, 0.99945, 1.00022, 1.00022, 1.00022, 1.00022, 0.99977, 0.99999, 0.99861, 0.99861, 1, 0.99977, 0.99977, 1.0006, 0.99946, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00084, 1.0006, 1, 1, 1.00001, 1.00001, 1.00001, 0.99973, 0.99973, 1.00001, 0.99973, 0.99973, 0.99973, 0.99973, 0.99999, 0.99999, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00022, 1, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1, 1.00013, 1.00022, 1.00007, 1.00022, 1.00022, 1.00022, 1.00001, 1.0001, 1.00054, 1.00052, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 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.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00065, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00022, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 0.99973, 0.99977, 0.99977, 1.00001, 1.00016, 1.00016, 1.00016, 1.00016, 1.00016, 1.00001, 0.99933, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 0.99982, 0.99982, 1, 1.00001, 1.00019, 1.00001, 1.0001, 0.99986, 1.00001, 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.99962, 1.00027, 1.0001, 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972, 0.9994, 0.99975, 0.99973, 1.00089, 1.00005, 0.99967, 1.00048, 0.99973, 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.99895, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924, 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 1, 1.00051, 1, 0.99973, 1, 1.00423, 0.99925, 0.99999, 0.99973, 0.99945, 0.99945, 0.99973, 1.00001, 1, 0.99973, 1.00031, 0.99973, 0.99973, 1, 1, 1.00049, 1.00245, 1, 1, 1, 0.99949, 1.00003, 0.99959, 0.99987, 0.99973, 0.99973, 1.0006, 1.0009, 0.99949, 1.41144, 1.00005, 1.00005, 1.0006, 1.0006, 0.99998, 1, 1.0009, 0.99972, 1, 1, 0.99998, 1, 1, 1, 1, 1, 1, 0.99998, 0.99973, 1.00019, 0.99999, 0.99998, 1, 0.99962, 1.0006, 1.0006, 1, 1, 1.00025, 0.99973, 1, 0.99973, 0.99973, 0.99973, 1.0288, 0.99973, 1.00024, 1.0006, 0.9995, 0.99998, 1, 0.99998, 1.06409, 1.36625, 1.41144, 0.99973, 0.99998, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99897, 0.99897, 1.00003, 1.00003, 0.99984, 0.99968, 0.99968, 0.99973, 1.0006, 1, 0.99998, 1.0006, 1, 0.99999, 1, 0.99973, 1.00002, 0.99998, 0.99973, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.00026, 0.99998, 1, 1.00003, 1.00031, 0.99973, 0.99973, 0.99998, 0.99998, 0.99973, 0.99973, 0.99973, 1.00042, 0.99999, 0.99998, 1, 0.99924, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00034, 1.0006, 1.00015, 1.00027, 0.99999, 0.99999, 1.00035, 0.99999, 0.99999, 0.99977, 0.99924, 0.99924, 0.99924, 0.99924, 0.99924, 1.0006, 0.99924, 0.99924, 1, 1, 1, 1, 0.99924, 0.99924, 0.99962, 1.06311, 0.99924, 1.00024, 1.00003, 1.00031, 1.41144, 0.99973, 1.00003, 0.99924, 0.95317, 0.99924, 1.40579, 0.99999, 0.60299, 1, 1, 1.00003, 1.00267, 1.01487, 1.00003, 1, 1, 0.99973, 0.99973, 1.00041, 0.99973, 0.99973, 0.99973, 1, 1.00031, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.00016, 0.99998, 0.99973, 0.99973, 0.99973, 1.00025, 1.00025, 0.99973, 0.99973, 0.99973, 1.00002, 1.00002, 1.00002, 1.40483, 0.99968, 0.99936, 1, 1.00026, 1.00026, 0.99973, 0.99973, 0.9998, 0.99998, 0.99998, 0.96329, 0.99982, 1.0006, 1, 1.00023, 0.99947, 1.00012, 1.00003, 1.06409, 1.20985, 1.00063, 0.99973, 0.99973, 1.00026, 1.00006, 0.99998, 0.99998, 0.99998, 0.99924, 0.99924, 0.99924, 0.99924, 1.00043, 0.99998, 0.99998, 0.8254, 0.99998, 0.99998, 1.00025, 1.00003, 1.00043, 0.99998, 1.41144, 1, 1, 1, 1, 1, 1, 0.99999, 0.99973, 0.99973, 1.00002, 0.99998, 1.40579, 0.99995, 1, 0.99973, 1.0006, 1, 0.99953, 0.99973, 1.39713, 1.00054, 1.0006, 0.99994, 1.0006, 0.89547, 1.0006, 0.99911, 0.99973, 0.99973, 1.00002, 1.00002, 0.99998, 1, 0.99998, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99955, 1.0006, 0.99998, 1, 1, 1, 1, 1.00026, 1.0006, 0.99998, 1, 1.00001, 0.99954, 0.99973, 0.98332, 1, 1, 0.99998, 1, 0.99991, 1, 1.66475, 1.0006, 1, 1, 1, 1, 0.99973, 1.41144, 1.00036, 1.00036, 1.00036, 1.00036, 0.99973, 0.99973, 1, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 1.0005, 1, 1, 1, 1, 0.99973, 1, 1, 1, 1, 1, 0.99973, 0.99918]; +exports.HelveticaItalicFactors = HelveticaItalicFactors; +const HelveticaItalicLineHeight = 1.35; +exports.HelveticaItalicLineHeight = HelveticaItalicLineHeight; +const HelveticaRegularFactors = [0.76116, 1, 1.00001, 1, 1, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99928, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 0.99977, 0.99977, 0.99977, 0.91621, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.9998, 1.00001, 1.00001, 0.99977, 0.99977, 1.00013, 0.99977, 0.99973, 1.00026, 1.00022, 1.0004, 1.00022, 1.00022, 1.00022, 1.00022, 0.99977, 0.99999, 0.99861, 0.99861, 1, 0.99977, 0.99977, 1.0006, 1.00019, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00055, 1.0006, 1, 1, 1.00001, 1.00001, 1.00001, 0.99973, 0.99973, 1.00005, 0.99973, 0.99973, 0.99973, 0.99973, 0.99999, 0.99999, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00022, 1, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1, 0.99941, 1.00022, 0.99947, 1.00022, 1.00022, 1.00022, 1.00001, 1.00019, 0.99977, 0.99946, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 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.00001, 1.00001, 1.00001, 1.00001, 1.00001, 0.99973, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00022, 1.00001, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 0.99945, 0.99977, 0.99977, 1.00001, 1.00016, 1.00016, 1.00016, 1.00016, 1.00016, 1.00001, 1.00015, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 0.99973, 0.99982, 0.99982, 1, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964, 1.00001, 0.99928, 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, 1.00047, 1.00029, 1.00092, 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082, 0.9996, 0.99973, 1.00043, 0.99953, 1.0007, 0.99915, 0.99973, 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.99968, 0.99973, 1.0007, 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973, 1.00114, 1, 1.00035, 1, 0.99955, 1, 0.99971, 0.99925, 1.00023, 0.99973, 0.99978, 0.99978, 0.99973, 1.00001, 1, 0.99973, 1.00031, 0.99973, 0.99973, 1, 1, 1, 1, 1, 1, 1, 0.99949, 1.00003, 0.99959, 0.99987, 0.99973, 0.99973, 1.0006, 1.0009, 0.99966, 1.41144, 1.00005, 1.00005, 1.0006, 1.0006, 0.99998, 1.0009, 0.99972, 1, 1, 0.99998, 1, 1, 1, 1, 0.99998, 0.99973, 1.00019, 0.99999, 0.99998, 0.99962, 1.0006, 1.0006, 1.00025, 0.99973, 0.99973, 0.99973, 0.99973, 1.04596, 0.99973, 1.00024, 1.00065, 0.9995, 0.99998, 0.99998, 1.06409, 1.36625, 1.41144, 0.99973, 0.99998, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 0.99973, 0.99973, 0.99973, 1.00045, 1.00045, 1.00003, 0.99915, 0.99984, 0.99973, 0.99973, 0.99973, 1.0006, 1, 0.99998, 1.0006, 1, 0.99999, 1, 0.99973, 1.00002, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.00026, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 1.00003, 1.00031, 0.99973, 0.99973, 0.99998, 0.99998, 0.99973, 0.99973, 0.99973, 1.00042, 0.99999, 0.99998, 0.99924, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00034, 1.0006, 1.00015, 1.00027, 0.99999, 0.99999, 1.00035, 0.99999, 0.99999, 0.99977, 0.99924, 0.99924, 0.99924, 0.99924, 0.99924, 1.0006, 0.99924, 0.99924, 1, 1, 1, 1, 0.99924, 0.99924, 1, 1.02572, 0.99924, 1.00005, 1.00003, 1.00031, 1.41144, 0.99973, 1.00003, 0.99924, 0.95317, 0.99924, 1.40579, 0.99999, 0.60299, 1, 1, 1.00003, 1.00267, 0.96499, 1.00003, 1, 1, 0.99973, 0.99973, 0.99999, 0.99973, 0.99973, 0.99973, 1, 1.00031, 0.99973, 1, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.00016, 0.99998, 0.99973, 0.99973, 0.99973, 1.00031, 1.00031, 0.99973, 0.99973, 0.99973, 1.00002, 1.00002, 1.00002, 1.40483, 0.99968, 0.99936, 1, 1.00026, 1.00026, 0.99973, 0.99973, 0.9998, 0.99998, 0.99998, 0.96329, 0.99982, 1.0006, 1, 1.00023, 0.99933, 1.00008, 1.00003, 1.06409, 1.20985, 1.00015, 0.99973, 0.99973, 1.00026, 1.00006, 0.99998, 0.99998, 0.99998, 0.99924, 0.99924, 0.99924, 0.99924, 1.00043, 0.99998, 0.99998, 0.8254, 0.99998, 0.99998, 1.00025, 1.00003, 1.00027, 0.99998, 1.41144, 1, 1, 1, 1, 1, 1, 0.99999, 0.99973, 0.99973, 1.00002, 1.40579, 0.9997, 1, 0.99973, 1.0006, 1, 0.99953, 0.99973, 1.39713, 1.00054, 1.0006, 0.99995, 1.0006, 0.84533, 1.0006, 0.99973, 0.99973, 0.99973, 1.00002, 1.00002, 0.99998, 0.99998, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99955, 1.0006, 0.99998, 1, 1, 1, 1, 1.00026, 1.0006, 0.99998, 1, 1.00001, 0.99561, 0.99973, 1.00073, 1, 1, 0.99998, 1, 1, 1, 1, 1, 0.99991, 1, 1.66475, 1.0006, 1, 1, 1, 1, 1, 0.99973, 1.41144, 1.00023, 1.00023, 1.00023, 1.00023, 0.99973, 0.99973, 1, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 1.00055, 1, 1, 1, 1, 0.99973, 1, 1, 1, 1, 1, 0.99973, 1.00019]; +exports.HelveticaRegularFactors = HelveticaRegularFactors; +const HelveticaRegularLineHeight = 1.2; +exports.HelveticaRegularLineHeight = HelveticaRegularLineHeight; + +/***/ }), +/* 58 */ +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.LiberationSansRegularWidths = exports.LiberationSansItalicWidths = exports.LiberationSansBoldWidths = exports.LiberationSansBoldItalicWidths = void 0; +const LiberationSansBoldWidths = [365, 0, 722, 1000, 1000, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 722, 722, 722, 719, 667, 667, 667, 667, 667, 667, 667, 667, 667, 723, 667, 667, 853, 722, 906, 722, 556, 611, 778, 601, 778, 778, 778, 778, 722, 604, 354, 354, 604, 722, 722, 278, 785, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 474, 278, 556, 556, 722, 722, 722, 611, 611, 667, 611, 611, 611, 611, 833, 833, 722, 722, 722, 722, 722, 722, 778, 1000, 778, 778, 778, 778, 778, 778, 778, 802, 838, 778, 825, 778, 778, 778, 667, 821, 722, 809, 778, 722, 722, 722, 722, 667, 667, 708, 708, 708, 708, 708, 708, 708, 708, 708, 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, 667, 667, 667, 667, 667, 600, 611, 611, 611, 611, 611, 778, 667, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 667, 927, 722, 722, 667, 944, 944, 944, 944, 944, 667, 644, 667, 667, 667, 667, 667, 611, 611, 611, 611, 611, 556, 556, 556, 556, 333, 333, 556, 889, 889, 1000, 722, 719, 722, 567, 712, 667, 669, 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, 487, 885, 567, 711, 667, 278, 276, 556, 1094, 1062, 875, 610, 622, 556, 618, 615, 417, 635, 556, 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, 447, 611, 417, 552, 556, 278, 281, 278, 969, 906, 611, 500, 556, 719, 778, 604, 611, 885, 489, 1115, 556, 615, 615, 556, 722, 333, 556, 549, 556, 556, 1000, 500, 1000, 1000, 500, 500, 500, 584, 584, 389, 975, 556, 611, 278, 280, 610, 708, 389, 389, 333, 333, 333, 333, 280, 350, 556, 556, 333, 333, 222, 556, 556, 556, 556, 333, 556, 576, 604, 333, 333, 656, 333, 278, 333, 222, 737, 556, 333, 611, 556, 556, 719, 611, 400, 606, 510, 333, 333, 465, 549, 729, 708, 556, 333, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 1000, 556, 1000, 556, 611, 556, 475, 451, 584, 583, 600, 611, 611, 611, 333, 604, 333, 333, 750, 604, 1000, 556, 834, 333, 556, 556, 333, 556, 611, 556, 611, 611, 611, 611, 611, 333, 333, 584, 549, 556, 556, 333, 333, 611, 611, 611, 594, 604, 333, 333, 278, 278, 278, 278, 278, 278, 556, 278, 713, 274, 604, 604, 722, 604, 604, 1052, 278, 278, 278, 278, 278, 278, 278, 278, 556, 558, 556, 556, 278, 278, 556, 385, 278, 479, 584, 549, 708, 556, 584, 278, 494, 278, 708, 889, 552, 750, 333, 584, 240, 612, 584, 500, 750, 611, 611, 708, 611, 611, 556, 333, 549, 611, 556, 556, 611, 611, 611, 611, 611, 944, 333, 611, 611, 611, 845, 845, 611, 611, 556, 834, 834, 834, 354, 370, 365, 979, 611, 611, 611, 611, 556, 333, 333, 494, 889, 278, 1000, 1094, 715, 766, 584, 549, 823, 753, 611, 611, 611, 474, 500, 500, 500, 278, 278, 278, 278, 238, 389, 389, 549, 389, 389, 737, 584, 619, 333, 708, 556, 556, 556, 556, 556, 556, 479, 556, 556, 834, 333, 708, 684, 520, 556, 278, 1021, 531, 556, 713, 917, 333, 446, 333, 479, 333, 541, 611, 556, 834, 834, 333, 333, 333, 1000, 990, 990, 990, 990, 556, 611, 611, 611, 611, 611, 611, 611, 611, 556, 552, 278, 333, 333, 333, 576, 333, 611, 333, 333, 333, 667, 722, 556, 615, 333, 333, 333, 396, 768, 612, 167, 278, 750, 333, 611, 611, 611, 708, 582, 582, 582, 582, 611, 611, 556, 778, 778, 778, 778, 778, 556, 445, 556, 556, 556, 556, 556, 556, 500, 500, 500, 500, 556, 460]; +exports.LiberationSansBoldWidths = LiberationSansBoldWidths; +const LiberationSansBoldItalicWidths = [365, 0, 722, 1000, 1000, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 722, 722, 722, 671, 667, 667, 667, 667, 667, 667, 667, 667, 667, 723, 667, 667, 854, 722, 906, 722, 556, 611, 778, 610, 778, 778, 778, 778, 722, 604, 354, 354, 604, 722, 722, 278, 782, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 473, 278, 556, 556, 722, 722, 722, 611, 611, 667, 611, 611, 611, 611, 833, 833, 722, 722, 722, 722, 722, 722, 778, 1000, 778, 778, 778, 778, 778, 778, 778, 781, 847, 778, 844, 778, 778, 778, 667, 822, 718, 829, 778, 722, 722, 722, 722, 667, 667, 708, 708, 708, 708, 708, 708, 708, 708, 708, 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, 667, 667, 667, 667, 667, 590, 611, 611, 611, 611, 611, 778, 667, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 667, 930, 722, 722, 667, 944, 944, 944, 944, 944, 667, 657, 667, 667, 667, 667, 667, 611, 611, 611, 611, 611, 556, 556, 556, 556, 333, 333, 556, 889, 889, 1000, 722, 708, 722, 614, 722, 667, 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, 575, 886, 614, 719, 667, 278, 278, 556, 1094, 1042, 854, 622, 677, 556, 619, 604, 534, 618, 556, 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, 467, 611, 469, 563, 556, 278, 278, 278, 969, 906, 611, 507, 556, 719, 778, 611, 611, 885, 516, 1146, 556, 620, 620, 556, 722, 333, 556, 549, 556, 556, 1000, 500, 999, 1000, 500, 500, 500, 584, 584, 389, 975, 556, 611, 278, 280, 621, 708, 389, 389, 333, 333, 333, 333, 280, 350, 556, 556, 333, 333, 222, 556, 556, 556, 556, 333, 556, 578, 604, 333, 333, 656, 333, 278, 333, 222, 737, 556, 333, 611, 556, 556, 740, 611, 400, 610, 510, 333, 333, 333, 549, 729, 708, 556, 333, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 1000, 556, 1000, 556, 611, 556, 479, 479, 584, 583, 600, 611, 611, 611, 333, 604, 333, 333, 750, 604, 1000, 556, 834, 333, 556, 556, 333, 556, 611, 556, 611, 611, 611, 611, 611, 333, 333, 584, 549, 556, 556, 333, 333, 611, 611, 611, 594, 604, 333, 333, 278, 278, 278, 278, 278, 278, 556, 278, 713, 274, 604, 604, 722, 604, 604, 1052, 278, 278, 278, 278, 278, 278, 278, 278, 556, 566, 556, 556, 278, 278, 556, 396, 278, 479, 584, 549, 708, 556, 584, 278, 494, 278, 708, 889, 552, 750, 333, 584, 240, 603, 584, 500, 750, 611, 611, 708, 611, 611, 556, 333, 549, 611, 556, 556, 611, 611, 611, 611, 611, 944, 333, 611, 611, 611, 834, 834, 611, 611, 556, 834, 834, 834, 354, 370, 365, 979, 611, 611, 611, 611, 556, 333, 333, 494, 889, 278, 1000, 1104, 704, 712, 584, 549, 823, 773, 611, 611, 611, 474, 500, 500, 500, 278, 278, 278, 278, 238, 389, 389, 549, 389, 389, 737, 584, 605, 333, 708, 556, 556, 556, 556, 556, 556, 479, 556, 556, 834, 333, 708, 664, 532, 556, 278, 1021, 531, 556, 713, 917, 333, 409, 333, 479, 333, 558, 611, 556, 834, 834, 333, 333, 333, 1000, 990, 990, 990, 990, 556, 611, 611, 611, 611, 611, 611, 611, 611, 556, 552, 278, 333, 333, 333, 576, 333, 611, 333, 333, 333, 667, 719, 556, 619, 333, 333, 333, 396, 768, 612, 167, 278, 750, 333, 611, 611, 611, 708, 591, 591, 591, 591, 611, 611, 556, 778, 778, 778, 778, 778, 556, 450, 556, 556, 556, 556, 556, 556, 500, 500, 500, 500, 556, 492]; +exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths; +const LiberationSansItalicWidths = [365, 0, 667, 1000, 1000, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 722, 722, 722, 722, 722, 722, 667, 722, 722, 722, 671, 667, 667, 667, 667, 667, 667, 667, 667, 667, 723, 667, 667, 789, 722, 846, 722, 556, 611, 778, 570, 778, 778, 778, 778, 722, 604, 354, 354, 604, 722, 722, 278, 733, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 389, 278, 500, 500, 667, 667, 667, 556, 556, 667, 556, 556, 556, 556, 833, 833, 722, 722, 722, 722, 722, 722, 778, 1000, 778, 778, 778, 778, 778, 778, 778, 761, 775, 778, 794, 778, 778, 778, 667, 837, 725, 831, 778, 722, 722, 722, 722, 667, 667, 708, 708, 708, 708, 708, 708, 708, 708, 708, 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, 667, 667, 667, 667, 667, 600, 611, 611, 611, 611, 611, 778, 667, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 667, 865, 722, 722, 667, 944, 944, 944, 944, 944, 667, 648, 667, 667, 667, 667, 667, 611, 611, 611, 611, 611, 556, 556, 556, 556, 333, 294, 556, 889, 889, 1000, 667, 651, 667, 544, 704, 667, 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, 492, 843, 544, 708, 667, 278, 278, 500, 1066, 982, 844, 589, 639, 556, 562, 522, 493, 553, 556, 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, 339, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556, 472, 500, 724, 778, 556, 556, 885, 323, 1083, 556, 570, 570, 556, 667, 278, 556, 549, 556, 556, 1000, 500, 1000, 998, 500, 500, 500, 469, 584, 389, 1015, 556, 556, 278, 260, 571, 708, 334, 334, 278, 278, 333, 285, 260, 350, 500, 500, 333, 324, 222, 500, 500, 500, 500, 333, 556, 546, 604, 333, 324, 656, 278, 278, 333, 222, 737, 556, 333, 556, 556, 556, 625, 556, 400, 556, 510, 333, 316, 333, 549, 729, 708, 556, 333, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 1000, 556, 1000, 556, 556, 556, 439, 439, 584, 584, 600, 555, 555, 556, 278, 500, 333, 278, 750, 604, 1000, 556, 834, 333, 556, 556, 333, 556, 556, 500, 556, 556, 556, 556, 611, 333, 294, 584, 549, 556, 556, 333, 333, 556, 556, 556, 594, 604, 333, 398, 222, 278, 278, 278, 278, 278, 444, 278, 713, 274, 604, 604, 719, 604, 604, 1052, 222, 222, 222, 222, 222, 278, 222, 222, 500, 500, 500, 500, 222, 222, 492, 281, 222, 400, 584, 549, 708, 556, 584, 222, 494, 222, 708, 833, 552, 750, 333, 584, 188, 548, 584, 500, 750, 556, 556, 615, 556, 556, 556, 333, 549, 556, 500, 556, 556, 556, 556, 556, 556, 944, 333, 556, 556, 556, 779, 779, 556, 556, 556, 834, 834, 834, 354, 370, 365, 979, 611, 611, 556, 556, 537, 333, 333, 494, 889, 278, 1000, 1094, 652, 670, 584, 549, 823, 728, 556, 556, 611, 355, 333, 333, 333, 222, 222, 222, 222, 191, 333, 333, 549, 333, 333, 737, 584, 573, 333, 708, 500, 500, 500, 500, 500, 500, 354, 556, 556, 834, 333, 708, 603, 486, 556, 278, 1021, 531, 556, 713, 917, 278, 374, 278, 354, 278, 542, 556, 556, 834, 834, 333, 328, 333, 1000, 990, 990, 990, 990, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 552, 278, 333, 333, 333, 576, 333, 611, 278, 333, 278, 667, 715, 556, 565, 333, 333, 333, 365, 768, 612, 167, 278, 750, 333, 500, 500, 556, 708, 550, 550, 550, 550, 556, 556, 500, 722, 722, 722, 722, 722, 500, 447, 500, 500, 500, 500, 556, 500, 500, 500, 500, 500, 556, 463]; +exports.LiberationSansItalicWidths = LiberationSansItalicWidths; +const LiberationSansRegularWidths = [365, 0, 667, 1000, 1000, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 722, 722, 722, 722, 722, 722, 667, 722, 722, 722, 668, 667, 667, 667, 667, 667, 667, 667, 667, 667, 723, 667, 667, 784, 722, 838, 722, 556, 611, 778, 551, 778, 778, 778, 778, 722, 604, 354, 354, 604, 722, 722, 278, 735, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 384, 278, 500, 500, 667, 667, 667, 556, 556, 668, 556, 556, 556, 556, 833, 833, 722, 722, 722, 722, 722, 722, 778, 1000, 778, 778, 778, 778, 778, 778, 778, 748, 752, 778, 774, 778, 778, 778, 667, 798, 722, 835, 778, 722, 722, 722, 722, 667, 667, 708, 708, 708, 708, 708, 708, 708, 708, 708, 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, 667, 667, 667, 667, 667, 618, 611, 611, 611, 611, 611, 778, 667, 722, 722, 722, 722, 722, 722, 722, 722, 722, 667, 667, 855, 722, 722, 667, 944, 944, 944, 944, 944, 667, 650, 667, 667, 667, 667, 667, 611, 611, 611, 611, 611, 556, 556, 556, 556, 333, 556, 889, 889, 1000, 667, 656, 667, 542, 677, 667, 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, 489, 865, 542, 719, 667, 278, 278, 500, 1057, 1010, 854, 583, 635, 556, 573, 531, 365, 583, 556, 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, 411, 556, 365, 510, 500, 222, 278, 222, 906, 812, 556, 438, 500, 719, 778, 552, 556, 885, 323, 1073, 556, 578, 578, 556, 667, 278, 556, 549, 556, 556, 1000, 500, 1000, 1000, 500, 500, 500, 469, 584, 389, 1015, 556, 556, 278, 260, 575, 708, 334, 334, 278, 278, 333, 260, 350, 500, 500, 333, 500, 500, 500, 500, 333, 556, 525, 604, 333, 656, 278, 278, 737, 556, 556, 556, 556, 615, 556, 400, 557, 510, 333, 333, 549, 729, 708, 556, 333, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 1000, 556, 1000, 556, 556, 556, 446, 446, 584, 583, 600, 556, 556, 556, 278, 500, 333, 278, 750, 604, 1000, 556, 834, 556, 556, 556, 556, 500, 556, 556, 556, 556, 611, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285, 333, 584, 549, 556, 556, 333, 333, 556, 556, 556, 594, 604, 333, 222, 278, 278, 278, 278, 278, 444, 278, 713, 274, 604, 604, 719, 604, 604, 1052, 222, 222, 222, 222, 222, 278, 222, 222, 500, 500, 500, 500, 222, 222, 500, 292, 222, 334, 584, 549, 708, 556, 584, 222, 494, 222, 708, 833, 552, 750, 333, 584, 188, 576, 584, 500, 750, 556, 556, 604, 556, 556, 556, 333, 549, 556, 500, 556, 556, 556, 556, 556, 556, 944, 333, 556, 556, 556, 781, 781, 556, 556, 556, 834, 834, 834, 354, 370, 365, 979, 611, 611, 556, 556, 537, 333, 333, 494, 889, 278, 1000, 1094, 648, 690, 584, 549, 823, 713, 556, 556, 611, 355, 333, 333, 333, 222, 222, 222, 222, 191, 333, 333, 549, 333, 333, 737, 584, 569, 333, 708, 500, 500, 500, 500, 500, 500, 354, 556, 556, 834, 708, 617, 482, 556, 278, 1021, 531, 556, 713, 917, 278, 395, 278, 375, 278, 556, 556, 556, 834, 834, 333, 333, 1000, 990, 990, 990, 990, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 552, 278, 333, 333, 333, 576, 333, 611, 278, 333, 278, 667, 722, 556, 559, 333, 333, 333, 333, 333, 333, 333, 365, 768, 612, 167, 278, 750, 333, 333, 500, 500, 556, 708, 547, 547, 547, 547, 556, 556, 500, 722, 722, 722, 722, 722, 500, 448, 500, 500, 500, 500, 556, 500, 500, 500, 500, 500, 556, 441]; +exports.LiberationSansRegularWidths = LiberationSansRegularWidths; + +/***/ }), +/* 59 */ +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.MyriadProRegularLineHeight = exports.MyriadProRegularFactors = exports.MyriadProItalicLineHeight = exports.MyriadProItalicFactors = exports.MyriadProBoldLineHeight = exports.MyriadProBoldItalicLineHeight = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0; +const MyriadProBoldFactors = [1.36898, 1, 0.90838, 0.868, 0.868, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.91945, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.83637, 0.83637, 0.82391, 0.82391, 0.82391, 0.82391, 0.82391, 0.82391, 0.91905, 0.96376, 0.96376, 0.97484, 0.90157, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.80061, 0.95417, 0.80061, 0.80061, 0.75261, 0.95407, 0.87992, 0.97484, 0.99793, 0.86275, 0.8768, 0.8019, 0.8768, 0.8768, 1, 0.8768, 0.95407, 1, 1, 1, 1, 0.97069, 0.95407, 1.0258, 0.887, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 1.0258, 0.82976, 1.0258, 0.73901, 0.73901, 0.85022, 0.85022, 1, 0.83655, 0.83655, 0.97153, 0.83655, 1, 0.83655, 0.84638, 1.0156, 1.0156, 0.95546, 0.95546, 0.95546, 1, 0.95546, 0.95546, 0.92179, 0.936, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 0.92796, 0.97268, 0.92179, 0.96034, 0.92179, 0.92179, 0.92179, 0.87107, 0.95638, 0.92361, 0.91709, 0.92179, 0.82114, 0.82114, 0.82114, 1, 0.87107, 0.8096, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.8096, 0.8096, 1, 0.8096, 1, 0.96318, 0.89713, 0.89713, 0.89713, 0.89713, 1, 0.92436, 0.86958, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.94438, 0.93704, 0.93704, 0.83689, 0.94438, 0.94438, 0.95353, 0.94083, 0.94083, 0.94083, 0.94083, 0.94083, 0.91905, 0.89192, 0.90406, 0.90406, 0.90406, 0.90406, 0.90406, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 0.94938, 0.94938, 0.94938, 0.94938, 0.90088, 1, 0.94938, 0.9031, 0.9031, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.94938, 0.94836, 0.94836, 0.94938, 0.93884, 0.83181, 0.94938, 1.08595, 0.94938, 0.94938, 1, 1, 1, 1, 1, 1, 1, 1.02058, 1.02058, 1.16661, 0.78966, 0.94938, 0.97898, 1.18777, 1.01149, 0.96174, 1, 0.80687, 0.80687, 0.94292, 0.94292, 0.90088, 1, 1.01149, 0.96544, 0.81093, 0.81093, 0.90088, 1, 1, 0.81093, 0.81093, 0.81093, 0.81093, 0.90088, 0.99793, 0.87548, 1, 0.90088, 1, 1, 0.78076, 0.93582, 1, 1, 0.91882, 0.99793, 1, 0.97571, 0.94219, 0.94219, 0.84313, 0.97571, 0.89022, 0.9498, 1, 0.90088, 1, 0.9358, 1.08595, 1, 1, 0.99793, 0.90088, 0.98621, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.99793, 1, 1, 0.94938, 1, 0.89903, 0.95933, 0.94938, 0.98607, 1.0373, 1.02058, 1, 1.36145, 0.95933, 0.95933, 0.93969, 0.80479, 1, 0.80479, 1.024, 1, 1, 1, 0.99793, 1, 1, 0.99793, 0.99793, 1, 1, 0.9577, 0.92601, 0.9577, 0.9577, 1, 0.9577, 0.98225, 0.90088, 1, 1.02058, 1.08595, 0.8361, 0.8361, 0.81079, 0.81079, 0.95933, 0.95933, 0.95933, 1, 1, 0.90088, 1, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 1.01591, 0.98621, 1.05486, 1.30692, 1, 1, 1, 1, 1, 1, 0.98621, 1.0078, 1.0078, 1.0078, 1.0078, 0.98621, 1.0474, 1.0474, 0.97455, 0.98275, 1, 0.97455, 0.98981, 0.98981, 0.9314, 0.73977, 1, 0.73903, 1.02058, 1.08595, 1, 1, 1.02058, 1, 1.16161, 1.033, 1, 0.9672, 0.54324, 1, 1, 1.02058, 1, 0.95617, 1.02058, 1, 1, 0.95933, 0.95933, 0.8271, 0.95933, 1, 0.99793, 1, 1.08595, 0.95933, 0.91701, 0.98894, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 0.91964, 0.90088, 0.9446, 0.9446, 0.9446, 0.86774, 0.86774, 0.9446, 0.9446, 0.99793, 1, 0.99642, 0.99642, 1, 1.0213, 1.05686, 1, 0.9446, 0.9446, 0.9446, 0.97898, 0.97455, 0.94292, 0.94292, 1.17173, 0.9897, 0.93582, 1.285, 1, 0.99394, 0.78367, 1.02058, 1.08595, 0.80535, 0.96361, 0.97407, 0.72851, 0.72851, 0.83734, 0.918, 0.908, 0.908, 0.93582, 1, 0.93582, 0.93582, 0.86209, 0.97646, 0.97646, 1.0732, 0.97646, 1, 0.62295, 1, 0.9553, 0.90088, 1, 0.78036, 0.78036, 0.78036, 1, 0.78036, 1, 1, 1.00872, 0.99793, 1, 1, 1, 0.86832, 1, 0.99793, 1.19137, 1, 1, 0.99793, 0.76169, 1, 1.10208, 1.0128, 1.10208, 0.77452, 1, 1.05453, 0.97898, 0.99793, 1, 0.99642, 0.90088, 1, 0.90989, 0.65, 1, 1, 1, 1, 0.99793, 0.95442, 0.95442, 0.95442, 0.95442, 0.95442, 0.95442, 0.95442, 0.95442, 0.89903, 1, 0.72706, 0.96694, 1, 1, 1, 1, 0.89713, 1.10208, 0.90088, 0.78076, 1, 1, 1, 1, 0.96694, 1, 1, 1, 1, 1, 0.74854, 0.93582, 1, 1, 1, 1, 0.95442, 1, 0.95871, 0.95871, 0.95871, 0.95871, 0.95442, 0.95442, 0.95298, 0.97579, 0.97579, 0.97579, 0.97579, 0.97579, 0.9332, 1.05993, 0.94039, 0.94039, 0.94039, 0.94039, 0.99793, 0.94039, 0.938, 0.938, 0.938, 0.938, 0.99793, 0.95776]; +exports.MyriadProBoldFactors = MyriadProBoldFactors; +const MyriadProBoldLineHeight = 1.2; +exports.MyriadProBoldLineHeight = MyriadProBoldLineHeight; +const MyriadProBoldItalicFactors = [1.36898, 1, 0.85576, 0.845, 0.845, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.80591, 0.80591, 0.80729, 0.80729, 0.80729, 0.80729, 0.80729, 0.80729, 0.85308, 0.94299, 0.94299, 0.95961, 0.94729, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.92098, 0.77512, 0.77512, 0.66862, 0.92222, 0.7927, 0.95961, 0.97276, 0.83655, 0.86523, 0.7805, 0.86523, 0.86523, 1, 0.86523, 0.92222, 1, 1, 1, 1, 0.92222, 0.92222, 0.98621, 0.86036, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.98621, 0.69323, 0.98621, 0.71743, 0.71743, 0.81698, 0.81698, 1, 0.79726, 0.79726, 0.92655, 0.79726, 1, 0.79726, 0.81691, 0.98558, 0.98558, 0.92222, 0.92222, 0.92222, 1, 0.92222, 0.92222, 0.90637, 0.909, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 0.92346, 0.89711, 0.90637, 0.88127, 0.90251, 0.90251, 0.90637, 0.83809, 0.93157, 0.90976, 0.83392, 0.90637, 0.80729, 0.80729, 0.80729, 1, 0.83809, 0.76463, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.76463, 0.76463, 1, 0.76463, 1, 0.94523, 0.86275, 0.86275, 0.86275, 0.86275, 1, 0.90637, 0.83659, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.90699, 0.83509, 0.83509, 0.72459, 0.90699, 0.90699, 0.91605, 0.9154, 0.9154, 0.9154, 0.9154, 0.9154, 0.85308, 0.85359, 0.85458, 0.85458, 0.85458, 0.85458, 0.85458, 0.90531, 0.90531, 0.90531, 0.90531, 0.90531, 0.99613, 0.99613, 0.99613, 0.99613, 1.18616, 1, 0.99613, 0.85811, 0.85811, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.99613, 0.92886, 0.92886, 0.99613, 0.92222, 0.80178, 0.99613, 1.08595, 0.99613, 0.99613, 1, 1, 1, 1, 1, 1, 1, 1.02058, 1.02058, 1.16148, 0.76813, 0.99613, 0.91677, 1.21296, 0.8578, 0.90557, 1, 0.80687, 0.80687, 0.94292, 0.94292, 1.18616, 1, 0.8578, 0.95973, 0.78216, 0.78216, 1.18616, 1, 1, 0.78216, 0.78216, 0.78216, 0.78216, 1.18616, 0.97276, 0.81539, 1, 1.18616, 1, 1, 0.78076, 0.93582, 1, 1, 0.91339, 0.97276, 1, 0.91677, 0.9332, 0.9332, 0.76783, 0.91677, 0.89022, 0.90276, 1, 1.18616, 1, 1.30628, 1.08595, 1, 1, 0.97276, 1.18616, 0.95381, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.97276, 1, 1, 0.90083, 1, 0.89903, 0.92168, 0.90083, 0.91324, 0.91324, 1.02058, 1, 1.36145, 0.92168, 0.92168, 0.9135, 0.80779, 1, 0.80779, 0.98796, 1, 1, 1, 0.97276, 1, 1, 0.97276, 0.97276, 1, 1, 0.9135, 0.86847, 0.9135, 0.9135, 1, 0.9135, 0.94951, 1.18616, 1, 1.02058, 1.08595, 0.82891, 0.82711, 0.80479, 0.80178, 0.92168, 0.92168, 0.92168, 1, 1, 1.18616, 1, 0.95381, 0.95381, 0.95381, 0.95381, 0.95381, 0.95381, 0.97096, 0.95381, 1.05486, 1.23026, 1, 1, 1, 1, 1, 1, 0.95381, 0.95381, 0.95381, 0.95381, 0.95381, 0.95381, 0.98981, 0.98981, 0.95298, 0.9224, 1, 0.95298, 0.95381, 0.95381, 0.85408, 0.6894, 1, 0.74321, 1.02058, 1.08595, 1, 1, 1.02058, 1, 1.20006, 1.0006, 1, 0.93459, 0.71526, 1, 1, 1.02058, 1, 0.92699, 1.02058, 1, 1, 0.92168, 0.92168, 0.79464, 0.92168, 1, 0.97276, 1, 1.08595, 0.92168, 0.86847, 0.97276, 0.91513, 0.91513, 0.91513, 0.91513, 0.91513, 0.87514, 1.18616, 0.91513, 0.91513, 0.91513, 0.85923, 0.85923, 0.91513, 0.91513, 0.97276, 1, 0.99043, 0.99043, 1, 1.08074, 1.04864, 1, 0.91677, 0.91677, 0.91513, 0.92004, 0.96736, 0.94292, 0.94292, 1.14542, 0.97733, 0.93582, 1.26, 1, 0.97355, 0.80487, 1.02058, 1.08595, 0.79199, 0.89398, 0.91677, 0.71541, 0.71541, 0.81625, 0.896, 0.896, 0.896, 0.91782, 1, 0.91782, 0.91782, 0.83266, 0.95077, 0.95077, 1.03493, 0.95077, 1, 0.55509, 1, 0.93481, 1.18616, 1, 0.748, 0.748, 0.748, 1, 0.748, 1, 1, 0.99973, 0.97276, 1, 1, 1, 0.88159, 1, 0.97276, 1.17337, 1, 1, 0.97276, 0.78694, 1, 1.04502, 1.05214, 1.04502, 0.72651, 1, 0.99531, 0.92332, 0.97276, 1, 0.99043, 1.18616, 1, 1.00899, 0.698, 1, 1, 1, 1, 0.97276, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.89903, 1, 0.66227, 0.96694, 1, 1, 1, 1, 0.86275, 1.04502, 1.18616, 0.78076, 1, 1, 1, 1, 0.96694, 1, 1, 1, 1, 1, 0.85633, 0.93582, 1, 1, 1, 1, 0.91677, 1, 0.90646, 0.90646, 0.90646, 0.90646, 0.91677, 0.91677, 0.92061, 0.94236, 0.94236, 0.94236, 0.94236, 0.94236, 0.89544, 1.0051, 0.89364, 0.89364, 0.89364, 0.89364, 0.97276, 0.89364, 0.9, 0.9, 0.9, 0.9, 0.97276, 0.86842]; +exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors; +const MyriadProBoldItalicLineHeight = 1.2; +exports.MyriadProBoldItalicLineHeight = MyriadProBoldItalicLineHeight; +const MyriadProItalicFactors = [1.36898, 1, 0.85158, 0.773, 0.773, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.77812, 0.77812, 0.76852, 0.76852, 0.76852, 0.76852, 0.76852, 0.76852, 0.78112, 0.89591, 0.89591, 0.90561, 0.88836, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.70466, 0.87396, 0.70466, 0.70466, 0.62264, 0.86822, 0.7646, 0.90561, 0.88465, 0.76125, 0.80094, 0.76449, 0.80094, 0.80094, 1, 0.80094, 0.86822, 1, 1, 1, 1, 0.86822, 0.86822, 0.83864, 0.81402, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.83864, 0.65351, 0.83864, 0.728, 0.728, 0.77212, 0.77212, 1, 0.79475, 0.79475, 0.85308, 0.79475, 1, 0.79475, 0.80553, 0.93637, 0.93637, 0.87514, 0.87514, 0.87514, 1, 0.87514, 0.87514, 0.8588, 0.867, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 0.89386, 0.89947, 0.8588, 0.86026, 0.85751, 0.85751, 0.8588, 0.76013, 0.82565, 0.85701, 0.77899, 0.8588, 0.72421, 0.72421, 0.72421, 1, 0.76013, 0.69866, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.69866, 0.69866, 1, 0.69866, 1, 0.89058, 0.77598, 0.77598, 0.77598, 0.77598, 1, 0.8588, 0.76013, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.85991, 0.8156, 0.8156, 0.69461, 0.85991, 0.85991, 0.80811, 0.87832, 0.87832, 0.87832, 0.87832, 0.87832, 0.78112, 0.82352, 0.77512, 0.77512, 0.77512, 0.77512, 0.77512, 0.8562, 0.8562, 0.8562, 0.8562, 0.8562, 0.93859, 0.93859, 0.93859, 0.93859, 1.15012, 1, 0.93859, 0.8075, 0.8075, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.93859, 0.9486, 0.9486, 0.93859, 0.88307, 0.77025, 0.93859, 1.08595, 0.93859, 0.93859, 1, 1, 1, 1, 1, 1, 1, 1.27014, 1.02058, 1.06383, 0.70926, 0.93859, 0.94399, 1.18417, 0.83537, 0.93298, 1, 0.85034, 0.85034, 1.0222, 1.0222, 1.15012, 1, 0.83537, 0.79121, 0.846, 0.846, 1.15012, 1, 1, 0.846, 0.846, 0.846, 0.846, 1.15012, 0.88465, 0.77487, 1, 1.15012, 1, 1, 0.75945, 0.75945, 1, 1, 0.9161, 0.88465, 1, 0.94399, 0.86847, 0.86847, 0.8544, 0.94399, 0.79519, 0.93942, 1, 1.15012, 1, 1.03901, 1.08595, 1, 1, 0.88465, 1.15012, 0.82424, 0.81453, 0.81453, 0.81453, 0.81453, 0.81453, 0.81453, 0.81453, 0.81453, 0.88465, 1, 1, 0.81453, 1, 0.89903, 0.96017, 0.81453, 0.92388, 0.92388, 1.02058, 1, 1.36145, 0.96186, 0.96186, 0.9278, 0.84943, 1, 0.70869, 1.0186, 1, 1, 1, 0.88465, 1, 1, 0.88465, 0.88465, 1, 1, 0.94219, 0.878, 0.94219, 0.94219, 1, 0.94219, 0.88075, 1.15012, 1, 1.02058, 1.08595, 0.73541, 0.73361, 0.73572, 0.73572, 0.96017, 0.96017, 0.96017, 1, 1, 1.15012, 1, 1.03075, 0.82424, 0.82424, 0.82424, 0.82424, 0.82424, 1.02738, 0.82424, 1.02119, 1.06233, 1, 1, 1, 1, 1, 1, 1.03075, 1.03075, 1.03075, 1.03075, 1.03075, 0.82424, 1.02175, 1.02175, 0.912, 0.922, 1, 0.912, 1.03075, 1.03075, 0.88787, 0.83911, 1, 0.66266, 1.02058, 1.08595, 1, 1, 1.02058, 1, 1.05233, 1.06676, 1, 0.96998, 0.69353, 1, 1, 1.02058, 1, 0.95829, 1.02058, 1, 1, 0.96017, 0.96017, 0.86865, 0.96017, 1, 0.88465, 1, 1.08595, 0.96017, 0.88, 0.88465, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.84759, 1.15012, 0.93859, 0.93859, 0.93859, 0.86799, 0.86799, 0.93859, 0.93859, 0.88465, 1, 0.9005, 0.9005, 1, 0.94565, 0.9446, 1, 0.8562, 0.8562, 0.93859, 0.94399, 0.91974, 0.85283, 0.85283, 1.04828, 0.86936, 0.75945, 1.124, 1, 0.93969, 0.78815, 1.02058, 1.08595, 0.74948, 0.85769, 0.94399, 0.69046, 0.62864, 0.85639, 1.027, 1.027, 1.027, 0.87321, 1, 0.87321, 0.87321, 0.86948, 0.95493, 0.95493, 0.98391, 0.95493, 1, 0.53609, 1, 0.93758, 1.15313, 1, 0.746, 0.746, 0.746, 1, 0.746, 1, 1, 0.90083, 0.88465, 1, 1, 1, 0.89217, 1, 0.88465, 1.17337, 1, 1, 0.88465, 0.75187, 1, 1.12658, 1.03737, 1.12658, 0.88417, 1, 0.95119, 0.94578, 0.88465, 1, 0.9005, 1.15012, 1, 1.08106, 0.669, 1, 1, 1, 1, 0.88465, 0.94578, 0.94578, 0.94578, 0.94578, 0.94578, 0.94578, 0.94578, 0.94578, 0.89903, 1, 0.65507, 0.9219, 1, 1, 1, 1, 0.77598, 1.12658, 1.15012, 0.75945, 1, 1, 1, 1, 0.9219, 1, 1, 1, 1, 1, 0.85034, 0.75945, 1, 1, 1, 1, 0.94578, 1, 0.91123, 0.91123, 0.91123, 0.91123, 0.94578, 0.94578, 0.91, 0.979, 0.979, 0.979, 0.979, 0.979, 0.882, 0.93559, 0.882, 0.882, 0.882, 0.882, 0.88465, 0.882, 0.83, 0.83, 0.83, 0.83, 0.88465, 0.84596]; +exports.MyriadProItalicFactors = MyriadProItalicFactors; +const MyriadProItalicLineHeight = 1.2; +exports.MyriadProItalicLineHeight = MyriadProItalicLineHeight; +const MyriadProRegularFactors = [1.36898, 1, 0.91755, 0.788, 0.788, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.92138, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.8126, 0.8126, 0.80314, 0.80314, 0.80314, 0.80314, 0.80314, 0.80314, 0.85608, 0.92222, 0.92222, 0.92915, 0.92819, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.73764, 0.90991, 0.73764, 0.73764, 0.7154, 0.90284, 0.86169, 0.92915, 0.92241, 0.79726, 0.83051, 0.81884, 0.83051, 0.83051, 1, 0.83051, 0.90284, 1, 1, 1, 1, 0.90976, 0.90284, 0.86023, 0.82873, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.86023, 0.80513, 0.86023, 0.74, 0.74, 0.8126, 0.8126, 1, 0.84869, 0.84869, 0.91172, 0.84869, 1, 0.84869, 0.85588, 0.96518, 0.96518, 0.91115, 0.91115, 0.91115, 1, 0.91115, 0.91115, 0.8858, 0.894, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 0.94307, 0.98612, 0.8858, 0.94007, 0.8858, 0.8858, 0.8858, 0.79761, 0.89992, 0.87791, 0.81992, 0.8858, 0.74498, 0.74498, 0.74498, 1, 0.79761, 0.73914, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.73914, 0.73914, 1, 0.73914, 1, 0.89297, 0.81363, 0.81363, 0.81363, 0.81363, 1, 0.8858, 0.79611, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.89591, 0.88157, 0.88157, 0.82528, 0.89591, 0.89591, 0.83659, 0.89633, 0.89633, 0.89633, 0.89633, 0.89633, 0.85608, 0.83089, 0.8111, 0.8111, 0.8111, 0.8111, 0.8111, 0.90531, 0.90531, 0.90531, 0.90531, 0.90531, 0.86667, 0.86667, 0.86667, 0.86667, 0.90088, 0.86667, 0.86936, 0.86936, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.86667, 0.95308, 0.95308, 0.86667, 0.90706, 0.78105, 0.86667, 1.08595, 0.86667, 0.86667, 1, 1, 1, 1, 1, 1, 1, 1.27014, 1.02058, 1.0664, 0.72601, 0.86667, 1.0231, 1.22736, 0.92006, 0.97358, 1, 0.85034, 0.85034, 1.0222, 1.0222, 0.90088, 0.92006, 0.80549, 0.896, 0.896, 0.90088, 0.896, 0.896, 0.896, 0.896, 0.90088, 0.92241, 0.87064, 1, 0.90088, 1, 0.74505, 0.74505, 0.91882, 0.92241, 1.01411, 0.89903, 0.89903, 0.93372, 1.01411, 0.79519, 0.98088, 1, 0.90088, 1.03901, 1.08595, 1, 1, 0.92241, 0.90088, 0.84224, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.90083, 0.92241, 1, 0.90083, 1, 0.89903, 0.99793, 0.90083, 0.98699, 0.98699, 1.02058, 1, 1.36145, 0.99793, 0.99793, 0.97276, 0.82784, 1, 0.69067, 1.05099, 1, 1, 1, 0.92241, 1, 0.92241, 0.92241, 1, 1.00512, 0.928, 1.00512, 1.00512, 1, 1.00512, 0.89713, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90088, 1.02058, 1.08595, 0.75339, 0.75339, 0.76575, 0.76575, 0.99793, 0.99793, 0.99793, 1, 1, 0.90088, 1.05326, 0.84224, 0.84224, 0.84224, 0.84224, 0.84224, 1.07469, 0.84224, 1.02119, 1.1536, 1, 1, 1, 1, 1, 1, 1.05326, 1.06226, 1.06226, 1.06226, 1.06226, 0.84224, 1.09377, 1.09377, 0.938, 0.986, 1, 0.938, 1.06226, 1.06226, 0.944, 0.83704, 1, 0.81441, 1.02058, 1.08595, 1, 1, 1.02058, 1, 1.05638, 1.08927, 1, 1.00119, 0.54324, 1, 1, 1.02058, 1, 0.95978, 1.02058, 1, 1, 0.99793, 0.99793, 0.91887, 0.99793, 1, 0.92241, 1, 1.08595, 0.99793, 0.938, 0.89364, 0.98714, 0.98714, 0.98714, 0.98714, 0.98714, 0.91434, 0.90088, 0.98714, 0.98714, 0.98714, 0.88888, 0.88888, 0.98714, 0.98714, 0.92241, 1, 0.91009, 0.91009, 1, 0.93484, 0.97198, 1, 0.89876, 0.89876, 0.98714, 1.0231, 0.95325, 0.85283, 0.85283, 1.07257, 0.89073, 0.74505, 1.156, 1, 0.99007, 0.80442, 1.02058, 1.08595, 0.74705, 0.91879, 1.01231, 0.73002, 0.66466, 0.94935, 1.06904, 1.06304, 1.06304, 0.93173, 1, 0.93173, 0.93173, 0.98472, 0.98196, 0.98196, 1.024, 0.98196, 1, 0.56866, 1, 0.98972, 0.90088, 1, 0.792, 0.792, 0.792, 1, 0.792, 1, 1, 0.9332, 0.92241, 1, 1, 0.89762, 1, 0.92241, 1.23456, 1, 1, 0.92241, 0.71119, 1, 1.19137, 1.04552, 1.19137, 0.904, 1, 0.96017, 1.0231, 0.92241, 1, 0.91009, 0.90088, 0.90388, 0.619, 1, 1, 1, 1, 0.92241, 0.99074, 0.99074, 0.99074, 0.99074, 0.99074, 0.99074, 0.99074, 0.99074, 0.89903, 1, 0.76305, 0.9219, 1, 1, 1, 1, 0.81363, 1.19137, 0.90088, 0.74505, 1, 1, 1, 1, 0.9219, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.72458, 0.74505, 1, 1, 1, 1, 1, 0.99074, 1, 0.95817, 0.95817, 0.95817, 0.95817, 0.99074, 0.99074, 0.962, 1.01915, 1.01915, 1.01915, 1.01915, 1.01915, 0.926, 0.96705, 0.942, 0.942, 0.942, 0.942, 0.92241, 0.942, 0.856, 0.856, 0.856, 0.856, 0.92241, 0.92761]; +exports.MyriadProRegularFactors = MyriadProRegularFactors; +const MyriadProRegularLineHeight = 1.2; +exports.MyriadProRegularLineHeight = MyriadProRegularLineHeight; + +/***/ }), +/* 60 */ +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.SegoeuiRegularLineHeight = exports.SegoeuiRegularFactors = exports.SegoeuiItalicLineHeight = exports.SegoeuiItalicFactors = exports.SegoeuiBoldLineHeight = exports.SegoeuiBoldItalicLineHeight = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0; +const SegoeuiBoldFactors = [1.76738, 1, 0.97363, 0.93506, 0.93506, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 1.01149, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.88776, 0.88776, 0.8641, 0.8641, 0.8641, 0.8641, 0.8641, 0.8641, 0.98243, 1.02096, 1.02096, 1.02096, 0.97826, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 0.79795, 1.09251, 0.79795, 0.79795, 0.7676, 1.06085, 0.98167, 1.02096, 1.03424, 0.85132, 0.914, 0.85134, 0.914, 0.914, 1, 0.914, 1.06085, 1, 0.99862, 0.99862, 1, 1.06085, 1.06085, 1.1406, 0.97138, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.01134, 1.1406, 0.8007, 0.8007, 0.89858, 0.89858, 1, 0.83693, 0.83693, 1.0388, 0.83693, 1, 0.83693, 0.83693, 1.14889, 1.14889, 1.09398, 1.09398, 1.09398, 1, 1.09398, 1.09398, 0.97489, 0.93994, 0.97426, 0.97489, 0.97426, 0.97426, 0.97426, 0.97489, 0.97489, 0.95493, 1.03089, 0.97489, 1.02546, 0.97489, 0.97489, 0.97426, 0.92094, 0.99346, 1.0595, 1.02112, 0.97489, 0.90399, 0.90399, 0.90399, 1, 0.92094, 0.84041, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.84041, 0.84041, 0.84041, 0.84041, 1, 0.94793, 0.95923, 0.95923, 0.95923, 0.95923, 1, 0.97489, 0.92094, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 0.90996, 0.90996, 0.84097, 1.00135, 1.00135, 1, 1.06467, 1.06467, 1.06467, 1.06467, 1.06467, 0.98243, 0.86039, 0.90996, 0.90996, 0.90996, 0.90996, 0.90996, 0.99361, 0.99361, 0.99361, 0.99361, 0.99361, 0.96752, 0.96752, 0.96752, 0.96752, 0.91056, 1, 0.96752, 0.93136, 0.93136, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.96752, 1.03574, 1.03574, 0.96752, 1.17647, 0.81525, 0.96752, 1.29004, 0.96752, 0.96752, 0.86182, 0.94434, 0.86279, 0.86279, 0.94434, 1, 1, 1.2107, 1.2107, 1.16939, 0.97847, 0.96752, 1.01519, 1.56942, 1.16579, 1.0192, 1, 0.94856, 0.94856, 1.1085, 1.1085, 1.03959, 1, 1.16579, 1.20642, 0.86304, 0.86304, 1.15103, 1, 1, 0.86304, 0.86304, 0.86304, 0.86304, 0.64663, 1.03424, 0.96268, 1.42603, 1.15103, 1, 1.04315, 0.81378, 0.9754, 1, 1, 1.18622, 1, 1, 1.01359, 0.73047, 0.73047, 1.03057, 1.03517, 0.94994, 1.00886, 1.34163, 1.3871, 1, 0.87815, 1.28826, 1, 1, 1.03424, 0.75953, 1.02285, 0.97278, 0.97278, 0.97278, 0.97278, 0.97278, 0.97278, 0.97278, 0.97278, 1.03424, 1, 0.91211, 0.97278, 1, 0.89903, 0.99041, 0.97278, 0.97531, 1.02597, 1.2107, 1.21172, 1, 1.0008, 1.0008, 0.97122, 0.9824, 0.96039, 0.9824, 1.15103, 1, 1.42603, 1, 1.03424, 1.15749, 1, 1.03424, 1.03424, 1, 0.93503, 1.01359, 1.01932, 1.01359, 1.01359, 1, 1.01359, 1.02798, 0.94282, 1, 1.2107, 1.29004, 1.04478, 1.04478, 1.03372, 1.03372, 0.98561, 1.00879, 0.98561, 1.15296, 1, 1.21994, 1, 1.02285, 1.02285, 1.02285, 1.02285, 1.02285, 1.02285, 1.08692, 1.02285, 1.13973, 2.10339, 1, 1, 0.9716, 1.42603, 1.42603, 1, 1.02285, 1.18102, 1.18102, 1.18102, 1.18102, 1.02285, 1.02285, 1.02285, 1.00527, 1.02277, 1, 1.00527, 1.02285, 1.02285, 0.98683, 0.9455, 1, 0.90418, 1.2107, 1.29004, 1, 1.03424, 1.2107, 1.07733, 1.18874, 1.13005, 1, 1.0302, 0.75155, 1, 1, 1.2107, 1.222, 1.0016, 1.2107, 1, 1, 0.99041, 0.99041, 0.96692, 0.99041, 1, 1.03424, 1, 1.29004, 0.99041, 0.99561, 1.06497, 1.0008, 1, 1.0008, 1, 1, 0.97931, 0.79912, 1, 1.0008, 1.0008, 0.98439, 0.98439, 1.0008, 1.0008, 1.03424, 1.15749, 1.15749, 1.14169, 0.99862, 1.10818, 1.24866, 0.69825, 1.0008, 1.0008, 1, 1.01519, 0.91572, 1.1085, 1.1085, 1.16897, 0.97529, 0.9754, 1.25635, 1.19687, 1.04983, 0.90434, 1.2107, 1.28826, 0.96085, 1.0499, 1.01359, 0.71703, 0.71703, 1.04016, 0.98633, 0.98633, 0.98633, 1.04394, 1.04394, 1.04394, 1.04394, 1.23203, 1.02258, 1.02258, 1.18416, 1.02258, 1, 1.18622, 1, 0.99921, 0.81378, 1, 0.79104, 0.79104, 0.79104, 0.79104, 0.79104, 1, 1.02956, 0.8727, 1.03424, 1.10948, 1, 1, 0.8965, 0.93803, 1.03424, 1.59578, 1, 1.2886, 1.03424, 0.90137, 1, 1.16862, 1.23085, 1.16862, 1.07034, 1, 1.13189, 1.01519, 1.03424, 1.15749, 1.17389, 1.15103, 1, 0.95161, 0.771, 0.87025, 0.87025, 0.87025, 0.87025, 1.03424, 0.99041, 0.99041, 0.99041, 0.99041, 0.99041, 0.99041, 0.99041, 0.99041, 0.74627, 0.75155, 0.99297, 1.21408, 1.21408, 1.21408, 1, 1.18328, 0.95923, 1.16862, 1.01173, 0.81378, 0.79795, 1.09466, 0.97278, 1.02065, 1, 1.21408, 1.24633, 1.12454, 1, 1, 1, 0.9754, 1, 1, 1.09193, 1.09193, 0.99041, 1, 1.06628, 1.06628, 1.06628, 1.06628, 0.99041, 0.99041, 0.97454, 1.02511, 1.02511, 1.02511, 1.02511, 1.02511, 0.99298, 1.07237, 0.96752, 0.96752, 0.96752, 0.96752, 1.03424, 0.96752, 0.95801, 0.95801, 0.95801, 0.95801, 1.03424, 1.0106]; +exports.SegoeuiBoldFactors = SegoeuiBoldFactors; +const SegoeuiBoldLineHeight = 1.33008; +exports.SegoeuiBoldLineHeight = SegoeuiBoldLineHeight; +const SegoeuiBoldItalicFactors = [1.76738, 1, 0.97363, 0.94385, 0.94385, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 1.00811, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.89723, 0.89723, 0.87897, 0.87897, 0.87897, 0.87897, 0.87897, 0.87897, 0.9817, 1.0426, 1.0426, 1.0426, 1.09818, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 0.79429, 1.10466, 0.79429, 0.79429, 0.77702, 1.05815, 0.99137, 1.0426, 1.036, 0.85292, 0.91149, 0.86869, 0.91149, 0.91149, 1, 0.91149, 1.05815, 1, 0.99862, 0.99862, 1, 1.05815, 1.05815, 1.1406, 0.97441, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 1.1406, 0.95253, 1.1406, 0.79631, 0.79631, 0.90128, 0.90128, 1, 0.83853, 0.83853, 1.06662, 0.83853, 1, 0.83853, 0.83853, 1.04396, 1.04396, 1.10615, 1.10615, 1.10615, 1, 1.10615, 1.10615, 0.97552, 0.91602, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 0.98999, 1.07205, 0.97552, 1.0347, 0.97552, 0.97552, 0.97552, 0.94436, 1.00356, 1.04694, 1.01945, 0.97552, 0.88641, 0.88641, 0.88641, 1, 0.94436, 0.80527, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.80527, 0.80527, 0.80527, 0.80527, 1, 0.98015, 0.96083, 0.96083, 0.95923, 0.96083, 1, 0.97552, 0.94436, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142, 0.91142, 0.86142, 1.00135, 1.00135, 1, 1.06777, 1.06777, 1.06777, 1.06777, 1.06777, 0.9817, 0.84918, 0.91142, 0.91142, 0.91142, 0.91142, 0.91142, 0.99361, 0.99361, 0.99361, 0.99361, 0.99361, 1.06585, 1.06585, 1.06585, 1.06585, 1.31818, 1, 1.06585, 0.96705, 0.96705, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.06585, 1.04961, 1.04961, 1.06585, 1.10953, 0.83284, 1.06585, 1.29004, 1.06585, 1.06585, 0.86224, 0.94434, 0.86364, 0.86279, 0.94434, 1, 1, 1.21237, 1.21237, 1.16939, 0.97847, 1.06585, 0.97042, 1.57293, 1.16579, 0.99607, 1, 0.95107, 0.95107, 1.11144, 1.11144, 1.31818, 1, 1.16579, 1.20502, 0.83055, 0.83055, 1.31818, 1, 1, 0.83055, 0.83055, 0.83055, 0.83055, 1.31818, 1.036, 0.93491, 1.42603, 1.31818, 1, 1.04315, 0.81378, 0.9754, 1, 1, 1.18754, 1, 1, 0.97042, 0.72959, 0.72959, 1.0033, 0.97042, 0.94994, 1.008, 1.34163, 1.31818, 1, 1.27126, 1.29004, 1, 1, 1.036, 1.31818, 1.14236, 0.93503, 0.93503, 0.93503, 0.93503, 0.93503, 0.93503, 0.93503, 0.93503, 1.036, 1, 0.91406, 0.93503, 1, 0.89903, 0.97922, 0.93503, 0.9898, 0.9898, 1.21237, 1.21339, 1, 1.00639, 1.00639, 0.93125, 1.03959, 0.96039, 1.03959, 1.1261, 1, 1.42603, 1, 1.036, 1.15574, 1, 1.036, 1.036, 1, 0.93327, 0.97042, 1.02897, 0.97042, 0.97042, 1, 0.97042, 0.98721, 1.31818, 1, 1.21237, 1.29004, 1.05356, 1.05356, 1.03372, 1.03372, 0.97922, 0.97922, 0.97922, 1.15296, 1, 1.31818, 1, 1.14236, 1.14236, 1.14236, 1.14236, 1.14236, 1.14236, 1.04302, 1.14236, 1.13904, 2.10339, 1, 1, 0.9716, 1.42603, 1.42603, 1, 1.14236, 1.14236, 1.14236, 1.14236, 1.14236, 1.14236, 0.94552, 1.01582, 1.01054, 1.00518, 1, 1.01054, 1.14236, 1.14236, 0.97981, 1.09125, 1, 0.90418, 1.21237, 1.29004, 1, 1.03336, 1.21237, 1.23199, 1.18775, 1.19508, 1, 1.02471, 0.79487, 1, 1, 1.21237, 1.222, 1.02186, 1.21237, 1, 1, 0.97922, 0.97922, 1.01034, 0.97922, 1, 1.036, 1, 1.29004, 0.97922, 1, 1.02809, 0.94165, 0.94165, 0.94165, 0.94165, 0.94165, 0.91981, 1.31818, 0.94165, 0.94165, 0.94165, 1.00351, 1.00351, 0.94165, 0.94165, 1.036, 1.15574, 1.15574, 1.13934, 0.99862, 1.26781, 1.24866, 0.69825, 0.94165, 0.94165, 0.94165, 0.97042, 0.91484, 1.11144, 1.11144, 1.16798, 0.97639, 0.9754, 1.26514, 1.16541, 1.10687, 0.99314, 1.21237, 1.29004, 0.96085, 1.04232, 0.97042, 0.73541, 0.73541, 1.04016, 0.98633, 0.98633, 0.98633, 1.04745, 1.04394, 1.04745, 1.04745, 1.23203, 1.0276, 1.0276, 1.18416, 1.0276, 1, 1.18622, 1, 0.98387, 1.31818, 1, 0.78929, 0.78929, 0.78929, 0.78929, 0.78929, 1, 1.02956, 0.87357, 1.036, 1.15574, 1, 1, 0.93377, 0.93028, 1.036, 1.59754, 1, 1.2886, 1.036, 0.90068, 1, 1.1261, 1.35125, 1.16862, 1.05403, 1, 1.11121, 0.97042, 1.036, 1.15574, 1.17389, 1.31818, 1, 0.95161, 0.771, 0.87025, 0.87025, 0.87025, 0.87025, 1.036, 0.97922, 0.97922, 0.97922, 0.97922, 0.97922, 0.97922, 0.97922, 0.97922, 0.74627, 0.75155, 0.98946, 1.21261, 1.24047, 1.24047, 1, 1.1349, 0.96083, 1.1261, 1.31818, 0.81378, 0.79429, 1.09097, 0.93503, 0.96609, 1, 1.21261, 1.24633, 1.09125, 1, 1, 1, 0.9754, 1, 1, 1.13269, 1.13269, 0.97922, 1, 1.07514, 1.07514, 1.07514, 1.07514, 0.97922, 0.97922, 0.95874, 1.02197, 1.02197, 1.02197, 1.02197, 1.02197, 0.98507, 1.08578, 0.96752, 0.96752, 0.96752, 0.96752, 1.036, 0.96752, 0.97168, 0.97168, 0.97168, 0.97168, 1.036, 0.95134]; +exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors; +const SegoeuiBoldItalicLineHeight = 1.33008; +exports.SegoeuiBoldItalicLineHeight = SegoeuiBoldItalicLineHeight; +const SegoeuiItalicFactors = [1.76738, 1, 0.94729, 0.85498, 0.85498, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85944, 0.85944, 0.88506, 0.88506, 0.88506, 0.88506, 0.88506, 0.88506, 0.8858, 0.9858, 0.9858, 0.9858, 0.9607, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 0.74817, 1.03849, 0.74817, 0.74817, 0.71022, 0.98039, 0.90883, 0.9858, 0.96927, 0.80016, 0.88449, 0.82791, 0.88449, 0.88449, 1, 0.88449, 0.98039, 1, 0.99862, 0.99862, 1, 0.98039, 0.98039, 0.95782, 0.84421, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.84171, 0.95782, 0.69238, 0.69238, 0.89898, 0.89898, 1, 0.83231, 0.83231, 0.98316, 0.84723, 1, 0.84723, 0.83231, 0.98183, 0.98183, 1.03989, 1.03989, 1.03989, 1, 1.03989, 1.03989, 0.96924, 0.92383, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.01284, 1.05734, 0.96924, 0.99877, 0.96924, 0.96924, 0.96924, 0.86237, 0.90082, 0.97642, 0.97296, 0.96924, 0.80595, 0.80595, 0.80595, 1, 0.86237, 0.74524, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.74524, 0.74524, 0.74524, 0.74524, 1, 0.86075, 0.86091, 0.86091, 0.85771, 0.86091, 1, 0.96924, 0.86237, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089, 0.83089, 0.77596, 0.95402, 0.95402, 0.94143, 0.98448, 0.98448, 0.98448, 0.98448, 0.98448, 0.8858, 0.78614, 0.83089, 0.83089, 0.83089, 0.83089, 0.83089, 0.93285, 0.93285, 0.93285, 0.93285, 0.93285, 0.97454, 0.97454, 0.97454, 0.97454, 1.04839, 1, 0.97454, 0.92916, 0.92916, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.97454, 1.0976, 1.0976, 0.97454, 1.15373, 0.78032, 0.97454, 1.24822, 0.97454, 0.97454, 0.86182, 0.94434, 0.86321, 0.8649, 0.94434, 1, 1, 1.45994, 1.17308, 1.07403, 0.94565, 0.97454, 0.97454, 1.39016, 0.92481, 0.98205, 1, 0.91082, 0.91082, 1.0949, 1.0949, 1.04839, 1, 0.92481, 1.15621, 0.87207, 0.87207, 1.04839, 1, 1, 0.87207, 0.87207, 0.87207, 0.87207, 1.04839, 0.96927, 0.99821, 1.42603, 1.04839, 1, 1.04315, 0.78383, 0.78383, 1, 1, 1.23393, 1, 1, 0.97454, 0.67603, 0.67603, 0.95391, 0.97454, 0.94261, 1.05097, 1.34163, 1.04839, 1, 0.81965, 1.24822, 1, 1, 0.96927, 1.04839, 0.93146, 0.87533, 0.87533, 0.87533, 0.87533, 0.87533, 0.87533, 0.87533, 0.87533, 0.96927, 1, 0.73584, 0.87533, 1, 0.89903, 1.01054, 0.87533, 1.04, 1.04, 1.17308, 1.17308, 1, 1.03342, 1.03342, 0.93854, 1.14763, 0.95996, 0.95748, 1.06151, 1, 1.42603, 1, 0.96927, 1.09836, 1, 0.96927, 0.96927, 1, 0.87709, 0.97454, 1.03809, 0.97454, 0.97454, 1, 0.97454, 0.88409, 1.04839, 1, 1.17308, 1.24822, 0.9245, 0.9245, 0.94868, 0.94868, 1.00176, 1.00176, 1.00176, 1.15296, 1, 1.04839, 1, 1.16484, 0.93146, 0.93146, 0.93146, 0.93146, 0.93146, 1.12761, 0.93146, 1.14589, 1.96791, 1, 1, 0.97622, 1.42603, 1.42603, 1, 1.16484, 1.2, 1.2, 1.2, 1.2, 0.93146, 1.08132, 1.08132, 0.98047, 1.02148, 1, 0.98047, 1.16484, 1.16484, 1.0119, 1.04861, 1, 0.78755, 1.17308, 1.24822, 1, 0.96927, 1.17308, 1.31868, 1.17984, 1.23736, 1, 1.02989, 0.63218, 1, 1, 1.17308, 1.22135, 1.04724, 1.17308, 1, 1, 1.01054, 1.01054, 0.9857, 1.01054, 1, 0.96927, 1, 1.24822, 1.01054, 1.0127, 1.06234, 0.96225, 0.96225, 0.96225, 0.96225, 0.96225, 0.90171, 1.04839, 0.96225, 0.96225, 0.96225, 1.0326, 1.0326, 0.96225, 0.96225, 0.96927, 1.09836, 1.13525, 1.09836, 0.99862, 1.1781, 1.22326, 0.69825, 0.8761, 0.8761, 0.96225, 0.97454, 0.85273, 0.91349, 0.91349, 1.083, 0.92586, 0.78383, 1.21191, 1.01473, 1.11826, 0.8965, 1.17308, 1.24822, 0.91578, 1.0557, 0.97454, 0.77349, 0.70424, 1.05365, 1.12317, 1.12317, 1.12317, 0.94945, 0.94945, 0.94945, 0.94945, 1.18414, 1.06598, 1.06598, 1.18416, 1.06598, 1, 1.20808, 1, 0.97783, 1.04839, 1, 0.79004, 0.79004, 0.79004, 0.79004, 0.79004, 1, 1.06483, 0.80597, 0.96927, 1.01522, 1, 1, 0.94818, 0.93574, 0.96927, 1.42531, 1, 1.2886, 0.96927, 0.86438, 1, 1.16344, 1.30679, 1.16344, 1.02759, 1, 1.05401, 0.97454, 0.96927, 1.09836, 1.15222, 1.04839, 1, 0.81965, 0.77295, 0.87025, 0.87025, 0.87025, 0.87025, 0.96927, 1.00351, 1.00351, 1.00351, 1.00351, 1.00351, 1.00351, 1.00351, 1.00351, 0.74627, 0.75155, 0.98946, 1.20088, 1.09971, 1.09971, 1, 1.09971, 0.86091, 1.16344, 1.04839, 0.78383, 0.74817, 1.03754, 0.87533, 0.98705, 1, 1.20088, 1.24633, 1.07497, 1, 1, 1, 0.78032, 1, 1, 1.10742, 1.10742, 1.00351, 1, 1.0675, 1.0675, 1.0675, 1.0675, 1.00351, 1.00351, 0.94629, 0.9973, 0.9973, 0.9973, 0.9973, 0.9973, 0.91016, 1.02732, 0.96777, 0.96777, 0.96777, 0.96777, 0.96927, 0.96777, 0.9043, 0.9043, 0.9043, 0.9043, 0.96927, 0.95364]; +exports.SegoeuiItalicFactors = SegoeuiItalicFactors; +const SegoeuiItalicLineHeight = 1.33008; +exports.SegoeuiItalicLineHeight = SegoeuiItalicLineHeight; +const SegoeuiRegularFactors = [1.76738, 1, 0.96706, 0.86035, 0.86035, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96635, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.85944, 0.85944, 0.85734, 0.85734, 0.85734, 0.85734, 0.85734, 0.85734, 0.88433, 0.97093, 0.97093, 0.97093, 0.96491, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 0.75842, 1.03444, 0.75842, 0.75842, 0.72727, 0.9831, 0.92366, 0.97093, 0.96927, 0.79936, 0.88198, 0.85638, 0.88198, 0.88198, 1, 0.88198, 0.9831, 1, 0.99862, 0.99862, 1, 0.9831, 0.9831, 0.95782, 0.84784, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.95782, 0.98601, 0.95782, 0.71387, 0.71387, 0.86969, 0.86969, 1, 0.84636, 0.84636, 0.94152, 0.84636, 1, 0.84636, 0.84636, 1.07796, 1.07796, 1.03584, 1.03584, 1.03584, 1, 1.03584, 1.03584, 0.96924, 0.93066, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.0098, 1.09799, 0.96924, 1.03405, 0.96924, 0.96924, 0.96924, 0.83968, 0.94492, 0.98715, 0.9287, 0.96924, 0.82826, 0.82826, 0.82826, 1, 0.83968, 0.79649, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.79649, 0.79649, 0.79649, 0.79649, 1, 0.83491, 0.85771, 0.85771, 0.85771, 0.85771, 1, 0.96924, 0.83968, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.95132, 0.8287, 0.8287, 0.77968, 0.95132, 0.95132, 0.93119, 0.98965, 0.98965, 0.98965, 0.98965, 0.98965, 0.88433, 0.78437, 0.8287, 0.8287, 0.8287, 0.8287, 0.8287, 0.93365, 0.93365, 0.93365, 0.93365, 0.93365, 0.91484, 0.91484, 0.91484, 0.91484, 0.84751, 0.91484, 0.93575, 0.93575, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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.91484, 1.0625, 1.0625, 0.91484, 1.19985, 0.78032, 0.91484, 1.24822, 0.91484, 0.91484, 0.86182, 0.94434, 0.86279, 0.86279, 0.94434, 1, 1, 1.45786, 1.1714, 1.07152, 0.94084, 0.91484, 1.05707, 1.3638, 0.92105, 0.95246, 1, 0.90351, 0.90351, 1.08612, 1.08612, 0.91202, 0.92105, 1.16039, 0.92383, 0.92383, 1.11437, 0.92383, 0.92383, 0.92383, 0.92383, 0.61584, 0.96927, 1.02512, 1.42603, 1.11437, 1.04315, 0.78032, 0.78032, 1.20808, 0.99912, 1.05882, 0.67428, 0.67428, 1.0969, 1.05882, 0.94261, 1.04912, 1.34163, 1.2434, 0.81818, 1.24644, 1, 1, 0.96927, 0.60411, 0.8717, 0.9403, 0.9403, 0.9403, 0.9403, 0.9403, 0.9403, 0.9403, 0.9403, 0.96927, 0.73291, 0.9403, 1, 0.89903, 1.01756, 0.9403, 0.98248, 0.98248, 1.1714, 1.17238, 1, 1.03424, 1.03424, 1.00527, 1.02285, 0.95996, 0.85337, 1.12654, 1, 1.42603, 1, 0.96927, 1.11358, 0.96927, 0.96927, 0.87796, 1.05882, 1.03809, 1.05882, 1.05882, 1, 1.05882, 0.89049, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.80499, 1.1714, 1.24822, 0.90957, 0.90957, 0.94868, 0.94868, 1.01756, 1.01756, 1.01756, 1.15296, 1, 0.97361, 1.09011, 0.8717, 0.8717, 0.8717, 0.8717, 0.8717, 1.11551, 0.8717, 1.14589, 1.9697, 1, 1, 0.97622, 1.42603, 1.42603, 1, 1.09011, 1.2, 1.2, 1.2, 1.2, 0.8717, 1.09011, 1.09011, 0.99414, 1.04785, 1, 0.99414, 1.09011, 1.09011, 0.99609, 1.0536, 1, 0.94298, 1.1714, 1.24822, 1, 0.96927, 1.1714, 1.08571, 1.18083, 1.23297, 1, 1.034, 0.75155, 1, 1, 1.1714, 1.22135, 1.00169, 1.1714, 1, 1, 1.01756, 1.01756, 1.00323, 1.01756, 1, 0.96927, 1, 1.24822, 1.01756, 1.05176, 1.06234, 1.05356, 1.05356, 1.05356, 1.05356, 1.05356, 0.98293, 0.55572, 1.05356, 1.05356, 1.05356, 1.03502, 1.03502, 1.05356, 1.05356, 0.96927, 1.10539, 1.11593, 1.08665, 0.99862, 1.05937, 1.17914, 0.69825, 0.95923, 0.95923, 1.05356, 1.05707, 0.85273, 0.90616, 0.90616, 1.083, 0.92037, 0.78032, 1.20996, 1.01518, 1.07831, 0.9087, 1.1714, 1.24644, 0.91578, 1.05205, 1.05882, 0.80597, 0.73381, 1.10454, 1.13196, 1.13196, 1.13196, 1.03077, 1.03077, 1.03077, 1.03077, 1.2046, 1.04399, 1.04399, 1.18416, 1.04399, 1, 1.20808, 1, 1.03004, 0.84164, 1, 0.84863, 0.84863, 0.84863, 0.84863, 0.84863, 1, 1.06483, 0.80597, 0.96927, 1.06967, 1, 0.93117, 0.95542, 0.96927, 1.40246, 1, 1.2886, 0.96927, 0.86507, 1, 1.21968, 1.23362, 1.21968, 1.17318, 1, 1.05443, 1.05707, 0.96927, 1.10539, 1.14169, 1.01173, 0.81818, 0.77295, 0.87025, 0.87025, 0.87025, 0.87025, 0.96927, 1.01756, 1.01756, 1.01756, 1.01756, 1.01756, 1.01756, 1.01756, 1.01756, 0.74627, 0.75155, 0.98594, 1.20088, 1.09971, 1.09971, 1, 1.05425, 0.85771, 1.21968, 0.93109, 0.78032, 0.75842, 1.03719, 0.9403, 1.04021, 1, 1.20088, 1.24633, 1.05425, 1.09971, 1.09971, 1.09971, 1.07497, 1, 1, 1, 0.78032, 1, 1, 1, 1.10938, 1.10938, 1.01756, 1, 1.01071, 1.01071, 1.01071, 1.01071, 1.01756, 1.01756, 0.95801, 1.00068, 1.00068, 1.00068, 1.00068, 1.00068, 0.91797, 0.99346, 0.96777, 0.96777, 0.96777, 0.96777, 0.96927, 0.96777, 0.9043, 0.9043, 0.9043, 0.9043, 0.96927, 1.00221]; +exports.SegoeuiRegularFactors = SegoeuiRegularFactors; +const SegoeuiRegularLineHeight = 1.33008; +exports.SegoeuiRegularLineHeight = SegoeuiRegularLineHeight; + +/***/ }), +/* 61 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -49469,7 +50805,7 @@ class MurmurHash3_64 { exports.MurmurHash3_64 = MurmurHash3_64; /***/ }), -/* 55 */ +/* 62 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -49990,7 +51326,7 @@ class OperatorList { } static get CHUNK_SIZE_ABOUT() { - return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", OperatorList.CHUNK_SIZE - 5); + return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5); } constructor(intent, streamSink) { @@ -49998,7 +51334,7 @@ class OperatorList { this.fnArray = []; this.argsArray = []; - if (streamSink && intent !== "oplist") { + if (streamSink && !(intent && intent.startsWith("oplist-"))) { this.optimizer = new QueueOptimizer(this); } else { this.optimizer = new NullOptimizer(this); @@ -50124,7 +51460,7 @@ class OperatorList { exports.OperatorList = OperatorList; /***/ }), -/* 56 */ +/* 63 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -50542,7 +51878,7 @@ class PDFImage { } output[i] = value; - buf = buf & (1 << remainingBits) - 1; + buf &= (1 << remainingBits) - 1; bits = remainingBits; } } @@ -50797,7 +52133,7 @@ class PDFImage { exports.PDFImage = PDFImage; /***/ }), -/* 57 */ +/* 64 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -50813,17 +52149,17 @@ var _core_utils = __w_pdfjs_require__(9); var _util = __w_pdfjs_require__(2); -var _name_number_tree = __w_pdfjs_require__(58); +var _name_number_tree = __w_pdfjs_require__(65); var _colorspace = __w_pdfjs_require__(14); -var _file_spec = __w_pdfjs_require__(59); +var _file_spec = __w_pdfjs_require__(66); -var _image_utils = __w_pdfjs_require__(51); +var _image_utils = __w_pdfjs_require__(52); -var _metadata_parser = __w_pdfjs_require__(60); +var _metadata_parser = __w_pdfjs_require__(67); -var _struct_tree = __w_pdfjs_require__(62); +var _struct_tree = __w_pdfjs_require__(69); function fetchDestination(dest) { if (dest instanceof _primitives.Dict) { @@ -50845,6 +52181,7 @@ class Catalog { this.fontCache = new _primitives.RefSetCache(); this.builtInCMapCache = new Map(); + this.standardFontDataCache = new Map(); this.globalImageCache = new _image_utils.GlobalImageCache(); this.pageKidsCountCache = new _primitives.RefSetCache(); this.pageIndexCache = new _primitives.RefSetCache(); @@ -51782,6 +53119,26 @@ class Catalog { return (0, _util.shadow)(this, "attachments", attachments); } + get xfaImages() { + const obj = this._catDict.get("Names"); + + let xfaImages = null; + + if (obj instanceof _primitives.Dict && obj.has("XFAImages")) { + const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref); + + for (const [key, value] of nameTree.getAll()) { + if (!xfaImages) { + xfaImages = new _primitives.Dict(this.xref); + } + + xfaImages.set(key, value); + } + } + + return (0, _util.shadow)(this, "xfaImages", xfaImages); + } + _collectJavaScript() { const obj = this._catDict.get("Names"); @@ -51890,6 +53247,7 @@ class Catalog { this.fontCache.clear(); this.builtInCMapCache.clear(); + this.standardFontDataCache.clear(); }); } @@ -52271,7 +53629,7 @@ class Catalog { exports.Catalog = Catalog; /***/ }), -/* 58 */ +/* 65 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -52436,7 +53794,7 @@ class NumberTree extends NameOrNumberTree { exports.NumberTree = NumberTree; /***/ }), -/* 59 */ +/* 66 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -52540,7 +53898,7 @@ class FileSpec { exports.FileSpec = FileSpec; /***/ }), -/* 60 */ +/* 67 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -52550,7 +53908,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.MetadataParser = void 0; -var _xml_parser = __w_pdfjs_require__(61); +var _xml_parser = __w_pdfjs_require__(68); class MetadataParser { constructor(data) { @@ -52679,7 +54037,7 @@ class MetadataParser { exports.MetadataParser = MetadataParser; /***/ }), -/* 61 */ +/* 68 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -53226,7 +54584,7 @@ class SimpleXMLParser extends XMLParserBase { exports.SimpleXMLParser = SimpleXMLParser; /***/ }), -/* 62 */ +/* 69 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -53240,7 +54598,7 @@ var _primitives = __w_pdfjs_require__(5); var _util = __w_pdfjs_require__(2); -var _name_number_tree = __w_pdfjs_require__(58); +var _name_number_tree = __w_pdfjs_require__(65); const MAX_DEPTH = 40; const StructElementType = { @@ -53589,7 +54947,7 @@ class StructTreePage { exports.StructTreePage = StructTreePage; /***/ }), -/* 63 */ +/* 70 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -53737,7 +55095,7 @@ class ObjectLoader { exports.ObjectLoader = ObjectLoader; /***/ }), -/* 64 */ +/* 71 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -53754,9 +55112,9 @@ var _primitives = __w_pdfjs_require__(5); var _core_utils = __w_pdfjs_require__(9); -var _xml_parser = __w_pdfjs_require__(61); +var _xml_parser = __w_pdfjs_require__(68); -var _crypto = __w_pdfjs_require__(65); +var _crypto = __w_pdfjs_require__(72); function writeDict(dict, buffer, transform) { buffer.push("<<"); @@ -53875,13 +55233,7 @@ function computeMD5(filesize, xrefInfo) { return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array)); } -function updateXFA(datasetsRef, newRefs, xref) { - if (datasetsRef === null || xref === null) { - return; - } - - const datasets = xref.fetchIfRef(datasetsRef); - const str = datasets.getString(); +function writeXFADataForAcroform(str, newRefs) { const xml = new _xml_parser.SimpleXMLParser({ hasAttributes: true }).parseFromString(str); @@ -53913,15 +55265,27 @@ function updateXFA(datasetsRef, newRefs, xref) { const buffer = []; xml.documentElement.dump(buffer); - let updatedXml = buffer.join(""); + return buffer.join(""); +} + +function updateXFA(xfaData, datasetsRef, newRefs, xref) { + if (datasetsRef === null || xref === null) { + return; + } + + if (xfaData === null) { + const datasets = xref.fetchIfRef(datasetsRef); + xfaData = writeXFADataForAcroform(datasets.getString(), newRefs); + } + const encrypt = xref.encrypt; if (encrypt) { const transform = encrypt.createCipherTransform(datasetsRef.num, datasetsRef.gen); - updatedXml = transform.encryptString(updatedXml); + xfaData = transform.encryptString(xfaData); } - const data = `${datasetsRef.num} ${datasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${updatedXml.length}>>\nstream\n` + updatedXml + "\nendstream\nendobj\n"; + const data = `${datasetsRef.num} ${datasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n"; newRefs.push({ ref: datasetsRef, data @@ -53933,9 +55297,10 @@ function incrementalUpdate({ xrefInfo, newRefs, xref = null, - datasetsRef = null + datasetsRef = null, + xfaData = null }) { - updateXFA(datasetsRef, newRefs, xref); + updateXFA(xfaData, datasetsRef, newRefs, xref); const newXref = new _primitives.Dict(null); const refForXrefTable = xrefInfo.newRef; let buffer, baseOffset; @@ -54025,7 +55390,7 @@ function incrementalUpdate({ } /***/ }), -/* 65 */ +/* 72 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -54040,7 +55405,7 @@ var _util = __w_pdfjs_require__(2); var _primitives = __w_pdfjs_require__(5); -var _decrypt_stream = __w_pdfjs_require__(66); +var _decrypt_stream = __w_pdfjs_require__(73); class ARCFourCipher { constructor(key) { @@ -54218,7 +55583,7 @@ class Word64 { this.low = 0; } else { this.high = this.high << places | this.low >>> 32 - places; - this.low = this.low << places; + this.low <<= places; } } @@ -54986,7 +56351,7 @@ class AES128Cipher extends AESBaseCipher { t2 = s[t2]; t3 = s[t3]; t4 = s[t4]; - t1 = t1 ^ rcon[i]; + t1 ^= rcon[i]; for (let n = 0; n < 4; ++n) { result[j] = t1 ^= result[j - 16]; @@ -55038,7 +56403,7 @@ class AES256Cipher extends AESBaseCipher { t2 = s[t2]; t3 = s[t3]; t4 = s[t4]; - t1 = t1 ^ r; + t1 ^= r; if ((r <<= 1) >= 256) { r = (r ^ 0x1b) & 0xff; @@ -55618,7 +56983,7 @@ const CipherTransformFactory = function CipherTransformFactoryClosure() { exports.CipherTransformFactory = CipherTransformFactory; /***/ }), -/* 66 */ +/* 73 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -55677,7 +57042,7 @@ class DecryptStream extends _decode_stream.DecodeStream { exports.DecryptStream = DecryptStream; /***/ }), -/* 67 */ +/* 74 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -55687,29 +57052,105 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.XFAFactory = void 0; -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); + +var _bind = __w_pdfjs_require__(79); + +var _data = __w_pdfjs_require__(85); + +var _fonts = __w_pdfjs_require__(83); + +var _utils = __w_pdfjs_require__(76); -var _bind = __w_pdfjs_require__(71); +var _util = __w_pdfjs_require__(2); -var _parser = __w_pdfjs_require__(76); +var _parser = __w_pdfjs_require__(86); class XFAFactory { constructor(data) { try { this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data)); - this.form = new _bind.Binder(this.root).bind(); + const binder = new _bind.Binder(this.root); + this.form = binder.bind(); + this.dataHandler = new _data.DataHandler(this.root, binder.getData()); + this.form[_xfa_object.$globalData].template = this.form; + } catch (e) { + (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`); + } + } + + isValid() { + return this.root && this.form; + } + + _createPages() { + try { this.pages = this.form[_xfa_object.$toHTML](); + this.dims = this.pages.children.map(c => { + const { + width, + height + } = c.attributes.style; + return [0, 0, parseInt(width), parseInt(height)]; + }); } catch (e) { - console.log(e); + (0, _util.warn)(`XFA - an error occurred during layout: ${e}`); } } - getPage(pageIndex) { - return this.pages.children[pageIndex]; + getBoundingBox(pageIndex) { + return this.dims[pageIndex]; } get numberPages() { - return this.pages.children.length; + if (!this.pages) { + this._createPages(); + } + + return this.dims.length; + } + + setImages(images) { + this.form[_xfa_object.$globalData].images = images; + } + + setFonts(fonts) { + this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts); + const missingFonts = []; + + for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) { + typeface = (0, _utils.stripQuotes)(typeface); + + const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface); + + if (!font) { + missingFonts.push(typeface); + } + } + + if (missingFonts.length > 0) { + return missingFonts; + } + + return null; + } + + appendFonts(fonts, reallyMissingFonts) { + this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts); + } + + getPages() { + if (!this.pages) { + this._createPages(); + } + + const pages = this.pages; + this.pages = null; + return pages; + } + + serializeData(storage) { + return this.dataHandler.serialize(storage); } static _createDocument(data) { @@ -55725,7 +57166,7 @@ class XFAFactory { exports.XFAFactory = XFAFactory; /***/ }), -/* 68 */ +/* 75 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -55733,13 +57174,17 @@ exports.XFAFactory = XFAFactory; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject = exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject = exports.$uid = exports.$toStyle = exports.$toHTML = exports.$text = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$resolvePrototypes = exports.$removeChild = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = exports.$nodeName = exports.$namespaceId = exports.$isTransparent = exports.$isDescendent = exports.$isDataValue = exports.$insertAt = exports.$indexOf = exports.$ids = exports.$hasSettableValue = exports.$hasItem = exports.$global = exports.$getRealChildrenByNameIt = exports.$getParent = exports.$getNextPage = exports.$getDataValue = exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributeIt = exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$clean = exports.$childrenToHTML = exports.$break = exports.$appendChild = exports.$addHTML = exports.$acceptWhitespace = void 0; +exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject = exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject = exports.$uid = exports.$toStyle = exports.$toString = exports.$toHTML = exports.$text = exports.$tabIndex = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$root = exports.$resolvePrototypes = exports.$removeChild = exports.$pushGlyphs = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = exports.$nodeName = exports.$namespaceId = exports.$isUsable = exports.$isTransparent = exports.$isThereMoreWidth = exports.$isSplittable = exports.$isNsAgnostic = exports.$isDescendent = exports.$isDataValue = exports.$isCDATAXml = exports.$isBindable = exports.$insertAt = exports.$indexOf = exports.$ids = exports.$hasSettableValue = exports.$globalData = exports.$getTemplateRoot = exports.$getSubformParent = exports.$getRealChildrenByNameIt = exports.$getParent = exports.$getNextPage = exports.$getExtra = exports.$getDataValue = exports.$getContainedChildren = exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributes = exports.$getAttributeIt = exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$cleanPage = exports.$clean = exports.$childrenToHTML = exports.$appendChild = exports.$addHTML = exports.$acceptWhitespace = void 0; -var _utils = __w_pdfjs_require__(69); +var _utils = __w_pdfjs_require__(76); var _util = __w_pdfjs_require__(2); -var _namespaces = __w_pdfjs_require__(70); +var _core_utils = __w_pdfjs_require__(9); + +var _namespaces = __w_pdfjs_require__(77); + +var _som = __w_pdfjs_require__(78); const $acceptWhitespace = Symbol(); exports.$acceptWhitespace = $acceptWhitespace; @@ -55747,12 +57192,12 @@ const $addHTML = Symbol(); exports.$addHTML = $addHTML; const $appendChild = Symbol(); exports.$appendChild = $appendChild; -const $break = Symbol(); -exports.$break = $break; const $childrenToHTML = Symbol(); exports.$childrenToHTML = $childrenToHTML; const $clean = Symbol(); exports.$clean = $clean; +const $cleanPage = Symbol(); +exports.$cleanPage = $cleanPage; const $cleanup = Symbol(); exports.$cleanup = $cleanup; const $clone = Symbol(); @@ -55773,6 +57218,8 @@ const $flushHTML = Symbol(); exports.$flushHTML = $flushHTML; const $getAttributeIt = Symbol(); exports.$getAttributeIt = $getAttributeIt; +const $getAttributes = Symbol(); +exports.$getAttributes = $getAttributes; const $getAvailableSpace = Symbol(); exports.$getAvailableSpace = $getAvailableSpace; const $getChildrenByClass = Symbol(); @@ -55783,18 +57230,24 @@ const $getChildrenByNameIt = Symbol(); exports.$getChildrenByNameIt = $getChildrenByNameIt; const $getDataValue = Symbol(); exports.$getDataValue = $getDataValue; +const $getExtra = Symbol(); +exports.$getExtra = $getExtra; const $getRealChildrenByNameIt = Symbol(); exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt; const $getChildren = Symbol(); exports.$getChildren = $getChildren; +const $getContainedChildren = Symbol(); +exports.$getContainedChildren = $getContainedChildren; const $getNextPage = Symbol(); exports.$getNextPage = $getNextPage; +const $getSubformParent = Symbol(); +exports.$getSubformParent = $getSubformParent; const $getParent = Symbol(); exports.$getParent = $getParent; -const $global = Symbol(); -exports.$global = $global; -const $hasItem = Symbol(); -exports.$hasItem = $hasItem; +const $getTemplateRoot = Symbol(); +exports.$getTemplateRoot = $getTemplateRoot; +const $globalData = Symbol(); +exports.$globalData = $globalData; const $hasSettableValue = Symbol(); exports.$hasSettableValue = $hasSettableValue; const $ids = Symbol(); @@ -55803,12 +57256,24 @@ const $indexOf = Symbol(); exports.$indexOf = $indexOf; const $insertAt = Symbol(); exports.$insertAt = $insertAt; +const $isCDATAXml = Symbol(); +exports.$isCDATAXml = $isCDATAXml; +const $isBindable = Symbol(); +exports.$isBindable = $isBindable; const $isDataValue = Symbol(); exports.$isDataValue = $isDataValue; const $isDescendent = Symbol(); exports.$isDescendent = $isDescendent; +const $isNsAgnostic = Symbol(); +exports.$isNsAgnostic = $isNsAgnostic; +const $isSplittable = Symbol(); +exports.$isSplittable = $isSplittable; +const $isThereMoreWidth = Symbol(); +exports.$isThereMoreWidth = $isThereMoreWidth; const $isTransparent = Symbol(); exports.$isTransparent = $isTransparent; +const $isUsable = Symbol(); +exports.$isUsable = $isUsable; const $lastAttribute = Symbol(); const $namespaceId = Symbol("namespaceId"); exports.$namespaceId = $namespaceId; @@ -55822,8 +57287,12 @@ const $onChildCheck = Symbol(); exports.$onChildCheck = $onChildCheck; const $onText = Symbol(); exports.$onText = $onText; +const $pushGlyphs = Symbol(); +exports.$pushGlyphs = $pushGlyphs; const $removeChild = Symbol(); exports.$removeChild = $removeChild; +const $root = Symbol("root"); +exports.$root = $root; const $resolvePrototypes = Symbol(); exports.$resolvePrototypes = $resolvePrototypes; const $searchNode = Symbol(); @@ -55834,10 +57303,14 @@ const $setSetAttributes = Symbol(); exports.$setSetAttributes = $setSetAttributes; const $setValue = Symbol(); exports.$setValue = $setValue; +const $tabIndex = Symbol(); +exports.$tabIndex = $tabIndex; const $text = Symbol(); exports.$text = $text; const $toHTML = Symbol(); exports.$toHTML = $toHTML; +const $toString = Symbol(); +exports.$toString = $toString; const $toStyle = Symbol(); exports.$toStyle = $toStyle; const $uid = Symbol("uid"); @@ -55871,11 +57344,14 @@ const _options = Symbol(); const _parent = Symbol("parent"); +const _resolvePrototypesHelper = Symbol(); + const _setAttributes = Symbol(); const _validator = Symbol(); let uid = 0; +const NS_DATASETS = _namespaces.NamespaceIds.datasets.id; class XFAObject { constructor(nsId, name, hasChildren = false) { @@ -55885,6 +57361,7 @@ class XFAObject { this[_parent] = null; this[_children] = []; this[$uid] = `${name}${uid++}`; + this[$globalData] = null; } [$onChild](child) { @@ -55926,16 +57403,40 @@ class XFAObject { return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId]; } + [$isNsAgnostic]() { + return false; + } + [$acceptWhitespace]() { return false; } + [$isCDATAXml]() { + return false; + } + + [$isBindable]() { + return false; + } + [$setId](ids) { if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) { ids.set(this.id, this); } } + [$getTemplateRoot]() { + return this[$globalData].template; + } + + [$isSplittable]() { + return false; + } + + [$isThereMoreWidth]() { + return false; + } + [$appendChild](child) { child[_parent] = this; @@ -55967,10 +57468,6 @@ class XFAObject { } } - [$hasItem]() { - return false; - } - [$indexOf](child) { return this[_children].indexOf(child); } @@ -55982,7 +57479,7 @@ class XFAObject { } [$isTransparent]() { - return this.name === ""; + return !this.name; } [$lastAttribute]() { @@ -56033,6 +57530,10 @@ class XFAObject { return this[_parent]; } + [$getSubformParent]() { + return this[$getParent](); + } + [$getChildren](name = null) { if (!name) { return this[_children]; @@ -56077,8 +57578,14 @@ class XFAObject { return _utils.HTMLResult.EMPTY; } - *[_filteredChildrenGenerator](filter, include) { + *[$getContainedChildren]() { for (const node of this[$getChildren]()) { + yield node; + } + } + + *[_filteredChildrenGenerator](filter, include) { + for (const node of this[$getContainedChildren]()) { if (!filter || include === filter.has(node[$nodeName])) { const availableSpace = this[$getAvailableSpace](); const res = node[$toHTML](availableSpace); @@ -56113,7 +57620,7 @@ class XFAObject { const res = this[$extra].failingNode[$toHTML](availableSpace); if (!res.success) { - return false; + return res; } if (res.html) { @@ -56133,7 +57640,7 @@ class XFAObject { const res = gen.value; if (!res.success) { - return false; + return res; } if (res.html) { @@ -56142,13 +57649,11 @@ class XFAObject { } this[$extra].generator = null; - return true; + return _utils.HTMLResult.EMPTY; } [$setSetAttributes](attributes) { - if (attributes.use || attributes.id) { - this[_setAttributes] = new Set(Object.keys(attributes)); - } + this[_setAttributes] = new Set(Object.keys(attributes)); } [_getUnsetAttributes](protoAttributes) { @@ -56159,57 +57664,91 @@ class XFAObject { [$resolvePrototypes](ids, ancestors = new Set()) { for (const child of this[_children]) { - const proto = child[_getPrototype](ids, ancestors); + child[_resolvePrototypesHelper](ids, ancestors); + } + } - if (proto) { - child[_applyPrototype](proto, ids, ancestors); - } else { - child[$resolvePrototypes](ids, ancestors); - } + [_resolvePrototypesHelper](ids, ancestors) { + const proto = this[_getPrototype](ids, ancestors); + + if (proto) { + this[_applyPrototype](proto, ids, ancestors); + } else { + this[$resolvePrototypes](ids, ancestors); } } [_getPrototype](ids, ancestors) { const { - use + use, + usehref } = this; - if (use && use.startsWith("#")) { - const id = use.slice(1); - const proto = ids.get(id); - this.use = ""; + if (!use && !usehref) { + return null; + } - if (!proto) { - (0, _util.warn)(`XFA - Invalid prototype id: ${id}.`); - return null; - } + let proto = null; + let somExpression = null; + let id = null; + let ref = use; - if (proto[$nodeName] !== this[$nodeName]) { - (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`); - return null; - } + if (usehref) { + ref = usehref; - if (ancestors.has(proto)) { - (0, _util.warn)(`XFA - Cycle detected in prototypes use.`); - return null; + if (usehref.startsWith("#som(") && usehref.endsWith(")")) { + somExpression = usehref.slice("#som(".length, usehref.length - 1); + } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) { + somExpression = usehref.slice(".#som(".length, usehref.length - 1); + } else if (usehref.startsWith("#")) { + id = usehref.slice(1); + } else if (usehref.startsWith(".#")) { + id = usehref.slice(2); } + } else if (use.startsWith("#")) { + id = use.slice(1); + } else { + somExpression = use; + } - ancestors.add(proto); + this.use = this.usehref = ""; - const protoProto = proto[_getPrototype](ids, ancestors); + if (id) { + proto = ids.get(id); + } else { + proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false); - if (!protoProto) { - ancestors.delete(proto); - return proto; + if (proto) { + proto = proto[0]; } + } - proto[_applyPrototype](protoProto, ids, ancestors); + if (!proto) { + (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`); + return null; + } - ancestors.delete(proto); - return proto; + if (proto[$nodeName] !== this[$nodeName]) { + (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`); + return null; } - return null; + if (ancestors.has(proto)) { + (0, _util.warn)(`XFA - Cycle detected in prototypes use.`); + return null; + } + + ancestors.add(proto); + + const protoProto = proto[_getPrototype](ids, ancestors); + + if (protoProto) { + proto[_applyPrototype](protoProto, ids, ancestors); + } + + proto[$resolvePrototypes](ids, ancestors); + ancestors.delete(proto); + return proto; } [_applyPrototype](proto, ids, ancestors) { @@ -56243,7 +57782,7 @@ class XFAObject { if (value instanceof XFAObjectArray) { for (const child of value[_children]) { - child[$resolvePrototypes](ids, ancestors); + child[_resolvePrototypesHelper](ids, ancestors); } for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) { @@ -56254,7 +57793,7 @@ class XFAObject { this[_children].push(child); - child[$resolvePrototypes](ids, newAncestors); + child[_resolvePrototypesHelper](ids, ancestors); } else { break; } @@ -56265,6 +57804,11 @@ class XFAObject { if (value !== null) { value[$resolvePrototypes](ids, ancestors); + + if (protoValue) { + value[_applyPrototype](protoValue, ids, ancestors); + } + continue; } @@ -56275,7 +57819,7 @@ class XFAObject { this[_children].push(child); - child[$resolvePrototypes](ids, newAncestors); + child[_resolvePrototypesHelper](ids, ancestors); } } } @@ -56285,7 +57829,7 @@ class XFAObject { return obj.map(x => XFAObject[_cloneAttribute](x)); } - if (obj instanceof Object) { + if (typeof obj === "object" && obj !== null) { return Object.assign({}, obj); } @@ -56303,6 +57847,7 @@ class XFAObject { } } + clone[$uid] = `${clone[$nodeName]}${uid++}`; clone[_children] = []; for (const name of Object.getOwnPropertyNames(this)) { @@ -56434,6 +57979,7 @@ class XFAAttribute { this[$nodeName] = name; this[$content] = value; this[$consumed] = false; + this[$uid] = `attribute${uid++}`; } [$getParent]() { @@ -56444,6 +57990,15 @@ class XFAAttribute { return true; } + [$getDataValue]() { + return this[$content].trim(); + } + + [$setValue](value) { + value = value.value || ""; + this[$content] = value.toString(); + } + [$text]() { return this[$content]; } @@ -56486,6 +58041,51 @@ class XmlObject extends XFAObject { this[$consumed] = false; } + [$toString](buf) { + const tagName = this[$nodeName]; + + if (tagName === "#text") { + buf.push((0, _core_utils.encodeToXmlString)(this[$content])); + return; + } + + const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : ""; + buf.push(`<${prefix}${tagName}`); + + for (const [name, value] of this[_attributes].entries()) { + buf.push(` ${name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`); + } + + if (this[_dataValue] !== null) { + if (this[_dataValue]) { + buf.push(` xfa:dataNode="dataValue"`); + } else { + buf.push(` xfa:dataNode="dataGroup"`); + } + } + + if (!this[$content] && this[_children].length === 0) { + buf.push("/>"); + return; + } + + buf.push(">"); + + if (this[$content]) { + if (typeof this[$content] === "string") { + buf.push((0, _core_utils.encodeToXmlString)(this[$content])); + } else { + this[$content][$toString](buf); + } + } else { + for (const child of this[_children]) { + child[$toString](buf); + } + } + + buf.push(`</${prefix}${tagName}>`); + } + [$onChild](child) { if (this[$content]) { const node = new XmlObject(this[$namespaceId], "#text"); @@ -56530,6 +58130,10 @@ class XmlObject extends XFAObject { return this[_children].filter(c => c[$nodeName] === name); } + [$getAttributes]() { + return this[_attributes]; + } + [$getChildrenByClass](name) { const value = this[_attributes].get(name); @@ -56606,6 +58210,11 @@ class XmlObject extends XFAObject { return this[$content].trim(); } + [$setValue](value) { + value = value.value || ""; + this[$content] = value.toString(); + } + [$dump]() { const dumped = Object.create(null); @@ -56725,8 +58334,8 @@ class Option10 extends IntegerObject { exports.Option10 = Option10; /***/ }), -/* 69 */ -/***/ ((__unused_webpack_module, exports) => { +/* 76 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -56742,7 +58351,11 @@ exports.getMeasurement = getMeasurement; exports.getRatio = getRatio; exports.getRelevant = getRelevant; exports.getStringOption = getStringOption; +exports.stripQuotes = stripQuotes; exports.HTMLResult = void 0; + +var _util = __w_pdfjs_require__(2); + const dimConverters = { pt: x => x, cm: x => x / 2.54 * 72, @@ -56752,6 +58365,14 @@ const dimConverters = { }; const measurementPattern = /([+-]?[0-9]+\.?[0-9]*)(.*)/; +function stripQuotes(str) { + if (str.startsWith("'") || str.startsWith('"')) { + return str.slice(1, str.length - 1); + } + + return str; +} + function getInteger({ data, defaultValue, @@ -56952,24 +58573,39 @@ function getBBox(data) { } class HTMLResult { - constructor(success, html, bbox) { + static get FAILURE() { + return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null)); + } + + static get EMPTY() { + return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null)); + } + + constructor(success, html, bbox, breakNode) { this.success = success; this.html = html; this.bbox = bbox; + this.breakNode = breakNode; + } + + isBreak() { + return !!this.breakNode; + } + + static breakNode(node) { + return new HTMLResult(false, null, null, node); } static success(html, bbox = null) { - return new HTMLResult(true, html, bbox); + return new HTMLResult(true, html, bbox, null); } } exports.HTMLResult = HTMLResult; -HTMLResult.FAILURE = new HTMLResult(false, null, null); -HTMLResult.EMPTY = new HTMLResult(true, null, null); /***/ }), -/* 70 */ +/* 77 */ /***/ ((__unused_webpack_module, exports) => { @@ -57045,7 +58681,351 @@ const NamespaceIds = { exports.NamespaceIds = NamespaceIds; /***/ }), -/* 71 */ +/* 78 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.createDataNode = createDataNode; +exports.searchNode = searchNode; + +var _xfa_object = __w_pdfjs_require__(75); + +var _util = __w_pdfjs_require__(2); + +const namePattern = /^[^.[]+/; +const indexPattern = /^[^\]]+/; +const operators = { + dot: 0, + dotDot: 1, + dotHash: 2, + dotBracket: 3, + dotParen: 4 +}; +const shortcuts = new Map([["$data", (root, current) => root.datasets.data], ["$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]]); +const somCache = new WeakMap(); + +function parseIndex(index) { + index = index.trim(); + + if (index === "*") { + return Infinity; + } + + return parseInt(index, 10) || 0; +} + +function parseExpression(expr, dotDotAllowed, noExpr = true) { + let match = expr.match(namePattern); + + if (!match) { + return null; + } + + let [name] = match; + const parsed = [{ + name, + cacheName: "." + name, + index: 0, + js: null, + formCalc: null, + operator: operators.dot + }]; + let pos = name.length; + + while (pos < expr.length) { + const spos = pos; + const char = expr.charAt(pos++); + + if (char === "[") { + match = expr.slice(pos).match(indexPattern); + + if (!match) { + (0, _util.warn)("XFA - Invalid index in SOM expression"); + return null; + } + + parsed[parsed.length - 1].index = parseIndex(match[0]); + pos += match[0].length + 1; + continue; + } + + let operator; + + switch (expr.charAt(pos)) { + case ".": + if (!dotDotAllowed) { + return null; + } + + pos++; + operator = operators.dotDot; + break; + + case "#": + pos++; + operator = operators.dotHash; + break; + + case "[": + if (noExpr) { + (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now."); + return null; + } + + operator = operators.dotBracket; + break; + + case "(": + if (noExpr) { + (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now."); + return null; + } + + operator = operators.dotParen; + break; + + default: + operator = operators.dot; + break; + } + + match = expr.slice(pos).match(namePattern); + + if (!match) { + break; + } + + [name] = match; + pos += name.length; + parsed.push({ + name, + cacheName: expr.slice(spos, pos), + operator, + index: 0, + js: null, + formCalc: null + }); + } + + return parsed; +} + +function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) { + const parsed = parseExpression(expr, dotDotAllowed); + + if (!parsed) { + return null; + } + + const fn = shortcuts.get(parsed[0].name); + let i = 0; + let isQualified; + + if (fn) { + isQualified = true; + root = [fn(root, container)]; + i = 1; + } else { + isQualified = container === null; + root = [container || root]; + } + + for (let ii = parsed.length; i < ii; i++) { + const { + name, + cacheName, + operator, + index + } = parsed[i]; + const nodes = []; + + for (const node of root) { + if (!(node instanceof _xfa_object.XFAObject)) { + continue; + } + + let children, cached; + + if (useCache) { + cached = somCache.get(node); + + if (!cached) { + cached = new Map(); + somCache.set(node, cached); + } + + children = cached.get(cacheName); + } + + if (!children) { + switch (operator) { + case operators.dot: + children = node[_xfa_object.$getChildrenByName](name, false); + break; + + case operators.dotDot: + children = node[_xfa_object.$getChildrenByName](name, true); + break; + + case operators.dotHash: + children = node[_xfa_object.$getChildrenByClass](name); + + if (children instanceof _xfa_object.XFAObjectArray) { + children = children.children; + } else { + children = [children]; + } + + break; + + default: + break; + } + + if (useCache) { + cached.set(cacheName, children); + } + } + + if (children.length > 0) { + nodes.push(children); + } + } + + if (nodes.length === 0 && !isQualified && i === 0) { + const parent = container[_xfa_object.$getParent](); + + container = parent; + + if (!container) { + return null; + } + + i = -1; + root = [container]; + continue; + } + + if (isFinite(index)) { + root = nodes.filter(node => index < node.length).map(node => node[index]); + } else { + root = nodes.reduce((acc, node) => acc.concat(node), []); + } + } + + if (root.length === 0) { + return null; + } + + return root; +} + +function createNodes(root, path) { + let node = null; + + for (const { + name, + index + } of path) { + for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) { + node = new _xfa_object.XmlObject(root[_xfa_object.$namespaceId], name); + + root[_xfa_object.$appendChild](node); + } + + root = node; + } + + return node; +} + +function createDataNode(root, container, expr) { + const parsed = parseExpression(expr); + + if (!parsed) { + return null; + } + + if (parsed.some(x => x.operator === operators.dotDot)) { + return null; + } + + const fn = shortcuts.get(parsed[0].name); + let i = 0; + + if (fn) { + root = fn(root, container); + i = 1; + } else { + root = container || root; + } + + for (let ii = parsed.length; i < ii; i++) { + const { + name, + operator, + index + } = parsed[i]; + + if (!isFinite(index)) { + parsed[i].index = 0; + return createNodes(root, parsed.slice(i)); + } + + let children; + + switch (operator) { + case operators.dot: + children = root[_xfa_object.$getChildrenByName](name, false); + break; + + case operators.dotDot: + children = root[_xfa_object.$getChildrenByName](name, true); + break; + + case operators.dotHash: + children = root[_xfa_object.$getChildrenByClass](name); + + if (children instanceof _xfa_object.XFAObjectArray) { + children = children.children; + } else { + children = [children]; + } + + break; + + default: + break; + } + + if (children.length === 0) { + return createNodes(root, parsed.slice(i)); + } + + if (index < children.length) { + const child = children[index]; + + if (!(child instanceof _xfa_object.XFAObject)) { + (0, _util.warn)(`XFA - Cannot create a node.`); + return null; + } + + root = child; + } else { + parsed[i].index = index - children.length; + return createNodes(root, parsed.slice(i)); + } + } + + return null; +} + +/***/ }), +/* 79 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -57055,13 +59035,13 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.Binder = void 0; -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); -var _template = __w_pdfjs_require__(72); +var _template = __w_pdfjs_require__(80); -var _som = __w_pdfjs_require__(75); +var _som = __w_pdfjs_require__(78); -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); var _util = __w_pdfjs_require__(2); @@ -57077,13 +59057,12 @@ class Binder { this.datasets = root.datasets; if (root.datasets && root.datasets.data) { - this.emptyMerge = false; this.data = root.datasets.data; } else { - this.emptyMerge = true; this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data"); } + this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0; this.root.form = this.form = root.template[_xfa_object.$clone](); } @@ -57106,26 +59085,22 @@ class Binder { } _bindValue(formNode, data, picture) { + formNode[_xfa_object.$data] = data; + if (formNode[_xfa_object.$hasSettableValue]()) { if (data[_xfa_object.$isDataValue]()) { const value = data[_xfa_object.$getDataValue](); formNode[_xfa_object.$setValue](createText(value)); - - formNode[_xfa_object.$data] = data; } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") { const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n"); formNode[_xfa_object.$setValue](createText(value)); - - formNode[_xfa_object.$data] = data; } else if (this._isConsumeData()) { (0, _util.warn)(`XFA - Nodes haven't the same type.`); } } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) { this._bindElement(formNode, data); - - formNode[_xfa_object.$data] = data; } else { (0, _util.warn)(`XFA - Nodes haven't the same type.`); } @@ -57164,18 +59139,11 @@ class Binder { return null; } - generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, false, false); - - while (true) { - match = generator.next().value; - - if (!match) { - break; - } + generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false); + match = generator.next().value; - if (match[_xfa_object.$global]) { - return match; - } + if (match) { + return match; } generator = this.data[_xfa_object.$getAttributeIt](name, true); @@ -57206,25 +59174,29 @@ class Binder { continue; } - const [node] = (0, _som.searchNode)(this.root, dataNode, ref, false, false); + const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false); - if (!node) { + if (!nodes) { (0, _util.warn)(`XFA - Invalid reference: ${ref}.`); continue; } + const [node] = nodes; + if (!node[_xfa_object.$isDescendent](this.data)) { (0, _util.warn)(`XFA - Invalid node: must be a data node.`); continue; } - const [targetNode] = (0, _som.searchNode)(this.root, formNode, target, false, false); + const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false); - if (!targetNode) { + if (!targetNodes) { (0, _util.warn)(`XFA - Invalid target: ${target}.`); continue; } + const [targetNode] = targetNodes; + if (!targetNode[_xfa_object.$isDescendent](formNode)) { (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`); continue; @@ -57314,25 +59286,29 @@ class Binder { continue; } - const [labelNode] = (0, _som.searchNode)(this.root, node, labelRef, true, false); + const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false); - if (!labelNode) { + if (!labelNodes) { (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`); continue; } + const [labelNode] = labelNodes; + if (!labelNode[_xfa_object.$isDescendent](this.datasets)) { (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`); continue; } - const [valueNode] = (0, _som.searchNode)(this.root, node, valueRef, true, false); + const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false); - if (!valueNode) { + if (!valueNodes) { (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`); continue; } + const [valueNode] = valueNodes; + if (!valueNode[_xfa_object.$isDescendent](this.datasets)) { (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`); continue; @@ -57450,6 +59426,24 @@ class Binder { if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") { this._mergeMode = child.mergeMode === "consumeData"; + + const dataChildren = dataNode[_xfa_object.$getChildren](); + + if (dataChildren.length > 0) { + this._bindOccurrences(child, [dataChildren[0]], null); + } else if (this.emptyMerge) { + const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(dataNode[_xfa_object.$namespaceId], child.name || "root"); + + dataNode[_xfa_object.$appendChild](dataChild); + + this._bindElement(child, dataChild); + } + + continue; + } + + if (!child[_xfa_object.$isBindable]()) { + continue; } let global = false; @@ -57497,11 +59491,17 @@ class Binder { if (match === null) { match = (0, _som.createDataNode)(this.data, dataNode, ref); + if (!match) { + continue; + } + if (this._isConsumeData()) { match[_xfa_object.$consumed] = true; } - match = [match]; + this._bindElement(child, match); + + continue; } else { if (this._isConsumeData()) { match = match.filter(node => !node[_xfa_object.$consumed]); @@ -57542,12 +59542,28 @@ class Binder { match = matches.length > 0 ? matches : null; } else { - match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, false).next().value; + match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value; if (!match) { - match = new _xfa_object.XmlObject(dataNode[_xfa_object.$namespaceId], child.name); + match = child[_xfa_object.$data] = new _xfa_object.XmlObject(dataNode[_xfa_object.$namespaceId], child.name); + + if (this.emptyMerge) { + match[_xfa_object.$consumed] = true; + } dataNode[_xfa_object.$appendChild](match); + + this._setProperties(child, match); + + this._bindItems(child, match); + + this._bindElement(child, match); + + continue; + } + + if (this.emptyMerge) { + match[_xfa_object.$consumed] = true; } match = [match]; @@ -57580,7 +59596,7 @@ class Binder { exports.Binder = Binder; /***/ }), -/* 72 */ +/* 80 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -57590,22 +59606,28 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0; -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _html_utils = __w_pdfjs_require__(73); +var _layout = __w_pdfjs_require__(81); -var _layout = __w_pdfjs_require__(74); +var _html_utils = __w_pdfjs_require__(82); -var _utils = __w_pdfjs_require__(69); +var _utils = __w_pdfjs_require__(76); var _util = __w_pdfjs_require__(2); -var _som = __w_pdfjs_require__(75); +var _som = __w_pdfjs_require__(78); const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id; +const SVG_NS = "http://www.w3.org/2000/svg"; const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2; +const MAX_EMPTY_PAGES = 3; + +function hasMargin(node) { + return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset); +} function _setValue(templateNode, value) { if (!templateNode.value) { @@ -57619,42 +59641,173 @@ function _setValue(templateNode, value) { templateNode.value[_xfa_object.$setValue](value); } -function getRoot(node) { - let parent = node[_xfa_object.$getParent](); +function* getContainedChildren(node) { + for (const child of node[_xfa_object.$getChildren]()) { + if (child instanceof SubformSet) { + yield* child[_xfa_object.$getContainedChildren](); + continue; + } - while (!(parent instanceof Template)) { - parent = parent[_xfa_object.$getParent](); + yield child; } +} + +function setTabIndex(node) { + while (node) { + if (!node.traversal || node[_xfa_object.$tabIndex]) { + return; + } + + let next = null; + + for (const child of node.traversal[_xfa_object.$getChildren]()) { + if (child.operation === "next") { + next = child; + break; + } + } + + if (!next || !next.ref) { + return; + } + + const root = node[_xfa_object.$getTemplateRoot](); - return parent; + node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex]; + + const ref = root[_xfa_object.$searchNode](next.ref, node); + + if (!ref) { + return; + } + + node = ref[0]; + } } -const NOTHING = 0; -const NOSPACE = 1; -const VALID = 2; +function valueToHtml(value) { + return _utils.HTMLResult.success({ + name: "div", + attributes: { + class: ["xfaRich"], + style: Object.create(null) + }, + children: [{ + name: "span", + attributes: { + style: Object.create(null) + }, + value + }] + }); +} -function checkDimensions(node, space) { - if (node.w !== "" && Math.round(node.w + node.x - space.width) > 1) { - const area = getRoot(node)[_xfa_object.$extra].currentContentArea; +function setFirstUnsplittable(node) { + const root = node[_xfa_object.$getTemplateRoot](); + + if (root[_xfa_object.$extra].firstUnsplittable === null) { + root[_xfa_object.$extra].firstUnsplittable = node; + root[_xfa_object.$extra].noLayoutFailure = true; + } +} + +function unsetFirstUnsplittable(node) { + const root = node[_xfa_object.$getTemplateRoot](); + + if (root[_xfa_object.$extra].firstUnsplittable === node) { + root[_xfa_object.$extra].noLayoutFailure = false; + } +} + +function handleBreak(node) { + if (node[_xfa_object.$extra]) { + return false; + } + + node[_xfa_object.$extra] = Object.create(null); - if (node.w + node.x > area.w) { - return NOTHING; + if (node.targetType === "auto") { + return false; + } + + const root = node[_xfa_object.$getTemplateRoot](); + + let target = null; + + if (node.target) { + target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]()); + + if (!target) { + return false; } - return NOSPACE; + target = target[0]; } - if (node.h !== "" && Math.round(node.h + node.y - space.height) > 1) { - const area = getRoot(node)[_xfa_object.$extra].currentContentArea; + const { + currentPageArea, + currentContentArea + } = root[_xfa_object.$extra]; + + if (node.targetType === "pageArea") { + if (!(target instanceof PageArea)) { + target = null; + } - if (node.h + node.y > area.h) { - return NOTHING; + if (node.startNew) { + node[_xfa_object.$extra].target = target || currentPageArea; + return true; + } else if (target && target !== currentPageArea) { + node[_xfa_object.$extra].target = target; + return true; } - return NOSPACE; + return false; + } + + if (!(target instanceof ContentArea)) { + target = null; } - return VALID; + const pageArea = target && target[_xfa_object.$getParent](); + + let index; + + if (node.startNew) { + if (target) { + const contentAreas = pageArea.contentArea.children; + index = contentAreas.findIndex(e => e === target) - 1; + } else { + index = currentPageArea.contentArea.children.findIndex(e => e === currentContentArea); + } + } else if (target && target !== currentContentArea) { + const contentAreas = pageArea.contentArea.children; + index = contentAreas.findIndex(e => e === target) - 1; + } else { + return false; + } + + node[_xfa_object.$extra].target = pageArea === currentPageArea ? null : pageArea; + node[_xfa_object.$extra].index = index; + return true; +} + +function handleOverflow(node, extraNode, space) { + const root = node[_xfa_object.$getTemplateRoot](); + + const saved = root[_xfa_object.$extra].noLayoutFailure; + const savedMethod = extraNode[_xfa_object.$getSubformParent]; + + extraNode[_xfa_object.$getSubformParent] = () => node; + + root[_xfa_object.$extra].noLayoutFailure = true; + + const res = extraNode[_xfa_object.$toHTML](space); + + node[_xfa_object.$addHTML](res.html, res.bbox); + + root[_xfa_object.$extra].noLayoutFailure = saved; + extraNode[_xfa_object.$getSubformParent] = savedMethod; } class AppearanceFilter extends _xfa_object.StringObject { @@ -57694,6 +59847,89 @@ class Arc extends _xfa_object.XFAObject { this.fill = null; } + [_xfa_object.$toHTML]() { + const edge = this.edge ? this.edge : new Edge({}); + + const edgeStyle = edge[_xfa_object.$toStyle](); + + const style = Object.create(null); + + if (this.fill && this.fill.presence === "visible") { + Object.assign(style, this.fill[_xfa_object.$toStyle]()); + } else { + style.fill = "transparent"; + } + + style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0); + style.stroke = edgeStyle.color; + let arc; + const attributes = { + xmlns: SVG_NS, + style: { + width: "100%", + height: "100%", + overflow: "visible" + } + }; + + if (this.startAngle === 0 && this.sweepAngle === 360) { + arc = { + name: "ellipse", + attributes: { + xmlns: SVG_NS, + cx: "50%", + cy: "50%", + rx: "50%", + ry: "50%", + style + } + }; + } else { + const startAngle = this.startAngle * Math.PI / 180; + const sweepAngle = this.sweepAngle * Math.PI / 180; + const largeArc = this.sweepAngle - this.startAngle > 180 ? 1 : 0; + const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(sweepAngle)), 50 * (1 - Math.sin(sweepAngle))]; + arc = { + name: "path", + attributes: { + xmlns: SVG_NS, + d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`, + vectorEffect: "non-scaling-stroke", + style + } + }; + Object.assign(attributes, { + viewBox: "0 0 100 100", + preserveAspectRatio: "none" + }); + } + + const svg = { + name: "svg", + children: [arc], + attributes + }; + + const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); + + if (hasMargin(parent)) { + return _utils.HTMLResult.success({ + name: "div", + attributes: { + style: { + display: "inline", + width: "100%", + height: "100%" + } + }, + children: [svg] + }); + } + + svg.attributes.style.position = "absolute"; + return _utils.HTMLResult.success(svg); + } + } class Area extends _xfa_object.XFAObject { @@ -57722,6 +59958,10 @@ class Area extends _xfa_object.XFAObject { this.subformSet = new _xfa_object.XFAObjectArray(); } + *[_xfa_object.$getContainedChildren]() { + yield* getContainedChildren(this); + } + [_xfa_object.$isTransparent]() { return true; } @@ -57743,9 +59983,13 @@ class Area extends _xfa_object.XFAObject { const attributes = { style, id: this[_xfa_object.$uid], - class: "xfaArea" + class: ["xfaArea"] }; + if ((0, _html_utils.isPrintOnly)(this)) { + attributes.class.push("xfaPrintOnly"); + } + if (this.name) { attributes.xfaName = this.name; } @@ -57758,12 +60002,18 @@ class Area extends _xfa_object.XFAObject { availableSpace }; - if (!this[_xfa_object.$childrenToHTML]({ + const result = this[_xfa_object.$childrenToHTML]({ filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]), include: true - })) { + }); + + if (!result.success) { + if (result.isBreak()) { + return result; + } + delete this[_xfa_object.$extra]; - return _utils.HTMLResult.empty; + return _utils.HTMLResult.FAILURE; } style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width); @@ -57791,6 +60041,10 @@ class Assist extends _xfa_object.XFAObject { this.toolTip = null; } + [_xfa_object.$toHTML]() { + return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null; + } + } class Barcode extends _xfa_object.XFAObject { @@ -57896,7 +60150,7 @@ class BooleanElement extends _xfa_object.Option01 { } [_xfa_object.$toHTML](availableSpace) { - return _utils.HTMLResult.success(this[_xfa_object.$content] === 1); + return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0"); } } @@ -57918,7 +60172,7 @@ class Border extends _xfa_object.XFAObject { this.margin = null; } - [_xfa_object.$toStyle](widths, margins) { + [_xfa_object.$toStyle]() { const edges = this.edge.children.slice(); if (edges.length < 4) { @@ -57929,47 +60183,36 @@ class Border extends _xfa_object.XFAObject { } } - widths = widths || [0, 0, 0, 0]; - - for (let i = 0; i < 4; i++) { - widths[i] = edges[i].thickness; - } - - margins = margins || [0, 0, 0, 0]; const edgeStyles = edges.map(node => { const style = node[_xfa_object.$toStyle](); style.color = style.color || "#000000"; return style; }); - let style; + const widths = edges.map(edge => edge.thickness); + const insets = [0, 0, 0, 0]; if (this.margin) { - style = this.margin[_xfa_object.$toStyle](); - margins[0] = this.margin.topInset; - margins[1] = this.margin.rightInset; - margins[2] = this.margin.bottomInset; - margins[3] = this.margin.leftInset; - } else { - style = Object.create(null); + insets[0] = this.margin.topInset; + insets[1] = this.margin.rightInset; + insets[2] = this.margin.bottomInset; + insets[3] = this.margin.leftInset; } - let isForUi = false; - - const parent = this[_xfa_object.$getParent](); - - const grandParent = parent ? parent[_xfa_object.$getParent]() : null; + this[_xfa_object.$extra] = { + widths, + insets + }; + const style = Object.create(null); - if (grandParent instanceof Ui) { - isForUi = true; + if (this.margin) { + Object.assign(style, this.margin[_xfa_object.$toStyle]()); } - if (this.fill) { + if (this.fill && this.fill.presence === "visible") { Object.assign(style, this.fill[_xfa_object.$toStyle]()); } - let hasRadius = false; - if (this.corner.children.some(node => node.radius !== 0)) { const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]()); @@ -57982,56 +60225,25 @@ class Border extends _xfa_object.XFAObject { } style.borderRadius = cornerStyles.map(s => s.radius).join(" "); - hasRadius = true; } - const firstEdge = edgeStyles[0]; - - if (!hasRadius && (this.edge.children.length <= 1 || edgeStyles.every(x => x.style === firstEdge.style && x.width === firstEdge.width && x.color === firstEdge.color) && margins.every(x => x === margins[0]))) { - let borderStyle; - - switch (this.presence) { - case "invisible": - case "hidden": - borderStyle = ""; - break; - - case "inactive": - borderStyle = "none"; - break; - - default: - borderStyle = firstEdge.style; - break; - } - - style.outline = `${firstEdge.width} ${firstEdge.color} ${borderStyle}`; - const offset = edges[0].thickness + margins[0]; - style.outlineOffset = `-${(0, _html_utils.measureToString)(offset)}`; - - if (isForUi) { - style.padding = `${(0, _html_utils.measureToString)(offset + 1)}`; - } - } else { - switch (this.presence) { - case "invisible": - case "hidden": - style.borderStyle = ""; - break; - - case "inactive": - style.borderStyle = "none"; - break; + switch (this.presence) { + case "invisible": + case "hidden": + style.borderStyle = ""; + break; - default: - style.borderStyle = edgeStyles.map(s => s.style).join(" "); - break; - } + case "inactive": + style.borderStyle = "none"; + break; - style.borderWidth = edgeStyles.map(s => s.width).join(" "); - style.borderColor = edgeStyles.map(s => s.color).join(" "); + default: + style.borderStyle = edgeStyles.map(s => s.style).join(" "); + break; } + style.borderWidth = edgeStyles.map(s => s.width).join(" "); + style.borderColor = edgeStyles.map(s => s.color).join(" "); return style; } @@ -58073,7 +60285,7 @@ class BreakAfter extends _xfa_object.XFAObject { validate: x => x === 1 }); this.target = attributes.target || ""; - this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); + this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]); this.trailer = attributes.trailer || ""; this.use = attributes.use || ""; this.usehref = attributes.usehref || ""; @@ -58093,7 +60305,7 @@ class BreakBefore extends _xfa_object.XFAObject { validate: x => x === 1 }); this.target = attributes.target || ""; - this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); + this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]); this.trailer = attributes.trailer || ""; this.use = attributes.use || ""; this.usehref = attributes.usehref || ""; @@ -58121,7 +60333,8 @@ class Button extends _xfa_object.XFAObject { return _utils.HTMLResult.success({ name: "button", attributes: { - class: "xfaButton", + id: this[_xfa_object.$uid], + class: ["xfaButton"], style: {} }, children: [] @@ -58150,7 +60363,7 @@ class Caption extends _xfa_object.XFAObject { this.id = attributes.id || ""; this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]); this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); - this.reserve = (0, _utils.getMeasurement)(attributes.reserve); + this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve)); this.use = attributes.use || ""; this.usehref = attributes.usehref || ""; this.extras = null; @@ -58164,6 +60377,35 @@ class Caption extends _xfa_object.XFAObject { _setValue(this, value); } + [_xfa_object.$getExtra](availableSpace) { + if (!this[_xfa_object.$extra]) { + let { + width, + height + } = availableSpace; + + switch (this.placement) { + case "left": + case "right": + case "inline": + width = this.reserve <= 0 ? width : this.reserve; + break; + + case "top": + case "bottom": + height = this.reserve <= 0 ? height : this.reserve; + break; + } + + this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, { + width, + height + }); + } + + return this[_xfa_object.$extra]; + } + [_xfa_object.$toHTML](availableSpace) { if (!this.value) { return _utils.HTMLResult.EMPTY; @@ -58175,6 +60417,28 @@ class Caption extends _xfa_object.XFAObject { return _utils.HTMLResult.EMPTY; } + const savedReserve = this.reserve; + + if (this.reserve <= 0) { + const { + w, + h + } = this[_xfa_object.$getExtra](availableSpace); + + switch (this.placement) { + case "left": + case "right": + case "inline": + this.reserve = w; + break; + + case "top": + case "bottom": + this.reserve = h; + break; + } + } + const children = []; if (typeof value === "string") { @@ -58186,15 +60450,13 @@ class Caption extends _xfa_object.XFAObject { children.push(value); } - const style = (0, _html_utils.toStyle)(this, "font", "margin", "para", "visibility"); + const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility"); switch (this.placement) { case "left": case "right": if (this.reserve > 0) { style.width = (0, _html_utils.measureToString)(this.reserve); - } else { - style.minWidth = (0, _html_utils.measureToString)(this.reserve); } break; @@ -58203,18 +60465,18 @@ class Caption extends _xfa_object.XFAObject { case "bottom": if (this.reserve > 0) { style.height = (0, _html_utils.measureToString)(this.reserve); - } else { - style.minHeight = (0, _html_utils.measureToString)(this.reserve); } break; } + (0, _html_utils.setPara)(this, null, value); + this.reserve = savedReserve; return _utils.HTMLResult.success({ name: "div", attributes: { style, - class: "xfaCaption" + class: ["xfaCaption"] }, children }); @@ -58267,89 +60529,62 @@ class CheckButton extends _xfa_object.XFAObject { } [_xfa_object.$toHTML](availableSpace) { - const style = (0, _html_utils.toStyle)(this, "border", "margin"); + const style = (0, _html_utils.toStyle)("margin"); const size = (0, _html_utils.measureToString)(this.size); style.width = style.height = size; - let mark, radius; - - if (this.shape === "square") { - mark = "▪"; - radius = "10%"; - } else { - mark = "●"; - radius = "50%"; - } - - if (!style.borderRadius) { - style.borderRadius = radius; - } + let type; + let className; + let groupId; - if (this.mark !== "default") { - switch (this.mark) { - case "check": - mark = "✓"; - break; - - case "circle": - mark = "●"; - break; + const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); - case "cross": - mark = "✕"; - break; - - case "diamond": - mark = "♦"; - break; + const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || []; + const exportedValue = { + on: (items[0] || "on").toString(), + off: (items[1] || "off").toString() + }; + const value = field.value && field.value[_xfa_object.$text]() || "off"; + const checked = value === exportedValue.on || undefined; - case "square": - mark = "▪"; - break; + const container = field[_xfa_object.$getSubformParent](); - case "star": - mark = "★"; - break; - } - } + const fieldId = field[_xfa_object.$uid]; + let dataId; - if (size !== "10px") { - style.fontSize = size; - style.lineHeight = size; - style.width = size; - style.height = size; + if (container instanceof ExclGroup) { + groupId = container[_xfa_object.$uid]; + type = "radio"; + className = "xfaRadio"; + dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid]; + } else { + type = "checkbox"; + className = "xfaCheckbox"; + dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid]; } - const fieldId = this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid]; - const input = { name: "input", attributes: { - class: "xfaCheckbox", + class: [className], + style, fieldId, - type: "radio", - id: `${fieldId}-radio` + dataId, + type, + checked, + xfaOn: exportedValue.on } }; - const container = this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$getParent](); - - if (container instanceof ExclGroup) { - input.attributes.name = container[_xfa_object.$uid]; + if (groupId) { + input.attributes.name = groupId; } return _utils.HTMLResult.success({ name: "label", attributes: { - class: "xfaLabel" + class: ["xfaLabel"] }, - children: [input, { - name: "span", - attributes: { - class: "xfaCheckboxMark", - mark, - style - } - }] + children: [input] }); } @@ -58383,24 +60618,54 @@ class ChoiceList extends _xfa_object.XFAObject { const children = []; if (field.items.children.length > 0) { - const displayed = field.items.children[0][_xfa_object.$toHTML]().html; + const items = field.items; + let displayedIndex = 0; + let saveIndex = 0; - const values = field.items.children[1] ? field.items.children[1][_xfa_object.$toHTML]().html : []; + if (items.children.length === 2) { + displayedIndex = items.children[0].save; + saveIndex = 1 - displayedIndex; + } + + const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html; + + const values = items.children[saveIndex][_xfa_object.$toHTML]().html; + + let selected = false; + const value = field.value && field.value[_xfa_object.$text]() || ""; for (let i = 0, ii = displayed.length; i < ii; i++) { - children.push({ + const option = { name: "option", attributes: { value: values[i] || displayed[i] }, value: displayed[i] + }; + + if (values[i] === value) { + option.attributes.selected = selected = true; + } + + children.push(option); + } + + if (!selected) { + children.splice(0, 0, { + name: "option", + attributes: { + hidden: true, + selected: true + }, + value: " " }); } } const selectAttributes = { - class: "xfaSelect", - fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid], + class: ["xfaSelect"], + fieldId: field[_xfa_object.$uid], + dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], style }; @@ -58411,7 +60676,7 @@ class ChoiceList extends _xfa_object.XFAObject { return _utils.HTMLResult.success({ name: "label", attributes: { - class: "xfaLabel" + class: ["xfaLabel"] }, children: [{ name: "select", @@ -58493,18 +60758,23 @@ class ContentArea extends _xfa_object.XFAObject { const left = (0, _html_utils.measureToString)(this.x); const top = (0, _html_utils.measureToString)(this.y); const style = { - position: "absolute", left, top, width: (0, _html_utils.measureToString)(this.w), height: (0, _html_utils.measureToString)(this.h) }; + const classNames = ["xfaContentarea"]; + + if ((0, _html_utils.isPrintOnly)(this)) { + classNames.push("xfaPrintOnly"); + } + return _utils.HTMLResult.success({ name: "div", children: [], attributes: { style, - class: "xfaContentarea", + class: classNames, id: this[_xfa_object.$uid] } }); @@ -58534,7 +60804,7 @@ class Corner extends _xfa_object.XFAObject { [_xfa_object.$toStyle]() { const style = (0, _html_utils.toStyle)(this, "visibility"); - style.radius = (0, _html_utils.measureToString)(this.radius); + style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius); return style; } @@ -58550,11 +60820,13 @@ class DateElement extends _xfa_object.ContentObject { } [_xfa_object.$finalize]() { - this[_xfa_object.$content] = new Date(this[_xfa_object.$content].trim()); + const date = this[_xfa_object.$content].trim(); + + this[_xfa_object.$content] = date ? new Date(date) : null; } [_xfa_object.$toHTML](availableSpace) { - return _utils.HTMLResult.success(this[_xfa_object.$content].toString()); + return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : ""); } } @@ -58569,11 +60841,13 @@ class DateTime extends _xfa_object.ContentObject { } [_xfa_object.$finalize]() { - this[_xfa_object.$content] = new Date(this[_xfa_object.$content].trim()); + const date = this[_xfa_object.$content].trim(); + + this[_xfa_object.$content] = date ? new Date(date) : null; } [_xfa_object.$toHTML](availableSpace) { - return _utils.HTMLResult.success(this[_xfa_object.$content].toString()); + return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : ""); } } @@ -58594,19 +60868,23 @@ class DateTimeEdit extends _xfa_object.XFAObject { [_xfa_object.$toHTML](availableSpace) { const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); + + const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); + const html = { name: "input", attributes: { type: "text", - fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid], - class: "xfaTextfield", + fieldId: field[_xfa_object.$uid], + dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], + class: ["xfaTextfield"], style } }; return _utils.HTMLResult.success({ name: "label", attributes: { - class: "xfaLabel" + class: ["xfaLabel"] }, children: [html] }); @@ -58639,7 +60917,7 @@ class Decimal extends _xfa_object.ContentObject { } [_xfa_object.$toHTML](availableSpace) { - return _utils.HTMLResult.success(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); + return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); } } @@ -58747,48 +61025,62 @@ class Draw extends _xfa_object.XFAObject { } [_xfa_object.$toHTML](availableSpace) { - if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { + if (this.presence === "hidden" || this.presence === "inactive") { return _utils.HTMLResult.EMPTY; } (0, _html_utils.fixDimensions)(this); + const savedW = this.w; + const savedH = this.h; + const { + w, + h, + isBroken + } = (0, _html_utils.layoutNode)(this, availableSpace); - if (this.w !== "" && this.h === "" && this.value) { - const text = this.value[_xfa_object.$text](); - - if (text) { - const { - height - } = (0, _html_utils.layoutText)(text, this.font.size, { - width: this.w, - height: Infinity - }); - this.h = height || ""; + if (w && this.w === "") { + if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) { + return _utils.HTMLResult.FAILURE; } + + this.w = w; } - switch (checkDimensions(this, availableSpace)) { - case NOTHING: - return _utils.HTMLResult.EMPTY; + if (h && this.h === "") { + this.h = h; + } - case NOSPACE: - return _utils.HTMLResult.FAILURE; + setFirstUnsplittable(this); - default: - break; + if (!(0, _layout.checkDimensions)(this, availableSpace)) { + this.w = savedW; + this.h = savedH; + return _utils.HTMLResult.FAILURE; + } + + unsetFirstUnsplittable(this); + const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin"); + (0, _html_utils.setMinMaxDimensions)(this, style); + + if (style.margin) { + style.padding = style.margin; + delete style.margin; } - const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "borderMarginPadding"); const classNames = ["xfaDraw"]; if (this.font) { classNames.push("xfaFont"); } + if ((0, _html_utils.isPrintOnly)(this)) { + classNames.push("xfaPrintOnly"); + } + const attributes = { style, id: this[_xfa_object.$uid], - class: classNames.join(" ") + class: classNames }; if (this.name) { @@ -58800,58 +61092,26 @@ class Draw extends _xfa_object.XFAObject { attributes, children: [] }; - const extra = (0, _html_utils.addExtraDivForBorder)(html); + const assist = this.assist ? this.assist[_xfa_object.$toHTML]() : null; + + if (assist) { + html.attributes.title = assist; + } + const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace); const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null; if (value === null) { - return _utils.HTMLResult.success(extra, bbox); + this.w = savedW; + this.h = savedH; + return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); } html.children.push(value); - - if (value.attributes.class === "xfaRich") { - if (this.h === "") { - style.height = "auto"; - } - - if (this.w === "") { - style.width = "auto"; - } - - if (this.para) { - attributes.style.display = "flex"; - attributes.style.flexDirection = "column"; - - switch (this.para.vAlign) { - case "top": - attributes.style.justifyContent = "start"; - break; - - case "bottom": - attributes.style.justifyContent = "end"; - break; - - case "middle": - attributes.style.justifyContent = "center"; - break; - } - - const paraStyle = this.para[_xfa_object.$toStyle](); - - if (!value.attributes.style) { - value.attributes.style = paraStyle; - } else { - for (const [key, val] of Object.entries(paraStyle)) { - if (!(key in value.attributes.style)) { - value.attributes.style[key] = val; - } - } - } - } - } - - return _utils.HTMLResult.success(extra, bbox); + (0, _html_utils.setPara)(this, style, value); + this.w = savedW; + this.h = savedH; + return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); } } @@ -58863,7 +61123,7 @@ class Edge extends _xfa_object.XFAObject { this.id = attributes.id || ""; this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]); - this.thickness = Math.max(1, Math.round((0, _utils.getMeasurement)(attributes.thickness, "0.5pt"))); + this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt"); this.use = attributes.use || ""; this.usehref = attributes.usehref || ""; this.color = null; @@ -58874,7 +61134,7 @@ class Edge extends _xfa_object.XFAObject { const style = (0, _html_utils.toStyle)(this, "visibility"); Object.assign(style, { linecap: this.cap, - width: (0, _html_utils.measureToString)(Math.max(1, Math.round(this.thickness))), + width: (0, _html_utils.measureToString)(this.thickness), color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000", style: "" }); @@ -59045,6 +61305,10 @@ class ExData extends _xfa_object.ContentObject { this.usehref = attributes.usehref || ""; } + [_xfa_object.$isCDATAXml]() { + return this.contentType === "text/html"; + } + [_xfa_object.$onChild](child) { if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { this[_xfa_object.$content] = child; @@ -59140,6 +61404,10 @@ class ExclGroup extends _xfa_object.XFAObject { this.setProperty = new _xfa_object.XFAObjectArray(); } + [_xfa_object.$isBindable]() { + return true; + } + [_xfa_object.$hasSettableValue]() { return true; } @@ -59154,18 +61422,36 @@ class ExclGroup extends _xfa_object.XFAObject { field.value = nodeValue; } - const nodeBoolean = new BooleanElement({}); - nodeBoolean[_xfa_object.$content] = 0; + field.value[_xfa_object.$setValue](value); + } + } - for (const item of field.items.children) { - if (item[_xfa_object.$hasItem](value)) { - nodeBoolean[_xfa_object.$content] = 1; - break; - } - } + [_xfa_object.$isThereMoreWidth]() { + return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth](); + } - field.value[_xfa_object.$setValue](nodeBoolean); + [_xfa_object.$isSplittable]() { + const parent = this[_xfa_object.$getSubformParent](); + + if (!parent[_xfa_object.$isSplittable]()) { + return false; + } + + if (this[_xfa_object.$extra]._isSplittable !== undefined) { + return this[_xfa_object.$extra]._isSplittable; + } + + if (this.layout === "position" || this.layout.includes("row")) { + this[_xfa_object.$extra]._isSplittable = false; + return false; } + + if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) { + return false; + } + + this[_xfa_object.$extra]._isSplittable = true; + return true; } [_xfa_object.$flushHTML]() { @@ -59188,8 +61474,10 @@ class ExclGroup extends _xfa_object.XFAObject { (0, _html_utils.fixDimensions)(this); const children = []; const attributes = { - id: this[_xfa_object.$uid] + id: this[_xfa_object.$uid], + class: [] }; + (0, _html_utils.setAccess)(this, attributes.class); if (!this[_xfa_object.$extra]) { this[_xfa_object.$extra] = Object.create(null); @@ -59199,22 +61487,26 @@ class ExclGroup extends _xfa_object.XFAObject { children, attributes, attempt: 0, - availableSpace, + line: null, + numberInLine: 0, + availableSpace: { + width: Math.min(this.w || Infinity, availableSpace.width), + height: Math.min(this.h || Infinity, availableSpace.height) + }, width: 0, height: 0, prevHeight: 0, currentWidth: 0 }); - switch (checkDimensions(this, availableSpace)) { - case NOTHING: - return _utils.HTMLResult.EMPTY; + const isSplittable = this[_xfa_object.$isSplittable](); - case NOSPACE: - return _utils.HTMLResult.FAILURE; + if (!isSplittable) { + setFirstUnsplittable(this); + } - default: - break; + if (!(0, _layout.checkDimensions)(this, availableSpace)) { + return _utils.HTMLResult.FAILURE; } availableSpace = { @@ -59223,8 +61515,8 @@ class ExclGroup extends _xfa_object.XFAObject { }; const filter = new Set(["field"]); - if (this.layout === "row") { - const columnWidths = this[_xfa_object.$getParent]().columnWidths; + if (this.layout.includes("row")) { + const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths; if (Array.isArray(columnWidths) && columnWidths.length > 0) { this[_xfa_object.$extra].columnWidths = columnWidths; @@ -59232,7 +61524,7 @@ class ExclGroup extends _xfa_object.XFAObject { } } - const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "borderMarginPadding", "hAlign"); + const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); const classNames = ["xfaExclgroup"]; const cl = (0, _html_utils.layoutClass)(this); @@ -59240,34 +61532,53 @@ class ExclGroup extends _xfa_object.XFAObject { classNames.push(cl); } + if ((0, _html_utils.isPrintOnly)(this)) { + classNames.push("xfaPrintOnly"); + } + attributes.style = style; - attributes.class = classNames.join(" "); + attributes.class = classNames; if (this.name) { attributes.xfaName = this.name; } - let failure; + const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; + const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; - if (this.layout === "lr-tb" || this.layout === "rl-tb") { - for (; this[_xfa_object.$extra].attempt < MAX_ATTEMPTS_FOR_LRTB_LAYOUT; this[_xfa_object.$extra].attempt++) { - if (this[_xfa_object.$childrenToHTML]({ - filter, - include: true - })) { - break; - } + for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) { + if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { + this[_xfa_object.$extra].numberInLine = 0; } - failure = this[_xfa_object.$extra].attempt === 2; - } else { - failure = !this[_xfa_object.$childrenToHTML]({ + const result = this[_xfa_object.$childrenToHTML]({ filter, include: true }); + + if (result.success) { + break; + } + + if (result.isBreak()) { + return result; + } + + if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { + this[_xfa_object.$extra].attempt = maxRun; + break; + } + } + + if (!isSplittable) { + unsetFirstUnsplittable(this); } - if (failure) { + if (this[_xfa_object.$extra].attempt === maxRun) { + if (!isSplittable) { + delete this[_xfa_object.$extra]; + } + return _utils.HTMLResult.FAILURE; } @@ -59279,32 +61590,31 @@ class ExclGroup extends _xfa_object.XFAObject { marginV = this.margin.topInset + this.margin.bottomInset; } + const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0); + const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0); + const bbox = [this.x, this.y, width, height]; + if (this.w === "") { - style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width + marginH); + style.width = (0, _html_utils.measureToString)(width); } if (this.h === "") { - style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height + marginV); + style.height = (0, _html_utils.measureToString)(height); } - let html = { + const html = { name: "div", attributes, children }; - html = (0, _html_utils.addExtraDivForBorder)(html); - let bbox; + const assist = this.assist ? this.assist[_xfa_object.$toHTML]() : null; - if (this.w !== "" && this.h !== "") { - bbox = [this.x, this.y, this.w, this.h]; - } else { - const width = this.w === "" ? marginH + this[_xfa_object.$extra].width : this.w; - const height = this.h === "" ? marginV + this[_xfa_object.$extra].height : this.h; - bbox = [this.x, this.y, width, height]; + if (assist) { + html.attributes.title = assist; } delete this[_xfa_object.$extra]; - return _utils.HTMLResult.success(html, bbox); + return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); } } @@ -59399,90 +61709,233 @@ class Field extends _xfa_object.XFAObject { this.setProperty = new _xfa_object.XFAObjectArray(); } + [_xfa_object.$isBindable]() { + return true; + } + [_xfa_object.$setValue](value) { _setValue(this, value); } [_xfa_object.$toHTML](availableSpace) { + if (!this.ui) { + this.ui = new Ui({}); + this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData]; + + this[_xfa_object.$appendChild](this.ui); + + let node; + + switch (this.items.children.length) { + case 0: + node = new TextEdit({}); + this.ui.textEdit = node; + break; + + case 1: + node = new CheckButton({}); + this.ui.checkButton = node; + break; + + case 2: + node = new ChoiceList({}); + this.ui.choiceList = node; + break; + } + + this.ui[_xfa_object.$appendChild](node); + } + + setTabIndex(this); + if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { return _utils.HTMLResult.EMPTY; } - (0, _html_utils.fixDimensions)(this); + if (this.caption) { + delete this.caption[_xfa_object.$extra]; + } - switch (checkDimensions(this, availableSpace)) { - case NOTHING: - return _utils.HTMLResult.EMPTY; + const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null; + const savedW = this.w; + const savedH = this.h; - case NOSPACE: - return _utils.HTMLResult.FAILURE; + if (this.w === "" || this.h === "") { + let marginH = 0; + let marginV = 0; - default: - break; + if (this.margin) { + marginH = this.margin.leftInset + this.margin.rightInset; + marginV = this.margin.topInset + this.margin.bottomInset; + } + + let width = null; + let height = null; + + if (this.caption) { + const { + w, + h, + isBroken + } = this.caption[_xfa_object.$getExtra](availableSpace); + + if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) { + return _utils.HTMLResult.FAILURE; + } + + width = w; + height = h; + + if (this.ui.checkButton) { + switch (this.caption.placement) { + case "left": + case "right": + case "inline": + width += this.ui.checkButton.size; + break; + + case "top": + case "bottom": + height += this.ui.checkButton.size; + break; + } + } + } + + if (width && this.w === "") { + this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, Math.max(this.minW, width + marginH)); + } + + if (height && this.h === "") { + this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, Math.max(this.minH, height + marginV)); + } } - const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "borderMarginPadding", "hAlign"); + (0, _html_utils.fixDimensions)(this); + setFirstUnsplittable(this); + + if (!(0, _layout.checkDimensions)(this, availableSpace)) { + this.w = savedW; + this.h = savedH; + return _utils.HTMLResult.FAILURE; + } + + unsetFirstUnsplittable(this); + const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign"); + (0, _html_utils.setMinMaxDimensions)(this, style); const classNames = ["xfaField"]; if (this.font) { classNames.push("xfaFont"); } + if ((0, _html_utils.isPrintOnly)(this)) { + classNames.push("xfaPrintOnly"); + } + const attributes = { style, id: this[_xfa_object.$uid], - class: classNames.join(" ") + class: classNames }; + if (style.margin) { + style.padding = style.margin; + delete style.margin; + } + + (0, _html_utils.setAccess)(this, classNames); + if (this.name) { attributes.xfaName = this.name; } const children = []; - let html = { + const html = { name: "div", attributes, children }; + const assist = this.assist ? this.assist[_xfa_object.$toHTML]() : null; + + if (assist) { + html.attributes.title = assist; + } + + const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null; const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace); - html = (0, _html_utils.addExtraDivForBorder)(html); - const ui = this.ui ? this.ui[_xfa_object.$toHTML]().html : null; + + const ui = this.ui[_xfa_object.$toHTML]().html; if (!ui) { - return _utils.HTMLResult.success(html, bbox); + Object.assign(style, borderStyle); + return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); + } + + if (this[_xfa_object.$tabIndex]) { + if (ui.children && ui.children[0]) { + ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex]; + } else { + ui.attributes.tabindex = this[_xfa_object.$tabIndex]; + } } if (!ui.attributes.style) { ui.attributes.style = Object.create(null); } + if (this.ui.button) { + Object.assign(ui.attributes.style, borderStyle); + } else { + Object.assign(style, borderStyle); + } + children.push(ui); if (this.value) { if (this.ui.imageEdit) { ui.children.push(this.value[_xfa_object.$toHTML]().html); - } else if (ui.name !== "button") { - const value = this.value[_xfa_object.$toHTML]().html; + } else if (!this.ui.button) { + let value = ""; + + if (this.value.exData) { + value = this.value.exData[_xfa_object.$text](); + } else { + const htmlValue = this.value[_xfa_object.$toHTML]().html; + + if (htmlValue !== null) { + value = htmlValue.children[0].value; + } + } + + if (this.ui.textEdit && this.value.text && this.value.text.maxChars) { + ui.children[0].attributes.maxLength = this.value.text.maxChars; + } if (value) { if (ui.children[0].name === "textarea") { - ui.children[0].attributes.textContent = value.value; + ui.children[0].attributes.textContent = value; } else { - ui.children[0].attributes.value = value.value; + ui.children[0].attributes.value = value; } } } } - const caption = this.caption ? this.caption[_xfa_object.$toHTML]().html : null; - if (!caption) { - return _utils.HTMLResult.success(html, bbox); + if (ui.attributes.class) { + ui.attributes.class.push("xfaLeft"); + } + + this.w = savedW; + this.h = savedH; + return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); } - if (ui.name === "button") { - ui.attributes.style.background = style.background; - delete style.background; + if (this.ui.button) { + if (style.padding) { + delete style.padding; + } if (caption.name === "div") { caption.name = "span"; @@ -59490,36 +61943,43 @@ class Field extends _xfa_object.XFAObject { ui.children.push(caption); return _utils.HTMLResult.success(html, bbox); + } else if (this.ui.checkButton) { + caption.attributes.class[0] = "xfaCaptionForCheckButton"; } - ui.children.splice(0, 0, caption); + if (!ui.attributes.class) { + ui.attributes.class = []; + } switch (this.caption.placement) { case "left": - ui.attributes.style.flexDirection = "row"; + ui.children.splice(0, 0, caption); + ui.attributes.class.push("xfaLeft"); break; case "right": - ui.attributes.style.flexDirection = "row-reverse"; + ui.children.push(caption); + ui.attributes.class.push("xfaLeft"); break; case "top": - ui.attributes.style.alignItems = "start"; - ui.attributes.style.flexDirection = "column"; + ui.children.splice(0, 0, caption); + ui.attributes.class.push("xfaTop"); break; case "bottom": - ui.attributes.style.alignItems = "start"; - ui.attributes.style.flexDirection = "column-reverse"; + ui.children.push(caption); + ui.attributes.class.push("xfaTop"); break; case "inline": - delete ui.attributes.class; - caption.attributes.style.float = "left"; + ui.attributes.class.push("xfaLeft"); break; } - return _utils.HTMLResult.success(html, bbox); + this.w = savedW; + this.h = savedH; + return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); } } @@ -59545,13 +62005,17 @@ class Fill extends _xfa_object.XFAObject { [_xfa_object.$toStyle]() { const parent = this[_xfa_object.$getParent](); + const style = Object.create(null); let propName = "color"; if (parent instanceof Border) { propName = "background"; } - const style = Object.create(null); + if (parent instanceof Rectangle || parent instanceof Arc) { + propName = "fill"; + style.fill = "white"; + } for (const name of Object.getOwnPropertyNames(this)) { if (name === "extras" || name === "color") { @@ -59619,7 +62083,7 @@ class Float extends _xfa_object.ContentObject { } [_xfa_object.$toHTML](availableSpace) { - return _utils.HTMLResult.success(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); + return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); } } @@ -59655,7 +62119,7 @@ class Font extends _xfa_object.XFAObject { this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]); this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]); this.size = (0, _utils.getMeasurement)(attributes.size, "10pt"); - this.typeface = attributes.typeface || ""; + this.typeface = attributes.typeface || "Courier"; this.underline = (0, _utils.getInteger)({ data: attributes.underline, defaultValue: 0, @@ -59669,6 +62133,12 @@ class Font extends _xfa_object.XFAObject { this.fill = null; } + [_xfa_object.$clean](builder) { + super[_xfa_object.$clean](builder); + + this[_xfa_object.$globalData].usedTypefaces.add(this.typeface); + } + [_xfa_object.$toStyle]() { const style = (0, _html_utils.toStyle)(this, "fill"); const color = style.color; @@ -59687,13 +62157,8 @@ class Font extends _xfa_object.XFAObject { style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift); } - if (this.kerningMode !== "none") { - style.fontKerning = "normal"; - } - - if (this.letterSpacing) { - style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing); - } + style.fontKerning = this.kerningMode === "none" ? "none" : "normal"; + style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing); if (this.lineThrough !== 0) { style.textDecoration = "line-through"; @@ -59711,17 +62176,9 @@ class Font extends _xfa_object.XFAObject { } } - if (this.posture !== "normal") { - style.fontStyle = this.posture; - } - - const fontSize = (0, _html_utils.measureToString)(0.99 * this.size); - - if (fontSize !== "10px") { - style.fontSize = fontSize; - } - - style.fontFamily = (0, _html_utils.getFonts)(this.typeface); + style.fontStyle = this.posture; + style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size); + (0, _html_utils.setFontFamily)(this, this[_xfa_object.$globalData].fontFinder, style); if (this.underline !== 0) { style.textDecoration = "underline"; @@ -59731,10 +62188,7 @@ class Font extends _xfa_object.XFAObject { } } - if (this.weight !== "normal") { - style.fontWeight = this.weight; - } - + style.fontWeight = this.weight; return style; } @@ -59817,26 +62271,61 @@ class Image extends _xfa_object.StringObject { } [_xfa_object.$toHTML]() { - if (this.href || !this[_xfa_object.$content]) { + let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href); + + if (!buffer && (this.href || !this[_xfa_object.$content])) { return _utils.HTMLResult.EMPTY; } - if (this.transferEncoding === "base64") { - const buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content])); - const blob = new Blob([buffer], { - type: this.contentType - }); - return _utils.HTMLResult.success({ - name: "img", - attributes: { - class: "xfaImage", - style: {}, - src: URL.createObjectURL(blob) - } - }); + if (!buffer && this.transferEncoding === "base64") { + buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content])); } - return _utils.HTMLResult.EMPTY; + if (!buffer) { + return _utils.HTMLResult.EMPTY; + } + + const blob = new Blob([buffer], { + type: this.contentType + }); + let style; + + switch (this.aspect) { + case "fit": + case "actual": + break; + + case "height": + style = { + height: "100%", + objectFit: "fill" + }; + break; + + case "none": + style = { + width: "100%", + height: "100%", + objectFit: "fill" + }; + break; + + case "width": + style = { + width: "100%", + objectFit: "fill" + }; + break; + } + + return _utils.HTMLResult.success({ + name: "img", + attributes: { + class: ["xfaImage"], + style, + src: URL.createObjectURL(blob) + } + }); } } @@ -59882,7 +62371,7 @@ class Integer extends _xfa_object.ContentObject { } [_xfa_object.$toHTML](availableSpace) { - return _utils.HTMLResult.success(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); + return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : ""); } } @@ -59925,10 +62414,6 @@ class Items extends _xfa_object.XFAObject { this.time = new _xfa_object.XFAObjectArray(); } - [_xfa_object.$hasItem](value) { - return this.hasOwnProperty(value[_xfa_object.$nodeName]) && this[value[_xfa_object.$nodeName]].children.some(node => node[_xfa_object.$content] === value[_xfa_object.$content]); - } - [_xfa_object.$toHTML]() { const output = []; @@ -59990,6 +62475,77 @@ class Line extends _xfa_object.XFAObject { this.edge = null; } + [_xfa_object.$toHTML]() { + const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); + + const edge = this.edge ? this.edge : new Edge({}); + + const edgeStyle = edge[_xfa_object.$toStyle](); + + const style = Object.create(null); + const thickness = edge.presence === "visible" ? edge.thickness : 0; + style.strokeWidth = (0, _html_utils.measureToString)(thickness); + style.stroke = edgeStyle.color; + let x1, y1, x2, y2; + let width = "100%"; + let height = "100%"; + + if (parent.w <= thickness) { + [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"]; + width = style.strokeWidth; + } else if (parent.h <= thickness) { + [x1, y1, x2, y2] = [0, "50%", "100%", "50%"]; + height = style.strokeWidth; + } else { + if (this.slope === "\\") { + [x1, y1, x2, y2] = [0, 0, "100%", "100%"]; + } else { + [x1, y1, x2, y2] = [0, "100%", "100%", 0]; + } + } + + const line = { + name: "line", + attributes: { + xmlns: SVG_NS, + x1, + y1, + x2, + y2, + style + } + }; + const svg = { + name: "svg", + children: [line], + attributes: { + xmlns: SVG_NS, + width, + height, + style: { + overflow: "visible" + } + } + }; + + if (hasMargin(parent)) { + return _utils.HTMLResult.success({ + name: "div", + attributes: { + style: { + display: "inline", + width: "100%", + height: "100%" + } + }, + children: [svg] + }); + } + + svg.attributes.style.position = "absolute"; + return _utils.HTMLResult.success(svg); + } + } class Linear extends _xfa_object.XFAObject { @@ -60121,19 +62677,23 @@ class NumericEdit extends _xfa_object.XFAObject { [_xfa_object.$toHTML](availableSpace) { const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); + + const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); + const html = { name: "input", attributes: { type: "text", - fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid], - class: "xfaTextfield", + fieldId: field[_xfa_object.$uid], + dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], + class: ["xfaTextfield"], style } }; return _utils.HTMLResult.success({ name: "label", attributes: { - class: "xfaLabel" + class: ["xfaLabel"] }, children: [html] }); @@ -60201,6 +62761,30 @@ class Overflow extends _xfa_object.XFAObject { this.usehref = attributes.usehref || ""; } + [_xfa_object.$getExtra]() { + if (!this[_xfa_object.$extra]) { + const parent = this[_xfa_object.$getParent](); + + const root = this[_xfa_object.$getTemplateRoot](); + + const target = root[_xfa_object.$searchNode](this.target, parent); + + const leader = root[_xfa_object.$searchNode](this.leader, parent); + + const trailer = root[_xfa_object.$searchNode](this.trailer, parent); + + this[_xfa_object.$extra] = { + target: target && target[0] || null, + leader: leader && leader[0] || null, + trailer: trailer && trailer[0] || null, + addLeader: false, + addTrailer: false + }; + } + + return this[_xfa_object.$extra]; + } + } class PageArea extends _xfa_object.XFAObject { @@ -60236,30 +62820,44 @@ class PageArea extends _xfa_object.XFAObject { this.subform = new _xfa_object.XFAObjectArray(); } + [_xfa_object.$isUsable]() { + if (!this[_xfa_object.$extra]) { + this[_xfa_object.$extra] = { + numberOfUse: 0 + }; + return true; + } + + return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max; + } + + [_xfa_object.$cleanPage]() { + delete this[_xfa_object.$extra]; + } + [_xfa_object.$getNextPage]() { if (!this[_xfa_object.$extra]) { this[_xfa_object.$extra] = { - numberOfUse: 1 + numberOfUse: 0 }; } const parent = this[_xfa_object.$getParent](); if (parent.relation === "orderedOccurrence") { - if (this.occur && (this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max)) { + if (this[_xfa_object.$isUsable]()) { this[_xfa_object.$extra].numberOfUse += 1; return this; } } - delete this[_xfa_object.$extra]; return parent[_xfa_object.$getNextPage](); } [_xfa_object.$getAvailableSpace]() { - return { - width: Infinity, - height: Infinity + return this[_xfa_object.$extra].space || { + width: 0, + height: 0 }; } @@ -60277,18 +62875,31 @@ class PageArea extends _xfa_object.XFAObject { if (this.medium && this.medium.short && this.medium.long) { style.width = (0, _html_utils.measureToString)(this.medium.short); style.height = (0, _html_utils.measureToString)(this.medium.long); + this[_xfa_object.$extra].space = { + width: this.medium.short, + height: this.medium.long + }; if (this.medium.orientation === "landscape") { const x = style.width; style.width = style.height; style.height = x; + this[_xfa_object.$extra].space = { + width: this.medium.long, + height: this.medium.short + }; } } else { (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug."); } this[_xfa_object.$childrenToHTML]({ - filter: new Set(["area", "draw", "field", "subform", "contentArea"]), + filter: new Set(["area", "draw", "field", "subform"]), + include: true + }); + + this[_xfa_object.$childrenToHTML]({ + filter: new Set(["contentArea"]), include: true }); @@ -60296,8 +62907,10 @@ class PageArea extends _xfa_object.XFAObject { name: "div", children, attributes: { + class: ["xfaPage"], id: this[_xfa_object.$uid], - style + style, + xfaName: this.name } }); } @@ -60320,48 +62933,60 @@ class PageSet extends _xfa_object.XFAObject { this.pageSet = new _xfa_object.XFAObjectArray(); } + [_xfa_object.$cleanPage]() { + for (const page of this.pageArea.children) { + page[_xfa_object.$cleanPage](); + } + + for (const page of this.pageSet.children) { + page[_xfa_object.$cleanPage](); + } + } + + [_xfa_object.$isUsable]() { + return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max; + } + [_xfa_object.$getNextPage]() { if (!this[_xfa_object.$extra]) { this[_xfa_object.$extra] = { numberOfUse: 1, - currentIndex: -1 + pageIndex: -1, + pageSetIndex: -1 }; } if (this.relation === "orderedOccurrence") { - if (this[_xfa_object.$extra].currentIndex + 1 < this.pageArea.children.length) { - this[_xfa_object.$extra].currentIndex += 1; - return this.pageArea.children[this[_xfa_object.$extra].currentIndex]; + if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) { + this[_xfa_object.$extra].pageIndex += 1; + const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex]; + return pageArea[_xfa_object.$getNextPage](); } - if (this[_xfa_object.$extra].currentIndex + 1 < this.pageSet.children.length) { - this[_xfa_object.$extra].currentIndex += 1; - return this.pageSet.children[this[_xfa_object.$extra].currentIndex]; + if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) { + this[_xfa_object.$extra].pageSetIndex += 1; + return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage](); } - if (this.occur && (this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max)) { + if (this[_xfa_object.$isUsable]()) { this[_xfa_object.$extra].numberOfUse += 1; - this[_xfa_object.$extra].currentIndex = 0; - - if (this.pageArea.children.length > 0) { - return this.pageArea.children[0]; - } - - return this.pageSet.children[0][_xfa_object.$getNextPage](); + this[_xfa_object.$extra].pageIndex = -1; + this[_xfa_object.$extra].pageSetIndex = -1; + return this[_xfa_object.$getNextPage](); } - delete this[_xfa_object.$extra]; - const parent = this[_xfa_object.$getParent](); if (parent instanceof PageSet) { return parent[_xfa_object.$getNextPage](); } + this[_xfa_object.$cleanPage](); + return this[_xfa_object.$getNextPage](); } - const pageNumber = getRoot(this)[_xfa_object.$extra].pageNumber; + const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber; const parity = pageNumber % 2 === 0 ? "even" : "odd"; const position = pageNumber === 0 ? "first" : "rest"; @@ -60423,19 +63048,19 @@ class Para extends _xfa_object.XFAObject { const style = (0, _html_utils.toStyle)(this, "hAlign"); if (this.marginLeft !== "") { - style.marginLeft = (0, _html_utils.measureToString)(this.marginLeft); + style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft); } if (this.marginRight !== "") { - style.marginRight = (0, _html_utils.measureToString)(this.marginRight); + style.paddingight = (0, _html_utils.measureToString)(this.marginRight); } if (this.spaceAbove !== "") { - style.marginTop = (0, _html_utils.measureToString)(this.spaceAbove); + style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove); } if (this.spaceBelow !== "") { - style.marginBottom = (0, _html_utils.measureToString)(this.spaceBelow); + style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow); } if (this.textIndent !== "") { @@ -60662,7 +63287,7 @@ class Radial extends _xfa_object.XFAObject { startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF"; const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000"; const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`; - return `radial-gradient(circle to center, ${colors})`; + return `radial-gradient(circle at center, ${colors})`; } } @@ -60702,6 +63327,71 @@ class Rectangle extends _xfa_object.XFAObject { this.fill = null; } + [_xfa_object.$toHTML]() { + const edge = this.edge.children.length ? this.edge.children[0] : new Edge({}); + + const edgeStyle = edge[_xfa_object.$toStyle](); + + const style = Object.create(null); + + if (this.fill && this.fill.presence === "visible") { + Object.assign(style, this.fill[_xfa_object.$toStyle]()); + } else { + style.fill = "transparent"; + } + + style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0); + style.stroke = edgeStyle.color; + const corner = this.corner.children.length ? this.corner.children[0] : new Corner({}); + + const cornerStyle = corner[_xfa_object.$toStyle](); + + const rect = { + name: "rect", + attributes: { + xmlns: SVG_NS, + width: "100%", + height: "100%", + x: 0, + y: 0, + rx: cornerStyle.radius, + ry: cornerStyle.radius, + style + } + }; + const svg = { + name: "svg", + children: [rect], + attributes: { + xmlns: SVG_NS, + style: { + overflow: "visible" + }, + width: "100%", + height: "100%" + } + }; + + const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); + + if (hasMargin(parent)) { + return _utils.HTMLResult.success({ + name: "div", + attributes: { + style: { + display: "inline", + width: "100%", + height: "100%" + } + }, + children: [svg] + }); + } + + svg.attributes.style.position = "absolute"; + return _utils.HTMLResult.success(svg); + } + } class RefElement extends _xfa_object.StringObject { @@ -60905,6 +63595,28 @@ class Subform extends _xfa_object.XFAObject { this.subformSet = new _xfa_object.XFAObjectArray(); } + [_xfa_object.$getSubformParent]() { + const parent = this[_xfa_object.$getParent](); + + if (parent instanceof SubformSet) { + return parent[_xfa_object.$getSubformParent](); + } + + return parent; + } + + [_xfa_object.$isBindable]() { + return true; + } + + [_xfa_object.$isThereMoreWidth]() { + return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth](); + } + + *[_xfa_object.$getContainedChildren]() { + yield* getContainedChildren(this); + } + [_xfa_object.$flushHTML]() { return (0, _layout.flushHTML)(this); } @@ -60917,15 +63629,85 @@ class Subform extends _xfa_object.XFAObject { return (0, _layout.getAvailableSpace)(this); } - [_xfa_object.$toHTML](availableSpace) { - if (this.name === "helpText") { - return _utils.HTMLResult.EMPTY; + [_xfa_object.$isSplittable]() { + const parent = this[_xfa_object.$getSubformParent](); + + if (!parent[_xfa_object.$isSplittable]()) { + return false; } - if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) { - const ret = this[_xfa_object.$extra].afterBreakAfter; - delete this[_xfa_object.$extra]; - return ret; + const contentArea = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea; + + if (this.overflow && this.overflow[_xfa_object.$getExtra]().target === contentArea) { + return false; + } + + if (this[_xfa_object.$extra]._isSplittable !== undefined) { + return this[_xfa_object.$extra]._isSplittable; + } + + if (this.layout === "position" || this.layout.includes("row")) { + this[_xfa_object.$extra]._isSplittable = false; + return false; + } + + if (this.keep && this.keep.intact !== "none") { + this[_xfa_object.$extra]._isSplittable = false; + return false; + } + + if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) { + return false; + } + + this[_xfa_object.$extra]._isSplittable = true; + return true; + } + + [_xfa_object.$toHTML](availableSpace) { + if (this.break) { + if (this.break.after !== "auto" || this.break.afterTarget !== "") { + const node = new BreakAfter({ + targetType: this.break.after, + target: this.break.afterTarget, + startNew: this.break.startNew.toString() + }); + node[_xfa_object.$globalData] = this[_xfa_object.$globalData]; + + this[_xfa_object.$appendChild](node); + + this.breakAfter.push(node); + } + + if (this.break.before !== "auto" || this.break.beforeTarget !== "") { + const node = new BreakBefore({ + targetType: this.break.before, + target: this.break.beforeTarget, + startNew: this.break.startNew.toString() + }); + node[_xfa_object.$globalData] = this[_xfa_object.$globalData]; + + this[_xfa_object.$appendChild](node); + + this.breakBefore.push(node); + } + + if (this.break.overflowTarget !== "") { + const node = new Overflow({ + target: this.break.overflowTarget, + leader: this.break.overflowLeader, + trailer: this.break.overflowTrailer + }); + node[_xfa_object.$globalData] = this[_xfa_object.$globalData]; + + this[_xfa_object.$appendChild](node); + + this.overflow.push(node); + } + + this[_xfa_object.$removeChild](this.break); + + this.break = null; } if (this.presence === "hidden" || this.presence === "inactive") { @@ -60936,11 +63718,25 @@ class Subform extends _xfa_object.XFAObject { (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug."); } + if (this.breakBefore.children.length >= 1) { + const breakBefore = this.breakBefore.children[0]; + + if (handleBreak(breakBefore)) { + return _utils.HTMLResult.breakNode(breakBefore); + } + } + + if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) { + return _utils.HTMLResult.EMPTY; + } + (0, _html_utils.fixDimensions)(this); const children = []; const attributes = { - id: this[_xfa_object.$uid] + id: this[_xfa_object.$uid], + class: [] }; + (0, _html_utils.setAccess)(this, attributes.class); if (!this[_xfa_object.$extra]) { this[_xfa_object.$extra] = Object.create(null); @@ -60948,42 +63744,43 @@ class Subform extends _xfa_object.XFAObject { Object.assign(this[_xfa_object.$extra], { children, + line: null, attributes, attempt: 0, - availableSpace, + numberInLine: 0, + availableSpace: { + width: Math.min(this.w || Infinity, availableSpace.width), + height: Math.min(this.h || Infinity, availableSpace.height) + }, width: 0, height: 0, prevHeight: 0, currentWidth: 0 }); - if (this.breakBefore.children.length >= 1) { - const breakBefore = this.breakBefore.children[0]; + const root = this[_xfa_object.$getTemplateRoot](); - if (!breakBefore[_xfa_object.$extra]) { - breakBefore[_xfa_object.$extra] = true; + const currentContentArea = root[_xfa_object.$extra].currentContentArea; + const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure; - getRoot(this)[_xfa_object.$break](breakBefore); - - return _utils.HTMLResult.FAILURE; - } + if (this.overflow) { + root[_xfa_object.$extra].noLayoutFailure = root[_xfa_object.$extra].noLayoutFailure || this.overflow[_xfa_object.$getExtra]().target === currentContentArea; } - switch (checkDimensions(this, availableSpace)) { - case NOTHING: - return _utils.HTMLResult.EMPTY; + const isSplittable = this[_xfa_object.$isSplittable](); - case NOSPACE: - return _utils.HTMLResult.FAILURE; + if (!isSplittable) { + setFirstUnsplittable(this); + } - default: - break; + if (!(0, _layout.checkDimensions)(this, availableSpace)) { + return _utils.HTMLResult.FAILURE; } const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]); if (this.layout.includes("row")) { - const columnWidths = this[_xfa_object.$getParent]().columnWidths; + const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths; if (Array.isArray(columnWidths) && columnWidths.length > 0) { this[_xfa_object.$extra].columnWidths = columnWidths; @@ -60991,7 +63788,7 @@ class Subform extends _xfa_object.XFAObject { } } - const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "borderMarginPadding", "hAlign"); + const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); const classNames = ["xfaSubform"]; const cl = (0, _html_utils.layoutClass)(this); @@ -61000,36 +63797,75 @@ class Subform extends _xfa_object.XFAObject { } attributes.style = style; - attributes.class = classNames.join(" "); + attributes.class = classNames; if (this.name) { attributes.xfaName = this.name; } - let failure; + if (this.overflow) { + const overflowExtra = this.overflow[_xfa_object.$getExtra](); - if (this.layout === "lr-tb" || this.layout === "rl-tb") { - for (; this[_xfa_object.$extra].attempt < MAX_ATTEMPTS_FOR_LRTB_LAYOUT; this[_xfa_object.$extra].attempt++) { - if (this[_xfa_object.$childrenToHTML]({ - filter, - include: true - })) { - break; - } + if (overflowExtra.addLeader) { + overflowExtra.addLeader = false; + handleOverflow(this, overflowExtra.leader, availableSpace); } + } - failure = this[_xfa_object.$extra].attempt === 2; - } else { - failure = !this[_xfa_object.$childrenToHTML]({ + const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; + const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; + + for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) { + if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { + this[_xfa_object.$extra].numberInLine = 0; + } + + const result = this[_xfa_object.$childrenToHTML]({ filter, include: true }); + + if (result.success) { + break; + } + + if (result.isBreak()) { + return result; + } + + if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) { + this[_xfa_object.$extra].attempt = maxRun; + break; + } + } + + if (!isSplittable) { + unsetFirstUnsplittable(this); } - if (failure) { + root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure; + + if (this[_xfa_object.$extra].attempt === maxRun) { + if (this.overflow) { + this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow; + } + + if (!isSplittable) { + delete this[_xfa_object.$extra]; + } + return _utils.HTMLResult.FAILURE; } + if (this.overflow) { + const overflowExtra = this.overflow[_xfa_object.$getExtra](); + + if (overflowExtra.addTrailer) { + overflowExtra.addTrailer = false; + handleOverflow(this, overflowExtra.trailer, availableSpace); + } + } + let marginH = 0; let marginV = 0; @@ -61038,41 +63874,42 @@ class Subform extends _xfa_object.XFAObject { marginV = this.margin.topInset + this.margin.bottomInset; } + const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0); + const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0); + const bbox = [this.x, this.y, width, height]; + if (this.w === "") { - style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width + marginH); + style.width = (0, _html_utils.measureToString)(width); } if (this.h === "") { - style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height + marginV); + style.height = (0, _html_utils.measureToString)(height); } - let html = { + const html = { name: "div", attributes, children }; - html = (0, _html_utils.addExtraDivForBorder)(html); - let bbox; + const assist = this.assist ? this.assist[_xfa_object.$toHTML]() : null; - if (this.w !== "" && this.h !== "") { - bbox = [this.x, this.y, this.w, this.h]; - } else { - const width = this.w === "" ? marginH + this[_xfa_object.$extra].width : this.w; - const height = this.h === "" ? marginV + this[_xfa_object.$extra].height : this.h; - bbox = [this.x, this.y, width, height]; + if (assist) { + html.attributes.title = assist; } + const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox); + if (this.breakAfter.children.length >= 1) { const breakAfter = this.breakAfter.children[0]; - getRoot(this)[_xfa_object.$break](breakAfter); - - this[_xfa_object.$extra].afterBreakAfter = _utils.HTMLResult.success(html, bbox); - return _utils.HTMLResult.FAILURE; + if (handleBreak(breakAfter)) { + this[_xfa_object.$extra].afterBreakAfter = result; + return _utils.HTMLResult.breakNode(breakAfter); + } } delete this[_xfa_object.$extra]; - return _utils.HTMLResult.success(html, bbox); + return result; } } @@ -61098,27 +63935,18 @@ class SubformSet extends _xfa_object.XFAObject { this.subformSet = new _xfa_object.XFAObjectArray(); } - [_xfa_object.$toHTML]() { - const children = []; - - if (!this[_xfa_object.$extra]) { - this[_xfa_object.$extra] = Object.create(null); - } + *[_xfa_object.$getContainedChildren]() { + yield* getContainedChildren(this); + } - this[_xfa_object.$extra].children = children; + [_xfa_object.$getSubformParent]() { + let parent = this[_xfa_object.$getParent](); - this[_xfa_object.$childrenToHTML]({ - filter: new Set(["subform", "subformSet"]), - include: true - }); + while (!(parent instanceof Subform)) { + parent = parent[_xfa_object.$getParent](); + } - return _utils.HTMLResult.success({ - name: "div", - children, - attributes: { - id: this[_xfa_object.$uid] - } - }); + return parent; } } @@ -61197,10 +64025,12 @@ class Template extends _xfa_object.XFAObject { if (this.subform.children.length >= 2) { (0, _util.warn)("XFA - Several subforms in template node: please file a bug."); } + + this[_xfa_object.$tabIndex] = 1000; } - [_xfa_object.$break](node) { - this[_xfa_object.$extra].breakingNode = node; + [_xfa_object.$isSplittable]() { + return true; } [_xfa_object.$searchNode](expr, container) { @@ -61220,13 +64050,20 @@ class Template extends _xfa_object.XFAObject { } this[_xfa_object.$extra] = { - breakingNode: null, + overflowNode: null, + firstUnsplittable: null, + currentContentArea: null, + currentPageArea: null, + noLayoutFailure: false, pageNumber: 1, pagePosition: "first", oddOrEven: "odd", blankOrNotBlank: "nonBlank" }; const root = this.subform.children[0]; + + root.pageSet[_xfa_object.$cleanPage](); + const pageAreas = root.pageSet.pageArea.children; const mainHtml = { name: "div", @@ -61263,42 +64100,77 @@ class Template extends _xfa_object.XFAObject { pageArea = pageAreas[0]; } + pageArea[_xfa_object.$extra] = { + numberOfUse: 1 + }; + const pageAreaParent = pageArea[_xfa_object.$getParent](); pageAreaParent[_xfa_object.$extra] = { numberOfUse: 1, - currentIndex: pageAreaParent.pageArea.children.indexOf(pageArea) + pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea), + pageSetIndex: 0 }; let targetPageArea; let leader = null; let trailer = null; + let hasSomething = true; + let hasSomethingCounter = 0; + let startIndex = 0; while (true) { + if (!hasSomething) { + mainHtml.children.pop(); + + if (++hasSomethingCounter === MAX_EMPTY_PAGES) { + (0, _util.warn)("XFA - Something goes wrong: please file a bug."); + return mainHtml; + } + } else { + hasSomethingCounter = 0; + } + targetPageArea = null; + this[_xfa_object.$extra].currentPageArea = pageArea; const page = pageArea[_xfa_object.$toHTML]().html; mainHtml.children.push(page); if (leader) { - page.children.push(leader[_xfa_object.$toHTML](page[_xfa_object.$extra].space).html); + this[_xfa_object.$extra].noLayoutFailure = true; + page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html); leader = null; } if (trailer) { - page.children.push(trailer[_xfa_object.$toHTML](page[_xfa_object.$extra].space).html); + this[_xfa_object.$extra].noLayoutFailure = true; + page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html); trailer = null; } const contentAreas = pageArea.contentArea.children; - const htmlContentAreas = page.children.filter(node => node.attributes.class === "xfaContentarea"); + const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea")); + hasSomething = false; + this[_xfa_object.$extra].firstUnsplittable = null; + this[_xfa_object.$extra].noLayoutFailure = false; - for (let i = 0, ii = contentAreas.length; i < ii; i++) { + const flush = index => { + const html = root[_xfa_object.$flushHTML](); + + if (html) { + hasSomething = hasSomething || html.children && html.children.length !== 0; + htmlContentAreas[index].children.push(html); + } + }; + + for (let i = startIndex, ii = contentAreas.length; i < ii; i++) { const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i]; const space = { width: contentArea.w, height: contentArea.h }; + startIndex = 0; if (leader) { htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html); @@ -61310,29 +64182,27 @@ class Template extends _xfa_object.XFAObject { trailer = null; } - let html = root[_xfa_object.$toHTML](space); + const html = root[_xfa_object.$toHTML](space); if (html.success) { if (html.html) { + hasSomething = hasSomething || html.html.children && html.html.children.length !== 0; htmlContentAreas[i].children.push(html.html); + } else if (!hasSomething) { + mainHtml.children.pop(); } return mainHtml; } - let mustBreak = false; - - if (this[_xfa_object.$extra].breakingNode) { - const node = this[_xfa_object.$extra].breakingNode; - this[_xfa_object.$extra].breakingNode = null; + if (html.isBreak()) { + const node = html.breakNode; + flush(i); if (node.targetType === "auto") { - i--; continue; } - const startNew = node.startNew === 1; - if (node.leader) { leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]()); leader = leader ? leader[0] : null; @@ -61343,41 +64213,61 @@ class Template extends _xfa_object.XFAObject { trailer = trailer ? trailer[0] : null; } - let target = null; - - if (node.target) { - target = this[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]()); - target = target ? target[0] : target; + if (node.targetType === "pageArea") { + targetPageArea = node[_xfa_object.$extra].target; + i = Infinity; + } else if (!node[_xfa_object.$extra].target) { + i = node[_xfa_object.$extra].index; + } else { + targetPageArea = node[_xfa_object.$extra].target; + startIndex = node[_xfa_object.$extra].index + 1; + i = Infinity; } - if (node.targetType === "pageArea") { - if (startNew) { - mustBreak = true; - } else if (target === pageArea || !(target instanceof PageArea)) { - i--; - continue; + continue; + } + + if (this[_xfa_object.$extra].overflowNode) { + const node = this[_xfa_object.$extra].overflowNode; + this[_xfa_object.$extra].overflowNode = null; + + const overflowExtra = node[_xfa_object.$getExtra](); + + const target = overflowExtra.target; + overflowExtra.addLeader = overflowExtra.leader !== null; + overflowExtra.addTrailer = overflowExtra.trailer !== null; + flush(i); + i = Infinity; + + if (target instanceof PageArea) { + targetPageArea = target; + } else if (target instanceof ContentArea) { + const index = contentAreas.findIndex(e => e === target); + + if (index !== -1) { + i = index - 1; } else { - targetPageArea = target; - mustBreak = true; + targetPageArea = target[_xfa_object.$getParent](); + startIndex = targetPageArea.contentArea.children.findIndex(e => e === target); } - } else if (target === "contentArea" || !(target instanceof ContentArea)) { - i--; - continue; } + + continue; } - html = root[_xfa_object.$flushHTML](); + flush(i); + } - if (html) { - htmlContentAreas[i].children.push(html); - } + this[_xfa_object.$extra].pageNumber += 1; - if (mustBreak) { - break; + if (targetPageArea) { + if (targetPageArea[_xfa_object.$isUsable]()) { + targetPageArea[_xfa_object.$extra].numberOfUse += 1; + } else { + targetPageArea = null; } } - this[_xfa_object.$extra].pageNumber += 1; pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage](); } } @@ -61401,6 +64291,10 @@ class Text extends _xfa_object.ContentObject { this.usehref = attributes.usehref || ""; } + [_xfa_object.$acceptWhitespace]() { + return true; + } + [_xfa_object.$onChild](child) { if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) { this[_xfa_object.$content] = child; @@ -61411,16 +64305,17 @@ class Text extends _xfa_object.ContentObject { return false; } + [_xfa_object.$onText](str) { + if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) { + return; + } + + super[_xfa_object.$onText](str); + } + [_xfa_object.$toHTML](availableSpace) { if (typeof this[_xfa_object.$content] === "string") { - const html = { - name: "span", - attributes: { - class: "xfaRich", - style: {} - }, - value: this[_xfa_object.$content] - }; + const html = valueToHtml(this[_xfa_object.$content]).html; if (this[_xfa_object.$content].includes("\u2029")) { html.name = "div"; @@ -61474,11 +64369,7 @@ class TextEdit extends _xfa_object.XFAObject { }); this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]); this.id = attributes.id || ""; - this.multiLine = (0, _utils.getInteger)({ - data: attributes.multiLine, - defaultValue: 1, - validate: x => x === 0 - }); + this.multiLine = attributes.multiLine || ""; this.use = attributes.use || ""; this.usehref = attributes.usehref || ""; this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]); @@ -61488,16 +64379,32 @@ class TextEdit extends _xfa_object.XFAObject { this.margin = null; } + [_xfa_object.$clean](builder) { + super[_xfa_object.$clean](builder); + + const parent = this[_xfa_object.$getParent](); + + const defaultValue = parent instanceof Draw ? 1 : 0; + this.multiLine = (0, _utils.getInteger)({ + data: this.multiLine, + defaultValue, + validate: x => x === 0 || x === 1 + }); + } + [_xfa_object.$toHTML](availableSpace) { const style = (0, _html_utils.toStyle)(this, "border", "font", "margin"); let html; + const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent](); + if (this.multiLine === 1) { html = { name: "textarea", attributes: { - fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid], - class: "xfaTextfield", + dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], + fieldId: field[_xfa_object.$uid], + class: ["xfaTextfield"], style } }; @@ -61506,8 +64413,9 @@ class TextEdit extends _xfa_object.XFAObject { name: "input", attributes: { type: "text", - fieldId: this[_xfa_object.$getParent]()[_xfa_object.$getParent]()[_xfa_object.$uid], - class: "xfaTextfield", + dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid], + fieldId: field[_xfa_object.$uid], + class: ["xfaTextfield"], style } }; @@ -61516,7 +64424,7 @@ class TextEdit extends _xfa_object.XFAObject { return _utils.HTMLResult.success({ name: "label", attributes: { - class: "xfaLabel" + class: ["xfaLabel"] }, children: [html] }); @@ -61534,11 +64442,13 @@ class Time extends _xfa_object.StringObject { } [_xfa_object.$finalize]() { - this[_xfa_object.$content] = new Date(this[_xfa_object.$content]); + const date = this[_xfa_object.$content].trim(); + + this[_xfa_object.$content] = date ? new Date(date) : null; } [_xfa_object.$toHTML](availableSpace) { - return _utils.HTMLResult.success(this[_xfa_object.$content].toString()); + return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : ""); } } @@ -62255,7 +65165,359 @@ class TemplateNamespace { exports.TemplateNamespace = TemplateNamespace; /***/ }), -/* 73 */ +/* 81 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.addHTML = addHTML; +exports.checkDimensions = checkDimensions; +exports.flushHTML = flushHTML; +exports.getAvailableSpace = getAvailableSpace; + +var _xfa_object = __w_pdfjs_require__(75); + +var _html_utils = __w_pdfjs_require__(82); + +function createLine(node, children) { + return { + name: "div", + attributes: { + class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"] + }, + children + }; +} + +function flushHTML(node) { + if (!node[_xfa_object.$extra]) { + return null; + } + + const attributes = node[_xfa_object.$extra].attributes; + const html = { + name: "div", + attributes, + children: node[_xfa_object.$extra].children + }; + + if (node[_xfa_object.$extra].failingNode) { + const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML](); + + if (htmlFromFailing) { + if (node.layout.endsWith("-tb")) { + html.children.push(createLine(node, [htmlFromFailing])); + } else { + html.children.push(htmlFromFailing); + } + } + } + + if (html.children.length === 0) { + return null; + } + + return html; +} + +function addHTML(node, html, bbox) { + const extra = node[_xfa_object.$extra]; + const availableSpace = extra.availableSpace; + const [x, y, w, h] = bbox; + + switch (node.layout) { + case "position": + { + extra.width = Math.max(extra.width, x + w); + extra.height = Math.max(extra.height, y + h); + extra.children.push(html); + break; + } + + case "lr-tb": + case "rl-tb": + if (!extra.line || extra.attempt === 1) { + extra.line = createLine(node, []); + extra.children.push(extra.line); + extra.numberInLine = 0; + } + + extra.numberInLine += 1; + extra.line.children.push(html); + + if (extra.attempt === 0) { + extra.currentWidth += w; + extra.height = Math.max(extra.height, extra.prevHeight + h); + } else { + extra.currentWidth = w; + extra.prevHeight = extra.height; + extra.height += h; + extra.attempt = 0; + } + + extra.width = Math.max(extra.width, extra.currentWidth); + break; + + case "rl-row": + case "row": + { + extra.children.push(html); + extra.width += w; + extra.height = Math.max(extra.height, h); + const height = (0, _html_utils.measureToString)(extra.height); + + for (const child of extra.children) { + child.attributes.style.height = height; + } + + break; + } + + case "table": + { + extra.width = Math.min(availableSpace.width, Math.max(extra.width, w)); + extra.height += h; + extra.children.push(html); + break; + } + + case "tb": + { + extra.width = availableSpace.width; + extra.height += h; + extra.children.push(html); + break; + } + } +} + +function getAvailableSpace(node) { + const availableSpace = node[_xfa_object.$extra].availableSpace; + const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0; + const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0; + + switch (node.layout) { + case "lr-tb": + case "rl-tb": + if (node[_xfa_object.$extra].attempt === 0) { + return { + width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth, + height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight + }; + } + + return { + width: availableSpace.width - marginH, + height: availableSpace.height - marginV - node[_xfa_object.$extra].height + }; + + case "rl-row": + case "row": + const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x); + + return { + width, + height: availableSpace.height - marginH + }; + + case "table": + case "tb": + return { + width: availableSpace.width - marginH, + height: availableSpace.height - marginV - node[_xfa_object.$extra].height + }; + + case "position": + default: + return availableSpace; + } +} + +function getTransformedBBox(node) { + let w = node.w === "" ? NaN : node.w; + let h = node.h === "" ? NaN : node.h; + let [centerX, centerY] = [0, 0]; + + switch (node.anchorType || "") { + case "bottomCenter": + [centerX, centerY] = [w / 2, h]; + break; + + case "bottomLeft": + [centerX, centerY] = [0, h]; + break; + + case "bottomRight": + [centerX, centerY] = [w, h]; + break; + + case "middleCenter": + [centerX, centerY] = [w / 2, h / 2]; + break; + + case "middleLeft": + [centerX, centerY] = [0, h / 2]; + break; + + case "middleRight": + [centerX, centerY] = [w, h / 2]; + break; + + case "topCenter": + [centerX, centerY] = [w / 2, 0]; + break; + + case "topRight": + [centerX, centerY] = [w, 0]; + break; + } + + let x, y; + + switch (node.rotate || 0) { + case 0: + [x, y] = [-centerX, -centerY]; + break; + + case 90: + [x, y] = [-centerY, centerX]; + [w, h] = [h, -w]; + break; + + case 180: + [x, y] = [centerX, centerY]; + [w, h] = [-w, -h]; + break; + + case 270: + [x, y] = [centerY, -centerX]; + [w, h] = [-h, w]; + break; + } + + return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)]; +} + +function checkDimensions(node, space) { + if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) { + return true; + } + + if (node.w === 0 || node.h === 0) { + return true; + } + + const ERROR = 2; + + const parent = node[_xfa_object.$getSubformParent](); + + const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0; + const [, y, w, h] = getTransformedBBox(node); + + switch (parent.layout) { + case "lr-tb": + case "rl-tb": + if (attempt === 0) { + if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { + if (node.h !== "" && Math.round(h - space.height) > ERROR) { + return false; + } + + if (node.w !== "") { + if (Math.round(w - space.width) <= ERROR) { + return true; + } + + if (parent[_xfa_object.$extra].numberInLine === 0) { + return space.height > 0; + } + + return false; + } + + return space.width > 0; + } + + if (node.w !== "") { + return Math.round(w - space.width) <= ERROR; + } + + return space.width > 0; + } + + if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { + return true; + } + + if (node.h !== "" && Math.round(h - space.height) > ERROR) { + return false; + } + + if (node.w === "" || Math.round(w - space.width) <= ERROR) { + return space.height > 0; + } + + if (parent[_xfa_object.$isThereMoreWidth]()) { + return false; + } + + return space.height > 0; + + case "table": + case "tb": + if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { + return true; + } + + if (node.h !== "" && !node[_xfa_object.$isSplittable]()) { + return Math.round(h - space.height) <= ERROR; + } + + if (node.w === "" || Math.round(w - space.width) <= ERROR) { + return space.height > 0; + } + + if (parent[_xfa_object.$isThereMoreWidth]()) { + return false; + } + + return space.height > 0; + + case "position": + if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { + return true; + } + + if (node.h === "" || Math.round(h + y - space.height) <= ERROR) { + return true; + } + + const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea; + + return h + y > area.h; + + case "rl-row": + case "row": + if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) { + return true; + } + + if (node.h !== "") { + return Math.round(h - space.height) <= ERROR; + } + + return true; + + default: + return true; + } +} + +/***/ }), +/* 82 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -62263,24 +65525,29 @@ exports.TemplateNamespace = TemplateNamespace; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.addExtraDivForBorder = addExtraDivForBorder; exports.computeBbox = computeBbox; +exports.createWrapper = createWrapper; exports.fixDimensions = fixDimensions; exports.fixTextIndent = fixTextIndent; -exports.getFonts = getFonts; +exports.isPrintOnly = isPrintOnly; exports.layoutClass = layoutClass; -exports.layoutText = layoutText; +exports.layoutNode = layoutNode; exports.measureToString = measureToString; +exports.setAccess = setAccess; +exports.setFontFamily = setFontFamily; +exports.setMinMaxDimensions = setMinMaxDimensions; +exports.setPara = setPara; exports.toStyle = toStyle; -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); -var _utils = __w_pdfjs_require__(69); +var _utils = __w_pdfjs_require__(76); -var _util = __w_pdfjs_require__(2); +var _fonts = __w_pdfjs_require__(83); -const wordNonWordRegex = new RegExp("([\\p{N}\\p{L}\\p{M}]+)|([^\\p{N}\\p{L}\\p{M}]+)", "gu"); -const wordFirstRegex = new RegExp("^[\\p{N}\\p{L}\\p{M}]", "u"); +var _text = __w_pdfjs_require__(84); + +var _util = __w_pdfjs_require__(2); function measureToString(m) { if (typeof m === "string") { @@ -62292,7 +65559,7 @@ function measureToString(m) { const converters = { anchorType(node, style) { - const parent = node[_xfa_object.$getParent](); + const parent = node[_xfa_object.$getSubformParent](); if (!parent || parent.layout && parent.layout !== "position") { return; @@ -62338,7 +65605,7 @@ const converters = { }, dimensions(node, style) { - const parent = node[_xfa_object.$getParent](); + const parent = node[_xfa_object.$getSubformParent](); let width = node.w; const height = node.h; @@ -62365,33 +65632,17 @@ const converters = { style.width = measureToString(width); } else { style.width = "auto"; - - if (node.maxW > 0) { - style.maxWidth = measureToString(node.maxW); - } - - if (parent.layout === "position") { - style.minWidth = measureToString(node.minW); - } } if (height !== "") { style.height = measureToString(height); } else { style.height = "auto"; - - if (node.maxH > 0) { - style.maxHeight = measureToString(node.maxH); - } - - if (parent.layout === "position") { - style.minHeight = measureToString(node.minH); - } } }, position(node, style) { - const parent = node[_xfa_object.$getParent](); + const parent = node[_xfa_object.$getSubformParent](); if (parent && parent.layout && parent.layout !== "position") { return; @@ -62442,129 +65693,138 @@ const converters = { } } else { switch (node.hAlign) { - case "right": + case "left": + style.alignSelf = "start"; + break; + case "center": - style.justifyContent = node.hAlign; + style.alignSelf = "center"; + break; + + case "right": + style.alignSelf = "end"; break; } } }, - borderMarginPadding(node, style) { - const borderWidths = [0, 0, 0, 0]; - const borderInsets = [0, 0, 0, 0]; - const marginNode = node.margin ? [node.margin.topInset, node.margin.rightInset, node.margin.bottomInset, node.margin.leftInset] : [0, 0, 0, 0]; - let borderMargin; - - if (node.border) { - Object.assign(style, node.border[_xfa_object.$toStyle](borderWidths, borderInsets)); - borderMargin = style.margin; - delete style.margin; + margin(node, style) { + if (node.margin) { + style.margin = node.margin[_xfa_object.$toStyle]().margin; } + } - if (borderWidths.every(x => x === 0)) { - if (marginNode.every(x => x === 0)) { - return; - } +}; - Object.assign(style, node.margin[_xfa_object.$toStyle]()); - style.padding = style.margin; - delete style.margin; - delete style.outline; - delete style.outlineOffset; - return; +function setMinMaxDimensions(node, style) { + const parent = node[_xfa_object.$getSubformParent](); + + if (parent.layout === "position") { + if (node.minW > 0) { + style.minWidth = measureToString(node.minW); } - if (node.margin) { - Object.assign(style, node.margin[_xfa_object.$toStyle]()); - style.padding = style.margin; - delete style.margin; + if (node.maxW > 0) { + style.maxWidth = measureToString(node.maxW); } - if (!style.borderWidth) { - return; + if (node.minH > 0) { + style.minHeight = measureToString(node.minH); } - style.borderData = { - borderWidth: style.borderWidth, - borderColor: style.borderColor, - borderStyle: style.borderStyle, - margin: borderMargin - }; - delete style.borderWidth; - delete style.borderColor; - delete style.borderStyle; + if (node.maxH > 0) { + style.maxHeight = measureToString(node.maxH); + } } +} -}; +function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) { + const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder); -function layoutText(text, fontSize, space) { - let width = 0; - let height = 0; - let totalWidth = 0; - const lineHeight = fontSize * 1.5; - const averageCharSize = fontSize * 0.4; - const maxCharOnLine = Math.floor(space.width / averageCharSize); - const chunks = text.match(wordNonWordRegex); - let treatedChars = 0; - let i = 0; - let chunk = chunks[0]; + if (typeof text === "string") { + measure.addString(text); + } else { + text[_xfa_object.$pushGlyphs](measure); + } - while (chunk) { - const w = chunk.length * averageCharSize; + return measure.compute(width); +} - if (width + w <= space.width) { - width += w; - treatedChars += chunk.length; - chunk = chunks[i++]; - continue; - } +function layoutNode(node, availableSpace) { + let height = null; + let width = null; + let isBroken = false; - if (!wordFirstRegex.test(chunk) || chunk.length > maxCharOnLine) { - const numOfCharOnLine = Math.floor((space.width - width) / averageCharSize); - chunk = chunk.slice(numOfCharOnLine); - treatedChars += numOfCharOnLine; + if ((!node.w || !node.h) && node.value) { + let marginH = 0; + let marginV = 0; - if (height + lineHeight > space.height) { - return { - width: 0, - height: 0, - splitPos: treatedChars - }; - } + if (node.margin) { + marginH = node.margin.leftInset + node.margin.rightInset; + marginV = node.margin.topInset + node.margin.bottomInset; + } - totalWidth = Math.max(width, totalWidth); - width = 0; - height += lineHeight; - continue; + let lineHeight = null; + let margin = null; + + if (node.para) { + margin = Object.create(null); + lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight; + margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove; + margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow; + margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft; + margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight; } - if (height + lineHeight > space.height) { - return { - width: 0, - height: 0, - splitPos: treatedChars - }; + let font = node.font; + + if (!font) { + const root = node[_xfa_object.$getTemplateRoot](); + + let parent = node[_xfa_object.$getParent](); + + while (parent !== root) { + if (parent.font) { + font = parent.font; + break; + } + + parent = parent[_xfa_object.$getParent](); + } } - totalWidth = Math.max(width, totalWidth); - width = w; - height += lineHeight; - chunk = chunks[i++]; - } + const maxWidth = !node.w ? availableSpace.width : node.w; + const fontFinder = node[_xfa_object.$globalData].fontFinder; - if (totalWidth === 0) { - totalWidth = width; - } + if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") { + const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth); + width = res.width; + height = res.height; + isBroken = res.isBroken; + } else { + const text = node.value[_xfa_object.$text](); + + if (text) { + const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth); + width = res.width; + height = res.height; + isBroken = res.isBroken; + } + } + + if (width !== null && !node.w) { + width += marginH; + } - if (totalWidth !== 0) { - height += lineHeight; + if (height !== null && !node.h) { + height += marginV; + } } return { - width: totalWidth, - height, - splitPos: -1 + w: width, + h: height, + isBroken }; } @@ -62582,7 +65842,7 @@ function computeBbox(node, html, availableSpace) { if (width === "") { if (node.maxW === 0) { - const parent = node[_xfa_object.$getParent](); + const parent = node[_xfa_object.$getSubformParent](); if (parent.layout === "position" && parent.w !== "") { width = 0; @@ -62600,7 +65860,7 @@ function computeBbox(node, html, availableSpace) { if (height === "") { if (node.maxH === 0) { - const parent = node[_xfa_object.$getParent](); + const parent = node[_xfa_object.$getSubformParent](); if (parent.layout === "position" && parent.h !== "") { height = 0; @@ -62621,7 +65881,7 @@ function computeBbox(node, html, availableSpace) { } function fixDimensions(node) { - const parent = node[_xfa_object.$getParent](); + const parent = node[_xfa_object.$getSubformParent](); if (parent.layout && parent.layout.includes("row")) { const extra = parent[_xfa_object.$extra]; @@ -62639,32 +65899,13 @@ function fixDimensions(node) { } } - if (parent.w && node.w) { - node.w = Math.min(parent.w, node.w); - } - - if (parent.h && node.h) { - node.h = Math.min(parent.h, node.h); - } - if (parent.layout && parent.layout !== "position") { node.x = node.y = 0; - - if (parent.layout === "tb") { - if (parent.w !== "" && (node.w === "" || node.w === 0 || node.w > parent.w)) { - node.w = parent.w; - } - } } - if (node.layout === "position") { - node.minW = node.minH = 0; - node.maxW = node.maxH = Infinity; - } else { - if (node.layout === "table") { - if (node.w === "" && Array.isArray(node.columnWidths)) { - node.w = node.columnWidths.reduce((a, x) => a + x, 0); - } + if (node.layout === "table") { + if (node.w === "" && Array.isArray(node.columnWidths)) { + node.w = node.columnWidths.reduce((a, x) => a + x, 0); } } } @@ -62707,6 +65948,11 @@ function toStyle(node, ...names) { continue; } + if (converters.hasOwnProperty(name)) { + converters[name](node, style); + continue; + } + if (value instanceof _xfa_object.XFAObject) { const newStyle = value[_xfa_object.$toStyle](); @@ -62715,102 +65961,114 @@ function toStyle(node, ...names) { } else { (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`); } - - continue; - } - - if (converters.hasOwnProperty(name)) { - converters[name](node, style); } } return style; } -function addExtraDivForBorder(html) { - const style = html.attributes.style; - const data = style.borderData; - const children = []; - const attributes = { - class: "xfaWrapper", - style: Object.create(null) +function createWrapper(node, html) { + const { + attributes + } = html; + const { + style + } = attributes; + const wrapper = { + name: "div", + attributes: { + class: ["xfaWrapper"], + style: Object.create(null) + }, + children: [] }; + attributes.class.push("xfaWrapped"); - for (const key of ["top", "left"]) { - if (style[key] !== undefined) { - attributes.style[key] = style[key]; - } - } - - delete style.top; - delete style.left; - - if (style.position === "absolute") { - attributes.style.position = "absolute"; - } else { - attributes.style.position = "relative"; - } - - delete style.position; - - if (style.justifyContent) { - attributes.style.justifyContent = style.justifyContent; - delete style.justifyContent; - } + if (node.border) { + const { + widths, + insets + } = node.border[_xfa_object.$extra]; + let width, height; + let top = insets[0]; + let left = insets[3]; + const insetsH = insets[0] + insets[2]; + const insetsW = insets[1] + insets[3]; + + switch (node.border.hand) { + case "even": + top -= widths[0] / 2; + left -= widths[3] / 2; + width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`; + height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`; + break; - if (data) { - delete style.borderData; - let insets; + case "left": + top -= widths[0]; + left -= widths[3]; + width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`; + height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`; + break; - if (data.margin) { - insets = data.margin.split(" "); - delete data.margin; - } else { - insets = ["0px", "0px", "0px", "0px"]; + case "right": + width = insetsW ? `calc(100% - ${insetsW}px)` : "100%"; + height = insetsH ? `calc(100% - ${insetsH}px)` : "100%"; + break; } - let width = "100%"; - let height = width; - - if (insets[1] !== "0px" || insets[3] !== "0px") { - width = `calc(100% - ${parseInt(insets[1]) + parseInt(insets[3])}px`; - } + const classNames = ["xfaBorder"]; - if (insets[0] !== "0px" || insets[2] !== "0px") { - height = `calc(100% - ${parseInt(insets[0]) + parseInt(insets[2])}px`; + if (isPrintOnly(node.border)) { + classNames.push("xfaPrintOnly"); } - const borderStyle = { - top: insets[0], - left: insets[3], - width, - height + const border = { + name: "div", + attributes: { + class: classNames, + style: { + top: `${top}px`, + left: `${left}px`, + width, + height + } + }, + children: [] }; - for (const [k, v] of Object.entries(data)) { - borderStyle[k] = v; + for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) { + if (style[key] !== undefined) { + border.attributes.style[key] = style[key]; + delete style[key]; + } } - if (style.transform) { - borderStyle.transform = style.transform; + wrapper.children.push(border, html); + } else { + wrapper.children.push(html); + } + + for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) { + if (style[key] !== undefined) { + wrapper.attributes.style[key] = style[key]; + delete style[key]; } + } - const borderDiv = { - name: "div", - attributes: { - class: "xfaBorderDiv", - style: borderStyle - } - }; - children.push(borderDiv); + if (style.position === "absolute") { + wrapper.attributes.style.position = "absolute"; + } else { + wrapper.attributes.style.position = "relative"; } - children.push(html); - return { - name: "div", - attributes, - children - }; + delete style.position; + + if (style.alignSelf) { + wrapper.attributes.style.alignSelf = style.alignSelf; + delete style.alignSelf; + } + + return wrapper; } function fixTextIndent(styles) { @@ -62820,39 +66078,104 @@ function fixTextIndent(styles) { return; } - const align = styles.textAlign || "left"; + const align = styles.textAlign === "right" ? "right" : "left"; + const name = "padding" + (align === "left" ? "Left" : "Right"); + const padding = (0, _utils.getMeasurement)(styles[name], "0px"); + styles[name] = `${padding - indent}px`; +} + +function setAccess(node, classNames) { + switch (node.access) { + case "nonInteractive": + classNames.push("xfaNonInteractive"); + break; - if (align === "left" || align === "right") { - const name = "margin" + (align === "left" ? "Left" : "Right"); - const margin = (0, _utils.getMeasurement)(styles[name], "0px"); - styles[name] = `${margin - indent}pt`; + case "readOnly": + classNames.push("xfaReadOnly"); + break; + + case "protected": + classNames.push("xfaDisabled"); + break; } } -function getFonts(family) { - if (family.startsWith("'")) { - family = `"${family.slice(1, family.length - 1)}"`; - } else if (family.includes(" ") && !family.startsWith('"')) { - family = `"${family}"`; - } +function isPrintOnly(node) { + return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print"; +} - const fonts = [family]; +function setPara(node, nodeStyle, value) { + if (value.attributes.class && value.attributes.class.includes("xfaRich")) { + if (nodeStyle) { + if (node.h === "") { + nodeStyle.height = "auto"; + } - switch (family) { - case `"Myriad Pro"`: - fonts.push(`"Roboto Condensed"`, `"Ubuntu Condensed"`, `"Microsoft Sans Serif"`, `"Apple Symbols"`, "Helvetica", `"sans serif"`); - break; + if (node.w === "") { + nodeStyle.width = "auto"; + } + } - case "Arial": - fonts.push("Helvetica", `"Liberation Sans"`, "Arimo", `"sans serif"`); - break; + if (node.para) { + const valueStyle = value.attributes.style; + valueStyle.display = "flex"; + valueStyle.flexDirection = "column"; + + switch (node.para.vAlign) { + case "top": + valueStyle.justifyContent = "start"; + break; + + case "bottom": + valueStyle.justifyContent = "end"; + break; + + case "middle": + valueStyle.justifyContent = "center"; + break; + } + + const paraStyle = node.para[_xfa_object.$toStyle](); + + for (const [key, val] of Object.entries(paraStyle)) { + if (!(key in valueStyle)) { + valueStyle[key] = val; + } + } + } } +} + +function setFontFamily(xfaFont, fontFinder, style) { + const name = (0, _utils.stripQuotes)(xfaFont.typeface); + const typeface = fontFinder.find(name); + style.fontFamily = `"${name}"`; + + if (typeface) { + const { + fontFamily + } = typeface.regular.cssFontInfo; + + if (fontFamily !== name) { + style.fontFamily = `"${fontFamily}"`; + } + + if (style.lineHeight) { + return; + } - return fonts.join(","); + const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface); + + if (pdfFont && pdfFont.lineHeight > 0) { + style.lineHeight = Math.max(1.2, pdfFont.lineHeight); + } else { + style.lineHeight = 1.2; + } + } } /***/ }), -/* 74 */ +/* 83 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -62860,173 +66183,174 @@ function getFonts(family) { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.addHTML = addHTML; -exports.flushHTML = flushHTML; -exports.getAvailableSpace = getAvailableSpace; +exports.selectFont = selectFont; +exports.FontFinder = void 0; -var _xfa_object = __w_pdfjs_require__(68); +var _util = __w_pdfjs_require__(2); -var _html_utils = __w_pdfjs_require__(73); +class FontFinder { + constructor(pdfFonts) { + this.fonts = new Map(); + this.cache = new Map(); + this.warned = new Set(); + this.defaultFont = null; + this.add(pdfFonts); + } -function flushHTML(node) { - const attributes = node[_xfa_object.$extra].attributes; - const html = { - name: "div", - attributes, - children: node[_xfa_object.$extra].children - }; + add(pdfFonts, reallyMissingFonts = null) { + for (const pdfFont of pdfFonts) { + this.addPdfFont(pdfFont); + } - if (node[_xfa_object.$extra].failingNode) { - const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML](); + for (const pdfFont of this.fonts.values()) { + if (!pdfFont.regular) { + pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic; + } + } - if (htmlFromFailing) { - html.children.push(htmlFromFailing); + if (!reallyMissingFonts || reallyMissingFonts.size === 0) { + return; } - } - if (html.children.length === 0) { - return null; + const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA"); + + for (const missing of reallyMissingFonts) { + this.fonts.set(missing, myriad); + } } - node[_xfa_object.$extra].children = []; - delete node[_xfa_object.$extra].line; - return html; -} + addPdfFont(pdfFont) { + const cssFontInfo = pdfFont.cssFontInfo; + const name = cssFontInfo.fontFamily; + let font = this.fonts.get(name); -function addHTML(node, html, bbox) { - const extra = node[_xfa_object.$extra]; - const availableSpace = extra.availableSpace; + if (!font) { + font = Object.create(null); + this.fonts.set(name, font); - switch (node.layout) { - case "position": - { - const [x, y, w, h] = bbox; - extra.width = Math.max(extra.width, x + w); - extra.height = Math.max(extra.height, y + h); - extra.children.push(html); - break; + if (!this.defaultFont) { + this.defaultFont = font; } + } - case "lr-tb": - case "rl-tb": - if (!extra.line || extra.attempt === 1) { - extra.line = { - name: "div", - attributes: { - class: node.layout === "lr-tb" ? "xfaLr" : "xfaRl" - }, - children: [] - }; - extra.children.push(extra.line); - } + let property = ""; + const fontWeight = parseFloat(cssFontInfo.fontWeight); - extra.line.children.push(html); + if (parseFloat(cssFontInfo.italicAngle) !== 0) { + property = fontWeight >= 700 ? "bolditalic" : "italic"; + } else if (fontWeight >= 700) { + property = "bold"; + } - if (extra.attempt === 0) { - const [,, w, h] = bbox; - extra.currentWidth += w; - extra.height = Math.max(extra.height, extra.prevHeight + h); - } else { - const [,, w, h] = bbox; - extra.width = Math.max(extra.width, extra.currentWidth); - extra.currentWidth = w; - extra.prevHeight = extra.height; - extra.height += h; - extra.attempt = 0; + if (!property) { + if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) { + property = "bold"; } - break; + if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) { + property += "italic"; + } + } - case "rl-row": - case "row": - { - extra.children.push(html); - const [,, w, h] = bbox; - extra.width += w; - extra.height = Math.max(extra.height, h); - const height = (0, _html_utils.measureToString)(extra.height); + if (!property) { + property = "regular"; + } - for (const child of extra.children) { - if (child.attributes.class === "xfaWrapper") { - child.children[child.children.length - 1].attributes.style.height = height; - } else { - child.attributes.style.height = height; - } - } + font[property] = pdfFont; + } - break; - } + getDefault() { + return this.defaultFont; + } - case "table": - { - const [,, w, h] = bbox; - extra.width = Math.min(availableSpace.width, Math.max(extra.width, w)); - extra.height += h; - extra.children.push(html); - break; + find(fontName, mustWarn = true) { + let font = this.fonts.get(fontName) || this.cache.get(fontName); + + if (font) { + return font; + } + + const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi; + let name = fontName.replace(pattern, ""); + font = this.fonts.get(name); + + if (font) { + this.cache.set(fontName, font); + return font; + } + + name = name.toLowerCase(); + const maybe = []; + + for (const [family, pdfFont] of this.fonts.entries()) { + if (family.replace(pattern, "").toLowerCase().startsWith(name)) { + maybe.push(pdfFont); } + } - case "tb": - { - const [,,, h] = bbox; - extra.width = availableSpace.width; - extra.height += h; - extra.children.push(html); - break; + if (maybe.length === 0) { + for (const [, pdfFont] of this.fonts.entries()) { + if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) { + maybe.push(pdfFont); + } } - } -} + } -function getAvailableSpace(node) { - const availableSpace = node[_xfa_object.$extra].availableSpace; + if (maybe.length === 0) { + name = name.replace(/psmt|mt/gi, ""); - switch (node.layout) { - case "lr-tb": - case "rl-tb": - switch (node[_xfa_object.$extra].attempt) { - case 0: - return { - width: availableSpace.width - node[_xfa_object.$extra].currentWidth, - height: availableSpace.height - node[_xfa_object.$extra].prevHeight - }; + for (const [family, pdfFont] of this.fonts.entries()) { + if (family.replace(pattern, "").toLowerCase().startsWith(name)) { + maybe.push(pdfFont); + } + } + } - case 1: - return { - width: availableSpace.width, - height: availableSpace.height - node[_xfa_object.$extra].height - }; + if (maybe.length === 0) { + for (const pdfFont of this.fonts.values()) { + if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) { + maybe.push(pdfFont); + } + } + } - default: - return { - width: Infinity, - height: availableSpace.height - node[_xfa_object.$extra].prevHeight - }; + if (maybe.length >= 1) { + if (maybe.length !== 1 && mustWarn) { + (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`); } - case "rl-row": - case "row": - const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x); + this.cache.set(fontName, maybe[0]); + return maybe[0]; + } - return { - width, - height: availableSpace.height - }; + if (mustWarn && !this.warned.has(fontName)) { + this.warned.add(fontName); + (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`); + } - case "table": - case "tb": - return { - width: availableSpace.width, - height: availableSpace.height - node[_xfa_object.$extra].height - }; + return null; + } - case "position": - default: - return availableSpace; +} + +exports.FontFinder = FontFinder; + +function selectFont(xfaFont, typeface) { + if (xfaFont.posture === "italic") { + if (xfaFont.weight === "bold") { + return typeface.bolditalic; + } + + return typeface.italic; + } else if (xfaFont.weight === "bold") { + return typeface.bold; } + + return typeface.regular; } /***/ }), -/* 75 */ +/* 84 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -63034,333 +66358,332 @@ function getAvailableSpace(node) { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createDataNode = createDataNode; -exports.searchNode = searchNode; +exports.TextMeasure = void 0; -var _xfa_object = __w_pdfjs_require__(68); +var _fonts = __w_pdfjs_require__(83); -var _util = __w_pdfjs_require__(2); +const WIDTH_FACTOR = 1.01; -const namePattern = /^[^.[]+/; -const indexPattern = /^[^\]]+/; -const operators = { - dot: 0, - dotDot: 1, - dotHash: 2, - dotBracket: 3, - dotParen: 4 -}; -const shortcuts = new Map([["$data", (root, current) => root.datasets.data], ["$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]]); -const somCache = new WeakMap(); +class FontInfo { + constructor(xfaFont, margin, lineHeight, fontFinder) { + this.lineHeight = lineHeight; + this.paraMargin = margin || { + top: 0, + bottom: 0, + left: 0, + right: 0 + }; -function parseIndex(index) { - index = index.trim(); + if (!xfaFont) { + [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); + return; + } - if (index === "*") { - return Infinity; - } + this.xfaFont = { + typeface: xfaFont.typeface, + posture: xfaFont.posture, + weight: xfaFont.weight, + size: xfaFont.size, + letterSpacing: xfaFont.letterSpacing + }; + const typeface = fontFinder.find(xfaFont.typeface); - return parseInt(index, 10) || 0; -} + if (!typeface) { + [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); + return; + } -function parseExpression(expr, dotDotAllowed) { - let match = expr.match(namePattern); + this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface); - if (!match) { - return null; + if (!this.pdfFont) { + [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); + } } - let [name] = match; - const parsed = [{ - name, - cacheName: "." + name, - index: 0, - js: null, - formCalc: null, - operator: operators.dot - }]; - let pos = name.length; - - while (pos < expr.length) { - const spos = pos; - const char = expr.charAt(pos++); - - if (char === "[") { - match = expr.slice(pos).match(indexPattern); + defaultFont(fontFinder) { + const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault(); - if (!match) { - (0, _util.warn)("XFA - Invalid index in SOM expression"); - return null; - } - - parsed[parsed.length - 1].index = parseIndex(match[0]); - pos += match[0].length + 1; - continue; + if (font && font.regular) { + const pdfFont = font.regular; + const info = pdfFont.cssFontInfo; + const xfaFont = { + typeface: info.fontFamily, + posture: "normal", + weight: "normal", + size: 10, + letterSpacing: 0 + }; + return [pdfFont, xfaFont]; } - let operator; - - switch (expr.charAt(pos)) { - case ".": - if (!dotDotAllowed) { - return null; - } + const xfaFont = { + typeface: "Courier", + posture: "normal", + weight: "normal", + size: 10, + letterSpacing: 0 + }; + return [null, xfaFont]; + } - pos++; - operator = operators.dotDot; - break; +} - case "#": - pos++; - operator = operators.dotHash; - break; +class FontSelector { + constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) { + this.fontFinder = fontFinder; + this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)]; + } - case "[": - operator = operators.dotBracket; - break; + pushData(xfaFont, margin, lineHeight) { + const lastFont = this.stack[this.stack.length - 1]; - case "(": - operator = operators.dotParen; - break; + for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) { + if (!xfaFont[name]) { + xfaFont[name] = lastFont.xfaFont[name]; + } + } - default: - operator = operators.dot; - break; + for (const name of ["top", "bottom", "left", "right"]) { + if (isNaN(margin[name])) { + margin[name] = lastFont.paraMargin[name]; + } } - match = expr.slice(pos).match(namePattern); + const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder); - if (!match) { - break; + if (!fontInfo.pdfFont) { + fontInfo.pdfFont = lastFont.pdfFont; } - [name] = match; - pos += name.length; - parsed.push({ - name, - cacheName: expr.slice(spos, pos), - operator, - index: 0, - js: null, - formCalc: null - }); + this.stack.push(fontInfo); + } + + popFont() { + this.stack.pop(); + } + + topFont() { + return this.stack[this.stack.length - 1]; } - return parsed; } -function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) { - const parsed = parseExpression(expr, dotDotAllowed); +class TextMeasure { + constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) { + this.glyphs = []; + this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts); + this.extraHeight = 0; + } - if (!parsed) { - return null; + pushData(xfaFont, margin, lineHeight) { + this.fontSelector.pushData(xfaFont, margin, lineHeight); } - const fn = shortcuts.get(parsed[0].name); - let i = 0; - let isQualified; + popFont(xfaFont) { + return this.fontSelector.popFont(); + } - if (fn) { - isQualified = true; - root = [fn(root, container)]; - i = 1; - } else { - isQualified = container === null; - root = [container || root]; + addPara() { + const lastFont = this.fontSelector.topFont(); + this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom; } - for (let ii = parsed.length; i < ii; i++) { - const { - name, - cacheName, - operator, - index - } = parsed[i]; - const nodes = []; + addString(str) { + if (!str) { + return; + } - for (const node of root) { - if (!(node instanceof _xfa_object.XFAObject)) { - continue; - } + const lastFont = this.fontSelector.topFont(); + const fontSize = lastFont.xfaFont.size; - let children, cached; + if (lastFont.pdfFont) { + const letterSpacing = lastFont.xfaFont.letterSpacing; + const pdfFont = lastFont.pdfFont; + const lineHeight = lastFont.lineHeight || Math.ceil(Math.max(1.2, pdfFont.lineHeight) * fontSize); + const scale = fontSize / 1000; - if (useCache) { - cached = somCache.get(node); + for (const line of str.split(/[\u2029\n]/)) { + const encodedLine = pdfFont.encodeString(line).join(""); + const glyphs = pdfFont.charsToGlyphs(encodedLine); - if (!cached) { - cached = new Map(); - somCache.set(node, cached); + for (const glyph of glyphs) { + this.glyphs.push([glyph.width * scale + letterSpacing, lineHeight, glyph.unicode === " ", false]); } - children = cached.get(cacheName); + this.glyphs.push([0, 0, false, true]); } - if (!children) { - switch (operator) { - case operators.dot: - children = node[_xfa_object.$getChildrenByName](name, false); - break; + this.glyphs.pop(); + return; + } - case operators.dotDot: - children = node[_xfa_object.$getChildrenByName](name, true); - break; + for (const line of str.split(/[\u2029\n]/)) { + for (const char of line.split("")) { + this.glyphs.push([fontSize, fontSize, char === " ", false]); + } - case operators.dotHash: - children = node[_xfa_object.$getChildrenByClass](name); + this.glyphs.push([0, 0, false, true]); + } - if (children instanceof _xfa_object.XFAObjectArray) { - children = children.children; - } else { - children = [children]; - } + this.glyphs.pop(); + } - break; + compute(maxWidth) { + let lastSpacePos = -1, + lastSpaceWidth = 0, + width = 0, + height = 0, + currentLineWidth = 0, + currentLineHeight = 0; + let isBroken = false; - default: - break; - } + for (let i = 0, ii = this.glyphs.length; i < ii; i++) { + const [glyphWidth, glyphHeight, isSpace, isEOL] = this.glyphs[i]; - if (useCache) { - cached.set(cacheName, children); - } + if (isEOL) { + width = Math.max(width, currentLineWidth); + currentLineWidth = 0; + height += currentLineHeight; + currentLineHeight = glyphHeight; + lastSpacePos = -1; + lastSpaceWidth = 0; + continue; } - if (children.length > 0) { - nodes.push(children); + if (isSpace) { + if (currentLineWidth + glyphWidth > maxWidth) { + width = Math.max(width, currentLineWidth); + currentLineWidth = 0; + height += currentLineHeight; + currentLineHeight = glyphHeight; + lastSpacePos = -1; + lastSpaceWidth = 0; + isBroken = true; + } else { + currentLineHeight = Math.max(glyphHeight, currentLineHeight); + lastSpaceWidth = currentLineWidth; + currentLineWidth += glyphWidth; + lastSpacePos = i; + } + + continue; } - } - if (nodes.length === 0 && !isQualified && i === 0) { - const parent = container[_xfa_object.$getParent](); + if (currentLineWidth + glyphWidth > maxWidth) { + height += currentLineHeight; + currentLineHeight = glyphHeight; - container = parent; + if (lastSpacePos !== -1) { + i = lastSpacePos; + width = Math.max(width, lastSpaceWidth); + currentLineWidth = 0; + lastSpacePos = -1; + lastSpaceWidth = 0; + } else { + width = Math.max(width, currentLineWidth); + currentLineWidth = glyphWidth; + } - if (!container) { - return null; + isBroken = true; + continue; } - i = -1; - root = [container]; - continue; + currentLineWidth += glyphWidth; + currentLineHeight = Math.max(glyphHeight, currentLineHeight); } - if (isFinite(index)) { - root = nodes.filter(node => index < node.length).map(node => node[index]); - } else { - root = nodes.reduce((acc, node) => acc.concat(node), []); - } - } - - if (root.length === 0) { - return null; + width = Math.max(width, currentLineWidth); + height += currentLineHeight + this.extraHeight; + return { + width: WIDTH_FACTOR * width, + height, + isBroken + }; } - return root; } -function createNodes(root, path) { - let node = null; - - for (const { - name, - index - } of path) { - for (let i = 0; i <= index; i++) { - node = new _xfa_object.XmlObject(root[_xfa_object.$namespaceId], name); +exports.TextMeasure = TextMeasure; - root[_xfa_object.$appendChild](node); - } +/***/ }), +/* 85 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { - root = node; - } - return node; -} -function createDataNode(root, container, expr) { - const parsed = parseExpression(expr); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.DataHandler = void 0; - if (!parsed) { - return null; - } +var _xfa_object = __w_pdfjs_require__(75); - if (parsed.some(x => x.operator === operators.dotDot)) { - return null; +class DataHandler { + constructor(root, data) { + this.data = data; + this.dataset = root.datasets || null; } - const fn = shortcuts.get(parsed[0].name); - let i = 0; - - if (fn) { - root = fn(root, container); - i = 1; - } else { - root = container || root; - } + serialize(storage) { + const stack = [[-1, this.data[_xfa_object.$getChildren]()]]; - for (let ii = parsed.length; i < ii; i++) { - const { - name, - operator, - index - } = parsed[i]; + while (stack.length > 0) { + const last = stack[stack.length - 1]; + const [i, children] = last; - if (!isFinite(index)) { - parsed[i].index = 0; - return createNodes(root, parsed.slice(i)); - } + if (i + 1 === children.length) { + stack.pop(); + continue; + } - let children; + const child = children[++last[0]]; + const storageEntry = storage.get(child[_xfa_object.$uid]); - switch (operator) { - case operators.dot: - children = root[_xfa_object.$getChildrenByName](name, false); - break; + if (storageEntry) { + child[_xfa_object.$setValue](storageEntry); + } else { + const attributes = child[_xfa_object.$getAttributes](); - case operators.dotDot: - children = root[_xfa_object.$getChildrenByName](name, true); - break; + for (const value of attributes.values()) { + const entry = storage.get(value[_xfa_object.$uid]); - case operators.dotHash: - children = root[_xfa_object.$getChildrenByClass](name); + if (entry) { + value[_xfa_object.$setValue](entry); - if (children instanceof _xfa_object.XFAObjectArray) { - children = children.children; - } else { - children = [children]; + break; + } } + } - break; - - default: - break; - } + const nodes = child[_xfa_object.$getChildren](); - if (children.length === 0) { - return createNodes(root, parsed.slice(i)); + if (nodes.length > 0) { + stack.push([-1, nodes]); + } } - if (index < children.length) { - const child = children[index]; + const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`]; - if (!(child instanceof _xfa_object.XFAObject)) { - (0, _util.warn)(`XFA - Cannot create a node.`); - return null; + if (this.dataset) { + for (const child of this.dataset[_xfa_object.$getChildren]()) { + if (child[_xfa_object.$nodeName] !== "data") { + child[_xfa_object.$toString](buf); + } } - - root = child; - } else { - parsed[i].index = children.length - index; - return createNodes(root, parsed.slice(i)); } + + this.data[_xfa_object.$toString](buf); + + buf.push("</xfa:datasets>"); + return buf.join(""); } - return null; } +exports.DataHandler = DataHandler; + /***/ }), -/* 76 */ +/* 86 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -63370,11 +66693,11 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.XFAParser = void 0; -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); -var _xml_parser = __w_pdfjs_require__(61); +var _xml_parser = __w_pdfjs_require__(68); -var _builder = __w_pdfjs_require__(77); +var _builder = __w_pdfjs_require__(87); var _util = __w_pdfjs_require__(2); @@ -63383,6 +66706,9 @@ class XFAParser extends _xml_parser.XMLParserBase { super(); this._builder = new _builder.Builder(); this._stack = []; + this._globalData = { + usedTypefaces: new Set() + }; this._ids = new Map(); this._current = this._builder.buildRoot(this._ids); this._errorCode = _xml_parser.XMLParserErrorCode.NoError; @@ -63475,20 +66801,20 @@ class XFAParser extends _xml_parser.XMLParserBase { return [namespace, prefixes, attributeObj]; } - _getNameAndPrefix(name) { + _getNameAndPrefix(name, nsAgnostic) { const i = name.indexOf(":"); if (i === -1) { return [name, null]; } - return [name.substring(i + 1), name.substring(0, i)]; + return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)]; } onBeginElement(tagName, attributes, isEmpty) { const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName); - const [name, nsPrefix] = this._getNameAndPrefix(tagName); + const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic()); const node = this._builder.build({ nsPrefix, @@ -63498,6 +66824,8 @@ class XFAParser extends _xml_parser.XMLParserBase { prefixes }); + node[_xfa_object.$globalData] = this._globalData; + if (isEmpty) { node[_xfa_object.$finalize](); @@ -63518,6 +66846,15 @@ class XFAParser extends _xml_parser.XMLParserBase { onEndElement(name) { const node = this._current; + if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") { + const parser = new XFAParser(); + parser._globalData = this._globalData; + const root = parser.parse(node[_xfa_object.$content]); + node[_xfa_object.$content] = null; + + node[_xfa_object.$onChild](root); + } + node[_xfa_object.$finalize](); this._current = this._stack.pop(); @@ -63538,7 +66875,7 @@ class XFAParser extends _xml_parser.XMLParserBase { exports.XFAParser = XFAParser; /***/ }), -/* 77 */ +/* 87 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -63548,15 +66885,15 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.Builder = void 0; -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); -var _setup = __w_pdfjs_require__(78); +var _setup = __w_pdfjs_require__(88); -var _template = __w_pdfjs_require__(72); +var _template = __w_pdfjs_require__(80); -var _unknown = __w_pdfjs_require__(87); +var _unknown = __w_pdfjs_require__(97); var _util = __w_pdfjs_require__(2); @@ -63576,6 +66913,8 @@ class Root extends _xfa_object.XFAObject { super[_xfa_object.$finalize](); if (this.element.template instanceof _template.Template) { + this[_xfa_object.$ids].set(_xfa_object.$root, this.element); + this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]); this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids]; @@ -63598,6 +66937,7 @@ class Empty extends _xfa_object.XFAObject { class Builder { constructor() { this._namespaceStack = []; + this._nsAgnosticLevel = 0; this._namespacePrefixes = new Map(); this._namespaces = new Map(); this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({ @@ -63656,16 +66996,25 @@ class Builder { const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty(); - if (hasNamespaceDef || prefixes) { + if (node[_xfa_object.$isNsAgnostic]()) { + this._nsAgnosticLevel++; + } + + if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) { node[_xfa_object.$cleanup] = { hasNamespace: hasNamespaceDef, - prefixes + prefixes, + nsAgnostic: node[_xfa_object.$isNsAgnostic]() }; } return node; } + isNsAgnostic() { + return this._nsAgnosticLevel > 0; + } + _searchNamespace(nsName) { let ns = this._namespaces.get(nsName); @@ -63733,7 +67082,8 @@ class Builder { clean(data) { const { hasNamespace, - prefixes + prefixes, + nsAgnostic } = data; if (hasNamespace) { @@ -63747,6 +67097,10 @@ class Builder { this._namespacePrefixes.get(prefix).pop(); }); } + + if (nsAgnostic) { + this._nsAgnosticLevel--; + } } } @@ -63754,7 +67108,7 @@ class Builder { exports.Builder = Builder; /***/ }), -/* 78 */ +/* 88 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -63764,23 +67118,23 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.NamespaceSetUp = void 0; -var _config = __w_pdfjs_require__(79); +var _config = __w_pdfjs_require__(89); -var _connection_set = __w_pdfjs_require__(80); +var _connection_set = __w_pdfjs_require__(90); -var _datasets = __w_pdfjs_require__(81); +var _datasets = __w_pdfjs_require__(91); -var _locale_set = __w_pdfjs_require__(82); +var _locale_set = __w_pdfjs_require__(92); -var _signature = __w_pdfjs_require__(83); +var _signature = __w_pdfjs_require__(93); -var _stylesheet = __w_pdfjs_require__(84); +var _stylesheet = __w_pdfjs_require__(94); -var _template = __w_pdfjs_require__(72); +var _template = __w_pdfjs_require__(80); -var _xdp = __w_pdfjs_require__(85); +var _xdp = __w_pdfjs_require__(95); -var _xhtml = __w_pdfjs_require__(86); +var _xhtml = __w_pdfjs_require__(96); const NamespaceSetUp = { config: _config.ConfigNamespace, @@ -63796,7 +67150,7 @@ const NamespaceSetUp = { exports.NamespaceSetUp = NamespaceSetUp; /***/ }), -/* 79 */ +/* 89 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -63806,11 +67160,11 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.ConfigNamespace = void 0; -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); -var _utils = __w_pdfjs_require__(69); +var _utils = __w_pdfjs_require__(76); var _util = __w_pdfjs_require__(2); @@ -63950,7 +67304,7 @@ class BehaviorOverride extends _xfa_object.ContentObject { } [_xfa_object.$finalize]() { - this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => !!x && x.include(":")).map(x => x.split(":", 2))); + this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2))); } } @@ -65685,7 +69039,7 @@ class ConfigNamespace { exports.ConfigNamespace = ConfigNamespace; /***/ }), -/* 80 */ +/* 90 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -65695,9 +69049,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.ConnectionSetNamespace = void 0; -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id; @@ -65899,7 +69253,7 @@ class ConnectionSetNamespace { exports.ConnectionSetNamespace = ConnectionSetNamespace; /***/ }), -/* 81 */ +/* 91 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -65909,9 +69263,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.DatasetsNamespace = void 0; -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id; @@ -65920,6 +69274,10 @@ class Data extends _xfa_object.XmlObject { super(DATASETS_NS_ID, "data", attributes); } + [_xfa_object.$isNsAgnostic]() { + return true; + } + } class Datasets extends _xfa_object.XFAObject { @@ -65934,8 +69292,6 @@ class Datasets extends _xfa_object.XFAObject { if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) { this[name] = child; - } else { - child[_xfa_object.$global] = true; } this[_xfa_object.$appendChild](child); @@ -65965,7 +69321,7 @@ class DatasetsNamespace { exports.DatasetsNamespace = DatasetsNamespace; /***/ }), -/* 82 */ +/* 92 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -65975,11 +69331,11 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.LocaleSetNamespace = void 0; -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); -var _utils = __w_pdfjs_require__(69); +var _utils = __w_pdfjs_require__(76); const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id; @@ -66303,7 +69659,7 @@ class LocaleSetNamespace { exports.LocaleSetNamespace = LocaleSetNamespace; /***/ }), -/* 83 */ +/* 93 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -66313,9 +69669,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.SignatureNamespace = void 0; -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id; @@ -66344,7 +69700,7 @@ class SignatureNamespace { exports.SignatureNamespace = SignatureNamespace; /***/ }), -/* 84 */ +/* 94 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -66354,9 +69710,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.StylesheetNamespace = void 0; -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id; @@ -66385,7 +69741,7 @@ class StylesheetNamespace { exports.StylesheetNamespace = StylesheetNamespace; /***/ }), -/* 85 */ +/* 95 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -66395,9 +69751,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.XdpNamespace = void 0; -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id; @@ -66439,7 +69795,7 @@ class XdpNamespace { exports.XdpNamespace = XdpNamespace; /***/ }), -/* 86 */ +/* 96 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -66449,27 +69805,32 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.XhtmlNamespace = void 0; -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _html_utils = __w_pdfjs_require__(73); +var _html_utils = __w_pdfjs_require__(82); -var _utils = __w_pdfjs_require__(69); +var _utils = __w_pdfjs_require__(76); const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id; const 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"]); -const 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 => (0, _html_utils.measureToString)(1 * (0, _utils.getMeasurement)(value))], ["letter-spacing", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["line-height", value => (0, _html_utils.measureToString)(0.99 * (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 => (0, _html_utils.getFonts)(value)]]); +const 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) => { + value = original.fontSize = (0, _utils.getMeasurement)(value); + return (0, _html_utils.measureToString)(0.99 * value); +}], ["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]]); const spacesRegExp = /\s+/g; const crlfRegExp = /[\r\n]+/g; -function mapStyle(styleStr) { +function mapStyle(styleStr, fontFinder) { const style = Object.create(null); if (!styleStr) { return style; } + const original = Object.create(null); + for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) { const mapping = StyleMapping.get(key); @@ -66483,7 +69844,7 @@ function mapStyle(styleStr) { if (typeof mapping === "string") { newValue = mapping; } else { - newValue = mapping(value); + newValue = mapping(value, original); } } @@ -66498,16 +69859,31 @@ function mapStyle(styleStr) { } } + if (style.fontFamily) { + (0, _html_utils.setFontFamily)({ + typeface: style.fontFamily, + weight: style.fontWeight || "normal", + posture: style.fontStyle || "normal", + size: original.fontSize || 0 + }, fontFinder, style); + } + (0, _html_utils.fixTextIndent)(style); return style; } -function checkStyle(style) { - if (!style) { +function checkStyle(node) { + if (!node.style) { return ""; } - return style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key]) => VALID_STYLES.has(key)).map(kv => kv.join(":")).join(";"); + return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => { + if (key === "font-family") { + node[_xfa_object.$globalData].usedTypefaces.add(value); + } + + return VALID_STYLES.has(key); + }).map(kv => kv.join(":")).join(";"); } const NoWhites = new Set(["body", "html"]); @@ -66515,7 +69891,13 @@ const NoWhites = new Set(["body", "html"]); class XhtmlObject extends _xfa_object.XmlObject { constructor(attributes, name) { super(XHTML_NS_ID, name); - this.style = checkStyle(attributes.style); + this.style = attributes.style || ""; + } + + [_xfa_object.$clean](builder) { + super[_xfa_object.$clean](builder); + + this.style = checkStyle(this); } [_xfa_object.$acceptWhitespace]() { @@ -66534,6 +69916,109 @@ class XhtmlObject extends _xfa_object.XmlObject { } } + [_xfa_object.$pushGlyphs](measure, mustPop = true) { + const xfaFont = Object.create(null); + const margin = { + top: NaN, + bottom: NaN, + left: NaN, + right: NaN + }; + let lineHeight = null; + + for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) { + switch (key) { + case "font-family": + xfaFont.typeface = (0, _utils.stripQuotes)(value); + break; + + case "font-size": + xfaFont.size = (0, _utils.getMeasurement)(value); + break; + + case "font-weight": + xfaFont.weight = value; + break; + + case "font-style": + xfaFont.posture = value; + break; + + case "letter-spacing": + xfaFont.letterSpacing = (0, _utils.getMeasurement)(value); + break; + + case "margin": + const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x)); + + switch (values.length) { + case 1: + margin.top = margin.bottom = margin.left = margin.right = values[0]; + break; + + case 2: + margin.top = margin.bottom = values[0]; + margin.left = margin.right = values[1]; + break; + + case 3: + margin.top = values[0]; + margin.bottom = values[2]; + margin.left = margin.right = values[1]; + break; + + case 4: + margin.top = values[0]; + margin.left = values[1]; + margin.bottom = values[2]; + margin.right = values[3]; + break; + } + + break; + + case "margin-top": + margin.top = (0, _utils.getMeasurement)(value); + break; + + case "margin-bottom": + margin.bottom = (0, _utils.getMeasurement)(value); + break; + + case "margin-left": + margin.left = (0, _utils.getMeasurement)(value); + break; + + case "margin-right": + margin.right = (0, _utils.getMeasurement)(value); + break; + + case "line-height": + lineHeight = (0, _utils.getMeasurement)(value); + break; + } + } + + measure.pushData(xfaFont, margin, lineHeight); + + if (this[_xfa_object.$content]) { + measure.addString(this[_xfa_object.$content]); + } else { + for (const child of this[_xfa_object.$getChildren]()) { + if (child[_xfa_object.$nodeName] === "#text") { + measure.addString(child[_xfa_object.$content]); + continue; + } + + child[_xfa_object.$pushGlyphs](measure); + } + } + + if (mustPop) { + measure.popFont(); + } + } + [_xfa_object.$toHTML](availableSpace) { const children = []; this[_xfa_object.$extra] = { @@ -66550,7 +70035,7 @@ class XhtmlObject extends _xfa_object.XmlObject { name: this[_xfa_object.$nodeName], attributes: { href: this.href, - style: mapStyle(this.style) + style: mapStyle(this.style, this[_xfa_object.$globalData].fontFinder) }, children, value: this[_xfa_object.$content] || "" @@ -66572,6 +70057,16 @@ class B extends XhtmlObject { super(attributes, "b"); } + [_xfa_object.$pushGlyphs](measure) { + measure.pushFont({ + weight: "bold" + }); + + super[_xfa_object.$pushGlyphs](measure); + + measure.popFont(); + } + } class Body extends XhtmlObject { @@ -66591,7 +70086,7 @@ class Body extends XhtmlObject { } html.name = "div"; - html.attributes.class = "xfaRich"; + html.attributes.class = ["xfaRich"]; return res; } @@ -66606,6 +70101,10 @@ class Br extends XhtmlObject { return "\n"; } + [_xfa_object.$pushGlyphs](measure) { + measure.addString("\n"); + } + [_xfa_object.$toHTML](availableSpace) { return _utils.HTMLResult.success({ name: "br" @@ -66631,7 +70130,7 @@ class Html extends XhtmlObject { return _utils.HTMLResult.success({ name: "div", attributes: { - class: "xfaRich", + class: ["xfaRich"], style: {} }, value: this[_xfa_object.$content] || "" @@ -66641,7 +70140,7 @@ class Html extends XhtmlObject { if (children.length === 1) { const child = children[0]; - if (child.attributes && child.attributes.class === "xfaRich") { + if (child.attributes && child.attributes.class.includes("xfaRich")) { return _utils.HTMLResult.success(child); } } @@ -66649,7 +70148,7 @@ class Html extends XhtmlObject { return _utils.HTMLResult.success({ name: "div", attributes: { - class: "xfaRich", + class: ["xfaRich"], style: {} }, children @@ -66663,6 +70162,16 @@ class I extends XhtmlObject { super(attributes, "i"); } + [_xfa_object.$pushGlyphs](measure) { + measure.pushFont({ + posture: "italic" + }); + + super[_xfa_object.$pushGlyphs](measure); + + measure.popFont(); + } + } class Li extends XhtmlObject { @@ -66684,6 +70193,14 @@ class P extends XhtmlObject { super(attributes, "p"); } + [_xfa_object.$pushGlyphs](measure) { + super[_xfa_object.$pushGlyphs](measure, false); + + measure.addString("\n"); + measure.addPara(); + measure.popFont(); + } + [_xfa_object.$text]() { return super[_xfa_object.$text]() + "\n"; } @@ -66784,7 +70301,7 @@ class XhtmlNamespace { exports.XhtmlNamespace = XhtmlNamespace; /***/ }), -/* 87 */ +/* 97 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -66794,9 +70311,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports.UnknownNamespace = void 0; -var _namespaces = __w_pdfjs_require__(70); +var _namespaces = __w_pdfjs_require__(77); -var _xfa_object = __w_pdfjs_require__(68); +var _xfa_object = __w_pdfjs_require__(75); class UnknownNamespace { constructor(nsId) { @@ -66812,7 +70329,7 @@ class UnknownNamespace { exports.UnknownNamespace = UnknownNamespace; /***/ }), -/* 88 */ +/* 98 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -66830,7 +70347,7 @@ var _parser = __w_pdfjs_require__(17); var _core_utils = __w_pdfjs_require__(9); -var _crypto = __w_pdfjs_require__(65); +var _crypto = __w_pdfjs_require__(72); class XRef { constructor(stream, pdfManager) { @@ -67216,8 +70733,29 @@ class XRef { } else if (m = objRegExp.exec(token)) { const num = m[1] | 0, gen = m[2] | 0; + let contentLength, + startPos = position + token.length, + updateEntries = false; - if (!this.entries[num] || this.entries[num].gen === gen) { + if (!this.entries[num]) { + updateEntries = true; + } else if (this.entries[num].gen === gen) { + try { + const parser = new _parser.Parser({ + lexer: new _parser.Lexer(stream.makeSubStream(startPos)) + }); + parser.getObj(); + updateEntries = true; + } catch (ex) { + if (ex instanceof _core_utils.ParserEOFException) { + (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`); + } else { + updateEntries = true; + } + } + } + + if (updateEntries) { this.entries[num] = { offset: position - stream.start, gen, @@ -67225,9 +70763,6 @@ class XRef { }; } - let contentLength, - startPos = position + token.length; - while (startPos < buffer.length) { const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4; contentLength = endPos - position; @@ -67629,7 +71164,7 @@ class XRef { exports.XRef = XRef; /***/ }), -/* 89 */ +/* 99 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -68129,7 +71664,7 @@ class MessageHandler { exports.MessageHandler = MessageHandler; /***/ }), -/* 90 */ +/* 100 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -68353,8 +71888,8 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({ var _worker = __w_pdfjs_require__(1); -const pdfjsVersion = '2.9.359'; -const pdfjsBuild = 'e667c8cbc'; +const pdfjsVersion = '2.10.377'; +const pdfjsBuild = '156762c48'; })(); /******/ return __webpack_exports__; |