//>>built
define("dojox/gfx/svg","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(l,n,p,q,k,v,z,u,A,h,g,t){function m(a,b){return p.doc.createElementNS?p.doc.createElementNS(a,b):p.doc.createElement(b)}function w(a,b,e,c){return a.setAttributeNS?a.setAttributeNS(b,e,c):a.setAttribute(e,c)}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 B=navigator.userAgent,C=n("ios"),y=n("android"),D=n("chrome")||y&&4<=y?"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 E=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||
l.isArray(a)||a instanceof A)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=l._toArray(d),f;for(f=0;f<d.length;++f)d[f]*=e;if("butt"!=a.cap){for(f=0;f<d.length;f+=2)d[f]-=e,1>d[f]&&(d[f]=1);for(f=1;f<d.length;f+=2)d[f]+=e}d=d.join(",")}b.setAttribute("stroke-dasharray",d);b.setAttribute("dojoGfxStrokeStyle",a.style)}return this},_getParentSurface:function(){for(var a=this.parent;a&&!(a instanceof h.Surface);a=a.parent);return a},_setFillObject:function(a,b){var e=c.xmlns.svg;this.fillStyle=a;var d=this._getParentSurface().defNode,
f=this.rawNode.getAttribute("fill");if(f=c.getRef(f))if(f.tagName.toLowerCase()!=b.toLowerCase()){var g=f.id;f.parentNode.removeChild(f);f=m(e,b);f.setAttribute("id",g);d.appendChild(f)}else for(;f.childNodes.length;)f.removeChild(f.lastChild);else f=m(e,b),f.setAttribute("id",h._base._getUniqueId()),d.appendChild(f);if("pattern"==b)f.setAttribute("patternUnits","userSpaceOnUse"),e=m(e,"image"),e.setAttribute("x",0),e.setAttribute("y",0),e.setAttribute("width",(0>a.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"),d=0;d<a.colors.length;++d){var g=a.colors[d],k=m(e,"stop"),l=g.color=h.normalizeColor(g.color);k.setAttribute("offset",g.offset.toFixed(8));k.setAttribute("stop-color",l.toCss());k.setAttribute("stop-opacity",l.a);f.appendChild(k)}this.rawNode.setAttribute("fill","url(#"+f.getAttribute("id")+")");this.rawNode.removeAttribute("fill-opacity");this.rawNode.setAttribute("fill-rule",
"evenodd");return f},_applyTransform:function(){if(this.matrix){var a=this.matrix;this.rawNode.setAttribute("transform","matrix("+a.xx.toFixed(8)+","+a.yx.toFixed(8)+","+a.xy.toFixed(8)+","+a.yy.toFixed(8)+","+a.dx.toFixed(8)+","+a.dy.toFixed(8)+")")}else this.rawNode.removeAttribute("transform");return this},setRawNode:function(a){a=this.rawNode=a;"image"!=this.shape.type&&a.setAttribute("fill","none");a.setAttribute("fill-opacity",0);a.setAttribute("stroke","none");a.setAttribute("stroke-opacity",
0);a.setAttribute("stroke-width",1);a.setAttribute("stroke-linecap","butt");a.setAttribute("stroke-linejoin","miter");a.setAttribute("stroke-miterlimit",4);a.__gfxObject__=this},setShape:function(a){this.shape=h.makeParameters(this.shape,a);for(var b in this.shape)if("type"!=b){a=this.shape[b];if("width"===b||"height"===b)a=0>a?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=l.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=m(c.xmlns.svg,b),e.appendChild(b)):(d="gfx_clip"+ ++E,this.rawNode.setAttribute("clip-path","url(#"+d+")"),e=
m(c.xmlns.svg,"clipPath"),b=m(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();for(var c=[],d=this.shape.points,f=0;f<d.length;++f)c.push(d[f].x.toFixed(8),d[f].y.toFixed(8));this.rawNode.setAttribute("points",c.join(" "));return this}});c.Polyline.nodeType="polyline";c.Image=k("dojox.gfx.svg.Image",[c.Shape,g.Image],{setShape:function(a){this.shape=h.makeParameters(this.shape,a);this.bbox=null;a=this.rawNode;for(var b in this.shape)if("type"!=b&&"src"!=b){var e=this.shape[b];if("width"===b||"height"===
b)e=0>e?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",D);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=m(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=m(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=m(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 F=534<function(){var a=/WebKit\/(\d*)/.exec(B);return a?a[1]:0}();c.Surface=k("dojox.gfx.svg.Surface",g.Surface,{constructor:function(){g.Container._init.call(this)},destroy:function(){g.Container.clear.call(this,!0);this.defNode=
null;this.inherited(arguments)},setDimensions:function(a,b){if(!this.rawNode)return this;var c=0>a?0:a,d=0>b?0:b;this.rawNode.setAttribute("width",c);this.rawNode.setAttribute("height",d);F&&(this.rawNode.style.width=c,this.rawNode.style.height=d);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=
m(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=m(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=0<this._batch?--this._batch:0;this.fragment&&!this._batch&&(this.rawNode.appendChild(this.fragment),delete this.fragment);return this},add:function(a){this!=a.getParent()&&(this.fragment?this.fragment.appendChild(a.rawNode):
this.rawNode.appendChild(a.rawNode),r.add.apply(this,arguments),a.setClip(a.clip));return this},remove:function(a,b){this==a.getParent()&&(this.rawNode==a.rawNode.parentNode&&this.rawNode.removeChild(a.rawNode),this.fragment&&this.fragment==a.rawNode.parentNode&&this.fragment.removeChild(a.rawNode),a._removeClipNode(),r.remove.apply(this,arguments));return this},clear:function(){for(var a=this.rawNode;a.lastChild;)a.removeChild(a.lastChild);var b=this.defNode;if(b){for(;b.lastChild;)b.removeChild(b.lastChild);
a.appendChild(b)}return r.clear.apply(this,arguments)},getBoundingBox:r.getBoundingBox,_moveChildToFront:r._moveChildToFront,_moveChildToBack:r._moveChildToBack};t=c.Creator={createObject:function(a,b){if(!this.rawNode)return null;var e=new a,d=m(c.xmlns.svg,a.nodeType);e.setRawNode(d);e.setShape(b);this.add(e);return e}};l.extend(c.Text,n);l.extend(c.TextPath,n);l.extend(c.Group,k);l.extend(c.Group,g.Creator);l.extend(c.Group,t);l.extend(c.Surface,k);l.extend(c.Surface,g.Creator);l.extend(c.Surface,
t);c.fixTarget=function(a,b){a.gfxTarget||(a.gfxTarget=C&&a.target.wholeText?a.target.parentElement.__gfxObject__:a.target.__gfxObject__);return!0};c.useSvgWeb&&(c.createSurface=function(a,b,e){var d=new c.Surface;b=0>b?0:b;e=0>e?0:e;if(!b||!e){var f=z.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=m(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=m(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:l.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]}},l.extend(c.Shape,
n),l.extend(c.Surface,n));return c});
//# sourceMappingURL=svg.js.map