/**
 * @license
 * Copyright (c) 2018 amCharts (Antanas Marcelionis, Martynas Majeris)
 *
 * This sofware is provided under multiple licenses. Please see below for
 * links to appropriate usage.
 *
 * Free amCharts linkware license. Details and conditions:
 * https://github.com/amcharts/amcharts4/blob/master/LICENSE
 *
 * One of the amCharts commercial licenses. Details and pricing:
 * https://www.amcharts.com/online-store/
 * https://www.amcharts.com/online-store/licenses-explained/
 *
 * If in doubt, contact amCharts at contact@amcharts.com
 *
 * PLEASE DO NOT REMOVE THIS COPYRIGHT NOTICE.
 * @hidden
 */
am4internal_webpackJsonp(["0471"],{"2gqV":function(t,e,i){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t){return(a="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)})(t)}Object.defineProperty(e,"__esModule",{value:!0}),i.d(e,"BlurStack",function(){return p}),i.d(e,"image",function(){return o}),i.d(e,"canvasRGBA",function(){return h}),i.d(e,"canvasRGB",function(){return f}),i.d(e,"imageDataRGBA",function(){return u}),i.d(e,"imageDataRGB",function(){return c});var s=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],r=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function o(t,e,i,n){if("string"==typeof t&&(t=document.getElementById(t)),t&&"naturalWidth"in t){var a=t.naturalWidth,s=t.naturalHeight;if("string"==typeof e&&(e=document.getElementById(e)),e&&"getContext"in e){e.style.width=a+"px",e.style.height=s+"px",e.width=a,e.height=s;var r=e.getContext("2d");r.clearRect(0,0,a,s),r.drawImage(t,0,0),isNaN(i)||i<1||(n?h(e,0,0,a,s,i):f(e,0,0,a,s,i))}}}function l(t,e,i,n,s){if("string"==typeof t&&(t=document.getElementById(t)),!(t&&"object"===a(t)&&"getContext"in t))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var r=t.getContext("2d");try{return r.getImageData(e,i,n,s)}catch(t){throw new Error("unable to access image data: "+t)}}function h(t,e,i,n,a,s){if(!(isNaN(s)||s<1)){s|=0;var r=l(t,e,i,n,a);r=u(r,e,i,n,a,s),t.getContext("2d").putImageData(r,e,i)}}function u(t,e,i,n,a,o){var l,h,u,f,c,d,m,y,g,v,x,b,P,E,w,C,B,M,T,S,k,V,A,D,R,O=t.data,N=2*o+1,L=n-1,z=a-1,I=o+1,X=I*(I+1)/2,q=new p,F=q;for(u=1;u<N;u++)F=F.next=new p,u===I&&(R=F);F.next=q;var W=null,G=null;m=d=0;var $=s[o],H=r[o];for(h=0;h<a;h++){for(C=B=M=T=y=g=v=x=0,b=I*(S=O[d]),P=I*(k=O[d+1]),E=I*(V=O[d+2]),w=I*(A=O[d+3]),y+=X*S,g+=X*k,v+=X*V,x+=X*A,F=q,u=0;u<I;u++)F.r=S,F.g=k,F.b=V,F.a=A,F=F.next;for(u=1;u<I;u++)f=d+((L<u?L:u)<<2),y+=(F.r=S=O[f])*(D=I-u),g+=(F.g=k=O[f+1])*D,v+=(F.b=V=O[f+2])*D,x+=(F.a=A=O[f+3])*D,C+=S,B+=k,M+=V,T+=A,F=F.next;for(W=q,G=R,l=0;l<n;l++)O[d+3]=A=x*$>>H,0!==A?(A=255/A,O[d]=(y*$>>H)*A,O[d+1]=(g*$>>H)*A,O[d+2]=(v*$>>H)*A):O[d]=O[d+1]=O[d+2]=0,y-=b,g-=P,v-=E,x-=w,b-=W.r,P-=W.g,E-=W.b,w-=W.a,f=m+((f=l+o+1)<L?f:L)<<2,y+=C+=W.r=O[f],g+=B+=W.g=O[f+1],v+=M+=W.b=O[f+2],x+=T+=W.a=O[f+3],W=W.next,b+=S=G.r,P+=k=G.g,E+=V=G.b,w+=A=G.a,C-=S,B-=k,M-=V,T-=A,G=G.next,d+=4;m+=n}for(l=0;l<n;l++){for(B=M=T=C=g=v=x=y=0,b=I*(S=O[d=l<<2]),P=I*(k=O[d+1]),E=I*(V=O[d+2]),w=I*(A=O[d+3]),y+=X*S,g+=X*k,v+=X*V,x+=X*A,F=q,u=0;u<I;u++)F.r=S,F.g=k,F.b=V,F.a=A,F=F.next;for(c=n,u=1;u<=o;u++)d=c+l<<2,y+=(F.r=S=O[d])*(D=I-u),g+=(F.g=k=O[d+1])*D,v+=(F.b=V=O[d+2])*D,x+=(F.a=A=O[d+3])*D,C+=S,B+=k,M+=V,T+=A,F=F.next,u<z&&(c+=n);for(d=l,W=q,G=R,h=0;h<a;h++)O[(f=d<<2)+3]=A=x*$>>H,A>0?(A=255/A,O[f]=(y*$>>H)*A,O[f+1]=(g*$>>H)*A,O[f+2]=(v*$>>H)*A):O[f]=O[f+1]=O[f+2]=0,y-=b,g-=P,v-=E,x-=w,b-=W.r,P-=W.g,E-=W.b,w-=W.a,f=l+((f=h+I)<z?f:z)*n<<2,y+=C+=W.r=O[f],g+=B+=W.g=O[f+1],v+=M+=W.b=O[f+2],x+=T+=W.a=O[f+3],W=W.next,b+=S=G.r,P+=k=G.g,E+=V=G.b,w+=A=G.a,C-=S,B-=k,M-=V,T-=A,G=G.next,d+=n}return t}function f(t,e,i,n,a,s){if(!(isNaN(s)||s<1)){s|=0;var r=l(t,e,i,n,a);r=c(r,e,i,n,a,s),t.getContext("2d").putImageData(r,e,i)}}function c(t,e,i,n,a,o){var l,h,u,f,c,d,m,y,g,v,x,b,P,E,w,C,B,M,T,S,k,V=t.data,A=2*o+1,D=n-1,R=a-1,O=o+1,N=O*(O+1)/2,L=new p,z=L;for(u=1;u<A;u++)z=z.next=new p,u===O&&(k=z);z.next=L;var I=null,X=null;m=d=0;var q=s[o],F=r[o];for(h=0;h<a;h++){for(E=w=C=y=g=v=0,x=O*(B=V[d]),b=O*(M=V[d+1]),P=O*(T=V[d+2]),y+=N*B,g+=N*M,v+=N*T,z=L,u=0;u<O;u++)z.r=B,z.g=M,z.b=T,z=z.next;for(u=1;u<O;u++)f=d+((D<u?D:u)<<2),y+=(z.r=B=V[f])*(S=O-u),g+=(z.g=M=V[f+1])*S,v+=(z.b=T=V[f+2])*S,E+=B,w+=M,C+=T,z=z.next;for(I=L,X=k,l=0;l<n;l++)V[d]=y*q>>F,V[d+1]=g*q>>F,V[d+2]=v*q>>F,y-=x,g-=b,v-=P,x-=I.r,b-=I.g,P-=I.b,f=m+((f=l+o+1)<D?f:D)<<2,y+=E+=I.r=V[f],g+=w+=I.g=V[f+1],v+=C+=I.b=V[f+2],I=I.next,x+=B=X.r,b+=M=X.g,P+=T=X.b,E-=B,w-=M,C-=T,X=X.next,d+=4;m+=n}for(l=0;l<n;l++){for(w=C=E=g=v=y=0,x=O*(B=V[d=l<<2]),b=O*(M=V[d+1]),P=O*(T=V[d+2]),y+=N*B,g+=N*M,v+=N*T,z=L,u=0;u<O;u++)z.r=B,z.g=M,z.b=T,z=z.next;for(c=n,u=1;u<=o;u++)d=c+l<<2,y+=(z.r=B=V[d])*(S=O-u),g+=(z.g=M=V[d+1])*S,v+=(z.b=T=V[d+2])*S,E+=B,w+=M,C+=T,z=z.next,u<R&&(c+=n);for(d=l,I=L,X=k,h=0;h<a;h++)V[f=d<<2]=y*q>>F,V[f+1]=g*q>>F,V[f+2]=v*q>>F,y-=x,g-=b,v-=P,x-=I.r,b-=I.g,P-=I.b,f=l+((f=h+O)<R?f:R)*n<<2,y+=E+=I.r=V[f],g+=w+=I.g=V[f+1],v+=C+=I.b=V[f+2],I=I.next,x+=B=X.r,b+=M=X.g,P+=T=X.b,E-=B,w-=M,C-=T,X=X.next,d+=n}return t}var p=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}},"4E4r":function(t,e){t.exports=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={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",feldspar:"d19275",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",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",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",rebeccapurple:"663399",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",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var i=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],n=0;n<i.length;n++){var a=i[n].re,s=i[n].process,r=a.exec(t);if(r){var o=s(r);this.r=o[0],this.g=o[1],this.b=o[2],o.length>3&&(this.alpha=o[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i},this.getHelpXML=function(){for(var t=new Array,n=0;n<i.length;n++)for(var a=i[n].example,s=0;s<a.length;s++)t[t.length]=a[s];for(var r in e)t[t.length]=r;var o=document.createElement("ul");o.setAttribute("id","rgbcolor-examples");for(n=0;n<t.length;n++)try{var l=document.createElement("li"),h=new RGBColor(t[n]),u=document.createElement("div");u.style.cssText="margin: 3px; border: 1px solid black; background:"+h.toHex()+"; color:"+h.toHex(),u.appendChild(document.createTextNode("test"));var f=document.createTextNode(" "+t[n]+" -> "+h.toRGB()+" -> "+h.toHex());l.appendChild(u),l.appendChild(f),o.appendChild(l)}catch(t){}return o}}},pu93:function(t,e,i){var n,a,s;function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(o,l){"object"==r(e)&&void 0!==t?t.exports=l(i("4E4r"),i("2gqV")):(a=[i("4E4r"),i("2gqV")],void 0===(s="function"==typeof(n=l)?n.apply(e,a):n)||(t.exports=s))}(0,function(t,e){"use strict";var i;return t=t&&t.hasOwnProperty("default")?t.default:t,e=e&&e.hasOwnProperty("default")?e.default:e,function(i){var n;i.exports,(n=window).DOMParser=window.DOMParser;var a=n.document;function s(t,e){var i;return(i=a.createElement("canvas")).width=t,i.height=e,i}var r,o=function t(e,i,n){if(null!=e||null!=i||null!=n){var s=y(n||{});"string"==typeof e&&(e=a.getElementById(e)),null!=e.svg&&e.svg.stop(),e.childNodes&&1==e.childNodes.length&&"OBJECT"==e.childNodes[0].nodeName||(e.svg=s);var r=e.getContext("2d");void 0!==i.documentElement?s.loadXmlDoc(r,i):"<"==i.substr(0,1)?s.loadXml(r,i):s.load(r,i)}else for(var o=a.querySelectorAll("svg"),l=0;l<o.length;l++){var h=o[l],u=a.createElement("canvas");if(void 0!==h.clientWidth&&void 0!==h.clientHeight)u.width=h.clientWidth,u.height=h.clientHeight;else{var f=h.getBoundingClientRect();u.width=f.width,u.height=f.height}h.parentNode.insertBefore(u,h),h.parentNode.removeChild(h);var c=a.createElement("div");c.appendChild(h),t(u,c.innerHTML)}};"undefined"==typeof Element||(void 0!==Element.prototype.matches?r=function(t,e){return t.matches(e)}:void 0!==Element.prototype.webkitMatchesSelector?r=function(t,e){return t.webkitMatchesSelector(e)}:void 0!==Element.prototype.mozMatchesSelector?r=function(t,e){return t.mozMatchesSelector(e)}:void 0!==Element.prototype.msMatchesSelector?r=function(t,e){return t.msMatchesSelector(e)}:void 0!==Element.prototype.oMatchesSelector?r=function(t,e){return t.oMatchesSelector(e)}:("function"!=typeof jQuery&&"function"!=typeof Zepto||(r=function(t,e){return $(t).is(e)}),void 0===r&&"undefined"!=typeof Sizzle&&(r=Sizzle.matchesSelector)));var l=/(\[[^\]]+\])/g,h=/(#[^\s\+>~\.\[:]+)/g,u=/(\.[^\s\+>~\.\[:]+)/g,f=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,c=/(:[\w-]+\([^\)]*\))/gi,p=/(:[^\s\+>~\.\[:]+)/g,d=/([^\s\+>~\.\[:]+)/g;function m(t){var e=[0,0,0],i=function(i,n){var a=t.match(i);null!=a&&(e[n]+=a.length,t=t.replace(i," "))};return t=(t=t.replace(/:not\(([^\)]*)\)/g,"     $1 ")).replace(/{[\s\S]*/gm," "),i(l,1),i(h,0),i(u,1),i(f,2),i(c,1),i(p,1),t=(t=t.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," "),i(d,2),e.join("")}function y(i){var o={opts:i,FRAMERATE:30,MAX_VIRTUAL_PIXELS:3e4,rootEmSize:12,emSize:12,log:function(){}};1==o.opts.log&&"undefined"!=typeof console&&(o.log=function(t){console.log(t)}),o.init=function(t){var e=0;o.UniqueId=function(){return"canvg"+ ++e},o.Definitions={},o.Styles={},o.StylesSpecificity={},o.Animations=[],o.Images=[],o.ctx=t,o.ViewPort=new function(){this.viewPorts=[],this.Clear=function(){this.viewPorts=[]},this.SetCurrent=function(t,e){this.viewPorts.push({width:t,height:e})},this.RemoveCurrent=function(){this.viewPorts.pop()},this.Current=function(){return this.viewPorts[this.viewPorts.length-1]},this.width=function(){return this.Current().width},this.height=function(){return this.Current().height},this.ComputeSize=function(t){return null!=t&&"number"==typeof t?t:"x"==t?this.width():"y"==t?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}},o.init(),o.ImagesLoaded=function(){for(var t=0;t<o.Images.length;t++)if(!o.Images[t].loaded)return!1;return!0},o.trim=function(t){return t.replace(/^\s+|\s+$/g,"")},o.compressSpaces=function(t){return t.replace(/(?!\u3000)\s+/gm," ")},o.ajax=function(t){var e;return(e=n.XMLHttpRequest?new n.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"))?(e.open("GET",t,!1),e.send(null),e.responseText):null},o.parseXml=function(t){if("undefined"!=typeof Windows&&void 0!==Windows.Data&&void 0!==Windows.Data.Xml){var e=new Windows.Data.Xml.Dom.XmlDocument,a=new Windows.Data.Xml.Dom.XmlLoadSettings;return a.prohibitDtd=!1,e.loadXml(t,a),e}if(!n.DOMParser)return t=t.replace(/<!DOCTYPE svg[^>]*>/,""),(e=new ActiveXObject("Microsoft.XMLDOM")).async="false",e.loadXML(t),e;try{var s=i.xmldom?new n.DOMParser(i.xmldom):new n.DOMParser;return s.parseFromString(t,"image/svg+xml")}catch(e){return(s=i.xmldom?new n.DOMParser(i.xmldom):new n.DOMParser).parseFromString(t,"text/xml")}},o.Property=function(t,e){this.name=t,this.value=e},o.Property.prototype.getValue=function(){return this.value},o.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},o.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var t=parseFloat(this.value);return(this.value+"").match(/%$/)&&(t/=100),t},o.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},o.Property.prototype.numValueOrDefault=function(t){return this.hasValue()?this.numValue():parseFloat(t)},o.Property.prototype.addOpacity=function(e){var i=this.value;if(null!=e.value&&""!=e.value&&"string"==typeof this.value){var n=new t(this.value);n.ok&&(i="rgba("+n.r+", "+n.g+", "+n.b+", "+e.numValue()+")")}return new o.Property(this.name,i)},o.Property.prototype.getDefinition=function(){var t=this.value.match(/#([^\)'"]+)/);return t&&(t=t[1]),t||(t=this.value),o.Definitions[t]},o.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},o.Property.prototype.getFillStyleDefinition=function(t,e){var i=this.getDefinition();if(null!=i&&i.createGradient)return i.createGradient(o.ctx,t,e);if(null!=i&&i.createPattern){if(i.getHrefAttribute().hasValue()){var n=i.attribute("patternTransform");i=i.getHrefAttribute().getDefinition(),n.hasValue()&&(i.attribute("patternTransform",!0).value=n.value)}return i.createPattern(o.ctx,t,e)}return null},o.Property.prototype.getDPI=function(){return 96},o.Property.prototype.getREM=function(){return o.rootEmSize},o.Property.prototype.getEM=function(){return o.emSize},o.Property.prototype.getUnits=function(){return(this.value+"").replace(/[0-9\.\-]/g,"")},o.Property.prototype.isPixels=function(){if(!this.hasValue())return!1;var t=this.value+"";return!!t.match(/px$/)||!!t.match(/^[0-9]+$/)},o.Property.prototype.toPixels=function(t,e){if(!this.hasValue())return 0;var i=this.value+"";if(i.match(/rem$/))return this.numValue()*this.getREM(t);if(i.match(/em$/))return this.numValue()*this.getEM(t);if(i.match(/ex$/))return this.numValue()*this.getEM(t)/2;if(i.match(/px$/))return this.numValue();if(i.match(/pt$/))return this.numValue()*this.getDPI(t)*(1/72);if(i.match(/pc$/))return 15*this.numValue();if(i.match(/cm$/))return this.numValue()*this.getDPI(t)/2.54;if(i.match(/mm$/))return this.numValue()*this.getDPI(t)/25.4;if(i.match(/in$/))return this.numValue()*this.getDPI(t);if(i.match(/%$/))return this.numValue()*o.ViewPort.ComputeSize(t);var n=this.numValue();return e&&n<1?n*o.ViewPort.ComputeSize(t):n},o.Property.prototype.toMilliseconds=function(){return this.hasValue()?(this.value+"").match(/ms$/)?this.numValue():1e3*this.numValue():0},o.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/deg$/)?this.numValue()*(Math.PI/180):t.match(/grad$/)?this.numValue()*(Math.PI/200):t.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)};var l={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};return o.Property.prototype.toTextBaseline=function(){return this.hasValue()?l[this.value]:null},o.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(t,e,i,n,a,s){var r=null!=s?this.Parse(s):this.CreateFont("","","","","",o.ctx.font);return{fontFamily:a=a||r.fontFamily,fontSize:n||r.fontSize,fontStyle:t||r.fontStyle,fontWeight:i||r.fontWeight,fontVariant:e||r.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var t=this;this.Parse=function(e){for(var i={},n=o.trim(o.compressSpaces(e||"")).split(" "),a={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},s="",r=0;r<n.length;r++)a.fontStyle||-1==t.Styles.indexOf(n[r])?a.fontVariant||-1==t.Variants.indexOf(n[r])?a.fontWeight||-1==t.Weights.indexOf(n[r])?a.fontSize?"inherit"!=n[r]&&(s+=n[r]):("inherit"!=n[r]&&(i.fontSize=n[r].split("/")[0]),a.fontStyle=a.fontVariant=a.fontWeight=a.fontSize=!0):("inherit"!=n[r]&&(i.fontWeight=n[r]),a.fontStyle=a.fontVariant=a.fontWeight=!0):("inherit"!=n[r]&&(i.fontVariant=n[r]),a.fontStyle=a.fontVariant=!0):("inherit"!=n[r]&&(i.fontStyle=n[r]),a.fontStyle=!0);return""!=s&&(i.fontFamily=s),i}},o.ToNumberArray=function(t){for(var e=(t||"").match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm)||[],i=0;i<e.length;i++)e[i]=parseFloat(e[i]);return e},o.Point=function(t,e){this.x=t,this.y=e},o.Point.prototype.angleTo=function(t){return Math.atan2(t.y-this.y,t.x-this.x)},o.Point.prototype.applyTransform=function(t){var e=this.x*t[0]+this.y*t[2]+t[4],i=this.x*t[1]+this.y*t[3]+t[5];this.x=e,this.y=i},o.CreatePoint=function(t){var e=o.ToNumberArray(t);return new o.Point(e[0],e[1])},o.CreatePath=function(t){for(var e=o.ToNumberArray(t),i=[],n=0;n<e.length;n+=2)i.push(new o.Point(e[n],e[n+1]));return i},o.BoundingBox=function(t,e,i,n){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.x=function(){return this.x1},this.y=function(){return this.y1},this.width=function(){return this.x2-this.x1},this.height=function(){return this.y2-this.y1},this.addPoint=function(t,e){null!=t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))},this.addX=function(t){this.addPoint(t,null)},this.addY=function(t){this.addPoint(null,t)},this.addBoundingBox=function(t){this.addPoint(t.x1,t.y1),this.addPoint(t.x2,t.y2)},this.addQuadraticCurve=function(t,e,i,n,a,s){var r=t+2/3*(i-t),o=e+2/3*(n-e),l=r+1/3*(a-t),h=o+1/3*(s-e);this.addBezierCurve(t,e,r,l,o,h,a,s)},this.addBezierCurve=function(t,e,i,n,a,s,r,o){var l=[t,e],h=[i,n],u=[a,s],f=[r,o];this.addPoint(l[0],l[1]),this.addPoint(f[0],f[1]);for(var c=0;c<=1;c++){var p=function(t){return Math.pow(1-t,3)*l[c]+3*Math.pow(1-t,2)*t*h[c]+3*(1-t)*Math.pow(t,2)*u[c]+Math.pow(t,3)*f[c]},d=6*l[c]-12*h[c]+6*u[c],m=-3*l[c]+9*h[c]-9*u[c]+3*f[c],y=3*h[c]-3*l[c];if(0!=m){var g=Math.pow(d,2)-4*y*m;if(!(g<0)){var v=(-d+Math.sqrt(g))/(2*m);0<v&&v<1&&(0==c&&this.addX(p(v)),1==c&&this.addY(p(v)));var x=(-d-Math.sqrt(g))/(2*m);0<x&&x<1&&(0==c&&this.addX(p(x)),1==c&&this.addY(p(x)))}}else{if(0==d)continue;var b=-y/d;0<b&&b<1&&(0==c&&this.addX(p(b)),1==c&&this.addY(p(b)))}}},this.isPointInBox=function(t,e){return this.x1<=t&&t<=this.x2&&this.y1<=e&&e<=this.y2},this.addPoint(t,e),this.addPoint(i,n)},o.Transform=function(t){var e=this;this.Type={},this.Type.translate=function(t){this.p=o.CreatePoint(t),this.apply=function(t){t.translate(this.p.x||0,this.p.y||0)},this.unapply=function(t){t.translate(-1*this.p.x||0,-1*this.p.y||0)},this.applyToPoint=function(t){t.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0])}},this.Type.rotate=function(t){var e=o.ToNumberArray(t);this.angle=new o.Property("angle",e[0]),this.cx=e[1]||0,this.cy=e[2]||0,this.apply=function(t){t.translate(this.cx,this.cy),t.rotate(this.angle.toRadians()),t.translate(-this.cx,-this.cy)},this.unapply=function(t){t.translate(this.cx,this.cy),t.rotate(-1*this.angle.toRadians()),t.translate(-this.cx,-this.cy)},this.applyToPoint=function(t){var e=this.angle.toRadians();t.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]),t.applyTransform([Math.cos(e),Math.sin(e),-Math.sin(e),Math.cos(e),0,0]),t.applyTransform([1,0,0,1,-this.p.x||0,-this.p.y||0])}},this.Type.scale=function(t){this.p=o.CreatePoint(t),this.apply=function(t){t.scale(this.p.x||1,this.p.y||this.p.x||1)},this.unapply=function(t){t.scale(1/this.p.x||1,1/this.p.y||this.p.x||1)},this.applyToPoint=function(t){t.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}},this.Type.matrix=function(t){this.m=o.ToNumberArray(t),this.apply=function(t){t.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])},this.unapply=function(t){var e=this.m[0],i=this.m[2],n=this.m[4],a=this.m[1],s=this.m[3],r=this.m[5],o=1/(e*(1*s-0*r)-i*(1*a-0*r)+n*(0*a-0*s));t.transform(o*(1*s-0*r),o*(0*r-1*a),o*(0*n-1*i),o*(1*e-0*n),o*(i*r-n*s),o*(n*a-e*r))},this.applyToPoint=function(t){t.applyTransform(this.m)}},this.Type.SkewBase=function(t){this.base=e.Type.matrix,this.base(t),this.angle=new o.Property("angle",t)},this.Type.SkewBase.prototype=new this.Type.matrix,this.Type.skewX=function(t){this.base=e.Type.SkewBase,this.base(t),this.m=[1,0,Math.tan(this.angle.toRadians()),1,0,0]},this.Type.skewX.prototype=new this.Type.SkewBase,this.Type.skewY=function(t){this.base=e.Type.SkewBase,this.base(t),this.m=[1,Math.tan(this.angle.toRadians()),0,1,0,0]},this.Type.skewY.prototype=new this.Type.SkewBase,this.transforms=[],this.apply=function(t){for(var e=0;e<this.transforms.length;e++)this.transforms[e].apply(t)},this.unapply=function(t){for(var e=this.transforms.length-1;0<=e;e--)this.transforms[e].unapply(t)},this.applyToPoint=function(t){for(var e=0;e<this.transforms.length;e++)this.transforms[e].applyToPoint(t)};for(var i=o.trim(o.compressSpaces(t)).replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/),n=0;n<i.length;n++)if("none"!==i[n]){var a=o.trim(i[n].split("(")[0]),s=i[n].split("(")[1].replace(")",""),r=this.Type[a];if(void 0!==r){var l=new r(s);l.type=a,this.transforms.push(l)}}},o.AspectRatio=function(t,e,i,n,a,s,r,l,h,u){var f=(e=(e=o.compressSpaces(e)).replace(/^defer\s/,"")).split(" ")[0]||"xMidYMid",c=e.split(" ")[1]||"meet",p=i/n,d=a/s,m=Math.min(p,d),y=Math.max(p,d);"meet"==c&&(n*=m,s*=m),"slice"==c&&(n*=y,s*=y),h=new o.Property("refX",h),u=new o.Property("refY",u),h.hasValue()&&u.hasValue()?t.translate(-m*h.toPixels("x"),-m*u.toPixels("y")):(f.match(/^xMid/)&&("meet"==c&&m==d||"slice"==c&&y==d)&&t.translate(i/2-n/2,0),f.match(/YMid$/)&&("meet"==c&&m==p||"slice"==c&&y==p)&&t.translate(0,a/2-s/2),f.match(/^xMax/)&&("meet"==c&&m==d||"slice"==c&&y==d)&&t.translate(i-n,0),f.match(/YMax$/)&&("meet"==c&&m==p||"slice"==c&&y==p)&&t.translate(0,a-s)),"none"==f?t.scale(p,d):"meet"==c?t.scale(m,m):"slice"==c&&t.scale(y,y),t.translate(null==r?0:-r,null==l?0:-l)},o.Element={},o.EmptyProperty=new o.Property("EMPTY",""),o.Element.ElementBase=function(t){this.attributes={},this.styles={},this.stylesSpecificity={},this.children=[],this.attribute=function(t,e){var i=this.attributes[t];return null!=i?i:(1==e&&(i=new o.Property(t,""),this.attributes[t]=i),i||o.EmptyProperty)},this.getHrefAttribute=function(){for(var t in this.attributes)if("href"==t||t.match(/:href$/))return this.attributes[t];return o.EmptyProperty},this.style=function(t,e,i){var n=this.styles[t];if(null!=n)return n;var a=this.attribute(t);if(null!=a&&a.hasValue())return this.styles[t]=a;if(1!=i){var s=this.parent;if(null!=s){var r=s.style(t);if(null!=r&&r.hasValue())return r}}return 1==e&&(n=new o.Property(t,""),this.styles[t]=n),n||o.EmptyProperty},this.render=function(t){if("none"!=this.style("display").value&&"hidden"!=this.style("visibility").value){if(t.save(),this.style("mask").hasValue()){var e=this.style("mask").getDefinition();null!=e&&e.apply(t,this)}else if(this.style("filter").hasValue()){var i=this.style("filter").getDefinition();null!=i&&i.apply(t,this)}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}},this.setContext=function(){},this.clearContext=function(){},this.renderChildren=function(t){for(var e=0;e<this.children.length;e++)this.children[e].render(t)},this.addChild=function(t,e){var i=t;e&&(i=o.CreateElement(t)),i.parent=this,"title"!=i.type&&this.children.push(i)},this.addStylesFromStyleDefinition=function(){for(var e in o.Styles)if("@"!=e[0]&&r(t,e)){var i=o.Styles[e],n=o.StylesSpecificity[e];if(null!=i)for(var a in i){var s=this.stylesSpecificity[a];void 0===s&&(s="000"),s<=n&&(this.styles[a]=i[a],this.stylesSpecificity[a]=n)}}};var e,i=new RegExp("^[A-Z-]+$");if(null!=t&&1==t.nodeType){for(var n=0;n<t.attributes.length;n++){var a=t.attributes[n],s=(e=a.nodeName,i.test(e)?e.toLowerCase():e);this.attributes[s]=new o.Property(s,a.value)}if(this.addStylesFromStyleDefinition(),this.attribute("style").hasValue()){var l=this.attribute("style").value.split(";");for(n=0;n<l.length;n++)if(""!=o.trim(l[n])){var h=l[n].split(":"),u=o.trim(h[0]),f=o.trim(h[1]);this.styles[u]=new o.Property(u,f)}}for(this.attribute("id").hasValue()&&null==o.Definitions[this.attribute("id").value]&&(o.Definitions[this.attribute("id").value]=this),n=0;n<t.childNodes.length;n++){var c=t.childNodes[n];if(1==c.nodeType&&this.addChild(c,!0),this.captureTextNodes&&(3==c.nodeType||4==c.nodeType)){var p=c.value||c.text||c.textContent||"";""!=o.compressSpaces(p)&&this.addChild(new o.Element.tspan(c),!1)}}}},o.Element.RenderedElementBase=function(t){this.base=o.Element.ElementBase,this.base(t),this.calculateOpacity=function(){for(var t=1,e=this;null!=e;){var i=e.style("opacity",!1,!0);i.hasValue()&&(t*=i.numValue()),e=e.parent}return t},this.setContext=function(t,e){if(!e){var i;if(this.style("fill").isUrlDefinition())null!=(i=this.style("fill").getFillStyleDefinition(this,this.style("fill-opacity")))&&(t.fillStyle=i);else if(this.style("fill").hasValue()){var n;"currentColor"==(n=this.style("fill")).value&&(n.value=this.style("color").value),"inherit"!=n.value&&(t.fillStyle="none"==n.value?"rgba(0,0,0,0)":n.value)}if(this.style("fill-opacity").hasValue()&&(n=(n=new o.Property("fill",t.fillStyle)).addOpacity(this.style("fill-opacity")),t.fillStyle=n.value),this.style("stroke").isUrlDefinition())null!=(i=this.style("stroke").getFillStyleDefinition(this,this.style("stroke-opacity")))&&(t.strokeStyle=i);else if(this.style("stroke").hasValue()){var a;"currentColor"==(a=this.style("stroke")).value&&(a.value=this.style("color").value),"inherit"!=a.value&&(t.strokeStyle="none"==a.value?"rgba(0,0,0,0)":a.value)}if(this.style("stroke-opacity").hasValue()&&(a=(a=new o.Property("stroke",t.strokeStyle)).addOpacity(this.style("stroke-opacity")),t.strokeStyle=a.value),this.style("stroke-width").hasValue()){var s=this.style("stroke-width").toPixels();t.lineWidth=0==s?.001:s}if(this.style("stroke-linecap").hasValue()&&(t.lineCap=this.style("stroke-linecap").value),this.style("stroke-linejoin").hasValue()&&(t.lineJoin=this.style("stroke-linejoin").value),this.style("stroke-miterlimit").hasValue()&&(t.miterLimit=this.style("stroke-miterlimit").value),this.style("paint-order").hasValue()&&(t.paintOrder=this.style("paint-order").value),this.style("stroke-dasharray").hasValue()&&"none"!=this.style("stroke-dasharray").value){var r=o.ToNumberArray(this.style("stroke-dasharray").value);void 0!==t.setLineDash?t.setLineDash(r):void 0!==t.webkitLineDash?t.webkitLineDash=r:void 0===t.mozDash||1==r.length&&0==r[0]||(t.mozDash=r);var l=this.style("stroke-dashoffset").toPixels();void 0!==t.lineDashOffset?t.lineDashOffset=l:void 0!==t.webkitLineDashOffset?t.webkitLineDashOffset=l:void 0!==t.mozDashOffset&&(t.mozDashOffset=l)}}if(void 0!==t.font)if(this.style("font").hasValue())t.font=this.style("font").value;else{t.font=o.Font.CreateFont(this.style("font-style").value,this.style("font-variant").value,this.style("font-weight").value,this.style("font-size").hasValue()?this.style("font-size").toPixels()+"px":"",this.style("font-family").value).toString();var h=this.style("font-size",!1,!1);h.isPixels()&&(o.emSize=h.toPixels())}if(this.style("transform",!1,!0).hasValue()&&new o.Transform(this.style("transform",!1,!0).value).apply(t),this.style("clip-path",!1,!0).hasValue()){var u=this.style("clip-path",!1,!0).getDefinition();null!=u&&u.apply(t)}t.globalAlpha=this.calculateOpacity()}},o.Element.RenderedElementBase.prototype=new o.Element.ElementBase,o.Element.PathElementBase=function(t){this.base=o.Element.RenderedElementBase,this.base(t),this.path=function(t){return null!=t&&t.beginPath(),new o.BoundingBox},this.renderChildren=function(t){this.path(t),o.Mouse.checkPath(this,t),""!=t.fillStyle&&("inherit"!=this.style("fill-rule").valueOrDefault("inherit")?t.fill(this.style("fill-rule").value):t.fill()),""!=t.strokeStyle&&t.stroke();var e=this.getMarkers();if(null!=e){if(this.style("marker-start").isUrlDefinition()&&(i=this.style("marker-start").getDefinition()).render(t,e[0][0],e[0][1]),this.style("marker-mid").isUrlDefinition())for(var i=this.style("marker-mid").getDefinition(),n=1;n<e.length-1;n++)i.render(t,e[n][0],e[n][1]);this.style("marker-end").isUrlDefinition()&&(i=this.style("marker-end").getDefinition()).render(t,e[e.length-1][0],e[e.length-1][1])}},this.getBoundingBox=function(){return this.path()},this.getMarkers=function(){return null}},o.Element.PathElementBase.prototype=new o.Element.RenderedElementBase,o.SetDefaults=function(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4},o.Element.svg=function(t){this.base=o.Element.RenderedElementBase,this.base(t),this.baseClearContext=this.clearContext,this.clearContext=function(t){this.baseClearContext(t),o.ViewPort.RemoveCurrent()},this.baseSetContext=this.setContext,this.setContext=function(t){if(o.SetDefaults(t),t.canvas.style&&void 0!==t.font&&void 0!==n.getComputedStyle){t.font=n.getComputedStyle(t.canvas).getPropertyValue("font");var e=new o.Property("fontSize",o.Font.Parse(t.font).fontSize);e.hasValue()&&(o.rootEmSize=o.emSize=e.toPixels("y"))}this.baseSetContext(t),this.attribute("x").hasValue()||(this.attribute("x",!0).value=0),this.attribute("y").hasValue()||(this.attribute("y",!0).value=0),t.translate(this.attribute("x").toPixels("x"),this.attribute("y").toPixels("y"));var i=o.ViewPort.width(),a=o.ViewPort.height();if(this.attribute("width").hasValue()||(this.attribute("width",!0).value="100%"),this.attribute("height").hasValue()||(this.attribute("height",!0).value="100%"),void 0===this.root){i=this.attribute("width").toPixels("x"),a=this.attribute("height").toPixels("y");var s=0,r=0;this.attribute("refX").hasValue()&&this.attribute("refY").hasValue()&&(s=-this.attribute("refX").toPixels("x"),r=-this.attribute("refY").toPixels("y")),"visible"!=this.attribute("overflow").valueOrDefault("hidden")&&(t.beginPath(),t.moveTo(s,r),t.lineTo(i,r),t.lineTo(i,a),t.lineTo(s,a),t.closePath(),t.clip())}if(o.ViewPort.SetCurrent(i,a),this.attribute("viewBox").hasValue()){var l=o.ToNumberArray(this.attribute("viewBox").value),h=l[0],u=l[1];i=l[2],a=l[3],o.AspectRatio(t,this.attribute("preserveAspectRatio").value,o.ViewPort.width(),i,o.ViewPort.height(),a,h,u,this.attribute("refX").value,this.attribute("refY").value),o.ViewPort.RemoveCurrent(),o.ViewPort.SetCurrent(l[2],l[3])}}},o.Element.svg.prototype=new o.Element.RenderedElementBase,o.Element.rect=function(t){this.base=o.Element.PathElementBase,this.base(t),this.path=function(t){var e=this.attribute("x").toPixels("x"),i=this.attribute("y").toPixels("y"),n=this.attribute("width").toPixels("x"),a=this.attribute("height").toPixels("y"),s=this.attribute("rx").toPixels("x"),r=this.attribute("ry").toPixels("y");if(this.attribute("rx").hasValue()&&!this.attribute("ry").hasValue()&&(r=s),this.attribute("ry").hasValue()&&!this.attribute("rx").hasValue()&&(s=r),s=Math.min(s,n/2),r=Math.min(r,a/2),null!=t){var l=(Math.sqrt(2)-1)/3*4;t.beginPath(),0<a&&0<n&&(t.moveTo(e+s,i),t.lineTo(e+n-s,i),t.bezierCurveTo(e+n-s+l*s,i,e+n,i+r-l*r,e+n,i+r),t.lineTo(e+n,i+a-r),t.bezierCurveTo(e+n,i+a-r+l*r,e+n-s+l*s,i+a,e+n-s,i+a),t.lineTo(e+s,i+a),t.bezierCurveTo(e+s-l*s,i+a,e,i+a-r+l*r,e,i+a-r),t.lineTo(e,i+r),t.bezierCurveTo(e,i+r-l*r,e+s-l*s,i,e+s,i),t.closePath())}return new o.BoundingBox(e,i,e+n,i+a)}},o.Element.rect.prototype=new o.Element.PathElementBase,o.Element.circle=function(t){this.base=o.Element.PathElementBase,this.base(t),this.path=function(t){var e=this.attribute("cx").toPixels("x"),i=this.attribute("cy").toPixels("y"),n=this.attribute("r").toPixels();return null!=t&&0<n&&(t.beginPath(),t.arc(e,i,n,0,2*Math.PI,!1),t.closePath()),new o.BoundingBox(e-n,i-n,e+n,i+n)}},o.Element.circle.prototype=new o.Element.PathElementBase,o.Element.ellipse=function(t){this.base=o.Element.PathElementBase,this.base(t),this.path=function(t){var e=(Math.sqrt(2)-1)/3*4,i=this.attribute("rx").toPixels("x"),n=this.attribute("ry").toPixels("y"),a=this.attribute("cx").toPixels("x"),s=this.attribute("cy").toPixels("y");return null!=t&&(t.beginPath(),t.moveTo(a+i,s),t.bezierCurveTo(a+i,s+e*n,a+e*i,s+n,a,s+n),t.bezierCurveTo(a-e*i,s+n,a-i,s+e*n,a-i,s),t.bezierCurveTo(a-i,s-e*n,a-e*i,s-n,a,s-n),t.bezierCurveTo(a+e*i,s-n,a+i,s-e*n,a+i,s),t.closePath()),new o.BoundingBox(a-i,s-n,a+i,s+n)}},o.Element.ellipse.prototype=new o.Element.PathElementBase,o.Element.line=function(t){this.base=o.Element.PathElementBase,this.base(t),this.getPoints=function(){return[new o.Point(this.attribute("x1").toPixels("x"),this.attribute("y1").toPixels("y")),new o.Point(this.attribute("x2").toPixels("x"),this.attribute("y2").toPixels("y"))]},this.path=function(t){var e=this.getPoints();return null!=t&&(t.beginPath(),t.moveTo(e[0].x,e[0].y),t.lineTo(e[1].x,e[1].y)),new o.BoundingBox(e[0].x,e[0].y,e[1].x,e[1].y)},this.getMarkers=function(){var t=this.getPoints(),e=t[0].angleTo(t[1]);return[[t[0],e],[t[1],e]]}},o.Element.line.prototype=new o.Element.PathElementBase,o.Element.polyline=function(t){this.base=o.Element.PathElementBase,this.base(t),this.points=o.CreatePath(this.attribute("points").value),this.path=function(t){var e=new o.BoundingBox(this.points[0].x,this.points[0].y);null!=t&&(t.beginPath(),t.moveTo(this.points[0].x,this.points[0].y));for(var i=1;i<this.points.length;i++)e.addPoint(this.points[i].x,this.points[i].y),null!=t&&t.lineTo(this.points[i].x,this.points[i].y);return e},this.getMarkers=function(){for(var t=[],e=0;e<this.points.length-1;e++)t.push([this.points[e],this.points[e].angleTo(this.points[e+1])]);return 0<t.length&&t.push([this.points[this.points.length-1],t[t.length-1][1]]),t}},o.Element.polyline.prototype=new o.Element.PathElementBase,o.Element.polygon=function(t){this.base=o.Element.polyline,this.base(t),this.basePath=this.path,this.path=function(t){var e=this.basePath(t);return null!=t&&(t.lineTo(this.points[0].x,this.points[0].y),t.closePath()),e}},o.Element.polygon.prototype=new o.Element.polyline,o.Element.path=function(t){this.base=o.Element.PathElementBase,this.base(t);var e=this.attribute("d").value;e=e.replace(/,/gm," ");for(var i=0;i<2;i++)e=e.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,"$1 $2");for(e=(e=e.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2")).replace(/([0-9])([+\-])/gm,"$1 $2"),i=0;i<2;i++)e=e.replace(/(\.[0-9]*)(\.)/gm,"$1 $2");e=e.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 "),e=o.compressSpaces(e),e=o.trim(e),this.PathParser=new function(t){this.tokens=t.split(" "),this.reset=function(){this.i=-1,this.command="",this.previousCommand="",this.start=new o.Point(0,0),this.control=new o.Point(0,0),this.current=new o.Point(0,0),this.points=[],this.angles=[]},this.isEnd=function(){return this.i>=this.tokens.length-1},this.isCommandOrEnd=function(){return!!this.isEnd()||null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var t=new o.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(t)},this.getAsControlPoint=function(){var t=this.getPoint();return this.control=t},this.getAsCurrentPoint=function(){var t=this.getPoint();return this.current=t},this.getReflectedControlPoint=function(){return"c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase()?this.current:new o.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},this.makeAbsolute=function(t){return this.isRelativeCommand()&&(t.x+=this.current.x,t.y+=this.current.y),t},this.addMarker=function(t,e,i){null!=i&&0<this.angles.length&&null==this.angles[this.angles.length-1]&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(i)),this.addMarkerAngle(t,null==e?null:e.angleTo(t))},this.addMarkerAngle=function(t,e){this.points.push(t),this.angles.push(e)},this.getMarkerPoints=function(){return this.points},this.getMarkerAngles=function(){for(var t=0;t<this.angles.length;t++)if(null==this.angles[t])for(var e=t+1;e<this.angles.length;e++)if(null!=this.angles[e]){this.angles[t]=this.angles[e];break}return this.angles}}(e),this.path=function(t){var e=this.PathParser;e.reset();var i=new o.BoundingBox;for(null!=t&&t.beginPath();!e.isEnd();)switch(e.nextCommand(),e.command){case"M":case"m":var n=e.getAsCurrentPoint();for(e.addMarker(n),i.addPoint(n.x,n.y),null!=t&&t.moveTo(n.x,n.y),e.start=e.current;!e.isCommandOrEnd();)n=e.getAsCurrentPoint(),e.addMarker(n,e.start),i.addPoint(n.x,n.y),null!=t&&t.lineTo(n.x,n.y);break;case"L":case"l":for(;!e.isCommandOrEnd();){var a=e.current;n=e.getAsCurrentPoint(),e.addMarker(n,a),i.addPoint(n.x,n.y),null!=t&&t.lineTo(n.x,n.y)}break;case"H":case"h":for(;!e.isCommandOrEnd();){var s=new o.Point((e.isRelativeCommand()?e.current.x:0)+e.getScalar(),e.current.y);e.addMarker(s,e.current),e.current=s,i.addPoint(e.current.x,e.current.y),null!=t&&t.lineTo(e.current.x,e.current.y)}break;case"V":case"v":for(;!e.isCommandOrEnd();)s=new o.Point(e.current.x,(e.isRelativeCommand()?e.current.y:0)+e.getScalar()),e.addMarker(s,e.current),e.current=s,i.addPoint(e.current.x,e.current.y),null!=t&&t.lineTo(e.current.x,e.current.y);break;case"C":case"c":for(;!e.isCommandOrEnd();){var r=e.current,l=e.getPoint(),h=e.getAsControlPoint(),u=e.getAsCurrentPoint();e.addMarker(u,h,l),i.addBezierCurve(r.x,r.y,l.x,l.y,h.x,h.y,u.x,u.y),null!=t&&t.bezierCurveTo(l.x,l.y,h.x,h.y,u.x,u.y)}break;case"S":case"s":for(;!e.isCommandOrEnd();)r=e.current,l=e.getReflectedControlPoint(),h=e.getAsControlPoint(),u=e.getAsCurrentPoint(),e.addMarker(u,h,l),i.addBezierCurve(r.x,r.y,l.x,l.y,h.x,h.y,u.x,u.y),null!=t&&t.bezierCurveTo(l.x,l.y,h.x,h.y,u.x,u.y);break;case"Q":case"q":for(;!e.isCommandOrEnd();)r=e.current,h=e.getAsControlPoint(),u=e.getAsCurrentPoint(),e.addMarker(u,h,h),i.addQuadraticCurve(r.x,r.y,h.x,h.y,u.x,u.y),null!=t&&t.quadraticCurveTo(h.x,h.y,u.x,u.y);break;case"T":case"t":for(;!e.isCommandOrEnd();)r=e.current,h=e.getReflectedControlPoint(),e.control=h,u=e.getAsCurrentPoint(),e.addMarker(u,h,h),i.addQuadraticCurve(r.x,r.y,h.x,h.y,u.x,u.y),null!=t&&t.quadraticCurveTo(h.x,h.y,u.x,u.y);break;case"A":case"a":for(;!e.isCommandOrEnd();){r=e.current;var f=e.getScalar(),c=e.getScalar(),p=e.getScalar()*(Math.PI/180),d=e.getScalar(),m=e.getScalar(),y=(u=e.getAsCurrentPoint(),new o.Point(Math.cos(p)*(r.x-u.x)/2+Math.sin(p)*(r.y-u.y)/2,-Math.sin(p)*(r.x-u.x)/2+Math.cos(p)*(r.y-u.y)/2)),g=Math.pow(y.x,2)/Math.pow(f,2)+Math.pow(y.y,2)/Math.pow(c,2);1<g&&(f*=Math.sqrt(g),c*=Math.sqrt(g));var v=(d==m?-1:1)*Math.sqrt((Math.pow(f,2)*Math.pow(c,2)-Math.pow(f,2)*Math.pow(y.y,2)-Math.pow(c,2)*Math.pow(y.x,2))/(Math.pow(f,2)*Math.pow(y.y,2)+Math.pow(c,2)*Math.pow(y.x,2)));isNaN(v)&&(v=0);var x=new o.Point(v*f*y.y/c,v*-c*y.x/f),b=new o.Point((r.x+u.x)/2+Math.cos(p)*x.x-Math.sin(p)*x.y,(r.y+u.y)/2+Math.sin(p)*x.x+Math.cos(p)*x.y),P=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))},E=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(P(t)*P(e))},w=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(E(t,e))},C=w([1,0],[(y.x-x.x)/f,(y.y-x.y)/c]),B=[(y.x-x.x)/f,(y.y-x.y)/c],M=[(-y.x-x.x)/f,(-y.y-x.y)/c],T=w(B,M);E(B,M)<=-1&&(T=Math.PI),1<=E(B,M)&&(T=0);var S=1-m?1:-1,k=C+S*(T/2),V=new o.Point(b.x+f*Math.cos(k),b.y+c*Math.sin(k));if(e.addMarkerAngle(V,k-S*Math.PI/2),e.addMarkerAngle(u,k-S*Math.PI),i.addPoint(u.x,u.y),null!=t&&!isNaN(C)&&!isNaN(T)){E=c<f?f:c;var A=c<f?1:f/c,D=c<f?c/f:1;t.translate(b.x,b.y),t.rotate(p),t.scale(A,D),t.arc(0,0,E,C,C+T,1-m),t.scale(1/A,1/D),t.rotate(-p),t.translate(-b.x,-b.y)}}break;case"Z":case"z":null!=t&&i.x1!==i.x2&&i.y1!==i.y2&&t.closePath(),e.current=e.start}return i},this.getMarkers=function(){for(var t=this.PathParser.getMarkerPoints(),e=this.PathParser.getMarkerAngles(),i=[],n=0;n<t.length;n++)i.push([t[n],e[n]]);return i}},o.Element.path.prototype=new o.Element.PathElementBase,o.Element.pattern=function(t){this.base=o.Element.ElementBase,this.base(t),this.createPattern=function(t,e,i){var n=this.attribute("width").toPixels("x",!0),a=this.attribute("height").toPixels("y",!0),r=new o.Element.svg;r.attributes.viewBox=new o.Property("viewBox",this.attribute("viewBox").value),r.attributes.width=new o.Property("width",n+"px"),r.attributes.height=new o.Property("height",a+"px"),r.attributes.transform=new o.Property("transform",this.attribute("patternTransform").value),r.children=this.children;var l=s(n,a),h=l.getContext("2d");this.attribute("x").hasValue()&&this.attribute("y").hasValue()&&h.translate(this.attribute("x").toPixels("x",!0),this.attribute("y").toPixels("y",!0)),i.hasValue()?this.styles["fill-opacity"]=i:delete this.styles["fill-opacity"];for(var u=-1;u<=1;u++)for(var f=-1;f<=1;f++)h.save(),r.attributes.x=new o.Property("x",u*l.width),r.attributes.y=new o.Property("y",f*l.height),r.render(h),h.restore();return t.createPattern(l,"repeat")}},o.Element.pattern.prototype=new o.Element.ElementBase,o.Element.marker=function(t){this.base=o.Element.ElementBase,this.base(t),this.baseRender=this.render,this.render=function(t,e,i){if(e){t.translate(e.x,e.y),"auto"==this.attribute("orient").valueOrDefault("auto")&&t.rotate(i),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&t.scale(t.lineWidth,t.lineWidth),t.save();var n=new o.Element.svg;n.attributes.viewBox=new o.Property("viewBox",this.attribute("viewBox").value),n.attributes.refX=new o.Property("refX",this.attribute("refX").value),n.attributes.refY=new o.Property("refY",this.attribute("refY").value),n.attributes.width=new o.Property("width",this.attribute("markerWidth").value),n.attributes.height=new o.Property("height",this.attribute("markerHeight").value),n.attributes.fill=new o.Property("fill",this.attribute("fill").valueOrDefault("black")),n.attributes.stroke=new o.Property("stroke",this.attribute("stroke").valueOrDefault("none")),n.children=this.children,n.render(t),t.restore(),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&t.scale(1/t.lineWidth,1/t.lineWidth),"auto"==this.attribute("orient").valueOrDefault("auto")&&t.rotate(-i),t.translate(-e.x,-e.y)}}},o.Element.marker.prototype=new o.Element.ElementBase,o.Element.defs=function(t){this.base=o.Element.ElementBase,this.base(t),this.render=function(){}},o.Element.defs.prototype=new o.Element.ElementBase,o.Element.GradientBase=function(t){this.base=o.Element.ElementBase,this.base(t),this.stops=[];for(var e=0;e<this.children.length;e++){var i=this.children[e];"stop"==i.type&&this.stops.push(i)}this.getGradient=function(){},this.gradientUnits=function(){return this.attribute("gradientUnits").valueOrDefault("objectBoundingBox")},this.attributesToInherit=["gradientUnits"],this.inheritStopContainer=function(t){for(var e=0;e<this.attributesToInherit.length;e++){var i=this.attributesToInherit[e];!this.attribute(i).hasValue()&&t.attribute(i).hasValue()&&(this.attribute(i,!0).value=t.attribute(i).value)}},this.createGradient=function(t,e,i){var n=this;this.getHrefAttribute().hasValue()&&(n=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(n));var a=function(t){return i.hasValue()?new o.Property("color",t).addOpacity(i).value:t},r=this.getGradient(t,e);if(null==r)return a(n.stops[n.stops.length-1].color);for(var l=0;l<n.stops.length;l++)r.addColorStop(n.stops[l].offset,a(n.stops[l].color));if(this.attribute("gradientTransform").hasValue()){var h=o.ViewPort.viewPorts[0],u=new o.Element.rect;u.attributes.x=new o.Property("x",-o.MAX_VIRTUAL_PIXELS/3),u.attributes.y=new o.Property("y",-o.MAX_VIRTUAL_PIXELS/3),u.attributes.width=new o.Property("width",o.MAX_VIRTUAL_PIXELS),u.attributes.height=new o.Property("height",o.MAX_VIRTUAL_PIXELS);var f=new o.Element.g;f.attributes.transform=new o.Property("transform",this.attribute("gradientTransform").value),f.children=[u];var c=new o.Element.svg;c.attributes.x=new o.Property("x",0),c.attributes.y=new o.Property("y",0),c.attributes.width=new o.Property("width",h.width),c.attributes.height=new o.Property("height",h.height),c.children=[f];var p=s(h.width,h.height),d=p.getContext("2d");return d.fillStyle=r,c.render(d),d.createPattern(p,"no-repeat")}return r}},o.Element.GradientBase.prototype=new o.Element.ElementBase,o.Element.linearGradient=function(t){this.base=o.Element.GradientBase,this.base(t),this.attributesToInherit.push("x1"),this.attributesToInherit.push("y1"),this.attributesToInherit.push("x2"),this.attributesToInherit.push("y2"),this.getGradient=function(t,e){var i="objectBoundingBox"==this.gradientUnits()?e.getBoundingBox(t):null;this.attribute("x1").hasValue()||this.attribute("y1").hasValue()||this.attribute("x2").hasValue()||this.attribute("y2").hasValue()||(this.attribute("x1",!0).value=0,this.attribute("y1",!0).value=0,this.attribute("x2",!0).value=1,this.attribute("y2",!0).value=0);var n="objectBoundingBox"==this.gradientUnits()?i.x()+i.width()*this.attribute("x1").numValue():this.attribute("x1").toPixels("x"),a="objectBoundingBox"==this.gradientUnits()?i.y()+i.height()*this.attribute("y1").numValue():this.attribute("y1").toPixels("y"),s="objectBoundingBox"==this.gradientUnits()?i.x()+i.width()*this.attribute("x2").numValue():this.attribute("x2").toPixels("x"),r="objectBoundingBox"==this.gradientUnits()?i.y()+i.height()*this.attribute("y2").numValue():this.attribute("y2").toPixels("y");return n==s&&a==r?null:t.createLinearGradient(n,a,s,r)}},o.Element.linearGradient.prototype=new o.Element.GradientBase,o.Element.radialGradient=function(t){this.base=o.Element.GradientBase,this.base(t),this.attributesToInherit.push("cx"),this.attributesToInherit.push("cy"),this.attributesToInherit.push("r"),this.attributesToInherit.push("fx"),this.attributesToInherit.push("fy"),this.attributesToInherit.push("fr"),this.getGradient=function(t,e){var i=e.getBoundingBox(t);this.attribute("cx").hasValue()||(this.attribute("cx",!0).value="50%"),this.attribute("cy").hasValue()||(this.attribute("cy",!0).value="50%"),this.attribute("r").hasValue()||(this.attribute("r",!0).value="50%");var n="objectBoundingBox"==this.gradientUnits()?i.x()+i.width()*this.attribute("cx").numValue():this.attribute("cx").toPixels("x"),a="objectBoundingBox"==this.gradientUnits()?i.y()+i.height()*this.attribute("cy").numValue():this.attribute("cy").toPixels("y"),s=n,r=a;this.attribute("fx").hasValue()&&(s="objectBoundingBox"==this.gradientUnits()?i.x()+i.width()*this.attribute("fx").numValue():this.attribute("fx").toPixels("x")),this.attribute("fy").hasValue()&&(r="objectBoundingBox"==this.gradientUnits()?i.y()+i.height()*this.attribute("fy").numValue():this.attribute("fy").toPixels("y"));var o="objectBoundingBox"==this.gradientUnits()?(i.width()+i.height())/2*this.attribute("r").numValue():this.attribute("r").toPixels(),l=this.attribute("fr").toPixels();return t.createRadialGradient(s,r,l,n,a,o)}},o.Element.radialGradient.prototype=new o.Element.GradientBase,o.Element.stop=function(t){this.base=o.Element.ElementBase,this.base(t),this.offset=this.attribute("offset").numValue(),this.offset<0&&(this.offset=0),1<this.offset&&(this.offset=1);var e=this.style("stop-color",!0);""===e.value&&(e.value="#000"),this.style("stop-opacity").hasValue()&&(e=e.addOpacity(this.style("stop-opacity"))),this.color=e.value},o.Element.stop.prototype=new o.Element.ElementBase,o.Element.AnimateBase=function(t){this.base=o.Element.ElementBase,this.base(t),o.Animations.push(this),this.duration=0,this.begin=this.attribute("begin").toMilliseconds(),this.maxDuration=this.begin+this.attribute("dur").toMilliseconds(),this.getProperty=function(){var t=this.attribute("attributeType").value,e=this.attribute("attributeName").value;return"CSS"==t?this.parent.style(e,!0):this.parent.attribute(e,!0)},this.initialValue=null,this.initialUnits="",this.removed=!1,this.calcValue=function(){return""},this.update=function(t){if(null==this.initialValue&&(this.initialValue=this.getProperty().value,this.initialUnits=this.getProperty().getUnits()),this.duration>this.maxDuration){if("indefinite"==this.attribute("repeatCount").value||"indefinite"==this.attribute("repeatDur").value)this.duration=0;else if("freeze"!=this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"==this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration=this.duration+t;var e=!1;if(this.begin<this.duration){var i=this.calcValue();this.attribute("type").hasValue()&&(i=this.attribute("type").value+"("+i+")"),this.getProperty().value=i,e=!0}return e},this.from=this.attribute("from"),this.to=this.attribute("to"),this.values=this.attribute("values"),this.values.hasValue()&&(this.values.value=this.values.value.split(";")),this.progress=function(){var t={progress:(this.duration-this.begin)/(this.maxDuration-this.begin)};if(this.values.hasValue()){var e=t.progress*(this.values.value.length-1),i=Math.floor(e),n=Math.ceil(e);t.from=new o.Property("from",parseFloat(this.values.value[i])),t.to=new o.Property("to",parseFloat(this.values.value[n])),t.progress=(e-i)/(n-i)}else t.from=this.from,t.to=this.to;return t}},o.Element.AnimateBase.prototype=new o.Element.ElementBase,o.Element.animate=function(t){this.base=o.Element.AnimateBase,this.base(t),this.calcValue=function(){var t=this.progress(),e=t.from.numValue()+(t.to.numValue()-t.from.numValue())*t.progress;return"%"===this.initialUnits&&(e*=100),e+this.initialUnits}},o.Element.animate.prototype=new o.Element.AnimateBase,o.Element.animateColor=function(e){this.base=o.Element.AnimateBase,this.base(e),this.calcValue=function(){var e=this.progress(),i=new t(e.from.value),n=new t(e.to.value);if(i.ok&&n.ok){var a=i.r+(n.r-i.r)*e.progress,s=i.g+(n.g-i.g)*e.progress,r=i.b+(n.b-i.b)*e.progress;return"rgb("+parseInt(a,10)+","+parseInt(s,10)+","+parseInt(r,10)+")"}return this.attribute("from").value}},o.Element.animateColor.prototype=new o.Element.AnimateBase,o.Element.animateTransform=function(t){this.base=o.Element.AnimateBase,this.base(t),this.calcValue=function(){for(var t=this.progress(),e=o.ToNumberArray(t.from.value),i=o.ToNumberArray(t.to.value),n="",a=0;a<e.length;a++)n+=e[a]+(i[a]-e[a])*t.progress+" ";return n}},o.Element.animateTransform.prototype=new o.Element.animate,o.Element.font=function(t){this.base=o.Element.ElementBase,this.base(t),this.horizAdvX=this.attribute("horiz-adv-x").numValue(),this.isRTL=!1,this.isArabic=!1,this.fontFace=null,this.missingGlyph=null,this.glyphs=[];for(var e=0;e<this.children.length;e++){var i=this.children[e];"font-face"==i.type?(this.fontFace=i).style("font-family").hasValue()&&(o.Definitions[i.style("font-family").value]=this):"missing-glyph"==i.type?this.missingGlyph=i:"glyph"==i.type&&(""!=i.arabicForm?(this.isRTL=!0,this.isArabic=!0,void 0===this.glyphs[i.unicode]&&(this.glyphs[i.unicode]=[]),this.glyphs[i.unicode][i.arabicForm]=i):this.glyphs[i.unicode]=i)}this.render=function(){}},o.Element.font.prototype=new o.Element.ElementBase,o.Element.fontface=function(t){this.base=o.Element.ElementBase,this.base(t),this.ascent=this.attribute("ascent").value,this.descent=this.attribute("descent").value,this.unitsPerEm=this.attribute("units-per-em").numValue()},o.Element.fontface.prototype=new o.Element.ElementBase,o.Element.missingglyph=function(t){this.base=o.Element.path,this.base(t),this.horizAdvX=0},o.Element.missingglyph.prototype=new o.Element.path,o.Element.glyph=function(t){this.base=o.Element.path,this.base(t),this.horizAdvX=this.attribute("horiz-adv-x").numValue(),this.unicode=this.attribute("unicode").value,this.arabicForm=this.attribute("arabic-form").value},o.Element.glyph.prototype=new o.Element.path,o.Element.text=function(t){this.captureTextNodes=!0,this.base=o.Element.RenderedElementBase,this.base(t),this.baseSetContext=this.setContext,this.setContext=function(t){this.baseSetContext(t);var e=this.style("dominant-baseline").toTextBaseline();null==e&&(e=this.style("alignment-baseline").toTextBaseline()),null!=e&&(t.textBaseline=e)},this.initializeCoordinates=function(t){this.x=this.attribute("x").toPixels("x"),this.y=this.attribute("y").toPixels("y"),this.attribute("dx").hasValue()&&(this.x+=this.attribute("dx").toPixels("x")),this.attribute("dy").hasValue()&&(this.y+=this.attribute("dy").toPixels("y")),this.x+=this.getAnchorDelta(t,this,0)},this.getBoundingBox=function(t){this.initializeCoordinates(t);for(var e=null,i=0;i<this.children.length;i++){var n=this.getChildBoundingBox(t,this,this,i);null==e?e=n:e.addBoundingBox(n)}return e},this.renderChildren=function(t){this.initializeCoordinates(t);for(var e=0;e<this.children.length;e++)this.renderChild(t,this,this,e);o.Mouse.checkBoundingBox(this,this.getBoundingBox(t))},this.getAnchorDelta=function(t,e,i){var n=this.style("text-anchor").valueOrDefault("start");if("start"==n)return 0;for(var a=0,s=i;s<e.children.length;s++){var r=e.children[s];if(i<s&&r.attribute("x").hasValue())break;a+=r.measureTextRecursive(t)}return-1*("end"==n?a:a/2)},this.adjustChildCoordinates=function(t,e,i,n){var a=i.children[n];if("function"!=typeof a.measureText)return a;if(a.attribute("x").hasValue()){a.x=a.attribute("x").toPixels("x")+e.getAnchorDelta(t,i,n);var s=a.attribute("text-anchor").valueOrDefault("start");if("start"!==s){var r=a.measureTextRecursive(t);a.x+=-1*("end"==s?r:r/2)}a.attribute("dx").hasValue()&&(a.x+=a.attribute("dx").toPixels("x"))}else a.attribute("dx").hasValue()&&(e.x+=a.attribute("dx").toPixels("x")),a.x=e.x;return e.x=a.x+a.measureText(t),a.attribute("y").hasValue()?(a.y=a.attribute("y").toPixels("y"),a.attribute("dy").hasValue()&&(a.y+=a.attribute("dy").toPixels("y"))):(a.attribute("dy").hasValue()&&(e.y+=a.attribute("dy").toPixels("y")),a.y=e.y),e.y=a.y,a},this.getChildBoundingBox=function(t,e,i,n){var a=this.adjustChildCoordinates(t,e,i,n),s=a.getBoundingBox(t);for(n=0;n<a.children.length;n++){var r=e.getChildBoundingBox(t,e,a,n);s.addBoundingBox(r)}return s},this.renderChild=function(t,e,i,n){var a=this.adjustChildCoordinates(t,e,i,n);for(a.render(t),n=0;n<a.children.length;n++)e.renderChild(t,e,a,n)}},o.Element.text.prototype=new o.Element.RenderedElementBase,o.Element.TextElementBase=function(t){this.base=o.Element.RenderedElementBase,this.base(t),this.getGlyph=function(t,e,i){var n=e[i],a=null;if(t.isArabic){var s="isolated";(0==i||" "==e[i-1])&&i<e.length-2&&" "!=e[i+1]&&(s="terminal"),0<i&&" "!=e[i-1]&&i<e.length-2&&" "!=e[i+1]&&(s="medial"),0<i&&" "!=e[i-1]&&(i==e.length-1||" "==e[i+1])&&(s="initial"),void 0!==t.glyphs[n]&&null==(a=t.glyphs[n][s])&&"glyph"==t.glyphs[n].type&&(a=t.glyphs[n])}else a=t.glyphs[n];return null==a&&(a=t.missingGlyph),a},this.renderChildren=function(t){var e=this.parent.style("font-family").getDefinition();if(null==e)"stroke"==t.paintOrder?(""!=t.strokeStyle&&t.strokeText(o.compressSpaces(this.getText()),this.x,this.y),""!=t.fillStyle&&t.fillText(o.compressSpaces(this.getText()),this.x,this.y)):(""!=t.fillStyle&&t.fillText(o.compressSpaces(this.getText()),this.x,this.y),""!=t.strokeStyle&&t.strokeText(o.compressSpaces(this.getText()),this.x,this.y));else{var i=this.parent.style("font-size").numValueOrDefault(o.Font.Parse(o.ctx.font).fontSize),n=this.parent.style("font-style").valueOrDefault(o.Font.Parse(o.ctx.font).fontStyle),a=this.getText();e.isRTL&&(a=a.split("").reverse().join(""));for(var s=o.ToNumberArray(this.parent.attribute("dx").value),r=0;r<a.length;r++){var l=this.getGlyph(e,a,r),h=i/e.fontFace.unitsPerEm;t.translate(this.x,this.y),t.scale(h,-h);var u=t.lineWidth;t.lineWidth=t.lineWidth*e.fontFace.unitsPerEm/i,"italic"==n&&t.transform(1,0,.4,1,0,0),l.render(t),"italic"==n&&t.transform(1,0,-.4,1,0,0),t.lineWidth=u,t.scale(1/h,-1/h),t.translate(-this.x,-this.y),this.x+=i*(l.horizAdvX||e.horizAdvX)/e.fontFace.unitsPerEm,void 0===s[r]||isNaN(s[r])||(this.x+=s[r])}}},this.getText=function(){},this.measureTextRecursive=function(t){for(var e=this.measureText(t),i=0;i<this.children.length;i++)e+=this.children[i].measureTextRecursive(t);return e},this.measureText=function(t){var e=this.parent.style("font-family").getDefinition();if(null!=e){var i=this.parent.style("font-size").numValueOrDefault(o.Font.Parse(o.ctx.font).fontSize),n=0,a=this.getText();e.isRTL&&(a=a.split("").reverse().join(""));for(var s=o.ToNumberArray(this.parent.attribute("dx").value),r=0;r<a.length;r++)n+=(this.getGlyph(e,a,r).horizAdvX||e.horizAdvX)*i/e.fontFace.unitsPerEm,void 0===s[r]||isNaN(s[r])||(n+=s[r]);return n}var l=o.compressSpaces(this.getText());if(!t.measureText)return 10*l.length;t.save(),this.setContext(t,!0);var h=t.measureText(l).width;return t.restore(),h},this.getBoundingBox=function(t){var e=this.parent.style("font-size").numValueOrDefault(o.Font.Parse(o.ctx.font).fontSize);return new o.BoundingBox(this.x,this.y-e,this.x+this.measureText(t),this.y)}},o.Element.TextElementBase.prototype=new o.Element.RenderedElementBase,o.Element.tspan=function(t){this.captureTextNodes=!0,this.base=o.Element.TextElementBase,this.base(t),this.text=o.compressSpaces(t.value||t.text||t.textContent||""),this.getText=function(){return 0<this.children.length?"":this.text}},o.Element.tspan.prototype=new o.Element.TextElementBase,o.Element.tref=function(t){this.base=o.Element.TextElementBase,this.base(t),this.getText=function(){var t=this.getHrefAttribute().getDefinition();if(null!=t)return t.children[0].getText()}},o.Element.tref.prototype=new o.Element.TextElementBase,o.Element.a=function(t){this.base=o.Element.TextElementBase,this.base(t),this.hasText=0<t.childNodes.length;for(var e=0;e<t.childNodes.length;e++)3!=t.childNodes[e].nodeType&&(this.hasText=!1);this.text=this.hasText?t.childNodes[0].value||t.childNodes[0].data:"",this.getText=function(){return this.text},this.baseRenderChildren=this.renderChildren,this.renderChildren=function(t){if(this.hasText){this.baseRenderChildren(t);var e=new o.Property("fontSize",o.Font.Parse(o.ctx.font).fontSize);o.Mouse.checkBoundingBox(this,new o.BoundingBox(this.x,this.y-e.toPixels("y"),this.x+this.measureText(t),this.y))}else if(0<this.children.length){var i=new o.Element.g;i.children=this.children,i.parent=this,i.render(t)}},this.onclick=function(){n.open(this.getHrefAttribute().value)},this.onmousemove=function(){o.ctx.canvas.style.cursor="pointer"}},o.Element.a.prototype=new o.Element.TextElementBase,o.Element.textPath=function(t){this.base=o.Element.TextElementBase,this.base(t);var e=this.getHrefAttribute().getDefinition();this.text=o.compressSpaces(t.value||t.text||t.textContent||""),this.renderChildren=function(t){this.setTextData(t),t.save();var e=this.parent.style("text-decoration").value,i=this.fontSize(),n=this.glyphInfo,a=t.fillStyle;"underline"===e&&t.beginPath();for(var s=0;s<n.length;s++){var r=n[s].p0,l=n[s].p1,h=n[s].text;t.save(),t.translate(r.x,r.y),t.rotate(n[s].rotation),""!=t.fillStyle&&t.fillText(o.compressSpaces(h),0,0),""!=t.strokeStyle&&t.strokeText(o.compressSpaces(h),0,0),t.restore(),"underline"===e&&(0===s&&t.moveTo(r.x,r.y+i/8),t.lineTo(l.x,l.y+i/5))}"underline"===e&&(t.lineWidth=i/20,t.strokeStyle=a,t.stroke(),t.closePath()),t.restore()},this.path=function(t){var e=this.dataArray;null!=t&&t.beginPath();for(var i=0;i<e.length;i++){var n=e[i].command,a=e[i].points;switch(n){case"L":null!=t&&t.lineTo(a[0],a[1]);break;case"M":null!=t&&t.moveTo(a[0],a[1]);break;case"C":null!=t&&t.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"Q":null!=t&&t.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case"A":var s=a[0],r=a[1],o=a[2],l=a[3],h=a[4],u=a[5],f=a[6],c=a[7],p=l<o?o:l,d=l<o?1:o/l,m=l<o?l/o:1;null!=t&&(t.translate(s,r),t.rotate(f),t.scale(d,m),t.arc(0,0,p,h,h+u,1-c),t.scale(1/d,1/m),t.rotate(-f),t.translate(-s,-r));break;case"z":null!=t&&t.closePath()}}},this.getText=function(){return this.text},this.fontSize=function(){return this.parent.style("font-size").numValueOrDefault(o.Font.Parse(o.ctx.font).fontSize)},this.measureText=function(t,e){var i=this.parent.style("font-family").getDefinition();if(e=e||this.getText(),null!=i){var n=this.fontSize(),a=0;i.isRTL&&(e=e.split("").reverse().join(""));for(var s=o.ToNumberArray(this.parent.attribute("dx").value),r=0;r<e.length;r++)a+=(this.getGlyph(i,e,r).horizAdvX||i.horizAdvX)*n/i.fontFace.unitsPerEm,void 0===s[r]||isNaN(s[r])||(a+=s[r]);return a}var l=o.compressSpaces(e);if(!t.measureText)return 10*l.length;t.save(),this.setContext(t);var h=t.measureText(l).width;return t.restore(),h},this.setTextData=function(t){if(!this.hasOwnProperty("glyphInfo")){var e=this,i=this.getText().split(""),n=this.getText().split(" ").length-1,a=o.ToNumberArray(this.parent.attribute("dx").valueOrDefault("0")),s=0,r=this.parent.style("text-anchor").valueOrDefault("start"),l=this.style("letter-spacing"),h=this.parent.style("letter-spacing");l.hasValue()&&"inherit"!==l.getValue()?l.hasValue()&&"initial"!==l.getValue()&&"unset"!==l.getValue()&&(s=l.toPixels()):s=h.toPixels(),this.letterSpacingCache=[];for(var u=0;u<this.getText().length;u++)this.letterSpacingCache.push(void 0!==a[u]?a[u]:s);var f=this.letterSpacingCache.reduce(function(t,e){return t+e||0},0);this.textWidth=this.measureText(t),this.textHeight=this.fontSize();var c=Math.max(this.textWidth+f,0);this.glyphInfo=[];var p=this.getPathLength(),d=this.style("startOffset").numValueOrDefault(0)*p,m=0;"middle"!==r&&"center"!==r||(m=-c/2),"end"!==r&&"right"!==r||(m=-c),m+=d;var y=function(i,a){var s,o=e.measureText(t,i);" "===i&&"justify"===r&&c<p&&(o+=(p-c)/n),-1<a&&(m+=(s=(s=a)||0,e.letterSpacingCache[s]||0));var l=e.textHeight/20,h={p0:e.getEquidistantPointOnPath(m,l),p1:e.getEquidistantPointOnPath(m+o,l)};return m+=o,h};for(u=0;u<i.length;u++){var g=y(i[u],u);if(void 0!==g.p0&&void 0!==g.p1){var v=e.getLineLength(g.p0.x,g.p0.y,g.p1.x,g.p1.y),x=e.getPointOnLine(0+v/2,g.p0.x,g.p0.y,g.p1.x,g.p1.y),b=Math.atan2(g.p1.y-g.p0.y,g.p1.x-g.p0.x);this.glyphInfo.push({transposeX:x.x,transposeY:x.y,text:i[u],rotation:b,p0:g.p0,p1:g.p1})}}}},this.parsePathData=function(t){if(this.pathLength=void 0,!t)return[];var e=[],i=t.PathParser;for(i.reset();!i.isEnd();){var n=[],a=null,s=i.current?i.current.x:0,r=i.current?i.current.y:0;i.nextCommand();var l=i.command.toUpperCase();switch(i.command){case"M":case"m":var h=i.getAsCurrentPoint();for(n.push(h.x,h.y),i.start=i.current;!i.isCommandOrEnd();)h=i.getAsCurrentPoint(),n.push(h.x,h.y),a="L";break;case"L":case"l":for(;!i.isCommandOrEnd();)h=i.getAsCurrentPoint(),n.push(h.x,h.y);a="L";break;case"H":case"h":for(;!i.isCommandOrEnd();){var u=new o.Point((i.isRelativeCommand()?i.current.x:0)+i.getScalar(),i.current.y);n.push(u.x,u.y),i.current=u}a="L";break;case"V":case"v":for(;!i.isCommandOrEnd();)u=new o.Point(i.current.x,(i.isRelativeCommand()?i.current.y:0)+i.getScalar()),n.push(u.x,u.y),i.current=u;a="L";break;case"C":case"c":for(;!i.isCommandOrEnd();){var f=i.getPoint(),c=i.getAsControlPoint(),p=i.getAsCurrentPoint();n.push(f.x,f.y,c.x,c.y,p.x,p.y)}break;case"S":case"s":for(;!i.isCommandOrEnd();)f=i.getReflectedControlPoint(),c=i.getAsControlPoint(),p=i.getAsCurrentPoint(),n.push(f.x,f.y,c.x,c.y,p.x,p.y);a="C";break;case"Q":case"q":for(;!i.isCommandOrEnd();)c=i.getAsControlPoint(),p=i.getAsCurrentPoint(),n.push(c.x,c.y,p.x,p.y);break;case"T":case"t":for(;!i.isCommandOrEnd();)c=i.getReflectedControlPoint(),i.control=c,p=i.getAsCurrentPoint(),n.push(c.x,c.y,p.x,p.y);a="Q";break;case"A":case"a":for(;!i.isCommandOrEnd();){var d=i.current,m=i.getScalar(),y=i.getScalar(),g=i.getScalar()*(Math.PI/180),v=i.getScalar(),x=i.getScalar(),b=(p=i.getAsCurrentPoint(),new o.Point(Math.cos(g)*(d.x-p.x)/2+Math.sin(g)*(d.y-p.y)/2,-Math.sin(g)*(d.x-p.x)/2+Math.cos(g)*(d.y-p.y)/2)),P=Math.pow(b.x,2)/Math.pow(m,2)+Math.pow(b.y,2)/Math.pow(y,2);1<P&&(m*=Math.sqrt(P),y*=Math.sqrt(P));var E=(v==x?-1:1)*Math.sqrt((Math.pow(m,2)*Math.pow(y,2)-Math.pow(m,2)*Math.pow(b.y,2)-Math.pow(y,2)*Math.pow(b.x,2))/(Math.pow(m,2)*Math.pow(b.y,2)+Math.pow(y,2)*Math.pow(b.x,2)));isNaN(E)&&(E=0);var w=new o.Point(E*m*b.y/y,E*-y*b.x/m),C=new o.Point((d.x+p.x)/2+Math.cos(g)*w.x-Math.sin(g)*w.y,(d.y+p.y)/2+Math.sin(g)*w.x+Math.cos(g)*w.y),B=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))},M=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(B(t)*B(e))},T=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(M(t,e))},S=T([1,0],[(b.x-w.x)/m,(b.y-w.y)/y]),k=[(b.x-w.x)/m,(b.y-w.y)/y],V=[(-b.x-w.x)/m,(-b.y-w.y)/y],A=T(k,V);M(k,V)<=-1&&(A=Math.PI),1<=M(k,V)&&(A=0),0===x&&0<A&&(A-=2*Math.PI),1===x&&A<0&&(A+=2*Math.PI),n=[C.x,C.y,m,y,S,A,g,x]}break;case"Z":case"z":i.current=i.start}"Z"!==l?e.push({command:a||l,points:n,start:{x:s,y:r},pathLength:this.calcLength(s,r,a||l,n)}):e.push({command:"z",points:[],start:void 0,pathLength:0})}return e},this.getPathLength=function(){if(void 0===this.pathLength||null===this.pathLength||isNaN(this.pathLength))for(var t=this.pathLength=0;t<this.dataArray.length;t++)0<this.dataArray[t].pathLength&&(this.pathLength+=this.dataArray[t].pathLength);return this.pathLength},this.getPointOnPath=function(t){var e=0,i=this.getPathLength(),n=void 0;if(!(t<-5e-5||i<t-5e-5))for(var a=0;a<this.dataArray.length;a++){var s=this.dataArray[a];if(!s||!(s.pathLength<5e-5||e+s.pathLength+5e-5<t)){var r=t-e,o=void 0;switch(s.command){case"L":n=this.getPointOnLine(r,s.start.x,s.start.y,s.points[0],s.points[1],s.start.x,s.start.y);break;case"A":var l=s.points[4],h=s.points[5],u=s.points[4]+h;if(o=l+r/s.pathLength*h,h<0&&o<u||0<=h&&u<o)break;n=this.getPointOnEllipticalArc(s.points[0],s.points[1],s.points[2],s.points[3],o,s.points[6]);break;case"C":1<(o=r/s.pathLength)&&(o=1),n=this.getPointOnCubicBezier(o,s.start.x,s.start.y,s.points[0],s.points[1],s.points[2],s.points[3],s.points[4],s.points[5]);break;case"Q":1<(o=r/s.pathLength)&&(o=1),n=this.getPointOnQuadraticBezier(o,s.start.x,s.start.y,s.points[0],s.points[1],s.points[2],s.points[3])}if(void 0!==n&&n!=={})return n;break}e+=s.pathLength}},this.buildEquidistantCache=function(t,e){var i=this.getPathLength();if(e=e||.25,t=t||i/100,this.equidistantCache=this.equidistantCache||{},!this.equidistantCache.hasOwnProperty("points")||this.equidistantCache.step!=t||this.equidistantCache.precision!=e){this.equidistantCache={step:t,precision:e,points:[]};for(var n=0,a=0;a<=i;a+=e){var s=this.getPointOnPath(a),r=this.getPointOnPath(a+e);void 0!==s&&void 0!==r&&t<=(n+=this.getLineLength(s.x,s.y,r.x,r.y))&&(this.equidistantCache.points.push({x:s.x,y:s.y,distance:a}),n-=t)}}},this.getEquidistantPointOnPath=function(t,e,i){if(this.buildEquidistantCache(e,i),!(t<0||5e-5<t-this.getPathLength())){var n=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[n]||void 0}},this.getLineLength=function(t,e,i,n){return Math.sqrt((i-t)*(i-t)+(n-e)*(n-e))},this.getPointOnLine=function(t,e,i,n,a,s,r){void 0===s&&(s=e),void 0===r&&(r=i);var o=(a-i)/(n-e+1e-8),l=Math.sqrt(t*t/(1+o*o));n<e&&(l*=-1);var h,u=o*l;if(n===e)h={x:s,y:r+u};else if((r-i)/(s-e+1e-8)===o)h={x:s+l,y:r+u};else{var f,c,p=this.getLineLength(e,i,n,a);if(p<1e-8)return;var d=(s-e)*(n-e)+(r-i)*(a-i);f=e+(d/=p*p)*(n-e),c=i+d*(a-i);var m=this.getLineLength(s,r,f,c),y=Math.sqrt(t*t-m*m);l=Math.sqrt(y*y/(1+o*o)),n<e&&(l*=-1),h={x:f+l,y:c+(u=o*l)}}return h},this.getPointOnCubicBezier=function(t,e,i,n,a,s,r,o,l){function h(t){return t*t*t}function u(t){return 3*t*t*(1-t)}function f(t){return 3*t*(1-t)*(1-t)}function c(t){return(1-t)*(1-t)*(1-t)}return{x:o*h(t)+s*u(t)+n*f(t)+e*c(t),y:l*h(t)+r*u(t)+a*f(t)+i*c(t)}},this.getPointOnQuadraticBezier=function(t,e,i,n,a,s,r){function o(t){return t*t}function l(t){return 2*t*(1-t)}function h(t){return(1-t)*(1-t)}return{x:s*o(t)+n*l(t)+e*h(t),y:r*o(t)+a*l(t)+i*h(t)}},this.getPointOnEllipticalArc=function(t,e,i,n,a,s){var r=Math.cos(s),o=Math.sin(s),l=i*Math.cos(a),h=n*Math.sin(a);return{x:t+(l*r-h*o),y:e+(l*o+h*r)}},this.calcLength=function(t,e,i,n){var a,s,r,o;switch(i){case"L":return this.getLineLength(t,e,n[0],n[1]);case"C":for(a=0,s=this.getPointOnCubicBezier(0,t,e,n[0],n[1],n[2],n[3],n[4],n[5]),o=.01;o<=1;o+=.01)r=this.getPointOnCubicBezier(o,t,e,n[0],n[1],n[2],n[3],n[4],n[5]),a+=this.getLineLength(s.x,s.y,r.x,r.y),s=r;return a;case"Q":for(a=0,s=this.getPointOnQuadraticBezier(0,t,e,n[0],n[1],n[2],n[3]),o=.01;o<=1;o+=.01)r=this.getPointOnQuadraticBezier(o,t,e,n[0],n[1],n[2],n[3]),a+=this.getLineLength(s.x,s.y,r.x,r.y),s=r;return a;case"A":a=0;var l=n[4],h=n[5],u=n[4]+h,f=Math.PI/180;if(Math.abs(l-u)<f&&(f=Math.abs(l-u)),s=this.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],l,0),h<0)for(o=l-f;u<o;o-=f)r=this.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],o,0),a+=this.getLineLength(s.x,s.y,r.x,r.y),s=r;else for(o=l+f;o<u;o+=f)r=this.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],o,0),a+=this.getLineLength(s.x,s.y,r.x,r.y),s=r;return r=this.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],u,0),a+this.getLineLength(s.x,s.y,r.x,r.y)}return 0},this.dataArray=this.parsePathData(e)},o.Element.textPath.prototype=new o.Element.TextElementBase,o.Element.image=function(t){this.base=o.Element.RenderedElementBase,this.base(t);var e=this.getHrefAttribute().value;if(""!=e){var i=e.match(/\.svg$/);if(o.Images.push(this),this.loaded=!1,i)this.img=o.ajax(e),this.loaded=!0;else{this.img=a.createElement("img"),1==o.opts.useCORS&&(this.img.crossOrigin="Anonymous");var n=this;this.img.onload=function(){n.loaded=!0},this.img.onerror=function(){o.log('ERROR: image "'+e+'" not found'),n.loaded=!0},this.img.src=e}this.renderChildren=function(t){var e=this.attribute("x").toPixels("x"),a=this.attribute("y").toPixels("y"),s=this.attribute("width").toPixels("x"),r=this.attribute("height").toPixels("y");0!=s&&0!=r&&(t.save(),i?t.drawSvg(this.img,e,a,s,r):(t.translate(e,a),o.AspectRatio(t,this.attribute("preserveAspectRatio").value,s,this.img.width,r,this.img.height,0,0),n.loaded&&(void 0===this.img.complete||this.img.complete)&&t.drawImage(this.img,0,0)),t.restore())},this.getBoundingBox=function(){var t=this.attribute("x").toPixels("x"),e=this.attribute("y").toPixels("y"),i=this.attribute("width").toPixels("x"),n=this.attribute("height").toPixels("y");return new o.BoundingBox(t,e,t+i,e+n)}}},o.Element.image.prototype=new o.Element.RenderedElementBase,o.Element.g=function(t){this.base=o.Element.RenderedElementBase,this.base(t),this.getBoundingBox=function(t){for(var e=new o.BoundingBox,i=0;i<this.children.length;i++)e.addBoundingBox(this.children[i].getBoundingBox(t));return e}},o.Element.g.prototype=new o.Element.RenderedElementBase,o.Element.symbol=function(t){this.base=o.Element.RenderedElementBase,this.base(t),this.render=function(){}},o.Element.symbol.prototype=new o.Element.RenderedElementBase,o.ParseExternalUrl=function(t){var e=t.match(/url\(('([^']+)'|"([^"]+)"|([^'"\)]+))\)/)||[];return e[2]||e[3]||e[4]},o.Element.style=function(t){this.base=o.Element.ElementBase,this.base(t);for(var e="",i=0;i<t.childNodes.length;i++)e+=t.childNodes[i].data;e=e.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"");var n=(e=o.compressSpaces(e)).split("}");for(i=0;i<n.length;i++)if(""!=o.trim(n[i]))for(var a=n[i].split("{"),s=a[0].split(","),r=a[1].split(";"),l=0;l<s.length;l++){var h=o.trim(s[l]);if(""!=h){for(var u=o.Styles[h]||{},f=0;f<r.length;f++){var c=r[f].indexOf(":"),p=r[f].substr(0,c),d=r[f].substr(c+1,r[f].length-c);null!=p&&null!=d&&(u[o.trim(p)]=new o.Property(o.trim(p),o.trim(d)))}if(o.Styles[h]=u,o.StylesSpecificity[h]=m(h),"@font-face"==h)for(var y=u["font-family"].value.replace(/"/g,""),g=u.src.value.split(","),v=0;v<g.length;v++)if(0<g[v].indexOf('format("svg")')){var x=o.ParseExternalUrl(g[v]);if(x)for(var b=o.parseXml(o.ajax(x)).getElementsByTagName("font"),P=0;P<b.length;P++){var E=o.CreateElement(b[P]);o.Definitions[y]=E}}}}},o.Element.style.prototype=new o.Element.ElementBase,o.Element.use=function(t){this.base=o.Element.RenderedElementBase,this.base(t),this.baseSetContext=this.setContext,this.setContext=function(t){this.baseSetContext(t),this.attribute("x").hasValue()&&t.translate(this.attribute("x").toPixels("x"),0),this.attribute("y").hasValue()&&t.translate(0,this.attribute("y").toPixels("y"))};var e=this.getHrefAttribute().getDefinition();this.path=function(t){null!=e&&e.path(t)},this.elementTransform=function(){if(null!=e&&e.style("transform",!1,!0).hasValue())return new o.Transform(e.style("transform",!1,!0).value)},this.getBoundingBox=function(t){if(null!=e)return e.getBoundingBox(t)},this.renderChildren=function(t){if(null!=e){var i=e;"symbol"==e.type&&((i=new o.Element.svg).type="svg",i.attributes.viewBox=new o.Property("viewBox",e.attribute("viewBox").value),i.attributes.preserveAspectRatio=new o.Property("preserveAspectRatio",e.attribute("preserveAspectRatio").value),i.attributes.overflow=new o.Property("overflow",e.attribute("overflow").value),i.children=e.children),"svg"==i.type&&(this.attribute("width").hasValue()&&(i.attributes.width=new o.Property("width",this.attribute("width").value)),this.attribute("height").hasValue()&&(i.attributes.height=new o.Property("height",this.attribute("height").value)));var n=i.parent;i.parent=null,i.render(t),i.parent=n}}},o.Element.use.prototype=new o.Element.RenderedElementBase,o.Element.mask=function(t){this.base=o.Element.ElementBase,this.base(t),this.apply=function(t,e){var i=this.attribute("x").toPixels("x"),n=this.attribute("y").toPixels("y"),a=this.attribute("width").toPixels("x"),r=this.attribute("height").toPixels("y");if(0==a&&0==r){for(var l=new o.BoundingBox,h=0;h<this.children.length;h++)l.addBoundingBox(this.children[h].getBoundingBox(t));i=Math.floor(l.x1),n=Math.floor(l.y1),a=Math.floor(l.width()),r=Math.floor(l.height())}var u=e.style("mask").value;e.style("mask").value="";var f=s(i+a,n+r),c=f.getContext("2d");o.SetDefaults(c),this.renderChildren(c),new o.Element.feColorMatrix({nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(c,0,0,i+a,n+r);var p=s(i+a,n+r),d=p.getContext("2d");o.SetDefaults(d),e.render(d),d.globalCompositeOperation="destination-in",d.fillStyle=c.createPattern(f,"no-repeat"),d.fillRect(0,0,i+a,n+r),t.fillStyle=d.createPattern(p,"no-repeat"),t.fillRect(0,0,i+a,n+r),e.style("mask").value=u},this.render=function(){}},o.Element.mask.prototype=new o.Element.ElementBase,o.Element.clipPath=function(t){this.base=o.Element.ElementBase,this.base(t),this.apply=function(t){var e="undefined"!=typeof CanvasRenderingContext2D,i=t.beginPath,n=t.closePath;e&&(CanvasRenderingContext2D.prototype.beginPath=function(){},CanvasRenderingContext2D.prototype.closePath=function(){}),i.call(t);for(var a=0;a<this.children.length;a++){var s=this.children[a];if(void 0!==s.path){var r=void 0!==s.elementTransform&&s.elementTransform();!r&&s.style("transform",!1,!0).hasValue()&&(r=new o.Transform(s.style("transform",!1,!0).value)),r&&r.apply(t),s.path(t),e&&(CanvasRenderingContext2D.prototype.closePath=n),r&&r.unapply(t)}}n.call(t),t.clip(),e&&(CanvasRenderingContext2D.prototype.beginPath=i,CanvasRenderingContext2D.prototype.closePath=n)},this.render=function(){}},o.Element.clipPath.prototype=new o.Element.ElementBase,o.Element.filter=function(t){this.base=o.Element.ElementBase,this.base(t),this.apply=function(t,e){var i=e.getBoundingBox(t),n=Math.floor(i.x1),a=Math.floor(i.y1),r=Math.floor(i.width()),l=Math.floor(i.height()),h=e.style("filter").value;e.style("filter").value="";for(var u=0,f=0,c=0;c<this.children.length;c++){var p=this.children[c].extraFilterDistance||0;u=Math.max(u,p),f=Math.max(f,p)}var d=s(r+2*u,l+2*f),m=d.getContext("2d");for(o.SetDefaults(m),m.translate(-n+u,-a+f),e.render(m),c=0;c<this.children.length;c++)"function"==typeof this.children[c].apply&&this.children[c].apply(m,0,0,r+2*u,l+2*f);t.drawImage(d,0,0,r+2*u,l+2*f,n-u,a-f,r+2*u,l+2*f),e.style("filter",!0).value=h},this.render=function(){}},o.Element.filter.prototype=new o.Element.ElementBase,o.Element.feDropShadow=function(t){this.base=o.Element.ElementBase,this.base(t),this.addStylesFromStyleDefinition(),this.apply=function(){}},o.Element.feDropShadow.prototype=new o.Element.ElementBase,o.Element.feMorphology=function(t){this.base=o.Element.ElementBase,this.base(t),this.apply=function(){}},o.Element.feMorphology.prototype=new o.Element.ElementBase,o.Element.feComposite=function(t){this.base=o.Element.ElementBase,this.base(t),this.apply=function(){}},o.Element.feComposite.prototype=new o.Element.ElementBase,o.Element.feColorMatrix=function(t){this.base=o.Element.ElementBase,this.base(t);var e=o.ToNumberArray(this.attribute("values").value);switch(this.attribute("type").valueOrDefault("matrix")){case"saturate":var i=e[0];e=[.213+.787*i,.715-.715*i,.072-.072*i,0,0,.213-.213*i,.715+.285*i,.072-.072*i,0,0,.213-.213*i,.715-.715*i,.072+.928*i,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var n=e[0]*Math.PI/180,a=function(t,e,i){return t+Math.cos(n)*e+Math.sin(n)*i};e=[a(.213,.787,-.213),a(.715,-.715,-.715),a(.072,-.072,.928),0,0,a(.213,-.213,.143),a(.715,.285,.14),a(.072,-.072,-.283),0,0,a(.213,-.213,-.787),a(.715,-.715,.715),a(.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}function s(t,e,i,n,a,s){return t[i*n*4+4*e+s]}function r(t,e,i,n,a,s,r){t[i*n*4+4*e+s]=r}function l(t,i){var n=e[t];return n*(n<0?i-255:i)}var h=this.attribute("includeOpacity").hasValue();this.apply=function(t,e,i,n,a){var o=t.getImageData(0,0,n,a);for(i=0;i<a;i++)for(e=0;e<n;e++){var u=s(o.data,e,i,n,0,0),f=s(o.data,e,i,n,0,1),c=s(o.data,e,i,n,0,2),p=s(o.data,e,i,n,0,3),d=l(0,u)+l(1,f)+l(2,c)+l(3,p)+l(4,1),m=l(5,u)+l(6,f)+l(7,c)+l(8,p)+l(9,1),y=l(10,u)+l(11,f)+l(12,c)+l(13,p)+l(14,1),g=l(15,u)+l(16,f)+l(17,c)+l(18,p)+l(19,1);h&&(d=m=y=0,g*=p/255),r(o.data,e,i,n,0,0,d),r(o.data,e,i,n,0,1,m),r(o.data,e,i,n,0,2,y),r(o.data,e,i,n,0,3,g)}t.clearRect(0,0,n,a),t.putImageData(o,0,0)}},o.Element.feColorMatrix.prototype=new o.Element.ElementBase,o.Element.feGaussianBlur=function(t){this.base=o.Element.ElementBase,this.base(t),this.blurRadius=Math.floor(this.attribute("stdDeviation").numValue()),this.extraFilterDistance=this.blurRadius,this.apply=function(t,i,n,s,r){e&&void 0!==e.canvasRGBA?(t.canvas.id=o.UniqueId(),t.canvas.style.display="none",a.body.appendChild(t.canvas),e.canvasRGBA(t.canvas,i,n,s,r,this.blurRadius),a.body.removeChild(t.canvas)):o.log("ERROR: StackBlur.js must be included for blur to work")}},o.Element.feGaussianBlur.prototype=new o.Element.ElementBase,o.Element.title=function(){},o.Element.title.prototype=new o.Element.ElementBase,o.Element.desc=function(){},o.Element.desc.prototype=new o.Element.ElementBase,o.Element.MISSING=function(t){o.log("ERROR: Element '"+t.nodeName+"' not yet implemented.")},o.Element.MISSING.prototype=new o.Element.ElementBase,o.CreateElement=function(t){var e=t.nodeName.replace(/^[^:]+:/,"");e=e.replace(/\-/g,"");var i;return(i=void 0!==o.Element[e]?new o.Element[e](t):new o.Element.MISSING(t)).type=t.nodeName,i},o.load=function(t,e){o.loadXml(t,o.ajax(e))},o.loadXml=function(t,e){o.loadXmlDoc(t,o.parseXml(e))},o.loadXmlDoc=function(t,e){o.init(t);var i=function(e){for(var i=t.canvas;i;)e.x-=i.offsetLeft,e.y-=i.offsetTop,i=i.offsetParent;return n.scrollX&&(e.x+=n.scrollX),n.scrollY&&(e.y+=n.scrollY),e};1!=o.opts.ignoreMouse&&(t.canvas.onclick=function(t){var e=i(new o.Point(null!=t?t.clientX:event.clientX,null!=t?t.clientY:event.clientY));o.Mouse.onclick(e.x,e.y)},t.canvas.onmousemove=function(t){var e=i(new o.Point(null!=t?t.clientX:event.clientX,null!=t?t.clientY:event.clientY));o.Mouse.onmousemove(e.x,e.y)});var a=o.CreateElement(e.documentElement);a.root=!0,a.addStylesFromStyleDefinition();var s=!0,r=function(){o.ViewPort.Clear(),t.canvas.parentNode?o.ViewPort.SetCurrent(t.canvas.parentNode.clientWidth,t.canvas.parentNode.clientHeight):o.ViewPort.SetCurrent(800,600),1!=o.opts.ignoreDimensions&&(s||null==o.opts.scaleWidth&&null==o.opts.scaleHeight)&&(a.style("width").hasValue()&&(t.canvas.width=a.style("width").toPixels("x"),t.canvas.style&&(t.canvas.style.width=t.canvas.width+"px")),a.style("height").hasValue()&&(t.canvas.height=a.style("height").toPixels("y"),t.canvas.style&&(t.canvas.style.height=t.canvas.height+"px")));var i=t.canvas.clientWidth||t.canvas.width,n=t.canvas.clientHeight||t.canvas.height;if(1==o.opts.ignoreDimensions&&a.style("width").hasValue()&&a.style("height").hasValue()&&(i=a.style("width").toPixels("x"),n=a.style("height").toPixels("y")),o.ViewPort.SetCurrent(i,n),null!=o.opts.offsetX&&(a.attribute("x",!0).value=o.opts.offsetX),null!=o.opts.offsetY&&(a.attribute("y",!0).value=o.opts.offsetY),null!=o.opts.scaleWidth||null!=o.opts.scaleHeight){var r=null,l=null,h=o.ToNumberArray(a.attribute("viewBox").value);null!=o.opts.scaleWidth&&(a.attribute("width").hasValue()?r=a.attribute("width").toPixels("x")/o.opts.scaleWidth:isNaN(h[2])||(r=h[2]/o.opts.scaleWidth)),null!=o.opts.scaleHeight&&(a.attribute("height").hasValue()?l=a.attribute("height").toPixels("y")/o.opts.scaleHeight:isNaN(h[3])||(l=h[3]/o.opts.scaleHeight)),null==r&&(r=l),null==l&&(l=r),a.attribute("width",!0).value=o.opts.scaleWidth,a.attribute("height",!0).value=o.opts.scaleHeight,a.style("transform",!0,!0).value+=" scale("+1/r+","+1/l+")"}1!=o.opts.ignoreClear&&t.clearRect(0,0,i,n),a.render(t),s&&(s=!1,"function"==typeof o.opts.renderCallback&&o.opts.renderCallback(e))},l=!0;o.ImagesLoaded()&&(l=!1,r()),o.intervalID=setInterval(function(){var t=!1;if(l&&o.ImagesLoaded()&&(t=!(l=!1)),1!=o.opts.ignoreMouse&&(t=t||o.Mouse.hasEvents()),1!=o.opts.ignoreAnimation)for(var e=0;e<o.Animations.length;e++){var i=o.Animations[e].update(1e3/o.FRAMERATE);t=t||i}"function"==typeof o.opts.forceRedraw&&1==o.opts.forceRedraw()&&(t=!0),t&&(r(),o.Mouse.runEvents())},1e3/o.FRAMERATE)},o.stop=function(){o.intervalID&&clearInterval(o.intervalID)},o.Mouse=new function(){this.events=[],this.hasEvents=function(){return 0!=this.events.length},this.onclick=function(t,e){this.events.push({type:"onclick",x:t,y:e,run:function(t){t.onclick&&t.onclick()}})},this.onmousemove=function(t,e){this.events.push({type:"onmousemove",x:t,y:e,run:function(t){t.onmousemove&&t.onmousemove()}})},this.eventElements=[],this.checkPath=function(t,e){for(var i=0;i<this.events.length;i++){var n=this.events[i];e.isPointInPath&&e.isPointInPath(n.x,n.y)&&(this.eventElements[i]=t)}},this.checkBoundingBox=function(t,e){if(e)for(var i=0;i<this.events.length;i++){var n=this.events[i];e.isPointInBox(n.x,n.y)&&(this.eventElements[i]=t)}},this.runEvents=function(){o.ctx.canvas.style.cursor="";for(var t=0;t<this.events.length;t++)for(var e=this.events[t],i=this.eventElements[t];i;)e.run(i),i=i.parent;this.events=[],this.eventElements=[]}},o}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,i,n,a,s){var r={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:i,scaleWidth:n,scaleHeight:a};for(var l in s)s.hasOwnProperty(l)&&(r[l]=s[l]);o(this.canvas,t,r)}),o._build=y,i.exports=o}(i={exports:{}}),i.exports})}});
//# sourceMappingURL=canvg.js.map