Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

html2canvas.js 71KB

12345678
  1. /*!
  2. html2canvas <http://html2canvas.hertzen.com>
  3. Copyright (c) 2016 Niklas von Hertzen
  4. */
  5. /*! Copyright Mathias Bynens <https://mathiasbynens.be/> */
  6. 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.prototype.paint = function (a) { try { if (a instanceof z) this.renderer.ctx.restore(); else if (s(a)) { h(a.parent) && a.parent.appendToDOM(); this.paintText(a); h(a.parent) && a.parent.cleanDOM() } else this.paintNode(a) } catch (c) { b(c); if (this.options.strict) throw c } }; a.NodeParser.prototype.paintNode = function (a) { if (x(a)) { this.renderer.setOpacity(a.opacity); this.renderer.ctx.save(); a.hasTransform() && this.renderer.setTransform(a.parseTransform()) } if (a.node.nodeName === "INPUT" && a.node.type === "checkbox") this.paintCheckbox(a); else if (a.node.nodeName === "INPUT" && a.node.type === "radio") this.paintRadio(a); else this.paintElement(a) }; a.NodeParser.prototype.paintElement = function (a) { var c = a.parseBounds(); this.renderer.clip(a.backgroundClip, function () { this.renderer.renderBackground(a, c, a.borders.borders.map(V)) }, this); this.renderer.clip(a.clip, function () { this.renderer.renderBorders(a.borders.borders) }, this); this.renderer.clip(a.backgroundClip, function () { switch (a.node.nodeName) { case "svg": case "IFRAME": var d = this.images.get(a.node); if (d) this.renderer.renderImage(a, c, a.borders, d); else b("Error loading <" + a.node.nodeName + ">", a.node); break; case "IMG": var e = this.images.get(a.node.src); if (e) this.renderer.renderImage(a, c, a.borders, e); else b("Error loading <img>", a.node.src); break; case "CANVAS": this.renderer.renderImage(a, c, a.borders, { image: a.node }); break; case "SELECT": case "INPUT": case "TEXTAREA": if (a.node.nodeName === "INPUT" && a.node.type === "image") { var d = this.images.get(a.node); if (d) this.renderer.renderImage(a, c, a.borders, d); else b("Error loading <" + a.node.nodeName + ">", a.node) } else this.paintFormValue(a) } }, this) }; a.NodeParser.prototype.paintCheckbox = function (f) { var c = f.parseBounds(), b = Math.min(c.width, c.height), a = { width: b - 1, height: b - 1, top: c.top, left: c.left }, d = [3, 3], h = [d, d, d, d], g = [1, 1, 1, 1].map(function (a) { return { color: new e("#A5A5A5"), width: a } }), i = w(a, h, g); this.renderer.clip(f.backgroundClip, function () { this.renderer.rectangle(a.left + 1, a.top + 1, a.width - 2, a.height - 2, new e("#DEDEDE")); this.renderer.renderBorders(y(g, a, i, h)); if (f.node.checked) { this.renderer.font(new e("#424242"), "normal", "normal", "bold", b - 3 + "px", "arial"); this.renderer.text("\u2714", a.left + b / 6, a.top + b - 1) } }, this) }; a.NodeParser.prototype.paintRadio = function (c) { var a = c.parseBounds(), b = Math.min(a.width, a.height) - 2; this.renderer.clip(c.backgroundClip, function () { this.renderer.circleStroke(a.left + 1, a.top + 1, b, new e("#DEDEDE"), 1, new e("#A5A5A5")); c.node.checked && this.renderer.circle(Math.ceil(a.left + b / 4) + 1, Math.ceil(a.top + b / 4) + 1, Math.floor(b / 2), new e("#424242")) }, this) }; a.NodeParser.prototype.paintFormValue = function (c) { var f = c.getValue(); if (f.length > 0) { var d = c.node.ownerDocument, a = d.createElement("html2canvaswrapper"), g = ["lineHeight", "textAlign", "fontFamily", "fontWeight", "fontSize", "color", "paddingLeft", "paddingTop", "paddingRight", "paddingBottom", "width", "height", "borderLeftStyle", "borderTopStyle", "borderLeftWidth", "borderTopWidth", "boxSizing", "whiteSpace", "wordWrap"]; g.forEach(function (d) { try { a.style[d] = c.css(d) } catch (e) { b("html2canvas: Parse: Exception caught in renderFormValue: " + e.message) } }); var e = c.parseBounds(); a.style.position = "fixed"; a.style.left = e.left + "px"; a.style.top = e.top + "px"; a.textContent = f; d.body.appendChild(a); this.paintText(new q(a.firstChild, c)); d.body.removeChild(a) } }; a.NodeParser.prototype.paintText = function (a) { a.applyTextTransform(); var c = m.ucs2.decode(a.node.data), d = (!this.options.letterRendering || H(a)) && !S(a.node.data) ? W(c) : c.map(function (a) { return m.ucs2.encode([a]) }), g = a.parent.fontWeight(), f = a.parent.css("fontSize"), e = a.parent.css("fontFamily"), b = a.parent.parseTextShadows(); this.renderer.font(a.parent.color("color"), a.parent.css("fontStyle"), a.parent.css("fontVariant"), g, f, e); if (b.length) this.renderer.fontShadow(b[0].color, b[0].offsetX, b[0].offsetY, b[0].blur); else this.renderer.clearShadow(); this.renderer.clip(a.parent.clip, function () { d.map(this.parseTextBounds(a), this).forEach(function (b, c) { if (b) { this.renderer.text(d[c], b.left, b.bottom); this.renderTextDecoration(a.parent, b, this.fontMetrics.getMetrics(e, f)) } }, this) }, this) }; a.NodeParser.prototype.renderTextDecoration = function (b, a, c) { switch (b.css("textDecoration").split(" ")[0]) { case "underline": this.renderer.rectangle(a.left, Math.round(a.top + c.baseline + c.lineWidth), a.width, 1, b.color("color")); break; case "overline": this.renderer.rectangle(a.left, Math.round(a.top), a.width, 1, b.color("color")); break; case "line-through": this.renderer.rectangle(a.left, Math.ceil(a.top + c.middle + c.lineWidth), a.width, 1, b.color("color")) } }; var v = { inset: [["darken", .6], ["darken", .1], ["darken", .1], ["darken", .6]] }; a.NodeParser.prototype.parseBorders = function (a) { var b = a.parseBounds(), d = E(a), c = ["Top", "Right", "Bottom", "Left"].map(function (f, g) { var d = a.css("border" + f + "Style"), b = a.color("border" + f + "Color"); if (d === "inset" && b.isBlack()) b = new e([255, 255, 255, b.a]); var c = v[d] ? v[d][g] : null; return { width: a.cssInt("border" + f + "Width"), color: c ? b[c[0]](c[1]) : b, args: null } }), f = w(b, d, c); return { clip: this.parseBackgroundClip(a, f, c, d, b), borders: y(c, b, f, d) } }; function y(b, d, a, c) { return b.map(function (i, j) { if (i.width > 0) { var f = d.left, e = d.top, h = d.width, g = d.height - b[2].width; switch (j) { case 0: g = b[0].width; i.args = l({ c1: [f, e], c2: [f + h, e], c3: [f + h - b[1].width, e + g], c4: [f + b[3].width, e + g] }, c[0], c[1], a.topLeftOuter, a.topLeftInner, a.topRightOuter, a.topRightInner); break; case 1: f = d.left + d.width - b[1].width; h = b[1].width; i.args = l({ c1: [f + h, e], c2: [f + h, e + g + b[2].width], c3: [f, e + g], c4: [f, e + b[0].width] }, c[1], c[2], a.topRightOuter, a.topRightInner, a.bottomRightOuter, a.bottomRightInner); break; case 2: e = e + d.height - b[2].width; g = b[2].width; i.args = l({ c1: [f + h, e + g], c2: [f, e + g], c3: [f + b[3].width, e], c4: [f + h - b[3].width, e] }, c[2], c[3], a.bottomRightOuter, a.bottomRightInner, a.bottomLeftOuter, a.bottomLeftInner); break; case 3: h = b[3].width; i.args = l({ c1: [f, e + g + b[2].width], c2: [f, e], c3: [f + h, e + b[0].width], c4: [f + h, e + g] }, c[3], c[0], a.bottomLeftOuter, a.bottomLeftInner, a.topLeftOuter, a.topLeftInner) } } return i }) } a.NodeParser.prototype.parseBackgroundClip = function (h, b, f, c, a) { var g = h.css("backgroundClip"), e = []; switch (g) { case "content-box": case "padding-box": d(e, c[0], c[1], b.topLeftInner, b.topRightInner, a.left + f[3].width, a.top + f[0].width); d(e, c[1], c[2], b.topRightInner, b.bottomRightInner, a.left + a.width - f[1].width, a.top + f[0].width); d(e, c[2], c[3], b.bottomRightInner, b.bottomLeftInner, a.left + a.width - f[1].width, a.top + a.height - f[2].width); d(e, c[3], c[0], b.bottomLeftInner, b.topLeftInner, a.left + f[3].width, a.top + a.height - f[2].width); break; default: d(e, c[0], c[1], b.topLeftOuter, b.topRightOuter, a.left, a.top); d(e, c[1], c[2], b.topRightOuter, b.bottomRightOuter, a.left + a.width, a.top); d(e, c[2], c[3], b.bottomRightOuter, b.bottomLeftOuter, a.left + a.width, a.top + a.height); d(e, c[3], c[0], b.bottomLeftOuter, b.topLeftOuter, a.left, a.top + a.height) } return e }; function c(a, b, i, j) { var h = 4 * ((Math.sqrt(2) - 1) / 3), e = i * h, g = j * h, c = a + i, d = b + j; return { topLeft: f({ x: a, y: d }, { x: a, y: d - g }, { x: c - e, y: b }, { x: c, y: b }), topRight: f({ x: a, y: b }, { x: a + e, y: b }, { x: c, y: d - g }, { x: c, y: d }), bottomRight: f({ x: c, y: b }, { x: c, y: b + g }, { x: a + e, y: d }, { x: a, y: d }), bottomLeft: f({ x: c, y: d }, { x: c - e, y: d }, { x: a, y: b + g }, { x: a, y: b }) } } function w(h, a, b) { var f = h.left, g = h.top, d = h.width, e = h.height, r = a[0][0] < d / 2 ? a[0][0] : d / 2, s = a[0][1] < e / 2 ? a[0][1] : e / 2, m = a[1][0] < d / 2 ? a[1][0] : d / 2, t = a[1][1] < e / 2 ? a[1][1] : e / 2, k = a[2][0] < d / 2 ? a[2][0] : d / 2, l = a[2][1] < e / 2 ? a[2][1] : e / 2, q = a[3][0] < d / 2 ? a[3][0] : d / 2, j = a[3][1] < e / 2 ? a[3][1] : e / 2, i = d - m, o = e - l, n = d - k, p = e - j; return { topLeftOuter: c(f, g, r, s).topLeft.subdivide(.5), topLeftInner: c(f + b[3].width, g + b[0].width, Math.max(0, r - b[3].width), Math.max(0, s - b[0].width)).topLeft.subdivide(.5), topRightOuter: c(f + i, g, m, t).topRight.subdivide(.5), topRightInner: c(f + Math.min(i, d + b[3].width), g + b[0].width, i > d + b[3].width ? 0 : m - b[3].width, t - b[0].width).topRight.subdivide(.5), bottomRightOuter: c(f + n, g + o, k, l).bottomRight.subdivide(.5), bottomRightInner: c(f + Math.min(n, d - b[3].width), g + Math.min(o, e + b[0].width), Math.max(0, k - b[1].width), l - b[2].width).bottomRight.subdivide(.5), bottomLeftOuter: c(f, g + p, q, j).bottomLeft.subdivide(.5), bottomLeftInner: c(f + b[3].width, g + p, Math.max(0, q - b[3].width), j - b[2].width).bottomLeft.subdivide(.5) } } function f(d, a, b, e) { var c = function (a, b, c) { return { x: a.x + (b.x - a.x) * c, y: a.y + (b.y - a.y) * c } }; return { start: d, startControl: a, endControl: b, end: e, subdivide: function (g) { var k = c(d, a, g), l = c(a, b, g), m = c(b, e, g), h = c(k, l, g), i = c(l, m, g), j = c(h, i, g); return [f(d, k, h, j), f(j, i, m, e)] }, curveTo: function (c) { c.push(["bezierCurve", a.x, a.y, b.x, b.y, e.x, e.y]) }, curveToReversed: function (c) { c.push(["bezierCurve", b.x, b.y, a.x, a.y, d.x, d.y]) } } } function l(b, c, h, f, d, g, e) { var a = []; if (c[0] > 0 || c[1] > 0) { a.push(["line", f[1].start.x, f[1].start.y]); f[1].curveTo(a) } else a.push(["line", b.c1[0], b.c1[1]]); if (h[0] > 0 || h[1] > 0) { a.push(["line", g[0].start.x, g[0].start.y]); g[0].curveTo(a); a.push(["line", e[0].end.x, e[0].end.y]); e[0].curveToReversed(a) } else { a.push(["line", b.c2[0], b.c2[1]]); a.push(["line", b.c3[0], b.c3[1]]) } if (c[0] > 0 || c[1] > 0) { a.push(["line", d[1].end.x, d[1].end.y]); d[1].curveToReversed(a) } else a.push(["line", b.c4[0], b.c4[1]]); return a } function d(a, d, e, b, c, f, g) { if (d[0] > 0 || d[1] > 0) { a.push(["line", b[0].start.x, b[0].start.y]); b[0].curveTo(a); b[1].curveTo(a) } else a.push(["line", f, g]); (e[0] > 0 || e[1] > 0) && a.push(["line", c[0].start.x, c[0].start.y]) } function J(a) { return a.cssInt("zIndex") < 0 } function K(a) { return a.cssInt("zIndex") > 0 } function C(a) { return a.cssInt("zIndex") === 0 } function B(a) { return ["inline", "inline-block", "inline-table"].indexOf(a.css("display")) !== -1 } function x(a) { return a instanceof o } function X(a) { return a.node.data.trim().length > 0 } function H(a) { return /^(normal|none|0px)$/.test(a.parent.css("letterSpacing")) } function E(a) { return ["TopLeft", "TopRight", "BottomRight", "BottomLeft"].map(function (d) { var c = a.css("border" + d + "Radius"), b = c.split(" "); if (b.length <= 1) b[1] = b[0]; return b.map(Y) }) } function L(a) { return a.nodeType === Node.TEXT_NODE || a.nodeType === Node.ELEMENT_NODE } function D(a) { var b = a.css("position"), c = ["absolute", "relative", "fixed"].indexOf(b) !== -1 ? a.css("zIndex") : "auto"; return c !== "auto" } function i(a) { return a.css("position") !== "static" } function r(a) { return a.css("float") !== "none" } function M(a) { return ["inline-block", "inline-table"].indexOf(a.css("display")) !== -1 } function k(a) { var b = this; return function () { return !a.apply(b, arguments) } } function j(a) { return a.node.nodeType === Node.ELEMENT_NODE } function h(a) { return a.isPseudoElement === true } function s(a) { return a.node.nodeType === Node.TEXT_NODE } function T(a) { return function (b, c) { return b.cssInt("zIndex") + a.indexOf(b) / a.length - (c.cssInt("zIndex") + a.indexOf(c) / a.length) } } function R(a) { return a.getOpacity() < 1 } function Y(a) { return parseInt(a, 10) } function V(a) { return a.width } function F(a) { return a.node.nodeType !== Node.ELEMENT_NODE || ["SCRIPT", "HEAD", "TITLE", "OBJECT", "BR", "OPTION"].indexOf(a.node.nodeName) === -1 } function t(a) { return [].concat.apply([], a) } function P(a) { var b = a.substr(0, 1); return b === a.substr(a.length - 1) && b.match(/'|"/) ? a.substr(1, a.length - 2) : a } function W(c) { var e = [], b = 0, d = false, a; while (c.length) { if (I(c[b]) === d) { a = c.splice(0, b); a.length && e.push(m.ucs2.encode(a)); d = !d; b = 0 } else b++; if (b >= c.length) { a = c.splice(0, b); a.length && e.push(m.ucs2.encode(a)) } } return e } function I(a) { return [32, 13, 10, 9, 45].indexOf(a) !== -1 } function S(a) { return /[^\u0000-\u00ff]/.test(a) } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var d = a.Utils, c = d.getBounds, b = a.loadUrlDocument; a.FrameContainer = function (b, e, d) { this.image = null; this.src = b; var g = this, f = c(b); this.promise = (!e ? this.proxyLoad(d.proxy, f, d) : new a.Promise(function (a) { if (b.contentWindow.document.URL === "about:blank" || b.contentWindow.document.documentElement == null) b.contentWindow.onload = b.onload = function () { a(b) }; else a(b) })).then(function (b) { var c = a.html2canvasExport; return c(b.contentWindow.document.documentElement, { type: "view", width: b.width, height: b.height, proxy: d.proxy, javascriptEnabled: d.javascriptEnabled, removeContainer: d.removeContainer, allowTaint: d.allowTaint, imageTimeout: d.imageTimeout / 2 }) }).then(function (a) { return g.image = a }) }; a.FrameContainer.prototype.proxyLoad = function (e, c, d) { var a = this.src; return b(a.src, e, a.ownerDocument, c.width, c.height, d) } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var b = a.Log, d = a.ImageContainer, c = a.DummyImageContainer, h = a.ProxyImageContainer, j = a.FrameContainer, e = a.SVGContainer, i = a.SVGNodeContainer, f = a.LinearGradientContainer, g = a.WebkitGradientContainer, k = a.Utils.bind; a.ImageLoader = function (a, b) { this.link = null; this.options = a; this.support = b; this.origin = this.getOrigin(window.location.href) }; a.ImageLoader.prototype.findImages = function (b) { var a = []; b.reduce(function (b, a) { switch (a.node.nodeName) { case "IMG": return b.concat([{ args: [a.node.src], method: "url" }]); case "svg": case "IFRAME": return b.concat([{ args: [a.node], method: a.node.nodeName }]) } if (a.node.nodeName === "INPUT" && a.node.type === "image") return b.concat([{ args: [a.node.src], method: "url" }]); return b }, []).forEach(this.addImage(a, this.loadImage), this); return a }; a.ImageLoader.prototype.findBackgroundImage = function (a, b) { b.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(a, this.loadImage), this); return a }; a.ImageLoader.prototype.addImage = function (a, c) { return function (d) { d.args.forEach(function (e) { if (!this.imageExists(a, e)) { a.splice(0, 0, c.call(this, d)); b("Added image #" + a.length, typeof e === "string" ? e.substring(0, 100) : e) } }, this) } }; a.ImageLoader.prototype.hasImageBackground = function (a) { return a.method !== "none" }; a.ImageLoader.prototype.loadImage = function (a) { if (a.method === "url") { var b = a.args[0]; if (this.isSVG(b) && !this.support.svg && !this.options.allowTaint) return new e(b); else if (b.match(/data:image\/.*;base64,/i)) return new d(b.replace(/url\(['"]{0,}|['"]{0,}\)$/ig, ""), false); else if (this.isSameOrigin(b) || this.options.allowTaint === true || this.isSVG(b)) return new d(b, false); else if (this.support.cors && !this.options.allowTaint && this.options.useCORS) return new d(b, true); else if (this.options.proxy) return new h(b, this.options.proxy); else return new c(b) } else if (a.method === "linear-gradient") return new f(a); else if (a.method === "gradient") return new g(a); else if (a.method === "svg") return new i(a.args[0], this.support.svg); else if (a.method === "IFRAME") return new j(a.args[0], this.isSameOrigin(a.args[0].src), this.options); else return new c(a) }; a.ImageLoader.prototype.isSVG = function (a) { return a.substring(a.length - 3).toLowerCase() === "svg" || e.prototype.isInline(a) }; a.ImageLoader.prototype.imageExists = function (a, b) { return a.some(function (a) { return a.src === b }) }; a.ImageLoader.prototype.isSameOrigin = function (a) { return this.getOrigin(a) === this.origin }; a.ImageLoader.prototype.getOrigin = function (b) { var a = this.link || (this.link = document.createElement("a")); a.href = b; a.href = a.href; return a.protocol + a.hostname + a.port }; a.ImageLoader.prototype.getPromise = function (a) { return this.timeout(a, this.options.imageTimeout)["catch"](function () { var b = new c(a.src); return b.promise.then(function (b) { a.image = b }) }) }; a.ImageLoader.prototype.get = function (b) { var a = null; return this.images.some(function (c) { return (a = c).src === b }) ? a : null }; a.ImageLoader.prototype.fetch = function (c) { this.images = c.reduce(k(this.findBackgroundImage, this), this.findImages(c)); this.images.forEach(function (a, c) { a.promise.then(function () { b("Succesfully loaded image #" + (c + 1), a) }, function (d) { b("Failed loading image #" + (c + 1), a, d) }) }); this.ready = a.Promise.all(this.images.map(this.getPromise, this)); b("Finished searching images"); return this }; a.ImageLoader.prototype.timeout = function (c, f) { var d, e = a.Promise.race([c.promise, new a.Promise(function (e, a) { d = setTimeout(function () { b("Timed out loading image", c); a(c) }, f) })]).then(function (a) { clearTimeout(d); return a }); e["catch"](function () { clearTimeout(d) }); return e } })(Html2canvas || (Html2canvas = {})); var Html2canvas; (function (a) { var t = a.Support, d = a.CanvasRenderer, q = a.ImageLoader, r = a.NodeParser, o = a.NodeContainer, b = a.Log, f = a.Utils, i = a.CreateWindowClone, k = a.loadUrlDocument, s = f.getBounds, c = "data-html2canvas-node", h = 0; a.html2canvas = function (g, f) { var j = h++; f = f || {}; if (f.logging) { b.options.logging = true; b.options.start = Date.now() } f.async = typeof f.async === "undefined" ? true : f.async; f.allowTaint = typeof f.allowTaint === "undefined" ? false : f.allowTaint; f.removeContainer = typeof f.removeContainer === "undefined" ? true : f.removeContainer; f.javascriptEnabled = typeof f.javascriptEnabled === "undefined" ? false : f.javascriptEnabled; f.imageTimeout = typeof f.imageTimeout === "undefined" ? 1e4 : f.imageTimeout; f.renderer = typeof f.renderer === "function" ? f.renderer : d; f.strict = !!f.strict; if (typeof g === "string") { if (typeof f.proxy !== "string") return a.Promise.reject("Proxy must be used when rendering url"); var n = f.width != null ? f.width : window.innerWidth, l = f.height != null ? f.height : window.innerHeight; return k(p(g), f.proxy, document, n, l, f).then(function (a) { return e(a.contentWindow.document.documentElement, a, f, n, l) }) } var i = (g === undefined ? [document.documentElement] : g.length ? g : [g])[0]; i.setAttribute(c + j, j); return m(i.ownerDocument, f, i.ownerDocument.defaultView.innerWidth, i.ownerDocument.defaultView.innerHeight, j).then(function (a) { if (typeof f.onrendered === "function") { b("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"); f.onrendered(a) } return a }) }; window.html2canvas = a.html2canvas; a.html2canvas.CanvasRenderer = d; a.html2canvas.NodeContainer = o; a.html2canvas.log = b; a.html2canvas.utils = f; a.html2canvasExport = typeof document === "undefined" || typeof Object.create !== "function" || typeof document.createElement("canvas").getContext !== "function" ? function () { return a.Promise.reject("No canvas support") } : a.html2canvas; function m(d, f, j, h, g) { return i(d, d, j, h, f, d.defaultView.pageXOffset, d.defaultView.pageYOffset).then(function (l) { b("Document cloned"); var i = c + g, m = "[" + i + "='" + g + "']"; d.querySelector(m).removeAttribute(i); var k = l.contentWindow, o = k.document.querySelector(m), n = typeof f.onclone === "function" ? a.Promise.resolve(f.onclone(k.document)) : a.Promise.resolve(true); return n.then(function () { return e(o, l, f, j, h) }) }) } function e(f, i, a, o, m) { var d = i.contentWindow, k = new t(d.document), h = new q(a, k), e = s(f), v = a.type === "view" ? o : n(d.document), p = a.type === "view" ? m : l(d.document), c = new a.renderer(v, p, h, a, document), u = new r(f, c, k, h, a); return u.ready.then(function () { b("Finished rendering"); var h; if (a.type === "view") h = g(c.canvas, { width: c.canvas.width, height: c.canvas.height, top: 0, left: 0, x: 0, y: 0 }); else if (f === d.document.body || f === d.document.documentElement || a.canvas != null) h = c.canvas; else h = g(c.canvas, { width: a.width != null ? a.width : e.width, height: a.height != null ? a.height : e.height, top: e.top, left: e.left, x: 0, y: 0 }); j(i, a); return h }) } function j(a, c) { if (c.removeContainer) { a.parentNode.removeChild(a); b("Cleaned up container") } } function g(c, a) { var d = document.createElement("canvas"), g = Math.min(c.width - 1, Math.max(0, a.left)), i = Math.min(c.width, Math.max(1, a.left + a.width)), h = Math.min(c.height - 1, Math.max(0, a.top)), j = Math.min(c.height, Math.max(1, a.top + a.height)); d.width = a.width; d.height = a.height; var f = i - g, e = j - h; b("Cropping canvas at:", "left:", a.left, "top:", a.top, "width:", f, "height:", e); b("Resulting crop with width", a.width, "and height", a.height, "with x", g, "and y", h); d.getContext("2d").drawImage(c, g, h, f, e, a.x, a.y, f, e); return d } function n(a) { return Math.max(Math.max(a.body.scrollWidth, a.documentElement.scrollWidth), Math.max(a.body.offsetWidth, a.documentElement.offsetWidth), Math.max(a.body.clientWidth, a.documentElement.clientWidth)) } function l(a) { return Math.max(Math.max(a.body.scrollHeight, a.documentElement.scrollHeight), Math.max(a.body.offsetHeight, a.documentElement.offsetHeight), Math.max(a.body.clientHeight, a.documentElement.clientHeight)) } function p(b) { var a = document.createElement("a"); a.href = b; a.href = a.href; return a } })(Html2canvas || (Html2canvas = {}))