//>>built define("dojo/_base/lang dojo/_base/sniff dojo/_base/window dojo/dom dojo/_base/declare dojo/_base/array dojo/dom-geometry dojo/dom-attr dojo/_base/Color ./_base ./shape ./path".split(" "),function(m,n,p,q,k,v,y,u,z,h,g,t){function l(a,b){return p.doc.createElementNS?p.doc.createElementNS(a,b):p.doc.createElement(b)}function w(a,b,c,d){return a.setAttributeNS?a.setAttributeNS(b,c,d):a.setAttribute(c,d)}function x(a){return c.useSvgWeb?p.doc.createTextNode(a,!0):p.doc.createTextNode(a)}var c=h.svg= {};c.useSvgWeb="undefined"!=typeof window.svgweb;var A=navigator.userAgent,B=n("ios"),C=n("chrome")?"auto":"optimizeLegibility";c.xmlns={xlink:"http://www.w3.org/1999/xlink",svg:"http://www.w3.org/2000/svg"};c.getRef=function(a){return a&&"none"!=a?a.match(/^url\(#.+\)$/)?q.byId(a.slice(5,-1)):a.match(/^#dojoUnique\d+$/)?q.byId(a.slice(1)):null:null};c.dasharray={solid:"none",shortdash:[4,1],shortdot:[1,1],shortdashdot:[4,1,1,1],shortdashdotdot:[4,1,1,1,1,1],dot:[1,3],dash:[4,3],longdash:[8,3],dashdot:[4, 3,1,3],longdashdot:[8,3,1,3],longdashdotdot:[8,3,1,3,1,3]};var D=0;c.Shape=k("dojox.gfx.svg.Shape",g.Shape,{destroy:function(){if(this.fillStyle&&"type"in this.fillStyle){var a=this.rawNode.getAttribute("fill");(a=c.getRef(a))&&a.parentNode.removeChild(a)}this.clip&&(a=this.rawNode.getAttribute("clip-path"))&&(a=q.byId(a.match(/gfx_clip[\d]+/)[0]))&&a.parentNode.removeChild(a);g.Shape.prototype.destroy.apply(this,arguments)},setFill:function(a){if(!a)return this.fillStyle=null,this.rawNode.setAttribute("fill", "none"),this.rawNode.setAttribute("fill-opacity",0),this;var b,c=function(a){this.setAttribute(a,b[a].toFixed(8))};if("object"==typeof a&&"type"in a){switch(a.type){case "linear":b=h.makeParameters(h.defaultLinearGradient,a);a=this._setFillObject(b,"linearGradient");v.forEach(["x1","y1","x2","y2"],c,a);break;case "radial":b=h.makeParameters(h.defaultRadialGradient,a);a=this._setFillObject(b,"radialGradient");v.forEach(["cx","cy","r"],c,a);break;case "pattern":b=h.makeParameters(h.defaultPattern,a), a=this._setFillObject(b,"pattern"),v.forEach(["x","y","width","height"],c,a)}this.fillStyle=b;return this}this.fillStyle=b=h.normalizeColor(a);this.rawNode.setAttribute("fill",b.toCss());this.rawNode.setAttribute("fill-opacity",b.a);this.rawNode.setAttribute("fill-rule","evenodd");return this},setStroke:function(a){var b=this.rawNode;if(!a)return this.strokeStyle=null,b.setAttribute("stroke","none"),b.setAttribute("stroke-opacity",0),this;if("string"==typeof a||m.isArray(a)||a instanceof z)a={color:a}; a=this.strokeStyle=h.makeParameters(h.defaultStroke,a);a.color=h.normalizeColor(a.color);if(a){var e=0>a.width?0:a.width;b.setAttribute("stroke",a.color.toCss());b.setAttribute("stroke-opacity",a.color.a);b.setAttribute("stroke-width",e);b.setAttribute("stroke-linecap",a.cap);"number"==typeof a.join?(b.setAttribute("stroke-linejoin","miter"),b.setAttribute("stroke-miterlimit",a.join)):b.setAttribute("stroke-linejoin",a.join);var d=a.style.toLowerCase();d in c.dasharray&&(d=c.dasharray[d]);if(d instanceof Array){var d=m._toArray(d),f;for(f=0;fd[f]&&(d[f]=1);for(f=1;fa.width?0:a.width).toFixed(8)),e.setAttribute("height",(0>a.height?0: a.height).toFixed(8)),w(e,c.xmlns.xlink,"xlink:href",a.src),f.appendChild(e);else for(f.setAttribute("gradientUnits","userSpaceOnUse"),b=0;ba?0:a;this.rawNode.setAttribute(b,a)}this.bbox=null;return this},_moveToFront:function(){this.rawNode.parentNode.appendChild(this.rawNode);return this},_moveToBack:function(){this.rawNode.parentNode.insertBefore(this.rawNode, this.rawNode.parentNode.firstChild);return this},setClip:function(a){this.inherited(arguments);var b=a?"width"in a?"rect":"cx"in a?"ellipse":"points"in a?"polyline":"d"in a?"path":null:null;if(a&&!b)return this;"polyline"===b&&(a=m.clone(a),a.points=a.points.join(","));var e,d=u.get(this.rawNode,"clip-path");d&&(e=q.byId(d.match(/gfx_clip[\d]+/)[0]))&&e.removeChild(e.childNodes[0]);a?(e?(b=l(c.xmlns.svg,b),e.appendChild(b)):(d="gfx_clip"+ ++D,this.rawNode.setAttribute("clip-path","url(#"+d+")"),e= l(c.xmlns.svg,"clipPath"),b=l(c.xmlns.svg,b),e.appendChild(b),this.rawNode.parentNode.insertBefore(e,this.rawNode),u.set(e,"id",d)),u.set(b,a)):(this.rawNode.removeAttribute("clip-path"),e&&e.parentNode.removeChild(e));return this},_removeClipNode:function(){var a,b=u.get(this.rawNode,"clip-path");b&&(a=q.byId(b.match(/gfx_clip[\d]+/)[0]))&&a.parentNode.removeChild(a);return a}});c.Group=k("dojox.gfx.svg.Group",c.Shape,{constructor:function(){g.Container._init.call(this)},setRawNode:function(a){this.rawNode= a;this.rawNode.__gfxObject__=this},destroy:function(){this.clear(!0);c.Shape.prototype.destroy.apply(this,arguments)}});c.Group.nodeType="g";c.Rect=k("dojox.gfx.svg.Rect",[c.Shape,g.Rect],{setShape:function(a){this.shape=h.makeParameters(this.shape,a);this.bbox=null;for(var b in this.shape)if("type"!=b&&"r"!=b){a=this.shape[b];if("width"===b||"height"===b)a=0>a?0:a;this.rawNode.setAttribute(b,a)}null!=this.shape.r&&(this.rawNode.setAttribute("ry",this.shape.r),this.rawNode.setAttribute("rx",this.shape.r)); return this}});c.Rect.nodeType="rect";c.Ellipse=k("dojox.gfx.svg.Ellipse",[c.Shape,g.Ellipse],{});c.Ellipse.nodeType="ellipse";c.Circle=k("dojox.gfx.svg.Circle",[c.Shape,g.Circle],{});c.Circle.nodeType="circle";c.Line=k("dojox.gfx.svg.Line",[c.Shape,g.Line],{});c.Line.nodeType="line";c.Polyline=k("dojox.gfx.svg.Polyline",[c.Shape,g.Polyline],{setShape:function(a,b){a&&a instanceof Array?(this.shape=h.makeParameters(this.shape,{points:a}),b&&this.shape.points.length&&this.shape.points.push(this.shape.points[0])): this.shape=h.makeParameters(this.shape,a);this.bbox=null;this._normalizePoints();a=[];b=this.shape.points;for(var c=0;ce?0:e;a.setAttribute(b,e)}a.setAttribute("preserveAspectRatio","none");w(a,c.xmlns.xlink,"xlink:href",this.shape.src);a.__gfxObject__=this;return this}});c.Image.nodeType="image";c.Text=k("dojox.gfx.svg.Text",[c.Shape,g.Text],{setShape:function(a){this.shape=h.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;var b=this.shape;a.setAttribute("x",b.x);a.setAttribute("y",b.y);a.setAttribute("text-anchor",b.align);a.setAttribute("text-decoration",b.decoration);a.setAttribute("rotate",b.rotated? 90:0);a.setAttribute("kerning",b.kerning?"auto":0);a.setAttribute("text-rendering",C);a.firstChild?a.firstChild.nodeValue=b.text:a.appendChild(x(b.text));return this},getTextWidth:function(){var a=this.rawNode,b=a.parentNode,a=a.cloneNode(!0);a.style.visibility="hidden";var c=0,d=a.firstChild.nodeValue;b.appendChild(a);if(""!=d)for(;!c;)c=a.getBBox?parseInt(a.getBBox().width):68;b.removeChild(a);return c},getBoundingBox:function(){var a=null;if(this.getShape().text)try{a=this.rawNode.getBBox()}catch(b){a= {x:0,y:0,width:0,height:0}}return a}});c.Text.nodeType="text";c.Path=k("dojox.gfx.svg.Path",[c.Shape,t.Path],{_updateWithSegment:function(a){this.inherited(arguments);"string"==typeof this.shape.path&&this.rawNode.setAttribute("d",this.shape.path)},setShape:function(a){this.inherited(arguments);this.shape.path?this.rawNode.setAttribute("d",this.shape.path):this.rawNode.removeAttribute("d");return this}});c.Path.nodeType="path";c.TextPath=k("dojox.gfx.svg.TextPath",[c.Shape,t.TextPath],{_updateWithSegment:function(a){this.inherited(arguments); this._setTextPath()},setShape:function(a){this.inherited(arguments);this._setTextPath();return this},_setTextPath:function(){if("string"==typeof this.shape.path){var a=this.rawNode;if(!a.firstChild){var b=l(c.xmlns.svg,"textPath"),e=x("");b.appendChild(e);a.appendChild(b)}b=(b=a.firstChild.getAttributeNS(c.xmlns.xlink,"href"))&&c.getRef(b);if(!b&&(e=this._getParentSurface())){var e=e.defNode,b=l(c.xmlns.svg,"path"),d=h._base._getUniqueId();b.setAttribute("id",d);e.appendChild(b);w(a.firstChild,c.xmlns.xlink, "xlink:href","#"+d)}b&&b.setAttribute("d",this.shape.path)}},_setText:function(){var a=this.rawNode;if(!a.firstChild){var b=l(c.xmlns.svg,"textPath"),e=x("");b.appendChild(e);a.appendChild(b)}a=a.firstChild;b=this.text;a.setAttribute("alignment-baseline","middle");switch(b.align){case "middle":a.setAttribute("text-anchor","middle");a.setAttribute("startOffset","50%");break;case "end":a.setAttribute("text-anchor","end");a.setAttribute("startOffset","100%");break;default:a.setAttribute("text-anchor", "start"),a.setAttribute("startOffset","0%")}a.setAttribute("baseline-shift","0.5ex");a.setAttribute("text-decoration",b.decoration);a.setAttribute("rotate",b.rotated?90:0);a.setAttribute("kerning",b.kerning?"auto":0);a.firstChild.data=b.text}});c.TextPath.nodeType="text";var E=534a?0:a;b=0>b?0:b;this.rawNode.setAttribute("width",a);this.rawNode.setAttribute("height",b);E&&(this.rawNode.style.width=a,this.rawNode.style.height=b);return this},getDimensions:function(){return this.rawNode?{width:h.normalizedLength(this.rawNode.getAttribute("width")),height:h.normalizedLength(this.rawNode.getAttribute("height"))}:null}});c.createSurface=function(a,b,e){var d=new c.Surface;d.rawNode=l(c.xmlns.svg, "svg");d.rawNode.setAttribute("overflow","hidden");b&&d.rawNode.setAttribute("width",0>b?0:b);e&&d.rawNode.setAttribute("height",0>e?0:e);b=l(c.xmlns.svg,"defs");d.rawNode.appendChild(b);d.defNode=b;d._parent=q.byId(a);d._parent.appendChild(d.rawNode);h._base._fixMsTouchAction(d);return d};n={_setFont:function(){var a=this.fontStyle;this.rawNode.setAttribute("font-style",a.style);this.rawNode.setAttribute("font-variant",a.variant);this.rawNode.setAttribute("font-weight",a.weight);this.rawNode.setAttribute("font-size", a.size);this.rawNode.setAttribute("font-family",a.family)}};var r=g.Container;k=c.Container={openBatch:function(){if(!this._batch){var a;a=c.useSvgWeb?p.doc.createDocumentFragment(!0):p.doc.createDocumentFragment();this.fragment=a}++this._batch;return this},closeBatch:function(){this._batch=0b?0:b;e=0>e?0:e;if(!b||!e){var f=y.position(a);b=b||f.w;e=e||f.h}a=q.byId(a);var f=a.id?a.id+"_svgweb":h._base._getUniqueId(),g=l(c.xmlns.svg,"svg");g.id=f;g.setAttribute("width",b);g.setAttribute("height",e);svgweb.appendChild(g,a);g.addEventListener("SVGLoad",function(){d.rawNode= this;d.isLoaded=!0;var a=l(c.xmlns.svg,"defs");d.rawNode.appendChild(a);d.defNode=a;if(d.onLoad)d.onLoad(d)},!1);d.isLoaded=!1;return d},c.Surface.extend({destroy:function(){var a=this.rawNode;svgweb.removeChild(a,a.parentNode)}}),n={connect:function(a,b,c){"on"===a.substring(0,2)&&(a=a.substring(2));c=2==arguments.length?b:m.hitch(b,c);this.getEventSource().addEventListener(a,c,!1);return[this,a,c]},disconnect:function(a){this.getEventSource().removeEventListener(a[1],a[2],!1);delete a[0]}},m.extend(c.Shape, n),m.extend(c.Surface,n));return c});