UNPKG

jspdf-fontkit

Version:

jsPDF with fontkit for complex glyph support

1,393 lines (1,392 loc) 1.07 MB
var ut = /* @__PURE__ */ function() { return typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : this; }(); function So() { ut.console && typeof ut.console.log == "function" && ut.console.log.apply(ut.console, arguments); } function Ef(r) { ut.console && (typeof ut.console.warn == "function" ? ut.console.warn.apply(ut.console, arguments) : So.call(null, arguments)); } function Tf(r) { ut.console && (typeof ut.console.error == "function" ? ut.console.error.apply(ut.console, arguments) : So(r)); } var Tt = { log: So, warn: Ef, error: Tf }; /** * @license * FileSaver.js * A saveAs() FileSaver implementation. * * By Eli Grey, http://eligrey.com * * License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT) * source : http://purl.eligrey.com/github/FileSaver.js */ function _f(r, t) { return typeof t > "u" ? t = { autoBom: !1 } : typeof t != "object" && (Tt.warn("Deprecated: Expected third argument to be a object"), t = { autoBom: !t }), t.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test( r.type ) ? new Blob(["\uFEFF", r], { type: r.type }) : r; } function $s(r, t, e) { var n = new XMLHttpRequest(); n.open("GET", r), n.responseType = "blob", n.onload = function() { yi(n.response, t, e); }, n.onerror = function() { Tt.error("could not download file"); }, n.send(); } function Ol(r) { var t = new XMLHttpRequest(); t.open("HEAD", r, !1); try { t.send(); } catch { } return t.status >= 200 && t.status <= 299; } function M0(r) { try { r.dispatchEvent(new MouseEvent("click")); } catch { var t = document.createEvent("MouseEvents"); t.initMouseEvent( "click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null ), r.dispatchEvent(t); } } var yi = ut.saveAs || // probably in some web worker (typeof window != "object" || window !== ut ? function() { } : ( // Use download attribute first if possible (#193 Lumia mobile) unless this is a native app typeof HTMLAnchorElement < "u" && "download" in HTMLAnchorElement.prototype ? function(t, e, n) { var i = ut.URL || ut.webkitURL, u = document.createElement("a"); e = e || t.name || "download", u.download = e, u.rel = "noopener", typeof t == "string" ? (u.href = t, u.origin !== location.origin ? Ol(u.href) ? $s(t, e, n) : M0(u, u.target = "_blank") : M0(u)) : (u.href = i.createObjectURL(t), setTimeout(function() { i.revokeObjectURL(u.href); }, 4e4), setTimeout(function() { M0(u); }, 0)); } : ( // Use msSaveOrOpenBlob as a second approach "msSaveOrOpenBlob" in navigator ? function(t, e, n) { if (e = e || t.name || "download", typeof t == "string") if (Ol(t)) $s(t, e, n); else { var i = document.createElement("a"); i.href = t, i.target = "_blank", setTimeout(function() { M0(i); }); } else navigator.msSaveOrOpenBlob(_f(t, n), e); } : ( // Fallback to using FileReader and a popup function(t, e, n, i) { if (i = i || open("", "_blank"), i && (i.document.title = i.document.body.innerText = "downloading..."), typeof t == "string") return $s(t, e, n); var u = t.type === "application/octet-stream", h = /constructor/i.test(ut.HTMLElement) || ut.safari, o = /CriOS\/[\d]+/.test(navigator.userAgent); if ((o || u && h) && typeof FileReader == "object") { var s = new FileReader(); s.onloadend = function() { var c = s.result; c = o ? c : c.replace(/^data:[^;]*;/, "data:attachment/file;"), i ? i.location.href = c : location = c, i = null; }, s.readAsDataURL(t); } else { var l = ut.URL || ut.webkitURL, f = l.createObjectURL(t); i ? i.location = f : location.href = f, i = null, setTimeout(function() { l.revokeObjectURL(f); }, 4e4); } } ) ) )); /** * A class to parse color values * @author Stoyan Stefanov <sstoo@gmail.com> * {@link http://www.phpied.com/rgb-color-parser-in-javascript/} * @license Use it if you like it */ function ou(r) { r = r || "", this.ok = !1, r.charAt(0) == "#" && (r = r.substr(1, 6)), r = r.replace(/ /g, ""), r = r.toLowerCase(); var t, e = { aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "00ffff", aquamarine: "7fffd4", azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000000", blanchedalmond: "ffebcd", blue: "0000ff", blueviolet: "8a2be2", brown: "a52a2a", burlywood: "deb887", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e", coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c", cyan: "00ffff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b", darkgray: "a9a9a9", darkgreen: "006400", darkkhaki: "bdb76b", darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc", darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b", darkslategray: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3", deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dodgerblue: "1e90ff", feldspar: "d19275", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22", fuchsia: "ff00ff", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700", goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c", indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa", lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6", lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgrey: "d3d3d3", lightgreen: "90ee90", lightpink: "ffb6c1", lightsalmon: "ffa07a", lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslateblue: "8470ff", lightslategray: "778899", lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "00ff00", limegreen: "32cd32", linen: "faf0e6", magenta: "ff00ff", maroon: "800000", mediumaquamarine: "66cdaa", mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370d8", mediumseagreen: "3cb371", mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585", midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5", navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000", olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6", palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "d87093", papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb", plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", red: "ff0000", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513", salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee", sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd", slategray: "708090", snow: "fffafa", springgreen: "00ff7f", steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8", tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", violetred: "d02090", wheat: "f5deb3", white: "ffffff", whitesmoke: "f5f5f5", yellow: "ffff00", yellowgreen: "9acd32" }; r = e[r] || r; for (var n = [ { re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/, example: ["rgb(123, 234, 45)", "rgb(255,234,245)"], process: function(s) { return [parseInt(s[1]), parseInt(s[2]), parseInt(s[3])]; } }, { re: /^(\w{2})(\w{2})(\w{2})$/, example: ["#00ff00", "336699"], process: function(s) { return [ parseInt(s[1], 16), parseInt(s[2], 16), parseInt(s[3], 16) ]; } }, { re: /^(\w{1})(\w{1})(\w{1})$/, example: ["#fb0", "f0f"], process: function(s) { return [ parseInt(s[1] + s[1], 16), parseInt(s[2] + s[2], 16), parseInt(s[3] + s[3], 16) ]; } } ], i = 0; i < n.length; i++) { var u = n[i].re, h = n[i].process, o = u.exec(r); o && (t = h(o), this.r = t[0], this.g = t[1], this.b = t[2], this.ok = !0); } this.r = this.r < 0 || isNaN(this.r) ? 0 : this.r > 255 ? 255 : this.r, this.g = this.g < 0 || isNaN(this.g) ? 0 : this.g > 255 ? 255 : this.g, this.b = this.b < 0 || isNaN(this.b) ? 0 : this.b > 255 ? 255 : this.b, this.toRGB = function() { return "rgb(" + this.r + ", " + this.g + ", " + this.b + ")"; }, this.toHex = function() { var s = this.r.toString(16), l = this.g.toString(16), f = this.b.toString(16); return s.length == 1 && (s = "0" + s), l.length == 1 && (l = "0" + l), f.length == 1 && (f = "0" + f), "#" + s + l + f; }; } var Za, co; (function() { Za = ut.atob.bind(ut), co = ut.btoa.bind(ut); })(); /** * @license * Joseph Myers does not specify a particular license for his work. * * Author: Joseph Myers * Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js * * Modified by: Owen Leong */ function Xs(r, t) { var e = r[0], n = r[1], i = r[2], u = r[3]; e = br(e, n, i, u, t[0], 7, -680876936), u = br(u, e, n, i, t[1], 12, -389564586), i = br(i, u, e, n, t[2], 17, 606105819), n = br(n, i, u, e, t[3], 22, -1044525330), e = br(e, n, i, u, t[4], 7, -176418897), u = br(u, e, n, i, t[5], 12, 1200080426), i = br(i, u, e, n, t[6], 17, -1473231341), n = br(n, i, u, e, t[7], 22, -45705983), e = br(e, n, i, u, t[8], 7, 1770035416), u = br(u, e, n, i, t[9], 12, -1958414417), i = br(i, u, e, n, t[10], 17, -42063), n = br(n, i, u, e, t[11], 22, -1990404162), e = br(e, n, i, u, t[12], 7, 1804603682), u = br(u, e, n, i, t[13], 12, -40341101), i = br(i, u, e, n, t[14], 17, -1502002290), n = br(n, i, u, e, t[15], 22, 1236535329), e = mr(e, n, i, u, t[1], 5, -165796510), u = mr(u, e, n, i, t[6], 9, -1069501632), i = mr(i, u, e, n, t[11], 14, 643717713), n = mr(n, i, u, e, t[0], 20, -373897302), e = mr(e, n, i, u, t[5], 5, -701558691), u = mr(u, e, n, i, t[10], 9, 38016083), i = mr(i, u, e, n, t[15], 14, -660478335), n = mr(n, i, u, e, t[4], 20, -405537848), e = mr(e, n, i, u, t[9], 5, 568446438), u = mr(u, e, n, i, t[14], 9, -1019803690), i = mr(i, u, e, n, t[3], 14, -187363961), n = mr(n, i, u, e, t[8], 20, 1163531501), e = mr(e, n, i, u, t[13], 5, -1444681467), u = mr(u, e, n, i, t[2], 9, -51403784), i = mr(i, u, e, n, t[7], 14, 1735328473), n = mr(n, i, u, e, t[12], 20, -1926607734), e = xr(e, n, i, u, t[5], 4, -378558), u = xr(u, e, n, i, t[8], 11, -2022574463), i = xr(i, u, e, n, t[11], 16, 1839030562), n = xr(n, i, u, e, t[14], 23, -35309556), e = xr(e, n, i, u, t[1], 4, -1530992060), u = xr(u, e, n, i, t[4], 11, 1272893353), i = xr(i, u, e, n, t[7], 16, -155497632), n = xr(n, i, u, e, t[10], 23, -1094730640), e = xr(e, n, i, u, t[13], 4, 681279174), u = xr(u, e, n, i, t[0], 11, -358537222), i = xr(i, u, e, n, t[3], 16, -722521979), n = xr(n, i, u, e, t[6], 23, 76029189), e = xr(e, n, i, u, t[9], 4, -640364487), u = xr(u, e, n, i, t[12], 11, -421815835), i = xr(i, u, e, n, t[15], 16, 530742520), n = xr(n, i, u, e, t[2], 23, -995338651), e = wr(e, n, i, u, t[0], 6, -198630844), u = wr(u, e, n, i, t[7], 10, 1126891415), i = wr(i, u, e, n, t[14], 15, -1416354905), n = wr(n, i, u, e, t[5], 21, -57434055), e = wr(e, n, i, u, t[12], 6, 1700485571), u = wr(u, e, n, i, t[3], 10, -1894986606), i = wr(i, u, e, n, t[10], 15, -1051523), n = wr(n, i, u, e, t[1], 21, -2054922799), e = wr(e, n, i, u, t[8], 6, 1873313359), u = wr(u, e, n, i, t[15], 10, -30611744), i = wr(i, u, e, n, t[6], 15, -1560198380), n = wr(n, i, u, e, t[13], 21, 1309151649), e = wr(e, n, i, u, t[4], 6, -145523070), u = wr(u, e, n, i, t[11], 10, -1120210379), i = wr(i, u, e, n, t[2], 15, 718787259), n = wr(n, i, u, e, t[9], 21, -343485551), r[0] = ri(e, r[0]), r[1] = ri(n, r[1]), r[2] = ri(i, r[2]), r[3] = ri(u, r[3]); } function X0(r, t, e, n, i, u) { return t = ri(ri(t, r), ri(n, u)), ri(t << i | t >>> 32 - i, e); } function br(r, t, e, n, i, u, h) { return X0(t & e | ~t & n, r, t, i, u, h); } function mr(r, t, e, n, i, u, h) { return X0(t & n | e & ~n, r, t, i, u, h); } function xr(r, t, e, n, i, u, h) { return X0(t ^ e ^ n, r, t, i, u, h); } function wr(r, t, e, n, i, u, h) { return X0(e ^ (t | ~n), r, t, i, u, h); } function lu(r) { var t = r.length, e = [1732584193, -271733879, -1732584194, 271733878], n; for (n = 64; n <= r.length; n += 64) Xs(e, Bf(r.substring(n - 64, n))); r = r.substring(n - 64); var i = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; for (n = 0; n < r.length; n++) i[n >> 2] |= r.charCodeAt(n) << (n % 4 << 3); if (i[n >> 2] |= 128 << (n % 4 << 3), n > 55) for (Xs(e, i), n = 0; n < 16; n++) i[n] = 0; return i[14] = t * 8, Xs(e, i), e; } function Bf(r) { var t = [], e; for (e = 0; e < 64; e += 4) t[e >> 2] = r.charCodeAt(e) + (r.charCodeAt(e + 1) << 8) + (r.charCodeAt(e + 2) << 16) + (r.charCodeAt(e + 3) << 24); return t; } var El = "0123456789abcdef".split(""); function Df(r) { for (var t = "", e = 0; e < 4; e++) t += El[r >> e * 8 + 4 & 15] + El[r >> e * 8 & 15]; return t; } function Mf(r) { for (var t = 0; t < r.length; t++) r[t] = Df(r[t]); return r.join(""); } function Rf(r) { return String.fromCharCode( (r & 255) >> 0, (r & 65280) >> 8, (r & 16711680) >> 16, (r & 4278190080) >> 24 ); } function Uf(r) { return r.map(Rf).join(""); } function Co(r) { return Uf(lu(r)); } function qf(r) { return Mf(lu(r)); } var zf = qf("hello") != "5d41402abc4b2a76b9719d911017c592"; function ri(r, t) { if (zf) { var e = (r & 65535) + (t & 65535), n = (r >> 16) + (t >> 16) + (e >> 16); return n << 16 | e & 65535; } else return r + t & 4294967295; } /** * @license * FPDF is released under a permissive license: there is no usage restriction. * You may embed it freely in your application (commercial or not), with or * without modifications. * * Reference: http://www.fpdf.org/en/script/script37.php */ function jf(r, t) { return new Array(t + 1).join(r); } function Lo(r, t) { var e, n; if (r !== e) { for (var i = jf(r, (256 / r.length >> 0) + 1), u = [], h = 0; h < 256; h++) u[h] = h; for (var o = 0, h = 0; h < 256; h++) { var s = u[h]; o = (o + s + i.charCodeAt(h)) % 256, u[h] = u[o], u[o] = s; } e = r, n = u; } else u = n; for (var l = t.length, f = 0, c = 0, b = "", h = 0; h < l; h++) f = (f + 1) % 256, s = u[f], c = (c + s) % 256, u[f] = u[c], u[c] = s, i = u[(u[f] + u[c]) % 256], b += String.fromCharCode(t.charCodeAt(h) ^ i); return b; } /** * @license * Licensed under the MIT License. * http://opensource.org/licenses/mit-license * Author: Owen Leong (@owenl131) * Date: 15 Oct 2020 * References: * https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt * https://github.com/foliojs/pdfkit/blob/master/lib/security.js * http://www.fpdf.org/en/script/script37.php */ var Tl = { print: 4, modify: 8, copy: 16, "annot-forms": 32 }; function ga(r, t, e, n) { this.v = 1, this.r = 2; let i = 192; r.forEach(function(o) { if (typeof Tl.perm < "u") throw new Error("Invalid permission: " + o); i += Tl[o]; }), this.padding = "(¿N^NuŠAd\0NVÿú\b..\0¶Ðh>€/\f©þdSiz"; let u = (t + this.padding).substr(0, 32), h = (e + this.padding).substr(0, 32); this.O = this.processOwnerPassword(u, h), this.P = -((i ^ 255) + 1), this.encryptionKey = Co( u + this.O + this.lsbFirstWord(this.P) + this.hexToBytes(n) ).substr(0, 5), this.U = Lo(this.encryptionKey, this.padding); } ga.prototype.lsbFirstWord = function(r) { return String.fromCharCode( r >> 0 & 255, r >> 8 & 255, r >> 16 & 255, r >> 24 & 255 ); }; ga.prototype.toHexString = function(r) { return r.split("").map(function(t) { return ("0" + (t.charCodeAt(0) & 255).toString(16)).slice(-2); }).join(""); }; ga.prototype.hexToBytes = function(r) { for (var t = [], e = 0; e < r.length; e += 2) t.push(String.fromCharCode(parseInt(r.substr(e, 2), 16))); return t.join(""); }; ga.prototype.processOwnerPassword = function(r, t) { let e = Co(t).substr(0, 5); return Lo(e, r); }; ga.prototype.encryptor = function(r, t) { let e = Co( this.encryptionKey + String.fromCharCode( r & 255, r >> 8 & 255, r >> 16 & 255, t & 255, t >> 8 & 255 ) ).substr(0, 10); return function(n) { return Lo(e, n); }; }; function ha(r) { if (/[^\u0000-\u00ff]/.test(r)) throw new Error( "Invalid PDF Name Object: " + r + ", Only accept ASCII characters." ); for (var t = "", e = r.length, n = 0; n < e; n++) { var i = r.charCodeAt(n); if (i < 33 || i === 35 || i === 37 || i === 40 || i === 41 || i === 47 || i === 60 || i === 62 || i === 91 || i === 93 || i === 123 || i === 125 || i > 126) { var u = i.toString(16), h = ("0" + u).slice(-2); t += "#" + h; } else t += r[n]; } return t; } function _l(r) { if (typeof r != "object") throw new Error( "Invalid Context passed to initialize PubSub (jsPDF-module)" ); var t = {}; this.subscribe = function(e, n, i) { if (i = i || !1, typeof e != "string" || typeof n != "function" || typeof i != "boolean") throw new Error( "Invalid arguments passed to PubSub.subscribe (jsPDF-module)" ); t.hasOwnProperty(e) || (t[e] = {}); var u = Math.random().toString(35); return t[e][u] = [n, !!i], u; }, this.unsubscribe = function(e) { for (var n in t) if (t[n][e]) return delete t[n][e], Object.keys(t[n]).length === 0 && delete t[n], !0; return !1; }, this.publish = function(e) { if (t.hasOwnProperty(e)) { var n = Array.prototype.slice.call(arguments, 1), i = []; for (var u in t[e]) { var h = t[e][u]; try { h[0].apply(r, n); } catch (o) { ut.console && Tt.error("jsPDF PubSub Error", o.message, o); } h[1] && i.push(u); } i.length && i.forEach(this.unsubscribe); } }, this.getTopics = function() { return t; }; } function z0(r) { if (!(this instanceof z0)) return new z0(r); var t = "opacity,stroke-opacity".split(","); for (var e in r) r.hasOwnProperty(e) && t.indexOf(e) >= 0 && (this[e] = r[e]); this.id = "", this.objectNumber = -1; } z0.prototype.equals = function(t) { var e = "id,objectNumber,equals", n; if (!t || typeof t != typeof this) return !1; var i = 0; for (n in this) if (!(e.indexOf(n) >= 0)) { if (this.hasOwnProperty(n) && !t.hasOwnProperty(n) || this[n] !== t[n]) return !1; i++; } for (n in t) t.hasOwnProperty(n) && e.indexOf(n) < 0 && i--; return i === 0; }; function uu(r, t) { this.gState = r, this.matrix = t, this.id = "", this.objectNumber = -1; } function Ai(r, t, e, n, i) { if (!(this instanceof Ai)) return new Ai(r, t, e, n, i); this.type = r === "axial" ? 2 : 3, this.coords = t, this.colors = e, uu.call(this, n, i); } function pa(r, t, e, n, i) { if (!(this instanceof pa)) return new pa(r, t, e, n, i); this.boundingBox = r, this.xStep = t, this.yStep = e, this.stream = "", this.cloneIndex = 0, uu.call(this, n, i); } function ft(r) { var t = typeof arguments[0] == "string" ? arguments[0] : "p", e = arguments[1], n = arguments[2], i = arguments[3], u = [], h = 1, o, s = 16, l = "S", f = null; r = r || {}, typeof r == "object" && (t = r.orientation, e = r.unit || e, n = r.format || n, i = r.compress || r.compressPdf || i, f = r.encryption || null, f !== null && (f.userPassword = f.userPassword || "", f.ownerPassword = f.ownerPassword || "", f.userPermissions = f.userPermissions || []), h = typeof r.userUnit == "number" ? Math.abs(r.userUnit) : 1, typeof r.precision < "u" && (o = r.precision), typeof r.floatPrecision < "u" && (s = r.floatPrecision), l = r.defaultPathOperation || "S"), u = r.filters || (i === !0 ? ["FlateEncode"] : u), e = e || "mm", t = ("" + (t || "P")).toLowerCase(); var c = r.putOnlyUsedFonts || !1, b = {}, v = { internal: {}, __private__: {} }; v.__private__.PubSub = _l; var A = "1.3", S = v.__private__.getPdfVersion = function() { return A; }; v.__private__.setPdfVersion = function(p) { A = p; }; var x = { a0: [2383.94, 3370.39], a1: [1683.78, 2383.94], a2: [1190.55, 1683.78], a3: [841.89, 1190.55], a4: [595.28, 841.89], a5: [419.53, 595.28], a6: [297.64, 419.53], a7: [209.76, 297.64], a8: [147.4, 209.76], a9: [104.88, 147.4], a10: [73.7, 104.88], b0: [2834.65, 4008.19], b1: [2004.09, 2834.65], b2: [1417.32, 2004.09], b3: [1000.63, 1417.32], b4: [708.66, 1000.63], b5: [498.9, 708.66], b6: [354.33, 498.9], b7: [249.45, 354.33], b8: [175.75, 249.45], b9: [124.72, 175.75], b10: [87.87, 124.72], c0: [2599.37, 3676.54], c1: [1836.85, 2599.37], c2: [1298.27, 1836.85], c3: [918.43, 1298.27], c4: [649.13, 918.43], c5: [459.21, 649.13], c6: [323.15, 459.21], c7: [229.61, 323.15], c8: [161.57, 229.61], c9: [113.39, 161.57], c10: [79.37, 113.39], dl: [311.81, 623.62], letter: [612, 792], "government-letter": [576, 756], legal: [612, 1008], "junior-legal": [576, 360], ledger: [1224, 792], tabloid: [792, 1224], "credit-card": [153, 243] }; v.__private__.getPageFormats = function() { return x; }; var E = v.__private__.getPageFormat = function(p) { return x[p]; }; n = n || "a4"; var F = { COMPAT: "compat", ADVANCED: "advanced" }, N = F.COMPAT; function B() { this.saveGraphicsState(), X( new st( yt, 0, 0, -yt, 0, En() * yt ).toString() + " cm" ), this.setFontSize(this.getFontSize() / yt), l = "n", N = F.ADVANCED; } function y() { this.restoreGraphicsState(), l = "S", N = F.COMPAT; } var C = v.__private__.combineFontStyleAndFontWeight = function(p, T) { if (p == "bold" && T == "normal" || p == "bold" && T == 400 || p == "normal" && T == "italic" || p == "bold" && T == "italic") throw new Error("Invalid Combination of fontweight and fontstyle"); return T && (p = T == 400 || T === "normal" ? p === "italic" ? "italic" : "normal" : (T == 700 || T === "bold") && p === "normal" ? "bold" : (T == 700 ? "bold" : T) + "" + p), p; }; v.advancedAPI = function(p) { var T = N === F.COMPAT; return T && B.call(this), typeof p != "function" ? this : (p(this), T && y.call(this), this); }, v.compatAPI = function(p) { var T = N === F.ADVANCED; return T && y.call(this), typeof p != "function" ? this : (p(this), T && B.call(this), this); }, v.isAdvancedAPI = function() { return N === F.ADVANCED; }; var D = function(p) { if (N !== F.ADVANCED) throw new Error( p + " is only available in 'advanced' API mode. You need to call advancedAPI() first." ); }, V = v.roundToPrecision = v.__private__.roundToPrecision = function(p, T) { var Z = o || T; if (isNaN(p) || isNaN(Z)) throw new Error("Invalid argument passed to jsPDF.roundToPrecision"); return p.toFixed(Z).replace(/0+$/, ""); }, R; typeof s == "number" ? R = v.hpf = v.__private__.hpf = function(p) { if (isNaN(p)) throw new Error("Invalid argument passed to jsPDF.hpf"); return V(p, s); } : s === "smart" ? R = v.hpf = v.__private__.hpf = function(p) { if (isNaN(p)) throw new Error("Invalid argument passed to jsPDF.hpf"); return p > -1 && p < 1 ? V(p, 16) : V(p, 5); } : R = v.hpf = v.__private__.hpf = function(p) { if (isNaN(p)) throw new Error("Invalid argument passed to jsPDF.hpf"); return V(p, 16); }; var L = v.f2 = v.__private__.f2 = function(p) { if (isNaN(p)) throw new Error("Invalid argument passed to jsPDF.f2"); return V(p, 2); }, J = v.__private__.f3 = function(p) { if (isNaN(p)) throw new Error("Invalid argument passed to jsPDF.f3"); return V(p, 3); }, _ = v.scale = v.__private__.scale = function(p) { if (isNaN(p)) throw new Error("Invalid argument passed to jsPDF.scale"); if (N === F.COMPAT) return p * yt; if (N === F.ADVANCED) return p; }, re = function(p) { if (N === F.COMPAT) return En() - p; if (N === F.ADVANCED) return p; }, ee = function(p) { return _(re(p)); }; v.__private__.setPrecision = v.setPrecision = function(p) { typeof parseInt(p, 10) == "number" && (o = parseInt(p, 10)); }; var te = "00000000000000000000000000000000", O = v.__private__.getFileId = function() { return te; }, G = v.__private__.setFileId = function(p) { return typeof p < "u" && /^[a-fA-F0-9]{32}$/.test(p) ? te = p.toUpperCase() : te = te.split("").map(function() { return "ABCDEF0123456789".charAt(Math.floor(Math.random() * 16)); }).join(""), f !== null && (vr = new ga( f.userPermissions, f.userPassword, f.ownerPassword, te )), te; }; v.setFileId = function(p) { return G(p), this; }, v.getFileId = function() { return O(); }; var z, Q = v.__private__.convertDateToPDFDate = function(p) { var T = "", Z = p.getTimezoneOffset(), le = Z < 0 ? "+" : "-", we = Math.floor(Math.abs(Z / 60)), Oe = Math.abs(Z % 60), Ge = [le, I(we), "'", I(Oe), "'"].join(""); return T = [ "D:", p.getFullYear(), I(p.getMonth() + 1), I(p.getDate()), I(p.getHours()), I(p.getMinutes()), I(p.getSeconds()), Ge ].join(""), T; }, oe = v.__private__.convertPDFDateToDate = function(p) { var T = parseInt(p.substr(2, 4), 10), Z = parseInt(p.substr(6, 2), 10) - 1, le = parseInt(p.substr(8, 2), 10), we = parseInt(p.substr(10, 2), 10), Oe = parseInt(p.substr(12, 2), 10), Ge = parseInt(p.substr(14, 2), 10), Xe = new Date(T, Z, le, we, Oe, Ge, 0); return Xe; }, ue = v.__private__.setCreationDate = function(p) { var T, Z = /^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/; if (typeof p > "u" && (p = /* @__PURE__ */ new Date()), p instanceof Date) T = Q(p); else if (Z.test(p)) T = p; else throw new Error("Invalid argument passed to jsPDF.setCreationDate"); return z = T, z; }, ie = v.__private__.getCreationDate = function(p) { var T = z; return p === "jsDate" && (T = oe(z)), T; }; v.setCreationDate = function(p) { return ue(p), this; }, v.getCreationDate = function(p) { return ie(p); }; var I = v.__private__.padd2 = function(p) { return ("0" + parseInt(p)).slice(-2); }, $ = v.__private__.padd2Hex = function(p) { return p = p.toString(), ("00" + p).substr(p.length); }, W = 0, pe = [], he = [], q = 0, K = [], se = [], Y, ye = !1, Ne = he, ne = function() { W = 0, q = 0, he = [], pe = [], K = [], Qt = qt(), Lr = qt(); }; v.__private__.setCustomOutputDestination = function(p) { ye = !0, Ne = p; }; var ve = function(p) { ye || (Ne = p); }; v.__private__.resetCustomOutputDestination = function() { ye = !1, Ne = he; }; var X = v.__private__.out = function(p) { return p = p.toString(), q += p.length + 1, Ne.push(p), Ne; }, ce = v.__private__.write = function(p) { return X( arguments.length === 1 ? p.toString() : Array.prototype.join.call(arguments, " ") ); }, fe = v.__private__.getArrayBuffer = function(p) { for (var T = p.length, Z = new ArrayBuffer(T), le = new Uint8Array(Z); T--; ) le[T] = p.charCodeAt(T); return Z; }, Fe = [ ["Helvetica", "helvetica", "normal", "WinAnsiEncoding"], ["Helvetica-Bold", "helvetica", "bold", "WinAnsiEncoding"], ["Helvetica-Oblique", "helvetica", "italic", "WinAnsiEncoding"], ["Helvetica-BoldOblique", "helvetica", "bolditalic", "WinAnsiEncoding"], ["Courier", "courier", "normal", "WinAnsiEncoding"], ["Courier-Bold", "courier", "bold", "WinAnsiEncoding"], ["Courier-Oblique", "courier", "italic", "WinAnsiEncoding"], ["Courier-BoldOblique", "courier", "bolditalic", "WinAnsiEncoding"], ["Times-Roman", "times", "normal", "WinAnsiEncoding"], ["Times-Bold", "times", "bold", "WinAnsiEncoding"], ["Times-Italic", "times", "italic", "WinAnsiEncoding"], ["Times-BoldItalic", "times", "bolditalic", "WinAnsiEncoding"], ["ZapfDingbats", "zapfdingbats", "normal", null], ["Symbol", "symbol", "normal", null] ]; v.__private__.getStandardFonts = function() { return Fe; }; var Me = r.fontSize || 16; v.__private__.setFontSize = v.setFontSize = function(p) { return N === F.ADVANCED ? Me = p / yt : Me = p, this; }; var He = v.__private__.getFontSize = v.getFontSize = function() { return N === F.COMPAT ? Me : Me * yt; }, _e = r.R2L || !1; v.__private__.setR2L = v.setR2L = function(p) { return _e = p, this; }, v.__private__.getR2L = v.getR2L = function() { return _e; }; var je, Ue = v.__private__.setZoomMode = function(p) { var T = [ void 0, null, "fullwidth", "fullheight", "fullpage", "original" ]; if (/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(p)) je = p; else if (!isNaN(p)) je = parseInt(p, 10); else if (T.indexOf(p) !== -1) je = p; else throw new Error( 'zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "' + p + '" is not recognized.' ); }; v.__private__.getZoomMode = function() { return je; }; var We, at = v.__private__.setPageMode = function(p) { var T = [ void 0, null, "UseNone", "UseOutlines", "UseThumbs", "FullScreen" ]; if (T.indexOf(p) == -1) throw new Error( 'Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "' + p + '" is not recognized.' ); We = p; }; v.__private__.getPageMode = function() { return We; }; var qe, gt = v.__private__.setLayoutMode = function(p) { var T = [ void 0, null, "continuous", "single", "twoleft", "tworight", "two" ]; if (T.indexOf(p) == -1) throw new Error( 'Layout mode must be one of continuous, single, twoleft, tworight. "' + p + '" is not recognized.' ); qe = p; }; v.__private__.getLayoutMode = function() { return qe; }, v.__private__.setDisplayMode = v.setDisplayMode = function(p, T, Z) { return Ue(p), gt(T), at(Z), this; }; var nt = { title: "", subject: "", author: "", keywords: "", creator: "" }; v.__private__.getDocumentProperty = function(p) { if (Object.keys(nt).indexOf(p) === -1) throw new Error("Invalid argument passed to jsPDF.getDocumentProperty"); return nt[p]; }, v.__private__.getDocumentProperties = function() { return nt; }, v.__private__.setDocumentProperties = v.setProperties = v.setDocumentProperties = function(p) { for (var T in nt) nt.hasOwnProperty(T) && p[T] && (nt[T] = p[T]); return this; }, v.__private__.setDocumentProperty = function(p, T) { if (Object.keys(nt).indexOf(p) === -1) throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty"); return nt[p] = T; }; var $e = {}, rt = {}, Ke, pt = [], it = {}, Bt = {}, Nt = {}, rr = {}, nr = null, yt, Et = 0, ot = [], mt = new _l(v), _r = r.hotfixes || [], ir = {}, zr = {}, Cr = [], jr, Gr, Kr, st = function(p, T, Z, le, we, Oe) { if (!(this instanceof st)) return new st(p, T, Z, le, we, Oe); isNaN(p) && (p = 1), isNaN(T) && (T = 0), isNaN(Z) && (Z = 0), isNaN(le) && (le = 1), isNaN(we) && (we = 0), isNaN(Oe) && (Oe = 0), this._matrix = [p, T, Z, le, we, Oe]; }; Object.defineProperty(st.prototype, "sx", { get: function() { return this._matrix[0]; }, set: function(p) { this._matrix[0] = p; } }), Object.defineProperty(st.prototype, "shy", { get: function() { return this._matrix[1]; }, set: function(p) { this._matrix[1] = p; } }), Object.defineProperty(st.prototype, "shx", { get: function() { return this._matrix[2]; }, set: function(p) { this._matrix[2] = p; } }), Object.defineProperty(st.prototype, "sy", { get: function() { return this._matrix[3]; }, set: function(p) { this._matrix[3] = p; } }), Object.defineProperty(st.prototype, "tx", { get: function() { return this._matrix[4]; }, set: function(p) { this._matrix[4] = p; } }), Object.defineProperty(st.prototype, "ty", { get: function() { return this._matrix[5]; }, set: function(p) { this._matrix[5] = p; } }), Object.defineProperty(st.prototype, "a", { get: function() { return this._matrix[0]; }, set: function(p) { this._matrix[0] = p; } }), Object.defineProperty(st.prototype, "b", { get: function() { return this._matrix[1]; }, set: function(p) { this._matrix[1] = p; } }), Object.defineProperty(st.prototype, "c", { get: function() { return this._matrix[2]; }, set: function(p) { this._matrix[2] = p; } }), Object.defineProperty(st.prototype, "d", { get: function() { return this._matrix[3]; }, set: function(p) { this._matrix[3] = p; } }), Object.defineProperty(st.prototype, "e", { get: function() { return this._matrix[4]; }, set: function(p) { this._matrix[4] = p; } }), Object.defineProperty(st.prototype, "f", { get: function() { return this._matrix[5]; }, set: function(p) { this._matrix[5] = p; } }), Object.defineProperty(st.prototype, "rotation", { get: function() { return Math.atan2(this.shx, this.sx); } }), Object.defineProperty(st.prototype, "scaleX", { get: function() { return this.decompose().scale.sx; } }), Object.defineProperty(st.prototype, "scaleY", { get: function() { return this.decompose().scale.sy; } }), Object.defineProperty(st.prototype, "isIdentity", { get: function() { return !(this.sx !== 1 || this.shy !== 0 || this.shx !== 0 || this.sy !== 1 || this.tx !== 0 || this.ty !== 0); } }), st.prototype.join = function(p) { return [this.sx, this.shy, this.shx, this.sy, this.tx, this.ty].map(R).join(p); }, st.prototype.multiply = function(p) { var T = p.sx * this.sx + p.shy * this.shx, Z = p.sx * this.shy + p.shy * this.sy, le = p.shx * this.sx + p.sy * this.shx, we = p.shx * this.shy + p.sy * this.sy, Oe = p.tx * this.sx + p.ty * this.shx + this.tx, Ge = p.tx * this.shy + p.ty * this.sy + this.ty; return new st(T, Z, le, we, Oe, Ge); }, st.prototype.decompose = function() { var p = this.sx, T = this.shy, Z = this.shx, le = this.sy, we = this.tx, Oe = this.ty, Ge = Math.sqrt(p * p + T * T); p /= Ge, T /= Ge; var Xe = p * Z + T * le; Z -= p * Xe, le -= T * Xe; var Qe = Math.sqrt(Z * Z + le * le); return Z /= Qe, le /= Qe, Xe /= Qe, p * le < T * Z && (p = -p, T = -T, Xe = -Xe, Ge = -Ge), { scale: new st(Ge, 0, 0, Qe, 0, 0), translate: new st(1, 0, 0, 1, we, Oe), rotate: new st(p, T, -T, p, 0, 0), skew: new st(1, 0, Xe, 1, 0, 0) }; }, st.prototype.toString = function(p) { return this.join(" "); }, st.prototype.inversed = function() { var p = this.sx, T = this.shy, Z = this.shx, le = this.sy, we = this.tx, Oe = this.ty, Ge = 1 / (p * le - T * Z), Xe = le * Ge, Qe = -T * Ge, ht = -Z * Ge, At = p * Ge, xt = -Xe * we - ht * Oe, wt = -Qe * we - At * Oe; return new st(Xe, Qe, ht, At, xt, wt); }, st.prototype.applyToPoint = function(p) { var T = p.x * this.sx + p.y * this.shx + this.tx, Z = p.x * this.shy + p.y * this.sy + this.ty; return new Hi(T, Z); }, st.prototype.applyToRectangle = function(p) { var T = this.applyToPoint(p), Z = this.applyToPoint(new Hi(p.x + p.w, p.y + p.h)); return new g0(T.x, T.y, Z.x - T.x, Z.y - T.y); }, st.prototype.clone = function() { var p = this.sx, T = this.shy, Z = this.shx, le = this.sy, we = this.tx, Oe = this.ty; return new st(p, T, Z, le, we, Oe); }, v.Matrix = st; var Qr = v.matrixMult = function(p, T) { return T.multiply(p); }, Br = new st(1, 0, 0, 1, 0, 0); v.unitMatrix = v.identityMatrix = Br; var Dr = function(p, T) { if (!Bt[p]) { var Z = T instanceof Ai ? "Sh" : "P", le = Z + (Object.keys(it).length + 1).toString(10); T.id = le, Bt[p] = le, it[le] = T, mt.publish("addPattern", T); } }; v.ShadingPattern = Ai, v.TilingPattern = pa, v.addShadingPattern = function(p, T) { return D("addShadingPattern()"), Dr(p, T), this; }, v.beginTilingPattern = function(p) { D("beginTilingPattern()"), b0( p.boundingBox[0], p.boundingBox[1], p.boundingBox[2] - p.boundingBox[0], p.boundingBox[3] - p.boundingBox[1], p.matrix ); }, v.endTilingPattern = function(p, T) { D("endTilingPattern()"), T.stream = se[Y].join(` `), Dr(p, T), mt.publish("endTilingPattern", T), Cr.pop().restore(); }; var Ut = v.__private__.newObject = function() { var p = qt(); return $t(p, !0), p; }, qt = v.__private__.newObjectDeferred = function() { return W++, pe[W] = function() { return q; }, W; }, $t = function(p, T) { return T = typeof T == "boolean" ? T : !1, pe[p] = q, T && X(p + " 0 obj"), p; }, Vr = v.__private__.newAdditionalObject = function() { var p = qt(), T = { objId: p, content: "" }; return K.push(T), T; }, Qt = qt(), Lr = qt(), or = v.__private__.decodeColorString = function(p) { var T = p.split(" "); if (T.length === 2 && (T[1] === "g" || T[1] === "G")) { var Z = parseFloat(T[0]); T = [Z, Z, Z, "r"]; } else if (T.length === 5 && (T[4] === "k" || T[4] === "K")) { var le = (1 - T[0]) * (1 - T[3]), we = (1 - T[1]) * (1 - T[3]), Oe = (1 - T[2]) * (1 - T[3]); T = [le, we, Oe, "r"]; } for (var Ge = "#", Xe = 0; Xe < 3; Xe++) Ge += ("0" + Math.floor(parseFloat(T[Xe]) * 255).toString(16)).slice(-2); return Ge; }, yr = v.__private__.encodeColorString = function(p) { var T; typeof p == "string" && (p = { ch1: p }); var Z = p.ch1, le = p.ch2, we = p.ch3, Oe = p.ch4, Ge = p.pdfColorType === "draw" ? ["G", "RG", "K"] : ["g", "rg", "k"]; if (typeof Z == "string" && Z.charAt(0) !== "#") { var Xe = new ou(Z); if (Xe.ok) Z = Xe.toHex(); else if (!/^\d*\.?\d*$/.test(Z)) throw new Error( 'Invalid color "' + Z + '" passed to jsPDF.encodeColorString.' ); } if (typeof Z == "string" && /^#[0-9A-Fa-f]{3}$/.test(Z) && (Z = "#" + Z[1] + Z[1] + Z[2] + Z[2] + Z[3] + Z[3]), typeof Z == "string" && /^#[0-9A-Fa-f]{6}$/.test(Z)) { var Qe = parseInt(Z.substr(1), 16); Z = Qe >> 16 & 255, le = Qe >> 8 & 255, we = Qe & 255; } if (typeof le > "u" || typeof Oe > "u" && Z === le && le === we) if (typeof Z == "string") T = Z + " " + Ge[0]; else switch (p.precision) { case 2: T = L(Z / 255) + " " + Ge[0]; break; case 3: default: T = J(Z / 255) + " " + Ge[0]; } else if (typeof Oe > "u" || typeof Oe == "object") { if (Oe && !isNaN(Oe.a) && Oe.a === 0) return T = ["1.", "1.", "1.", Ge[1]].join(" "), T; if (typeof Z == "string") T = [Z, le, we, Ge[1]].join(" "); else switch (p.precision) { case 2: T = [ L(Z / 255), L(le / 255), L(we / 255), Ge[1] ].join(" "); break; default: case 3: T = [ J(Z / 255), J(le / 255), J(we / 255), Ge[1] ].join(" "); } } else if (typeof Z == "string") T = [Z, le, we, Oe, Ge[2]].join(" "); else switch (p.precision) { case 2: T = [L(Z), L(le), L(we), L(Oe), Ge[2]].join( " " ); break; case 3: default: T = [J(Z), J(le), J(we), J(Oe), Ge[2]].join( " " ); } return T; }, Hr = v.__private__.getFilters = function() { return u; }, pr = v.__private__.putStream = function(p) { p = p || {}; var T = p.data || "", Z = p.filters || Hr(), le = p.alreadyAppliedFilters || [], we = p.addLength1 || !1, Oe = T.length, Ge = p.objectId, Xe = function(_t) { return _t; }; if (f !== null && typeof Ge > "u") throw new Error( "ObjectId must be passed to putStream for file encryption" ); f !== null && (Xe = vr.encryptor(Ge, 0)); var Qe = {}; Z === !0 && (Z = ["FlateEncode"]); var ht = p.additionalKeyValues || []; typeof ft.API.processDataByFilters < "u" ? Qe = ft.API.processDataByFilters(T, Z) : Qe = { data: T, reverseChain: [] }; var At = Qe.reverseChain + (Array.isArray(le) ? le.join(" ") : le.toString()); if (Qe.data.length !== 0 && (ht.push({ key: "Length", value: Qe.data.length }), we === !0 && ht.push({ key: "Length1", value: Oe })), At.length != 0) if (At.split("/").length - 1 === 1) ht.push({ key: "Filter", value: At }); else { ht.push({ key: "Filter", value: "[" + At + "]" }); for (var xt = 0; xt < ht.length; xt += 1) if (ht[xt].key === "DecodeParms") { for (var wt = [], lr = 0; lr < Qe.reverseChain.split("/").length - 1; lr += 1) wt.push("null"); wt.push(ht[xt].value), ht[xt].value = "[" + wt.join(" ") + "]"; } } X("<<"); for (var jt = 0; jt < ht.length; jt++) X("/" + ht[jt].key + " " + ht[jt].value); X(">>"), Qe.data.length !== 0 && (X("stream"), X(Xe(Qe.data)), X("endstream")); }, en = v.__private__.putPage = function(p) { var T = p.number, Z = p.data, le = p.objId, we = p.contentsObjId; $t(le, !0), X("<</Type /Page"), X("/Parent " + p.rootDictionaryObjId + " 0 R"), X("/Resources " + p.resourceDictionaryObjId + " 0 R"), X( "/MediaBox [" + parseFloat(R(p.mediaBox.bottomLeftX)) + " " + parseFloat(R(p.mediaBox.bottomLeftY)) + " " + R(p.mediaBox.topRightX) + " " + R(p.mediaBox.topRightY) + "]" ), p.cropBox !== null && X( "/CropBox [" + R(p.cropBox.bottomLeftX) + " " + R(p.cropBox.bottomLeftY) + " " + R(p.cropBox.topRightX) + " " + R(p.cropBox.topRightY) + "]" ), p.bleedBox !== null && X( "/BleedBox [" + R(p.bleedBox.bottomLeftX) + " " + R(p.bleedBox.bottomLeftY) + " " + R(p.bleedBox.topRightX) + " " + R(p.bleedBox.topRightY) + "]" ), p.trimBox !== null && X( "/TrimBox [" + R(p.trimBox.bottomLeftX) + " " + R(p.trimBox.bottomLeftY) + " " + R(p.trimBox.topRightX) + " " + R(p.trimBox.topRightY) + "]" ), p.artBox !== null && X( "/ArtBox [" + R(p.artBox.bottomLeftX) + " " + R(p.artBox.bottomLeftY) + " " + R(p.artBox.topRightX) + " " + R(p.artBox.topRightY) + "]" ), typeof p.userUnit == "number" && p.userUnit !== 1 && X("/UserUnit " + p.userUnit), mt.publish("putPage", { objId: le, pageContext: ot[T], pageNumber: T, page: Z }), X("/Contents " + we + " 0 R"), X(">>"), X("endobj"); var Oe = Z.join(` `); return N === F.ADVANCED && (Oe += ` Q`), $t(we, !0), pr({ data: Oe, filters: Hr(), objectId: we }), X("endobj"), le; }, zt = v.__private__.putPages = function() { var p, T, Z = []; for (p = 1; p <= Et; p++) ot[p].objId = qt(), ot[p].contentsObjId = qt(); for (p = 1; p <= Et; p++) Z.push( en({ number: p, data: se[p], objId: ot[p].objId, contentsObjId: ot[p].contentsObjId, mediaBox: ot[p].mediaBox, cropBox: ot[p].cropBox, bleedBox: ot[p].bleedBox, trimBox: ot[p].trimBox, artBox: ot[p].artBox, userUnit: ot[p].userUnit, rootDictionaryObjId: Qt, resourceDictionaryObjId: Lr }) ); $t(Qt, !0), X("<</Type /Pages"); var le = "/Kids ["; for (T = 0; T < Et; T++) le += Z[T] + " 0 R "; X(le + "]"), X("/Count " + Et), X(">>"), X("endobj"), mt.publish("postPutPages"); }, Rt = function(p) { mt.publish("putFont", { font: p, out: X, newObject: Ut, putStream: pr }), p.isAlreadyPutted !== !0 && (p.objectNumber = Ut(), X("<<"), X("/Type /Font"), X("/BaseFont /" + ha(p.postScriptName)), X("/Subtype /Type1"), typeof p.encoding == "string" && X("/Encoding /" + p.encoding), X("/FirstChar 32"), X("/LastChar 255"), X(">>"), X("endobj")); }, Nr = function() { for (var p in $e) $e.hasOwnProperty(p) && (c === !1 || c === !0 && b.hasOwnProperty(p)) && Rt($e[p]); }, fn = function(p) { p.objectNumber = Ut(); var T = []; T.push({ key: "Type", value: "/XObject" }), T.push({ key: "Subtype", value: "/Form" }), T.push({ key: "BBox", value: "[" + [ R(p.x), R(p.y), R(p.x + p.width), R(p.y + p.height) ].join(" ") + "]" }), T.push({ key: "Matrix", value: "[" + p.matrix.toString() + "]" }); var Z = p.pages[1].join(` `); pr({ data: Z, additionalKeyValues: T, objectId: p.objectNumber }), X("endobj"); }, Pr = function() { for (var p in ir) ir.hasOwnProperty(p) && fn(ir[p]); }, cn = function(p, T) { var Z = [], le, we = 1 / (T - 1); for (le = 0; le < 1; le += we) Z.push(le); if (Z.push(1), p[0].offset != 0) { var Oe = { offset: 0, color: p[0].color }; p.unshift(Oe); } if (p[p.length - 1].offset != 1) { var Ge = { offset: 1, color: p[p.length - 1].color }; p.push(Ge); } for (var Xe = "", Qe = 0, ht = 0; ht < Z.length; ht++) { for (le = Z[ht]; le > p[Qe + 1].offset; ) Qe++; var At = p[Qe].offset, xt = p[Qe + 1].offset, wt = (le - At) / (xt - At), lr = p[Qe].color, jt = p[Qe + 1].color; Xe += $(Math.round((1 - wt) * lr[0] + wt * jt[0]).toString(16)) + $(Math.round((1 - wt) * lr[1] + wt * jt[1]).toString(16)) + $(Math.round((1 - wt) * lr[2] + wt * jt[2]).toString(16)); } return Xe.trim(); }, oi = function(p, T) { T || (T = 21); var Z = Ut(), le = cn(p.colors, T), we = []; we.push({ key: "FunctionType", value: "0" }), we.push({ key: "Domain", value: "[0.0 1.0]" }), we.push({ key: "Size", value: "[" + T + "]" }), we.push({ key: "BitsPerSample", value: "8" }), we.push({ key: "Range", value: "[0.0 1.0 0.0 1.0 0.0 1.0]" }), we.push({ key: "Decode", value: "[0.0 1.0 0.0 1.0 0.0 1.0]" }), pr({ data: le, additionalKeyValues: we, alreadyAppliedFilters: ["/ASCIIHexDecode"], objectId: Z }), X("endobj"), p.objectNumber = Ut(), X("<< /ShadingType " + p.type), X("/ColorSpace /DeviceRGB"); var Oe = "/Coords [" + R(parseFloat(p.coords[0])) + " " + // x1 R(parseFloat(p.coords[1])) + " "; p.type === 2 ? Oe += R(parseFloat(p.coords[2])) + " " + // x2 R(parseFloat(p.coords[3])) : Oe += R(parseFloat(p.coords[2])) + " " + // r1 R(parseFloat(p.coords[3])) + " " + // x2 R(parseFloat(p.coords[4])) + " " + // y2 R(parseFloat(p.coords[5])), Oe += "]", X(Oe), p.matrix && X("/Matrix [" + p.matrix.toString() + "]"), X("/Function " + Z + " 0 R"), X("/Extend [true true]"), X(">>"), X("endobj"); }, Oi = function(p, T) { var Z = qt(), le = Ut(); T.push({ resourcesOid: Z, objectOid: le }), p.objectNumber = le; var we = []; we.push({ key: "Type", value: "/Pattern" }), we.push({ key: "PatternType", value: "1" }), we.push({ key: "PaintType", value: "1" }), we.push({ key: "TilingType", value: "1" }), we.push({ key: "BBox", value: "[" + p.boundingBox.map(R).join(" ") + "]" }), we.push({ key: "XStep", value: R(p.xStep) }), we.push({ key: "YStep", value: R(p.yStep) }), we.push({ key: "Resources", value: Z + " 0 R" }), p.matrix && we.push({ key: "Matrix", value: "[" + p.matrix.toString() + "]" }), pr({ data: p.stream, additionalKeyValues: we, objectId: p.objectNumber }), X("endobj"); }, Pn = function(p) { var T; for (T in it) it.hasOwnProperty(T) && (it[T] instanceof Ai ? oi(it[T]) : it[T] instanceof pa && Oi(it[T], p)); }, Ei = function(p) { p.objectNumber = Ut(), X("<<"); for (var T in p) switch (T) { case "opacity": X("/ca " + L(p[T])); break; case "stroke-opacity": X("/CA " + L(p[T])); break; } X(">>"), X("endobj"); }, Ti = function() { var p; for (p in Nt) Nt.hasOwnProperty(p) && Ei(Nt[p]); }, _i = function() {