teechart.js 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,489 +0,0 @@
1
- /* $Id$ */
2
-
3
- /**
4
- * @projectDescription An cross-browser implementation of the HTML5 <canvas> text methods
5
- * @author Fabien M�nager
6
- * @version $Revision$
7
- * @license MIT License <http://www.opensource.org/licenses/mit-license.php>
8
- */
9
-
10
- /**
11
- * Known issues:
12
- * - The 'light' font weight is not supported, neither is the 'oblique' font style.
13
- * - Optimize the different hacks (for Opera9)
14
- */
15
-
16
- window.Canvas = window.Canvas || {};
17
- window.Canvas.Text = {
18
- // http://mondaybynoon.com/2007/04/02/linux-font-equivalents-to-popular-web-typefaces/
19
- equivalentFaces: {
20
- // Web popular fonts
21
- 'arial': ['liberation sans', 'nimbus sans l', 'freesans', 'optimer', 'dejavu sans'],
22
- 'times new roman': ['liberation serif', 'helvetiker', 'linux libertine', 'freeserif'],
23
- 'courier new': ['dejavu sans mono', 'liberation mono', 'nimbus mono l', 'freemono'],
24
- 'georgia': ['nimbus roman no9 l', 'helvetiker'],
25
- 'helvetica': ['nimbus sans l', 'helvetiker', 'freesans'],
26
- 'tahoma': ['dejavu sans', 'optimer', 'bitstream vera sans'],
27
- 'verdana': ['dejavu sans', 'optimer', 'bitstream vera sans']
28
- },
29
- genericFaces: {
30
- 'serif': ['times new roman', 'georgia', 'garamond', 'bodoni', 'minion web', 'itc stone serif', 'bitstream cyberbit'],
31
- 'sans-serif': ['arial', 'verdana', 'trebuchet', 'tahoma', 'helvetica', 'itc avant garde gothic', 'univers', 'futura',
32
- 'gill sans', 'akzidenz grotesk', 'attika', 'typiko new era', 'itc stone sans', 'monotype gill sans 571'],
33
- 'monospace': ['courier', 'courier new', 'prestige', 'everson mono'],
34
- 'cursive': ['caflisch script', 'adobe poetica', 'sanvito', 'ex ponto', 'snell roundhand', 'zapf-chancery'],
35
- 'fantasy': ['alpha geometrique', 'critter', 'cottonwood', 'fb reactor', 'studz']
36
- },
37
- faces: {},
38
- scaling: 0.962,
39
- _styleCache: {}
40
- };
41
-
42
- /** The implementation of the text functions */
43
- (function(){
44
- var isOpera9 = (window.opera && /Opera\/9/.test(navigator.userAgent)), // It seems to be faster when the hacked methods are used. But there are artifacts with Opera 10.
45
- proto = window.CanvasRenderingContext2D ? window.CanvasRenderingContext2D.prototype : document.createElement('canvas').getContext('2d').__proto__,
46
- ctxt = window.Canvas.Text;
47
-
48
- // Global options
49
- ctxt.options = {
50
- fallbackCharacter: ' ', // The character that will be drawn when not present in the font face file
51
- dontUseMoz: false, // Don't use the builtin Firefox 3.0 functions (mozDrawText, mozPathText and mozMeasureText)
52
- reimplement: false, // Don't use the builtin official functions present in Chrome 2, Safari 4, and Firefox 3.1+
53
- debug: false, // Debug mode, not used yet
54
- autoload: false // Specify the directory containing the face files or false
55
- };
56
-
57
- var scripts = document.getElementsByTagName("script"),
58
- parts = scripts[scripts.length-1].src.split('?');
59
-
60
- ctxt.basePath = parts[0].substr(0, parts[0].lastIndexOf("/")+1);
61
-
62
- if (parts[1]) {
63
- var options = parts[1].split('&');
64
- for (var j = options.length-1; j >= 0; --j) {
65
- var pair = options[j].split('=');
66
- ctxt.options[pair[0]] = pair[1];
67
- }
68
- }
69
-
70
- // What is the browser's implementation ?
71
- var moz = !ctxt.options.dontUseMoz && proto.mozDrawText && !proto.fillText;
72
-
73
- // If the text functions are already here or if on the iPhone (fillText exists) : nothing to do !
74
- if (proto.fillText && !ctxt.options.reimplement && !/iphone/i.test(navigator.userAgent)) {
75
- // This property is needed, when including the font face files
76
- return window._typeface_js = {loadFace: function(){}};
77
- }
78
-
79
- function getCSSWeightEquivalent(weight){
80
- switch(String(weight)) {
81
- case 'bolder':
82
- case 'bold':
83
- case '900':
84
- case '800':
85
- case '700': return 'bold';
86
- case '600':
87
- case '500':
88
- case '400':
89
- default:
90
- case 'normal': return 'normal';
91
- //default: return 'light';
92
- }
93
- }
94
-
95
- function getElementStyle(e){
96
- if (document.defaultView && document.defaultView.getComputedStyle) {
97
- return document.defaultView.getComputedStyle(e, null);
98
- }
99
- return e.currentStyle || e.style;
100
- }
101
-
102
- function getXHR(){
103
- if (!ctxt.xhr) {
104
- var methods = [
105
- function(){return new XMLHttpRequest()},
106
- function(){return new ActiveXObject('Msxml2.XMLHTTP')},
107
- function(){return new ActiveXObject('Microsoft.XMLHTTP')}
108
- ];
109
- for (var i = 0; i < methods.length; i++) {
110
- try {
111
- ctxt.xhr = methods[i]();
112
- break;
113
- }
114
- catch (e) {}
115
- }
116
- }
117
- return ctxt.xhr;
118
- }
119
-
120
- function arrayContains(a, v){
121
- var i, l = a.length;
122
- for (i = l-1; i >= 0; --i) if (a[i] === v) return true;
123
- return false;
124
- }
125
-
126
- ctxt.lookupFamily = function(family){
127
- var faces = this.faces, face, i, f, list,
128
- equiv = this.equivalentFaces,
129
- generic = this.genericFaces;
130
-
131
- if (faces[family]) return faces[family];
132
-
133
- if (generic[family]) {
134
- for (i = 0; i < generic[family].length; i++) {
135
- if (f = this.lookupFamily(generic[family][i])) return f;
136
- }
137
- }
138
-
139
- if (!(list = equiv[family])) return false;
140
-
141
- for (i = 0; i < list.length; i++)
142
- if (face = faces[list[i]]) return face;
143
- return false;
144
- }
145
-
146
- ctxt.getFace = function(family, weight, style){
147
- var face = this.lookupFamily(family);
148
- if (!face) return false;
149
-
150
- if (face &&
151
- face[weight] &&
152
- face[weight][style]) return face[weight][style];
153
-
154
- if (!this.options.autoload) return false;
155
-
156
- var faceName = (family.replace(/[ -]/g, '_')+'-'+weight+'-'+style),
157
- xhr = this.xhr,
158
- url = this.basePath+this.options.autoload+'/'+faceName+'.js';
159
-
160
- xhr = getXHR();
161
- xhr.open("get", url, false);
162
- xhr.send(null);
163
- if(xhr.status == 200) {
164
- eval(xhr.responseText);
165
- return this.faces[family][weight][style];
166
- }
167
- else throw 'Unable to load the font ['+family+' '+weight+' '+style+']';
168
- };
169
-
170
- ctxt.loadFace = function(data){
171
- var family = data.familyName.toLowerCase();
172
-
173
- this.faces[family] = this.faces[family] || {};
174
-
175
- if (data.strokeFont) {
176
- this.faces[family].normal = this.faces[family].normal || {};
177
- this.faces[family].normal.normal = data;
178
- this.faces[family].normal.italic = data;
179
-
180
- this.faces[family].bold = this.faces[family].normal || {};
181
- this.faces[family].bold.normal = data;
182
- this.faces[family].bold.italic = data;
183
- }
184
- else {
185
- this.faces[family][data.cssFontWeight] = this.faces[family][data.cssFontWeight] || {};
186
- this.faces[family][data.cssFontWeight][data.cssFontStyle] = data;
187
- }
188
- return data;
189
- };
190
-
191
- // To use the typeface.js face files
192
- window._typeface_js = {faces: ctxt.faces, loadFace: ctxt.loadFace};
193
-
194
- ctxt.getFaceFromStyle = function(style){
195
- var weight = getCSSWeightEquivalent(style.weight),
196
- families = style.family, i, face;
197
-
198
- for (i = 0; i < families.length; i++) {
199
- // The iPhone adds "-webkit-" at the beginning
200
- if (face = this.getFace(families[i].toLowerCase().replace(/^-webkit-/, ""), weight, style.style)) {
201
- return face;
202
- }
203
- }
204
- return false;
205
- };
206
-
207
- // Default values
208
- // Firefox 3.5 throws an error when redefining these properties
209
- try {
210
- proto.font = "10px sans-serif";
211
- proto.textAlign = "start";
212
- proto.textBaseline = "alphabetic";
213
- }
214
- catch(e){}
215
-
216
- proto.parseStyle = function(styleText){
217
- if (ctxt._styleCache[styleText]) return this.getComputedStyle(ctxt._styleCache[styleText]);
218
-
219
- var style = {}, computedStyle, families;
220
-
221
- if (!this._elt) {
222
- this._elt = document.createElement('span');
223
- this.canvas.appendChild(this._elt);
224
- }
225
-
226
- // Default style
227
- this.canvas.font = '10px sans-serif';
228
- this._elt.style.font = styleText;
229
-
230
- computedStyle = getElementStyle(this._elt);
231
- style.size = computedStyle.fontSize;
232
- style.weight = getCSSWeightEquivalent(computedStyle.fontWeight);
233
- style.style = computedStyle.fontStyle;
234
-
235
- families = computedStyle.fontFamily.split(',');
236
- for(i = 0; i < families.length; i++) {
237
- families[i] = families[i].replace(/^["'\s]*/, '').replace(/["'\s]*$/, '');
238
- }
239
- style.family = families;
240
- return this.getComputedStyle(ctxt._styleCache[styleText] = style);
241
- };
242
-
243
- proto.buildStyle = function (style){
244
- return style.style+' '+style.weight+' '+style.size+'px "'+style.family+'"';
245
- };
246
-
247
- proto.renderText = function(text, style){
248
- var face = ctxt.getFaceFromStyle(style),
249
- scale = (style.size / face.resolution) * 0.75,
250
- offset = 0, i,
251
- chars = String(text).split(''),
252
- length = chars.length;
253
-
254
- if (!isOpera9) {
255
- this.scale(scale, -scale);
256
- this.lineWidth /= scale;
257
- }
258
-
259
- for (i = 0; i < length; i++) {
260
- offset += this.renderGlyph(chars[i], face, scale, offset);
261
- }
262
- };
263
-
264
- if (isOpera9) {
265
- proto.renderGlyph = function(c, face, scale, offset){
266
- var i, cpx, cpy, outline, action, length,
267
- glyph = face.glyphs[c] || face.glyphs[ctxt.options.fallbackCharacter];
268
-
269
- if (!glyph) return;
270
-
271
- if (glyph.o) {
272
- outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' '));
273
- length = outline.length;
274
- for (i = 0; i < length; ) {
275
- action = outline[i++];
276
-
277
- switch(action) {
278
- case 'm':
279
- this.moveTo(outline[i++]*scale+offset, outline[i++]*-scale);
280
- break;
281
- case 'l':
282
- this.lineTo(outline[i++]*scale+offset, outline[i++]*-scale);
283
- break;
284
- case 'q':
285
- cpx = outline[i++]*scale+offset;
286
- cpy = outline[i++]*-scale;
287
- this.quadraticCurveTo(outline[i++]*scale+offset, outline[i++]*-scale, cpx, cpy);
288
- break;
289
- case 'b':
290
- cpx = outline[i++]*scale+offset;
291
- cpy = outline[i++]*-scale;
292
- this.bezierCurveTo(outline[i++]*scale+offset, outline[i++]*-scale, outline[i++]*scale+offset, outline[i++]*-scale, cpx, cpy);
293
- break;
294
- }
295
- }
296
- }
297
- return glyph.ha*scale;
298
- };
299
- }
300
- else {
301
- proto.renderGlyph = function(c, face){
302
- var i, cpx, cpy, outline, action, length,
303
- glyph = face.glyphs[c] || face.glyphs[ctxt.options.fallbackCharacter];
304
-
305
- if (!glyph) return;
306
-
307
- if (glyph.o) {
308
- outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' '));
309
- length = outline.length;
310
- for (i = 0; i < length; ) {
311
- action = outline[i++];
312
-
313
- switch(action) {
314
- case 'm':
315
- this.moveTo(outline[i++], outline[i++]);
316
- break;
317
- case 'l':
318
- this.lineTo(outline[i++], outline[i++]);
319
- break;
320
- case 'q':
321
- cpx = outline[i++];
322
- cpy = outline[i++];
323
- this.quadraticCurveTo(outline[i++], outline[i++], cpx, cpy);
324
- break;
325
- case 'b':
326
- cpx = outline[i++];
327
- cpy = outline[i++];
328
- this.bezierCurveTo(outline[i++], outline[i++], outline[i++], outline[i++], cpx, cpy);
329
- break;
330
- }
331
- }
332
- }
333
- if (glyph.ha) this.translate(glyph.ha, 0);
334
- };
335
- }
336
-
337
- proto.getTextExtents = function(text, style){
338
- var width = 0, height = 0, ha = 0,
339
- face = ctxt.getFaceFromStyle(style),
340
- i, length = text.length, glyph;
341
-
342
- for (i = 0; i < length; i++) {
343
- glyph = face.glyphs[text.charAt(i)] || face.glyphs[ctxt.options.fallbackCharacter];
344
- width += Math.max(glyph.ha, glyph.x_max);
345
- ha += glyph.ha;
346
- }
347
-
348
- return {
349
- width: width,
350
- height: face.lineHeight,
351
- ha: ha
352
- };
353
- };
354
-
355
- proto.getComputedStyle = function(style){
356
- var p, canvasStyle = getElementStyle(this.canvas),
357
- computedStyle = {},
358
- s = style.size,
359
- canvasFontSize = parseFloat(canvasStyle.fontSize),
360
- fontSize = parseFloat(s);
361
-
362
- for (p in style) {
363
- computedStyle[p] = style[p];
364
- }
365
-
366
- // Compute the size
367
- if (typeof s === 'number' || s.indexOf('px') != -1)
368
- computedStyle.size = fontSize;
369
- else if (s.indexOf('em') != -1)
370
- computedStyle.size = canvasFontSize * fontSize;
371
- else if (s.indexOf('%') != -1)
372
- computedStyle.size = (canvasFontSize / 100) * fontSize;
373
- else if (s.indexOf('pt') != -1)
374
- computedStyle.size = fontSize / 0.75;
375
- else
376
- computedStyle.size = canvasFontSize;
377
-
378
- return computedStyle;
379
- };
380
-
381
- proto.getTextOffset = function(text, style, face){
382
- var canvasStyle = getElementStyle(this.canvas),
383
- metrics = this.measureText(text),
384
- scale = (style.size / face.resolution) * 0.75,
385
- offset = {x: 0, y: 0, metrics: metrics, scale: scale};
386
-
387
- switch (this.textAlign) {
388
- default:
389
- case null:
390
- case 'left': break;
391
- case 'center': offset.x = -metrics.width/2; break;
392
- case 'right': offset.x = -metrics.width; break;
393
- case 'start': offset.x = (canvasStyle.direction == 'rtl') ? -metrics.width : 0; break;
394
- case 'end': offset.x = (canvasStyle.direction == 'ltr') ? -metrics.width : 0; break;
395
- }
396
-
397
- switch (this.textBaseline) {
398
- case 'alphabetic': break;
399
- default:
400
- case null:
401
- case 'ideographic':
402
- case 'bottom': offset.y = face.descender; break;
403
- case 'hanging':
404
- case 'top': offset.y = face.ascender; break;
405
- case 'middle': offset.y = (face.ascender + face.descender) / 2; break;
406
- }
407
- offset.y *= scale;
408
- return offset;
409
- };
410
-
411
- proto.drawText = function(text, x, y, maxWidth, stroke){
412
- var style = this.parseStyle(this.font),
413
- face = ctxt.getFaceFromStyle(style),
414
- offset = this.getTextOffset(text, style, face);
415
-
416
- this.save();
417
- this.translate(x + offset.x, y + offset.y);
418
- if (face.strokeFont && !stroke) {
419
- this.strokeStyle = this.fillStyle;
420
- }
421
- this.lineCap = "round";
422
- this.beginPath();
423
-
424
- if (moz) {
425
- this.mozTextStyle = this.buildStyle(style);
426
- this[stroke ? 'mozPathText' : 'mozDrawText'](text);
427
- }
428
- else {
429
- this.scale(ctxt.scaling, ctxt.scaling);
430
- this.renderText(text, style);
431
- if (face.strokeFont) {
432
- this.lineWidth = 2 + style.size * (style.weight == 'bold' ? 0.08 : 0.015) / 2;
433
- }
434
- }
435
-
436
- this[(stroke || (face.strokeFont && !moz)) ? 'stroke' : 'fill']();
437
-
438
- this.closePath();
439
- this.restore();
440
-
441
- if (ctxt.options.debug) {
442
- var left = Math.floor(offset.x + x) + 0.5,
443
- top = Math.floor(y)+0.5;
444
-
445
- this.save();
446
- this.strokeStyle = '#F00';
447
- this.lineWidth = 0.5;
448
- this.beginPath();
449
-
450
- // Text baseline
451
- this.moveTo(left + offset.metrics.width, top);
452
- this.lineTo(left, top);
453
-
454
- // Text align
455
- this.moveTo(left - offset.x, top + offset.y);
456
- this.lineTo(left - offset.x, top + offset.y - style.size);
457
-
458
- this.stroke();
459
- this.closePath();
460
- this.restore();
461
- }
462
- };
463
-
464
- proto.fillText = function(text, x, y, maxWidth){
465
- this.drawText(text, x, y, maxWidth, false);
466
- };
467
-
468
- proto.strokeText = function(text, x, y, maxWidth){
469
- this.drawText(text, x, y, maxWidth, true);
470
- };
471
-
472
- proto.measureText = function(text){
473
- var style = this.parseStyle(this.font),
474
- dim = {width: 0};
475
-
476
- if (moz) {
477
- this.mozTextStyle = this.buildStyle(style);
478
- dim.width = this.mozMeasureText(text);
479
- }
480
- else {
481
- var face = ctxt.getFaceFromStyle(style),
482
- scale = (style.size / face.resolution) * 0.75;
483
-
484
- dim.width = this.getTextExtents(text, style).ha * scale * ctxt.scaling;
485
- }
486
-
487
- return dim;
488
- };
489
- })();
@@ -1,35 +0,0 @@
1
- // Copyright 2006 Google Inc.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
- document.createElement("canvas").getContext||(function(){var s=Math,j=s.round,F=s.sin,G=s.cos,V=s.abs,W=s.sqrt,k=10,v=k/2;function X(){return this.context_||(this.context_=new H(this))}var L=Array.prototype.slice;function Y(b,a){var c=L.call(arguments,2);return function(){return b.apply(a,c.concat(L.call(arguments)))}}var M={init:function(b){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var a=b||document;a.createElement("canvas");a.attachEvent("onreadystatechange",Y(this.init_,this,a))}},init_:function(b){b.namespaces.g_vml_||
15
- b.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");b.namespaces.g_o_||b.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!b.styleSheets.ex_canvas_){var a=b.createStyleSheet();a.owningElement.id="ex_canvas_";a.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}var c=b.getElementsByTagName("canvas"),d=0;for(;d<c.length;d++)this.initElement(c[d])},
16
- initElement:function(b){if(!b.getContext){b.getContext=X;b.innerHTML="";b.attachEvent("onpropertychange",Z);b.attachEvent("onresize",$);var a=b.attributes;if(a.width&&a.width.specified)b.style.width=a.width.nodeValue+"px";else b.width=b.clientWidth;if(a.height&&a.height.specified)b.style.height=a.height.nodeValue+"px";else b.height=b.clientHeight}return b}};function Z(b){var a=b.srcElement;switch(b.propertyName){case "width":a.style.width=a.attributes.width.nodeValue+"px";a.getContext().clearRect();
17
- break;case "height":a.style.height=a.attributes.height.nodeValue+"px";a.getContext().clearRect();break}}function $(b){var a=b.srcElement;if(a.firstChild){a.firstChild.style.width=a.clientWidth+"px";a.firstChild.style.height=a.clientHeight+"px"}}M.init();var N=[],B=0;for(;B<16;B++){var C=0;for(;C<16;C++)N[B*16+C]=B.toString(16)+C.toString(16)}function I(){return[[1,0,0],[0,1,0],[0,0,1]]}function y(b,a){var c=I(),d=0;for(;d<3;d++){var f=0;for(;f<3;f++){var h=0,g=0;for(;g<3;g++)h+=b[d][g]*a[g][f];c[d][f]=
18
- h}}return c}function O(b,a){a.fillStyle=b.fillStyle;a.lineCap=b.lineCap;a.lineJoin=b.lineJoin;a.lineWidth=b.lineWidth;a.miterLimit=b.miterLimit;a.shadowBlur=b.shadowBlur;a.shadowColor=b.shadowColor;a.shadowOffsetX=b.shadowOffsetX;a.shadowOffsetY=b.shadowOffsetY;a.strokeStyle=b.strokeStyle;a.globalAlpha=b.globalAlpha;a.arcScaleX_=b.arcScaleX_;a.arcScaleY_=b.arcScaleY_;a.lineScale_=b.lineScale_}function P(b){var a,c=1;b=String(b);if(b.substring(0,3)=="rgb"){var d=b.indexOf("(",3),f=b.indexOf(")",d+
19
- 1),h=b.substring(d+1,f).split(",");a="#";var g=0;for(;g<3;g++)a+=N[Number(h[g])];if(h.length==4&&b.substr(3,1)=="a")c=h[3]}else a=b;return{color:a,alpha:c}}function aa(b){switch(b){case "butt":return"flat";case "round":return"round";case "square":default:return"square"}}function H(b){this.m_=I();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=k*1;this.globalAlpha=1;this.canvas=b;
20
- var a=b.ownerDocument.createElement("div");a.style.width=b.clientWidth+"px";a.style.height=b.clientHeight+"px";a.style.overflow="hidden";a.style.position="absolute";b.appendChild(a);this.element_=a;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}var i=H.prototype;i.clearRect=function(){this.element_.innerHTML=""};i.beginPath=function(){this.currentPath_=[]};i.moveTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"moveTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};
21
- i.lineTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"lineTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};i.bezierCurveTo=function(b,a,c,d,f,h){var g=this.getCoords_(f,h),l=this.getCoords_(b,a),e=this.getCoords_(c,d);Q(this,l,e,g)};function Q(b,a,c,d){b.currentPath_.push({type:"bezierCurveTo",cp1x:a.x,cp1y:a.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y});b.currentX_=d.x;b.currentY_=d.y}i.quadraticCurveTo=function(b,a,c,d){var f=this.getCoords_(b,a),h=this.getCoords_(c,d),g={x:this.currentX_+
22
- 0.6666666666666666*(f.x-this.currentX_),y:this.currentY_+0.6666666666666666*(f.y-this.currentY_)};Q(this,g,{x:g.x+(h.x-this.currentX_)/3,y:g.y+(h.y-this.currentY_)/3},h)};i.arc=function(b,a,c,d,f,h){c*=k;var g=h?"at":"wa",l=b+G(d)*c-v,e=a+F(d)*c-v,m=b+G(f)*c-v,r=a+F(f)*c-v;if(l==m&&!h)l+=0.125;var n=this.getCoords_(b,a),o=this.getCoords_(l,e),q=this.getCoords_(m,r);this.currentPath_.push({type:g,x:n.x,y:n.y,radius:c,xStart:o.x,yStart:o.y,xEnd:q.x,yEnd:q.y})};i.rect=function(b,a,c,d){this.moveTo(b,
23
- a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath()};i.strokeRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.stroke();this.currentPath_=f};i.fillRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.fill();this.currentPath_=f};i.createLinearGradient=function(b,
24
- a,c,d){var f=new D("gradient");f.x0_=b;f.y0_=a;f.x1_=c;f.y1_=d;return f};i.createRadialGradient=function(b,a,c,d,f,h){var g=new D("gradientradial");g.x0_=b;g.y0_=a;g.r0_=c;g.x1_=d;g.y1_=f;g.r1_=h;return g};i.drawImage=function(b){var a,c,d,f,h,g,l,e,m=b.runtimeStyle.width,r=b.runtimeStyle.height;b.runtimeStyle.width="auto";b.runtimeStyle.height="auto";var n=b.width,o=b.height;b.runtimeStyle.width=m;b.runtimeStyle.height=r;if(arguments.length==3){a=arguments[1];c=arguments[2];h=g=0;l=d=n;e=f=o}else if(arguments.length==
25
- 5){a=arguments[1];c=arguments[2];d=arguments[3];f=arguments[4];h=g=0;l=n;e=o}else if(arguments.length==9){h=arguments[1];g=arguments[2];l=arguments[3];e=arguments[4];a=arguments[5];c=arguments[6];d=arguments[7];f=arguments[8]}else throw Error("Invalid number of arguments");var q=this.getCoords_(a,c),t=[];t.push(" <g_vml_:group",' coordsize="',k*10,",",k*10,'"',' coordorigin="0,0"',' style="width:',10,"px;height:",10,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]){var E=[];E.push("M11=",
26
- this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",j(q.x/k),",","Dy=",j(q.y/k),"");var p=q,z=this.getCoords_(a+d,c),w=this.getCoords_(a,c+f),x=this.getCoords_(a+d,c+f);p.x=s.max(p.x,z.x,w.x,x.x);p.y=s.max(p.y,z.y,w.y,x.y);t.push("padding:0 ",j(p.x/k),"px ",j(p.y/k),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",E.join(""),", sizingmethod='clip');")}else t.push("top:",j(q.y/k),"px;left:",j(q.x/k),"px;");t.push(' ">','<g_vml_:image src="',b.src,
27
- '"',' style="width:',k*d,"px;"," height:",k*f,'px;"',' cropleft="',h/n,'"',' croptop="',g/o,'"',' cropright="',(n-h-l)/n,'"',' cropbottom="',(o-g-e)/o,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",t.join(""))};i.stroke=function(b){var a=[],c=P(b?this.fillStyle:this.strokeStyle),d=c.color,f=c.alpha*this.globalAlpha;a.push("<g_vml_:shape",' filled="',!!b,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0 0" coordsize="',k*10," ",k*10,'"',' stroked="',
28
- !b,'"',' path="');var h={x:null,y:null},g={x:null,y:null},l=0;for(;l<this.currentPath_.length;l++){var e=this.currentPath_[l];switch(e.type){case "moveTo":a.push(" m ",j(e.x),",",j(e.y));break;case "lineTo":a.push(" l ",j(e.x),",",j(e.y));break;case "close":a.push(" x ");e=null;break;case "bezierCurveTo":a.push(" c ",j(e.cp1x),",",j(e.cp1y),",",j(e.cp2x),",",j(e.cp2y),",",j(e.x),",",j(e.y));break;case "at":case "wa":a.push(" ",e.type," ",j(e.x-this.arcScaleX_*e.radius),",",j(e.y-this.arcScaleY_*e.radius),
29
- " ",j(e.x+this.arcScaleX_*e.radius),",",j(e.y+this.arcScaleY_*e.radius)," ",j(e.xStart),",",j(e.yStart)," ",j(e.xEnd),",",j(e.yEnd));break}if(e){if(h.x==null||e.x<h.x)h.x=e.x;if(g.x==null||e.x>g.x)g.x=e.x;if(h.y==null||e.y<h.y)h.y=e.y;if(g.y==null||e.y>g.y)g.y=e.y}}a.push(' ">');if(b)if(typeof this.fillStyle=="object"){var m=this.fillStyle,r=0,n={x:0,y:0},o=0,q=1;if(m.type_=="gradient"){var t=m.x1_/this.arcScaleX_,E=m.y1_/this.arcScaleY_,p=this.getCoords_(m.x0_/this.arcScaleX_,m.y0_/this.arcScaleY_),
30
- z=this.getCoords_(t,E);r=Math.atan2(z.x-p.x,z.y-p.y)*180/Math.PI;if(r<0)r+=360;if(r<1.0E-6)r=0}else{var p=this.getCoords_(m.x0_,m.y0_),w=g.x-h.x,x=g.y-h.y;n={x:(p.x-h.x)/w,y:(p.y-h.y)/x};w/=this.arcScaleX_*k;x/=this.arcScaleY_*k;var R=s.max(w,x);o=2*m.r0_/R;q=2*m.r1_/R-o}var u=m.colors_;u.sort(function(ba,ca){return ba.offset-ca.offset});var J=u.length,da=u[0].color,ea=u[J-1].color,fa=u[0].alpha*this.globalAlpha,ga=u[J-1].alpha*this.globalAlpha,S=[],l=0;for(;l<J;l++){var T=u[l];S.push(T.offset*q+
31
- o+" "+T.color)}a.push('<g_vml_:fill type="',m.type_,'"',' method="none" focus="100%"',' color="',da,'"',' color2="',ea,'"',' colors="',S.join(","),'"',' opacity="',ga,'"',' g_o_:opacity2="',fa,'"',' angle="',r,'"',' focusposition="',n.x,",",n.y,'" />')}else a.push('<g_vml_:fill color="',d,'" opacity="',f,'" />');else{var K=this.lineScale_*this.lineWidth;if(K<1)f*=K;a.push("<g_vml_:stroke",' opacity="',f,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',aa(this.lineCap),
32
- '"',' weight="',K,'px"',' color="',d,'" />')}a.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",a.join(""))};i.fill=function(){this.stroke(true)};i.closePath=function(){this.currentPath_.push({type:"close"})};i.getCoords_=function(b,a){var c=this.m_;return{x:k*(b*c[0][0]+a*c[1][0]+c[2][0])-v,y:k*(b*c[0][1]+a*c[1][1]+c[2][1])-v}};i.save=function(){var b={};O(this,b);this.aStack_.push(b);this.mStack_.push(this.m_);this.m_=y(I(),this.m_)};i.restore=function(){O(this.aStack_.pop(),
33
- this);this.m_=this.mStack_.pop()};function ha(b){var a=0;for(;a<3;a++){var c=0;for(;c<2;c++)if(!isFinite(b[a][c])||isNaN(b[a][c]))return false}return true}function A(b,a,c){if(!!ha(a)){b.m_=a;if(c)b.lineScale_=W(V(a[0][0]*a[1][1]-a[0][1]*a[1][0]))}}i.translate=function(b,a){A(this,y([[1,0,0],[0,1,0],[b,a,1]],this.m_),false)};i.rotate=function(b){var a=G(b),c=F(b);A(this,y([[a,c,0],[-c,a,0],[0,0,1]],this.m_),false)};i.scale=function(b,a){this.arcScaleX_*=b;this.arcScaleY_*=a;A(this,y([[b,0,0],[0,a,
34
- 0],[0,0,1]],this.m_),true)};i.transform=function(b,a,c,d,f,h){A(this,y([[b,a,0],[c,d,0],[f,h,1]],this.m_),true)};i.setTransform=function(b,a,c,d,f,h){A(this,[[b,a,0],[c,d,0],[f,h,1]],true)};i.clip=function(){};i.arcTo=function(){};i.createPattern=function(){return new U};function D(b){this.type_=b;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}D.prototype.addColorStop=function(b,a){a=P(a);this.colors_.push({offset:b,color:a.color,alpha:a.alpha})};function U(){}G_vmlCanvasManager=
35
- M;CanvasRenderingContext2D=H;CanvasGradient=D;CanvasPattern=U})();