UNPKG

node-red-contrib-snap4city-user

Version:

Nodes for Snap4city project, targeted to standard user (no developer)

1,276 lines (1,252 loc) 165 kB
// ┌────────────────────────────────────────────────────────────────────┐ \\ // │ Raphaël 2.1.0 - JavaScript Vector Library │ \\ // ├────────────────────────────────────────────────────────────────────┤ \\ // │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ // │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\ // ├────────────────────────────────────────────────────────────────────┤ \\ // │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\ // └────────────────────────────────────────────────────────────────────┘ \\ (function (a) { var b = "0.3.4", c = "hasOwnProperty", d = /[\.\/]/, e = "*", f = function () {}, g = function (a, b) { return a - b }, h, i, j = { n: {} }, k = function (a, b) { var c = j, d = i, e = Array.prototype.slice.call(arguments, 2), f = k.listeners(a), l = 0, m = !1, n, o = [], p = {}, q = [], r = h, s = []; h = a, i = 0; for (var t = 0, u = f.length; t < u; t++) "zIndex" in f[t] && (o.push(f[t].zIndex), f[t].zIndex < 0 && (p[f[t].zIndex] = f[t])); o.sort(g); while (o[l] < 0) { n = p[o[l++]], q.push(n.apply(b, e)); if (i) { i = d; return q } } for (t = 0; t < u; t++) { n = f[t]; if ("zIndex" in n) if (n.zIndex == o[l]) { q.push(n.apply(b, e)); if (i) break; do { l++, n = p[o[l]], n && q.push(n.apply(b, e)); if (i) break } while (n) } else p[n.zIndex] = n; else { q.push(n.apply(b, e)); if (i) break } } i = d, h = r; return q.length ? q : null }; k.listeners = function (a) { var b = a.split(d), c = j, f, g, h, i, k, l, m, n, o = [c], p = []; for (i = 0, k = b.length; i < k; i++) { n = []; for (l = 0, m = o.length; l < m; l++) { c = o[l].n, g = [c[b[i]], c[e]], h = 2; while (h--) f = g[h], f && (n.push(f), p = p.concat(f.f || [])) } o = n } return p }, k.on = function (a, b) { var c = a.split(d), e = j; for (var g = 0, h = c.length; g < h; g++) e = e.n, !e[c[g]] && (e[c[g]] = { n: {} }), e = e[c[g]]; e.f = e.f || []; for (g = 0, h = e.f.length; g < h; g++) if (e.f[g] == b) return f; e.f.push(b); return function (a) { +a == +a && (b.zIndex = +a) } }, k.stop = function () { i = 1 }, k.nt = function (a) { if (a) return (new RegExp("(?:\\.|\\/|^)" + a + "(?:\\.|\\/|$)")).test(h); return h }, k.off = k.unbind = function (a, b) { var f = a.split(d), g, h, i, k, l, m, n, o = [j]; for (k = 0, l = f.length; k < l; k++) for (m = 0; m < o.length; m += i.length - 2) { i = [m, 1], g = o[m].n; if (f[k] != e) g[f[k]] && i.push(g[f[k]]); else for (h in g) g[c](h) && i.push(g[h]); o.splice.apply(o, i) } for (k = 0, l = o.length; k < l; k++) { g = o[k]; while (g.n) { if (b) { if (g.f) { for (m = 0, n = g.f.length; m < n; m++) if (g.f[m] == b) { g.f.splice(m, 1); break }! g.f.length && delete g.f } for (h in g.n) if (g.n[c](h) && g.n[h].f) { var p = g.n[h].f; for (m = 0, n = p.length; m < n; m++) if (p[m] == b) { p.splice(m, 1); break }! p.length && delete g.n[h].f } } else { delete g.f; for (h in g.n) g.n[c](h) && g.n[h].f && delete g.n[h].f } g = g.n } } }, k.once = function (a, b) { var c = function () { var d = b.apply(this, arguments); k.unbind(a, c); return d }; return k.on(a, c) }, k.version = b, k.toString = function () { return "You are running Eve " + b }, typeof module != "undefined" && module.exports ? module.exports = k : typeof define != "undefined" ? define("eve", [], function () { return k }) : a.eve = k })(this), function () { function cF(a) { for (var b = 0; b < cy.length; b++) cy[b].el.paper == a && cy.splice(b--, 1) } function cE(b, d, e, f, h, i) { e = Q(e); var j, k, l, m = [], o, p, q, t = b.ms, u = {}, v = {}, w = {}; if (f) for (y = 0, z = cy.length; y < z; y++) { var x = cy[y]; if (x.el.id == d.id && x.anim == b) { x.percent != e ? (cy.splice(y, 1), l = 1) : k = x, d.attr(x.totalOrigin); break } } else f = +v; for (var y = 0, z = b.percents.length; y < z; y++) { if (b.percents[y] == e || b.percents[y] > f * b.top) { e = b.percents[y], p = b.percents[y - 1] || 0, t = t / b.top * (e - p), o = b.percents[y + 1], j = b.anim[e]; break } f && d.attr(b.anim[b.percents[y]]) } if (!!j) { if (!k) { for (var A in j) if (j[g](A)) if (U[g](A) || d.paper.customAttributes[g](A)) { u[A] = d.attr(A), u[A] == null && (u[A] = T[A]), v[A] = j[A]; switch (U[A]) { case C: w[A] = (v[A] - u[A]) / t; break; case "colour": u[A] = a.getRGB(u[A]); var B = a.getRGB(v[A]); w[A] = { r: (B.r - u[A].r) / t, g: (B.g - u[A].g) / t, b: (B.b - u[A].b) / t }; break; case "path": var D = bR(u[A], v[A]), E = D[1]; u[A] = D[0], w[A] = []; for (y = 0, z = u[A].length; y < z; y++) { w[A][y] = [0]; for (var F = 1, G = u[A][y].length; F < G; F++) w[A][y][F] = (E[y][F] - u[A][y][F]) / t } break; case "transform": var H = d._, I = ca(H[A], v[A]); if (I) { u[A] = I.from, v[A] = I.to, w[A] = [], w[A].real = !0; for (y = 0, z = u[A].length; y < z; y++) { w[A][y] = [u[A][y][0]]; for (F = 1, G = u[A][y].length; F < G; F++) w[A][y][F] = (v[A][y][F] - u[A][y][F]) / t } } else { var J = d.matrix || new cb, K = { _: { transform: H.transform }, getBBox: function () { return d.getBBox(1) } }; u[A] = [J.a, J.b, J.c, J.d, J.e, J.f], b$(K, v[A]), v[A] = K._.transform, w[A] = [(K.matrix.a - J.a) / t, (K.matrix.b - J.b) / t, (K.matrix.c - J.c) / t, (K.matrix.d - J.d) / t, (K.matrix.e - J.e) / t, (K.matrix.f - J.f) / t] } break; case "csv": var L = r(j[A])[s](c), M = r(u[A])[s](c); if (A == "clip-rect") { u[A] = M, w[A] = [], y = M.length; while (y--) w[A][y] = (L[y] - u[A][y]) / t } v[A] = L; break; default: L = [][n](j[A]), M = [][n](u[A]), w[A] = [], y = d.paper.customAttributes[A].length; while (y--) w[A][y] = ((L[y] || 0) - (M[y] || 0)) / t } } var O = j.easing, P = a.easing_formulas[O]; if (!P) { P = r(O).match(N); if (P && P.length == 5) { var R = P; P = function (a) { return cC(a, +R[1], +R[2], +R[3], +R[4], t) } } else P = bf } q = j.start || b.start || +(new Date), x = { anim: b, percent: e, timestamp: q, start: q + (b.del || 0), status: 0, initstatus: f || 0, stop: !1, ms: t, easing: P, from: u, diff: w, to: v, el: d, callback: j.callback, prev: p, next: o, repeat: i || b.times, origin: d.attr(), totalOrigin: h }, cy.push(x); if (f && !k && !l) { x.stop = !0, x.start = new Date - t * f; if (cy.length == 1) return cA() } l && (x.start = new Date - x.ms * f), cy.length == 1 && cz(cA) } else k.initstatus = f, k.start = new Date - k.ms * f; eve("raphael.anim.start." + d.id, d, b) } } function cD(a, b) { var c = [], d = {}; this.ms = b, this.times = 1; if (a) { for (var e in a) a[g](e) && (d[Q(e)] = a[e], c.push(Q(e))); c.sort(bd) } this.anim = d, this.top = c[c.length - 1], this.percents = c } function cC(a, b, c, d, e, f) { function o(a, b) { var c, d, e, f, j, k; for (e = a, k = 0; k < 8; k++) { f = m(e) - a; if (z(f) < b) return e; j = (3 * i * e + 2 * h) * e + g; if (z(j) < 1e-6) break; e = e - f / j } c = 0, d = 1, e = a; if (e < c) return c; if (e > d) return d; while (c < d) { f = m(e); if (z(f - a) < b) return e; a > f ? c = e : d = e, e = (d - c) / 2 + c } return e } function n(a, b) { var c = o(a, b); return ((l * c + k) * c + j) * c } function m(a) { return ((i * a + h) * a + g) * a } var g = 3 * b, h = 3 * (d - b) - g, i = 1 - g - h, j = 3 * c, k = 3 * (e - c) - j, l = 1 - j - k; return n(a, 1 / (200 * f)) } function cq() { return this.x + q + this.y + q + this.width + " × " + this.height } function cp() { return this.x + q + this.y } function cb(a, b, c, d, e, f) { a != null ? (this.a = +a, this.b = +b, this.c = +c, this.d = +d, this.e = +e, this.f = +f) : (this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0) } function bH(b, c, d) { b = a._path2curve(b), c = a._path2curve(c); var e, f, g, h, i, j, k, l, m, n, o = d ? 0 : []; for (var p = 0, q = b.length; p < q; p++) { var r = b[p]; if (r[0] == "M") e = i = r[1], f = j = r[2]; else { r[0] == "C" ? (m = [e, f].concat(r.slice(1)), e = m[6], f = m[7]) : (m = [e, f, e, f, i, j, i, j], e = i, f = j); for (var s = 0, t = c.length; s < t; s++) { var u = c[s]; if (u[0] == "M") g = k = u[1], h = l = u[2]; else { u[0] == "C" ? (n = [g, h].concat(u.slice(1)), g = n[6], h = n[7]) : (n = [g, h, g, h, k, l, k, l], g = k, h = l); var v = bG(m, n, d); if (d) o += v; else { for (var w = 0, x = v.length; w < x; w++) v[w].segment1 = p, v[w].segment2 = s, v[w].bez1 = m, v[w].bez2 = n; o = o.concat(v) } } } } } return o } function bG(b, c, d) { var e = a.bezierBBox(b), f = a.bezierBBox(c); if (!a.isBBoxIntersect(e, f)) return d ? 0 : []; var g = bB.apply(0, b), h = bB.apply(0, c), i = ~~(g / 5), j = ~~(h / 5), k = [], l = [], m = {}, n = d ? 0 : []; for (var o = 0; o < i + 1; o++) { var p = a.findDotsAtSegment.apply(a, b.concat(o / i)); k.push({ x: p.x, y: p.y, t: o / i }) } for (o = 0; o < j + 1; o++) p = a.findDotsAtSegment.apply(a, c.concat(o / j)), l.push({ x: p.x, y: p.y, t: o / j }); for (o = 0; o < i; o++) for (var q = 0; q < j; q++) { var r = k[o], s = k[o + 1], t = l[q], u = l[q + 1], v = z(s.x - r.x) < .001 ? "y" : "x", w = z(u.x - t.x) < .001 ? "y" : "x", x = bD(r.x, r.y, s.x, s.y, t.x, t.y, u.x, u.y); if (x) { if (m[x.x.toFixed(4)] == x.y.toFixed(4)) continue; m[x.x.toFixed(4)] = x.y.toFixed(4); var y = r.t + z((x[v] - r[v]) / (s[v] - r[v])) * (s.t - r.t), A = t.t + z((x[w] - t[w]) / (u[w] - t[w])) * (u.t - t.t); y >= 0 && y <= 1 && A >= 0 && A <= 1 && (d ? n++ : n.push({ x: x.x, y: x.y, t1: y, t2: A })) } } return n } function bF(a, b) { return bG(a, b, 1) } function bE(a, b) { return bG(a, b) } function bD(a, b, c, d, e, f, g, h) { if (!(x(a, c) < y(e, g) || y(a, c) > x(e, g) || x(b, d) < y(f, h) || y(b, d) > x(f, h))) { var i = (a * d - b * c) * (e - g) - (a - c) * (e * h - f * g), j = (a * d - b * c) * (f - h) - (b - d) * (e * h - f * g), k = (a - c) * (f - h) - (b - d) * (e - g); if (!k) return; var l = i / k, m = j / k, n = +l.toFixed(2), o = +m.toFixed(2); if (n < +y(a, c).toFixed(2) || n > +x(a, c).toFixed(2) || n < +y(e, g).toFixed(2) || n > +x(e, g).toFixed(2) || o < +y(b, d).toFixed(2) || o > +x(b, d).toFixed(2) || o < +y(f, h).toFixed(2) || o > +x(f, h).toFixed(2)) return; return { x: l, y: m } } } function bC(a, b, c, d, e, f, g, h, i) { if (!(i < 0 || bB(a, b, c, d, e, f, g, h) < i)) { var j = 1, k = j / 2, l = j - k, m, n = .01; m = bB(a, b, c, d, e, f, g, h, l); while (z(m - i) > n) k /= 2, l += (m < i ? 1 : -1) * k, m = bB(a, b, c, d, e, f, g, h, l); return l } } function bB(a, b, c, d, e, f, g, h, i) { i == null && (i = 1), i = i > 1 ? 1 : i < 0 ? 0 : i; var j = i / 2, k = 12, l = [-0.1252, .1252, -0.3678, .3678, -0.5873, .5873, -0.7699, .7699, -0.9041, .9041, -0.9816, .9816], m = [.2491, .2491, .2335, .2335, .2032, .2032, .1601, .1601, .1069, .1069, .0472, .0472], n = 0; for (var o = 0; o < k; o++) { var p = j * l[o] + j, q = bA(p, a, c, e, g), r = bA(p, b, d, f, h), s = q * q + r * r; n += m[o] * w.sqrt(s) } return j * n } function bA(a, b, c, d, e) { var f = -3 * b + 9 * c - 9 * d + 3 * e, g = a * f + 6 * b - 12 * c + 6 * d; return a * g - 3 * b + 3 * c } function by(a, b) { var c = []; for (var d = 0, e = a.length; e - 2 * !b > d; d += 2) { var f = [{ x: +a[d - 2], y: +a[d - 1] }, { x: +a[d], y: +a[d + 1] }, { x: +a[d + 2], y: +a[d + 3] }, { x: +a[d + 4], y: +a[d + 5] }]; b ? d ? e - 4 == d ? f[3] = { x: +a[0], y: +a[1] } : e - 2 == d && (f[2] = { x: +a[0], y: +a[1] }, f[3] = { x: +a[2], y: +a[3] }) : f[0] = { x: +a[e - 2], y: +a[e - 1] } : e - 4 == d ? f[3] = f[2] : d || (f[0] = { x: +a[d], y: +a[d + 1] }), c.push(["C", (-f[0].x + 6 * f[1].x + f[2].x) / 6, (-f[0].y + 6 * f[1].y + f[2].y) / 6, (f[1].x + 6 * f[2].x - f[3].x) / 6, (f[1].y + 6 * f[2].y - f[3].y) / 6, f[2].x, f[2].y]) } return c } function bx() { return this.hex } function bv(a, b, c) { function d() { var e = Array.prototype.slice.call(arguments, 0), f = e.join("␀"), h = d.cache = d.cache || {}, i = d.count = d.count || []; if (h[g](f)) { bu(i, f); return c ? c(h[f]) : h[f] } i.length >= 1e3 && delete h[i.shift()], i.push(f), h[f] = a[m](b, e); return c ? c(h[f]) : h[f] } return d } function bu(a, b) { for (var c = 0, d = a.length; c < d; c++) if (a[c] === b) return a.push(a.splice(c, 1)[0]) } function bm(a) { if (Object(a) !== a) return a; var b = new a.constructor; for (var c in a) a[g](c) && (b[c] = bm(a[c])); return b } function a(c) { if (a.is(c, "function")) return b ? c() : eve.on("raphael.DOMload", c); if (a.is(c, E)) return a._engine.create[m](a, c.splice(0, 3 + a.is(c[0], C))).add(c); var d = Array.prototype.slice.call(arguments, 0); if (a.is(d[d.length - 1], "function")) { var e = d.pop(); return b ? e.call(a._engine.create[m](a, d)) : eve.on("raphael.DOMload", function () { e.call(a._engine.create[m](a, d)) }) } return a._engine.create[m](a, arguments) } a.version = "2.1.0", a.eve = eve; var b, c = /[, ]+/, d = { circle: 1, rect: 1, path: 1, ellipse: 1, text: 1, image: 1 }, e = /\{(\d+)\}/g, f = "prototype", g = "hasOwnProperty", h = { doc: document, win: window }, i = { was: Object.prototype[g].call(h.win, "Raphael"), is: h.win.Raphael }, j = function () { this.ca = this.customAttributes = {} }, k, l = "appendChild", m = "apply", n = "concat", o = "createTouch" in h.doc, p = "", q = " ", r = String, s = "split", t = "click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel" [s](q), u = { mousedown: "touchstart", mousemove: "touchmove", mouseup: "touchend" }, v = r.prototype.toLowerCase, w = Math, x = w.max, y = w.min, z = w.abs, A = w.pow, B = w.PI, C = "number", D = "string", E = "array", F = "toString", G = "fill", H = Object.prototype.toString, I = {}, J = "push", K = a._ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i, L = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i, M = { NaN: 1, Infinity: 1, "-Infinity": 1 }, N = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/, O = w.round, P = "setAttribute", Q = parseFloat, R = parseInt, S = r.prototype.toUpperCase, T = a._availableAttrs = { "arrow-end": "none", "arrow-start": "none", blur: 0, "clip-rect": "0 0 1e9 1e9", cursor: "default", cx: 0, cy: 0, fill: "#fff", "fill-opacity": 1, font: '10px "Arial"', "font-family": '"Arial"', "font-size": "10", "font-style": "normal", "font-weight": 400, gradient: 0, height: 0, href: "http://raphaeljs.com/", "letter-spacing": 0, opacity: 1, path: "M0,0", r: 0, rx: 0, ry: 0, src: "", stroke: "#000", "stroke-dasharray": "", "stroke-linecap": "butt", "stroke-linejoin": "butt", "stroke-miterlimit": 0, "stroke-opacity": 1, "stroke-width": 1, target: "_blank", "text-anchor": "middle", title: "Raphael", transform: "", width: 0, x: 0, y: 0 }, U = a._availableAnimAttrs = { blur: C, "clip-rect": "csv", cx: C, cy: C, fill: "colour", "fill-opacity": C, "font-size": C, height: C, opacity: C, path: "path", r: C, rx: C, ry: C, stroke: "colour", "stroke-opacity": C, "stroke-width": C, transform: "transform", width: C, x: C, y: C }, V = /[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g, W = /[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/, X = { hs: 1, rg: 1 }, Y = /,?([achlmqrstvxz]),?/gi, Z = /([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig, $ = /([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig, _ = /(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig, ba = a._radial_gradient = /^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/, bb = {}, bc = function (a, b) { return a.key - b.key }, bd = function (a, b) { return Q(a) - Q(b) }, be = function () {}, bf = function (a) { return a }, bg = a._rectPath = function (a, b, c, d, e) { if (e) return [ ["M", a + e, b], ["l", c - e * 2, 0], ["a", e, e, 0, 0, 1, e, e], ["l", 0, d - e * 2], ["a", e, e, 0, 0, 1, -e, e], ["l", e * 2 - c, 0], ["a", e, e, 0, 0, 1, -e, -e], ["l", 0, e * 2 - d], ["a", e, e, 0, 0, 1, e, -e], ["z"] ]; return [ ["M", a, b], ["l", c, 0], ["l", 0, d], ["l", -c, 0], ["z"] ] }, bh = function (a, b, c, d) { d == null && (d = c); return [ ["M", a, b], ["m", 0, -d], ["a", c, d, 0, 1, 1, 0, 2 * d], ["a", c, d, 0, 1, 1, 0, -2 * d], ["z"] ] }, bi = a._getPath = { path: function (a) { return a.attr("path") }, circle: function (a) { var b = a.attrs; return bh(b.cx, b.cy, b.r) }, ellipse: function (a) { var b = a.attrs; return bh(b.cx, b.cy, b.rx, b.ry) }, rect: function (a) { var b = a.attrs; return bg(b.x, b.y, b.width, b.height, b.r) }, image: function (a) { var b = a.attrs; return bg(b.x, b.y, b.width, b.height) }, text: function (a) { var b = a._getBBox(); return bg(b.x, b.y, b.width, b.height) } }, bj = a.mapPath = function (a, b) { if (!b) return a; var c, d, e, f, g, h, i; a = bR(a); for (e = 0, g = a.length; e < g; e++) { i = a[e]; for (f = 1, h = i.length; f < h; f += 2) c = b.x(i[f], i[f + 1]), d = b.y(i[f], i[f + 1]), i[f] = c, i[f + 1] = d } return a }; a._g = h, a.type = h.win.SVGAngle || h.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") ? "SVG" : "VML"; if (a.type == "VML") { var bk = h.doc.createElement("div"), bl; bk.innerHTML = '<v:shape adj="1"/>', bl = bk.firstChild, bl.style.behavior = "url(#default#VML)"; if (!bl || typeof bl.adj != "object") return a.type = p; bk = null } a.svg = !(a.vml = a.type == "VML"), a._Paper = j, a.fn = k = j.prototype = a.prototype, a._id = 0, a._oid = 0, a.is = function (a, b) { b = v.call(b); if (b == "finite") return !M[g](+a); if (b == "array") return a instanceof Array; return b == "null" && a === null || b == typeof a && a !== null || b == "object" && a === Object(a) || b == "array" && Array.isArray && Array.isArray(a) || H.call(a).slice(8, -1).toLowerCase() == b }, a.angle = function (b, c, d, e, f, g) { if (f == null) { var h = b - d, i = c - e; if (!h && !i) return 0; return (180 + w.atan2(-i, -h) * 180 / B + 360) % 360 } return a.angle(b, c, f, g) - a.angle(d, e, f, g) }, a.rad = function (a) { return a % 360 * B / 180 }, a.deg = function (a) { return a * 180 / B % 360 }, a.snapTo = function (b, c, d) { d = a.is(d, "finite") ? d : 10; if (a.is(b, E)) { var e = b.length; while (e--) if (z(b[e] - c) <= d) return b[e] } else { b = +b; var f = c % b; if (f < d) return c - f; if (f > b - d) return c - f + b } return c }; var bn = a.createUUID = function (a, b) { return function () { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a, b).toUpperCase() } }(/[xy]/g, function (a) { var b = w.random() * 16 | 0, c = a == "x" ? b : b & 3 | 8; return c.toString(16) }); a.setWindow = function (b) { eve("raphael.setWindow", a, h.win, b), h.win = b, h.doc = h.win.document, a._engine.initWin && a._engine.initWin(h.win) }; var bo = function (b) { if (a.vml) { var c = /^\s+|\s+$/g, d; try { var e = new ActiveXObject("htmlfile"); e.write("<body>"), e.close(), d = e.body } catch (f) { d = createPopup().document.body } var g = d.createTextRange(); bo = bv(function (a) { try { d.style.color = r(a).replace(c, p); var b = g.queryCommandValue("ForeColor"); b = (b & 255) << 16 | b & 65280 | (b & 16711680) >>> 16; return "#" + ("000000" + b.toString(16)).slice(-6) } catch (e) { return "none" } }) } else { var i = h.doc.createElement("i"); i.title = "Raphaël Colour Picker", i.style.display = "none", h.doc.body.appendChild(i), bo = bv(function (a) { i.style.color = a; return h.doc.defaultView.getComputedStyle(i, p).getPropertyValue("color") }) } return bo(b) }, bp = function () { return "hsb(" + [this.h, this.s, this.b] + ")" }, bq = function () { return "hsl(" + [this.h, this.s, this.l] + ")" }, br = function () { return this.hex }, bs = function (b, c, d) { c == null && a.is(b, "object") && "r" in b && "g" in b && "b" in b && (d = b.b, c = b.g, b = b.r); if (c == null && a.is(b, D)) { var e = a.getRGB(b); b = e.r, c = e.g, d = e.b } if (b > 1 || c > 1 || d > 1) b /= 255, c /= 255, d /= 255; return [b, c, d] }, bt = function (b, c, d, e) { b *= 255, c *= 255, d *= 255; var f = { r: b, g: c, b: d, hex: a.rgb(b, c, d), toString: br }; a.is(e, "finite") && (f.opacity = e); return f }; a.color = function (b) { var c; a.is(b, "object") && "h" in b && "s" in b && "b" in b ? (c = a.hsb2rgb(b), b.r = c.r, b.g = c.g, b.b = c.b, b.hex = c.hex) : a.is(b, "object") && "h" in b && "s" in b && "l" in b ? (c = a.hsl2rgb(b), b.r = c.r, b.g = c.g, b.b = c.b, b.hex = c.hex) : (a.is(b, "string") && (b = a.getRGB(b)), a.is(b, "object") && "r" in b && "g" in b && "b" in b ? (c = a.rgb2hsl(b), b.h = c.h, b.s = c.s, b.l = c.l, c = a.rgb2hsb(b), b.v = c.b) : (b = { hex: "none" }, b.r = b.g = b.b = b.h = b.s = b.v = b.l = -1)), b.toString = br; return b }, a.hsb2rgb = function (a, b, c, d) { this.is(a, "object") && "h" in a && "s" in a && "b" in a && (c = a.b, b = a.s, a = a.h, d = a.o), a *= 360; var e, f, g, h, i; a = a % 360 / 60, i = c * b, h = i * (1 - z(a % 2 - 1)), e = f = g = c - i, a = ~~a, e += [i, h, 0, 0, h, i][a], f += [h, i, i, h, 0, 0][a], g += [0, 0, h, i, i, h][a]; return bt(e, f, g, d) }, a.hsl2rgb = function (a, b, c, d) { this.is(a, "object") && "h" in a && "s" in a && "l" in a && (c = a.l, b = a.s, a = a.h); if (a > 1 || b > 1 || c > 1) a /= 360, b /= 100, c /= 100; a *= 360; var e, f, g, h, i; a = a % 360 / 60, i = 2 * b * (c < .5 ? c : 1 - c), h = i * (1 - z(a % 2 - 1)), e = f = g = c - i / 2, a = ~~a, e += [i, h, 0, 0, h, i][a], f += [h, i, i, h, 0, 0][a], g += [0, 0, h, i, i, h][a]; return bt(e, f, g, d) }, a.rgb2hsb = function (a, b, c) { c = bs(a, b, c), a = c[0], b = c[1], c = c[2]; var d, e, f, g; f = x(a, b, c), g = f - y(a, b, c), d = g == 0 ? null : f == a ? (b - c) / g : f == b ? (c - a) / g + 2 : (a - b) / g + 4, d = (d + 360) % 6 * 60 / 360, e = g == 0 ? 0 : g / f; return { h: d, s: e, b: f, toString: bp } }, a.rgb2hsl = function (a, b, c) { c = bs(a, b, c), a = c[0], b = c[1], c = c[2]; var d, e, f, g, h, i; g = x(a, b, c), h = y(a, b, c), i = g - h, d = i == 0 ? null : g == a ? (b - c) / i : g == b ? (c - a) / i + 2 : (a - b) / i + 4, d = (d + 360) % 6 * 60 / 360, f = (g + h) / 2, e = i == 0 ? 0 : f < .5 ? i / (2 * f) : i / (2 - 2 * f); return { h: d, s: e, l: f, toString: bq } }, a._path2string = function () { return this.join(",").replace(Y, "$1") }; var bw = a._preload = function (a, b) { var c = h.doc.createElement("img"); c.style.cssText = "position:absolute;left:-9999em;top:-9999em", c.onload = function () { b.call(this), this.onload = null, h.doc.body.removeChild(this) }, c.onerror = function () { h.doc.body.removeChild(this) }, h.doc.body.appendChild(c), c.src = a }; a.getRGB = bv(function (b) { if (!b || !!((b = r(b)).indexOf("-") + 1)) return { r: -1, g: -1, b: -1, hex: "none", error: 1, toString: bx }; if (b == "none") return { r: -1, g: -1, b: -1, hex: "none", toString: bx }; !X[g](b.toLowerCase().substring(0, 2)) && b.charAt() != "#" && (b = bo(b)); var c, d, e, f, h, i, j, k = b.match(L); if (k) { k[2] && (f = R(k[2].substring(5), 16), e = R(k[2].substring(3, 5), 16), d = R(k[2].substring(1, 3), 16)), k[3] && (f = R((i = k[3].charAt(3)) + i, 16), e = R((i = k[3].charAt(2)) + i, 16), d = R((i = k[3].charAt(1)) + i, 16)), k[4] && (j = k[4][s](W), d = Q(j[0]), j[0].slice(-1) == "%" && (d *= 2.55), e = Q(j[1]), j[1].slice(-1) == "%" && (e *= 2.55), f = Q(j[2]), j[2].slice(-1) == "%" && (f *= 2.55), k[1].toLowerCase().slice(0, 4) == "rgba" && (h = Q(j[3])), j[3] && j[3].slice(-1) == "%" && (h /= 100)); if (k[5]) { j = k[5][s](W), d = Q(j[0]), j[0].slice(-1) == "%" && (d *= 2.55), e = Q(j[1]), j[1].slice(-1) == "%" && (e *= 2.55), f = Q(j[2]), j[2].slice(-1) == "%" && (f *= 2.55), (j[0].slice(-3) == "deg" || j[0].slice(-1) == "°") && (d /= 360), k[1].toLowerCase().slice(0, 4) == "hsba" && (h = Q(j[3])), j[3] && j[3].slice(-1) == "%" && (h /= 100); return a.hsb2rgb(d, e, f, h) } if (k[6]) { j = k[6][s](W), d = Q(j[0]), j[0].slice(-1) == "%" && (d *= 2.55), e = Q(j[1]), j[1].slice(-1) == "%" && (e *= 2.55), f = Q(j[2]), j[2].slice(-1) == "%" && (f *= 2.55), (j[0].slice(-3) == "deg" || j[0].slice(-1) == "°") && (d /= 360), k[1].toLowerCase().slice(0, 4) == "hsla" && (h = Q(j[3])), j[3] && j[3].slice(-1) == "%" && (h /= 100); return a.hsl2rgb(d, e, f, h) } k = { r: d, g: e, b: f, toString: bx }, k.hex = "#" + (16777216 | f | e << 8 | d << 16).toString(16).slice(1), a.is(h, "finite") && (k.opacity = h); return k } return { r: -1, g: -1, b: -1, hex: "none", error: 1, toString: bx } }, a), a.hsb = bv(function (b, c, d) { return a.hsb2rgb(b, c, d).hex }), a.hsl = bv(function (b, c, d) { return a.hsl2rgb(b, c, d).hex }), a.rgb = bv(function (a, b, c) { return "#" + (16777216 | c | b << 8 | a << 16).toString(16).slice(1) }), a.getColor = function (a) { var b = this.getColor.start = this.getColor.start || { h: 0, s: 1, b: a || .75 }, c = this.hsb2rgb(b.h, b.s, b.b); b.h += .075, b.h > 1 && (b.h = 0, b.s -= .2, b.s <= 0 && (this.getColor.start = { h: 0, s: 1, b: b.b })); return c.hex }, a.getColor.reset = function () { delete this.start }, a.parsePathString = function (b) { if (!b) return null; var c = bz(b); if (c.arr) return bJ(c.arr); var d = { a: 7, c: 6, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, z: 0 }, e = []; a.is(b, E) && a.is(b[0], E) && (e = bJ(b)), e.length || r(b).replace(Z, function (a, b, c) { var f = [], g = b.toLowerCase(); c.replace(_, function (a, b) { b && f.push(+b) }), g == "m" && f.length > 2 && (e.push([b][n](f.splice(0, 2))), g = "l", b = b == "m" ? "l" : "L"); if (g == "r") e.push([b][n](f)); else while (f.length >= d[g]) { e.push([b][n](f.splice(0, d[g]))); if (!d[g]) break } }), e.toString = a._path2string, c.arr = bJ(e); return e }, a.parseTransformString = bv(function (b) { if (!b) return null; var c = { r: 3, s: 4, t: 2, m: 6 }, d = []; a.is(b, E) && a.is(b[0], E) && (d = bJ(b)), d.length || r(b).replace($, function (a, b, c) { var e = [], f = v.call(b); c.replace(_, function (a, b) { b && e.push(+b) }), d.push([b][n](e)) }), d.toString = a._path2string; return d }); var bz = function (a) { var b = bz.ps = bz.ps || {}; b[a] ? b[a].sleep = 100 : b[a] = { sleep: 100 }, setTimeout(function () { for (var c in b) b[g](c) && c != a && (b[c].sleep--, !b[c].sleep && delete b[c]) }); return b[a] }; a.findDotsAtSegment = function (a, b, c, d, e, f, g, h, i) { var j = 1 - i, k = A(j, 3), l = A(j, 2), m = i * i, n = m * i, o = k * a + l * 3 * i * c + j * 3 * i * i * e + n * g, p = k * b + l * 3 * i * d + j * 3 * i * i * f + n * h, q = a + 2 * i * (c - a) + m * (e - 2 * c + a), r = b + 2 * i * (d - b) + m * (f - 2 * d + b), s = c + 2 * i * (e - c) + m * (g - 2 * e + c), t = d + 2 * i * (f - d) + m * (h - 2 * f + d), u = j * a + i * c, v = j * b + i * d, x = j * e + i * g, y = j * f + i * h, z = 90 - w.atan2(q - s, r - t) * 180 / B; (q > s || r < t) && (z += 180); return { x: o, y: p, m: { x: q, y: r }, n: { x: s, y: t }, start: { x: u, y: v }, end: { x: x, y: y }, alpha: z } }, a.bezierBBox = function (b, c, d, e, f, g, h, i) { a.is(b, "array") || (b = [b, c, d, e, f, g, h, i]); var j = bQ.apply(null, b); return { x: j.min.x, y: j.min.y, x2: j.max.x, y2: j.max.y, width: j.max.x - j.min.x, height: j.max.y - j.min.y } }, a.isPointInsideBBox = function (a, b, c) { return b >= a.x && b <= a.x2 && c >= a.y && c <= a.y2 }, a.isBBoxIntersect = function (b, c) { var d = a.isPointInsideBBox; return d(c, b.x, b.y) || d(c, b.x2, b.y) || d(c, b.x, b.y2) || d(c, b.x2, b.y2) || d(b, c.x, c.y) || d(b, c.x2, c.y) || d(b, c.x, c.y2) || d(b, c.x2, c.y2) || (b.x < c.x2 && b.x > c.x || c.x < b.x2 && c.x > b.x) && (b.y < c.y2 && b.y > c.y || c.y < b.y2 && c.y > b.y) }, a.pathIntersection = function (a, b) { return bH(a, b) }, a.pathIntersectionNumber = function (a, b) { return bH(a, b, 1) }, a.isPointInsidePath = function (b, c, d) { var e = a.pathBBox(b); return a.isPointInsideBBox(e, c, d) && bH(b, [ ["M", c, d], ["H", e.x2 + 10] ], 1) % 2 == 1 }, a._removedFactory = function (a) { return function () { eve("raphael.log", null, "Raphaël: you are calling to method “" + a + "” of removed object", a) } }; var bI = a.pathBBox = function (a) { var b = bz(a); if (b.bbox) return b.bbox; if (!a) return { x: 0, y: 0, width: 0, height: 0, x2: 0, y2: 0 }; a = bR(a); var c = 0, d = 0, e = [], f = [], g; for (var h = 0, i = a.length; h < i; h++) { g = a[h]; if (g[0] == "M") c = g[1], d = g[2], e.push(c), f.push(d); else { var j = bQ(c, d, g[1], g[2], g[3], g[4], g[5], g[6]); e = e[n](j.min.x, j.max.x), f = f[n](j.min.y, j.max.y), c = g[5], d = g[6] } } var k = y[m](0, e), l = y[m](0, f), o = x[m](0, e), p = x[m](0, f), q = { x: k, y: l, x2: o, y2: p, width: o - k, height: p - l }; b.bbox = bm(q); return q }, bJ = function (b) { var c = bm(b); c.toString = a._path2string; return c }, bK = a._pathToRelative = function (b) { var c = bz(b); if (c.rel) return bJ(c.rel); if (!a.is(b, E) || !a.is(b && b[0], E)) b = a.parsePathString(b); var d = [], e = 0, f = 0, g = 0, h = 0, i = 0; b[0][0] == "M" && (e = b[0][1], f = b[0][2], g = e, h = f, i++, d.push(["M", e, f])); for (var j = i, k = b.length; j < k; j++) { var l = d[j] = [], m = b[j]; if (m[0] != v.call(m[0])) { l[0] = v.call(m[0]); switch (l[0]) { case "a": l[1] = m[1], l[2] = m[2], l[3] = m[3], l[4] = m[4], l[5] = m[5], l[6] = +(m[6] - e).toFixed(3), l[7] = +(m[7] - f).toFixed(3); break; case "v": l[1] = +(m[1] - f).toFixed(3); break; case "m": g = m[1], h = m[2]; default: for (var n = 1, o = m.length; n < o; n++) l[n] = +(m[n] - (n % 2 ? e : f)).toFixed(3) } } else { l = d[j] = [], m[0] == "m" && (g = m[1] + e, h = m[2] + f); for (var p = 0, q = m.length; p < q; p++) d[j][p] = m[p] } var r = d[j].length; switch (d[j][0]) { case "z": e = g, f = h; break; case "h": e += +d[j][r - 1]; break; case "v": f += +d[j][r - 1]; break; default: e += +d[j][r - 2], f += +d[j][r - 1] } } d.toString = a._path2string, c.rel = bJ(d); return d }, bL = a._pathToAbsolute = function (b) { var c = bz(b); if (c.abs) return bJ(c.abs); if (!a.is(b, E) || !a.is(b && b[0], E)) b = a.parsePathString(b); if (!b || !b.length) return [ ["M", 0, 0] ]; var d = [], e = 0, f = 0, g = 0, h = 0, i = 0; b[0][0] == "M" && (e = +b[0][1], f = +b[0][2], g = e, h = f, i++, d[0] = ["M", e, f]); var j = b.length == 3 && b[0][0] == "M" && b[1][0].toUpperCase() == "R" && b[2][0].toUpperCase() == "Z"; for (var k, l, m = i, o = b.length; m < o; m++) { d.push(k = []), l = b[m]; if (l[0] != S.call(l[0])) { k[0] = S.call(l[0]); switch (k[0]) { case "A": k[1] = l[1], k[2] = l[2], k[3] = l[3], k[4] = l[4], k[5] = l[5], k[6] = +(l[6] + e), k[7] = +(l[7] + f); break; case "V": k[1] = +l[1] + f; break; case "H": k[1] = +l[1] + e; break; case "R": var p = [e, f][n](l.slice(1)); for (var q = 2, r = p.length; q < r; q++) p[q] = +p[q] + e, p[++q] = +p[q] + f; d.pop(), d = d[n](by(p, j)); break; case "M": g = +l[1] + e, h = +l[2] + f; default: for (q = 1, r = l.length; q < r; q++) k[q] = +l[q] + (q % 2 ? e : f) } } else if (l[0] == "R") p = [e, f][n](l.slice(1)), d.pop(), d = d[n](by(p, j)), k = ["R"][n](l.slice(-2)); else for (var s = 0, t = l.length; s < t; s++) k[s] = l[s]; switch (k[0]) { case "Z": e = g, f = h; break; case "H": e = k[1]; break; case "V": f = k[1]; break; case "M": g = k[k.length - 2], h = k[k.length - 1]; default: