Ext.define("Ext.draw.ContainerBase", {
extend: "Ext.panel.Panel",
requires: ["Ext.window.Window"],
previewTitleText: "Chart Preview",
previewAltText: "Chart preview",
layout: "container",
addElementListener: function() {
var b = this,
a = arguments;
if (b.rendered) {
b.el.on.apply(b.el, a)
} else {
b.on("render", function() {
b.el.on.apply(b.el, a)
})
}
},
removeElementListener: function() {
var b = this,
a = arguments;
if (b.rendered) {
b.el.un.apply(b.el, a)
}
},
afterRender: function() {
this.callParent(arguments);
this.initAnimator()
},
getItems: function() {
var b = this,
a = b.items;
if (!a || !a.isMixedCollection) {
b.initItems()
}
return b.items
},
onRender: function() {
this.callParent(arguments);
this.element = this.el;
this.innerElement = this.body
},
setItems: function(a) {
this.items = a;
return a
},
setSurfaceSize: function(b, a) {
this.resizeHandler({
width: b,
height: a
});
this.renderFrame()
},
onResize: function(c, a, b, e) {
var d = this;
d.callParent([c, a, b, e]);
d.setBodySize({
width: c,
height: a
})
},
preview: function() {
var a = this.getImage();
new Ext.window.Window({
title: this.previewTitleText,
closeable: true,
renderTo: Ext.getBody(),
autoShow: true,
maximizeable: true,
maximized: true,
border: true,
layout: {
type: "hbox",
pack: "center",
align: "middle"
},
items: {
xtype: "container",
items: {
xtype: "image",
mode: "img",
cls: Ext.baseCSSPrefix + "chart-image",
alt: this.previewAltText,
src: a.data,
listeners: {
afterrender: function() {
var e = this,
b = e.imgEl.dom,
d = a.type === "svg" ? 1 : (window.devicePixelRatio || 1),
c;
if (!b.naturalWidth || !b.naturalHeight) {
b.onload = function() {
var g = b.naturalWidth,
f = b.naturalHeight;
e.setWidth(Math.floor(g / d));
e.setHeight(Math.floor(f / d))
}
} else {
c = e.getSize();
e.setWidth(Math.floor(c.width / d));
e.setHeight(Math.floor(c.height / d))
}
}
}
}
}
})
},
privates: {
getTargetEl: function() {
return this.innerElement
},
reattachToBody: function() {
var a = this;
if (a.pendingDetachSize) {
a.onBodyResize()
}
a.pendingDetachSize = false;
a.callParent()
}
}
});
Ext.define("Ext.draw.SurfaceBase", {
extend: "Ext.Widget",
getOwnerBody: function() {
return this.ownerCt.body
},
destroy: function() {
var a = this;
if (a.hasListeners.destroy) {
a.fireEvent("destroy", a)
}
a.callParent()
}
});
Ext.define("Ext.draw.Color", {
statics: {
colorToHexRe: /(.*?)rgb\((\d+),\s*(\d+),\s*(\d+)\)/,
rgbToHexRe: /\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/,
rgbaToHexRe: /\s*rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\.\d]+)\)/,
hexRe: /\s*#([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/,
NONE: "none",
RGBA_NONE: "rgba(0, 0, 0, 0)"
},
isColor: true,
lightnessFactor: 0.2,
constructor: function(d, b, a, c) {
this.setRGB(d, b, a, c)
},
setRGB: function(e, c, a, d) {
var b = this;
b.r = Math.min(255, Math.max(0, e));
b.g = Math.min(255, Math.max(0, c));
b.b = Math.min(255, Math.max(0, a));
if (d === undefined) {
b.a = 1
} else {
b.a = Math.min(1, Math.max(0, d))
}
},
getGrayscale: function() {
return this.r * 0.3 + this.g * 0.59 + this.b * 0.11
},
getHSL: function() {
var i = this,
a = i.r / 255,
f = i.g / 255,
j = i.b / 255,
k = Math.max(a, f, j),
d = Math.min(a, f, j),
m = k - d,
e, n = 0,
c = 0.5 * (k + d);
if (d !== k) {
n = (c <= 0.5) ? m / (k + d) : m / (2 - k - d);
if (a === k) {
e = 60 * (f - j) / m
} else {
if (f === k) {
e = 120 + 60 * (j - a) / m
} else {
e = 240 + 60 * (a - f) / m
}
}
if (e < 0) {
e += 360
}
if (e >= 360) {
e -= 360
}
}
return [e, n, c]
},
getHSV: function() {
var i = this,
a = i.r / 255,
f = i.g / 255,
j = i.b / 255,
k = Math.max(a, f, j),
d = Math.min(a, f, j),
c = k - d,
e, m = 0,
l = k;
if (d != k) {
m = l ? c / l : 0;
if (a === k) {
e = 60 * (f - j) / c
} else {
if (f === k) {
e = 60 * (j - a) / c + 120
} else {
e = 60 * (a - f) / c + 240
}
}
if (e < 0) {
e += 360
}
if (e >= 360) {
e -= 360
}
}
return [e, m, l]
},
setHSL: function(g, f, e) {
var i = this,
d = Math.abs,
j, b, a;
g = (g % 360 + 360) % 360;
f = f > 1 ? 1 : f < 0 ? 0 : f;
e = e > 1 ? 1 : e < 0 ? 0 : e;
if (f === 0 || g === null) {
e *= 255;
i.setRGB(e, e, e)
} else {
g /= 60;
j = f * (1 - d(2 * e - 1));
b = j * (1 - d(g % 2 - 1));
a = e - j / 2;
a *= 255;
j *= 255;
b *= 255;
switch (Math.floor(g)) {
case 0:
i.setRGB(j + a, b + a, a);
break;
case 1:
i.setRGB(b + a, j + a, a);
break;
case 2:
i.setRGB(a, j + a, b + a);
break;
case 3:
i.setRGB(a, b + a, j + a);
break;
case 4:
i.setRGB(b + a, a, j + a);
break;
case 5:
i.setRGB(j + a, a, b + a);
break
}
}
return i
},
setHSV: function(f, e, d) {
var g = this,
i, b, a;
f = (f % 360 + 360) % 360;
e = e > 1 ? 1 : e < 0 ? 0 : e;
d = d > 1 ? 1 : d < 0 ? 0 : d;
if (e === 0 || f === null) {
d *= 255;
g.setRGB(d, d, d)
} else {
f /= 60;
i = d * e;
b = i * (1 - Math.abs(f % 2 - 1));
a = d - i;
a *= 255;
i *= 255;
b *= 255;
switch (Math.floor(f)) {
case 0:
g.setRGB(i + a, b + a, a);
break;
case 1:
g.setRGB(b + a, i + a, a);
break;
case 2:
g.setRGB(a, i + a, b + a);
break;
case 3:
g.setRGB(a, b + a, i + a);
break;
case 4:
g.setRGB(b + a, a, i + a);
break;
case 5:
g.setRGB(i + a, a, b + a);
break
}
}
return g
},
createLighter: function(b) {
if (!b && b !== 0) {
b = this.lightnessFactor
}
var a = this.getHSL();
a[2] = Ext.Number.constrain(a[2] + b, 0, 1);
return Ext.draw.Color.fromHSL(a[0], a[1], a[2])
},
createDarker: function(a) {
if (!a && a !== 0) {
a = this.lightnessFactor
}
return this.createLighter(-a)
},
toString: function() {
var f = this,
c = Math.round;
if (f.a === 1) {
var e = c(f.r).toString(16),
d = c(f.g).toString(16),
a = c(f.b).toString(16);
e = (e.length === 1) ? "0" + e : e;
d = (d.length === 1) ? "0" + d : d;
a = (a.length === 1) ? "0" + a : a;
return ["#", e, d, a].join("")
} else {
return "rgba(" + [c(f.r), c(f.g), c(f.b), f.a === 0 ? 0 : f.a.toFixed(15)].join(", ") + ")"
}
},
toHex: function(b) {
if (Ext.isArray(b)) {
b = b[0]
}
if (!Ext.isString(b)) {
return ""
}
if (b.substr(0, 1) === "#") {
return b
}
var e = Ext.draw.Color.colorToHexRe.exec(b);
if (Ext.isArray(e)) {
var f = parseInt(e[2], 10),
d = parseInt(e[3], 10),
a = parseInt(e[4], 10),
c = a | (d << 8) | (f << 16);
return e[1] + "#" + ("000000" + c.toString(16)).slice(-6)
} else {
return ""
}
},
setFromString: function(j) {
var e, h, f, c, d = 1,
i = parseInt;
if (j === Ext.draw.Color.NONE) {
this.r = this.g = this.b = this.a = 0;
return this
}
if ((j.length === 4 || j.length === 7) && j.substr(0, 1) === "#") {
e = j.match(Ext.draw.Color.hexRe);
if (e) {
h = i(e[1], 16) >> 0;
f = i(e[2], 16) >> 0;
c = i(e[3], 16) >> 0;
if (j.length === 4) {
h += (h * 16);
f += (f * 16);
c += (c * 16)
}
}
} else {
if ((e = j.match(Ext.draw.Color.rgbToHexRe))) {
h = +e[1];
f = +e[2];
c = +e[3]
} else {
if ((e = j.match(Ext.draw.Color.rgbaToHexRe))) {
h = +e[1];
f = +e[2];
c = +e[3];
d = +e[4]
} else {
if (Ext.draw.Color.ColorList.hasOwnProperty(j.toLowerCase())) {
return this.setFromString(Ext.draw.Color.ColorList[j.toLowerCase()])
}
}
}
}
if (typeof h === "undefined") {
return this
}
this.r = h;
this.g = f;
this.b = c;
this.a = d;
return this
}
}, function() {
var a = new this();
this.addStatics({
fly: function(f, e, c, d) {
switch (arguments.length) {
case 1:
a.setFromString(f);
break;
case 3:
case 4:
a.setRGB(f, e, c, d);
break;
default:
return null
}
return a
},
ColorList: {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
gold: "#ffd700",
goldenrod: "#daa520",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavender: "#e6e6fa",
lavenderblush: "#fff0f5",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgrey: "#d3d3d3",
lightgreen: "#90ee90",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370d8",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#d87093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
},
fromHSL: function(d, c, b) {
return (new this(0, 0, 0, 0)).setHSL(d, c, b)
},
fromHSV: function(d, c, b) {
return (new this(0, 0, 0, 0)).setHSL(d, c, b)
},
fromString: function(b) {
return (new this(0, 0, 0, 0)).setFromString(b)
},
create: function(b) {
if (b instanceof this) {
return b
} else {
if (Ext.isArray(b)) {
return new Ext.draw.Color(b[0], b[1], b[2], b[3])
} else {
if (Ext.isString(b)) {
return Ext.draw.Color.fromString(b)
} else {
if (arguments.length > 2) {
return new Ext.draw.Color(arguments[0], arguments[1], arguments[2], arguments[3])
} else {
return new Ext.draw.Color(0, 0, 0, 0)
}
}
}
}
}
})
});
Ext.define("Ext.draw.sprite.AnimationParser", function() {
function a(d, c, b) {
return d + (c - d) * b
}
return {
singleton: true,
attributeRe: /^url\(#([a-zA-Z\-]+)\)$/,
requires: ["Ext.draw.Color"],
color: {
parseInitial: function(c, b) {
if (Ext.isString(c)) {
c = Ext.draw.Color.create(c)
}
if (Ext.isString(b)) {
b = Ext.draw.Color.create(b)
}
if ((c instanceof Ext.draw.Color) && (b instanceof Ext.draw.Color)) {
return [
[c.r, c.g, c.b, c.a],
[b.r, b.g, b.b, b.a]
]
} else {
return [c || b, b || c]
}
},
compute: function(d, c, b) {
if (!Ext.isArray(d) || !Ext.isArray(c)) {
return c || d
} else {
return [a(d[0], c[0], b), a(d[1], c[1], b), a(d[2], c[2], b), a(d[3], c[3], b)]
}
},
serve: function(c) {
var b = Ext.draw.Color.fly(c[0], c[1], c[2], c[3]);
return b.toString()
}
},
number: {
parse: function(b) {
return b === null ? null : +b
},
compute: function(d, c, b) {
if (!Ext.isNumber(d) || !Ext.isNumber(c)) {
return c || d
} else {
return a(d, c, b)
}
}
},
angle: {
parseInitial: function(c, b) {
if (b - c > Math.PI) {
b -= Math.PI * 2
} else {
if (b - c < -Math.PI) {
b += Math.PI * 2
}
}
return [c, b]
},
compute: function(d, c, b) {
if (!Ext.isNumber(d) || !Ext.isNumber(c)) {
return c || d
} else {
return a(d, c, b)
}
}
},
path: {
parseInitial: function(m, n) {
var c = m.toStripes(),
o = n.toStripes(),
e, d, k = c.length,
p = o.length,
h, f, b, g = o[p - 1],
l = [g[g.length - 2], g[g.length - 1]];
for (e = k; e < p; e++) {
c.push(c[k - 1].slice(0))
}
for (e = p; e < k; e++) {
o.push(l.slice(0))
}
b = c.length;
o.path = n;
o.temp = new Ext.draw.Path();
for (e = 0; e < b; e++) {
h = c[e];
f = o[e];
k = h.length;
p = f.length;
o.temp.commands.push("M");
for (d = p; d < k; d += 6) {
f.push(l[0], l[1], l[0], l[1], l[0], l[1])
}
g = o[o.length - 1];
l = [g[g.length - 2], g[g.length - 1]];
for (d = k; d < p; d += 6) {
h.push(l[0], l[1], l[0], l[1], l[0], l[1])
}
for (e = 0; e < f.length; e++) {
f[e] -= h[e]
}
for (e = 2; e < f.length; e += 6) {
o.temp.commands.push("C")
}
}
return [c, o]
},
compute: function(c, l, m) {
if (m >= 1) {
return l.path
}
var e = 0,
f = c.length,
d = 0,
b, k, h, n = l.temp.params,
g = 0;
for (; e < f; e++) {
k = c[e];
h = l[e];
b = k.length;
for (d = 0; d < b; d++) {
n[g++] = h[d] * m + k[d]
}
}
return l.temp
}
},
data: {
compute: function(h, j, k, g) {
var m = h.length - 1,
b = j.length - 1,
e = Math.max(m, b),
d, l, c;
if (!g || g === h) {
g = []
}
g.length = e + 1;
for (c = 0; c <= e; c++) {
d = h[Math.min(c, m)];
l = j[Math.min(c, b)];
if (Ext.isNumber(d)) {
if (!Ext.isNumber(l)) {
l = 0
}
g[c] = (l - d) * k + d
} else {
g[c] = l
}
}
return g
}
},
text: {
compute: function(d, c, b) {
return d.substr(0, Math.round(d.length * (1 - b))) + c.substr(Math.round(c.length * (1 - b)))
}
},
limited: "number",
limited01: "number"
}
});
(function() {
if (!Ext.global.Float32Array) {
var a = function(d) {
if (typeof d === "number") {
this.length = d
} else {
if ("length" in d) {
this.length = d.length;
for (var c = 0, b = d.length; c < b; c++) {
this[c] = +d[c]
}
}
}
};
a.prototype = [];
Ext.global.Float32Array = a
}
})();
Ext.define("Ext.draw.Draw", {
singleton: true,
radian: Math.PI / 180,
pi2: Math.PI * 2,
reflectFn: function(b) {
return b
},
rad: function(a) {
return (a % 360) * this.radian
},
degrees: function(a) {
return (a / this.radian) % 360
},
isBBoxIntersect: function(b, a, c) {
c = c || 0;
return (Math.max(b.x, a.x) - c > Math.min(b.x + b.width, a.x + a.width)) || (Math.max(b.y, a.y) - c > Math.min(b.y + b.height, a.y + a.height))
},
isPointInBBox: function(a, c, b) {
return !!b && a >= b.x && a <= (b.x + b.width) && c >= b.y && c <= (b.y + b.height)
},
spline: function(m) {
var e, c, k = m.length,
b, h, l, f, a = 0,
g = new Float32Array(m.length),
n = new Float32Array(m.length * 3 - 2);
g[0] = 0;
g[k - 1] = 0;
for (e = 1; e < k - 1; e++) {
g[e] = (m[e + 1] + m[e - 1] - 2 * m[e]) - g[e - 1];
a = 1 / (4 - a);
g[e] *= a
}
for (e = k - 2; e > 0; e--) {
a = 3.732050807568877 + 48.248711305964385 / (-13.928203230275537 + Math.pow(0.07179676972449123, e));
g[e] -= g[e + 1] * a
}
f = m[0];
b = f - g[0];
for (e = 0, c = 0; e < k - 1; c += 3) {
l = f;
h = b;
e++;
f = m[e];
b = f - g[e];
n[c] = l;
n[c + 1] = (b + 2 * h) / 3;
n[c + 2] = (b * 2 + h) / 3
}
n[c] = f;
return n
},
getAnchors: function(e, d, i, h, t, s, o) {
o = o || 4;
var n = Math.PI,
p = n / 2,
k = Math.abs,
a = Math.sin,
b = Math.cos,
f = Math.atan,
r, q, g, j, m, l, v, u, c;
r = (i - e) / o;
q = (t - i) / o;
if ((h >= d && h >= s) || (h <= d && h <= s)) {
g = j = p
} else {
g = f((i - e) / k(h - d));
if (d < h) {
g = n - g
}
j = f((t - i) / k(h - s));
if (s < h) {
j = n - j
}
}
c = p - ((g + j) % (n * 2)) / 2;
if (c > p) {
c -= n
}
g += c;
j += c;
m = i - r * a(g);
l = h + r * b(g);
v = i + q * a(j);
u = h + q * b(j);
if ((h > d && l < d) || (h < d && l > d)) {
m += k(d - l) * (m - i) / (l - h);
l = d
}
if ((h > s && u < s) || (h < s && u > s)) {
v -= k(s - u) * (v - i) / (u - h);
u = s
}
return {
x1: m,
y1: l,
x2: v,
y2: u
}
},
smooth: function(l, j, o) {
var k = l.length,
h, g, c, b, q, p, n, m, f = [],
e = [],
d, a;
for (d = 0; d < k - 1; d++) {
h = l[d];
g = j[d];
if (d === 0) {
n = h;
m = g;
f.push(n);
e.push(m);
if (k === 1) {
break
}
}
c = l[d + 1];
b = j[d + 1];
q = l[d + 2];
p = j[d + 2];
if (!Ext.isNumber(q + p)) {
f.push(n, c, c);
e.push(m, b, b);
break
}
a = this.getAnchors(h, g, c, b, q, p, o);
f.push(n, a.x1, c);
e.push(m, a.y1, b);
n = a.x2;
m = a.y2
}
return {
smoothX: f,
smoothY: e
}
},
beginUpdateIOS: Ext.os.is.iOS ? function() {
this.iosUpdateEl = Ext.getBody().createChild({
style: "position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; background: rgba(0,0,0,0.001); z-index: 100000"
})
} : Ext.emptyFn,
endUpdateIOS: function() {
this.iosUpdateEl = Ext.destroy(this.iosUpdateEl)
}
});
Ext.define("Ext.draw.gradient.Gradient", {
requires: ["Ext.draw.Color"],
isGradient: true,
config: {
stops: []
},
applyStops: function(f) {
var e = [],
d = f.length,
c, b, a;
for (c = 0; c < d; c++) {
b = f[c];
a = b.color;
if (!(a && a.isColor)) {
a = Ext.draw.Color.fly(a || Ext.draw.Color.NONE)
}
e.push({
offset: Math.min(1, Math.max(0, "offset" in b ? b.offset : b.position || 0)),
color: a.toString()
})
}
e.sort(function(h, g) {
return h.offset - g.offset
});
return e
},
onClassExtended: function(a, b) {
if (!b.alias && b.type) {
b.alias = "gradient." + b.type
}
},
constructor: function(a) {
this.initConfig(a)
},
generateGradient: Ext.emptyFn
});
Ext.define("Ext.draw.gradient.GradientDefinition", {
singleton: true,
urlStringRe: /^url\(#([\w\-]+)\)$/,
gradients: {},
add: function(a) {
var b = this.gradients,
c, e, d;
for (c = 0, e = a.length; c < e; c++) {
d = a[c];
if (Ext.isString(d.id)) {
b[d.id] = d
}
}
},
get: function(d) {
var a = this.gradients,
b = d.match(this.urlStringRe),
c;
if (b && b[1] && (c = a[b[1]])) {
return c || d
}
return d
}
});
Ext.define("Ext.draw.sprite.AttributeParser", {
singleton: true,
attributeRe: /^url\(#([a-zA-Z\-]+)\)$/,
requires: ["Ext.draw.Color", "Ext.draw.gradient.GradientDefinition"],
"default": Ext.identityFn,
string: function(a) {
return String(a)
},
number: function(a) {
if (Ext.isNumber(+a)) {
return a
}
},
angle: function(a) {
if (Ext.isNumber(a)) {
a %= Math.PI * 2;
if (a < -Math.PI) {
a += Math.PI * 2
} else {
if (a >= Math.PI) {
a -= Math.PI * 2
}
}
return a
}
},
data: function(a) {
if (Ext.isArray(a)) {
return a.slice()
} else {
if (a instanceof Float32Array) {
return new Float32Array(a)
}
}
},
bool: function(a) {
return !!a
},
color: function(a) {
if (a instanceof Ext.draw.Color) {
return a.toString()
} else {
if (a instanceof Ext.draw.gradient.Gradient) {
return a
} else {
if (!a) {
return Ext.draw.Color.NONE
} else {
if (Ext.isString(a)) {
if (a.substr(0, 3) === "url") {
a = Ext.draw.gradient.GradientDefinition.get(a);
if (Ext.isString(a)) {
return a
}
} else {
return Ext.draw.Color.fly(a).toString()
}
}
}
}
}
if (a.type === "linear") {
return Ext.create("Ext.draw.gradient.Linear", a)
} else {
if (a.type === "radial") {
return Ext.create("Ext.draw.gradient.Radial", a)
} else {
if (a.type === "pattern") {
return Ext.create("Ext.draw.gradient.Pattern", a)
} else {
return Ext.draw.Color.NONE
}
}
}
},
limited: function(a, b) {
return function(c) {
c = +c;
return Ext.isNumber(c) ? Math.min(Math.max(c, a), b) : undefined
}
},
limited01: function(a) {
a = +a;
return Ext.isNumber(a) ? Math.min(Math.max(a, 0), 1) : undefined
},
enums: function() {
var d = {},
a = Array.prototype.slice.call(arguments, 0),
b, c;
for (b = 0, c = a.length; b < c; b++) {
d[a[b]] = true
}
return function(e) {
return e in d ? e : undefined
}
}
});
Ext.define("Ext.draw.sprite.AttributeDefinition", {
requires: ["Ext.draw.sprite.AttributeParser", "Ext.draw.sprite.AnimationParser"],
config: {
defaults: {
$value: {},
lazy: true
},
aliases: {},
animationProcessors: {},
processors: {
$value: {},
lazy: true
},
dirtyTriggers: {},
triggers: {},
updaters: {}
},
inheritableStatics: {
processorFactoryRe: /^(\w+)\(([\w\-,]*)\)$/
},
spriteClass: null,
constructor: function(a) {
var b = this;
b.initConfig(a)
},
applyDefaults: function(b, a) {
a = Ext.apply(a || {}, this.normalize(b));
return a
},
applyAliases: function(b, a) {
return Ext.apply(a || {}, b)
},
applyProcessors: function(e, i) {
this.getAnimationProcessors();
var j = i || {},
h = Ext.draw.sprite.AttributeParser,
a = this.self.processorFactoryRe,
g = {},
d, b, c, f;
for (b in e) {
f = e[b];
if (typeof f === "string") {
c = f.match(a);
if (c) {
f = h[c[1]].apply(h, c[2].split(","))
} else {
if (h[f]) {
g[b] = f;
d = true;
f = h[f]
}
}
}
j[b] = f
}
if (d) {
this.setAnimationProcessors(g)
}
return j
},
applyAnimationProcessors: function(c, a) {
var e = Ext.draw.sprite.AnimationParser,
b, d;
if (!a) {
a = {}
}
for (b in c) {
d = c[b];
if (d === "none") {
a[b] = null
} else {
if (Ext.isString(d) && !(b in a)) {
if (d in e) {
while (Ext.isString(e[d])) {
d = e[d]
}
a[b] = e[d]
}
} else {
if (Ext.isObject(d)) {
a[b] = d
}
}
}
}
return a
},
updateDirtyTriggers: function(a) {
this.setTriggers(a)
},
applyTriggers: function(b, c) {
if (!c) {
c = {}
}
for (var a in b) {
c[a] = b[a].split(",")
}
return c
},
applyUpdaters: function(b, a) {
return Ext.apply(a || {}, b)
},
batchedNormalize: function(f, n) {
if (!f) {
return {}
}
var j = this.getProcessors(),
d = this.getAliases(),
a = f.translation || f.translate,
o = {},
g, h, b, e, p, c, m, l, k;
if ("rotation" in f) {
p = f.rotation
} else {
p = ("rotate" in f) ? f.rotate : undefined
}
if ("scaling" in f) {
c = f.scaling
} else {
c = ("scale" in f) ? f.scale : undefined
}
if (typeof c !== "undefined") {
if (Ext.isNumber(c)) {
o.scalingX = c;
o.scalingY = c
} else {
if ("x" in c) {
o.scalingX = c.x
}
if ("y" in c) {
o.scalingY = c.y
}
if ("centerX" in c) {
o.scalingCenterX = c.centerX
}
if ("centerY" in c) {
o.scalingCenterY = c.centerY
}
}
}
if (typeof p !== "undefined") {
if (Ext.isNumber(p)) {
p = Ext.draw.Draw.rad(p);
o.rotationRads = p
} else {
if ("rads" in p) {
o.rotationRads = p.rads
} else {
if ("degrees" in p) {
if (Ext.isArray(p.degrees)) {
o.rotationRads = Ext.Array.map(p.degrees, function(i) {
return Ext.draw.Draw.rad(i)
})
} else {
o.rotationRads = Ext.draw.Draw.rad(p.degrees)
}
}
}
if ("centerX" in p) {
o.rotationCenterX = p.centerX
}
if ("centerY" in p) {
o.rotationCenterY = p.centerY
}
}
}
if (typeof a !== "undefined") {
if ("x" in a) {
o.translationX = a.x
}
if ("y" in a) {
o.translationY = a.y
}
}
if ("matrix" in f) {
m = Ext.draw.Matrix.create(f.matrix);
k = m.split();
o.matrix = m;
o.rotationRads = k.rotation;
o.rotationCenterX = 0;
o.rotationCenterY = 0;
o.scalingX = k.scaleX;
o.scalingY = k.scaleY;
o.scalingCenterX = 0;
o.scalingCenterY = 0;
o.translationX = k.translateX;
o.translationY = k.translateY
}
for (b in f) {
e = f[b];
if (typeof e === "undefined") {
continue
} else {
if (Ext.isArray(e)) {
if (b in d) {
b = d[b]
}
if (b in j) {
o[b] = [];
for (g = 0, h = e.length; g < h; g++) {
l = j[b].call(this, e[g]);
if (typeof l !== "undefined") {
o[b][g] = l
}
}
} else {
if (n) {
o[b] = e
}
}
} else {
if (b in d) {
b = d[b]
}
if (b in j) {
e = j[b].call(this, e);
if (typeof e !== "undefined") {
o[b] = e
}
} else {
if (n) {
o[b] = e
}
}
}
}
}
return o
},
normalize: function(i, j) {
if (!i) {
return {}
}
var f = this.getProcessors(),
d = this.getAliases(),
a = i.translation || i.translate,
k = {},
b, e, l, c, h, g;
if ("rotation" in i) {
l = i.rotation
} else {
l = ("rotate" in i) ? i.rotate : undefined
}
if ("scaling" in i) {
c = i.scaling
} else {
c = ("scale" in i) ? i.scale : undefined
}
if (a) {
if ("x" in a) {
k.translationX = a.x
}
if ("y" in a) {
k.translationY = a.y
}
}
if (typeof c !== "undefined") {
if (Ext.isNumber(c)) {
k.scalingX = c;
k.scalingY = c
} else {
if ("x" in c) {
k.scalingX = c.x
}
if ("y" in c) {
k.scalingY = c.y
}
if ("centerX" in c) {
k.scalingCenterX = c.centerX
}
if ("centerY" in c) {
k.scalingCenterY = c.centerY
}
}
}
if (typeof l !== "undefined") {
if (Ext.isNumber(l)) {
l = Ext.draw.Draw.rad(l);
k.rotationRads = l
} else {
if ("rads" in l) {
k.rotationRads = l.rads
} else {
if ("degrees" in l) {
k.rotationRads = Ext.draw.Draw.rad(l.degrees)
}
}
if ("centerX" in l) {
k.rotationCenterX = l.centerX
}
if ("centerY" in l) {
k.rotationCenterY = l.centerY
}
}
}
if ("matrix" in i) {
h = Ext.draw.Matrix.create(i.matrix);
g = h.split();
k.matrix = h;
k.rotationRads = g.rotation;
k.rotationCenterX = 0;
k.rotationCenterY = 0;
k.scalingX = g.scaleX;
k.scalingY = g.scaleY;
k.scalingCenterX = 0;
k.scalingCenterY = 0;
k.translationX = g.translateX;
k.translationY = g.translateY
}
for (b in i) {
e = i[b];
if (typeof e === "undefined") {
continue
}
if (b in d) {
b = d[b]
}
if (b in f) {
e = f[b].call(this, e);
if (typeof e !== "undefined") {
k[b] = e
}
} else {
if (j) {
k[b] = e
}
}
}
return k
},
setBypassingNormalization: function(a, c, b) {
return c.pushDown(a, b)
},
set: function(a, c, b) {
b = this.normalize(b);
return this.setBypassingNormalization(a, c, b)
}
});
Ext.define("Ext.draw.Matrix", {
isMatrix: true,
statics: {
createAffineMatrixFromTwoPair: function(h, t, g, s, k, o, i, j) {
var v = g - h,
u = s - t,
e = i - k,
q = j - o,
d = 1 / (v * v + u * u),
p = v * e + u * q,
n = e * u - v * q,
m = -p * h - n * t,
l = n * h - p * t;
return new this(p * d, -n * d, n * d, p * d, m * d + k, l * d + o)
},
createPanZoomFromTwoPair: function(q, e, p, c, h, s, n, g) {
if (arguments.length === 2) {
return this.createPanZoomFromTwoPair.apply(this, q.concat(e))
}
var k = p - q,
j = c - e,
d = (q + p) * 0.5,
b = (e + c) * 0.5,
o = n - h,
a = g - s,
f = (h + n) * 0.5,
l = (s + g) * 0.5,
m = k * k + j * j,
i = o * o + a * a,
t = Math.sqrt(i / m);
return new this(t, 0, 0, t, f - t * d, l - t * b)
},
fly: (function() {
var a = null,
b = function(c) {
a.elements = c;
return a
};
return function(c) {
if (!a) {
a = new Ext.draw.Matrix()
}
a.elements = c;
Ext.draw.Matrix.fly = b;
return a
}
})(),
create: function(a) {
if (a instanceof this) {
return a
}
return new this(a)
}
},
constructor: function(e, d, a, f, c, b) {
if (e && e.length === 6) {
this.elements = e.slice()
} else {
if (e !== undefined) {
this.elements = [e, d, a, f, c, b]
} else {
this.elements = [1, 0, 0, 1, 0, 0]
}
}
},
prepend: function(a, l, h, g, m, k) {
var b = this.elements,
d = b[0],
j = b[1],
e = b[2],
c = b[3],
i = b[4],
f = b[5];
b[0] = a * d + h * j;
b[1] = l * d + g * j;
b[2] = a * e + h * c;
b[3] = l * e + g * c;
b[4] = a * i + h * f + m;
b[5] = l * i + g * f + k;
return this
},
prependMatrix: function(a) {
return this.prepend.apply(this, a.elements)
},
append: function(a, l, h, g, m, k) {
var b = this.elements,
d = b[0],
j = b[1],
e = b[2],
c = b[3],
i = b[4],
f = b[5];
b[0] = a * d + l * e;
b[1] = a * j + l * c;
b[2] = h * d + g * e;
b[3] = h * j + g * c;
b[4] = m * d + k * e + i;
b[5] = m * j + k * c + f;
return this
},
appendMatrix: function(a) {
return this.append.apply(this, a.elements)
},
set: function(f, e, a, g, c, b) {
var d = this.elements;
d[0] = f;
d[1] = e;
d[2] = a;
d[3] = g;
d[4] = c;
d[5] = b;
return this
},
inverse: function(i) {
var g = this.elements,
o = g[0],
m = g[1],
l = g[2],
k = g[3],
j = g[4],
h = g[5],
n = 1 / (o * k - m * l);
o *= n;
m *= n;
l *= n;
k *= n;
if (i) {
i.set(k, -m, -l, o, l * h - k * j, m * j - o * h);
return i
} else {
return new Ext.draw.Matrix(k, -m, -l, o, l * h - k * j, m * j - o * h)
}
},
translate: function(a, c, b) {
if (b) {
return this.prepend(1, 0, 0, 1, a, c)
} else {
return this.append(1, 0, 0, 1, a, c)
}
},
scale: function(f, e, c, a, b) {
var d = this;
if (e == null) {
e = f
}
if (c === undefined) {
c = 0
}
if (a === undefined) {
a = 0
}
if (b) {
return d.prepend(f, 0, 0, e, c - c * f, a - a * e)
} else {
return d.append(f, 0, 0, e, c - c * f, a - a * e)
}
},
rotate: function(g, e, c, b) {
var d = this,
f = Math.cos(g),
a = Math.sin(g);
e = e || 0;
c = c || 0;
if (b) {
return d.prepend(f, a, -a, f, e - f * e + c * a, c - f * c - e * a)
} else {
return d.append(f, a, -a, f, e - f * e + c * a, c - f * c - e * a)
}
},
rotateFromVector: function(a, h, c) {
var e = this,
g = Math.sqrt(a * a + h * h),
f = a / g,
b = h / g;
if (c) {
return e.prepend(f, b, -b, f, 0, 0)
} else {
return e.append(f, b, -b, f, 0, 0)
}
},
clone: function() {
return new Ext.draw.Matrix(this.elements)
},
flipX: function() {
return this.append(-1, 0, 0, 1, 0, 0)
},
flipY: function() {
return this.append(1, 0, 0, -1, 0, 0)
},
skewX: function(a) {
return this.append(1, 0, Math.tan(a), 1, 0, 0)
},
skewY: function(a) {
return this.append(1, Math.tan(a), 0, 1, 0, 0)
},
shearX: function(a) {
return this.append(1, 0, a, 1, 0, 0)
},
shearY: function(a) {
return this.append(1, a, 0, 1, 0, 0)
},
reset: function() {
return this.set(1, 0, 0, 1, 0, 0)
},
precisionCompensate: function(j, g) {
var c = this.elements,
f = c[0],
e = c[1],
i = c[2],
h = c[3],
d = c[4],
b = c[5],
a = e * i - f * h;
g.b = j * e / f;
g.c = j * i / h;
g.d = j;
g.xx = f / j;
g.yy = h / j;
g.dx = (b * f * i - d * f * h) / a / j;
g.dy = (d * e * h - b * f * h) / a / j
},
precisionCompensateRect: function(j, g) {
var b = this.elements,
f = b[0],
e = b[1],
i = b[2],
h = b[3],
c = b[4],
a = b[5],
d = i / f;
g.b = j * e / f;
g.c = j * d;
g.d = j * h / f;
g.xx = f / j;
g.yy = f / j;
g.dx = (a * i - c * h) / (e * d - h) / j;
g.dy = -(a * f - c * e) / (e * d - h) / j
},
x: function(a, c) {
var b = this.elements;
return a * b[0] + c * b[2] + b[4]
},
y: function(a, c) {
var b = this.elements;
return a * b[1] + c * b[3] + b[5]
},
get: function(b, a) {
return +this.elements[b + a * 2].toFixed(4)
},
transformPoint: function(b) {
var c = this.elements,
a, d;
if (b.isPoint) {
a = b.x;
d = b.y
} else {
a = b[0];
d = b[1]
}
return [a * c[0] + d * c[2] + c[4], a * c[1] + d * c[3] + c[5]]
},
transformBBox: function(q, i, j) {
var b = this.elements,
d = q.x,
r = q.y,
g = q.width * 0.5,
o = q.height * 0.5,
a = b[0],
s = b[1],
n = b[2],
k = b[3],
e = d + g,
c = r + o,
p, f, m;
if (i) {
g -= i;
o -= i;
m = [Math.sqrt(b[0] * b[0] + b[2] * b[2]), Math.sqrt(b[1] * b[1] + b[3] * b[3])];
p = Math.abs(g * a) + Math.abs(o * n) + Math.abs(m[0] * i);
f = Math.abs(g * s) + Math.abs(o * k) + Math.abs(m[1] * i)
} else {
p = Math.abs(g * a) + Math.abs(o * n);
f = Math.abs(g * s) + Math.abs(o * k)
}
if (!j) {
j = {}
}
j.x = e * a + c * n + b[4] - p;
j.y = e * s + c * k + b[5] - f;
j.width = p + p;
j.height = f + f;
return j
},
transformList: function(e) {
var b = this.elements,
a = b[0],
h = b[2],
l = b[4],
k = b[1],
g = b[3],
j = b[5],
f = e.length,
c, d;
for (d = 0; d < f; d++) {
c = e[d];
e[d] = [c[0] * a + c[1] * h + l, c[0] * k + c[1] * g + j]
}
return e
},
isIdentity: function() {
var a = this.elements;
return a[0] === 1 && a[1] === 0 && a[2] === 0 && a[3] === 1 && a[4] === 0 && a[5] === 0
},
isEqual: function(a) {
var c = a && a.isMatrix ? a.elements : a,
b = this.elements;
return b[0] === c[0] && b[1] === c[1] && b[2] === c[2] && b[3] === c[3] && b[4] === c[4] && b[5] === c[5]
},
equals: function(a) {
return this.isEqual(a)
},
toArray: function() {
var a = this.elements;
return [a[0], a[2], a[4], a[1], a[3], a[5]]
},
toVerticalArray: function() {
return this.elements.slice()
},
toString: function() {
var a = this;
return [a.get(0, 0), a.get(0, 1), a.get(1, 0), a.get(1, 1), a.get(2, 0), a.get(2, 1)].join(",")
},
toContext: function(a) {
a.transform.apply(a, this.elements);
return this
},
toSvg: function() {
var a = this.elements;
return "matrix(" + a[0].toFixed(9) + "," + a[1].toFixed(9) + "," + a[2].toFixed(9) + "," + a[3].toFixed(9) + "," + a[4].toFixed(9) + "," + a[5].toFixed(9) + ")"
},
getScaleX: function() {
var a = this.elements;
return Math.sqrt(a[0] * a[0] + a[2] * a[2])
},
getScaleY: function() {
var a = this.elements;
return Math.sqrt(a[1] * a[1] + a[3] * a[3])
},
getXX: function() {
return this.elements[0]
},
getXY: function() {
return this.elements[1]
},
getYX: function() {
return this.elements[2]
},
getYY: function() {
return this.elements[3]
},
getDX: function() {
return this.elements[4]
},
getDY: function() {
return this.elements[5]
},
split: function() {
var b = this.elements,
d = b[0],
c = b[1],
e = b[3],
a = {
translateX: b[4],
translateY: b[5]
};
a.rotate = a.rotation = Math.atan2(c, d);
a.scaleX = d / Math.cos(a.rotate);
a.scaleY = e / d * a.scaleX;
return a
}
}, function() {
function b(e, c, d) {
e[c] = {
get: function() {
return this.elements[d]
},
set: function(f) {
this.elements[d] = f
}
}
}
if (Object.defineProperties) {
var a = {};
b(a, "a", 0);
b(a, "b", 1);
b(a, "c", 2);
b(a, "d", 3);
b(a, "e", 4);
b(a, "f", 5);
Object.defineProperties(this.prototype, a)
}
this.prototype.multiply = this.prototype.appendMatrix
});
Ext.define("Ext.draw.modifier.Modifier", {
mixins: {
observable: "Ext.mixin.Observable"
},
config: {
previous: null,
next: null,
sprite: null
},
constructor: function(a) {
this.mixins.observable.constructor.call(this, a)
},
updateNext: function(a) {
if (a) {
a.setPrevious(this)
}
},
updatePrevious: function(a) {
if (a) {
a.setNext(this)
}
},
prepareAttributes: function(a) {
if (this._previous) {
this._previous.prepareAttributes(a)
}
},
popUp: function(a, b) {
if (this._next) {
this._next.popUp(a, b)
} else {
Ext.apply(a, b)
}
},
pushDown: function(a, c) {
if (this._previous) {
return this._previous.pushDown(a, c)
} else {
for (var b in c) {
if (c[b] === a[b]) {
delete c[b]
}
}
return c
}
}
});
Ext.define("Ext.draw.modifier.Target", {
requires: ["Ext.draw.Matrix"],
extend: "Ext.draw.modifier.Modifier",
alias: "modifier.target",
statics: {
uniqueId: 0
},
prepareAttributes: function(a) {
var b = this.getPrevious();
if (b) {
b.prepareAttributes(a)
}
a.attributeId = "attribute-" + Ext.draw.modifier.Target.uniqueId++;
if (!a.hasOwnProperty("canvasAttributes")) {
a.bbox = {
plain: {
dirty: true
},
transform: {
dirty: true
}
};
a.dirty = true;
a.pendingUpdaters = {};
a.canvasAttributes = {};
a.matrix = new Ext.draw.Matrix();
a.inverseMatrix = new Ext.draw.Matrix()
}
},
applyChanges: function(f, k) {
Ext.apply(f, k);
var l = this.getSprite(),
o = f.pendingUpdaters,
h = l.self.def.getTriggers(),
p, a, m, b, e, n, d, c, g;
for (b in k) {
e = true;
if ((p = h[b])) {
l.scheduleUpdaters(f, p, [b])
}
if (f.template && k.removeFromInstance && k.removeFromInstance[b]) {
delete f[b]
}
}
if (!e) {
return
}
if (o.canvas) {
n = o.canvas;
delete o.canvas;
for (d = 0, g = n.length; d < g; d++) {
b = n[d];
f.canvasAttributes[b] = f[b]
}
}
if (f.hasOwnProperty("children")) {
a = f.children;
for (d = 0, g = a.length; d < g; d++) {
m = a[d];
Ext.apply(m.pendingUpdaters, o);
if (n) {
for (c = 0; c < n.length; c++) {
b = n[c];
m.canvasAttributes[b] = m[b]
}
}
l.callUpdaters(m)
}
}
l.setDirty(true);
l.callUpdaters(f)
},
popUp: function(a, b) {
this.applyChanges(a, b)
},
pushDown: function(a, b) {
var c = this.getPrevious();
if (c) {
b = c.pushDown(a, b)
}
this.applyChanges(a, b);
return b
}
});
Ext.define("Ext.draw.TimingFunctions", function() {
var g = Math.pow,
j = Math.sin,
m = Math.cos,
l = Math.sqrt,
e = Math.PI,
b = ["quad", "cube", "quart", "quint"],
c = {
pow: function(o, i) {
return g(o, i || 6)
},
expo: function(i) {
return g(2, 8 * (i - 1))
},
circ: function(i) {
return 1 - l(1 - i * i)
},
sine: function(i) {
return 1 - j((1 - i) * e / 2)
},
back: function(i, o) {
o = o || 1.616;
return i * i * ((o + 1) * i - o)
},
bounce: function(q) {
for (var o = 0, i = 1; 1; o += i, i /= 2) {
if (q >= (7 - 4 * o) / 11) {
return i * i - g((11 - 6 * o - 11 * q) / 4, 2)
}
}
},
elastic: function(o, i) {
return g(2, 10 * --o) * m(20 * o * e * (i || 1) / 3)
}
},
k = {},
a, f, d;
function h(i) {
return function(o) {
return g(o, i)
}
}
function n(i, o) {
k[i + "In"] = function(p) {
return o(p)
};
k[i + "Out"] = function(p) {
return 1 - o(1 - p)
};
k[i + "InOut"] = function(p) {
return (p <= 0.5) ? o(2 * p) / 2 : (2 - o(2 * (1 - p))) / 2
}
}
for (d = 0, f = b.length; d < f; ++d) {
c[b[d]] = h(d + 2)
}
for (a in c) {
n(a, c[a])
}
k.linear = Ext.identityFn;
k.easeIn = k.quadIn;
k.easeOut = k.quadOut;
k.easeInOut = k.quadInOut;
return {
singleton: true,
easingMap: k
}
}, function(a) {
Ext.apply(a, a.easingMap)
});
Ext.define("Ext.draw.Animator", {
uses: ["Ext.draw.Draw"],
singleton: true,
frameCallbacks: {},
frameCallbackId: 0,
scheduled: 0,
frameStartTimeOffset: Ext.now(),
animations: [],
running: false,
animationTime: function() {
return Ext.AnimationQueue.frameStartTime - this.frameStartTimeOffset
},
add: function(b) {
var a = this;
if (!a.contains(b)) {
a.animations.push(b);
a.ignite();
if ("fireEvent" in b) {
b.fireEvent("animationstart", b)
}
}
},
remove: function(d) {
var c = this,
e = c.animations,
b = 0,
a = e.length;
for (; b < a; ++b) {
if (e[b] === d) {
e.splice(b, 1);
if ("fireEvent" in d) {
d.fireEvent("animationend", d)
}
return
}
}
},
contains: function(a) {
return Ext.Array.indexOf(this.animations, a) > -1
},
empty: function() {
return this.animations.length === 0
},
step: function(d) {
var c = this,
f = c.animations,
e, a = 0,
b = f.length;
for (; a < b; a++) {
e = f[a];
e.step(d);
if (!e.animating) {
f.splice(a, 1);
a--;
b--;
if (e.fireEvent) {
e.fireEvent("animationend", e)
}
}
}
},
schedule: function(c, a) {
a = a || this;
var b = "frameCallback" + (this.frameCallbackId++);
if (Ext.isString(c)) {
c = a[c]
}
Ext.draw.Animator.frameCallbacks[b] = {
fn: c,
scope: a,
once: true
};
this.scheduled++;
Ext.draw.Animator.ignite();
return b
},
scheduleIf: function(e, b) {
b = b || this;
var c = Ext.draw.Animator.frameCallbacks,
a, d;
if (Ext.isString(e)) {
e = b[e]
}
for (d in c) {
a = c[d];
if (a.once && a.fn === e && a.scope === b) {
return null
}
}
return this.schedule(e, b)
},
cancel: function(a) {
if (Ext.draw.Animator.frameCallbacks[a] && Ext.draw.Animator.frameCallbacks[a].once) {
this.scheduled--;
delete Ext.draw.Animator.frameCallbacks[a]
}
},
addFrameCallback: function(c, a) {
a = a || this;
if (Ext.isString(c)) {
c = a[c]
}
var b = "frameCallback" + (this.frameCallbackId++);
Ext.draw.Animator.frameCallbacks[b] = {
fn: c,
scope: a
};
return b
},
removeFrameCallback: function(a) {
delete Ext.draw.Animator.frameCallbacks[a]
},
fireFrameCallbacks: function() {
var c = this.frameCallbacks,
d, b, a;
for (d in c) {
a = c[d];
b = a.fn;
if (Ext.isString(b)) {
b = a.scope[b]
}
b.call(a.scope);
if (c[d] && a.once) {
this.scheduled--;
delete c[d]
}
}
},
handleFrame: function() {
this.step(this.animationTime());
this.fireFrameCallbacks();
if (!this.scheduled && this.empty()) {
Ext.AnimationQueue.stop(this.handleFrame, this);
this.running = false;
Ext.draw.Draw.endUpdateIOS()
}
},
ignite: function() {
if (!this.running) {
this.running = true;
Ext.AnimationQueue.start(this.handleFrame, this);
Ext.draw.Draw.beginUpdateIOS()
}
}
});
Ext.define("Ext.draw.modifier.Animation", {
requires: ["Ext.draw.TimingFunctions", "Ext.draw.Animator"],
extend: "Ext.draw.modifier.Modifier",
alias: "modifier.animation",
config: {
easing: Ext.identityFn,
duration: 0,
customEasings: {},
customDurations: {},
customDuration: null
},
constructor: function(a) {
var b = this;
b.anyAnimation = b.anySpecialAnimations = false;
b.animating = 0;
b.animatingPool = [];
b.callParent([a])
},
prepareAttributes: function(a) {
if (!a.hasOwnProperty("timers")) {
a.animating = false;
a.timers = {};
a.animationOriginal = Ext.Object.chain(a);
a.animationOriginal.prototype = a
}
if (this._previous) {
this._previous.prepareAttributes(a.animationOriginal)
}
},
updateSprite: function(a) {
this.setConfig(a.config.fx)
},
updateDuration: function(a) {
this.anyAnimation = a > 0
},
applyEasing: function(a) {
if (typeof a === "string") {
a = Ext.draw.TimingFunctions.easingMap[a]
}
return a
},
applyCustomEasings: function(a, e) {
e = e || {};
var g, d, b, h, c, f;
for (d in a) {
g = true;
h = a[d];
b = d.split(",");
if (typeof h === "string") {
h = Ext.draw.TimingFunctions.easingMap[h]
}
for (c = 0, f = b.length; c < f; c++) {
e[b[c]] = h
}
}
if (g) {
this.anySpecialAnimations = g
}
return e
},
setEasingOn: function(a, e) {
a = Ext.Array.from(a).slice();
var c = {},
d = a.length,
b = 0;
for (; b < d; b++) {
c[a[b]] = e
}
this.setCustomEasings(c)
},
clearEasingOn: function(a) {
a = Ext.Array.from(a, true);
var b = 0,
c = a.length;
for (; b < c; b++) {
delete this._customEasings[a[b]]
}
},
applyCustomDurations: function(g, h) {
h = h || {};
var e, c, f, a, b, d;
for (c in g) {
e = true;
f = g[c];
a = c.split(",");
for (b = 0, d = a.length; b < d; b++) {
h[a[b]] = f
}
}
if (e) {
this.anySpecialAnimations = e
}
return h
},
applyCustomDuration: function(a, b) {
if (a) {
this.getCustomDurations();
this.setCustomDurations(a)
}
},
setDurationOn: function(b, e) {
b = Ext.Array.from(b).slice();
var a = {},
c = 0,
d = b.length;
for (; c < d; c++) {
a[b[c]] = e
}
this.setCustomDurations(a)
},
clearDurationOn: function(a) {
a = Ext.Array.from(a, true);
var b = 0,
c = a.length;
for (; b < c; b++) {
delete this._customDurations[a[b]]
}
},
setAnimating: function(a, b) {
var e = this,
d = e.animatingPool;
if (a.animating !== b) {
a.animating = b;
if (b) {
d.push(a);
if (e.animating === 0) {
Ext.draw.Animator.add(e)
}
e.animating++
} else {
for (var c = d.length; c--;) {
if (d[c] === a) {
d.splice(c, 1)
}
}
e.animating = d.length
}
}
},
setAttrs: function(r, t) {
var s = this,
m = r.timers,
h = s._sprite.self.def._animationProcessors,
f = s._easing,
e = s._duration,
j = s._customDurations,
i = s._customEasings,
g = s.anySpecialAnimations,
n = s.anyAnimation || g,
o = r.animationOriginal,
d = false,
k, u, l, p, c, q, a;
if (!n) {
for (u in t) {
if (r[u] === t[u]) {
delete t[u]
} else {
r[u] = t[u]
}
delete o[u];
delete m[u]
}
return t
} else {
for (u in t) {
l = t[u];
p = r[u];
if (l !== p && p !== undefined && p !== null && (c = h[u])) {
q = f;
a = e;
if (g) {
if (u in i) {
q = i[u]
}
if (u in j) {
a = j[u]
}
}
if (p && p.isGradient || l && l.isGradient) {
a = 0
}
if (a) {
if (!m[u]) {
m[u] = {}
}
k = m[u];
k.start = 0;
k.easing = q;
k.duration = a;
k.compute = c.compute;
k.serve = c.serve || Ext.identityFn;
k.remove = t.removeFromInstance && t.removeFromInstance[u];
if (c.parseInitial) {
var b = c.parseInitial(p, l);
k.source = b[0];
k.target = b[1]
} else {
if (c.parse) {
k.source = c.parse(p);
k.target = c.parse(l)
} else {
k.source = p;
k.target = l
}
}
o[u] = l;
delete t[u];
d = true;
continue
} else {
delete o[u]
}
} else {
delete o[u]
}
delete m[u]
}
}
if (d && !r.animating) {
s.setAnimating(r, true)
}
return t
},
updateAttributes: function(g) {
if (!g.animating) {
return {}
}
var h = {},
e = false,
d = g.timers,
f = g.animationOriginal,
c = Ext.draw.Animator.animationTime(),
a, b, i;
if (g.lastUpdate === c) {
return null
}
for (a in d) {
b = d[a];
if (!b.start) {
b.start = c;
i = 0
} else {
i = (c - b.start) / b.duration
}
if (i >= 1) {
h[a] = f[a];
delete f[a];
if (d[a].remove) {
h.removeFromInstance = h.removeFromInstance || {};
h.removeFromInstance[a] = true
}
delete d[a]
} else {
h[a] = b.serve(b.compute(b.source, b.target, b.easing(i), g[a]));
e = true
}
}
g.lastUpdate = c;
this.setAnimating(g, e);
return h
},
pushDown: function(a, b) {
b = this.callParent([a.animationOriginal, b]);
return this.setAttrs(a, b)
},
popUp: function(a, b) {
a = a.prototype;
b = this.setAttrs(a, b);
if (this._next) {
return this._next.popUp(a, b)
} else {
return Ext.apply(a, b)
}
},
step: function(g) {
var f = this,
c = f.animatingPool.slice(),
e = c.length,
b = 0,
a, d;
for (; b < e; b++) {
a = c[b];
d = f.updateAttributes(a);
if (d && f._next) {
f._next.popUp(a, d)
}
}
},
stop: function() {
this.step();
var d = this,
b = d.animatingPool,
a, c;
for (a = 0, c = b.length; a < c; a++) {
b[a].animating = false
}
d.animatingPool.length = 0;
d.animating = 0;
Ext.draw.Animator.remove(d)
},
destroy: function() {
this.animatingPool.length = 0;
this.animating = 0;
this.callParent()
}
});
Ext.define("Ext.draw.modifier.Highlight", {
extend: "Ext.draw.modifier.Modifier",
alias: "modifier.highlight",
config: {
enabled: false,
highlightStyle: null
},
preFx: true,
applyHighlightStyle: function(b, a) {
a = a || {};
if (this.getSprite()) {
Ext.apply(a, this.getSprite().self.def.normalize(b))
} else {
Ext.apply(a, b)
}
return a
},
prepareAttributes: function(a) {
if (!a.hasOwnProperty("highlightOriginal")) {
a.highlighted = false;
a.highlightOriginal = Ext.Object.chain(a);
a.highlightOriginal.prototype = a;
a.highlightOriginal.removeFromInstance = {}
}
if (this._previous) {
this._previous.prepareAttributes(a.highlightOriginal)
}
},
updateSprite: function(b, a) {
if (b) {
if (this.getHighlightStyle()) {
this._highlightStyle = b.self.def.normalize(this.getHighlightStyle())
}
this.setHighlightStyle(b.config.highlight)
}
b.self.def.setConfig({
defaults: {
highlighted: false
},
processors: {
highlighted: "bool"
}
});
this.setSprite(b)
},
filterChanges: function(a, d) {
var e = this,
f = a.highlightOriginal,
c = e.getHighlightStyle(),
b;
if (a.highlighted) {
for (b in d) {
if (c.hasOwnProperty(b)) {
f[b] = d[b];
delete d[b]
}
}
}
for (b in d) {
if (b !== "highlighted" && f[b] === d[b]) {
delete d[b]
}
}
return d
},
pushDown: function(e, g) {
var f = this.getHighlightStyle(),
c = e.highlightOriginal,
i = c.removeFromInstance,
d, a, h, b;
if (g.hasOwnProperty("highlighted")) {
d = g.highlighted;
delete g.highlighted;
if (this._previous) {
g = this._previous.pushDown(c, g)
}
g = this.filterChanges(e, g);
if (d !== e.highlighted) {
if (d) {
for (a in f) {
if (a in g) {
c[a] = g[a]
} else {
h = e.template && e.template.ownAttr;
if (h && !e.prototype.hasOwnProperty(a)) {
i[a] = true;
c[a] = h.animationOriginal[a]
} else {
b = c.timers[a];
if (b && b.remove) {
i[a] = true
}
c[a] = e[a]
}
}
if (c[a] !== f[a]) {
g[a] = f[a]
}
}
} else {
for (a in f) {
if (!(a in g)) {
g[a] = c[a]
}
delete c[a]
}
g.removeFromInstance = g.removeFromInstance || {};
Ext.apply(g.removeFromInstance, i);
c.removeFromInstance = {}
}
g.highlighted = d
}
} else {
if (this._previous) {
g = this._previous.pushDown(c, g)
}
g = this.filterChanges(e, g)
}
return g
},
popUp: function(a, b) {
b = this.filterChanges(a, b);
Ext.draw.modifier.Modifier.prototype.popUp.call(this, a, b)
}
});
Ext.define("Ext.draw.sprite.Sprite", {
alias: "sprite.sprite",
mixins: {
observable: "Ext.mixin.Observable"
},
requires: ["Ext.draw.Draw", "Ext.draw.gradient.Gradient", "Ext.draw.sprite.AttributeDefinition", "Ext.draw.modifier.Target", "Ext.draw.modifier.Animation", "Ext.draw.modifier.Highlight"],
isSprite: true,
statics: {
defaultHitTestOptions: {
fill: true,
stroke: true
}
},
inheritableStatics: {
def: {
processors: {
strokeStyle: "color",
fillStyle: "color",
strokeOpacity: "limited01",
fillOpacity: "limited01",
lineWidth: "number",
lineCap: "enums(butt,round,square)",
lineJoin: "enums(round,bevel,miter)",
lineDash: "data",
lineDashOffset: "number",
miterLimit: "number",
shadowColor: "color",
shadowOffsetX: "number",
shadowOffsetY: "number",
shadowBlur: "number",
globalAlpha: "limited01",
globalCompositeOperation: "enums(source-over,destination-over,source-in,destination-in,source-out,destination-out,source-atop,destination-atop,lighter,xor,copy)",
hidden: "bool",
transformFillStroke: "bool",
zIndex: "number",
translationX: "number",
translationY: "number",
rotationRads: "number",
rotationCenterX: "number",
rotationCenterY: "number",
scalingX: "number",
scalingY: "number",
scalingCenterX: "number",
scalingCenterY: "number",
constrainGradients: "bool"
},
aliases: {
stroke: "strokeStyle",
fill: "fillStyle",
color: "fillStyle",
"stroke-width": "lineWidth",
"stroke-linecap": "lineCap",
"stroke-linejoin": "lineJoin",
"stroke-miterlimit": "miterLimit",
"text-anchor": "textAlign",
opacity: "globalAlpha",
translateX: "translationX",
translateY: "translationY",
rotateRads: "rotationRads",
rotateCenterX: "rotationCenterX",
rotateCenterY: "rotationCenterY",
scaleX: "scalingX",
scaleY: "scalingY",
scaleCenterX: "scalingCenterX",
scaleCenterY: "scalingCenterY"
},
defaults: {
hidden: false,
zIndex: 0,
strokeStyle: "none",
fillStyle: "none",
lineWidth: 1,
lineDash: [],
lineDashOffset: 0,
lineCap: "butt",
lineJoin: "miter",
miterLimit: 10,
shadowColor: "none",
shadowOffsetX: 0,
shadowOffsetY: 0,
shadowBlur: 0,
globalAlpha: 1,
strokeOpacity: 1,
fillOpacity: 1,
transformFillStroke: false,
translationX: 0,
translationY: 0,
rotationRads: 0,
rotationCenterX: null,
rotationCenterY: null,
scalingX: 1,
scalingY: 1,
scalingCenterX: null,
scalingCenterY: null,
constrainGradients: false
},
triggers: {
zIndex: "zIndex",
globalAlpha: "canvas",
globalCompositeOperation: "canvas",
transformFillStroke: "canvas",
strokeStyle: "canvas",
fillStyle: "canvas",
strokeOpacity: "canvas",
fillOpacity: "canvas",
lineWidth: "canvas",
lineCap: "canvas",
lineJoin: "canvas",
lineDash: "canvas",
lineDashOffset: "canvas",
miterLimit: "canvas",
shadowColor: "canvas",
shadowOffsetX: "canvas",
shadowOffsetY: "canvas",
shadowBlur: "canvas",
translationX: "transform",
translationY: "transform",
rotationRads: "transform",
rotationCenterX: "transform",
rotationCenterY: "transform",
scalingX: "transform",
scalingY: "transform",
scalingCenterX: "transform",
scalingCenterY: "transform",
constrainGradients: "canvas"
},
updaters: {
bbox: "bboxUpdater",
zIndex: function(a) {
a.dirtyZIndex = true
},
transform: function(a) {
a.dirtyTransform = true;
a.bbox.transform.dirty = true
}
}
}
},
config: {
parent: null,
surface: null
},
onClassExtended: function(d, c) {
var b = d.superclass.self.def.initialConfig,
e = c.inheritableStatics && c.inheritableStatics.def,
a;
if (e) {
a = Ext.Object.merge({}, b, e);
d.def = new Ext.draw.sprite.AttributeDefinition(a);
delete c.inheritableStatics.def
} else {
d.def = new Ext.draw.sprite.AttributeDefinition(b)
}
d.def.spriteClass = d
},
constructor: function(b) {
var d = this,
c = d.self.def,
e = c.getDefaults(),
a;
b = Ext.isObject(b) ? b : {};
d.id = b.id || Ext.id(null, "ext-sprite-");
d.attr = {};
d.mixins.observable.constructor.apply(d, arguments);
a = Ext.Array.from(b.modifiers, true);
d.prepareModifiers(a);
d.initializeAttributes();
d.setAttributes(e, true);
d.setAttributes(b)
},
getDirty: function() {
return this.attr.dirty
},
setDirty: function(b) {
this.attr.dirty = b;
if (b) {
var a = this.getParent();
if (a) {
a.setDirty(true)
}
}
},
addModifier: function(a, b) {
var c = this;
if (!(a instanceof Ext.draw.modifier.Modifier)) {
a = Ext.factory(a, null, null, "modifier")
}
a.setSprite(c);
if (a.preFx || a.config && a.config.preFx) {
if (c.fx.getPrevious()) {
c.fx.getPrevious().setNext(a)
}
a.setNext(c.fx)
} else {
c.topModifier.getPrevious().setNext(a);
a.setNext(c.topModifier)
}
if (b) {
c.initializeAttributes()
}
return a
},
prepareModifiers: function(d) {
var c = this,
a, b;
c.topModifier = new Ext.draw.modifier.Target({
sprite: c
});
c.fx = new Ext.draw.modifier.Animation({
sprite: c
});
c.fx.setNext(c.topModifier);
for (a = 0, b = d.length; a < b; a++) {
c.addModifier(d[a], false)
}
},
getAnimation: function() {
return this.fx
},
setAnimation: function(a) {
this.fx.setConfig(a)
},
initializeAttributes: function() {
this.topModifier.prepareAttributes(this.attr)
},
callUpdaters: function(d) {
var e = this,
h = d.pendingUpdaters,
i = e.self.def.getUpdaters(),
c = false,
a = false,
b, g, f;
e.callUpdaters = Ext.emptyFn;
do {
c = false;
for (g in h) {
c = true;
b = h[g];
delete h[g];
f = i[g];
if (typeof f === "string") {
f = e[f]
}
if (f) {
f.call(e, d, b)
}
}
a = a || c
} while (c);
delete e.callUpdaters;
if (a) {
e.setDirty(true)
}
},
scheduleUpdaters: function(a, e, c) {
var f;
if (c) {
for (var b = 0, d = e.length; b < d; b++) {
f = e[b];
this.scheduleUpdater(a, f, c)
}
} else {
for (f in e) {
c = e[f];
this.scheduleUpdater(a, f, c)
}
}
},
scheduleUpdater: function(a, c, b) {
b = b || [];
var d = a.pendingUpdaters;
if (c in d) {
if (b.length) {
d[c] = Ext.Array.merge(d[c], b)
}
} else {
d[c] = b
}
},
setAttributes: function(d, g, c) {
var a = this.attr,
b, e, f;
if (g) {
if (c) {
this.topModifier.pushDown(a, d)
} else {
f = {};
for (b in d) {
e = d[b];
if (e !== a[b]) {
f[b] = e
}
}
this.topModifier.pushDown(a, f)
}
} else {
this.topModifier.pushDown(a, this.self.def.normalize(d))
}
},
setAttributesBypassingNormalization: function(b, a) {
return this.setAttributes(b, true, a)
},
bboxUpdater: function(b) {
var c = b.rotationRads !== 0,
a = b.scalingX !== 1 || b.scalingY !== 1,
d = b.rotationCenterX === null || b.rotationCenterY === null,
e = b.scalingCenterX === null || b.scalingCenterY === null;
b.bbox.plain.dirty = true;
b.bbox.transform.dirty = true;
if (c && d || a && e) {
this.scheduleUpdater(b, "transform")
}
},
getBBox: function(d) {
var e = this,
a = e.attr,
f = a.bbox,
c = f.plain,
b = f.transform;
if (c.dirty) {
e.updatePlainBBox(c);
c.dirty = false
}
if (!d) {
e.applyTransformations();
if (b.dirty) {
e.updateTransformedBBox(b, c);
b.dirty = false
}
return b
}
return c
},
updatePlainBBox: Ext.emptyFn,
updateTransformedBBox: function(a, b) {
this.attr.matrix.transformBBox(b, 0, a)
},
getBBoxCenter: function(a) {
var b = this.getBBox(a);
if (b) {
return [b.x + b.width * 0.5, b.y + b.height * 0.5]
} else {
return [0, 0]
}
},
hide: function() {
this.attr.hidden = true;
this.setDirty(true);
return this
},
show: function() {
this.attr.hidden = false;
this.setDirty(true);
return this
},
useAttributes: function(i, f) {
this.applyTransformations();
var d = this.attr,
h = d.canvasAttributes,
e = h.strokeStyle,
g = h.fillStyle,
b = h.lineDash,
c = h.lineDashOffset,
a;
if (e) {
if (e.isGradient) {
i.strokeStyle = "black";
i.strokeGradient = e
} else {
i.strokeGradient = false
}
}
if (g) {
if (g.isGradient) {
i.fillStyle = "black";
i.fillGradient = g
} else {
i.fillGradient = false
}
}
if (b) {
i.setLineDash(b)
}
if (Ext.isNumber(c + i.lineDashOffset)) {
i.lineDashOffset = c
}
for (a in h) {
if (h[a] !== undefined && h[a] !== i[a]) {
i[a] = h[a]
}
}
this.setGradientBBox(i, f)
},
setGradientBBox: function(b, c) {
var a = this.attr;
if (a.constrainGradients) {
b.setGradientBBox({
x: c[0],
y: c[1],
width: c[2],
height: c[3]
})
} else {
b.setGradientBBox(this.getBBox(a.transformFillStroke))
}
},
applyTransformations: function(b) {
if (!b && !this.attr.dirtyTransform) {
return
}
var r = this,
k = r.attr,
p = r.getBBoxCenter(true),
g = p[0],
f = p[1],
q = k.translationX,
o = k.translationY,
j = k.scalingX,
i = k.scalingY === null ? k.scalingX : k.scalingY,
m = k.scalingCenterX === null ? g : k.scalingCenterX,
l = k.scalingCenterY === null ? f : k.scalingCenterY,
s = k.rotationRads,
e = k.rotationCenterX === null ? g : k.rotationCenterX,
d = k.rotationCenterY === null ? f : k.rotationCenterY,
c = Math.cos(s),
a = Math.sin(s),
n, h;
if (j === 1 && i === 1) {
m = 0;
l = 0
}
if (s === 0) {
e = 0;
d = 0
}
n = m * (1 - j) - e;
h = l * (1 - i) - d;
k.matrix.elements = [c * j, a * j, -a * i, c * i, c * n - a * h + e + q, a * n + c * h + d + o];
k.matrix.inverse(k.inverseMatrix);
k.dirtyTransform = false;
k.bbox.transform.dirty = true
},
transform: function(b, c) {
var a = this.attr,
e = a.matrix,
d;
if (b && b.isMatrix) {
d = b.elements
} else {
d = b
}
e.prepend.apply(e, d.slice());
e.inverse(a.inverseMatrix);
if (c) {
this.updateTransformAttributes()
}
a.dirtyTransform = false;
a.bbox.transform.dirty = true;
this.setDirty(true);
return this
},
updateTransformAttributes: function() {
var a = this.attr,
b = a.matrix.split();
a.rotationRads = b.rotate;
a.rotationCenterX = 0;
a.rotationCenterY = 0;
a.scalingX = b.scaleX;
a.scalingY = b.scaleY;
a.scalingCenterX = 0;
a.scalingCenterY = 0;
a.translationX = b.translateX;
a.translationY = b.translateY
},
resetTransform: function(b) {
var a = this.attr;
a.matrix.reset();
a.inverseMatrix.reset();
if (!b) {
this.updateTransformAttributes()
}
a.dirtyTransform = false;
a.bbox.transform.dirty = true;
this.setDirty(true);
return this
},
setTransform: function(a, b) {
this.resetTransform(true);
this.transform.call(this, a, b);
return this
},
preRender: Ext.emptyFn,
render: Ext.emptyFn,
hitTest: function(b, c) {
if (this.isVisible()) {
var a = b[0],
f = b[1],
e = this.getBBox(),
d = e && a >= e.x && a <= (e.x + e.width) && f >= e.y && f <= (e.y + e.height);
if (d) {
return {
sprite: this
}
}
}
return null
},
isVisible: function() {
var e = this.attr,
f = this.getParent(),
g = f && (f.isSurface || f.isVisible()),
d = g && !e.hidden && e.globalAlpha,
b = Ext.draw.Color.NONE,
a = Ext.draw.Color.RGBA_NONE,
c = e.fillOpacity && e.fillStyle !== b && e.fillStyle !== a,
i = e.strokeOpacity && e.strokeStyle !== b && e.strokeStyle !== a,
h = d && (c || i);
return !!h
},
repaint: function() {
var a = this.getSurface();
if (a) {
a.renderFrame()
}
},
remove: function() {
var a = this.getSurface();
if (a && a.isSurface) {
return a.remove(this)
}
return null
},
destroy: function() {
var b = this,
a = b.topModifier,
c;
while (a) {
c = a;
a = a.getPrevious();
c.destroy()
}
delete b.attr;
b.remove();
if (b.fireEvent("beforedestroy", b) !== false) {
b.fireEvent("destroy", b)
}
b.callParent()
}
}, function() {
this.def = new Ext.draw.sprite.AttributeDefinition(this.def);
this.def.spriteClass = this
});
Ext.define("Ext.draw.Path", {
requires: ["Ext.draw.Draw"],
statics: {
pathRe: /,?([achlmqrstvxz]),?/gi,
pathRe2: /-/gi,
pathSplitRe: /\s|,/g
},
svgString: "",
constructor: function(a) {
var b = this;
b.commands = [];
b.params = [];
b.cursor = null;
b.startX = 0;
b.startY = 0;
if (a) {
b.fromSvgString(a)
}
},
clear: function() {
var a = this;
a.params.length = 0;
a.commands.length = 0;
a.cursor = null;
a.startX = 0;
a.startY = 0;
a.dirt()
},
dirt: function() {
this.svgString = ""
},
moveTo: function(a, c) {
var b = this;
if (!b.cursor) {
b.cursor = [a, c]
}
b.params.push(a, c);
b.commands.push("M");
b.startX = a;
b.startY = c;
b.cursor[0] = a;
b.cursor[1] = c;
b.dirt()
},
lineTo: function(a, c) {
var b = this;
if (!b.cursor) {
b.cursor = [a, c];
b.params.push(a, c);
b.commands.push("M")
} else {
b.params.push(a, c);
b.commands.push("L")
}
b.cursor[0] = a;
b.cursor[1] = c;
b.dirt()
},
bezierCurveTo: function(c, e, b, d, a, g) {
var f = this;
if (!f.cursor) {
f.moveTo(c, e)
}
f.params.push(c, e, b, d, a, g);
f.commands.push("C");
f.cursor[0] = a;
f.cursor[1] = g;
f.dirt()
},
quadraticCurveTo: function(b, e, a, d) {
var c = this;
if (!c.cursor) {
c.moveTo(b, e)
}
c.bezierCurveTo((2 * b + c.cursor[0]) / 3, (2 * e + c.cursor[1]) / 3, (2 * b + a) / 3, (2 * e + d) / 3, a, d)
},
closePath: function() {
var a = this;
if (a.cursor) {
a.cursor = null;
a.commands.push("Z");
a.dirt()
}
},
arcTo: function(A, f, z, d, j, i, v) {
var E = this;
if (i === undefined) {
i = j
}
if (v === undefined) {
v = 0
}
if (!E.cursor) {
E.moveTo(A, f);
return
}
if (j === 0 || i === 0) {
E.lineTo(A, f);
return
}
z -= A;
d -= f;
var B = E.cursor[0] - A,
g = E.cursor[1] - f,
C = z * g - d * B,
b, a, l, r, k, q, x = Math.sqrt(B * B + g * g),
u = Math.sqrt(z * z + d * d),
t, e, c;
if (C === 0) {
E.lineTo(A, f);
return
}
if (i !== j) {
b = Math.cos(v);
a = Math.sin(v);
l = b / j;
r = a / i;
k = -a / j;
q = b / i;
var D = l * B + r * g;
g = k * B + q * g;
B = D;
D = l * z + r * d;
d = k * z + q * d;
z = D
} else {
B /= j;
g /= i;
z /= j;
d /= i
}
e = B * u + z * x;
c = g * u + d * x;
t = 1 / (Math.sin(Math.asin(Math.abs(C) / (x * u)) * 0.5) * Math.sqrt(e * e + c * c));
e *= t;
c *= t;
var o = (e * B + c * g) / (B * B + g * g),
m = (e * z + c * d) / (z * z + d * d);
var n = B * o - e,
p = g * o - c,
h = z * m - e,
y = d * m - c,
w = Math.atan2(p, n),
s = Math.atan2(y, h);
if (C > 0) {
if (s < w) {
s += Math.PI * 2
}
} else {
if (w < s) {
w += Math.PI * 2
}
}
if (i !== j) {
e = b * e * j - a * c * i + A;
c = a * c * i + b * c * i + f;
E.lineTo(b * j * n - a * i * p + e, a * j * n + b * i * p + c);
E.ellipse(e, c, j, i, v, w, s, C < 0)
} else {
e = e * j + A;
c = c * i + f;
E.lineTo(j * n + e, i * p + c);
E.ellipse(e, c, j, i, v, w, s, C < 0)
}
},
ellipse: function(h, f, c, a, q, n, d, e) {
var o = this,
g = o.params,
b = g.length,
m, l, k;
if (d - n >= Math.PI * 2) {
o.ellipse(h, f, c, a, q, n, n + Math.PI, e);
o.ellipse(h, f, c, a, q, n + Math.PI, d, e);
return
}
if (!e) {
if (d < n) {
d += Math.PI * 2
}
m = o.approximateArc(g, h, f, c, a, q, n, d)
} else {
if (n < d) {
n += Math.PI * 2
}
m = o.approximateArc(g, h, f, c, a, q, d, n);
for (l = b, k = g.length - 2; l < k; l += 2, k -= 2) {
var p = g[l];
g[l] = g[k];
g[k] = p;
p = g[l + 1];
g[l + 1] = g[k + 1];
g[k + 1] = p
}
}
if (!o.cursor) {
o.cursor = [g[g.length - 2], g[g.length - 1]];
o.commands.push("M")
} else {
o.cursor[0] = g[g.length - 2];
o.cursor[1] = g[g.length - 1];
o.commands.push("L")
}
for (l = 2; l < m; l += 6) {
o.commands.push("C")
}
o.dirt()
},
arc: function(b, f, a, d, c, e) {
this.ellipse(b, f, a, a, 0, d, c, e)
},
rect: function(b, e, c, a) {
if (c == 0 || a == 0) {
return
}
var d = this;
d.moveTo(b, e);
d.lineTo(b + c, e);
d.lineTo(b + c, e + a);
d.lineTo(b, e + a);
d.closePath()
},
approximateArc: function(s, i, f, o, n, d, x, v) {
var e = Math.cos(d),
z = Math.sin(d),
k = Math.cos(x),
l = Math.sin(x),
q = e * k * o - z * l * n,
y = -e * l * o - z * k * n,
p = z * k * o + e * l * n,
w = -z * l * o + e * k * n,
m = Math.PI / 2,
r = 2,
j = q,
u = y,
h = p,
t = w,
b = 0.547443256150549,
C, g, A, a, B, c;
v -= x;
if (v < 0) {
v += Math.PI * 2
}
s.push(q + i, p + f);
while (v >= m) {
s.push(j + u * b + i, h + t * b + f, j * b + u + i, h * b + t + f, u + i, t + f);
r += 6;
v -= m;
C = j;
j = u;
u = -C;
C = h;
h = t;
t = -C
}
if (v) {
g = (0.3294738052815987 + 0.012120855841304373 * v) * v;
A = Math.cos(v);
a = Math.sin(v);
B = A + g * a;
c = a - g * A;
s.push(j + u * g + i, h + t * g + f, j * B + u * c + i, h * B + t * c + f, j * A + u * a + i, h * A + t * a + f);
r += 6
}
return r
},
arcSvg: function(j, h, r, m, w, t, c) {
if (j < 0) {
j = -j
}
if (h < 0) {
h = -h
}
var x = this,
u = x.cursor[0],
f = x.cursor[1],
a = (u - t) / 2,
y = (f - c) / 2,
d = Math.cos(r),
s = Math.sin(r),
o = a * d + y * s,
v = -a * s + y * d,
i = o / j,
g = v / h,
p = i * i + g * g,
e = (u + t) * 0.5,
b = (f + c) * 0.5,
l = 0,
k = 0;
if (p >= 1) {
p = Math.sqrt(p);
j *= p;
h *= p
} else {
p = Math.sqrt(1 / p - 1);
if (m === w) {
p = -p
}
l = p * j * g;
k = -p * h * i;
e += d * l - s * k;
b += s * l + d * k
}
var q = Math.atan2((v - k) / h, (o - l) / j),
n = Math.atan2((-v - k) / h, (-o - l) / j) - q;
if (w) {
if (n <= 0) {
n += Math.PI * 2
}
} else {
if (n >= 0) {
n -= Math.PI * 2
}
}
x.ellipse(e, b, j, h, r, q, q + n, 1 - w)
},
fromSvgString: function(e) {
if (!e) {
return
}
var m = this,
h, l = {
a: 7,
c: 6,
h: 1,
l: 2,
m: 2,
q: 4,
s: 4,
t: 2,
v: 1,
z: 0,
A: 7,
C: 6,
H: 1,
L: 2,
M: 2,
Q: 4,
S: 4,
T: 2,
V: 1,
Z: 0
},
k = "",
g, f, c = 0,
b = 0,
d = false,
j, n, a;
if (Ext.isString(e)) {
h = e.replace(Ext.draw.Path.pathRe, " $1 ").replace(Ext.draw.Path.pathRe2, " -").split(Ext.draw.Path.pathSplitRe)
} else {
if (Ext.isArray(e)) {
h = e.join(",").split(Ext.draw.Path.pathSplitRe)
}
}
for (j = 0, n = 0; j < h.length; j++) {
if (h[j] !== "") {
h[n++] = h[j]
}
}
h.length = n;
m.clear();
for (j = 0; j < h.length;) {
k = d;
d = h[j];
a = (d.toUpperCase() !== d);
j++;
switch (d) {
case "M":
m.moveTo(c = +h[j], b = +h[j + 1]);
j += 2;
while (j < n && !l.hasOwnProperty(h[j])) {
m.lineTo(c = +h[j], b = +h[j + 1]);
j += 2
}
break;
case "L":
m.lineTo(c = +h[j], b = +h[j + 1]);
j += 2;
while (j < n && !l.hasOwnProperty(h[j])) {
m.lineTo(c = +h[j], b = +h[j + 1]);
j += 2
}
break;
case "A":
while (j < n && !l.hasOwnProperty(h[j])) {
m.arcSvg(+h[j], +h[j + 1], +h[j + 2] * Math.PI / 180, +h[j + 3], +h[j + 4], c = +h[j + 5], b = +h[j + 6]);
j += 7
}
break;
case "C":
while (j < n && !l.hasOwnProperty(h[j])) {
m.bezierCurveTo(+h[j], +h[j + 1], g = +h[j + 2], f = +h[j + 3], c = +h[j + 4], b = +h[j + 5]);
j += 6
}
break;
case "Z":
m.closePath();
break;
case "m":
m.moveTo(c += +h[j], b += +h[j + 1]);
j += 2;
while (j < n && !l.hasOwnProperty(h[j])) {
m.lineTo(c += +h[j], b += +h[j + 1]);
j += 2
}
break;
case "l":
m.lineTo(c += +h[j], b += +h[j + 1]);
j += 2;
while (j < n && !l.hasOwnProperty(h[j])) {
m.lineTo(c += +h[j], b += +h[j + 1]);
j += 2
}
break;
case "a":
while (j < n && !l.hasOwnProperty(h[j])) {
m.arcSvg(+h[j], +h[j + 1], +h[j + 2] * Math.PI / 180, +h[j + 3], +h[j + 4], c += +h[j + 5], b += +h[j + 6]);
j += 7
}
break;
case "c":
while (j < n && !l.hasOwnProperty(h[j])) {
m.bezierCurveTo(c + (+h[j]), b + (+h[j + 1]), g = c + (+h[j + 2]), f = b + (+h[j + 3]), c += +h[j + 4], b += +h[j + 5]);
j += 6
}
break;
case "z":
m.closePath();
break;
case "s":
if (!(k === "c" || k === "C" || k === "s" || k === "S")) {
g = c;
f = b
}
while (j < n && !l.hasOwnProperty(h[j])) {
m.bezierCurveTo(c + c - g, b + b - f, g = c + (+h[j]), f = b + (+h[j + 1]), c += +h[j + 2], b += +h[j + 3]);
j += 4
}
break;
case "S":
if (!(k === "c" || k === "C" || k === "s" || k === "S")) {
g = c;
f = b
}
while (j < n && !l.hasOwnProperty(h[j])) {
m.bezierCurveTo(c + c - g, b + b - f, g = +h[j], f = +h[j + 1], c = (+h[j + 2]), b = (+h[j + 3]));
j += 4
}
break;
case "q":
while (j < n && !l.hasOwnProperty(h[j])) {
m.quadraticCurveTo(g = c + (+h[j]), f = b + (+h[j + 1]), c += +h[j + 2], b += +h[j + 3]);
j += 4
}
break;
case "Q":
while (j < n && !l.hasOwnProperty(h[j])) {
m.quadraticCurveTo(g = +h[j], f = +h[j + 1], c = +h[j + 2], b = +h[j + 3]);
j += 4
}
break;
case "t":
if (!(k === "q" || k === "Q" || k === "t" || k === "T")) {
g = c;
f = b
}
while (j < n && !l.hasOwnProperty(h[j])) {
m.quadraticCurveTo(g = c + c - g, f = b + b - f, c += +h[j + 1], b += +h[j + 2]);
j += 2
}
break;
case "T":
if (!(k === "q" || k === "Q" || k === "t" || k === "T")) {
g = c;
f = b
}
while (j < n && !l.hasOwnProperty(h[j])) {
m.quadraticCurveTo(g = c + c - g, f = b + b - f, c = (+h[j + 1]), b = (+h[j + 2]));
j += 2
}
break;
case "h":
while (j < n && !l.hasOwnProperty(h[j])) {
m.lineTo(c += +h[j], b);
j++
}
break;
case "H":
while (j < n && !l.hasOwnProperty(h[j])) {
m.lineTo(c = +h[j], b);
j++
}
break;
case "v":
while (j < n && !l.hasOwnProperty(h[j])) {
m.lineTo(c, b += +h[j]);
j++
}
break;
case "V":
while (j < n && !l.hasOwnProperty(h[j])) {
m.lineTo(c, b = +h[j]);
j++
}
break
}
}
},
clone: function() {
var a = this,
b = new Ext.draw.Path();
b.params = a.params.slice(0);
b.commands = a.commands.slice(0);
b.cursor = a.cursor ? a.cursor.slice(0) : null;
b.startX = a.startX;
b.startY = a.startY;
b.svgString = a.svgString;
return b
},
transform: function(j) {
if (j.isIdentity()) {
return
}
var a = j.getXX(),
f = j.getYX(),
m = j.getDX(),
l = j.getXY(),
e = j.getYY(),
k = j.getDY(),
b = this.params,
c = 0,
d = b.length,
h, g;
for (; c < d; c += 2) {
h = b[c];
g = b[c + 1];
b[c] = h * a + g * f + m;
b[c + 1] = h * l + g * e + k
}
this.dirt()
},
getDimension: function(f) {
if (!f) {
f = {}
}
if (!this.commands || !this.commands.length) {
f.x = 0;
f.y = 0;
f.width = 0;
f.height = 0;
return f
}
f.left = Infinity;
f.top = Infinity;
f.right = -Infinity;
f.bottom = -Infinity;
var d = 0,
c = 0,
b = this.commands,
g = this.params,
e = b.length,
a, h;
for (; d < e; d++) {
switch (b[d]) {
case "M":
case "L":
a = g[c];
h = g[c + 1];
f.left = Math.min(a, f.left);
f.top = Math.min(h, f.top);
f.right = Math.max(a, f.right);
f.bottom = Math.max(h, f.bottom);
c += 2;
break;
case "C":
this.expandDimension(f, a, h, g[c], g[c + 1], g[c + 2], g[c + 3], a = g[c + 4], h = g[c + 5]);
c += 6;
break
}
}
f.x = f.left;
f.y = f.top;
f.width = f.right - f.left;
f.height = f.bottom - f.top;
return f
},
getDimensionWithTransform: function(n, f) {
if (!this.commands || !this.commands.length) {
if (!f) {
f = {}
}
f.x = 0;
f.y = 0;
f.width = 0;
f.height = 0;
return f
}
f.left = Infinity;
f.top = Infinity;
f.right = -Infinity;
f.bottom = -Infinity;
var a = n.getXX(),
k = n.getYX(),
q = n.getDX(),
p = n.getXY(),
h = n.getYY(),
o = n.getDY(),
e = 0,
d = 0,
b = this.commands,
c = this.params,
g = b.length,
m, l;
for (; e < g; e++) {
switch (b[e]) {
case "M":
case "L":
m = c[d] * a + c[d + 1] * k + q;
l = c[d] * p + c[d + 1] * h + o;
f.left = Math.min(m, f.left);
f.top = Math.min(l, f.top);
f.right = Math.max(m, f.right);
f.bottom = Math.max(l, f.bottom);
d += 2;
break;
case "C":
this.expandDimension(f, m, l, c[d] * a + c[d + 1] * k + q, c[d] * p + c[d + 1] * h + o, c[d + 2] * a + c[d + 3] * k + q, c[d + 2] * p + c[d + 3] * h + o, m = c[d + 4] * a + c[d + 5] * k + q, l = c[d + 4] * p + c[d + 5] * h + o);
d += 6;
break
}
}
if (!f) {
f = {}
}
f.x = f.left;
f.y = f.top;
f.width = f.right - f.left;
f.height = f.bottom - f.top;
return f
},
expandDimension: function(i, d, p, k, g, j, e, c, o) {
var m = this,
f = i.left,
a = i.right,
q = i.top,
n = i.bottom,
h = m.dim || (m.dim = []);
m.curveDimension(d, k, j, c, h);
f = Math.min(f, h[0]);
a = Math.max(a, h[1]);
m.curveDimension(p, g, e, o, h);
q = Math.min(q, h[0]);
n = Math.max(n, h[1]);
i.left = f;
i.right = a;
i.top = q;
i.bottom = n
},
curveDimension: function(p, n, k, j, h) {
var i = 3 * (-p + 3 * (n - k) + j),
g = 6 * (p - 2 * n + k),
f = -3 * (p - n),
o, m, e = Math.min(p, j),
l = Math.max(p, j),
q;
if (i === 0) {
if (g === 0) {
h[0] = e;
h[1] = l;
return
} else {
o = -f / g;
if (0 < o && o < 1) {
m = this.interpolate(p, n, k, j, o);
e = Math.min(e, m);
l = Math.max(l, m)
}
}
} else {
q = g * g - 4 * i * f;
if (q >= 0) {
q = Math.sqrt(q);
o = (q - g) / 2 / i;
if (0 < o && o < 1) {
m = this.interpolate(p, n, k, j, o);
e = Math.min(e, m);
l = Math.max(l, m)
}
if (q > 0) {
o -= q / i;
if (0 < o && o < 1) {
m = this.interpolate(p, n, k, j, o);
e = Math.min(e, m);
l = Math.max(l, m)
}
}
}
}
h[0] = e;
h[1] = l
},
interpolate: function(f, e, j, i, g) {
if (g === 0) {
return f
}
if (g === 1) {
return i
}
var h = (1 - g) / g;
return g * g * g * (i + h * (3 * j + h * (3 * e + h * f)))
},
fromStripes: function(g) {
var e = this,
c = 0,
d = g.length,
b, a, f;
e.clear();
for (; c < d; c++) {
f = g[c];
e.params.push.apply(e.params, f);
e.commands.push("M");
for (b = 2, a = f.length; b < a; b += 6) {
e.commands.push("C")
}
}
if (!e.cursor) {
e.cursor = []
}
e.cursor[0] = e.params[e.params.length - 2];
e.cursor[1] = e.params[e.params.length - 1];
e.dirt()
},
toStripes: function(k) {
var o = k || [],
p, n, m, b, a, h, g, f, e, c = this.commands,
d = this.params,
l = c.length;
for (f = 0, e = 0; f < l; f++) {
switch (c[f]) {
case "M":
p = [h = b = d[e++], g = a = d[e++]];
o.push(p);
break;
case "L":
n = d[e++];
m = d[e++];
p.push((b + b + n) / 3, (a + a + m) / 3, (b + n + n) / 3, (a + m + m) / 3, b = n, a = m);
break;
case "C":
p.push(d[e++], d[e++], d[e++], d[e++], b = d[e++], a = d[e++]);
break;
case "Z":
n = h;
m = g;
p.push((b + b + n) / 3, (a + a + m) / 3, (b + n + n) / 3, (a + m + m) / 3, b = n, a = m);
break
}
}
return o
},
updateSvgString: function() {
var b = [],
a = this.commands,
f = this.params,
e = a.length,
d = 0,
c = 0;
for (; d < e; d++) {
switch (a[d]) {
case "M":
b.push("M" + f[c] + "," + f[c + 1]);
c += 2;
break;
case "L":
b.push("L" + f[c] + "," + f[c + 1]);
c += 2;
break;
case "C":
b.push("C" + f[c] + "," + f[c + 1] + " " + f[c + 2] + "," + f[c + 3] + " " + f[c + 4] + "," + f[c + 5]);
c += 6;
break;
case "Z":
b.push("Z");
break
}
}
this.svgString = b.join("")
},
toString: function() {
if (!this.svgString) {
this.updateSvgString()
}
return this.svgString
}
});
Ext.define("Ext.draw.overrides.Path", {
override: "Ext.draw.Path",
rayOrigin: {
x: -10000,
y: -10000
},
isPointInPath: function(o, n) {
var m = this,
c = m.commands,
q = Ext.draw.PathUtil,
p = m.rayOrigin,
f = m.params,
l = c.length,
e = null,
d = null,
b = 0,
a = 0,
k = 0,
h, g;
for (h = 0, g = 0; h < l; h++) {
switch (c[h]) {
case "M":
if (e !== null) {
if (q.linesIntersection(e, d, b, a, p.x, p.y, o, n)) {
k += 1
}
}
e = b = f[g];
d = a = f[g + 1];
g += 2;
break;
case "L":
if (q.linesIntersection(b, a, f[g], f[g + 1], p.x, p.y, o, n)) {
k += 1
}
b = f[g];
a = f[g + 1];
g += 2;
break;
case "C":
k += q.cubicLineIntersections(b, f[g], f[g + 2], f[g + 4], a, f[g + 1], f[g + 3], f[g + 5], p.x, p.y, o, n).length;
b = f[g + 4];
a = f[g + 5];
g += 6;
break;
case "Z":
if (e !== null) {
if (q.linesIntersection(e, d, b, a, p.x, p.y, o, n)) {
k += 1
}
}
break
}
}
return k % 2 === 1
},
isPointOnPath: function(n, m) {
var l = this,
c = l.commands,
o = Ext.draw.PathUtil,
f = l.params,
k = c.length,
e = null,
d = null,
b = 0,
a = 0,
h, g;
for (h = 0, g = 0; h < k; h++) {
switch (c[h]) {
case "M":
if (e !== null) {
if (o.pointOnLine(e, d, b, a, n, m)) {
return true
}
}
e = b = f[g];
d = a = f[g + 1];
g += 2;
break;
case "L":
if (o.pointOnLine(b, a, f[g], f[g + 1], n, m)) {
return true
}
b = f[g];
a = f[g + 1];
g += 2;
break;
case "C":
if (o.pointOnCubic(b, f[g], f[g + 2], f[g + 4], a, f[g + 1], f[g + 3], f[g + 5], n, m)) {
return true
}
b = f[g + 4];
a = f[g + 5];
g += 6;
break;
case "Z":
if (e !== null) {
if (o.pointOnLine(e, d, b, a, n, m)) {
return true
}
}
break
}
}
return false
},
getSegmentIntersections: function(t, d, s, c, r, b, o, a) {
var w = this,
g = arguments.length,
v = Ext.draw.PathUtil,
f = w.commands,
u = w.params,
k = f.length,
m = null,
l = null,
h = 0,
e = 0,
x = [],
q, n, p;
for (q = 0, n = 0; q < k; q++) {
switch (f[q]) {
case "M":
if (m !== null) {
switch (g) {
case 4:
p = v.linesIntersection(m, l, h, e, t, d, s, c);
if (p) {
x.push(p)
}
break;
case 8:
p = v.cubicLineIntersections(t, s, r, o, d, c, b, a, m, l, h, e);
x.push.apply(x, p);
break
}
}
m = h = u[n];
l = e = u[n + 1];
n += 2;
break;
case "L":
switch (g) {
case 4:
p = v.linesIntersection(h, e, u[n], u[n + 1], t, d, s, c);
if (p) {
x.push(p)
}
break;
case 8:
p = v.cubicLineIntersections(t, s, r, o, d, c, b, a, h, e, u[n], u[n + 1]);
x.push.apply(x, p);
break
}
h = u[n];
e = u[n + 1];
n += 2;
break;
case "C":
switch (g) {
case 4:
p = v.cubicLineIntersections(h, u[n], u[n + 2], u[n + 4], e, u[n + 1], u[n + 3], u[n + 5], t, d, s, c);
x.push.apply(x, p);
break;
case 8:
p = v.cubicsIntersections(h, u[n], u[n + 2], u[n + 4], e, u[n + 1], u[n + 3], u[n + 5], t, s, r, o, d, c, b, a);
x.push.apply(x, p);
break
}
h = u[n + 4];
e = u[n + 5];
n += 6;
break;
case "Z":
if (m !== null) {
switch (g) {
case 4:
p = v.linesIntersection(m, l, h, e, t, d, s, c);
if (p) {
x.push(p)
}
break;
case 8:
p = v.cubicLineIntersections(t, s, r, o, d, c, b, a, m, l, h, e);
x.push.apply(x, p);
break
}
}
break
}
}
return x
},
getIntersections: function(o) {
var m = this,
c = m.commands,
g = m.params,
l = c.length,
f = null,
e = null,
b = 0,
a = 0,
d = [],
k, h, n;
for (k = 0, h = 0; k < l; k++) {
switch (c[k]) {
case "M":
if (f !== null) {
n = o.getSegmentIntersections.call(o, f, e, b, a);
d.push.apply(d, n)
}
f = b = g[h];
e = a = g[h + 1];
h += 2;
break;
case "L":
n = o.getSegmentIntersections.call(o, b, a, g[h], g[h + 1]);
d.push.apply(d, n);
b = g[h];
a = g[h + 1];
h += 2;
break;
case "C":
n = o.getSegmentIntersections.call(o, b, a, g[h], g[h + 1], g[h + 2], g[h + 3], g[h + 4], g[h + 5]);
d.push.apply(d, n);
b = g[h + 4];
a = g[h + 5];
h += 6;
break;
case "Z":
if (f !== null) {
n = o.getSegmentIntersections.call(o, f, e, b, a);
d.push.apply(d, n)
}
break
}
}
return d
}
});
Ext.define("Ext.draw.sprite.Path", {
extend: "Ext.draw.sprite.Sprite",
requires: ["Ext.draw.Draw", "Ext.draw.Path"],
alias: ["sprite.path", "Ext.draw.Sprite"],
type: "path",
isPath: true,
inheritableStatics: {
def: {
processors: {
path: function(b, a) {
if (!(b instanceof Ext.draw.Path)) {
b = new Ext.draw.Path(b)
}
return b
}
},
aliases: {
d: "path"
},
triggers: {
path: "bbox"
},
updaters: {
path: function(a) {
var b = a.path;
if (!b || b.bindAttr !== a) {
b = new Ext.draw.Path();
b.bindAttr = a;
a.path = b
}
b.clear();
this.updatePath(b, a);
this.scheduleUpdater(a, "bbox", ["path"])
}
}
}
},
updatePlainBBox: function(a) {
if (this.attr.path) {
this.attr.path.getDimension(a)
}
},
updateTransformedBBox: function(a) {
if (this.attr.path) {
this.attr.path.getDimensionWithTransform(this.attr.matrix, a)
}
},
render: function(b, c) {
var d = this.attr.matrix,
a = this.attr;
if (!a.path || a.path.params.length === 0) {
return
}
d.toContext(c);
c.appendPath(a.path);
c.fillStroke(a)
},
updatePath: function(b, a) {}
});
Ext.define("Ext.draw.overrides.sprite.Path", {
override: "Ext.draw.sprite.Path",
requires: ["Ext.draw.Color"],
isPointInPath: function(c, g) {
var b = this.attr;
if (b.fillStyle === Ext.draw.Color.RGBA_NONE) {
return this.isPointOnPath(c, g)
}
var e = b.path,
d = b.matrix,
f, a;
if (!d.isIdentity()) {
f = e.params.slice(0);
e.transform(b.matrix)
}
a = e.isPointInPath(c, g);
if (f) {
e.params = f
}
return a
},
isPointOnPath: function(c, g) {
var b = this.attr,
e = b.path,
d = b.matrix,
f, a;
if (!d.isIdentity()) {
f = e.params.slice(0);
e.transform(b.matrix)
}
a = e.isPointOnPath(c, g);
if (f) {
e.params = f
}
return a
},
hitTest: function(i, l) {
var e = this,
c = e.attr,
k = c.path,
g = c.matrix,
h = i[0],
f = i[1],
d = e.callParent([i, l]),
j = null,
a, b;
if (!d) {
return j
}
l = l || Ext.draw.sprite.Sprite.defaultHitTestOptions;
if (!g.isIdentity()) {
a = k.params.slice(0);
k.transform(c.matrix)
}
if (l.fill && l.stroke) {
b = c.fillStyle !== Ext.draw.Color.NONE && c.fillStyle !== Ext.draw.Color.RGBA_NONE;
if (b) {
if (k.isPointInPath(h, f)) {
j = {
sprite: e
}
}
} else {
if (k.isPointInPath(h, f) || k.isPointOnPath(h, f)) {
j = {
sprite: e
}
}
}
} else {
if (l.stroke && !l.fill) {
if (k.isPointOnPath(h, f)) {
j = {
sprite: e
}
}
} else {
if (l.fill && !l.stroke) {
if (k.isPointInPath(h, f)) {
j = {
sprite: e
}
}
}
}
}
if (a) {
k.params = a
}
return j
},
getIntersections: function(j) {
if (!(j.isSprite && j.isPath)) {
return []
}
var e = this.attr,
d = j.attr,
i = e.path,
h = d.path,
g = e.matrix,
a = d.matrix,
c, f, b;
if (!g.isIdentity()) {
c = i.params.slice(0);
i.transform(e.matrix)
}
if (!a.isIdentity()) {
f = h.params.slice(0);
h.transform(d.matrix)
}
b = i.getIntersections(h);
if (c) {
i.params = c
}
if (f) {
h.params = f
}
return b
}
});
Ext.define("Ext.draw.sprite.Circle", {
extend: "Ext.draw.sprite.Path",
alias: "sprite.circle",
type: "circle",
inheritableStatics: {
def: {
processors: {
cx: "number",
cy: "number",
r: "number"
},
aliases: {
radius: "r",
x: "cx",
y: "cy",
centerX: "cx",
centerY: "cy"
},
defaults: {
cx: 0,
cy: 0,
r: 4
},
triggers: {
cx: "path",
cy: "path",
r: "path"
}
}
},
updatePlainBBox: function(c) {
var b = this.attr,
a = b.cx,
e = b.cy,
d = b.r;
c.x = a - d;
c.y = e - d;
c.width = d + d;
c.height = d + d
},
updateTransformedBBox: function(d) {
var g = this.attr,
f = g.cx,
e = g.cy,
a = g.r,
h = g.matrix,
j = h.getScaleX(),
i = h.getScaleY(),
c, b;
c = j * a;
b = i * a;
d.x = h.x(f, e) - c;
d.y = h.y(f, e) - b;
d.width = c + c;
d.height = b + b
},
updatePath: function(b, a) {
b.arc(a.cx, a.cy, a.r, 0, Math.PI * 2, false)
}
});
Ext.define("Ext.draw.sprite.Arc", {
extend: "Ext.draw.sprite.Circle",
alias: "sprite.arc",
type: "arc",
inheritableStatics: {
def: {
processors: {
startAngle: "number",
endAngle: "number",
anticlockwise: "bool"
},
aliases: {
from: "startAngle",
to: "endAngle",
start: "startAngle",
end: "endAngle"
},
defaults: {
startAngle: 0,
endAngle: Math.PI * 2,
anticlockwise: false
},
triggers: {
startAngle: "path",
endAngle: "path",
anticlockwise: "path"
}
}
},
updatePath: function(b, a) {
b.arc(a.cx, a.cy, a.r, a.startAngle, a.endAngle, a.anticlockwise)
}
});
Ext.define("Ext.draw.sprite.Arrow", {
extend: "Ext.draw.sprite.Path",
alias: "sprite.arrow",
inheritableStatics: {
def: {
processors: {
x: "number",
y: "number",
size: "number"
},
defaults: {
x: 0,
y: 0,
size: 4
},
triggers: {
x: "path",
y: "path",
size: "path"
}
}
},
updatePath: function(d, b) {
var c = b.size * 1.5,
a = b.x - b.lineWidth / 2,
e = b.y;
d.fromSvgString("M".concat(a - c * 0.7, ",", e - c * 0.4, "l", [c * 0.6, 0, 0, -c * 0.4, c, c * 0.8, -c, c * 0.8, 0, -c * 0.4, -c * 0.6, 0], "z"))
}
});
Ext.define("Ext.draw.sprite.Composite", {
extend: "Ext.draw.sprite.Sprite",
alias: "sprite.composite",
type: "composite",
isComposite: true,
config: {
sprites: []
},
constructor: function() {
this.sprites = [];
this.sprites.map = {};
this.callParent(arguments)
},
add: function(c) {
if (!c) {
return null
}
if (!c.isSprite) {
c = Ext.create("sprite." + c.type, c);
c.setParent(this);
c.setSurface(this.getSurface())
}
var d = this,
a = d.attr,
b = c.applyTransformations;
c.applyTransformations = function() {
if (c.attr.dirtyTransform) {
a.dirtyTransform = true;
a.bbox.plain.dirty = true;
a.bbox.transform.dirty = true
}
b.call(c)
};
d.sprites.push(c);
d.sprites.map[c.id] = c.getId();
a.bbox.plain.dirty = true;
a.bbox.transform.dirty = true;
return c
},
updateSurface: function(a) {
for (var b = 0, c = this.sprites.length; b < c; b++) {
this.sprites[b].setSurface(a)
}
},
addAll: function(b) {
if (b.isSprite || b.type) {
this.add(b)
} else {
if (Ext.isArray(b)) {
var a = 0;
while (a < b.length) {
this.add(b[a++])
}
}
}
},
updatePlainBBox: function(g) {
var e = this,
b = Infinity,
h = -Infinity,
f = Infinity,
a = -Infinity,
j, k, c, d;
for (c = 0, d = e.sprites.length; c < d; c++) {
j = e.sprites[c];
j.applyTransformations();
k = j.getBBox();
if (b > k.x) {
b = k.x
}
if (h < k.x + k.width) {
h = k.x + k.width
}
if (f > k.y) {
f = k.y
}
if (a < k.y + k.height) {
a = k.y + k.height
}
}
g.x = b;
g.y = f;
g.width = h - b;
g.height = a - f
},
render: function(a, b, f) {
var d = this.attr.matrix,
c, e;
d.toContext(b);
for (c = 0, e = this.sprites.length; c < e; c++) {
a.renderSprite(this.sprites[c], f)
}
},
destroy: function() {
var c = this,
d = c.sprites,
b = d.length,
a;
c.callParent();
for (a = 0; a < b; a++) {
d[a].destroy()
}
d.length = 0
}
});
Ext.define("Ext.draw.sprite.Cross", {
extend: "Ext.draw.sprite.Path",
alias: "sprite.cross",
inheritableStatics: {
def: {
processors: {
x: "number",
y: "number",
size: "number"
},
defaults: {
x: 0,
y: 0,
size: 4
},
triggers: {
x: "path",
y: "path",
size: "path"
}
}
},
updatePath: function(d, b) {
var c = b.size / 1.7,
a = b.x - b.lineWidth / 2,
e = b.y;
d.fromSvgString("M".concat(a - c, ",", e, "l", [-c, -c, c, -c, c, c, c, -c, c, c, -c, c, c, c, -c, c, -c, -c, -c, c, -c, -c, "z"]))
}
});
Ext.define("Ext.draw.sprite.Diamond", {
extend: "Ext.draw.sprite.Path",
alias: "sprite.diamond",
inheritableStatics: {
def: {
processors: {
x: "number",
y: "number",
size: "number"
},
defaults: {
x: 0,
y: 0,
size: 4
},
triggers: {
x: "path",
y: "path",
size: "path"
}
}
},
updatePath: function(d, b) {
var c = b.size * 1.25,
a = b.x - b.lineWidth / 2,
e = b.y;
d.fromSvgString(["M", a, e - c, "l", c, c, -c, c, -c, -c, c, -c, "z"])
}
});
Ext.define("Ext.draw.sprite.Ellipse", {
extend: "Ext.draw.sprite.Path",
alias: "sprite.ellipse",
type: "ellipse",
inheritableStatics: {
def: {
processors: {
cx: "number",
cy: "number",
rx: "number",
ry: "number",
axisRotation: "number"
},
aliases: {
radius: "r",
x: "cx",
y: "cy",
centerX: "cx",
centerY: "cy",
radiusX: "rx",
radiusY: "ry"
},
defaults: {
cx: 0,
cy: 0,
rx: 1,
ry: 1,
axisRotation: 0
},
triggers: {
cx: "path",
cy: "path",
rx: "path",
ry: "path",
axisRotation: "path"
}
}
},
updatePlainBBox: function(c) {
var b = this.attr,
a = b.cx,
f = b.cy,
e = b.rx,
d = b.ry;
c.x = a - e;
c.y = f - d;
c.width = e + e;
c.height = d + d
},
updateTransformedBBox: function(d) {
var i = this.attr,
f = i.cx,
e = i.cy,
c = i.rx,
b = i.ry,
l = b / c,
m = i.matrix.clone(),
a, q, k, j, p, o, n, g;
m.append(1, 0, 0, l, 0, e * (1 - l));
a = m.getXX();
k = m.getYX();
p = m.getDX();
q = m.getXY();
j = m.getYY();
o = m.getDY();
n = Math.sqrt(a * a + k * k) * c;
g = Math.sqrt(q * q + j * j) * c;
d.x = f * a + e * k + p - n;
d.y = f * q + e * j + o - g;
d.width = n + n;
d.height = g + g
},
updatePath: function(b, a) {
b.ellipse(a.cx, a.cy, a.rx, a.ry, a.axisRotation, 0, Math.PI * 2, false)
}
});
Ext.define("Ext.draw.sprite.EllipticalArc", {
extend: "Ext.draw.sprite.Ellipse",
alias: "sprite.ellipticalArc",
type: "ellipticalArc",
inheritableStatics: {
def: {
processors: {
startAngle: "number",
endAngle: "number",
anticlockwise: "bool"
},
aliases: {
from: "startAngle",
to: "endAngle",
start: "startAngle",
end: "endAngle"
},
defaults: {
startAngle: 0,
endAngle: Math.PI * 2,
anticlockwise: false
},
triggers: {
startAngle: "path",
endAngle: "path",
anticlockwise: "path"
}
}
},
updatePath: function(b, a) {
b.ellipse(a.cx, a.cy, a.rx, a.ry, a.axisRotation, a.startAngle, a.endAngle, a.anticlockwise)
}
});
Ext.define("Ext.draw.sprite.Rect", {
extend: "Ext.draw.sprite.Path",
alias: "sprite.rect",
type: "rect",
inheritableStatics: {
def: {
processors: {
x: "number",
y: "number",
width: "number",
height: "number",
radius: "number"
},
aliases: {},
triggers: {
x: "path",
y: "path",
width: "path",
height: "path",
radius: "path"
},
defaults: {
x: 0,
y: 0,
width: 8,
height: 8,
radius: 0
}
}
},
updatePlainBBox: function(b) {
var a = this.attr;
b.x = a.x;
b.y = a.y;
b.width = a.width;
b.height = a.height
},
updateTransformedBBox: function(a, b) {
this.attr.matrix.transformBBox(b, this.attr.radius, a)
},
updatePath: function(f, d) {
var c = d.x,
g = d.y,
e = d.width,
b = d.height,
a = Math.min(d.radius, Math.abs(d.height) * 0.5, Math.abs(d.width) * 0.5);
if (a === 0) {
f.rect(c, g, e, b)
} else {
f.moveTo(c + a, g);
f.arcTo(c + e, g, c + e, g + b, a);
f.arcTo(c + e, g + b, c, g + b, a);
f.arcTo(c, g + b, c, g, a);
f.arcTo(c, g, c + a, g, a)
}
}
});
Ext.define("Ext.draw.sprite.Image", {
extend: "Ext.draw.sprite.Rect",
alias: "sprite.image",
type: "image",
statics: {
imageLoaders: {}
},
inheritableStatics: {
def: {
processors: {
src: "string"
},
defaults: {
src: "",
width: null,
height: null
}
}
},
render: function(c, o) {
var j = this,
h = j.attr,
n = h.matrix,
a = h.src,
l = h.x,
k = h.y,
b = h.width,
m = h.height,
g = Ext.draw.sprite.Image.imageLoaders[a],
f, d, e;
if (g && g.done) {
n.toContext(o);
d = g.image;
o.drawImage(d, l, k, b || (d.naturalWidth || d.width) / c.devicePixelRatio, m || (d.naturalHeight || d.height) / c.devicePixelRatio)
} else {
if (!g) {
f = new Image();
g = Ext.draw.sprite.Image.imageLoaders[a] = {
image: f,
done: false,
pendingSprites: [j],
pendingSurfaces: [c]
};
f.width = b;
f.height = m;
f.onload = function() {
if (!g.done) {
g.done = true;
for (e = 0; e < g.pendingSprites.length; e++) {
g.pendingSprites[e].setDirty(true)
}
for (e in g.pendingSurfaces) {
g.pendingSurfaces[e].renderFrame()
}
}
};
f.src = a
} else {
Ext.Array.include(g.pendingSprites, j);
Ext.Array.include(g.pendingSurfaces, c)
}
}
}
});
Ext.define("Ext.draw.sprite.Instancing", {
extend: "Ext.draw.sprite.Sprite",
alias: "sprite.instancing",
type: "instancing",
isInstancing: true,
config: {
template: null
},
instances: null,
applyTemplate: function(a) {
if (!a.isSprite) {
if (!a.xclass && !a.type) {
a.type = "circle"
}
a = Ext.create(a.xclass || "sprite." + a.type, a)
}
a.setParent(this);
return a
},
updateTemplate: function(a, b) {
if (b) {
delete b.ownAttr
}
a.setSurface(this.getSurface());
a.ownAttr = a.attr;
this.clearAll()
},
updateSurface: function(a) {
var b = this.getTemplate();
if (b) {
b.setSurface(a)
}
},
get: function(a) {
return this.instances[a]
},
getCount: function() {
return this.instances.length
},
clearAll: function() {
var a = this.getTemplate();
a.attr.children = this.instances = [];
this.position = 0
},
createInstance: function(d, f, c) {
var e = this.getTemplate(),
b = e.attr,
a = Ext.Object.chain(b);
e.topModifier.prepareAttributes(a);
e.attr = a;
e.setAttributes(d, f, c);
a.template = e;
this.instances.push(a);
e.attr = b;
this.position++;
return a
},
getBBox: function() {
return null
},
getBBoxFor: function(b, d) {
var c = this.getTemplate(),
a = c.attr,
e;
c.attr = this.instances[b];
e = c.getBBox(d);
c.attr = a;
return e
},
isVisible: function() {
var b = this.attr,
c = this.getParent(),
a;
a = c && c.isSurface && !b.hidden && b.globalAlpha;
return !!a
},
isInstanceVisible: function(c) {
var e = this,
d = e.getTemplate(),
b = d.attr,
f = e.instances,
a = false;
if (!Ext.isNumber(c) || c < 0 || c >= f.length || !e.isVisible()) {
return a
}
d.attr = f[c];
a = d.isVisible(point, options);
d.attr = b;
return a
},
render: function(b, l, d, h) {
var g = this,
j = g.getTemplate(),
k = g.attr.matrix,
c = j.attr,
a = g.instances,
e, f = g.position;
k.toContext(l);
j.preRender(b, l, d, h);
j.useAttributes(l, h);
for (e = 0; e < f; e++) {
if (a[e].dirtyZIndex) {
break
}
}
for (e = 0; e < f; e++) {
if (a[e].hidden) {
continue
}
l.save();
j.attr = a[e];
j.useAttributes(l, h);
j.render(b, l, d, h);
l.restore()
}
j.attr = c
},
setAttributesFor: function(c, e, f) {
var d = this.getTemplate(),
b = d.attr,
a = this.instances[c];
if (!a) {
return
}
d.attr = a;
if (f) {
e = Ext.apply({}, e)
} else {
e = d.self.def.normalize(e)
}
d.topModifier.pushDown(a, e);
d.attr = b
},
destroy: function() {
var b = this,
a = b.getTemplate();
b.instances = null;
if (a) {
a.destroy()
}
b.callParent()
}
});
Ext.define("Ext.draw.overrides.sprite.Instancing", {
override: "Ext.draw.sprite.Instancing",
hitTest: function(f, j) {
var e = this,
g = e.getTemplate(),
b = g.attr,
a = e.instances,
d = a.length,
c = 0,
h = null;
if (!e.isVisible()) {
return h
}
for (; c < d; c++) {
g.attr = a[c];
h = g.hitTest(f, j);
if (h) {
h.isInstance = true;
h.template = h.sprite;
h.sprite = this;
h.instance = a[c];
h.index = c;
return h
}
}
g.attr = b;
return h
}
});
Ext.define("Ext.draw.sprite.Line", {
extend: "Ext.draw.sprite.Sprite",
alias: "sprite.line",
type: "line",
inheritableStatics: {
def: {
processors: {
fromX: "number",
fromY: "number",
toX: "number",
toY: "number"
},
defaults: {
fromX: 0,
fromY: 0,
toX: 1,
toY: 1,
strokeStyle: "black"
},
aliases: {
x1: "fromX",
y1: "fromY",
x2: "toX",
y2: "toY"
}
}
},
updateLineBBox: function(b, i, s, g, r, f) {
var o = this.attr,
q = o.matrix,
h = o.lineWidth / 2,
m, l, d, c, k, j, n;
if (i) {
n = q.transformPoint([s, g]);
s = n[0];
g = n[1];
n = q.transformPoint([r, f]);
r = n[0];
f = n[1]
}
m = Math.min(s, r);
d = Math.max(s, r);
l = Math.min(g, f);
c = Math.max(g, f);
var t = Math.atan2(d - m, c - l),
a = Math.sin(t),
e = Math.cos(t),
k = h * e,
j = h * a;
m -= k;
l -= j;
d += k;
c += j;
b.x = m;
b.y = l;
b.width = d - m;
b.height = c - l
},
updatePlainBBox: function(b) {
var a = this.attr;
this.updateLineBBox(b, false, a.fromX, a.fromY, a.toX, a.toY)
},
updateTransformedBBox: function(b, c) {
var a = this.attr;
this.updateLineBBox(b, true, a.fromX, a.fromY, a.toX, a.toY)
},
render: function(b, c) {
var a = this.attr,
d = this.attr.matrix;
d.toContext(c);
c.beginPath();
c.moveTo(a.fromX, a.fromY);
c.lineTo(a.toX, a.toY);
c.stroke()
}
});
Ext.define("Ext.draw.sprite.Plus", {
extend: "Ext.draw.sprite.Path",
alias: "sprite.plus",
inheritableStatics: {
def: {
processors: {
x: "number",
y: "number",
size: "number"
},
defaults: {
x: 0,
y: 0,
size: 4
},
triggers: {
x: "path",
y: "path",
size: "path"
}
}
},
updatePath: function(d, b) {
var c = b.size / 1.3,
a = b.x - b.lineWidth / 2,
e = b.y;
d.fromSvgString("M".concat(a - c / 2, ",", e - c / 2, "l", [0, -c, c, 0, 0, c, c, 0, 0, c, -c, 0, 0, c, -c, 0, 0, -c, -c, 0, 0, -c, "z"]))
}
});
Ext.define("Ext.draw.sprite.Sector", {
extend: "Ext.draw.sprite.Path",
alias: "sprite.sector",
type: "sector",
inheritableStatics: {
def: {
processors: {
centerX: "number",
centerY: "number",
startAngle: "number",
endAngle: "number",
startRho: "number",
endRho: "number",
margin: "number"
},
aliases: {
rho: "endRho"
},
triggers: {
centerX: "path,bbox",
centerY: "path,bbox",
startAngle: "path,bbox",
endAngle: "path,bbox",
startRho: "path,bbox",
endRho: "path,bbox",
margin: "path,bbox"
},
defaults: {
centerX: 0,
centerY: 0,
startAngle: 0,
endAngle: 0,
startRho: 0,
endRho: 150,
margin: 0,
path: "M 0,0"
}
}
},
getMidAngle: function() {
return this.midAngle || 0
},
updatePath: function(j, h) {
var g = Math.min(h.startAngle, h.endAngle),
c = Math.max(h.startAngle, h.endAngle),
b = this.midAngle = (g + c) * 0.5,
d = h.margin,
f = h.centerX,
e = h.centerY,
i = Math.min(h.startRho, h.endRho),
a = Math.max(h.startRho, h.endRho);
if (d) {
f += d * Math.cos(b);
e += d * Math.sin(b)
}
j.moveTo(f + i * Math.cos(g), e + i * Math.sin(g));
j.lineTo(f + a * Math.cos(g), e + a * Math.sin(g));
j.arc(f, e, a, g, c, false);
j.lineTo(f + i * Math.cos(c), e + i * Math.sin(c));
j.arc(f, e, i, c, g, true)
}
});
Ext.define("Ext.draw.sprite.Square", {
extend: "Ext.draw.sprite.Rect",
alias: "sprite.square",
inheritableStatics: {
def: {
processors: {
size: "number"
},
defaults: {
size: 4
},
triggers: {
size: "size"
},
updaters: {
size: function(a) {
var c = a.size,
b = a.lineWidth / 2;
this.setAttributes({
x: a.x - c - b,
y: a.y - c,
height: 2 * c,
width: 2 * c
})
}
}
}
}
});
Ext.define("Ext.draw.TextMeasurer", {
singleton: true,
requires: ["Ext.util.TextMetrics"],
measureDiv: null,
measureCache: {},
precise: Ext.isIE8,
measureDivTpl: {
tag: "div",
style: {
overflow: "hidden",
position: "relative",
"float": "left",
width: 0,
height: 0
},
children: {
tag: "div",
style: {
display: "block",
position: "absolute",
x: -100000,
y: -100000,
padding: 0,
margin: 0,
"z-index": -100000,
"white-space": "nowrap"
}
}
},
actualMeasureText: function(g, b) {
var e = Ext.draw.TextMeasurer,
f = e.measureDiv,
a = 100000,
c;
if (!f) {
var d = Ext.Element.create({
style: {
overflow: "hidden",
position: "relative",
"float": "left",
width: 0,
height: 0
}
});
e.measureDiv = f = Ext.Element.create({
style: {
position: "absolute",
x: a,
y: a,
"z-index": -a,
"white-space": "nowrap",
display: "block",
padding: 0,
margin: 0
}
});
Ext.getBody().appendChild(d);
d.appendChild(f)
}
if (b) {
f.setStyle({
font: b,
lineHeight: "normal"
})
}
f.setText("(" + g + ")");
c = f.getSize();
f.setText("()");
c.width -= f.getSize().width;
return c
},
measureTextSingleLine: function(h, d) {
if (this.precise) {
return this.preciseMeasureTextSingleLine(h, d)
}
h = h.toString();
var a = this.measureCache,
g = h.split(""),
c = 0,
j = 0,
l, b, e, f, k;
if (!a[d]) {
a[d] = {}
}
a = a[d];
if (a[h]) {
return a[h]
}
for (e = 0, f = g.length; e < f; e++) {
b = g[e];
if (!(l = a[b])) {
k = this.actualMeasureText(b, d);
l = a[b] = k
}
c += l.width;
j = Math.max(j, l.height)
}
return a[h] = {
width: c,
height: j
}
},
preciseMeasureTextSingleLine: function(c, a) {
c = c.toString();
var b = this.measureDiv || (this.measureDiv = Ext.getBody().createChild(this.measureDivTpl).down("div"));
b.setStyle({
font: a || ""
});
return Ext.util.TextMetrics.measure(b, c)
},
measureText: function(e, b) {
var h = e.split("\n"),
d = h.length,
f = 0,
a = 0,
j, c, g;
if (d === 1) {
return this.measureTextSingleLine(e, b)
}
g = [];
for (c = 0; c < d; c++) {
j = this.measureTextSingleLine(h[c], b);
g.push(j);
f += j.height;
a = Math.max(a, j.width)
}
return {
width: a,
height: f,
sizes: g
}
}
});
Ext.define("Ext.draw.sprite.Text", function() {
var d = {
"xx-small": true,
"x-small": true,
small: true,
medium: true,
large: true,
"x-large": true,
"xx-large": true
};
var b = {
normal: true,
bold: true,
bolder: true,
lighter: true,
100: true,
200: true,
300: true,
400: true,
500: true,
600: true,
700: true,
800: true,
900: true
};
var a = {
start: "start",
left: "start",
center: "center",
middle: "center",
end: "end",
right: "end"
};
var c = {
top: "top",
hanging: "hanging",
middle: "middle",
center: "middle",
alphabetic: "alphabetic",
ideographic: "ideographic",
bottom: "bottom"
};
return {
extend: "Ext.draw.sprite.Sprite",
requires: ["Ext.draw.TextMeasurer", "Ext.draw.Color"],
alias: "sprite.text",
type: "text",
lineBreakRe: /\r?\n/g,
inheritableStatics: {
def: {
animationProcessors: {
text: "text"
},
processors: {
x: "number",
y: "number",
text: "string",
fontSize: function(e) {
if (Ext.isNumber(+e)) {
return e + "px"
} else {
if (e.match(Ext.dom.Element.unitRe)) {
return e
} else {
if (e in d) {
return e
}
}
}
},
fontStyle: "enums(,italic,oblique)",
fontVariant: "enums(,small-caps)",
fontWeight: function(e) {
if (e in b) {
return String(e)
} else {
return ""
}
},
fontFamily: "string",
textAlign: function(e) {
return a[e] || "center"
},
textBaseline: function(e) {
return c[e] || "alphabetic"
},
font: "string"
},
aliases: {
"font-size": "fontSize",
"font-family": "fontFamily",
"font-weight": "fontWeight",
"font-variant": "fontVariant",
"text-anchor": "textAlign"
},
defaults: {
fontStyle: "",
fontVariant: "",
fontWeight: "",
fontSize: "10px",
fontFamily: "sans-serif",
font: "10px sans-serif",
textBaseline: "alphabetic",
textAlign: "start",
strokeStyle: "rgba(0, 0, 0, 0)",
fillStyle: "#000",
x: 0,
y: 0,
text: ""
},
triggers: {
fontStyle: "fontX,bbox",
fontVariant: "fontX,bbox",
fontWeight: "fontX,bbox",
fontSize: "fontX,bbox",
fontFamily: "fontX,bbox",
font: "font,bbox,canvas",
textBaseline: "bbox",
textAlign: "bbox",
x: "bbox",
y: "bbox",
text: "bbox"
},
updaters: {
fontX: "makeFontShorthand",
font: "parseFontShorthand"
}
}
},
constructor: function(e) {
if (e && e.font) {
e = Ext.clone(e);
for (var f in e) {
if (f !== "font" && f.indexOf("font") === 0) {
delete e[f]
}
}
}
Ext.draw.sprite.Sprite.prototype.constructor.call(this, e)
},
fontValuesMap: {
italic: "fontStyle",
oblique: "fontStyle",
"small-caps": "fontVariant",
bold: "fontWeight",
bolder: "fontWeight",
lighter: "fontWeight",
"100": "fontWeight",
"200": "fontWeight",
"300": "fontWeight",
"400": "fontWeight",
"500": "fontWeight",
"600": "fontWeight",
"700": "fontWeight",
"800": "fontWeight",
"900": "fontWeight",
"xx-small": "fontSize",
"x-small": "fontSize",
small: "fontSize",
medium: "fontSize",
large: "fontSize",
"x-large": "fontSize",
"xx-large": "fontSize"
},
makeFontShorthand: function(e) {
var f = [];
if (e.fontStyle) {
f.push(e.fontStyle)
}
if (e.fontVariant) {
f.push(e.fontVariant)
}
if (e.fontWeight) {
f.push(e.fontWeight)
}
if (e.fontSize) {
f.push(e.fontSize)
}
if (e.fontFamily) {
f.push(e.fontFamily)
}
this.setAttributes({
font: f.join(" ")
}, true)
},
parseFontShorthand: function(j) {
var m = j.font,
k = m.length,
l = {},
n = this.fontValuesMap,
e = 0,
i, g, f, h;
while (e < k && i !== -1) {
i = m.indexOf(" ", e);
if (i < 0) {
f = m.substr(e)
} else {
if (i > e) {
f = m.substr(e, i - e)
} else {
continue
}
}
g = f.indexOf("/");
if (g > 0) {
f = f.substr(0, g)
} else {
if (g === 0) {
continue
}
}
if (f !== "normal" && f !== "inherit") {
h = n[f];
if (h) {
l[h] = f
} else {
if (f.match(Ext.dom.Element.unitRe)) {
l.fontSize = f
} else {
l.fontFamily = m.substr(e);
break
}
}
}
e = i + 1
}
if (!l.fontStyle) {
l.fontStyle = ""
}
if (!l.fontVariant) {
l.fontVariant = ""
}
if (!l.fontWeight) {
l.fontWeight = ""
}
this.setAttributes(l, true)
},
fontProperties: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
fontFamily: true
},
setAttributes: function(g, i, e) {
var f, h;
if (g && g.font) {
h = {};
for (f in g) {
if (!(f in this.fontProperties)) {
h[f] = g[f]
}
}
g = h
}
this.callParent([g, i, e])
},
getBBox: function(g) {
var h = this,
f = h.attr.bbox.plain,
e = h.getSurface();
if (f.dirty) {
h.updatePlainBBox(f);
f.dirty = false
}
if (e.getInherited().rtl && e.getFlipRtlText()) {
h.updatePlainBBox(f, true)
}
return h.callParent([g])
},
rtlAlignments: {
start: "end",
center: "center",
end: "start"
},
updatePlainBBox: function(k, B) {
var C = this,
w = C.attr,
o = w.x,
n = w.y,
q = [],
t = w.font,
r = w.text,
s = w.textBaseline,
l = w.textAlign,
u = (B && C.oldSize) ? C.oldSize : (C.oldSize = Ext.draw.TextMeasurer.measureText(r, t)),
z = C.getSurface(),
p = z.getInherited().rtl,
v = p && z.getFlipRtlText(),
h = z.getRect(),
f = u.sizes,
g = u.height,
j = u.width,
m = f ? f.length : 0,
e, A = 0;
switch (s) {
case "hanging":
case "top":
break;
case "ideographic":
case "bottom":
n -= g;
break;
case "alphabetic":
n -= g * 0.8;
break;
case "middle":
n -= g * 0.5;
break
}
if (v) {
o = h[2] - h[0] - o;
l = C.rtlAlignments[l]
}
switch (l) {
case "start":
if (p) {
for (; A < m; A++) {
e = f[A].width;
q.push(-(j - e))
}
}
break;
case "end":
o -= j;
if (p) {
break
}
for (; A < m; A++) {
e = f[A].width;
q.push(j - e)
}
break;
case "center":
o -= j * 0.5;
for (; A < m; A++) {
e = f[A].width;
q.push((p ? -1 : 1) * (j - e) * 0.5)
}
break
}
w.textAlignOffsets = q;
k.x = o;
k.y = n;
k.width = j;
k.height = g
},
setText: function(e) {
this.setAttributes({
text: e
}, true)
},
render: function(e, q, k) {
var h = this,
g = h.attr,
p = Ext.draw.Matrix.fly(g.matrix.elements.slice(0)),
o = h.getBBox(true),
s = g.textAlignOffsets,
m = Ext.draw.Color.RGBA_NONE,
l, j, f, r, n;
if (g.text.length === 0) {
return
}
r = g.text.split(h.lineBreakRe);
n = o.height / r.length;
l = g.bbox.plain.x;
j = g.bbox.plain.y + n * 0.78;
p.toContext(q);
if (e.getInherited().rtl) {
l += g.bbox.plain.width
}
for (f = 0; f < r.length; f++) {
if (q.fillStyle !== m) {
q.fillText(r[f], l + (s[f] || 0), j + n * f)
}
if (q.strokeStyle !== m) {
q.strokeText(r[f], l + (s[f] || 0), j + n * f)
}
}
}
}
});
Ext.define("Ext.draw.sprite.Tick", {
extend: "Ext.draw.sprite.Line",
alias: "sprite.tick",
inheritableStatics: {
def: {
processors: {
x: "number",
y: "number",
size: "number"
},
defaults: {
x: 0,
y: 0,
size: 4
},
triggers: {
x: "tick",
y: "tick",
size: "tick"
},
updaters: {
tick: function(b) {
var d = b.size * 1.5,
c = b.lineWidth / 2,
a = b.x,
e = b.y;
this.setAttributes({
fromX: a - c,
fromY: e - d,
toX: a - c,
toY: e + d
})
}
}
}
}
});
Ext.define("Ext.draw.sprite.Triangle", {
extend: "Ext.draw.sprite.Path",
alias: "sprite.triangle",
inheritableStatics: {
def: {
processors: {
x: "number",
y: "number",
size: "number"
},
defaults: {
x: 0,
y: 0,
size: 4
},
triggers: {
x: "path",
y: "path",
size: "path"
}
}
},
updatePath: function(d, b) {
var c = b.size * 2.2,
a = b.x,
e = b.y;
d.fromSvgString("M".concat(a, ",", e, "m0-", c * 0.58, "l", c * 0.5, ",", c * 0.87, "-", c, ",0z"))
}
});
Ext.define("Ext.draw.gradient.Linear", {
extend: "Ext.draw.gradient.Gradient",
requires: ["Ext.draw.Color"],
type: "linear",
config: {
degrees: 0,
radians: 0
},
applyRadians: function(b, a) {
if (Ext.isNumber(b)) {
return b
}
return a
},
applyDegrees: function(b, a) {
if (Ext.isNumber(b)) {
return b
}
return a
},
updateRadians: function(a) {
this.setDegrees(Ext.draw.Draw.degrees(a))
},
updateDegrees: function(a) {
this.setRadians(Ext.draw.Draw.rad(a))
},
generateGradient: function(q, o) {
var c = this.getRadians(),
p = Math.cos(c),
j = Math.sin(c),
m = o.width,
f = o.height,
d = o.x + m * 0.5,
b = o.y + f * 0.5,
n = this.getStops(),
g = n.length,
k, a, e;
if (Ext.isNumber(d + b) && f > 0 && m > 0) {
a = (Math.sqrt(f * f + m * m) * Math.abs(Math.cos(c - Math.atan(f / m)))) / 2;
k = q.createLinearGradient(d + p * a, b + j * a, d - p * a, b - j * a);
for (e = 0; e < g; e++) {
k.addColorStop(n[e].offset, n[e].color)
}
return k
}
return Ext.draw.Color.NONE
}
});
Ext.define("Ext.draw.gradient.Radial", {
extend: "Ext.draw.gradient.Gradient",
type: "radial",
config: {
start: {
x: 0,
y: 0,
r: 0
},
end: {
x: 0,
y: 0,
r: 1
}
},
applyStart: function(a, b) {
if (!b) {
return a
}
var c = {
x: b.x,
y: b.y,
r: b.r
};
if ("x" in a) {
c.x = a.x
} else {
if ("centerX" in a) {
c.x = a.centerX
}
}
if ("y" in a) {
c.y = a.y
} else {
if ("centerY" in a) {
c.y = a.centerY
}
}
if ("r" in a) {
c.r = a.r
} else {
if ("radius" in a) {
c.r = a.radius
}
}
return c
},
applyEnd: function(b, a) {
if (!a) {
return b
}
var c = {
x: a.x,
y: a.y,
r: a.r
};
if ("x" in b) {
c.x = b.x
} else {
if ("centerX" in b) {
c.x = b.centerX
}
}
if ("y" in b) {
c.y = b.y
} else {
if ("centerY" in b) {
c.y = b.centerY
}
}
if ("r" in b) {
c.r = b.r
} else {
if ("radius" in b) {
c.r = b.radius
}
}
return c
},
generateGradient: function(n, m) {
var a = this.getStart(),
b = this.getEnd(),
k = m.width * 0.5,
d = m.height * 0.5,
j = m.x + k,
f = m.y + d,
g = n.createRadialGradient(j + a.x * k, f + a.y * d, a.r * Math.max(k, d), j + b.x * k, f + b.y * d, b.r * Math.max(k, d)),
l = this.getStops(),
e = l.length,
c;
for (c = 0; c < e; c++) {
g.addColorStop(l[c].offset, l[c].color)
}
return g
}
});
Ext.define("Ext.draw.Surface", {
extend: "Ext.draw.SurfaceBase",
xtype: "surface",
requires: ["Ext.draw.sprite.*", "Ext.draw.gradient.*", "Ext.draw.sprite.AttributeDefinition", "Ext.draw.Matrix", "Ext.draw.Draw"],
uses: ["Ext.draw.engine.Canvas"],
devicePixelRatio: window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI,
deprecated: {
"5.1.0": {
statics: {
methods: {
stableSort: function(a) {
return Ext.Array.sort(a, function(d, c) {
return d.attr.zIndex - c.attr.zIndex
})
}
}
}
}
},
config: {
cls: Ext.baseCSSPrefix + "surface",
rect: null,
background: null,
items: [],
dirty: false,
flipRtlText: false
},
isSurface: true,
isPendingRenderFrame: false,
dirtyPredecessorCount: 0,
constructor: function(a) {
var b = this;
b.predecessors = [];
b.successors = [];
b.map = {};
b.callParent([a]);
b.matrix = new Ext.draw.Matrix();
b.inverseMatrix = b.matrix.inverse()
},
roundPixel: function(a) {
return Math.round(this.devicePixelRatio * a) / this.devicePixelRatio
},
waitFor: function(a) {
var b = this,
c = b.predecessors;
if (!Ext.Array.contains(c, a)) {
c.push(a);
a.successors.push(b);
if (a.getDirty()) {
b.dirtyPredecessorCount++
}
}
},
updateDirty: function(d) {
var c = this.successors,
e = c.length,
b = 0,
a;
for (; b < e; b++) {
a = c[b];
if (d) {
a.dirtyPredecessorCount++;
a.setDirty(true)
} else {
a.dirtyPredecessorCount--;
if (a.dirtyPredecessorCount === 0 && a.isPendingRenderFrame) {
a.renderFrame()
}
}
}
},
applyBackground: function(a, b) {
this.setDirty(true);
if (Ext.isString(a)) {
a = {
fillStyle: a
}
}
return Ext.factory(a, Ext.draw.sprite.Rect, b)
},
applyRect: function(a, b) {
if (b && a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]) {
return
}
if (Ext.isArray(a)) {
return [a[0], a[1], a[2], a[3]]
} else {
if (Ext.isObject(a)) {
return [a.x || a.left, a.y || a.top, a.width || (a.right - a.left), a.height || (a.bottom - a.top)]
}
}
},
updateRect: function(i) {
var h = this,
c = i[0],
f = i[1],
g = c + i[2],
a = f + i[3],
e = h.getBackground(),
d = h.element;
d.setLocalXY(Math.floor(c), Math.floor(f));
d.setSize(Math.ceil(g - Math.floor(c)), Math.ceil(a - Math.floor(f)));
if (e) {
e.setAttributes({
x: 0,
y: 0,
width: Math.ceil(g - Math.floor(c)),
height: Math.ceil(a - Math.floor(f))
})
}
h.setDirty(true)
},
resetTransform: function() {
this.matrix.set(1, 0, 0, 1, 0, 0);
this.inverseMatrix.set(1, 0, 0, 1, 0, 0);
this.setDirty(true)
},
get: function(a) {
return this.map[a] || this.getItems()[a]
},
add: function() {
var g = this,
e = Array.prototype.slice.call(arguments),
j = Ext.isArray(e[0]),
a = g.map,
c = [],
f, k, h, b, d;
f = Ext.Array.clean(j ? e[0] : e);
if (!f.length) {
return c
}
for (b = 0, d = f.length; b < d; b++) {
k = f[b];
h = null;
if (k.isSprite && !a[k.getId()]) {
h = k
} else {
if (!a[k.id]) {
h = this.createItem(k)
}
}
if (h) {
a[h.getId()] = h;
c.push(h);
h.setParent(g);
h.setSurface(g);
g.onAdd(h)
}
}
f = g.getItems();
if (f) {
f.push.apply(f, c)
}
g.dirtyZIndex = true;
g.setDirty(true);
if (!j && c.length === 1) {
return c[0]
} else {
return c
}
},
onAdd: Ext.emptyFn,
remove: function(a, c) {
var b = this,
e, d;
if (a) {
if (a.charAt) {
a = b.map[a]
}
if (!a || !a.isSprite) {
return null
}
if (a.isDestroyed || a.isDestroying) {
return a
}
e = a.getId();
d = b.map[e];
delete b.map[e];
if (c) {
a.destroy()
}
if (!d) {
return a
}
a.setParent(null);
a.setSurface(null);
Ext.Array.remove(b.getItems(), a);
b.dirtyZIndex = true;
b.setDirty(true)
}
return a || null
},
removeAll: function(d) {
var a = this.getItems(),
b = a.length - 1,
c;
if (d) {
for (; b >= 0; b--) {
a[b].destroy()
}
} else {
for (; b >= 0; b--) {
c = a[b];
c.setParent(null);
c.setSurface(null)
}
}
a.length = 0;
this.map = {};
this.dirtyZIndex = true
},
applyItems: function(a) {
if (this.getItems()) {
this.removeAll(true)
}
return Ext.Array.from(this.add(a))
},
createItem: function(a) {
return Ext.create(a.xclass || "sprite." + a.type, a)
},
getBBox: function(f, b) {
var f = Ext.Array.from(f),
c = Infinity,
h = -Infinity,
g = Infinity,
a = -Infinity,
j, k, d, e;
for (d = 0, e = f.length; d < e; d++) {
j = f[d];
k = j.getBBox(b);
if (c > k.x) {
c = k.x
}
if (h < k.x + k.width) {
h = k.x + k.width
}
if (g > k.y) {
g = k.y
}
if (a < k.y + k.height) {
a = k.y + k.height
}
}
return {
x: c,
y: g,
width: h - c,
height: a - g
}
},
emptyRect: [0, 0, 0, 0],
getEventXY: function(d) {
var g = this,
f = g.getInherited().rtl,
c = d.getXY(),
a = g.getOwnerBody(),
i = a.getXY(),
h = g.getRect() || g.emptyRect,
j = [],
b;
if (f) {
b = a.getWidth();
j[0] = i[0] - c[0] - h[0] + b
} else {
j[0] = c[0] - i[0] - h[0]
}
j[1] = c[1] - i[1] - h[1];
return j
},
clear: Ext.emptyFn,
orderByZIndex: function() {
var d = this,
a = d.getItems(),
e = false,
b, c;
if (d.getDirty()) {
for (b = 0, c = a.length; b < c; b++) {
if (a[b].attr.dirtyZIndex) {
e = true;
break
}
}
if (e) {
Ext.Array.sort(a, function(g, f) {
return g.attr.zIndex - f.attr.zIndex
});
this.setDirty(true)
}
for (b = 0, c = a.length; b < c; b++) {
a[b].attr.dirtyZIndex = false
}
}
},
repaint: function() {
var a = this;
a.repaint = Ext.emptyFn;
Ext.defer(function() {
delete a.repaint;
a.element.repaint()
}, 1)
},
renderFrame: function() {
var g = this;
if (!g.element) {
return
}
if (g.dirtyPredecessorCount > 0) {
g.isPendingRenderFrame = true;
return
}
var f = g.getRect(),
c = g.getBackground(),
a = g.getItems(),
e, b, d;
if (!f) {
return
}
g.orderByZIndex();
if (g.getDirty()) {
g.clear();
g.clearTransform();
if (c) {
g.renderSprite(c)
}
for (b = 0, d = a.length; b < d; b++) {
e = a[b];
if (g.renderSprite(e) === false) {
return
}
e.attr.textPositionCount = g.textPosition
}
g.setDirty(false)
}
},
renderSprite: Ext.emptyFn,
clearTransform: Ext.emptyFn,
destroy: function() {
var a = this;
a.removeAll(true);
a.predecessors = null;
a.successors = null;
a.callParent()
}
});
Ext.define("Ext.draw.overrides.Surface", {
override: "Ext.draw.Surface",
hitTest: function(b, c) {
var f = this,
g = f.getItems(),
e, d, a;
c = c || Ext.draw.sprite.Sprite.defaultHitTestOptions;
for (e = g.length - 1; e >= 0; e--) {
d = g[e];
if (d.hitTest) {
a = d.hitTest(b, c);
if (a) {
return a
}
}
}
return null
},
hitTestEvent: function(b, a) {
var c = this.getEventXY(b);
return this.hitTest(c, a)
}
});
Ext.define("Ext.draw.engine.SvgContext", {
requires: ["Ext.draw.Color"],
toSave: ["strokeOpacity", "strokeStyle", "fillOpacity", "fillStyle", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "lineDash", "lineDashOffset", "miterLimit", "shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor", "globalCompositeOperation", "position", "fillGradient", "strokeGradient"],
strokeOpacity: 1,
strokeStyle: "none",
fillOpacity: 1,
fillStyle: "none",
lineDash: [],
lineDashOffset: 0,
globalAlpha: 1,
lineWidth: 1,
lineCap: "butt",
lineJoin: "miter",
miterLimit: 10,
shadowOffsetX: 0,
shadowOffsetY: 0,
shadowBlur: 0,
shadowColor: "none",
globalCompositeOperation: "src",
urlStringRe: /^url\(#([\w\-]+)\)$/,
constructor: function(a) {
this.surface = a;
this.state = [];
this.matrix = new Ext.draw.Matrix();
this.path = null;
this.clear()
},
clear: function() {
this.group = this.surface.mainGroup;
this.position = 0;
this.path = null
},
getElement: function(a) {
return this.surface.getSvgElement(this.group, a, this.position++)
},
removeElement: function(d) {
var d = Ext.fly(d),
h, g, b, f, a, e, c;
if (!d) {
return
}
if (d.dom.tagName === "g") {
a = d.dom.gradients;
for (c in a) {
a[c].destroy()
}
} else {
h = d.getAttribute("fill");
g = d.getAttribute("stroke");
b = h && h.match(this.urlStringRe);
f = g && g.match(this.urlStringRe);
if (b && b[1]) {
e = Ext.fly(b[1]);
if (e) {
e.destroy()
}
}
if (f && f[1]) {
e = Ext.fly(f[1]);
if (e) {
e.destroy()
}
}
}
d.destroy()
},
save: function() {
var c = this.toSave,
e = {},
d = this.getElement("g"),
b, a;
for (a = 0; a < c.length; a++) {
b = c[a];
if (b in this) {
e[b] = this[b]
}
}
this.position = 0;
e.matrix = this.matrix.clone();
this.state.push(e);
this.group = d;
return d
},
restore: function() {
var d = this.toSave,
e = this.state.pop(),
c = this.group.dom.childNodes,
b, a;
while (c.length > this.position) {
this.removeElement(c[c.length - 1])
}
for (a = 0; a < d.length; a++) {
b = d[a];
if (b in e) {
this[b] = e[b]
} else {
delete this[b]
}
}
this.setTransform.apply(this, e.matrix.elements);
this.group = this.group.getParent()
},
transform: function(f, b, e, g, d, c) {
if (this.path) {
var a = Ext.draw.Matrix.fly([f, b, e, g, d, c]).inverse();
this.path.transform(a)
}
this.matrix.append(f, b, e, g, d, c)
},
setTransform: function(e, a, d, f, c, b) {
if (this.path) {
this.path.transform(this.matrix)
}
this.matrix.reset();
this.transform(e, a, d, f, c, b)
},
scale: function(a, b) {
this.transform(a, 0, 0, b, 0, 0)
},
rotate: function(d) {
var c = Math.cos(d),
a = Math.sin(d),
b = -Math.sin(d),
e = Math.cos(d);
this.transform(c, a, b, e, 0, 0)
},
translate: function(a, b) {
this.transform(1, 0, 0, 1, a, b)
},
setGradientBBox: function(a) {
this.bbox = a
},
beginPath: function() {
this.path = new Ext.draw.Path()
},
moveTo: function(a, b) {
if (!this.path) {
this.beginPath()
}
this.path.moveTo(a, b);
this.path.element = null
},
lineTo: function(a, b) {
if (!this.path) {
this.beginPath()
}
this.path.lineTo(a, b);
this.path.element = null
},
rect: function(b, d, c, a) {
this.moveTo(b, d);
this.lineTo(b + c, d);
this.lineTo(b + c, d + a);
this.lineTo(b, d + a);
this.closePath()
},
strokeRect: function(b, d, c, a) {
this.beginPath();
this.rect(b, d, c, a);
this.stroke()
},
fillRect: function(b, d, c, a) {
this.beginPath();
this.rect(b, d, c, a);
this.fill()
},
closePath: function() {
if (!this.path) {
this.beginPath()
}
this.path.closePath();
this.path.element = null
},
arcSvg: function(d, a, f, g, c, b, e) {
if (!this.path) {
this.beginPath()
}
this.path.arcSvg(d, a, f, g, c, b, e);
this.path.element = null
},
arc: function(b, f, a, d, c, e) {
if (!this.path) {
this.beginPath()
}
this.path.arc(b, f, a, d, c, e);
this.path.element = null
},
ellipse: function(a, h, g, f, d, c, b, e) {
if (!this.path) {
this.beginPath()
}
this.path.ellipse(a, h, g, f, d, c, b, e);
this.path.element = null
},
arcTo: function(b, e, a, d, g, f, c) {
if (!this.path) {
this.beginPath()
}
this.path.arcTo(b, e, a, d, g, f, c);
this.path.element = null
},
bezierCurveTo: function(d, f, b, e, a, c) {
if (!this.path) {
this.beginPath()
}
this.path.bezierCurveTo(d, f, b, e, a, c);
this.path.element = null
},
strokeText: function(d, a, e) {
d = String(d);
if (this.strokeStyle) {
var b = this.getElement("text"),
c = this.surface.getSvgElement(b, "tspan", 0);
this.surface.setElementAttributes(b, {
x: a,
y: e,
transform: this.matrix.toSvg(),
stroke: this.strokeStyle,
fill: "none",
opacity: this.globalAlpha,
"stroke-opacity": this.strokeOpacity,
style: "font: " + this.font,
"stroke-dasharray": this.lineDash.join(","),
"stroke-dashoffset": this.lineDashOffset
});
if (this.lineDash.length) {
this.surface.setElementAttributes(b, {
"stroke-dasharray": this.lineDash.join(","),
"stroke-dashoffset": this.lineDashOffset
})
}
if (c.dom.firstChild) {
c.dom.removeChild(c.dom.firstChild)
}
this.surface.setElementAttributes(c, {
"alignment-baseline": "alphabetic"
});
c.dom.appendChild(document.createTextNode(Ext.String.htmlDecode(d)))
}
},
fillText: function(d, a, e) {
d = String(d);
if (this.fillStyle) {
var b = this.getElement("text"),
c = this.surface.getSvgElement(b, "tspan", 0);
this.surface.setElementAttributes(b, {
x: a,
y: e,
transform: this.matrix.toSvg(),
fill: this.fillStyle,
opacity: this.globalAlpha,
"fill-opacity": this.fillOpacity,
style: "font: " + this.font
});
if (c.dom.firstChild) {
c.dom.removeChild(c.dom.firstChild)
}
this.surface.setElementAttributes(c, {
"alignment-baseline": "alphabetic"
});
c.dom.appendChild(document.createTextNode(Ext.String.htmlDecode(d)))
}
},
drawImage: function(c, k, i, l, e, p, n, a, g) {
var f = this,
d = f.getElement("image"),
j = k,
h = i,
b = typeof l === "undefined" ? c.width : l,
m = typeof e === "undefined" ? c.height : e,
o = null;
if (typeof g !== "undefined") {
o = k + " " + i + " " + l + " " + e;
j = p;
h = n;
b = a;
m = g
}
d.dom.setAttributeNS("http://www.w3.org/1999/xlink", "href", c.src);
f.surface.setElementAttributes(d, {
viewBox: o,
x: j,
y: h,
width: b,
height: m,
opacity: f.globalAlpha,
transform: f.matrix.toSvg()
})
},
fill: function() {
if (!this.path) {
return
}
if (this.fillStyle) {
var c, a = this.fillGradient,
d = this.bbox,
b = this.path.element;
if (!b) {
c = this.path.toString();
b = this.path.element = this.getElement("path");
this.surface.setElementAttributes(b, {
d: c,
transform: this.matrix.toSvg()
})
}
this.surface.setElementAttributes(b, {
fill: a && d ? a.generateGradient(this, d) : this.fillStyle,
"fill-opacity": this.fillOpacity * this.globalAlpha
})
}
},
stroke: function() {
if (!this.path) {
return
}
if (this.strokeStyle) {
var c, b = this.strokeGradient,
d = this.bbox,
a = this.path.element;
if (!a || !this.path.svgString) {
c = this.path.toString();
if (!c) {
return
}
a = this.path.element = this.getElement("path");
this.surface.setElementAttributes(a, {
fill: "none",
d: c,
transform: this.matrix.toSvg()
})
}
this.surface.setElementAttributes(a, {
stroke: b && d ? b.generateGradient(this, d) : this.strokeStyle,
"stroke-linecap": this.lineCap,
"stroke-linejoin": this.lineJoin,
"stroke-width": this.lineWidth,
"stroke-opacity": this.strokeOpacity * this.globalAlpha,
"stroke-dasharray": this.lineDash.join(","),
"stroke-dashoffset": this.lineDashOffset
});
if (this.lineDash.length) {
this.surface.setElementAttributes(a, {
"stroke-dasharray": this.lineDash.join(","),
"stroke-dashoffset": this.lineDashOffset
})
}
}
},
fillStroke: function(a, e) {
var b = this,
d = b.fillStyle,
g = b.strokeStyle,
c = b.fillOpacity,
f = b.strokeOpacity;
if (e === undefined) {
e = a.transformFillStroke
}
if (!e) {
a.inverseMatrix.toContext(b)
}
if (d && c !== 0) {
b.fill()
}
if (g && f !== 0) {
b.stroke()
}
},
appendPath: function(a) {
this.path = a.clone()
},
setLineDash: function(a) {
this.lineDash = a
},
getLineDash: function() {
return this.lineDash
},
createLinearGradient: function(d, g, b, e) {
var f = this,
c = f.surface.getNextDef("linearGradient"),
a = f.group.dom.gradients || (f.group.dom.gradients = {}),
h;
f.surface.setElementAttributes(c, {
x1: d,
y1: g,
x2: b,
y2: e,
gradientUnits: "userSpaceOnUse"
});
h = new Ext.draw.engine.SvgContext.Gradient(f, f.surface, c);
a[c.dom.id] = h;
return h
},
createRadialGradient: function(b, j, d, a, i, c) {
var g = this,
e = g.surface.getNextDef("radialGradient"),
f = g.group.dom.gradients || (g.group.dom.gradients = {}),
h;
g.surface.setElementAttributes(e, {
fx: b,
fy: j,
cx: a,
cy: i,
r: c,
gradientUnits: "userSpaceOnUse"
});
h = new Ext.draw.engine.SvgContext.Gradient(g, g.surface, e, d / c);
f[e.dom.id] = h;
return h
}
});
Ext.define("Ext.draw.engine.SvgContext.Gradient", {
statics: {
map: {}
},
constructor: function(c, a, d, b) {
var f = this.statics().map,
e;
e = f[d.dom.id];
if (e) {
e.element = null
}
f[d.dom.id] = this;
this.ctx = c;
this.surface = a;
this.element = d;
this.position = 0;
this.compression = b || 0
},
addColorStop: function(d, b) {
var c = this.surface.getSvgElement(this.element, "stop", this.position++),
a = this.compression;
this.surface.setElementAttributes(c, {
offset: (((1 - a) * d + a) * 100).toFixed(2) + "%",
"stop-color": b,
"stop-opacity": Ext.draw.Color.fly(b).a.toFixed(15)
})
},
toString: function() {
var a = this.element.dom.childNodes;
while (a.length > this.position) {
Ext.fly(a[a.length - 1]).destroy()
}
return "url(#" + this.element.getId() + ")"
},
destroy: function() {
var b = this.statics().map,
a = this.element;
if (a && a.dom) {
delete b[a.dom.id];
a.destroy()
}
this.callParent()
}
});
Ext.define("Ext.draw.engine.Svg", {
extend: "Ext.draw.Surface",
requires: ["Ext.draw.engine.SvgContext"],
statics: {
BBoxTextCache: {}
},
config: {
highPrecision: false
},
getElementConfig: function() {
return {
reference: "element",
style: {
position: "absolute"
},
children: [{
reference: "innerElement",
style: {
width: "100%",
height: "100%",
position: "relative"
},
children: [{
tag: "svg",
reference: "svgElement",
namespace: "http://www.w3.org/2000/svg",
width: "100%",
height: "100%",
version: 1.1
}]
}]
}
},
constructor: function(a) {
var b = this;
b.callParent([a]);
b.mainGroup = b.createSvgNode("g");
b.defElement = b.createSvgNode("defs");
b.svgElement.appendChild(b.mainGroup);
b.svgElement.appendChild(b.defElement);
b.ctx = new Ext.draw.engine.SvgContext(b)
},
createSvgNode: function(a) {
var b = document.createElementNS("http://www.w3.org/2000/svg", a);
return Ext.get(b)
},
getSvgElement: function(d, b, a) {
var c;
if (d.dom.childNodes.length > a) {
c = d.dom.childNodes[a];
if (c.tagName === b) {
return Ext.get(c)
} else {
Ext.destroy(c)
}
}
c = Ext.get(this.createSvgNode(b));
if (a === 0) {
d.insertFirst(c)
} else {
c.insertAfter(Ext.fly(d.dom.childNodes[a - 1]))
}
c.cache = {};
return c
},
setElementAttributes: function(d, b) {
var f = d.dom,
a = d.cache,
c, e;
for (c in b) {
e = b[c];
if (a[c] !== e) {
a[c] = e;
f.setAttribute(c, e)
}
}
},
getNextDef: function(a) {
return this.getSvgElement(this.defElement, a, this.defPosition++)
},
clearTransform: function() {
var a = this;
a.mainGroup.set({
transform: a.matrix.toSvg()
})
},
clear: function() {
this.ctx.clear();
this.defPosition = 0
},
renderSprite: function(b) {
var d = this,
c = d.getRect(),
a = d.ctx;
if (b.attr.hidden || b.attr.globalAlpha === 0) {
a.save();
a.restore();
return
}
b.element = a.save();
b.preRender(this);
b.useAttributes(a, c);
if (false === b.render(this, a, [0, 0, c[2], c[3]])) {
return false
}
b.setDirty(false);
a.restore()
},
flatten: function(e, b) {
var c = '',
f = Ext.getClassName(this),
a, g, d;
c += '";
return {
data: "data:image/svg+xml;utf8," + encodeURIComponent(c),
type: "svg"
}
},
serializeNode: function(d) {
var b = "",
c, f, a, e;
if (d.nodeType === document.TEXT_NODE) {
return d.nodeValue
}
b += "<" + d.nodeName;
if (d.attributes.length) {
for (c = 0, f = d.attributes.length; c < f; c++) {
a = d.attributes[c];
b += " " + a.name + '="' + a.value + '"'
}
}
b += ">";
if (d.childNodes && d.childNodes.length) {
for (c = 0, f = d.childNodes.length; c < f; c++) {
e = d.childNodes[c];
b += this.serializeNode(e)
}
}
b += "" + d.nodeName + ">";
return b
},
destroy: function() {
var a = this;
a.ctx.destroy();
a.mainGroup.destroy();
delete a.mainGroup;
delete a.ctx;
a.callParent()
},
remove: function(a, b) {
if (a && a.element) {
if (this.ctx) {
this.ctx.removeElement(a.element)
} else {
a.element.destroy()
}
a.element = null
}
this.callParent(arguments)
}
});
Ext.draw || (Ext.draw = {});
Ext.draw.engine || (Ext.draw.engine = {});
Ext.draw.engine.excanvas = true;
if (!document.createElement("canvas").getContext) {
(function() {
var ab = Math;
var n = ab.round;
var l = ab.sin;
var A = ab.cos;
var H = ab.abs;
var N = ab.sqrt;
var d = 10;
var f = d / 2;
var z = +navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];
function y() {
return this.context_ || (this.context_ = new D(this))
}
var t = Array.prototype.slice;
function g(j, m, p) {
var i = t.call(arguments, 2);
return function() {
return j.apply(m, i.concat(t.call(arguments)))
}
}
function af(i) {
return String(i).replace(/&/g, "&").replace(/"/g, """)
}
function Y(m, j, i) {
Ext.onReady(function() {
if (!m.namespaces[j]) {
m.namespaces.add(j, i, "#default#VML")
}
})
}
function R(j) {
Y(j, "g_vml_", "urn:schemas-microsoft-com:vml");
Y(j, "g_o_", "urn:schemas-microsoft-com:office:office");
if (!j.styleSheets.ex_canvas_) {
var i = j.createStyleSheet();
i.owningElement.id = "ex_canvas_";
i.cssText = "canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"
}
}
R(document);
var e = {
init: function(i) {
var j = i || document;
j.createElement("canvas");
j.attachEvent("onreadystatechange", g(this.init_, this, j))
},
init_: function(p) {
var m = p.getElementsByTagName("canvas");
for (var j = 0; j < m.length; j++) {
this.initElement(m[j])
}
},
initElement: function(j) {
if (!j.getContext) {
j.getContext = y;
R(j.ownerDocument);
j.innerHTML = "";
j.attachEvent("onpropertychange", x);
j.attachEvent("onresize", W);
var i = j.attributes;
if (i.width && i.width.specified) {
j.style.width = i.width.nodeValue + "px"
} else {
j.width = j.clientWidth
}
if (i.height && i.height.specified) {
j.style.height = i.height.nodeValue + "px"
} else {
j.height = j.clientHeight
}
}
return j
}
};
function x(j) {
var i = j.srcElement;
switch (j.propertyName) {
case "width":
i.getContext().clearRect();
i.style.width = i.attributes.width.nodeValue + "px";
i.firstChild.style.width = i.clientWidth + "px";
break;
case "height":
i.getContext().clearRect();
i.style.height = i.attributes.height.nodeValue + "px";
i.firstChild.style.height = i.clientHeight + "px";
break
}
}
function W(j) {
var i = j.srcElement;
if (i.firstChild) {
i.firstChild.style.width = i.clientWidth + "px";
i.firstChild.style.height = i.clientHeight + "px"
}
}
e.init();
var k = [];
for (var ae = 0; ae < 16; ae++) {
for (var ad = 0; ad < 16; ad++) {
k[ae * 16 + ad] = ae.toString(16) + ad.toString(16)
}
}
function B() {
return [
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]
]
}
function J(p, m) {
var j = B();
for (var i = 0; i < 3; i++) {
for (var ah = 0; ah < 3; ah++) {
var Z = 0;
for (var ag = 0; ag < 3; ag++) {
Z += p[i][ag] * m[ag][ah]
}
j[i][ah] = Z
}
}
return j
}
function v(j, i) {
i.fillStyle = j.fillStyle;
i.lineCap = j.lineCap;
i.lineJoin = j.lineJoin;
i.lineDash = j.lineDash;
i.lineWidth = j.lineWidth;
i.miterLimit = j.miterLimit;
i.shadowBlur = j.shadowBlur;
i.shadowColor = j.shadowColor;
i.shadowOffsetX = j.shadowOffsetX;
i.shadowOffsetY = j.shadowOffsetY;
i.strokeStyle = j.strokeStyle;
i.globalAlpha = j.globalAlpha;
i.font = j.font;
i.textAlign = j.textAlign;
i.textBaseline = j.textBaseline;
i.arcScaleX_ = j.arcScaleX_;
i.arcScaleY_ = j.arcScaleY_;
i.lineScale_ = j.lineScale_
}
var b = {
aliceblue: "#F0F8FF",
antiquewhite: "#FAEBD7",
aquamarine: "#7FFFD4",
azure: "#F0FFFF",
beige: "#F5F5DC",
bisque: "#FFE4C4",
black: "#000000",
blanchedalmond: "#FFEBCD",
blueviolet: "#8A2BE2",
brown: "#A52A2A",
burlywood: "#DEB887",
cadetblue: "#5F9EA0",
chartreuse: "#7FFF00",
chocolate: "#D2691E",
coral: "#FF7F50",
cornflowerblue: "#6495ED",
cornsilk: "#FFF8DC",
crimson: "#DC143C",
cyan: "#00FFFF",
darkblue: "#00008B",
darkcyan: "#008B8B",
darkgoldenrod: "#B8860B",
darkgray: "#A9A9A9",
darkgreen: "#006400",
darkgrey: "#A9A9A9",
darkkhaki: "#BDB76B",
darkmagenta: "#8B008B",
darkolivegreen: "#556B2F",
darkorange: "#FF8C00",
darkorchid: "#9932CC",
darkred: "#8B0000",
darksalmon: "#E9967A",
darkseagreen: "#8FBC8F",
darkslateblue: "#483D8B",
darkslategray: "#2F4F4F",
darkslategrey: "#2F4F4F",
darkturquoise: "#00CED1",
darkviolet: "#9400D3",
deeppink: "#FF1493",
deepskyblue: "#00BFFF",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1E90FF",
firebrick: "#B22222",
floralwhite: "#FFFAF0",
forestgreen: "#228B22",
gainsboro: "#DCDCDC",
ghostwhite: "#F8F8FF",
gold: "#FFD700",
goldenrod: "#DAA520",
grey: "#808080",
greenyellow: "#ADFF2F",
honeydew: "#F0FFF0",
hotpink: "#FF69B4",
indianred: "#CD5C5C",
indigo: "#4B0082",
ivory: "#FFFFF0",
khaki: "#F0E68C",
lavender: "#E6E6FA",
lavenderblush: "#FFF0F5",
lawngreen: "#7CFC00",
lemonchiffon: "#FFFACD",
lightblue: "#ADD8E6",
lightcoral: "#F08080",
lightcyan: "#E0FFFF",
lightgoldenrodyellow: "#FAFAD2",
lightgreen: "#90EE90",
lightgrey: "#D3D3D3",
lightpink: "#FFB6C1",
lightsalmon: "#FFA07A",
lightseagreen: "#20B2AA",
lightskyblue: "#87CEFA",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#B0C4DE",
lightyellow: "#FFFFE0",
limegreen: "#32CD32",
linen: "#FAF0E6",
magenta: "#FF00FF",
mediumaquamarine: "#66CDAA",
mediumblue: "#0000CD",
mediumorchid: "#BA55D3",
mediumpurple: "#9370DB",
mediumseagreen: "#3CB371",
mediumslateblue: "#7B68EE",
mediumspringgreen: "#00FA9A",
mediumturquoise: "#48D1CC",
mediumvioletred: "#C71585",
midnightblue: "#191970",
mintcream: "#F5FFFA",
mistyrose: "#FFE4E1",
moccasin: "#FFE4B5",
navajowhite: "#FFDEAD",
oldlace: "#FDF5E6",
olivedrab: "#6B8E23",
orange: "#FFA500",
orangered: "#FF4500",
orchid: "#DA70D6",
palegoldenrod: "#EEE8AA",
palegreen: "#98FB98",
paleturquoise: "#AFEEEE",
palevioletred: "#DB7093",
papayawhip: "#FFEFD5",
peachpuff: "#FFDAB9",
peru: "#CD853F",
pink: "#FFC0CB",
plum: "#DDA0DD",
powderblue: "#B0E0E6",
rosybrown: "#BC8F8F",
royalblue: "#4169E1",
saddlebrown: "#8B4513",
salmon: "#FA8072",
sandybrown: "#F4A460",
seagreen: "#2E8B57",
seashell: "#FFF5EE",
sienna: "#A0522D",
skyblue: "#87CEEB",
slateblue: "#6A5ACD",
slategray: "#708090",
slategrey: "#708090",
snow: "#FFFAFA",
springgreen: "#00FF7F",
steelblue: "#4682B4",
tan: "#D2B48C",
thistle: "#D8BFD8",
tomato: "#FF6347",
turquoise: "#40E0D0",
violet: "#EE82EE",
wheat: "#F5DEB3",
whitesmoke: "#F5F5F5",
yellowgreen: "#9ACD32"
};
function M(j) {
var p = j.indexOf("(", 3);
var i = j.indexOf(")", p + 1);
var m = j.substring(p + 1, i).split(",");
if (m.length != 4 || j.charAt(3) != "a") {
m[3] = 1
}
return m
}
function c(i) {
return parseFloat(i) / 100
}
function r(j, m, i) {
return Math.min(i, Math.max(m, j))
}
function I(ag) {
var i, ai, aj, ah, ak, Z;
ah = parseFloat(ag[0]) / 360 % 360;
if (ah < 0) {
ah++
}
ak = r(c(ag[1]), 0, 1);
Z = r(c(ag[2]), 0, 1);
if (ak == 0) {
i = ai = aj = Z
} else {
var j = Z < 0.5 ? Z * (1 + ak) : Z + ak - Z * ak;
var m = 2 * Z - j;
i = a(m, j, ah + 1 / 3);
ai = a(m, j, ah);
aj = a(m, j, ah - 1 / 3)
}
return "#" + k[Math.floor(i * 255)] + k[Math.floor(ai * 255)] + k[Math.floor(aj * 255)]
}
function a(j, i, m) {
if (m < 0) {
m++
}
if (m > 1) {
m--
}
if (6 * m < 1) {
return j + (i - j) * 6 * m
} else {
if (2 * m < 1) {
return i
} else {
if (3 * m < 2) {
return j + (i - j) * (2 / 3 - m) * 6
} else {
return j
}
}
}
}
var C = {};
function F(j) {
if (j in C) {
return C[j]
}
var ag, Z = 1;
j = String(j);
if (j.charAt(0) == "#") {
ag = j
} else {
if (/^rgb/.test(j)) {
var p = M(j);
var ag = "#",
ah;
for (var m = 0; m < 3; m++) {
if (p[m].indexOf("%") != -1) {
ah = Math.floor(c(p[m]) * 255)
} else {
ah = +p[m]
}
ag += k[r(ah, 0, 255)]
}
Z = +p[3]
} else {
if (/^hsl/.test(j)) {
var p = M(j);
ag = I(p);
Z = p[3]
} else {
ag = b[j] || j
}
}
}
return C[j] = {
color: ag,
alpha: Z
}
}
var o = {
style: "normal",
variant: "normal",
weight: "normal",
size: 10,
family: "sans-serif"
};
var L = {};
function E(i) {
if (L[i]) {
return L[i]
}
var p = document.createElement("div");
var m = p.style;
try {
m.font = i
} catch (j) {}
return L[i] = {
style: m.fontStyle || o.style,
variant: m.fontVariant || o.variant,
weight: m.fontWeight || o.weight,
size: m.fontSize || o.size,
family: m.fontFamily || o.family
}
}
function u(m, j) {
var i = {};
for (var ah in m) {
i[ah] = m[ah]
}
var ag = parseFloat(j.currentStyle.fontSize),
Z = parseFloat(m.size);
if (typeof m.size == "number") {
i.size = m.size
} else {
if (m.size.indexOf("px") != -1) {
i.size = Z
} else {
if (m.size.indexOf("em") != -1) {
i.size = ag * Z
} else {
if (m.size.indexOf("%") != -1) {
i.size = (ag / 100) * Z
} else {
if (m.size.indexOf("pt") != -1) {
i.size = Z / 0.75
} else {
i.size = ag
}
}
}
}
}
i.size *= 0.981;
return i
}
function ac(i) {
return i.style + " " + i.variant + " " + i.weight + " " + i.size + "px " + i.family
}
var s = {
butt: "flat",
round: "round"
};
function S(i) {
return s[i] || "square"
}
function D(i) {
this.m_ = B();
this.mStack_ = [];
this.aStack_ = [];
this.currentPath_ = [];
this.strokeStyle = "#000";
this.fillStyle = "#000";
this.lineWidth = 1;
this.lineJoin = "miter";
this.lineDash = [];
this.lineCap = "butt";
this.miterLimit = d * 1;
this.globalAlpha = 1;
this.font = "10px sans-serif";
this.textAlign = "left";
this.textBaseline = "alphabetic";
this.canvas = i;
var m = "width:" + i.clientWidth + "px;height:" + i.clientHeight + "px;overflow:hidden;position:absolute";
var j = i.ownerDocument.createElement("div");
j.style.cssText = m;
i.appendChild(j);
var p = j.cloneNode(false);
p.style.backgroundColor = "red";
p.style.filter = "alpha(opacity=0)";
i.appendChild(p);
this.element_ = j;
this.arcScaleX_ = 1;
this.arcScaleY_ = 1;
this.lineScale_ = 1
}
var q = D.prototype;
q.clearRect = function() {
if (this.textMeasureEl_) {
this.textMeasureEl_.removeNode(true);
this.textMeasureEl_ = null
}
this.element_.innerHTML = ""
};
q.beginPath = function() {
this.currentPath_ = []
};
q.moveTo = function(j, i) {
var m = V(this, j, i);
this.currentPath_.push({
type: "moveTo",
x: m.x,
y: m.y
});
this.currentX_ = m.x;
this.currentY_ = m.y
};
q.lineTo = function(j, i) {
var m = V(this, j, i);
this.currentPath_.push({
type: "lineTo",
x: m.x,
y: m.y
});
this.currentX_ = m.x;
this.currentY_ = m.y
};
q.bezierCurveTo = function(m, j, ak, aj, ai, ag) {
var i = V(this, ai, ag);
var ah = V(this, m, j);
var Z = V(this, ak, aj);
K(this, ah, Z, i)
};
function K(i, Z, m, j) {
i.currentPath_.push({
type: "bezierCurveTo",
cp1x: Z.x,
cp1y: Z.y,
cp2x: m.x,
cp2y: m.y,
x: j.x,
y: j.y
});
i.currentX_ = j.x;
i.currentY_ = j.y
}
q.quadraticCurveTo = function(ai, m, j, i) {
var ah = V(this, ai, m);
var ag = V(this, j, i);
var aj = {
x: this.currentX_ + 2 / 3 * (ah.x - this.currentX_),
y: this.currentY_ + 2 / 3 * (ah.y - this.currentY_)
};
var Z = {
x: aj.x + (ag.x - this.currentX_) / 3,
y: aj.y + (ag.y - this.currentY_) / 3
};
K(this, aj, Z, ag)
};
q.arc = function(al, aj, ak, ag, j, m) {
ak *= d;
var ap = m ? "at" : "wa";
var am = al + A(ag) * ak - f;
var ao = aj + l(ag) * ak - f;
var i = al + A(j) * ak - f;
var an = aj + l(j) * ak - f;
if (am == i && !m) {
am += 0.125
}
var Z = V(this, al, aj);
var ai = V(this, am, ao);
var ah = V(this, i, an);
this.currentPath_.push({
type: ap,
x: Z.x,
y: Z.y,
radius: ak,
xStart: ai.x,
yStart: ai.y,
xEnd: ah.x,
yEnd: ah.y
})
};
q.rect = function(m, j, i, p) {
this.moveTo(m, j);
this.lineTo(m + i, j);
this.lineTo(m + i, j + p);
this.lineTo(m, j + p);
this.closePath()
};
q.strokeRect = function(m, j, i, p) {
var Z = this.currentPath_;
this.beginPath();
this.moveTo(m, j);
this.lineTo(m + i, j);
this.lineTo(m + i, j + p);
this.lineTo(m, j + p);
this.closePath();
this.stroke();
this.currentPath_ = Z
};
q.fillRect = function(m, j, i, p) {
var Z = this.currentPath_;
this.beginPath();
this.moveTo(m, j);
this.lineTo(m + i, j);
this.lineTo(m + i, j + p);
this.lineTo(m, j + p);
this.closePath();
this.fill();
this.currentPath_ = Z
};
q.createLinearGradient = function(j, p, i, m) {
var Z = new U("gradient");
Z.x0_ = j;
Z.y0_ = p;
Z.x1_ = i;
Z.y1_ = m;
return Z
};
q.createRadialGradient = function(p, ag, m, j, Z, i) {
var ah = new U("gradientradial");
ah.x0_ = p;
ah.y0_ = ag;
ah.r0_ = m;
ah.x1_ = j;
ah.y1_ = Z;
ah.r1_ = i;
return ah
};
q.drawImage = function(an, j) {
var ah, Z, aj, ar, al, ak, ao, av;
var ai = an.runtimeStyle.width;
var am = an.runtimeStyle.height;
an.runtimeStyle.width = "auto";
an.runtimeStyle.height = "auto";
var ag = an.width;
var aq = an.height;
an.runtimeStyle.width = ai;
an.runtimeStyle.height = am;
if (arguments.length == 3) {
ah = arguments[1];
Z = arguments[2];
al = ak = 0;
ao = aj = ag;
av = ar = aq
} else {
if (arguments.length == 5) {
ah = arguments[1];
Z = arguments[2];
aj = arguments[3];
ar = arguments[4];
al = ak = 0;
ao = ag;
av = aq
} else {
if (arguments.length == 9) {
al = arguments[1];
ak = arguments[2];
ao = arguments[3];
av = arguments[4];
ah = arguments[5];
Z = arguments[6];
aj = arguments[7];
ar = arguments[8]
} else {
throw Error("Invalid number of arguments")
}
}
}
var au = V(this, ah, Z);
var at = [];
var i = 10;
var p = 10;
var ap = this.m_;
at.push("