//>>built
define("dojox/gfx/utils","dojo/_base/kernel dojo/_base/lang ./_base dojo/_base/html dojo/_base/array dojo/_base/window dojo/_base/json dojo/_base/Deferred dojo/_base/sniff require dojo/_base/config".split(" "),function(e,m,f,n,k,p,r,t,w,x,y){var d=f.utils={};m.mixin(d,{forEach:function(a,b,c){c=c||e.global;b.call(c,a);(a instanceof f.Surface||a instanceof f.Group)&&k.forEach(a.children,function(q){d.forEach(q,b,c)})},serialize:function(a){var b={},c;if((c=a instanceof f.Surface)||a instanceof f.Group){if(b.children=
k.map(a.children,d.serialize),c)return b.children}else b.shape=a.getShape();a.getTransform&&(c=a.getTransform())&&(b.transform=c);a.getStroke&&(c=a.getStroke())&&(b.stroke=c);a.getFill&&(c=a.getFill())&&(b.fill=c);a.getFont&&(c=a.getFont())&&(b.font=c);return b},toJson:function(a,b){return r.toJson(d.serialize(a),b)},deserialize:function(a,b){if(b instanceof Array)return k.map(b,m.hitch(null,d.deserialize,a));var c="shape"in b?a.createShape(b.shape):a.createGroup();"transform"in b&&c.setTransform(b.transform);
"stroke"in b&&c.setStroke(b.stroke);"fill"in b&&c.setFill(b.fill);"font"in b&&c.setFont(b.font);"children"in b&&k.forEach(b.children,m.hitch(null,d.deserialize,c));return c},fromJson:function(a,b){return d.deserialize(a,r.fromJson(b))},toSvg:function(a){var b=new t;if("svg"===f.renderer)try{var c=d._cleanSvg(d._innerXML(a.rawNode));b.callback(c)}catch(l){b.errback(l)}else{d._initSvgSerializerDeferred||d._initSvgSerializer();var q=d.toJson(a);c=function(){try{var l=a.getDimensions(),u=l.width,v=l.height,
g=d._gfxSvgProxy.document.createElement("div");d._gfxSvgProxy.document.body.appendChild(g);p.withDoc(d._gfxSvgProxy.document,function(){n.style(g,"width",u);n.style(g,"height",v)},this);d._gfxSvgProxy[dojox._scopeName].gfx.createSurface(g,u,v).whenLoaded(null,function(h){try{d._gfxSvgProxy[dojox._scopeName].gfx.utils.fromJson(h,q);var z=d._cleanSvg(g.innerHTML);h.clear();h.destroy();d._gfxSvgProxy.document.body.removeChild(g);b.callback(z)}catch(A){b.errback(A)}})}catch(h){b.errback(h)}};0<d._initSvgSerializerDeferred.fired?
c():d._initSvgSerializerDeferred.addCallback(c)}return b},_gfxSvgProxy:null,_initSvgSerializerDeferred:null,_svgSerializerInitialized:function(){d._initSvgSerializerDeferred.callback(!0)},_initSvgSerializer:function(){if(!d._initSvgSerializerDeferred){d._initSvgSerializerDeferred=new t;var a=p.doc.createElement("iframe");n.style(a,{display:"none",position:"absolute",width:"1em",height:"1em",top:"-10000px"});var b;w("ie")?a.onreadystatechange=function(){"complete"==a.contentWindow.document.readyState&&
(a.onreadystatechange=function(){},b=setInterval(function(){a.contentWindow[e.scopeMap.dojo[1]._scopeName]&&a.contentWindow[e.scopeMap.dojox[1]._scopeName].gfx&&a.contentWindow[e.scopeMap.dojox[1]._scopeName].gfx.utils&&(clearInterval(b),a.contentWindow.parent[e.scopeMap.dojox[1]._scopeName].gfx.utils._gfxSvgProxy=a.contentWindow,a.contentWindow.parent[e.scopeMap.dojox[1]._scopeName].gfx.utils._svgSerializerInitialized())},50))}:a.onload=function(){a.onload=function(){};b=setInterval(function(){a.contentWindow[e.scopeMap.dojo[1]._scopeName]&&
a.contentWindow[e.scopeMap.dojox[1]._scopeName].gfx&&a.contentWindow[e.scopeMap.dojox[1]._scopeName].gfx.utils&&(clearInterval(b),a.contentWindow.parent[e.scopeMap.dojox[1]._scopeName].gfx.utils._gfxSvgProxy=a.contentWindow,a.contentWindow.parent[e.scopeMap.dojox[1]._scopeName].gfx.utils._svgSerializerInitialized())},50)};var c=y.dojoxGfxSvgProxyFrameUrl||x.toUrl("dojox/gfx/resources/gfxSvgProxyFrame.html");a.setAttribute("src",c.toString());p.body().appendChild(a)}},_innerXML:function(a){return a.innerXML?
a.innerXML:a.xml?a.xml:"undefined"!=typeof XMLSerializer?(new XMLSerializer).serializeToString(a):null},_cleanSvg:function(a){a&&(-1==a.indexOf('xmlns\x3d"http://www.w3.org/2000/svg"')&&(a=a.substring(4,a.length),a='\x3csvg xmlns\x3d"http://www.w3.org/2000/svg"'+a),-1==a.indexOf('xmlns:xlink\x3d"http://www.w3.org/1999/xlink"')&&(a=a.substring(4,a.length),a='\x3csvg xmlns:xlink\x3d"http://www.w3.org/1999/xlink"'+a),-1===a.indexOf("xlink:href")&&(a=a.replace(/href\s*=/g,"xlink:href\x3d")),a=a.replace(/<img\b([^>]*)>/gi,
"\x3cimage $1 /\x3e"),a=a.replace(/\bdojoGfx\w*\s*=\s*(['"])\w*\1/g,""),a=a.replace(/\b__gfxObject__\s*=\s*(['"])\w*\1/g,""),a=a.replace(/[=]([^"']+?)(\s|>)/g,'\x3d"$1"$2'),a=a.replace(/\bstroke-opacity\w*\s*=\s*(['"])undefined\1/g,""));return a}});return d});