UNPKG

@microsoft/office-js

Version:
8 lines (6 loc) • 72.4 kB
/*! html2canvas <http://html2canvas.hertzen.com> Copyright (c) 2016 Niklas von Hertzen */ /*! Copyright Mathias Bynens <https://mathiasbynens.be/> */ var PunyCode; (function (x) { var d = 2147483647, b = 36, h = 1, f = 26, C = 38, B = 700, j = 72, o = 128, m = "-", v = /^xn--/, u = /[^\x20-\x7E]/, t = /[\x2E\u3002\uFF0E\uFF61]/g, A = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, g = b - h, a = Math.floor, e = String.fromCharCode, D; function c(a) { throw RangeError(A[a]) } function s(c, d) { var a = c.length, b = []; while (a--) b[a] = d(c[a]); return b } function n(a, f) { var b = a.split("@"), c = ""; if (b.length > 1) { c = b[0] + "@"; a = b[1] } a = a.replace(t, "."); var e = a.split("."), d = s(e, f).join("."); return c + d } function k(d) { var c = [], b = 0, f = d.length, a, e; while (b < f) { a = d.charCodeAt(b++); if (a >= 55296 && a <= 56319 && b < f) { e = d.charCodeAt(b++); if ((e & 64512) == 56320) c.push(((a & 1023) << 10) + (e & 1023) + 65536); else { c.push(a); b-- } } else c.push(a) } return c } function l(a) { return s(a, function (a) { var b = ""; if (a > 65535) { a -= 65536; b += e(a >>> 10 & 1023 | 55296); a = 56320 | a & 1023 } b += e(a); return b }).join("") } function w(a) { if (a - 48 < 10) return a - 22; if (a - 65 < 26) return a - 65; if (a - 97 < 26) return a - 97; return b } function i(a, b) { return a + 22 + 75 * Number(a < 26) - (Number(b != 0) << 5) } function r(c, h, e) { var d = 0; c = e ? a(c / B) : c >> 1; c += a(c / h); for (; c > g * f >> 1; d += b) c = a(c / g); return a(d + (g + 1) * c / (c + C)) } function p(k) { var t = [], B = k.length, n, e = 0, z = o, v = j, g, p, u, y, s, q, i, A, x; g = k.lastIndexOf(m); if (g < 0) g = 0; for (p = 0; p < g; ++p) { k.charCodeAt(p) >= 128 && c("not-basic"); t.push(k.charCodeAt(p)) } for (u = g > 0 ? g + 1 : 0; u < B;) { for (y = e, s = 1, q = b; true; q += b) { u >= B && c("invalid-input"); i = w(k.charCodeAt(u++)); (i >= b || i > a((d - e) / s)) && c("overflow"); e += i * s; A = q <= v ? h : q >= v + f ? f : q - v; if (i < A) break; x = b - A; s > a(d / x) && c("overflow"); s *= x } n = t.length + 1; v = r(e - y, n, y == 0); a(e / n) > d - z && c("overflow"); z += a(e / n); e %= n; t.splice(e++, 0, z) } return l(t) } function q(s) { var p, n, u, B, w, g, t, y, x, z, l, q = [], v, A, C, D; s = k(s); v = s.length; p = o; n = 0; w = j; for (g = 0; g < v; ++g) { l = s[g]; l < 128 && q.push(e(l)) } u = B = q.length; B && q.push(m); while (u < v) { for (t = d, g = 0; g < v; ++g) { l = s[g]; if (l >= p && l < t) t = l } A = u + 1; t - p > a((d - n) / A) && c("overflow"); n += (t - p) * A; p = t; for (g = 0; g < v; ++g) { l = s[g]; l < p && ++n > d && c("overflow"); if (l == p) { for (y = n, x = b; true; x += b) { z = x <= w ? h : x >= w + f ? f : x - w; if (y < z) break; D = y - z; C = b - z; q.push(e(i(z + D % C, 0))); y = a(D / C) } q.push(e(i(y, 0))); w = r(n, A, u == B); n = 0; ++u } } ++n; ++p } return q.join("") } function y(a) { return n(a, function (a) { return v.test(a) ? p(a.slice(4).toLowerCase()) : a }) } function z(a) { return n(a, function (a) { return u.test(a) ? "xn--" + q(a) : a }) } x.PunyCode = { version: "1.3.2", ucs2: { decode: k, encode: l }, decode: p, encode: q, toASCII: z, toUnicode: y } })(PunyCode || (PunyCode = {})); var Html2canvas; (function (a) { a.Color = function (a) { this.r = 0; this.g = 0; this.b = 0; this.a = null; var b = this.fromArray(a) || this.namedColor(a) || this.rgb(a) || this.rgba(a) || this.hex6(a) || this.hex3(a) }; a.Color.prototype.darken = function (c) { var b = 1 - c; return new a.Color([Math.round(this.r * b), Math.round(this.g * b), Math.round(this.b * b), this.a]) }; a.Color.prototype.isTransparent = function () { return this.a === 0 }; a.Color.prototype.isBlack = function () { return this.r === 0 && this.g === 0 && this.b === 0 }; a.Color.prototype.fromArray = function (a) { if (Array.isArray(a)) { this.r = Math.min(a[0], 255); this.g = Math.min(a[1], 255); this.b = Math.min(a[2], 255); if (a.length > 3) this.a = a[3] } return Array.isArray(a) }; var c = /^#([a-f0-9]{3})$/i; a.Color.prototype.hex3 = function (b) { var a = null; if ((a = b.match(c)) !== null) { this.r = parseInt(a[1][0] + a[1][0], 16); this.g = parseInt(a[1][1] + a[1][1], 16); this.b = parseInt(a[1][2] + a[1][2], 16) } return a !== null }; var d = /^#([a-f0-9]{6})$/i; a.Color.prototype.hex6 = function (b) { var a = null; if ((a = b.match(d)) !== null) { this.r = parseInt(a[1].substring(0, 2), 16); this.g = parseInt(a[1].substring(2, 4), 16); this.b = parseInt(a[1].substring(4, 6), 16) } return a !== null }; var f = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/; a.Color.prototype.rgb = function (b) { var a = null; if ((a = b.match(f)) !== null) { this.r = Number(a[1]); this.g = Number(a[2]); this.b = Number(a[3]) } return a !== null }; var e = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/; a.Color.prototype.rgba = function (b) { var a = null; if ((a = b.match(e)) !== null) { this.r = Number(a[1]); this.g = Number(a[2]); this.b = Number(a[3]); this.a = Number(a[4]) } return a !== null }; a.Color.prototype.toString = function () { return this.a !== null && this.a !== 1 ? "rgba(" + [this.r, this.g, this.b, this.a].join(",") + ")" : "rgb(" + [this.r, this.g, this.b].join(",") + ")" }; a.Color.prototype.namedColor = function (c) { c = c.toLowerCase(); var a = b[c]; if (a) { this.r = a[0]; this.g = a[1]; this.b = a[2] } else if (c === "transparent") { this.r = this.g = this.b = this.a = 0; return true } return !!a }; a.Color.prototype.isColor = true; var b = { aliceblue: [240, 248, 255], antiquewhite: [250, 235, 215], aqua: [0, 255, 255], aquamarine: [127, 255, 212], azure: [240, 255, 255], beige: [245, 245, 220], bisque: [255, 228, 196], black: [0, 0, 0], blanchedalmond: [255, 235, 205], blue: [0, 0, 255], blueviolet: [138, 43, 226], brown: [165, 42, 42], burlywood: [222, 184, 135], cadetblue: [95, 158, 160], chartreuse: [127, 255, 0], chocolate: [210, 105, 30], coral: [255, 127, 80], cornflowerblue: [100, 149, 237], cornsilk: [255, 248, 220], crimson: [220, 20, 60], cyan: [0, 255, 255], darkblue: [0, 0, 139], darkcyan: [0, 139, 139], darkgoldenrod: [184, 134, 11], darkgray: [169, 169, 169], darkgreen: [0, 100, 0], darkgrey: [169, 169, 169], darkkhaki: [189, 183, 107], darkmagenta: [139, 0, 139], darkolivegreen: [85, 107, 47], darkorange: [255, 140, 0], darkorchid: [153, 50, 204], darkred: [139, 0, 0], darksalmon: [233, 150, 122], darkseagreen: [143, 188, 143], darkslateblue: [72, 61, 139], darkslategray: [47, 79, 79], darkslategrey: [47, 79, 79], darkturquoise: [0, 206, 209], darkviolet: [148, 0, 211], deeppink: [255, 20, 147], deepskyblue: [0, 191, 255], dimgray: [105, 105, 105], dimgrey: [105, 105, 105], dodgerblue: [30, 144, 255], firebrick: [178, 34, 34], floralwhite: [255, 250, 240], forestgreen: [34, 139, 34], fuchsia: [255, 0, 255], gainsboro: [220, 220, 220], ghostwhite: [248, 248, 255], gold: [255, 215, 0], goldenrod: [218, 165, 32], gray: [128, 128, 128], green: [0, 128, 0], greenyellow: [173, 255, 47], grey: [128, 128, 128], honeydew: [240, 255, 240], hotpink: [255, 105, 180], indianred: [205, 92, 92], indigo: [75, 0, 130], ivory: [255, 255, 240], khaki: [240, 230, 140], lavender: [230, 230, 250], lavenderblush: [255, 240, 245], lawngreen: [124, 252, 0], lemonchiffon: [255, 250, 205], lightblue: [173, 216, 230], lightcoral: [240, 128, 128], lightcyan: [224, 255, 255], lightgoldenrodyellow: [250, 250, 210], lightgray: [211, 211, 211], lightgreen: [144, 238, 144], lightgrey: [211, 211, 211], lightpink: [255, 182, 193], lightsalmon: [255, 160, 122], lightseagreen: [32, 178, 170], lightskyblue: [135, 206, 250], lightslategray: [119, 136, 153], lightslategrey: [119, 136, 153], lightsteelblue: [176, 196, 222], lightyellow: [255, 255, 224], lime: [0, 255, 0], limegreen: [50, 205, 50], linen: [250, 240, 230], magenta: [255, 0, 255], maroon: [128, 0, 0], mediumaquamarine: [102, 205, 170], mediumblue: [0, 0, 205], mediumorchid: [186, 85, 211], mediumpurple: [147, 112, 219], mediumseagreen: [60, 179, 113], mediumslateblue: [123, 104, 238], mediumspringgreen: [0, 250, 154], mediumturquoise: [72, 209, 204], mediumvioletred: [199, 21, 133], midnightblue: [25, 25, 112], mintcream: [245, 255, 250], mistyrose: [255, 228, 225], moccasin: [255, 228, 181], navajowhite: [255, 222, 173], navy: [0, 0, 128], oldlace: [253, 245, 230], olive: [128, 128, 0], olivedrab: [107, 142, 35], orange: [255, 165, 0], orangered: [255, 69, 0], orchid: [218, 112, 214], palegoldenrod: [238, 232, 170], palegreen: [152, 251, 152], paleturquoise: [175, 238, 238], palevioletred: [219, 112, 147], papayawhip: [255, 239, 213], peachpuff: [255, 218, 185], peru: [205, 133, 63], pink: [255, 192, 203], plum: [221, 160, 221], powderblue: [176, 224, 230], purple: [128, 0, 128], rebeccapurple: [102, 51, 153], red: [255, 0, 0], rosybrown: [188, 143, 143], royalblue: [65, 105, 225], saddlebrown: [139, 69, 19], salmon: [250, 128, 114], sandybrown: [244, 164, 96], seagreen: [46, 139, 87], seashell: [255, 245, 238], sienna: [160, 82, 45], silver: [192, 192, 192], skyblue: [135, 206, 235], slateblue: [106, 90, 205], slategray: [112, 128, 144], slategrey: [112, 128, 144], snow: [255, 250, 250], springgreen: [0, 255, 127], steelblue: [70, 130, 180], tan: [210, 180, 140], teal: [0, 128, 128], thistle: [216, 191, 216], tomato: [255, 99, 71], turquoise: [64, 224, 208], violet: [238, 130, 238], wheat: [245, 222, 179], white: [255, 255, 255], whitesmoke: [245, 245, 245], yellow: [255, 255, 0], yellowgreen: [154, 205, 50] } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { a.Log = function () { a.Log.options.logging && window.console && window.console.log && Function.prototype.bind.call(window.console.log, window.console).apply(window.console, [Date.now() - a.Log.options.start + "ms", "html2canvas:"].concat([].slice.call(arguments, 0))) }; a.Log.options = { logging: false } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { a.Support = function (a) { this.rangeBounds = this.testRangeBounds(a); this.cors = this.testCORS(); this.svg = this.testSVG() }; a.Support.prototype.testRangeBounds = function (b) { var c, a, d, e, f = false; if (b.createRange) { c = b.createRange(); if (c.getBoundingClientRect) { a = b.createElement("boundtest"); a.style.height = "123px"; a.style.display = "block"; b.body.appendChild(a); c.selectNode(a); d = c.getBoundingClientRect(); e = d.height; if (e === 123) f = true; b.body.removeChild(a) } } return f }; a.Support.prototype.testCORS = function () { return typeof (new Image).crossOrigin !== "undefined" }; a.Support.prototype.testSVG = function () { var b = new Image, a = document.createElement("canvas"), c = a.getContext("2d"); b.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>"; try { c.drawImage(b, 0, 0); a.toDataURL() } catch (d) { return false } return true } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { a.Utils = {}; a.Promise = typeof window.Promise !== "undefined" ? window.Promise : OfficeExtension.Promise; a.Utils.smallImage = function () { return "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" }; a.Utils.bind = function (a, b) { return function () { return a.apply(b, arguments) } }; a.Utils.decode64 = function (b) { for (var g = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", l = b.length, j, h, c, d, f, i, k, e = "", a = 0; a < l; a += 4) { j = g.indexOf(b[a]); h = g.indexOf(b[a + 1]); c = g.indexOf(b[a + 2]); d = g.indexOf(b[a + 3]); f = j << 2 | h >> 4; i = (h & 15) << 4 | c >> 2; k = (c & 3) << 6 | d; if (c === 64) e += String.fromCharCode(f); else if (d === 64 || d === -1) e += String.fromCharCode(f, i); else e += String.fromCharCode(f, i, k) } return e }; a.Utils.getBounds = function (b) { if (b.getBoundingClientRect) { var a = b.getBoundingClientRect(), c = b.offsetWidth == null ? a.width : b.offsetWidth; return { top: a.top, bottom: a.bottom || a.top + a.height, right: a.left + c, left: a.left, width: c, height: b.offsetHeight == null ? a.height : b.offsetHeight } } return {} }; a.Utils.offsetBounds = function (b) { var c = b.offsetParent ? a.Utils.offsetBounds(b.offsetParent) : { top: 0, left: 0 }; return { top: b.offsetTop + c.top, bottom: b.offsetTop + b.offsetHeight + c.top, right: b.offsetLeft + c.left + b.offsetWidth, left: b.offsetLeft + c.left, width: b.offsetWidth, height: b.offsetHeight } }; a.Utils.parseBackgrounds = function (l) { var m = " \r\n\t", b, a, h, j, d, k = [], c = 0, g = 0, e, f, i = function () { if (b) { if (a.substr(0, 1) === '"') a = a.substr(1, a.length - 2); a && f.push(a); if (b.substr(0, 1) === "-" && (j = b.indexOf("-", 1) + 1) > 0) { h = b.substr(0, j); b = b.substr(j) } k.push({ prefix: h, method: b.toLowerCase(), value: d, args: f, image: null }) } f = []; b = h = a = d = "" }; f = []; b = h = a = d = ""; l.split("").forEach(function (h) { if (c === 0 && m.indexOf(h) > -1) return; switch (h) { case '"': if (!e) e = h; else if (e === h) e = null; break; case "(": if (e) break; else if (c === 0) { c = 1; d += h; return } else g++; break; case ")": if (e) break; else if (c === 1) if (g === 0) { c = 0; d += h; i(); return } else g--; break; case ",": if (e) break; else if (c === 0) { i(); return } else if (c === 1) if (g === 0 && !b.match(/^url$/i)) { f.push(a); a = ""; d += h; return } } d += h; if (c === 0) b += h; else a += h }); i(); return k } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { a.XHR = function (b) { return new a.Promise(function (d, c) { var a = new XMLHttpRequest; a.open("GET", b); a.onload = function () { if (a.status === 200) d(a.responseText); else c(new Error(a.statusText)) }; a.onerror = function () { c(new Error("Network Error")) }; a.send() }) } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var f = a.Log; function e(a, b, c) { a.defaultView && (b !== a.defaultView.pageXOffset || c !== a.defaultView.pageYOffset) && a.defaultView.scrollTo(b, c) } function d(a, b) { try { if (b) { b.width = a.width; b.height = a.height; b.getContext("2d").putImageData(a.getContext("2d").getImageData(0, 0, a.width, a.height), 0, 0) } } catch (c) { f("Unable to copy canvas content from", a, c) } } function b(a, f) { var e = a.nodeType === 3 ? document.createTextNode(a.nodeValue) : a.cloneNode(false), c = a.firstChild; while (c) { (f === true || c.nodeType !== 1 || c.nodeName !== "SCRIPT") && e.appendChild(b(c, f)); c = c.nextSibling } if (a.nodeType === 1) { e._scrollTop = a.scrollTop; e._scrollLeft = a.scrollLeft; if (a.nodeName === "CANVAS") d(a, e); else if (a.nodeName === "TEXTAREA" || a.nodeName === "SELECT") e.value = a.value } return e } function c(a) { if (a.nodeType === 1) { a.scrollTop = a._scrollTop; a.scrollLeft = a._scrollLeft; var b = a.firstChild; while (b) { c(b); b = b.nextSibling } } } a.CreateWindowClone = function (i, h, m, l, j, f, g) { var k = b(i.documentElement, j.javascriptEnabled), d = h.createElement("iframe"); d.className = "html2canvas-container"; d.style.visibility = "hidden"; d.style.position = "fixed"; d.style.left = "-10000px"; d.style.top = "0px"; d.style.border = "0"; d.width = m; d.height = l; d.scrolling = "no"; h.body.appendChild(d); return new a.Promise(function (b) { var a = d.contentWindow.document; d.contentWindow.onload = d.onload = function () { var e = setInterval(function () { if (a.body.childNodes.length > 0) { c(a.documentElement); clearInterval(e); if (j.type === "view") { d.contentWindow.scrollTo(f, g); if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (d.contentWindow.scrollY !== g || d.contentWindow.scrollX !== f)) { a.documentElement.style.top = -g + "px"; a.documentElement.style.left = -f + "px"; a.documentElement.style.position = "absolute" } } b(d) } }, 50) }; a.open(); a.write("<!DOCTYPE html><html></html>"); e(i, f, g); a.replaceChild(a.adoptNode(k), a.documentElement); a.close() }) } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.Log, c = a.Utils.smallImage; a.DummyImageContainer = function (e) { this.src = e; b("DummyImageContainer for", e); if (!this.promise || !this.image) { b("Initiating DummyImageContainer"); a.DummyImageContainer.prototype.image = new Image; var d = this.image; a.DummyImageContainer.prototype.promise = new a.Promise(function (a, b) { d.onload = a; d.onerror = b; d.src = c(); d.complete === true && a(d) }) } } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.Utils.smallImage; a.Font = function (g, i) { var a = document.createElement("div"), c = document.createElement("img"), d = document.createElement("span"), e = "Hidden Text", f, h; a.style.visibility = "hidden"; a.style.fontFamily = g; a.style.fontSize = i; a.style.margin = "0"; a.style.padding = "0"; document.body.appendChild(a); c.src = b(); c.width = 1; c.height = 1; c.style.margin = "0"; c.style.padding = "0"; c.style.verticalAlign = "baseline"; d.style.fontFamily = g; d.style.fontSize = i; d.style.margin = "0"; d.style.padding = "0"; d.appendChild(document.createTextNode(e)); a.appendChild(d); a.appendChild(c); f = c.offsetTop - d.offsetTop + 1; a.removeChild(d); a.appendChild(document.createTextNode(e)); a.style.lineHeight = "normal"; c.style.verticalAlign = "super"; h = c.offsetTop - a.offsetTop + 1; document.body.removeChild(a); this.baseline = f; this.lineWidth = 1; this.middle = h } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.Font; a.FontMetrics = function () { this.data = {} }; a.FontMetrics.prototype.getMetrics = function (a, c) { if (this.data[a + "-" + c] === undefined) this.data[a + "-" + c] = new b(a, c); return this.data[a + "-" + c] } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { a.GradientContainer = function (b) { this.src = b.value; this.colorStops = []; this.type = null; this.x0 = .5; this.y0 = .5; this.x1 = .5; this.y1 = .5; this.promise = a.Promise.resolve(true) }; a.GradientContainer.TYPES = { LINEAR: 1, RADIAL: 2 }; a.GradientContainer.REGEXP_COLORSTOP = /^\s*(rgba?\(\s*\d{1,3},\s*\d{1,3},\s*\d{1,3}(?:,\s*[0-9\.]+)?\s*\)|[a-z]{3,20}|#[a-f0-9]{3,6})(?:\s+(\d{1,3}(?:\.\d+)?)(%|px)?)?(?:\s|$)/i })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { a.ImageContainer = function (c, d) { this.src = c; this.image = new Image; var b = this; this.tainted = null; this.promise = new a.Promise(function (a, e) { b.image.onload = a; b.image.onerror = e; if (d) b.image.crossOrigin = "anonymous"; b.image.src = c; b.image.complete === true && a(b.image) }) } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.GradientContainer, c = a.Color; a.LinearGradientContainer = function (d) { b.apply(this, arguments); this.type = b.TYPES.LINEAR; var e = a.LinearGradientContainer.REGEXP_DIRECTION.test(d.args[0]) || !b.REGEXP_COLORSTOP.test(d.args[0]); if (e) d.args[0].split(/\s+/).reverse().forEach(function (b, c) { switch (b) { case "left": this.x0 = 0; this.x1 = 1; break; case "top": this.y0 = 0; this.y1 = 1; break; case "right": this.x0 = 1; this.x1 = 0; break; case "bottom": this.y0 = 1; this.y1 = 0; break; case "to": var e = this.y0, d = this.x0; this.y0 = this.y1; this.x0 = this.x1; this.x1 = d; this.y1 = e; break; case "center": break; default: var a = parseFloat(b) * .01; if (isNaN(a)) break; if (c === 0) { this.y0 = a; this.y1 = 1 - this.y0 } else { this.x0 = a; this.x1 = 1 - this.x0 } } }, this); else { this.y0 = 0; this.y1 = 1 } this.colorStops = d.args.slice(e ? 1 : 0).map(function (e) { var a = e.match(b.REGEXP_COLORSTOP), d = +a[2], f = d === 0 ? "%" : a[3]; return { color: new c(a[1]), stop: f === "%" ? d / 100 : null } }); if (this.colorStops[0].stop === null) this.colorStops[0].stop = 0; if (this.colorStops[this.colorStops.length - 1].stop === null) this.colorStops[this.colorStops.length - 1].stop = 1; this.colorStops.forEach(function (b, a) { b.stop === null && this.colorStops.slice(a).some(function (c, d) { if (c.stop !== null) { b.stop = (c.stop - this.colorStops[a - 1].stop) / (d + 1) + this.colorStops[a - 1].stop; return true } else return false }, this) }, this) }; a.LinearGradientContainer.prototype = Object.create(b.prototype); a.LinearGradientContainer.REGEXP_DIRECTION = /^\s*(?:to|left|right|top|bottom|center|\d{1,3}(?:\.\d+)?%?)(?:\s|$)/i })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var d = a.Color, c = a.Utils, i = c.getBounds, e = c.parseBackgrounds, g = c.offsetBounds; a.NodeContainer = function (b, a) { this.node = b; this.parent = a; this.stack = null; this.bounds = null; this.borders = null; this.clip = []; this.backgroundClip = []; this.offsetBounds = null; this.visible = null; this.computedStyles = null; this.colors = {}; this.styles = {}; this.backgroundImages = null; this.transformData = null; this.transformMatrix = null; this.isPseudoElement = false; this.opacity = null }; a.NodeContainer.prototype.cloneTo = function (a) { a.visible = this.visible; a.borders = this.borders; a.bounds = this.bounds; a.clip = this.clip; a.backgroundClip = this.backgroundClip; a.computedStyles = this.computedStyles; a.styles = this.styles; a.backgroundImages = this.backgroundImages; a.opacity = this.opacity }; a.NodeContainer.prototype.getOpacity = function () { return this.opacity === null ? (this.opacity = this.cssFloat("opacity")) : this.opacity }; a.NodeContainer.prototype.assignStack = function (a) { this.stack = a; a.children.push(this) }; a.NodeContainer.prototype.isElementVisible = function () { return this.node.nodeType === Node.TEXT_NODE ? this.parent.visible : this.css("display") !== "none" && this.css("visibility") !== "hidden" && !this.node.hasAttribute("data-html2canvas-ignore") && (this.node.nodeName !== "INPUT" || this.node.getAttribute("type") !== "hidden") }; a.NodeContainer.prototype.css = function (a) { if (!this.computedStyles) this.computedStyles = this.isPseudoElement ? this.parent.computedStyle(this.before ? ":before" : ":after") : this.computedStyle(null); return this.styles[a] || (this.styles[a] = this.computedStyles[a]) }; a.NodeContainer.prototype.prefixedCss = function (b) { var c = ["webkit", "moz", "ms", "o"], a = this.css(b); a === undefined && c.some(function (c) { a = this.css(c + b.substr(0, 1).toUpperCase() + b.substr(1)); return a !== undefined }, this); return a === undefined ? null : a }; a.NodeContainer.prototype.computedStyle = function (a) { return this.node.ownerDocument.defaultView.getComputedStyle(this.node, a) }; a.NodeContainer.prototype.cssInt = function (b) { var a = parseInt(this.css(b), 10); return isNaN(a) ? 0 : a }; a.NodeContainer.prototype.color = function (a) { return this.colors[a] || (this.colors[a] = new d(this.css(a))) }; a.NodeContainer.prototype.cssFloat = function (b) { var a = parseFloat(this.css(b)); return isNaN(a) ? 0 : a }; a.NodeContainer.prototype.fontWeight = function () { var a = this.css("fontWeight"); switch (parseInt(a, 10)) { case 401: a = "bold"; break; case 400: a = "normal" } return a }; a.NodeContainer.prototype.parseClip = function () { var a = this.css("clip").match(this.CLIP); if (a) return { top: parseInt(a[1], 10), right: parseInt(a[2], 10), bottom: parseInt(a[3], 10), left: parseInt(a[4], 10) }; return null }; a.NodeContainer.prototype.parseBackgroundImages = function () { return this.backgroundImages || (this.backgroundImages = e(this.css("backgroundImage"))) }; a.NodeContainer.prototype.cssList = function (c, d) { var a = (this.css(c) || "").split(","); a = a[d || 0] || a[0] || "auto"; a = a.trim().split(" "); if (a.length === 1) a = [a[0], b(a[0]) ? "auto" : a[0]]; return a }; a.NodeContainer.prototype.parseBackgroundSize = function (c, d, i) { var a = this.cssList("backgroundSize", i), f, e; if (b(a[0])) f = c.width * parseFloat(a[0]) / 100; else if (/contain|cover/.test(a[0])) { var h = c.width / c.height, g = d.width / d.height; return Number(h < g) ^ Number(a[0] === "contain") ? { width: c.height * g, height: c.height } : { width: c.width, height: c.width / g } } else f = parseInt(a[0], 10); if (a[0] === "auto" && a[1] === "auto") e = d.height; else if (a[1] === "auto") e = f / d.width * d.height; else if (b(a[1])) e = c.height * parseFloat(a[1]) / 100; else e = parseInt(a[1], 10); if (a[0] === "auto") f = e / d.height * d.width; return { width: f, height: e } }; a.NodeContainer.prototype.parseBackgroundPosition = function (g, c, h, f) { var a = this.cssList("backgroundPosition", h), d, e; if (b(a[0])) d = (g.width - (f || c).width) * (parseFloat(a[0]) / 100); else d = parseInt(a[0], 10); if (a[1] === "auto") e = d / c.width * c.height; else if (b(a[1])) e = (g.height - (f || c).height) * parseFloat(a[1]) / 100; else e = parseInt(a[1], 10); if (a[0] === "auto") d = e / c.height * c.width; return { left: d, top: e } }; a.NodeContainer.prototype.parseBackgroundRepeat = function (a) { return this.cssList("backgroundRepeat", a)[0] }; a.NodeContainer.prototype.parseTextShadows = function () { var b = this.css("textShadow"), f = []; if (b && b !== "none") for (var c = b.match(this.TEXT_SHADOW_PROPERTY), e = 0; c && e < c.length; e++) { var a = c[e].match(this.TEXT_SHADOW_VALUES); f.push({ color: new d(a[0]), offsetX: a[1] ? parseFloat(a[1].replace("px", "")) : 0, offsetY: a[2] ? parseFloat(a[2].replace("px", "")) : 0, blur: a[3] ? a[3].replace("px", "") : 0 }) } return f }; a.NodeContainer.prototype.parseTransform = function () { if (!this.transformData) if (this.hasTransform()) { var b = this.parseBounds(), a = this.prefixedCss("transformOrigin").split(" ").map(j).map(k); a[0] += b.left; a[1] += b.top; this.transformData = { origin: a, matrix: this.parseTransformMatrix() } } else this.transformData = { origin: [0, 0], matrix: [1, 0, 0, 1, 0, 0] }; return this.transformData }; a.NodeContainer.prototype.parseTransformMatrix = function () { if (!this.transformMatrix) { var a = this.prefixedCss("transform"), b = a ? h(a.match(this.MATRIX_PROPERTY)) : null; this.transformMatrix = b ? b : [1, 0, 0, 1, 0, 0] } return this.transformMatrix }; a.NodeContainer.prototype.parseBounds = function () { return this.bounds || (this.bounds = this.hasTransform() ? g(this.node) : i(this.node)) }; a.NodeContainer.prototype.hasTransform = function () { return this.parseTransformMatrix().join(",") !== "1,0,0,1,0,0" || this.parent && this.parent.hasTransform() }; a.NodeContainer.prototype.getValue = function () { var a = this.node.value || ""; if (this.node.tagName === "SELECT") a = f(this.node); else if (this.node.type === "password") a = Array(a.length + 1).join("\u2022"); return a.length === 0 ? this.node.placeholder || "" : a }; a.NodeContainer.prototype.MATRIX_PROPERTY = /(matrix|matrix3d)\((.+)\)/; a.NodeContainer.prototype.TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g; a.NodeContainer.prototype.TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g; a.NodeContainer.prototype.CLIP = /^rect\((\d+)px,? (\d+)px,? (\d+)px,? (\d+)px\)$/; function f(b) { var a = b.options[b.selectedIndex || 0]; return a ? a.text || "" : "" } function h(b) { if (b && b[1] === "matrix") return b[2].split(",").map(function (a) { return parseFloat(a.trim()) }); else if (b && b[1] === "matrix3d") { var a = b[2].split(",").map(function (a) { return parseFloat(a.trim()) }); return [a[0], a[1], a[4], a[5], a[12], a[13]] } } function b(a) { return a.toString().indexOf("%") !== -1 } function j(a) { return a.replace("px", "") } function k(a) { return parseFloat(a) } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var k = a.XHR, j = a.Utils, e = a.Log, f = a.CreateWindowClone, i = j.decode64; a.Proxy = function (l, g, j) { var e = "withCredentials" in new XMLHttpRequest; if (!g) return a.Promise.reject("No proxy configured"); var f = b(e), h = c(g, l, f); return e ? k(h) : d(j, h, f).then(function (a) { return i(a.content) }) }; var h = 0; a.ProxyURL = function (j, i, h) { var e = "crossOrigin" in new Image, f = b(e), g = c(i, j, f); return e ? a.Promise.resolve(g) : d(h, g, f).then(function (a) { return "data:" + a.type + ";base64," + a.content }) }; function d(b, d, c) { return new a.Promise(function (f, g) { var a = b.createElement("script"), e = function () { delete window.html2canvas.proxy[c]; b.body.removeChild(a) }; window.html2canvas.proxy[c] = function (a) { e(); f(a) }; a.src = d; a.onerror = function (a) { e(); g(a) }; b.body.appendChild(a) }) } function b(a) { return !a ? "html2canvas_" + Date.now() + "_" + ++h + "_" + Math.round(Math.random() * 1e5) : "" } function c(b, c, a) { return b + "?url=" + encodeURIComponent(c) + (a.length ? "&callback=html2canvas.proxy." + a : "") } function g(a) { return function (c) { var g = new DOMParser, b; try { b = g.parseFromString(c, "text/html") } catch (i) { e("DOMParser not supported, falling back to createHTMLDocument"); b = document.implementation.createHTMLDocument(""); try { b.open(); b.write(c); b.close() } catch (h) { e("createHTMLDocument write not supported, falling back to document.body.innerHTML"); b.body.innerHTML = c } } var f = b.querySelector("base"); if (!f || !f.href.host) { var d = b.createElement("base"); d.href = a; b.head.insertBefore(d, b.head.firstChild) } return b } } a.loadUrlDocument = function (b, h, c, i, e, d) { return (new a.Proxy(b, h, window.document)).then(g(b)).then(function (a) { return f(a, c, i, e, d, 0, 0) }) } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.ProxyURL; a.ProxyImageContainer = function (d, f) { var e = document.createElement("a"); e.href = d; d = e.href; this.src = d; this.image = new Image; var c = this; this.promise = new a.Promise(function (e, a) { c.image.crossOrigin = "Anonymous"; c.image.onload = e; c.image.onerror = a; (new b(d, f, document)).then(function (a) { c.image.src = a })["catch"](a) }) } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.NodeContainer; a.PseudoElementContainer = function (c, a, d) { b.call(this, c, a); this.isPseudoElement = true; this.before = d === ":before" }; a.PseudoElementContainer.prototype.cloneTo = function (b) { a.PseudoElementContainer.prototype.cloneTo.call(this, b); b.isPseudoElement = true; b.before = this.before }; a.PseudoElementContainer.prototype = Object.create(b.prototype); a.PseudoElementContainer.prototype.appendToDOM = function () { if (this.before) this.parent.node.insertBefore(this.node, this.parent.node.firstChild); else this.parent.node.appendChild(this.node); this.parent.node.className += " " + this.getHideClass() }; a.PseudoElementContainer.prototype.cleanDOM = function () { this.node.parentNode.removeChild(this.node); this.parent.node.className = this.parent.node.className.replace(this.getHideClass(), "") }; a.PseudoElementContainer.prototype.getHideClass = function () { return this["PSEUDO_HIDE_ELEMENT_CLASS_" + (this.before ? "BEFORE" : "AFTER")] }; a.PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = "___html2canvas___pseudoelement_before"; a.PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER = "___html2canvas___pseudoelement_after" })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.Log; a.Renderer = function (e, c, d, b, a) { this.width = e; this.height = c; this.images = d; this.options = b; this.document = a }; a.Renderer.prototype.renderImage = function (b, c, k, d) { var e = b.cssInt("paddingLeft"), f = b.cssInt("paddingTop"), j = b.cssInt("paddingRight"), i = b.cssInt("paddingBottom"), a = k.borders, h = c.width - (a[1].width + a[3].width + e + j), g = c.height - (a[0].width + a[2].width + f + i); this.drawImage(d, 0, 0, d.image.width || h, d.image.height || g, c.left + e + a[3].width, c.top + f + a[0].width, h, g) }; a.Renderer.prototype.renderBackground = function (b, a, c) { if (a.height > 0 && a.width > 0) { this.renderBackgroundColor(b, a); this.renderBackgroundImage(b, a, c) } }; a.Renderer.prototype.renderBackgroundColor = function (c, a) { var b = c.color("backgroundColor"); !b.isTransparent() && this.rectangle(a.left, a.top, a.width, a.height, b) }; a.Renderer.prototype.renderBorders = function (a) { a.forEach(this.renderBorder, this) }; a.Renderer.prototype.renderBorder = function (a) { !a.color.isTransparent() && a.args !== null && this.drawShape(a.args, a.color) }; a.Renderer.prototype.renderBackgroundImage = function (c, d, a) { var e = c.parseBackgroundImages(); e.reverse().forEach(function (e, h, i) { switch (e.method) { case "url": var g = this.images.get(e.args[0]); if (g) this.renderBackgroundRepeating(c, d, g, i.length - (h + 1), a); else b("Error loading background-image", e.args[0]); break; case "linear-gradient": case "gradient": var f = this.images.get(e.value); if (f) this.renderBackgroundGradient(f, d, a); else b("Error loading background-image", e.args[0]); break; case "none": break; default: b("Unknown background-image type", e.args[0]) } }, this) }; a.Renderer.prototype.renderBackgroundRepeating = function (f, a, e, g, b) { var c = f.parseBackgroundSize(a, e.image, g), d = f.parseBackgroundPosition(a, e.image, g, c), h = f.parseBackgroundRepeat(g); switch (h) { case "repeat-x": case "repeat no-repeat": this.backgroundRepeatShape(e, d, c, a, a.left + b[3], a.top + d.top + b[0], 99999, c.height, b); break; case "repeat-y": case "no-repeat repeat": this.backgroundRepeatShape(e, d, c, a, a.left + d.left + b[3], a.top + b[0], c.width, 99999, b); break; case "no-repeat": this.backgroundRepeatShape(e, d, c, a, a.left + d.left + b[3], a.top + d.top + b[0], c.width, c.height, b); break; default: this.renderBackgroundRepeat(e, d, c, { top: a.top, left: a.left }, b[3], b[0]) } } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.Renderer, c = a.LinearGradientContainer, e = a.Log; a.CanvasRenderer = function (c, a) { b.apply(this, arguments); this.canvas = this.options.canvas || this.document.createElement("canvas"); if (!this.options.canvas) { this.canvas.width = c; this.canvas.height = a } this.ctx = this.canvas.getContext("2d"); this.taintCtx = this.document.createElement("canvas").getContext("2d"); this.ctx.textBaseline = "bottom"; this.variables = {}; e("Initialized CanvasRenderer with size", c, "x", a) }; a.CanvasRenderer.prototype = Object.create(b.prototype); a.CanvasRenderer.prototype.setFillStyle = function (a) { this.ctx.fillStyle = typeof a === "object" && !!a.isColor ? a.toString() : a; return this.ctx }; a.CanvasRenderer.prototype.rectangle = function (d, e, c, a, b) { this.setFillStyle(b).fillRect(d, e, c, a) }; a.CanvasRenderer.prototype.circle = function (c, d, a, b) { this.setFillStyle(b); this.ctx.beginPath(); this.ctx.arc(c + a / 2, d + a / 2, a / 2, 0, Math.PI * 2, true); this.ctx.closePath(); this.ctx.fill() }; a.CanvasRenderer.prototype.circleStroke = function (c, e, d, b, f, a) { this.circle(c, e, d, b); this.ctx.strokeStyle = a.toString(); this.ctx.stroke() }; a.CanvasRenderer.prototype.drawShape = function (b, a) { this.shape(b); this.setFillStyle(a).fill() }; a.CanvasRenderer.prototype.taints = function (a) { if (a.tainted === null) { this.taintCtx.drawImage(a.image, 0, 0); try { this.taintCtx.getImageData(0, 0, 1, 1); a.tainted = false } catch (b) { this.taintCtx = document.createElement("canvas").getContext("2d"); a.tainted = true } } return a.tainted }; a.CanvasRenderer.prototype.drawImage = function (a, h, i, g, f, d, e, c, b) { (!this.taints(a) || this.options.allowTaint) && this.ctx.drawImage(a.image, h, i, g, f, d, e, c, b) }; a.CanvasRenderer.prototype.clip = function (c, a, b) { this.ctx.save(); c.filter(d).forEach(function (a) { this.shape(a).clip() }, this); a.call(b); this.ctx.restore() }; a.CanvasRenderer.prototype.shape = function (a) { this.ctx.beginPath(); a.forEach(function (a, b) { if (a[0] === "rect") this.ctx.rect.apply(this.ctx, a.slice(1)); else this.ctx[b === 0 ? "moveTo" : a[0] + "To"].apply(this.ctx, a.slice(1)) }, this); this.ctx.closePath(); return this.ctx }; a.CanvasRenderer.prototype.font = function (d, e, a, c, f, b) { this.setFillStyle(d).font = [e, a, c, f, b].join(" ").split(",")[0] }; a.CanvasRenderer.prototype.fontShadow = function (c, a, b, d) { this.setVariable("shadowColor", c.toString()).setVariable("shadowOffsetY", a).setVariable("shadowOffsetX", b).setVariable("shadowBlur", d) }; a.CanvasRenderer.prototype.clearShadow = function () { this.setVariable("shadowColor", "rgba(0,0,0,0)") }; a.CanvasRenderer.prototype.setOpacity = function (a) { this.ctx.globalAlpha = a }; a.CanvasRenderer.prototype.setTransform = function (a) { this.ctx.translate(a.origin[0], a.origin[1]); this.ctx.transform.apply(this.ctx, a.matrix); this.ctx.translate(-a.origin[0], -a.origin[1]) }; a.CanvasRenderer.prototype.setVariable = function (a, b) { if (this.variables[a] !== b) this.variables[a] = this.ctx[a] = b; return this }; a.CanvasRenderer.prototype.text = function (c, b, a) { this.ctx.fillText(c, b, a) }; a.CanvasRenderer.prototype.backgroundRepeatShape = function (g, f, j, h, a, b, e, d, c) { var i = [["line", Math.round(a), Math.round(b)], ["line", Math.round(a + e), Math.round(b)], ["line", Math.round(a + e), Math.round(d + b)], ["line", Math.round(a), Math.round(d + b)]]; this.clip([i], function () { this.renderBackgroundRepeat(g, f, j, h, c[3], c[0]) }, this) }; a.CanvasRenderer.prototype.renderBackgroundRepeat = function (e, a, h, d, f, g) { var b = Math.round(d.left + a.left + f), c = Math.round(d.top + a.top + g); this.setFillStyle(this.ctx.createPattern(this.resizeImage(e, h), "repeat")); this.ctx.translate(b, c); this.ctx.fill(); this.ctx.translate(-b, -c) }; a.CanvasRenderer.prototype.renderBackgroundGradient = function (b, a) { if (b instanceof c) { var d = this.ctx.createLinearGradient(a.left + a.width * b.x0, a.top + a.height * b.y0, a.left + a.width * b.x1, a.top + a.height * b.y1); b.colorStops.forEach(function (a) { d.addColorStop(a.stop, a.color.toString()) }); this.rectangle(a.left, a.top, a.width, a.height, d) } }; a.CanvasRenderer.prototype.resizeImage = function (e, b) { var a = e.image; if (a.width === b.width && a.height === b.height) return a; var d, c = document.createElement("canvas"); c.width = b.width; c.height = b.height; d = c.getContext("2d"); d.drawImage(a, 0, 0, a.width, a.height, 0, 0, b.width, b.height); return c }; function d(a) { return a.length > 0 } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.NodeContainer; a.StackingContext = function (a, d, c, e) { b.call(this, c, e); this.ownStacking = a; this.contexts = []; this.children = []; this.opacity = (this.parent ? this.parent.stack.opacity : 1) * d }; a.StackingContext.prototype = Object.create(b.prototype); a.StackingContext.prototype.getParentStack = function (b) { var a = this.parent ? this.parent.stack : null; return a ? a.ownStacking ? a : a.getParentStack(b) : b.stack } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var c = a.XHR, b = a.Utils.decode64; a.SVGContainer = function (d) { this.src = d; this.image = null; var b = this; this.promise = this.hasFabric().then(function () { return b.isInline(d) ? a.Promise.resolve(b.inlineFormatting(d)) : c(d) }).then(function (c) { return new a.Promise(function (a) { window.html2canvas.svg.fabric.loadSVGFromString(c, b.createCanvas.call(b, a)) }) }) }; a.SVGContainer.prototype.hasFabric = function () { return !window.html2canvas.svg || !window.html2canvas.svg.fabric ? a.Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg")) : a.Promise.resolve() }; a.SVGContainer.prototype.inlineFormatting = function (a) { return /^data:image\/svg\+xml;base64,/.test(a) ? this.decode64(this.removeContentType(a)) : this.removeContentType(a) }; a.SVGContainer.prototype.removeContentType = function (a) { return a.replace(/^data:image\/svg\+xml(;base64)?,/, "") }; a.SVGContainer.prototype.isInline = function (a) { return /^data:image\/svg\+xml/i.test(a) }; a.SVGContainer.prototype.createCanvas = function (a) { var b = this; return function (e, c) { var d = new window.html2canvas.svg.fabric.StaticCanvas("c"); b.image = d.lowerCanvasEl; d.setWidth(c.width).setHeight(c.height).add(window.html2canvas.svg.fabric.util.groupSVGElements(e, c)).renderAll(); a(d.lowerCanvasEl) } }; a.SVGContainer.prototype.decode64 = function (a) { return typeof window.atob === "function" ? window.atob(a) : b(a) } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { a.SVGNodeContainer = function (c, d) { this.src = c; this.image = null; var b = this; this.promise = d ? new a.Promise(function (a, d) { b.image = new Image; b.image.onload = a; b.image.onerror = d; b.image.src = "data:image/svg+xml," + encodeURIComponent((new XMLSerializer).serializeToString(c)); b.image.complete === true && a(b.image) }) : this.hasFabric().then(function () { return new a.Promise(function (a) { window.html2canvas.svg.fabric.parseSVGDocument(c, b.createCanvas.call(b, a)) }) }) }; a.SVGNodeContainer.prototype = Object.create(a.SVGContainer.prototype) })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.NodeContainer; a.TextContainer = function (c, a) { b.call(this, c, a) }; a.TextContainer.prototype = Object.create(b.prototype); a.TextContainer.prototype.applyTextTransform = function () { this.node.data = this.transform(this.parent.css("textTransform")) }; a.TextContainer.prototype.transform = function (b) { var a = this.node.data; switch (b) { case "lowercase": return a.toLowerCase(); case "capitalize": return a.replace(/(^|\s|:|-|\(|\))([a-z])/g, c); case "uppercase": return a.toUpperCase(); default: return a } }; function c(c, a, b) { if (c.length > 0) return a + b.toUpperCase() } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (b) { var a = b.GradientContainer; b.WebkitGradientContainer = function (b) { a.apply(this, arguments); this.type = b.args[0] === "linear" ? a.TYPES.LINEAR : a.TYPES.RADIAL }; b.WebkitGradientContainer.prototype = Object.create(a.prototype) })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.Log, m = PunyCode.PunyCode, p = a.NodeContainer, q = a.TextContainer, g = a.PseudoElementContainer, O = a.FontMetrics, e = a.Color, o = a.StackingContext, n = a.Utils, u = n.bind, U = n.getBounds, G = n.parseBackgrounds, N = n.offsetBounds; a.NodeParser = function (c, d, k, i, f) { b("Starting NodeParser"); this.renderer = d; this.options = f; this.range = null; this.support = k; this.renderQueue = []; this.stack = new o(true, 1, c.ownerDocument, null); var g = new p(c, null); f.background && d.rectangle(0, 0, d.width, d.height, new e(f.background)); if (c === c.ownerDocument.documentElement) { var h = new p(g.color("backgroundColor").isTransparent() ? c.ownerDocument.body : c.ownerDocument.documentElement, null); d.rectangle(0, 0, d.width, d.height, h.color("backgroundColor")) } g.visible = g.isElementVisible(); this.createPseudoHideStyles(c.ownerDocument); this.disableAnimations(c.ownerDocument); this.nodes = t([g].concat(this.getChildren(g)).filter(function (a) { return a.visible = a.isElementVisible() }).map(this.getPseudoElements, this)); this.fontMetrics = new O; b("Fetched nodes, total:", this.nodes.length); b("Calculate overflow clips"); this.calculateOverflowClips(); b("Start fetching images"); this.images = i.fetch(this.nodes.filter(j)); this.ready = this.images.ready.then(u(function () { b("Images loaded, starting parsing"); b("Creating stacking contexts"); this.createStackingContexts(); b("Sorting stacking contexts"); this.sortStackingContexts(this.stack); this.parse(this.stack); b("Render queue created with " + this.renderQueue.length + " items"); return new a.Promise(u(function (a) { if (!f.async) { this.renderQueue.forEach(this.paint, this); a() } else if (typeof f.async === "function") f.async.call(this, this.renderQueue, a); else if (this.renderQueue.length > 0) { this.renderIndex = 0; this.asyncRenderer(this.renderQueue, a) } else a() }, this)) }, this)) }; a.NodeParser.prototype.calculateOverflowClips = function () { this.nodes.forEach(function (a) { if (j(a)) { h(a) && a.appendToDOM(); a.borders = this.parseBorders(a); var c = a.css("overflow") === "hidden" ? [a.borders.clip] : [], b = a.parseClip(); b && ["absolute", "fixed"].indexOf(a.css("position")) !== -1 && c.push([["rect", a.bounds.left + b.left, a.bounds.top + b.top, b.right - b.left, b.bottom - b.top]]); a.clip = A(a) ? a.parent.clip.concat(c) : c; a.backgroundClip = a.css("overflow") !== "hidden" ? a.clip.concat([a.borders.clip]) : a.clip; h(a) && a.cleanDOM() } else if (s(a)) a.clip = A(a) ? a.parent.clip : []; if (!h(a)) a.bounds = null }, this) }; function A(a) { return a.parent && a.parent.clip.length } a.NodeParser.prototype.asyncRenderer = function (b, c, a) { a = a || Date.now(); this.paint(b[this.renderIndex++]); if (b.length === this.renderIndex) c(); else if (a + 20 > Date.now()) this.asyncRenderer(b, c, a); else setTimeout(u(function () { this.asyncRenderer(b, c) }, this), 0) }; a.NodeParser.prototype.createPseudoHideStyles = function (a) { this.createStyles(a, "." + g.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ':before { content: "" !important; display: none !important; }.' + g.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER + ':after { content: "" !important; display: none !important; }') }; a.NodeParser.prototype.disableAnimations = function (a) { this.createStyles(a, "* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}") }; a.NodeParser.prototype.createStyles = function (b, c) { var a = b.createElement("style"); a.innerHTML = c; b.body.appendChild(a) }; a.NodeParser.prototype.getPseudoElements = function (a) { var b = [[a]]; if (a.node.nodeType === Node.ELEMENT_NODE) { var c = this.getPseudoElement(a, ":before"), d = this.getPseudoElement(a, ":after"); c && b.push(c); d && b.push(d) } return t(b) }; function Q(a) { return a.replace(/(\-[a-z])/g, function (a) { return a.toUpperCase().replace("-", "") }) } a.NodeParser.prototype.getPseudoElement = function (f, k) { var a = f.computedStyle(k); if (!a || !a.content || a.content === "none" || a.content === "-moz-alt-content" || a.display === "none") return null; for (var d = P(a.content), i = d.substr(0, 3) === "url", b = document.createElement(i ? "img" : "html2canvaspseudoelement"), c = new g(b, f, k), e = a.length - 1; e >= 0; e--) { var h = Q(a.item(e)); b.style[h] = a[h] } b.className = g.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + g.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER; if (i) { b.src = G(d)[0].args[0]; return [c] } else { var j = document.createTextNode(d); b.appendChild(j); return [c, new q(j, c)] } }; a.NodeParser.prototype.getChildren = function (a) { return t([].filter.call(a.node.childNodes, L).map(function (c) { var b = [c.nodeType === Node.TEXT_NODE ? new q(c, a) : new p(c, a)].filter(F); return c.nodeType === Node.ELEMENT_NODE && b.length && c.tagName !== "TEXTAREA" ? b[0].isElementVisible() ? b.concat(this.getChildren(b[0])) : [] : b }, this)) }; a.NodeParser.prototype.newStackingContext = function (a, c) { var b = new o(c, a.getOpacity(), a.node, a.parent); a.cloneTo(b); var d = c ? b.getParentStack(this) : b.parent.stack; d.contexts.push(b); a.stack = b }; a.NodeParser.prototype.createStackingContexts = function () { this.nodes.forEach(function (a) { if (j(a) && (this.isRootElement(a) || R(a) || D(a) || this.isBodyWithTransparentRoot(a) || a.hasTransform())) this.newStackingContext(a, true); else if (j(a) && (i(a) && C(a) || M(a) || r(a))) this.newStackingContext(a, false); else a.assignStack(a.parent.stack) }, this) }; a.NodeParser.prototype.isBodyWithTransparentRoot = function (a) { return a.node.nodeName === "BODY" && a.parent.color("backgroundColor").isTransparent() }; a.NodeParser.prototype.isRootElement = function (a) { return a.parent === null }; a.NodeParser.prototype.sortStackingContexts = function (a) { a.contexts.sort(T(a.contexts.slice(0))); a.contexts.forEach(this.sortStackingContexts, this) }; a.NodeParser.prototype.parseTextBounds = function (a) { return function (b, g, d) { if (a.parent.css("textDecoration").substr(0, 4) !== "none" || b.trim().length !== 0) { if (this.support.rangeBounds && !a.parent.hasTransform()) { var f = d.slice(0, g).join("").length; return this.getRangeBounds(a.node, f, b.length) } else if (a.node && typeof a.node.data === "string") { var c = a.node.splitText(b.length), e = this.getWrapperBounds(a.node, a.parent.hasTransform()); a.node = c; return e } } else if (!this.support.rangeBounds || a.parent.hasTransform()) a.node = a.node.splitText(b.length); return {} } }; a.NodeParser.prototype.getWrapperBounds = function (b, e) { var a = b.ownerDocument.createElement("html2canvaswrapper"), c = b.parentNode, d = b.cloneNode(true); a.appendChild(b.cloneNode(true)); c.replaceChild(a, b); var f = e ? N(a) : U(a); c.replaceChild(d, a); return f }; a.NodeParser.prototype.getRangeBounds = function (b, c, d) { var a = this.range || (this.range = b.ownerDocument.createRange()); a.setStart(b, c); a.setEnd(b, c + d); return a.getBoundingClientRect() }; function z() { } a.NodeParser.prototype.parse = function (a) { var f = a.contexts.filter(J), c = a.children.filter(j), b = c.filter(k(r)), d = b.filter(k(i)).filter(k(B)), e = c.filter(k(i)).filter(r), l = b.filter(k(i)).filter(B), h = a.contexts.concat(b.filter(i)).filter(C), m = a.children.filter(s).filter(X), g = a.contexts.filter(K); f.concat(d).concat(e).concat(l).concat(h).concat(m).concat(g).forEach(function (a) { this.renderQueue.push(a); if (x(a)) { this.parse(a); this.renderQueue.push(new z) } }, this) }; a.NodeParser.pr