//>>built
define("dojox/gfx/vml_attach","dojo/_base/kernel dojo/_base/lang ./_base ./matrix ./path dojo/_base/Color ./vml".split(" "),function(u,l,f,m,v,n,g){u.experimental("dojox.gfx.vml_attach");g.attachNode=function(a){if(!a)return null;var d=null;switch(a.tagName.toLowerCase()){case g.Rect.nodeType:a=d=new g.Rect(a);var c=a.rawNode,b=c.outerHTML.match(/arcsize = "(\d*\.?\d+[%f]?)"/)[1];c=c.style;var e=parseFloat(c.width),k=parseFloat(c.height);b=0<=b.indexOf("%")?parseFloat(b)/100:g._parseFloat(b);a.shape=
f.makeParameters(f.defaultRect,{x:parseInt(c.left),y:parseInt(c.top),width:e,height:k,r:Math.min(e,k)*b});break;case g.Ellipse.nodeType:a.style.width==a.style.height?(a=d=new g.Circle(a),b=a.rawNode.style,c=parseInt(b.width)/2,a.shape=f.makeParameters(f.defaultCircle,{cx:parseInt(b.left)+c,cy:parseInt(b.top)+c,r:c})):(a=d=new g.Ellipse(a),b=a.rawNode.style,c=parseInt(b.width)/2,e=parseInt(b.height)/2,a.shape=f.makeParameters(f.defaultEllipse,{cx:parseInt(b.left)+c,cy:parseInt(b.top)+e,rx:c,ry:e}));
break;case g.Path.nodeType:switch(a.getAttribute("dojoGfxType")){case "line":b=d=new g.Line(a);a=b.shape=l.clone(f.defaultLine);b=b.rawNode.path.v.match(f.pathVmlRegExp);7>b.length||"m"!=b[0]||"l"!=b[3]||"e"!=b[6]||(a.x1=parseInt(b[1]),a.y1=parseInt(b[2]),a.x2=parseInt(b[4]),a.y2=parseInt(b[5]));break;case "polyline":b=d=new g.Polyline(a);a=b.shape=l.clone(f.defaultPolyline);b=b.rawNode.path.v.match(f.pathVmlRegExp);if(!(3>b.length||"m"!=b[0]||(c=parseInt(b[0]),e=parseInt(b[1]),isNaN(c)||isNaN(e)||
(a.points.push({x:c,y:e}),6>b.length||"l"!=b[3]))))for(k=4;k<b.length;k+=2){c=parseInt(b[k]);e=parseInt(b[k+1]);if(isNaN(c)||isNaN(e))break;a.points.push({x:c,y:e})}break;case "path":d=new g.Path(a);p(d);break;case "text":d=new g.Text(a);q(d);r(d);a=d;t(a);b=a.matrix;c=a.fontStyle;b&&c&&(a.matrix=m.multiply(b,{dy:.35*f.normalizedLength(c.size)}));break;case "textpath":d=new g.TextPath(a),p(d),q(d),r(d)}break;case g.Image.nodeType:switch(a.getAttribute("dojoGfxType")){case "image":a=d=new g.Image(a),
a.shape=l.clone(f.defaultImage),a.shape.src=a.rawNode.firstChild.src,a=d.rawNode.filters["DXImageTransform.Microsoft.Matrix"],d.matrix=m.normalize({xx:a.M11,xy:a.M12,yx:a.M21,yy:a.M22,dx:a.Dx,dy:a.Dy})}break;default:return null}if(!(d instanceof g.Image)){a=d;b=null;c=a.rawNode;e=c.fill;if(e.on&&"gradient"==e.type)for(b=l.clone(f.defaultLinearGradient),rad=m._degToRad(e.angle),b.x2=Math.cos(rad),b.y2=Math.sin(rad),b.colors=[],c=e.colors.value.split(";"),e=0;e<c.length;++e)(k=c[e].match(/\S+/g))&&
2==k.length&&b.colors.push({offset:g._parseFloat(k[0]),color:new n(k[1])});else if(e.on&&"gradientradial"==e.type)for(b=l.clone(f.defaultRadialGradient),w=parseFloat(c.style.width),h=parseFloat(c.style.height),b.cx=isNaN(w)?0:e.focusposition.x*w,b.cy=isNaN(h)?0:e.focusposition.y*h,b.r=isNaN(w)?1:w/2,b.colors=[],c=e.colors.value.split(";"),e=c.length-1;0<=e;--e)(k=c[e].match(/\S+/g))&&2==k.length&&b.colors.push({offset:g._parseFloat(k[0]),color:new n(k[1])});else e.on&&"tile"==e.type?(b=l.clone(f.defaultPattern),
b.width=f.pt2px(e.size.x),b.height=f.pt2px(e.size.y),b.x=e.origin.x*b.width,b.y=e.origin.y*b.height,b.src=e.src):e.on&&c.fillcolor&&(b=new n(c.fillcolor+""),b.a=e.opacity);a.fillStyle=b;x(d);d instanceof g.Text||t(d)}return d};g.attachSurface=function(a){var d=new g.Surface;d.clipNode=a;a=d.rawNode=a.firstChild;var c=a.firstChild;if(!c||"rect"!=c.tagName)return null;d.bgNode=a;return d};var x=function(a){var d=a.rawNode;if(d.stroked){a=a.strokeStyle=l.clone(f.defaultStroke);var c=d.stroke;a.color=
new n(d.strokecolor.value);a.width=f.normalizedLength(d.strokeweight+"");a.color.a=c.opacity;a.cap=this._translate(this._capMapReversed,c.endcap);a.join="miter"==c.joinstyle?c.miterlimit:c.joinstyle;a.style=c.dashstyle}else a.strokeStyle=null},t=function(a){var d=a.rawNode.skew,c=d.matrix;d=d.offset;a.matrix=m.normalize({xx:c.xtox,xy:c.ytox,yx:c.xtoy,yy:c.ytoy,dx:f.pt2px(d.x),dy:f.pt2px(d.y)})},q=function(a){var d=a.shape=l.clone(f.defaultText),c=a.rawNode,b=c.path.v.match(f.pathVmlRegExp);if(b&&
7==b.length){c=c.childNodes;for(var e=0;e<c.length&&"textpath"!=c[e].tagName;++e);if(!(e>=c.length)){a=c[e].style;d.text=c[e].string;switch(a["v-text-align"]){case "left":d.x=parseInt(b[1]);d.align="start";break;case "center":d.x=(parseInt(b[1])+parseInt(b[4]))/2;d.align="middle";break;case "right":d.x=parseInt(b[4]),d.align="end"}d.y=parseInt(b[2]);d.decoration=a["text-decoration"];d.rotated=a["v-rotate-letters"].toLowerCase()in g._bool;d.kerning=a["v-text-kern"].toLowerCase()in g._bool;return}}a.shape=
null},r=function(a){for(var d=a.fontStyle=l.clone(f.defaultFont),c=a.rawNode.childNodes,b=0;b<c.length&&"textpath"==c[b].tagName;++b);b>=c.length?a.fontStyle=null:(a=c[b].style,d.style=a.fontstyle,d.variant=a.fontvariant,d.weight=a.fontweight,d.size=a.fontsize,d.family=a.fontfamily)},p=function(a){var d=a.shape=l.clone(f.defaultPath),c=a.rawNode.path.v.match(f.pathVmlRegExp);a=[];for(var b=!1,e=v._pathVmlToSvgMap;0<c.length;++c){var k=c[0];k in e?(b=!1,a.push(e[k])):b||(k=parseInt(k),isNaN(k)?b=!0:
a.push(k))}c=a.length;4<=c&&""==a[c-1]&&0==a[c-2]&&0==a[c-3]&&"l"==a[c-4]&&a.splice(c-4,4);c&&(d.path=a.join(" "))};return g});