//>>built
define("dojox/gfx/svg_attach","dojo/_base/kernel dojo/_base/lang dojo/_base/array dojo/_base/Color ./_base ./svg ./matrix".split(" "),function(p,k,l,m,f,e,q){function r(a){var c=a.rawNode.getAttribute("fill");if("none"==c)a.fillStyle=null;else{var b=null,d=e.getRef(c);if(d)switch(d.tagName.toLowerCase()){case "lineargradient":b=n(f.defaultLinearGradient,d);l.forEach(["x1","y1","x2","y2"],function(g){b[g]=d.getAttribute(g)});break;case "radialgradient":b=n(f.defaultRadialGradient,d);l.forEach(["cx",
"cy","r"],function(g){b[g]=d.getAttribute(g)});b.cx=d.getAttribute("cx");b.cy=d.getAttribute("cy");b.r=d.getAttribute("r");break;case "pattern":b=k.clone(f.defaultPattern),l.forEach(["x","y","width","height"],function(g){b[g]=d.getAttribute(g)}),b.src=d.firstChild.getAttributeNS(e.xmlns.xlink,"href")}else b=new m(c),c=a.rawNode.getAttribute("fill-opacity"),null!=c&&(b.a=c);a.fillStyle=b}}function n(a,c){var b=k.clone(a);b.colors=[];for(var d=0;d<c.childNodes.length;++d)b.colors.push({offset:c.childNodes[d].getAttribute("offset"),
color:new m(c.childNodes[d].getAttribute("stop-color"))});return b}function h(a,c){var b=a.shape=k.clone(c),d=a.rawNode,g;for(g in b)b[g]=d.getAttribute(g)}p.experimental("dojox.gfx.svg_attach");e.attachNode=function(a){if(!a)return null;var c=null;switch(a.tagName.toLowerCase()){case e.Rect.nodeType:a=c=new e.Rect(a);h(a,f.defaultRect);a.shape.r=Math.min(a.rawNode.getAttribute("rx"),a.rawNode.getAttribute("ry"));break;case e.Ellipse.nodeType:c=new e.Ellipse(a);h(c,f.defaultEllipse);break;case e.Polyline.nodeType:c=
new e.Polyline(a);h(c,f.defaultPolyline);break;case e.Path.nodeType:c=new e.Path(a);h(c,f.defaultPath);break;case e.Circle.nodeType:c=new e.Circle(a);h(c,f.defaultCircle);break;case e.Line.nodeType:c=new e.Line(a);h(c,f.defaultLine);break;case e.Image.nodeType:c=new e.Image(a);h(c,f.defaultImage);break;case e.Text.nodeType:if((c=a.getElementsByTagName("textPath"))&&c.length){c=new e.TextPath(a);h(c,f.defaultPath);var b=c;a=b.shape=k.clone(f.defaultTextPath);b=b.rawNode;a.align=b.getAttribute("text-anchor");
a.decoration=b.getAttribute("text-decoration");a.rotated=0!=parseFloat(b.getAttribute("rotate"));a.kerning="auto"==b.getAttribute("kerning");a.text=b.firstChild.nodeValue}else b=c=new e.Text(a),a=b.shape=k.clone(f.defaultText),b=b.rawNode,a.x=b.getAttribute("x"),a.y=b.getAttribute("y"),a.align=b.getAttribute("text-anchor"),a.decoration=b.getAttribute("text-decoration"),a.rotated=0!=parseFloat(b.getAttribute("rotate")),a.kerning="auto"==b.getAttribute("kerning"),a.text=b.firstChild.nodeValue;b=c;a=
b.fontStyle=k.clone(f.defaultFont);b=b.rawNode;a.style=b.getAttribute("font-style");a.variant=b.getAttribute("font-variant");a.weight=b.getAttribute("font-weight");a.size=b.getAttribute("font-size");a.family=b.getAttribute("font-family");break;default:return null}if(!(c instanceof e.Image)){r(c);var d=c;a=d.rawNode;b=a.getAttribute("stroke");null==b||"none"==b?d.strokeStyle=null:(d=d.strokeStyle=k.clone(f.defaultStroke),b=new m(b),d.color=b,d.color.a=a.getAttribute("stroke-opacity"),d.width=a.getAttribute("stroke-width"),
d.cap=a.getAttribute("stroke-linecap"),d.join=a.getAttribute("stroke-linejoin"),"miter"==d.join&&(d.join=a.getAttribute("stroke-miterlimit")),d.style=a.getAttribute("dojoGfxStrokeStyle"))}a=c;b=a.rawNode.getAttribute("transform");b.match(/^matrix\(.+\)$/)?(b=b.slice(7,-1).split(","),a.matrix=q.normalize({xx:parseFloat(b[0]),xy:parseFloat(b[2]),yx:parseFloat(b[1]),yy:parseFloat(b[3]),dx:parseFloat(b[4]),dy:parseFloat(b[5])})):a.matrix=null;return c};e.attachSurface=function(a){var c=new e.Surface;
c.rawNode=a;a=a.getElementsByTagName("defs");if(0==a.length)return null;c.defNode=a[0];return c};return e});