!function t(e,i,n){function r(a,h){if(!i[a]){if(!e[a]){var o="function"==typeof require&&require;if(!h&&o)return o(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=i[a]={exports:{}};e[a][0].call(u.exports,function(t){var i=e[a][1][t];return r(i?i:t)},u,u.exports,t,e,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;ai;i++){var r=arguments[i];"function"==typeof r&&(r=r.prototype);for(var s in r)e[s]=r[s]}return e.initialize||(e.initialize=function(){}),e.constructor=function(t,i,n,r,s,a,h,o){return new e.initialize(t,i,n,r,s,a,h,o)},e.constructor.prototype=e.initialize.prototype=e,e.constructor}},{}],3:[function(t,e,i){var n={maroon:"#800000",red:"#ff0000",orange:"#ffA500",yellow:"#ffff00",olive:"#808000",purple:"#800080",fuchsia:"#ff00ff",white:"#ffffff",lime:"#00ff00",green:"#008000",navy:"#000080",blue:"#0000ff",aqua:"#00ffff",teal:"#008080",black:"#000000",silver:"#c0c0c0",gray:"#808080"},r=function(t,e){for(var i=[],n=0,r=t.length;r>n;n++)i[n]=e(t[n],n);return i},s=function(t,e){if(t.isColor)this.red=t.red,this.green=t.green,this.blue=t.blue,this.alpha=t.alpha;else{var i=n[t];switch(i&&(t=i,e="hex"),typeof t){case"string":e||(e=(e=t.match(/^rgb|^hsb|^hsl/))?e[0]:"hex");break;case"object":e=e||"rgb",t=t.toString();break;case"number":e="hex",t=t.toString(16)}t=s["parse"+e.toUpperCase()](t),this.red=t[0],this.green=t[1],this.blue=t[2],this.alpha=t[3]}this.isColor=!0},a=function(t,e,i){return Math.min(i,Math.max(e,t))},h=/([-.\d]+\%?)\s*,\s*([-.\d]+\%?)\s*,\s*([-.\d]+\%?)\s*,?\s*([-.\d]*\%?)/,o=/^#?([a-f0-9]{1,2})([a-f0-9]{1,2})([a-f0-9]{1,2})([a-f0-9]{0,2})$/i;s.parseRGB=function(t){return r(t.match(h).slice(1),function(t,e){return t&&(t=parseFloat(t)*("%"==t[t.length-1]?2.55:1)),3>e?Math.round((t%=256)<0?t+256:t):a(""===t?1:Number(t),0,1)})},s.parseHEX=function(t){return 1==t.length&&(t=t+t+t),r(t.match(o).slice(1),function(t,e){return 3==e?t?parseInt(t,16)/255:1:parseInt(1==t.length?t+t:t,16)})},s.parseHSB=function(t){var e=r(t.match(h).slice(1),function(t,e){return t&&(t=parseFloat(t)),0===e?Math.round((t%=360)<0?t+360:t):3>e?a(Math.round(t),0,100):a(""===t?1:Number(t),0,1)}),i=e[3],n=Math.round(e[2]/100*255);if(0==e[1])return[n,n,n,i];var s=e[0],o=s%60,l=Math.round(e[2]*(100-e[1])/1e4*255),u=Math.round(e[2]*(6e3-e[1]*o)/6e5*255),c=Math.round(e[2]*(6e3-e[1]*(60-o))/6e5*255);switch(Math.floor(s/60)){case 0:return[n,c,l,i];case 1:return[u,n,l,i];case 2:return[l,n,c,i];case 3:return[l,u,n,i];case 4:return[c,l,n,i];default:return[n,l,u,i]}},s.parseHSL=function(t){var e=r(t.match(h).slice(1),function(t,e){return t&&(t=parseFloat(t)),0===e?Math.round((t%=360)<0?t+360:t):3>e?a(Math.round(t),0,100):a(""===t?1:Number(t),0,1)}),i=e[0]/60,n=e[1]/100,s=e[2]/100,o=e[3],l=(1-Math.abs(2*s-1))*n,u=l*(1-Math.abs(i%2-1)),c=s-l/2,f=Math.round(255*(l+c)),p=Math.round(255*(u+c)),d=Math.round(255*c);switch(Math.floor(i)){case 0:return[f,p,d,o];case 1:return[p,f,d,o];case 2:return[d,f,p,o];case 3:return[d,p,f,o];case 4:return[p,d,f,o];default:return[f,d,p,o]}};var l=function(t,e){return 1!=e[3]?t+="a":e.pop(),t+"("+e.join(", ")+")"};s.prototype={toHSB:function(t){var e=this.red,i=this.green,n=this.blue,r=this.alpha,s=Math.max(e,i,n),a=Math.min(e,i,n),h=s-a,o=0,u=0!=h?h/s:0,c=s/255;if(u){var f=(s-e)/h,p=(s-i)/h,d=(s-n)/h;o=e==s?d-p:i==s?2+f-d:4+p-f,(o/=6)<0&&o++}var v=[Math.round(360*o),Math.round(100*u),Math.round(100*c),r];return t?v:l("hsb",v)},toHSL:function(t){var e=this.red,i=this.green,n=this.blue,r=this.alpha,s=Math.max(e,i,n),a=Math.min(e,i,n),h=s-a,o=0,u=0!=h?h/(255-Math.abs(s+a-255)):0,c=(s+a)/512;if(u){var f=(s-e)/h,p=(s-i)/h,d=(s-n)/h;o=e==s?d-p:i==s?2+f-d:4+p-f,(o/=6)<0&&o++}var v=[Math.round(360*o),Math.round(100*u),Math.round(100*c),r];return t?v:l("hsl",v)},toHEX:function(t){var e=this.alpha,i=1==(e=Math.round(255*e).toString(16)).length?e+e:e,n=r([this.red,this.green,this.blue],function(t){return t=t.toString(16),1==t.length?"0"+t:t});return t?n.concat(i):"#"+n.join("")+("ff"==i?"":i)},toRGB:function(t){var e=[this.red,this.green,this.blue,this.alpha];return t?e:l("rgb",e)}},s.prototype.toString=s.prototype.toRGB,s.hex=function(t){return new s(t,"hex")},null==this.hex&&(this.hex=s.hex),s.hsb=function(t,e,i,n){return new s([t||0,e||0,i||0,null==n?1:n],"hsb")},null==this.hsb&&(this.hsb=s.hsb),s.hsl=function(t,e,i,n){return new s([t||0,e||0,i||0,null==n?1:n],"hsl")},null==this.hsl&&(this.hsl=s.hsl),s.rgb=function(t,e,i,n){return new s([t||0,e||0,i||0,null==n?1:n],"rgb")},null==this.rgb&&(this.rgb=s.rgb),s.detach=function(t){return t=new s(t),[s.rgb(t.red,t.green,t.blue).toString(),t.alpha]},e.exports=s},{}],4:[function(t,e,i){var n=t("./class");e.exports=n({initialize:function(t){this.reset().push(t)},push:function(){var t=Array.prototype.join.call(arguments," ").match(/[a-df-z]|[\-+]?(?:[\d\.]e[\-+]?|[^\s\-+,a-z])+/gi);if(!t)return this;for(var e,i=t[0],n=1;i;){switch(i){case"m":this.move(t[n++],t[n++]);break;case"l":this.line(t[n++],t[n++]);break;case"c":this.curve(t[n++],t[n++],t[n++],t[n++],t[n++],t[n++]);break;case"s":this.curve(t[n++],t[n++],null,null,t[n++],t[n++]);break;case"q":this.curve(t[n++],t[n++],t[n++],t[n++]);break;case"t":this.curve(t[n++],t[n++]);break;case"a":this.arc(t[n+5],t[n+6],t[n],t[n+1],t[n+3],!+t[n+4],t[n+2]),n+=7;break;case"h":this.line(t[n++],0);break;case"v":this.line(0,t[n++]);break;case"M":this.moveTo(t[n++],t[n++]);break;case"L":this.lineTo(t[n++],t[n++]);break;case"C":this.curveTo(t[n++],t[n++],t[n++],t[n++],t[n++],t[n++]);break;case"S":this.curveTo(t[n++],t[n++],null,null,t[n++],t[n++]);break;case"Q":this.curveTo(t[n++],t[n++],t[n++],t[n++]);break;case"T":this.curveTo(t[n++],t[n++]);break;case"A":this.arcTo(t[n+5],t[n+6],t[n],t[n+1],t[n+3],!+t[n+4],t[n+2]),n+=7;break;case"H":this.lineTo(t[n++],this.penY);break;case"V":this.lineTo(this.penX,t[n++]);break;case"Z":case"z":this.close();break;default:i=e,n--;continue}e=i,"m"==e?e="l":"M"==e&&(e="L"),i=t[n++]}return this},reset:function(){return this.penX=this.penY=0,this.penDownX=this.penDownY=null,this._pivotX=this._pivotY=0,this.onReset(),this},move:function(t,e){return this.onMove(this.penX,this.penY,this._pivotX=this.penX+=+t,this._pivotY=this.penY+=+e),this},moveTo:function(t,e){return this.onMove(this.penX,this.penY,this._pivotX=this.penX=+t,this._pivotY=this.penY=+e),this},line:function(t,e){return this.lineTo(this.penX+ +t,this.penY+ +e)},lineTo:function(t,e){return null==this.penDownX&&(this.penDownX=this.penX,this.penDownY=this.penY),this.onLine(this.penX,this.penY,this._pivotX=this.penX=+t,this._pivotY=this.penY=+e),this},curve:function(t,e,i,n,r,s){var a=this.penX,h=this.penY;return this.curveTo(a+ +t,h+ +e,null==i?null:a+ +i,null==n?null:h+ +n,null==r?null:a+ +r,null==s?null:h+ +s)},curveTo:function(t,e,i,n,r,s){var a=this.penX,h=this.penY;return null==i&&(i=+t,n=+e,t=2*a-(this._pivotX||0),e=2*h-(this._pivotY||0)),null==r?(this._pivotX=+t,this._pivotY=+e,r=+i,s=+n,i=(r+2*+t)/3,n=(s+2*+e)/3,t=(a+2*+t)/3,e=(h+2*+e)/3):(this._pivotX=+i,this._pivotY=+n),null==this.penDownX&&(this.penDownX=a,this.penDownY=h),this.onBezierCurve(a,h,+t,+e,+i,+n,this.penX=+r,this.penY=+s),this},arc:function(t,e,i,n,r,s,a){return this.arcTo(this.penX+ +t,this.penY+ +e,i,n,r,s,a)},arcTo:function(t,e,i,n,r,s,a){if(n=Math.abs(+n||+i||+e-this.penY),i=Math.abs(+i||+t-this.penX),!i||!n||t==this.penX&&e==this.penY)return this.lineTo(t,e);var h=this.penX,o=this.penY,l=!+s,u=!!+r,c=a?a*Math.PI/180:0,f=Math.cos(c),p=Math.sin(c);t-=h,e-=o;var d=f*t/2+p*e/2,v=-p*t/2+f*e/2,g=i*i*n*n,m=n*n*d*d,y=i*i*v*v,x=g-y-m;if(0>x)x=Math.sqrt(1-x/g),i*=x,n*=x,d=t/2,v=e/2;else{x=Math.sqrt(x/(y+m)),u==l&&(x=-x);var _=-x*v*i/n,b=x*d*n/i;d=f*_-p*b+t/2,v=p*_+f*b+e/2}var w=f/i,T=p/i,M=-p/n,C=f/n,S=Math.atan2(M*-d+C*-v,w*-d+T*-v),k=Math.atan2(M*(t-d)+C*(e-v),w*(t-d)+T*(e-v));return d+=h,v+=o,t+=h,e+=o,null==this.penDownX&&(this.penDownX=this.penX,this.penDownY=this.penY),this.onArc(h,o,this._pivotX=this.penX=t,this._pivotY=this.penY=e,d,v,i,n,S,k,!l,a),this},counterArc:function(t,e,i,n,r){return this.arc(t,e,i,n,r,!0)},counterArcTo:function(t,e,i,n,r){return this.arcTo(t,e,i,n,r,!0)},close:function(){return null!=this.penDownX&&(this.onClose(this.penX,this.penY,this.penX=this.penDownX,this.penY=this.penDownY),this.penDownX=null),this},onReset:function(){},onMove:function(t,e,i,n){},onLine:function(t,e,i,n){this.onBezierCurve(t,e,t,e,i,n,i,n)},onBezierCurve:function(t,e,i,n,r,s,a,h){var o,l,u,c,f,p=a-t,d=h-e,v=p*p+d*d;if(u=i-t,c=n-e,f=u*p+c*d,f>v?(u-=p,c-=d):f>0&&0!=v&&(u-=f/v*p,c-=f/v*d),o=u*u+c*c,u=r-t,c=s-e,f=u*p+c*d,f>v?(u-=p,c-=d):f>0&&0!=v&&(u-=f/v*p,c-=f/v*d),l=u*u+c*c,.01>o&&.01>l)return void this.onLine(t,e,a,h);if(isNaN(o)||isNaN(l))throw new Error("Bad input");var g=.5*(i+r),m=.5*(n+s),y=.5*(i+t),x=.5*(n+e),_=.5*(y+g),b=.5*(x+m),w=.5*(a+r),T=.5*(h+s),M=.5*(w+g),C=.5*(T+m),S=.5*(_+M),k=.5*(b+C);this.onBezierCurve(t,e,y,x,_,b,S,k),this.onBezierCurve(S,k,M,C,w,T,a,h)},onArc:function(t,e,i,n,r,s,a,h,o,l,u,c){var f=c?c*Math.PI/180:0,p=Math.cos(f),d=Math.sin(f),v=p*a,g=-d*h,m=d*a,y=p*h,x=l-o;0>x&&!u?x+=2*Math.PI:x>0&&u&&(x-=2*Math.PI);for(var _=Math.ceil(Math.abs(x/(Math.PI/2))),b=x/_,w=4/3*Math.tan(b/4),T=Math.cos(o),M=Math.sin(o),C=0;_>C;C++){var S=T-w*M,k=M+w*T;o+=b,T=Math.cos(o),M=Math.sin(o);var z=T+w*M,X=M-w*T;this.onBezierCurve(t,e,r+v*S+g*k,s+m*S+y*k,r+v*z+g*X,s+m*z+y*X,t=r+v*T+g*M,e=s+m*T+y*M)}},onClose:function(t,e,i,n){this.onLine(t,e,i,n)}})},{"./class":2}],5:[function(t,e,i){function n(t,e,i,n,r,s){return t&&"object"==typeof t&&(e=t.yx,n=t.yy,s=t.y,i=t.xy,r=t.x,t=t.xx),this.xx=null==t?1:t,this.yx=e||0,this.xy=i||0,this.yy=null==n?1:n,this.x=(null==r?this.x:r)||0,this.y=(null==s?this.y:s)||0,this._transform(),this}var r=t("./class");e.exports=r({initialize:n,_transform:function(){},xx:1,yx:0,x:0,xy:0,yy:1,y:0,transform:function(t,e,i,n,r,s){var a=this;return t&&"object"==typeof t&&(e=t.yx,n=t.yy,s=t.y,i=t.xy,r=t.x,t=t.xx),r||(r=0),s||(s=0),this.transformTo(a.xx*t+a.xy*e,a.yx*t+a.yy*e,a.xx*i+a.xy*n,a.yx*i+a.yy*n,a.xx*r+a.xy*s+a.x,a.yx*r+a.yy*s+a.y)},transformTo:n,translate:function(t,e){return this.transform(1,0,0,1,t,e)},move:function(t,e){return this.x+=t||0,this.y+=e||0,this._transform(),this},scale:function(t,e){return null==e&&(e=t),this.transform(t,0,0,e,0,0)},rotate:function(t,e,i){(null==e||null==i)&&(e=(this.left||0)+(this.width||0)/2,i=(this.top||0)+(this.height||0)/2);var n=t*Math.PI/180,r=Math.sin(n),s=Math.cos(n);this.transform(1,0,0,1,e,i);var a=this;return this.transformTo(s*a.xx-r*a.yx,r*a.xx+s*a.yx,s*a.xy-r*a.yy,r*a.xy+s*a.yy,a.x,a.y).transform(1,0,0,1,-e,-i)},moveTo:function(t,e){var i=this;return this.transformTo(i.xx,i.yx,i.xy,i.yy,t,e)},rotateTo:function(t,e,i){var n=this,r=n.yx/n.xx>n.yy/n.xy?-1:1;return(n.xx<0?n.xy>=0:n.xy<0)&&(r=-r),this.rotate(t-180*Math.atan2(r*n.yx,r*n.xx)/Math.PI,e,i)},scaleTo:function(t,e){var i=this,n=Math.sqrt(i.xx*i.xx+i.yx*i.yx);return i.xx/=n,i.yx/=n,n=Math.sqrt(i.yy*i.yy+i.xy*i.xy),i.yy/=n,i.xy/=n,this.scale(t,e)},resizeTo:function(t,e){var i=this.width,n=this.height;return i&&n?this.scaleTo(t/i,e/n):this},inversePoint:function(t,e){var i=this.xx,n=this.yx,r=this.xy,s=this.yy,a=this.x,h=this.y,o=n*r-i*s;return 0==o?null:{x:(s*(a-t)+r*(e-h))/o,y:(i*(h-e)+n*(t-a))/o}},point:function(t,e){var i=this;return{x:i.xx*t+i.xy*e+i.x,y:i.yx*t+i.yy*e+i.y}}})},{"./class":2}],6:[function(t,e,i){var n=t("../core/class");e.exports=n({grab:function(){for(var t=0;tn;n++){var s,a=i[n];s="function"==typeof a?a.call(this,t):a.handleEvent(t),s===!1&&t.preventDefault()}}this.parentNode&&this.parentNode.dispatch&&this.parentNode.dispatch(t)},subscribe:function(t,e,i){if("string"!=typeof t){var n=[];for(var r in t)n.push(this.subscribe(r,t[r]));return function(){for(var t=0,e=n.length;e>t;t++)n[t]();return this}}var s="function"==typeof e?e.bind(i||this):e,a=this._events||(this._events={}),h=a[t]||(a[t]=[]);return h.push(s),function(){for(var t=0,e=h.length;e>t;t++)if(h[t]===s){h.splice(t,1);break}}}})},{"../core/class":2}],8:[function(t,e,i){function n(t){return t.toElement?t.toElement():t.getDOMNode?t.getDOMNode():t.getNode?t.getNode():t}var r=t("../core/class");e.exports=r({toElement:function(){return this.element},getDOMNode:function(){return this.toElement()},getNode:function(){return this.toElement()},inject:function(t){return(t.containerElement||n(t)).appendChild(this.element),this},injectBefore:function(t){var e=n(t);return e.parentNode.insertBefore(this.element,e),this},eject:function(){var t=this.element,e=t.parentNode;return e&&e.removeChild(t),this},subscribe:function(t,e,i){if("string"!=typeof t){var n=[];for(var r in t)n.push(this.subscribe(r,t[r]));return function(){for(var t=0,e=n.length;e>t;t++)n[t]();return this}}i||(i=this);var s;s="function"==typeof e?e.bind?e.bind(i):function(){return e.apply(i,arguments)}:e;var a=this.element;return a.addEventListener?(a.addEventListener(t,s,!1),function(){return a.removeEventListener(t,s,!1),this}):(a.attachEvent("on"+t,s),function(){return a.detachEvent("on"+t,s),this})}})},{"../core/class":2}],9:[function(t,e,i){var n=t("./modes/current");n.Rectangle=t("./shapes/rectangle"),n.Pill=t("./shapes/pill"),n.Ellipse=t("./shapes/ellipse"),n.Wedge=t("./shapes/wedge"),n.Font||(n.Font=t("./shapes/font")),n.Transform=t("./core/transform"),n.Color=t("./core/color"),e.exports=n},{"./core/color":3,"./core/transform":5,"./modes/current":19,"./shapes/ellipse":20,"./shapes/font":21,"./shapes/pill":23,"./shapes/rectangle":24,"./shapes/wedge":25}],10:[function(t,e,i){i.Surface=t("./canvas/surface"),i.Path=t("./canvas/path"),i.Shape=t("./canvas/shape"),i.Group=t("./canvas/group"),i.ClippingRectangle=t("./canvas/clippingrectangle"),i.Text=t("./canvas/text")},{"./canvas/clippingrectangle":12,"./canvas/group":13,"./canvas/path":15,"./canvas/shape":16,"./canvas/surface":17,"./canvas/text":18}],11:[function(t,e,i){function n(t,e,i){e=s.detach(e),i=s.detach(i);var n=document.createElement("canvas"),r=n.getContext("2d");return n.width=t.width,n.height=t.height,r.fillStyle=i[0],r.fillRect(0,0,t.width,t.height),r.globalCompositeOperation="lighter",r.drawImage(t,0,0),n}var r=t("../../core/class"),s=t("../../core/color"),a=t("../../core/transform"),h=t("./node"),o="undefined"!=typeof document&&document.createElement("canvas"),l=o&&o.getContext&&o.getContext("2d"),u=r(h,{initialize:function(){this._fill=null,this._pendingFill=null,this._fillTransform=null,this._stroke=null,this._strokeCap=null,this._strokeDash=null,this._strokeJoin=null,this._strokeWidth=null},_addColors:function(t,e){if("length"in e)for(var i=0,n=e.length-1;n>=i;i++)t.addColorStop(i/n,new s(e[i]).toString());else for(var r in e)t.addColorStop(r,new s(e[r]).toString());return t},fill:function(t){return arguments.length>1?this.fillLinear(arguments):(this._pendingFill&&this._pendingFill(),this._fill=t?new s(t).toString():null,this.invalidate())},fillRadial:function(t,e,i,n,r,h,o){if(null==e&&(e=(this.left||0)+.5*(this.width||0)),null==i&&(i=(this.top||0)+.5*(this.height||0)),null==r&&(r=n||.5*this.height||0),null==n&&(n=.5*(this.width||0)),null==h&&(h=e),null==o&&(o=i),h+=h-e,o+=o-i,0===n||"0"===n)return this.fillLinear(t);var u=r/n;this._pendingFill&&this._pendingFill();var c=l.createRadialGradient(e,i/u,0,h,o/u,2*n);if("length"in t)for(var f=0,p=t.length-1;p>=f;f++)c.addColorStop(f/p/2,new s(t[f]).toString()),c.addColorStop(1-f/p/2,new s(t[f]).toString());else for(var d in t)c.addColorStop(d/2,new s(t[d]).toString()),c.addColorStop(1-d/2,new s(t[d]).toString());return this._fill=c,this._fillTransform=new a(1,0,0,u),this.invalidate()},fillLinear:function(t,e,i,n,r){if(arguments.length<5){var s=(null==e?270:e)*Math.PI/180,h=Math.cos(s),o=-Math.sin(s),u=(Math.abs(h)+Math.abs(o))/2,c=this.width||1,f=this.height||1;h*=u,o*=u,e=.5-h,n=.5+h,i=.5-o,r=.5+o,this._fillTransform=new a(c,0,0,f)}else this._fillTransform=null;this._pendingFill&&this._pendingFill();var p=l.createLinearGradient(e,i,n,r);return this._addColors(p,t),this._fill=p,this.invalidate()},fillImage:function(t,e,i,n,r,s,a){this._pendingFill&&this._pendingFill();var h=t;if(h instanceof Image||(h=new Image,h.src=t),h.width&&h.height)return this._fillImage(h,e,i,n||0,r||0,s,a);this._fill=null;var o=this,l=function(){u(),o._fillImage(h,e,i,n||0,r||0,s,a)},u=function(){h.removeEventListener("load",l,!1),o._pendingFill=null};return this._pendingFill=u,h.addEventListener("load",l,!1),this},_fillImage:function(t,e,i,r,s,h,o){var u=e?e/t.width:1,c=i?i/t.height:1;return null!=h&&(t=n(t,h,o)),this._fill=l.createPattern(t,"repeat"),this._fillTransform=new a(u,0,0,c,r||0,s||0),this.invalidate()},stroke:function(t,e,i,n,r){return this._stroke=t?new s(t).toString():null,this._strokeWidth=null!=e?e:1,this._strokeCap=null!=i?i:"round",this._strokeJoin=null!=n?n:"round",this._strokeDash=r,this.invalidate()},element_renderTo:h.prototype.renderTo,renderTo:function(t,e,i,n,r,s,a){var h=this._opacity;if(null==h||h>=1)return this.renderLayerTo(t,e,i,n,r,s,a);if(this._fill&&this._stroke)return this.element_renderTo(t,e,i,n,r,s,a);t.globalAlpha=h;var o=this.renderLayerTo(t,e,i,n,r,s,a);return t.globalAlpha=1,o},renderLayerTo:function(t,e,i,n,r,s,a){t.setTransform(e,i,n,r,s,a),this.renderShapeTo(t)}});u._genericContext=l,e.exports=u},{"../../core/class":2,"../../core/color":3,"../../core/transform":5,"./node":14}],12:[function(t,e,i){var n=t("../../core/class"),r=t("../../dom/container"),s=t("./node");e.exports=n(s,r,{initialize:function(t,e){this.width=t,this.height=e},localHitTest:function(t,e){for(var i=this.lastChild;i;){var n=i.hitTest(t,e);if(n)return n;i=i.previousSibling}return null},renderLayerTo:function(t,e,i,n,r,s,a){t.setTransform(e,i,n,r,s,a),t.save(),t.beginPath(),t.rect(this.x,this.y,this.width,this.height),t.clip();for(var h=this.firstChild;h;)h.renderTo(t,e,i,n,r,s,a),h=h.nextSibling;t.restore()}})},{"../../core/class":2,"../../dom/container":6,"./node":14}],13:[function(t,e,i){var n=t("../../core/class"),r=t("../../dom/container"),s=t("./node");e.exports=n(s,r,{initialize:function(t,e){this.width=t,this.height=e},localHitTest:function(t,e){for(var i=this.lastChild;i;){var n=i.hitTest(t,e);if(n)return n;i=i.previousSibling}return null},renderLayerTo:function(t,e,i,n,r,s,a){if(!this._invisible){s=e*this.x+n*this.y+s,a=i*this.x+r*this.y+a;var h=e;e=h*this.xx+n*this.yx,n=h*this.xy+n*this.yy,h=i,i=h*this.xx+r*this.yx,r=h*this.xy+r*this.yy;for(var o=this.firstChild;o;)o.renderTo(t,e,i,n,r,s,a),o=o.nextSibling}}})},{"../../core/class":2,"../../dom/container":6,"./node":14}],14:[function(t,e,i){var n=t("../../core/class"),r=t("../../core/transform"),s=t("../../dom/dummy"),a=n(r,s,{invalidate:function(){return this.parentNode&&this.parentNode.invalidate(),this._layer&&(this._layerCache=null),this},_place:function(){this.invalidate()},_transform:function(){this.invalidate()},blend:function(t){return t>=1&&this._layer&&(this._layer=null),this._opacity=t,this.parentNode&&this.parentNode.invalidate(),this},hide:function(){return this._invisible=!0,this.parentNode&&this.parentNode.invalidate(),this},show:function(){return this._invisible=!1,this.parentNode&&this.parentNode.invalidate(),this},indicate:function(t,e){return this._cursor=t,this._tooltip=e,this.invalidate()},hitTest:function(t,e){if(this._invisible)return null;var i=this.inversePoint(t,e);return i?this.localHitTest(i.x,i.y):null},renderTo:function(t,e,i,n,r,s,a){var h=this._opacity;if(null==h||h>=1)return this.renderLayerTo(t,e,i,n,r,s,a);var o,l=this._layer,u=!0,c=t.canvas.width,f=t.canvas.height;if(l)if(l.setTransform(1,0,0,1,0,0),o=l.canvas,o.widths;s++)n[s](i);return i.isPointInPath(t,e)?this:null}return t>0&&e>0&&ts;s++)e[s](t);if(i){var h=this._fillTransform;h?(t.save(),t.transform(h.xx,h.yx,h.xy,h.yy,h.x,h.y),t.fillStyle=i,t.fill(),t.restore()):(t.fillStyle=i,t.fill())}n&&(t.strokeStyle=n,t.lineWidth=this._strokeWidth,t.lineCap=this._strokeCap,t.lineJoin=this._strokeJoin,t.stroke())}})},{"../../core/class":2,"./base":11,"./path":15}],17:[function(t,e,i){var n,r=t("../../core/class"),s=t("../../dom/container"),a=t("../../dom/native"),h=1e3/60,o=[],l=function(){clearTimeout(n),n=null;var t=o;o=[];for(var e=0,i=t.length;i>e;e++){var r=t[e];r._valid=!0,r.render()}},u="undefined"!=typeof window&&window.devicePixelRatio||1,c=null,f=null,p=r(a,s,{initialize:function(t,e,i){var n=this.element=i||document.createElement("canvas");this.context=n.getContext("2d");this._valid=!0,null!=t&&null!=e&&this.resize(t,e),n.addEventListener("mousemove",this,!1),n.addEventListener("mouseout",this,!1),n.addEventListener("mouseover",this,!1),n.addEventListener("mouseup",this,!1),n.addEventListener("mousedown",this,!1),n.addEventListener("click",this,!1)},handleEvent:function(t){if(null!=t.clientX){var e=this.element,i=e.getBoundingClientRect(),n=t.clientX-i.left-e.clientLeft,r=t.clientY-i.top-e.clientTop,s=this.hitTest(n,r);s!==c&&(c&&c.dispatch({type:"mouseout",target:c,relatedTarget:s,sourceEvent:t}),s&&s.dispatch({type:"mouseover",target:s,relatedTarget:c,sourceEvent:t}),c=s,f=this,this.refreshCursor()),s&&s.dispatch(t)}},refreshCursor:function(){if(f===this){for(var t=c,e="",i="";t&&(e||!t._cursor||(e=t._cursor,!i))&&(i||!t._tooltip||(i=t._tooltip,!e));)t=t.parentNode;this.element.style.cursor=e,this.element.title=i}},resize:function(t,e){var i=this.element;return i.setAttribute("width",t*u),i.setAttribute("height",e*u),i.style.width=t+"px",i.style.height=e+"px",this.width=t,this.height=e,this},invalidate:function(t,e,i,r){return this._valid&&(this._valid=!1,o.push(this),n||(window.mozRequestAnimationFrame?(n=!0,window.mozRequestAnimationFrame(l)):n=setTimeout(l,h))),this},hitTest:function(t,e){if(0>t||0>e||t>this.width||e>this.height)return null;for(var i=this.lastChild;i;){var n=i.hitTest(t,e);if(n)return n;i=i.previousSibling}return null},render:function(){var t=this.firstChild,e=this.context;for(e.setTransform(u,0,0,u,0,0),e.clearRect(0,0,this.width,this.height);t;)t.renderTo(e,u,0,0,u,0,0),t=t.nextSibling;this.refreshCursor()}});p.tagName="canvas",e.exports=p},{"../../core/class":2,"../../dom/container":6,"../../dom/native":8}],18:[function(t,e,i){var n=t("../../core/class"),r=t("./base"),s={middle:"center"};e.exports=n(r,{base_initialize:r.prototype.initialize,initialize:function(t,e,i,n){this.base_initialize(),this.draw.apply(this,arguments)},draw:function(t,e,i,n){var a;"string"==typeof e?a=Number(/(\d+)/.exec(e)[0]):e?(a=parseFloat(e.fontSize||e["font-size"]||"12"),e=(e.fontStyle||e["font-style"]||"")+" "+(e.fontVariant||e["font-variant"]||"")+" "+(e.fontWeight||e["font-weight"]||"")+" "+a+"px "+(e.fontFamily||e["font-family"]||"Arial")):e=this._font;var h=t&&t.split(/\r?\n/);this._font=e,this._fontSize=a,this._text=h,this._alignment=s[i]||i||"left";var o=r._genericContext;o.font=this._font,o.textAlign=this._alignment,o.textBaseline="middle",h=this._text;for(var l=h.length,u=0,c=0;l>c;c++){var f=o.measureText(h[c]).width;f>u&&(u=f)}return this.width=u,this.height=l?1.1*l*a:0,this.invalidate()},localHitTest:function(t,e){return this._fill&&t>0&&e>0&&tu;u++)t.fillText(o[u],0,a+u*h)}if(i)for(r?t.setLineDash?t.setLineDash(r):t.mozDash=r:t.setLineDash?t.setLineDash([]):t.mozDash=null,t.strokeStyle=i,t.lineWidth=this._strokeWidth,t.lineCap=this._strokeCap,t.lineJoin=this._strokeJoin,u=0;l>u;u++)t.strokeText(o[u],0,a+u*h)}})},{"../../core/class":2,"./base":11}],19:[function(t,e,i){function n(){throw new Error("You must require a mode before requiring anything else.")}i.Surface=n,i.Path=n,i.Shape=n,i.Group=n,i.ClippingRectangle=n,i.Text=n,i.setCurrent=function(t){for(var e in t)i[e]=t[e]}},{}],20:[function(t,e,i){var n=t("./generic");e.exports=n(function(t,e){this.width=t,this.height=e;var i=t/2,n=e/2;this.path.move(0,n).arc(t,0,i,n).arc(-t,0,i,n).close()})},{"./generic":22}],21:[function(t,e,i){var n=t("./generic"),r={},s=function(t){var e=/^\s*((?:(?:normal|bold|italic)\s+)*)(?:(\d+(?:\.\d+)?)[ptexm\%]*(?:\s*\/.*?)?\s+)?\s*\"?([^\"]*)/i,i=e.exec(t);return{fontFamily:i[3],fontSize:i[2],fontStyle:/italic/.exec(i[1])||"",fontWeight:/bold/.exec(i[1])||""}},a=n(function(t,e,i){"string"==typeof e&&(e=s(e)),e?this.font=e:e=this.font;var n=e.fontFamily||e["font-family"],a=e.fontWeight||e["font-weight"]||"normal",h=e.fontStyle||e["font-style"]||"normal",o=parseFloat(e.fontSize||e["font-size"]||e.size);if(e=e.glyphs?e:r[a+h+n],!e)throw new Error("The specified font has not been found.");for(var l=o/e.face["units-per-em"],u=0,c=o,f="",p="",d=0,v=l*e.face.ascent||o-l*e.face.descent,g=0,m=0,y=0,x=0,_=0,b=t.length;b>_;++_)if("\n"!=t.charAt(_)){var w=e.glyphs[t.charAt(_)]||e.glyphs.missing||e.glyphs[" "];if(w){var T=l*(w.w||e.w);if(w.d){var M=l;if(w.path)var C=w.path;else{for(var S,C=[],k=-1,z=("m"+w.d+"x").match(/[a-df-z]|[\-+]?(?:[\d\.]e[\-+]?|[^\s\-+,a-z])+/gi),X=0,L=z.length;L>X;X++){var D=z[X];D.match(/^[a-z]/i)?C[++k]=S=[D]:S.push(Number(D))}w.path=C}for(var X=0;Xu&&(u=d)}}else("end"==i||"right"==i)&&(g-=d,f+="m"+-d+",0"),("middle"==i||"center"==i)&&(g-=d/2,f+="m"+-d/2+",0"),f+=p,f+="m"+-g+","+-m,g=m=0,p="",d=0,v+=1.1*o,c+=1.1*o;("end"==i||"right"==i)&&(f+="m"+-d+",0"),("middle"==i||"center"==i)&&(f+="m"+-d/2+",0"),f+=p,this.path.push(f),this.width=u,this.height=c});a.register=function(t){var e=t.face,i=e["font-family"],n=e["font-weight"]>500?"bold":"normal",s="oblique"==e["font-stretch"]||"oblique"==e["font-style"]||"italic"==e["font-style"]?"italic":"normal";return r[n+s+i]=t,this},e.exports=a},{"./generic":22}],22:[function(t,e,i){var n=t("../core/class"),r=t("../modes/current");e.exports=function(t){return n(r.Shape,{shape_initialize:r.Shape.prototype.initialize,shape_draw:r.Shape.prototype.draw,initialize:function(t){this.shape_initialize(),this.path=new r.Path,null!=t&&this.draw.apply(this,arguments)},draw:function(){return this.path.reset(),this._draw_function.apply(this,arguments),this.shape_draw(this.path,this.width,this.height),this},_draw_function:t})}},{"../core/class":2,"../modes/current":19}],23:[function(t,e,i){var n=t("./generic");e.exports=n(function(t,e){this.width=t,this.height=e;var i=this.path;if(0>t&&(i.move(t,0),t=-t),0>e&&(i.move(0,e),e=-e),e>t){var n=t/2;i.move(0,n).arc(t,0,n).line(0,e-t).arc(-t,0,n).line(0,t-e)}else{var n=e/2;i.move(n,0).line(t-e,0).arc(0,e,n).line(e-t,0).arc(0,-e,n)}i.close()})},{"./generic":22}],24:[function(t,e,i){var n=t("./generic");e.exports=n(function(t,e,i){this.width=t,this.height=e;var n=this.path;if(i){"number"==typeof i&&(i=[i,i,i,i]);var r=i[0],s=i[1],a=i[2],h=i[3];0>r&&(r=0),0>s&&(s=0),0>h&&(h=0),0>a&&(a=0),n.move(0,r),0>t&&n.move(t,0),0>e&&n.move(0,e),r>0&&n.arc(r,-r),n.line(Math.abs(t)-(s+r),0),s>0&&n.arc(s,s),n.line(0,Math.abs(e)-(s+a)),a>0&&n.arc(-a,a),n.line(-Math.abs(t)+(a+h),0),h>0&&n.arc(-h,-h),n.line(0,-Math.abs(e)+(h+r))}else n.move(0,0).line(t,0).line(0,e).line(-t,0).line(0,-e);n.close()})},{"./generic":22}],25:[function(t,e,i){var n=t("./generic");e.exports=n(function(t,e,i,n){var r=2*Math.PI,s=Math.PI/180,a=i*s%r||0,h=n*s%r||0,o=Math.min(t||0,e||0),l=Math.max(t||0,e||0),u=a>h?r-a+h:h-a;this.width=this.height=2*l;var c=this.path;if(u>=r)c.move(0,l).arc(2*l,0,l).arc(2*-l,0,l),o&&c.move(l-o,0).counterArc(2*o,0,o).counterArc(2*-o,0,o);else{var f=Math.sin(a),p=Math.sin(h),d=Math.cos(a),v=Math.cos(h),g=p-f,m=v-d,y=o-l,x=u>Math.PI;c.move(l+l*f,l-l*d).arc(l*g,l*-m,l,l,x).line(y*p,y*-v), o&&c.counterArc(o*-g,o*m,o,o,x)}c.close()})},{"./generic":22}]},{},[1]);