(function(){var C=this,r=C._,g={},e=Array.prototype,m=Object.prototype,n=e.push,c=e.slice,p=e.concat,l=m.toString,D=m.hasOwnProperty,F=e.forEach,s=e.map,y=e.reduce,d=e.reduceRight,z=e.filter,q=e.every,w=e.some,x=e.indexOf,B=e.lastIndexOf,m=Array.isArray,H=Object.keys,G=Function.prototype.bind,a=function(f){if(f instanceof a)return f;if(!(this instanceof a))return new a(f);this._wrapped=f};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=a),exports._= a):C._=a;a.VERSION="1.5.1";var b=a.each=a.forEach=function(f,h,E){if(null!=f)if(F&&f.forEach===F)f.forEach(h,E);else if(f.length===+f.length)for(var b=0,d=f.length;bf.length)return Math.max.apply(Math,f);if(!h&&a.isEmpty(f))return-Infinity;var d={computed:-Infinity,value:-Infinity};b(f,function(a,f,b){f=h?h.call(E,a,f,b):a;f>d.computed&&(d={value:a,computed:f})});return d.value};a.min= function(f,h,E){if(!h&&a.isArray(f)&&f[0]===+f[0]&&65535>f.length)return Math.min.apply(Math,f);if(!h&&a.isEmpty(f))return Infinity;var d={computed:Infinity,value:Infinity};b(f,function(a,f,b){f=h?h.call(E,a,f,b):a;fb||void 0===h)return 1;if(h>>1;b.call(d,f[l])d?Math.max(0,c+d):d;else return k=a.sortedIndex(f,b),f[k]===b?k:-1;if(x&&f.indexOf===x)return f.indexOf(b,d);for(;k=arguments.length&&(b=a||0,a=0);d=arguments[2]||1;for(var k=Math.max(Math.ceil((b-a)/d),0),c=0,v=Array(k);c=I?(clearTimeout(l),l=null,e=t,v=a.apply(k,c)):l||!1===d.trailing||(l=setTimeout(u,I));return v}};a.debounce=function(a,b,d){var k,c=null;return function(){var v=this,l=arguments,e=d&&!c;clearTimeout(c);c=setTimeout(function(){c=null;d||(k=a.apply(v,l))},b);e&&(k=a.apply(v,l));return k}};a.once=function(a){var b=!1,d;return function(){if(b)return d;b=!0;d=a.apply(this,arguments);a=null;return d}};a.wrap=function(a,b){return function(){var d= [a];n.apply(d,arguments);return b.apply(this,d)}};a.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;0<=d;d--)b=[a[d].apply(this,b)];return b[0]}};a.after=function(a,b){return function(){if(1>--a)return b.apply(this,arguments)}};a.keys=H||function(f){if(f!==Object(f))throw new TypeError("Invalid object");var b=[],d;for(d in f)a.has(f,d)&&b.push(d);return b};a.values=function(f){var b=[],d;for(d in f)a.has(f,d)&&b.push(f[d]);return b};a.pairs=function(f){var b= [],d;for(d in f)a.has(f,d)&&b.push([d,f[d]]);return b};a.invert=function(f){var b={},d;for(d in f)a.has(f,d)&&(b[f[d]]=d);return b};a.functions=a.methods=function(f){var b=[],d;for(d in f)a.isFunction(f[d])&&b.push(d);return b.sort()};a.extend=function(a){b(c.call(arguments,1),function(b){if(b)for(var d in b)a[d]=b[d]});return a};a.pick=function(a){var d={},k=p.apply(e,c.call(arguments,1));b(k,function(b){b in a&&(d[b]=a[b])});return d};a.omit=function(f){var b={},d=p.apply(e,c.call(arguments,1)), k;for(k in f)a.contains(d,k)||(b[k]=f[k]);return b};a.defaults=function(a){b(c.call(arguments,1),function(b){if(b)for(var d in b)void 0===a[d]&&(a[d]=b[d])});return a};a.clone=function(f){return a.isObject(f)?a.isArray(f)?f.slice():a.extend({},f):f};a.tap=function(a,b){b(a);return a};var L=function(b,d,k,c){if(b===d)return 0!==b||1/b==1/d;if(null==b||null==d)return b===d;b instanceof a&&(b=b._wrapped);d instanceof a&&(d=d._wrapped);var v=l.call(b);if(v!=l.call(d))return!1;switch(v){case "[object String]":return b== String(d);case "[object Number]":return b!=+b?d!=+d:0==b?1/b==1/d:b==+d;case "[object Date]":case "[object Boolean]":return+b==+d;case "[object RegExp]":return b.source==d.source&&b.global==d.global&&b.multiline==d.multiline&&b.ignoreCase==d.ignoreCase}if("object"!=typeof b||"object"!=typeof d)return!1;for(var e=k.length;e--;)if(k[e]==b)return c[e]==d;var e=b.constructor,u=d.constructor;if(e!==u&&!(a.isFunction(e)&&e instanceof e&&a.isFunction(u)&&u instanceof u))return!1;k.push(b);c.push(d);e=0; u=!0;if("[object Array]"==v){if(e=b.length,u=e==d.length)for(;e--&&(u=L(b[e],d[e],k,c)););}else{for(var t in b)if(a.has(b,t)&&(e++,!(u=a.has(d,t)&&L(b[t],d[t],k,c))))break;if(u){for(t in d)if(a.has(d,t)&&!e--)break;u=!e}}k.pop();c.pop();return u};a.isEqual=function(a,b){return L(a,b,[],[])};a.isEmpty=function(b){if(null==b)return!0;if(a.isArray(b)||a.isString(b))return 0===b.length;for(var d in b)if(a.has(b,d))return!1;return!0};a.isElement=function(a){return!(!a||1!==a.nodeType)};a.isArray=m||function(a){return"[object Array]"== l.call(a)};a.isObject=function(a){return a===Object(a)};b("Arguments Function String Number Date RegExp".split(" "),function(b){a["is"+b]=function(a){return l.call(a)=="[object "+b+"]"}});a.isArguments(arguments)||(a.isArguments=function(b){return!(!b||!a.has(b,"callee"))});"function"!==typeof/./&&(a.isFunction=function(a){return"function"===typeof a});a.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))};a.isNaN=function(b){return a.isNumber(b)&&b!=+b};a.isBoolean=function(a){return!0=== a||!1===a||"[object Boolean]"==l.call(a)};a.isNull=function(a){return null===a};a.isUndefined=function(a){return void 0===a};a.has=function(a,b){return D.call(a,b)};a.noConflict=function(){C._=r;return this};a.identity=function(a){return a};a.times=function(a,b,d){for(var k=Array(Math.max(0,a)),c=0;c":">",'"':""","'":"'","/":"/"}}; J.unescape=a.invert(J.escape);var O={escape:RegExp("["+a.keys(J.escape).join("")+"]","g"),unescape:RegExp("("+a.keys(J.unescape).join("|")+")","g")};a.each(["escape","unescape"],function(b){a[b]=function(a){return null==a?"":(""+a).replace(O[b],function(a){return J[b][a]})}});a.result=function(b,d){if(null!=b){var k=b[d];return a.isFunction(k)?k.call(b):k}};a.mixin=function(d){b(a.functions(d),function(b){var k=a[b]=d[b];a.prototype[b]=function(){var b=[this._wrapped];n.apply(b,arguments);b=k.apply(a, b);return this._chain?a(b).chain():b}})};var M=0;a.uniqueId=function(a){var b=++M+"";return a?a+b:b};a.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/(.)^/,I={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},T=/\\|'|\r|\n|\t|\u2028|\u2029/g;a.template=function(b,d,k){var c;k=a.defaults({},k,a.templateSettings);var v=RegExp([(k.escape||t).source,(k.interpolate||t).source,(k.evaluate||t).source].join("|")+ "|$","g"),l=0,e="__p+='";b.replace(v,function(a,d,k,c,v){e+=b.slice(l,v).replace(T,function(a){return"\\"+I[a]});d&&(e+="'+\n((__t=("+d+"))==null?'':_.escape(__t))+\n'");k&&(e+="'+\n((__t=("+k+"))==null?'':__t)+\n'");c&&(e+="';\n"+c+"\n__p+='");l=v+a.length;return a});e+="';\n";k.variable||(e="with(obj||{}){\n"+e+"}\n");e="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+e+"return __p;\n";try{c=new Function(k.variable||"obj","_",e)}catch(u){throw u.source= e,u;}if(d)return c(d,a);d=function(b){return c.call(this,b,a)};d.source="function("+(k.variable||"obj")+"){\n"+e+"}";return d};a.chain=function(b){return a(b).chain()};a.mixin(a);b("pop push reverse shift sort splice unshift".split(" "),function(b){var d=e[b];a.prototype[b]=function(){var k=this._wrapped;d.apply(k,arguments);"shift"!=b&&"splice"!=b||0!==k.length||delete k[0];return this._chain?a(k).chain():k}});b(["concat","join","slice"],function(b){var d=e[b];a.prototype[b]=function(){var b=d.apply(this._wrapped, arguments);return this._chain?a(b).chain():b}});a.extend(a.prototype,{chain:function(){this._chain=!0;return this},value:function(){return this._wrapped}})}).call(this);var Backbone=Backbone||{}; (function(){var C=[].slice,r=function(e,m,g){var c;e=-1;var p=m.length;switch(g.length){case 0:for(;++e=p?l=!0:(t=b.x,m=b.y,m=new d.Anchor(t,m,void 0,void 0,void 0,void 0,d.Commands.close));break;case "m":case "l":t=parseFloat(c[0]);m=parseFloat(c[1]);m=new d.Anchor(t,m,void 0,void 0,void 0,void 0,"m"===q?d.Commands.move:d.Commands.line); e&&m.addSelf(b);b=m;break;case "h":case "v":t="h"===q?"x":"y";I="x"===t?"y":"x";m=new d.Anchor(void 0,void 0,void 0,void 0,void 0,void 0,d.Commands.line);m[t]=parseFloat(c[0]);m[I]=b[I];e&&(m[t]+=b[t]);b=m;break;case "s":case "c":m=b.x;I=b.y;k||(k=(new d.Vector).copy(b));"c"===q?(f=parseFloat(c[0]),t=parseFloat(c[1]),q=parseFloat(c[2]),h=parseFloat(c[3]),w=parseFloat(c[4]),n=parseFloat(c[5])):(h=d.Utils.getReflection(b,k,e),f=h.x,t=h.y,q=parseFloat(c[0]),h=parseFloat(c[1]),w=parseFloat(c[2]),n=parseFloat(c[3])); e&&(f+=m,t+=I,q+=m,h+=I,w+=m,n+=I);_.isObject(b.controls)||d.Anchor.AppendCurveProperties(b);b.controls.right.set(f-b.x,t-b.y);b=m=new d.Anchor(w,n,q-w,h-n,void 0,void 0,d.Commands.curve);k=m.controls.left;break;case "t":case "q":m=b.x;I=b.y;k||(k=(new d.Vector).copy(b));k.isZero()?(f=m,t=I):(f=k.x,I=k.y);"q"===q?(q=parseFloat(c[0]),h=parseFloat(c[1]),w=parseFloat(c[1]),n=parseFloat(c[2])):(h=d.Utils.getReflection(b,k,e),q=h.x,h=h.y,w=parseFloat(c[0]),n=parseFloat(c[1]));e&&(f+=m,t+=I,q+=m,h+=I,w+= m,n+=I);_.isObject(b.controls)||d.Anchor.AppendCurveProperties(b);b.controls.right.set(f-b.x,t-b.y);b=m=new d.Anchor(w,n,q-w,h-n,void 0,void 0,d.Commands.curve);k=m.controls.left;break;case "a":throw new d.Utils.Error("not yet able to interpret Elliptical Arcs.");}return m}));if(!(1>=g.length))return g=_.compact(g),g=(new d.Polygon(g,l,void 0,!0)).noStroke(),g.fill="black",d.Utils.applySvgAttributes(a,g)},circle:function(a){var b=parseFloat(a.getAttribute("cx")),c=parseFloat(a.getAttribute("cy")), v=parseFloat(a.getAttribute("r")),g=d.Resolution,u=_.map(_.range(g),function(a){var b=a/g*l;a=v*m(b);b=v*e(b);return new d.Anchor(a,b)},this),u=(new d.Polygon(u,!0,!0)).noStroke();u.translation.set(b,c);u.fill="black";return d.Utils.applySvgAttributes(a,u)},ellipse:function(a){var b=parseFloat(a.getAttribute("cx")),c=parseFloat(a.getAttribute("cy")),v=parseFloat(a.getAttribute("rx")),g=parseFloat(a.getAttribute("ry")),u=d.Resolution,p=_.map(_.range(u),function(a){var b=a/u*l;a=v*m(b);b=g*e(b);return new d.Anchor(a, b)},this),p=(new d.Polygon(p,!0,!0)).noStroke();p.translation.set(b,c);p.fill="black";return d.Utils.applySvgAttributes(a,p)},rect:function(a){var b=parseFloat(a.getAttribute("x")),c=parseFloat(a.getAttribute("y")),e=parseFloat(a.getAttribute("width")),l=parseFloat(a.getAttribute("height")),e=e/2,l=l/2,g=[new d.Anchor(e,l),new d.Anchor(-e,l),new d.Anchor(-e,-l),new d.Anchor(e,-l)],g=(new d.Polygon(g,!0)).noStroke();g.translation.set(b+e,c+l);g.fill="black";return d.Utils.applySvgAttributes(a,g)}, line:function(a){var b=parseFloat(a.getAttribute("x1")),c=parseFloat(a.getAttribute("y1")),e=parseFloat(a.getAttribute("x2")),l=parseFloat(a.getAttribute("y2")),e=(e-b)/2,l=(l-c)/2,g=[new d.Anchor(-e,-l),new d.Anchor(e,l)],g=(new d.Polygon(g)).noFill();g.translation.set(b+e,c+l);return d.Utils.applySvgAttributes(a,g)}},subdivide:function(a,b,c,e,l,g,m,p,q){q=q||d.Utils.Curve.RecursionLimit;var w=q+1;return _.map(_.range(0,w),function(q){var t=q/w;q=G(t,a,c,l,m);t=G(t,b,e,g,p);return new d.Anchor(q, t)})},getPointOnCubicBezier:function(a,b,d,c,e){var l=1-a;return l*l*l*b+3*l*l*a*d+3*l*a*a*c+a*a*a*e},getCurveFromPoints:function(a,b){for(var c=a.length,e=c-1,l=0;la||1E-4>c)return b._relative||(b.controls.left.copy(b),b.controls.right.copy(b)),b;a*=0.33;c*=0.33;q=ga;)a+=b;return a%b},Collection:function(){Array.call(this);1this.distanceTo(c)},lerp:function(c,e){C=(c.x-this.x)*e+this.x;r=(c.y-this.y)*e+this.y;return this.set(C,r)},isZero:function(){return 1E-4>this.length()},toString:function(){return this.x+","+this.y},toObject:function(){return{x:this.x,y:this.y}}});var n={set:function(c, e){this._x=c;this._y=e;return this.trigger(Two.Events.change)},copy:function(c){this._x=c.x;this._y=c.y;return this.trigger(Two.Events.change)},clear:function(){this._y=this._x=0;return this.trigger(Two.Events.change)},clone:function(){return new m(this._x,this._y)},add:function(c,e){this._x=c.x+e.x;this._y=c.y+e.y;return this.trigger(Two.Events.change)},addSelf:function(c){this._x+=c.x;this._y+=c.y;return this.trigger(Two.Events.change)},sub:function(c,e){this._x=c.x-e.x;this._y=c.y-e.y;return this.trigger(Two.Events.change)}, subSelf:function(c){this._x-=c.x;this._y-=c.y;return this.trigger(Two.Events.change)},multiplySelf:function(c){this._x*=c.x;this._y*=c.y;return this.trigger(Two.Events.change)},multiplyScalar:function(c){this._x*=c;this._y*=c;return this.trigger(Two.Events.change)},divideScalar:function(c){return c?(this._x/=c,this._y/=c,this.trigger(Two.Events.change)):this.clear()},negate:function(){return this.multiplyScalar(-1)},dot:function(c){return this._x*c.x+this._y*c.y},lengthSquared:function(){return this._x* this._x+this._y*this._y},length:function(){return Math.sqrt(this.lengthSquared())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(c){return Math.sqrt(this.distanceToSquared(c))},distanceToSquared:function(c){g=this._x-c.x;e=this._y-c.y;return g*g+e*e},setLength:function(c){return this.normalize().multiplyScalar(c)},equals:function(c){return 1E-4>this.distanceTo(c)},lerp:function(c,e){C=(c.x-this._x)*e+this._x;r=(c.y-this._y)*e+this._y;return this.set(C,r)},isZero:function(){return 1E-4> this.length()},toString:function(){return this._x+","+this._y},toObject:function(){return{x:this._x,y:this._y}}},c={get:function(){return this._x},set:function(c){this._x=c;this.trigger(Two.Events.change,"x")}},p={get:function(){return this._y},set:function(c){this._y=c;this.trigger(Two.Events.change,"y")}};Two.Vector.prototype.bind=Two.Vector.prototype.on=function(){this._bound||(this._x=this.x,this._y=this.y,Object.defineProperty(this,"x",c),Object.defineProperty(this,"y",p),_.extend(this,n),this._bound= !0);Backbone.Events.bind.apply(this,arguments);return this}})();(function(){var C=Two.Commands,r,g,e,m=Two.Anchor=function(c,e,g,n,r,s,y){Two.Vector.call(this,c,e);this._broadcast=_.bind(function(){this.trigger(Two.Events.change)},this);this._command=y||C.move;this._relative=!0;if(!y)return this;m.AppendCurveProperties(this);_.isNumber(g)&&(this.controls.left.x=g);_.isNumber(n)&&(this.controls.left.y=n);_.isNumber(r)&&(this.controls.right.x=r);_.isNumber(s)&&(this.controls.right.y=s)};_.extend(m,{AppendCurveProperties:function(c){c.controls={left:new Two.Vector(0, 0),right:new Two.Vector(0,0)}}});var n={listen:function(){_.isObject(this.controls)||m.AppendCurveProperties(this);_.each(this.controls,function(c){c.bind(Two.Events.change,this._broadcast)},this);return this},ignore:function(){_.each(this.controls,function(c){c.unbind(Two.Events.change,this._broadcast)},this);return this},clone:function(){g=this.controls;e=new Two.Anchor(this.x,this.y,g&&g.left.x,g&&g.left.y,g&&g.right.x,g&&g.right.y,this.command);e.relative=this._relative;return e},toObject:function(){r= {x:this.x,y:this.y};this._command&&(r.command=this._command);this._relative&&(r.relative=this._relative);this.controls&&(r.controls={left:this.controls.left.toObject(),right:this.controls.right.toObject()});return r}};Object.defineProperty(m.prototype,"command",{get:function(){return this._command},set:function(c){this._command=c;this._command!==C.curve||_.isObject(this.controls)||m.AppendCurveProperties(this);return this.trigger(Two.Events.change)}});Object.defineProperty(m.prototype,"relative", {get:function(){return this._relative},set:function(c){if(this._relative==c)return this;this._relative=!!c;return this.trigger(Two.Events.change)}});_.extend(m.prototype,Two.Vector.prototype,n);Two.Anchor.prototype.bind=Two.Anchor.prototype.on=function(){Two.Vector.prototype.bind.apply(this,arguments);_.extend(this,n)};Two.Anchor.prototype.unbind=Two.Anchor.prototype.off=function(){Two.Vector.prototype.unbind.apply(this,arguments);_.extend(this,n)}})();(function(){_.range(6);var C=Math.cos,r=Math.sin,g=Math.tan,e,m,n,c,p,l,D,F,s,y,d,z,q,w,x,B,H,G,a,b,k,v,K,u,A,L,J,O,M,t,I,T,f,h,E,ea,P,Q,aa,da,U,V,W,X,Y,ba,ca,Z,R,$=[],fa=Two.Matrix=function(a,b,d,c,f,e){this.elements=new Two.Array(9);var g=a;_.isArray(g)||(g=_.toArray(arguments));this.identity().set(g)};_.extend(fa,{Identity:[1,0,0,0,1,0,0,0,1],Multiply:function(d,c,f){if(3>=c.length)return z,q,w,e=c[0]||0,m=c[1]||0,n=c[2]||0,p=d,z=p[0]*e+p[1]*m+p[2]*n,q=p[3]*e+p[4]*m+p[5]*n,w=p[6]*e+p[7]*m+p[8]* n,{x:z,y:q,z:w};x=d[0];B=d[1];H=d[2];G=d[3];a=d[4];b=d[5];k=d[6];v=d[7];K=d[8];u=c[0];A=c[1];L=c[2];J=c[3];O=c[4];M=c[5];t=c[6];I=c[7];T=c[8];f=f||new Two.Array(9);f[0]=x*u+B*J+H*t;f[1]=x*A+B*O+H*I;f[2]=x*L+B*M+H*T;f[3]=G*u+a*J+b*t;f[4]=G*A+a*O+b*I;f[5]=G*L+a*M+b*T;f[6]=k*u+v*J+K*t;f[7]=k*A+v*O+K*I;f[8]=k*L+v*M+K*T;return f}});_.extend(fa.prototype,Backbone.Events,{set:function(a,b,c,f,e,g){d=a;E=arguments.length;_.isArray(d)||(d=_.toArray(arguments));_.each(d,function(a,b){_.isNumber(a)&&(this.elements[b]= a)},this);return this.trigger(Two.Events.change)},identity:function(){this.set(fa.Identity);return this},multiply:function(c,e,g,m,l,p,n,s,ma){d=arguments;E=d.length;if(1>=E)return _.each(this.elements,function(a,b){this.elements[b]=a*c},this),this.trigger(Two.Events.change);if(3>=E)return z,q,w,c=c||0,e=e||0,g=g||0,l=this.elements,z=l[0]*c+l[1]*e+l[2]*g,q=l[3]*c+l[4]*e+l[5]*g,w=l[6]*c+l[7]*e+l[8]*g,{x:z,y:q,z:w};f=this.elements;h=d;x=f[0];B=f[1];H=f[2];G=f[3];a=f[4];b=f[5];k=f[6];v=f[7];K=f[8];u= h[0];A=h[1];L=h[2];J=h[3];O=h[4];M=h[5];t=h[6];I=h[7];T=h[8];this.elements[0]=x*u+B*J+H*t;this.elements[1]=x*A+B*O+H*I;this.elements[2]=x*L+B*M+H*T;this.elements[3]=G*u+a*J+b*t;this.elements[4]=G*A+a*O+b*I;this.elements[5]=G*L+a*M+b*T;this.elements[6]=k*u+v*J+K*t;this.elements[7]=k*A+v*O+K*I;this.elements[8]=k*L+v*M+K*T;return this.trigger(Two.Events.change)},inverse:function(a){e=this.elements;a=a||new Two.Matrix;P=e[0];Q=e[1];aa=e[2];da=e[3];U=e[4];V=e[5];W=e[6];X=e[7];Y=e[8];ba=Y*U-V*X;ca=-Y*da+ V*W;Z=X*da-U*W;R=P*ba+Q*ca+aa*Z;if(!R)return null;R=1/R;a.elements[0]=ba*R;a.elements[1]=(-Y*Q+aa*X)*R;a.elements[2]=(V*Q-aa*U)*R;a.elements[3]=ca*R;a.elements[4]=(Y*P-aa*W)*R;a.elements[5]=(-V*P+aa*da)*R;a.elements[6]=Z*R;a.elements[7]=(-X*P+Q*W)*R;a.elements[8]=(U*P-Q*da)*R;return a},scale:function(a,b){E=arguments.length;1>=E&&(b=a);return this.multiply(a,0,0,0,b,0,0,0,1)},rotate:function(a){n=C(a);ea=r(a);return this.multiply(n,-ea,0,ea,n,0,0,0,1)},translate:function(a,b){return this.multiply(1, 0,a,0,1,b,0,0,1)},skewX:function(a){e=g(a);return this.multiply(1,e,0,0,1,0,0,0,1)},skewY:function(a){e=g(a);return this.multiply(1,0,0,e,1,0,0,0,1)},toString:function(a){this.toArray(a,$);return $.join(" ")},toArray:function(a,b){d=this.elements;y=!!b;e=parseFloat(d[0].toFixed(3));m=parseFloat(d[1].toFixed(3));n=parseFloat(d[2].toFixed(3));c=parseFloat(d[3].toFixed(3));p=parseFloat(d[4].toFixed(3));l=parseFloat(d[5].toFixed(3));if(a){D=parseFloat(d[6].toFixed(3));F=parseFloat(d[7].toFixed(3));s= parseFloat(d[8].toFixed(3));if(y){b[0]=e;b[1]=c;b[2]=D;b[3]=m;b[4]=p;b[5]=F;b[6]=n;b[7]=l;b[8]=s;return}return[e,c,D,m,p,F,n,l,s]}if(y)b[0]=e,b[1]=c,b[2]=m,b[3]=p,b[4]=n,b[5]=l;else return[e,c,m,p,n,l]},clone:function(){e=this.elements[0];m=this.elements[1];n=this.elements[2];c=this.elements[3];p=this.elements[4];l=this.elements[5];D=this.elements[6];F=this.elements[7];s=this.elements[8];return new Two.Matrix(e,m,n,c,p,l,D,F,s)}})})();(function(){var C=Two.Utils.mod,r,g,e,m={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",createElement:function(c,p){e=c;g=document.createElementNS(this.ns,e);"svg"===e&&(p=_.defaults(p||{},{version:this.version}));_.isObject(p)&&m.setAttributes(g,p);return g},setAttribute:function(c,e){this.setAttribute(e,c)},setAttributes:function(c,e){_.each(e,m.setAttribute,c);return this},removeAttribute:function(c,e){this.removeAttribute(e)},removeAttributes:function(c,e){_.each(e, m.removeAttribute,c);return this},toString:function(c,e){var g=c.length,m=g-1,n;return _.map(c,function(s,r){var d,z=e?C(r-1,g):Math.max(r-1,0),q=e?C(r+1,g):Math.min(r+1,m);d=c[z];var w=c[q],x,B,H,z=s.x.toFixed(3),w=s.y.toFixed(3);switch(s._command){case Two.Commands.close:d=Two.Commands.close;break;case Two.Commands.curve:x=d.controls&&d.controls.right||d;H=s.controls&&s.controls.left||s;d._relative?(q=(x.x+d.x).toFixed(3),x=(x.y+d.y).toFixed(3)):(q=x.x.toFixed(3),x=x.y.toFixed(3));s._relative?(B= (H.x+s.x).toFixed(3),H=(H.y+s.y).toFixed(3)):(B=H.x.toFixed(3),H=H.y.toFixed(3));d=(0===r?Two.Commands.move:Two.Commands.curve)+" "+q+" "+x+" "+B+" "+H+" "+z+" "+w;break;case Two.Commands.move:n=s;d=Two.Commands.move+" "+z+" "+w;break;default:d=s._command+" "+z+" "+w}r>=m&&e&&(s._command===Two.Commands.curve&&(w=n,x=s.controls&&s.controls.right||s,z=w.controls&&w.controls.left||w,s._relative?(q=(x.x+s.x).toFixed(3),x=(x.y+s.y).toFixed(3)):(q=x.x.toFixed(3),x=x.y.toFixed(3)),w._relative?(B=(z.x+w.x).toFixed(3), H=(z.y+w.y).toFixed(3)):(B=z.x.toFixed(3),H=z.y.toFixed(3)),z=w.x.toFixed(3),w=w.y.toFixed(3),d+=" C "+q+" "+x+" "+B+" "+H+" "+z+" "+w),d+=" Z");return d}).join(" ")},group:{appendChild:function(c){(g=this.domElement.querySelector("#"+Two.Identifier+c))&&this.elem.appendChild(g)},removeChild:function(c){(g=this.domElement.querySelector("#"+Two.Identifier+c))&&this.elem.removeChild(g)},renderChild:function(c){m[c._renderer.type].render.call(c,this)},render:function(c){this._update();this._renderer.elem|| (this._renderer.elem=m.createElement("g",{id:Two.Identifier+this.id}),c.appendChild(this._renderer.elem));r=this._matrix.manual||this._flagMatrix;var e={domElement:c,elem:this._renderer.elem};r&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");_.each(this.children,m.group.renderChild,c);this._flagAdditions&&_.each(this.additions,m.group.appendChild,e);this._flagSubtractions&&_.each(this.subtractions,m.group.removeChild,e);return this.flagReset()}},polygon:{render:function(c){this._update(); this._renderer.elem||(this._renderer.elem=m.createElement("path",{id:Two.Identifier+this.id}),c.appendChild(this._renderer.elem));g=this._renderer.elem;(r=this._matrix.manual||this._flagMatrix)&&g.setAttribute("transform","matrix("+this._matrix.toString()+")");this._flagVertices&&(vertices=m.toString(this._vertices,this._closed),g.setAttribute("d",vertices));this._flagFill&&g.setAttribute("fill",this._fill);this._flagStroke&&g.setAttribute("stroke",this._stroke);this._flagLinewidth&&g.setAttribute("stroke-width", this._linewidth);this._flagOpacity&&(g.setAttribute("stroke-opacity",this._opacity),g.setAttribute("fill-opacity",this._opacity));this._flagVisible&&g.setAttribute("visibility",this._visible?"visible":"hidden");this._flagCap&&g.setAttribute("stroke-linecap",this._cap);this._flagJoin&&g.setAttribute("stroke-linejoin",this._join);this._flagMiter&&g.setAttribute("stroke-miterlimit",this.miter);return this.flagReset()}}},n=Two[Two.Types.svg]=function(c){this.domElement=c.domElement||m.createElement("svg"); this.scene=new Two.Group;this.scene.parent=this};_.extend(n,{Utils:m});_.extend(n.prototype,Backbone.Events,{setSize:function(c,e){this.width=c;this.height=e;m.setAttributes(this.domElement,{width:c,height:e});return this},render:function(){m.group.render.call(this.scene,this.domElement);return this}})})();(function(){var C=Two.Utils.mod,r=Two.Utils.getRatio,g,e,m,n,c,p,l,D,F,s,y,d,z,q,w,x,B,H,G,a,b,k,v,K,u,A,L,J,O={group:{renderChild:function(a){O[a._renderer.type].render.call(a,this)},render:function(a){this._update();g=this._matrix.elements;a.save();a.transform(g[0],g[3],g[1],g[4],g[2],g[5]);_.each(this.children,O.group.renderChild,a);a.restore();return this.flagReset()}},polygon:{render:function(t){this._update();g=this._matrix.elements;e=this.stroke;m=this.linewidth;n=this.fill;c=this.opacity; p=this.visible;l=this.cap;D=this.join;F=this.miter;s=this.closed;y=this._vertices;d=y.length;z=d-1;if(!p)return this;t.save();g&&t.transform(g[0],g[3],g[1],g[4],g[2],g[5]);n&&(t.fillStyle=n);e&&(t.strokeStyle=e);m&&(t.lineWidth=m);F&&(t.miterLimit=F);D&&(t.lineJoin=D);l&&(t.lineCap=l);_.isNumber(c)&&(t.globalAlpha=c);t.beginPath();_.each(y,function(c,e){L=c.x.toFixed(3);J=c.y.toFixed(3);switch(c._command){case Two.Commands.close:t.closePath();break;case Two.Commands.curve:w=s?C(e-1,d):Math.max(e- 1,0);q=s?C(e+1,d):Math.min(e+1,z);x=y[w];B=y[q];v=x.controls&&x.controls.right||x;K=c.controls&&c.controls.left||c;x._relative?(b=(v.x+x.x).toFixed(3),k=(v.y+x.y).toFixed(3)):(b=v.x.toFixed(3),k=v.y.toFixed(3));c._relative?(G=(K.x+c.x).toFixed(3),a=(K.y+c.y).toFixed(3)):(G=K.x.toFixed(3),a=K.y.toFixed(3));t.bezierCurveTo(b,k,G,a,L,J);e>=z&&s&&(B=H,u=c.controls&&c.controls.right||c,A=B.controls&&B.controls.left||B,c._relative?(b=(u.x+c.x).toFixed(3),k=(u.y+c.y).toFixed(3)):(b=u.x.toFixed(3),k=u.y.toFixed(3)), B._relative?(G=(A.x+B.x).toFixed(3),a=(A.y+B.y).toFixed(3)):(G=A.x.toFixed(3),a=A.y.toFixed(3)),L=B.x.toFixed(3),J=B.y.toFixed(3),t.bezierCurveTo(b,k,G,a,L,J));break;case Two.Commands.line:t.lineTo(L,J);break;case Two.Commands.move:H=c,t.moveTo(L,J)}});s&&t.closePath();t.fill();t.stroke();t.restore();return this.flagReset()}}},M=Two[Two.Types.canvas]=function(a){this.domElement=a.domElement||document.createElement("canvas");this.ctx=this.domElement.getContext("2d");this.overdraw=a.overdraw||!1;this.scene= new Two.Group;this.scene.parent=this};_.extend(M,{Utils:O});_.extend(M.prototype,Backbone.Events,{setSize:function(a,b,c){this.width=a;this.height=b;this.ratio=_.isUndefined(c)?r(this.ctx):c;this.domElement.width=a*this.ratio;this.domElement.height=b*this.ratio;_.extend(this.domElement.style,{width:a+"px",height:b+"px"});return this},render:function(){var a=1===this.ratio;a||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio));this.overdraw||this.ctx.clearRect(0,0,this.width,this.height);O.group.render.call(this.scene, this.ctx);a||this.ctx.restore();return this}})})();(function(){var C=Two.Matrix.Multiply,r=Two.Utils.mod,g=[1,0,0,0,1,0,0,0,1],e=new Two.Array(9),m=Two.Utils.getRatio,n,c,p,l,D,F,s,y,d,z,q,w,x,B,H,G,a,b,k,v,K,u,A,L,J,O,M,t,I,T,f,h,E,ea,P,Q,aa,da,U,V,W,X,Y,ba,ca,Z,R,$,fa,ga,N,ia,ja,ka,ha,S={canvas:document.createElement("canvas"),uv:new Two.Array([0,0,1,0,0,1,0,1,1,0,1,1]),group:{renderChild:function(a){S[a._renderer.type].render.call(a,this.gl,this.program)},render:function(a,b){this._update();n=this.parent;c=n._matrix&&n._matrix.manual||n._flagMatrix; p=this._matrix.manual||this._flagMatrix;if(c||p)this._renderer.matrix||(this._renderer.matrix=new Two.Array(9)),this._matrix.toArray(!0,e),C(e,n._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*n._renderer.scale,c&&(this._flagMatrix=!0);_.each(this.children,S.group.renderChild,{gl:a,program:b});return this.flagReset()}},polygon:{render:function(a,b){if(!this._visible||!this._opacity)return this;n=this.parent;c=n._matrix.manual||n._flagMatrix;p=this._matrix.manual||this._flagMatrix; l=this._flagVertices||this._flagFill||this._flagStroke||this._flagLinewidth||this._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale;this._update();if(c||p)this._renderer.matrix||(this._renderer.matrix=new Two.Array(9)),this._matrix.toArray(!0,e),C(e,n._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*n._renderer.scale;l&&(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new Two.Array(12)), S.getBoundingClientRect(this._vertices,this._linewidth,this._renderer.rect),S.getTriangles(this._renderer.rect,this._renderer.triangles),S.updateBuffer(a,this,b),S.updateTexture(a,this));a.bindBuffer(a.ARRAY_BUFFER,this._renderer.textureCoordsBuffer);a.vertexAttribPointer(b.textureCoords,2,a.FLOAT,!1,0,0);a.bindTexture(a.TEXTURE_2D,this._renderer.texture);a.uniformMatrix3fv(b.matrix,!1,this._renderer.matrix);a.bindBuffer(a.ARRAY_BUFFER,this._renderer.buffer);a.vertexAttribPointer(b.position,2,a.FLOAT, !1,0,0);a.drawArrays(a.TRIANGLES,0,6);return this.flagReset()}},getBoundingClientRect:function(c,e,f){D=Infinity;F=-Infinity;s=Infinity;y=-Infinity;_.each(c,function(b,c){d=b.x;z=b.y;q;w;x;B;H=b.controls;s=Math.min(z,s);D=Math.min(d,D);F=Math.max(d,F);y=Math.max(z,y);b.controls&&(G=H.left,a=H.right,G&&a&&(q=b._relative?G.x+d:G.x,w=b._relative?G.y+z:G.y,x=b._relative?a.x+d:a.x,B=b._relative?a.y+z:a.y,q&&(w&&x&&B)&&(s=Math.min(w,B,s),D=Math.min(q,x,D),F=Math.max(q,x,F),y=Math.max(w,B,y))))});_.isNumber(e)&& (s-=e,D-=e,F+=e,y+=e);b=F-D;k=y-s;f.top=s;f.left=D;f.right=F;f.bottom=y;f.width=b;f.height=k;f.centroid||(f.centroid={});f.centroid.x=-D;f.centroid.y=-s},getTriangles:function(a,b){s=a.top;D=a.left;F=a.right;y=a.bottom;b[0]=D;b[1]=s;b[2]=F;b[3]=s;b[4]=D;b[5]=y;b[6]=D;b[7]=y;b[8]=F;b[9]=s;b[10]=F;b[11]=y},updateCanvas:function(a){v=a._vertices;K=this.canvas;u=this.ctx;A=a._renderer.scale;L=a._stroke;J=a._linewidth*A;O=a._fill;M=a._opacity;t=a._cap;I=a._join;T=a._miter;f=a._closed;h=v.length;E=h-1; K.width=Math.max(Math.ceil(a._renderer.rect.width*A),1);K.height=Math.max(Math.ceil(a._renderer.rect.height*A),1);ea=a._renderer.rect.centroid;P=ea.x*A;Q=ea.y*A;u.clearRect(0,0,K.width,K.height);O&&(u.fillStyle=O);L&&(u.strokeStyle=L);J&&(u.lineWidth=J);T&&(u.miterLimit=T);I&&(u.lineJoin=I);t&&(u.lineCap=t);_.isNumber(M)&&(u.globalAlpha=M);u.beginPath();_.each(v,function(a,b){aa;da;q;x;U;V;W;X;Y;ba;ca;G;d=(a.x*A+P).toFixed(3);z=(a.y*A+Q).toFixed(3);switch(a._command){case Two.Commands.close:u.closePath(); break;case Two.Commands.curve:da=f?r(b-1,h):Math.max(b-1,0);aa=f?r(b+1,h):Math.min(b+1,E);q=v[da];x=v[aa];Y=q.controls&&q.controls.right||q;ba=a.controls&&a.controls.left||a;q._relative?(W=((Y.x+q.x)*A+P).toFixed(3),X=((Y.y+q.y)*A+Q).toFixed(3)):(W=(Y.x*A+P).toFixed(3),X=(Y.y*A+Q).toFixed(3));a._relative?(U=((ba.x+a.x)*A+P).toFixed(3),V=((ba.y+a.y)*A+Q).toFixed(3)):(U=(ba.x*A+P).toFixed(3),V=(ba.y*A+Q).toFixed(3));u.bezierCurveTo(W,X,U,V,d,z);b>=E&&f&&(x=B,ca=a.controls&&a.controls.right||a,G=x.controls&& x.controls.left||x,a._relative?(W=((ca.x+a.x)*A+P).toFixed(3),X=((ca.y+a.y)*A+Q).toFixed(3)):(W=(ca.x*A+P).toFixed(3),X=(ca.y*A+Q).toFixed(3)),x._relative?(U=((G.x+x.x)*A+P).toFixed(3),V=((G.y+x.y)*A+P).toFixed(3)):(U=(G.x*A+P).toFixed(3),V=(G.y*A+Q).toFixed(3)),d=(x.x*A+P).toFixed(3),z=(x.y*A+Q).toFixed(3),u.bezierCurveTo(W,X,U,V,d,z));break;case Two.Commands.line:u.lineTo(d,z);break;case Two.Commands.move:B=a,u.moveTo(d,z)}});f&&u.closePath();u.fill();u.stroke()},updateTexture:function(a,b){this.updateCanvas(b); b._renderer.texture&&a.deleteTexture(b._renderer.texture);a.bindBuffer(a.ARRAY_BUFFER,b._renderer.textureCoordsBuffer);b._renderer.texture=a.createTexture();a.bindTexture(a.TEXTURE_2D,b._renderer.texture);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);0>=this.canvas.width||0>=this.canvas.height||a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,this.canvas)}, updateBuffer:function(a,b,c){_.isObject(b._renderer.buffer)&&a.deleteBuffer(b._renderer.buffer);b._renderer.buffer=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,b._renderer.buffer);a.enableVertexAttribArray(c.position);a.bufferData(a.ARRAY_BUFFER,b._renderer.triangles,a.STATIC_DRAW);_.isObject(b._renderer.textureCoordsBuffer)&&a.deleteBuffer(b._renderer.textureCoordsBuffer);b._renderer.textureCoordsBuffer=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,b._renderer.textureCoordsBuffer);a.enableVertexAttribArray(c.textureCoords); a.bufferData(a.ARRAY_BUFFER,this.uv,a.STATIC_DRAW)},program:{create:function(a,b){Z=a.createProgram();_.each(b,function(b){a.attachShader(Z,b)});a.linkProgram(Z);R=a.getProgramParameter(Z,a.LINK_STATUS);if(!R)throw ga=a.getProgramInfoLog(Z),a.deleteProgram(Z),new Two.Utils.Error("unable to link program: "+ga);return Z}},shaders:{create:function(a,b,c){$=a.createShader(a[c]);a.shaderSource($,b);a.compileShader($);fa=a.getShaderParameter($,a.COMPILE_STATUS);if(!fa)throw ga=a.getShaderInfoLog($),a.deleteShader($), new Two.Utils.Error("unable to compile shader "+$+": "+ga);return $},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},vertex:"attribute vec2 a_position;\nattribute vec2 a_textureCoords;\n\nuniform mat3 u_matrix;\nuniform vec2 u_resolution;\n\nvarying vec2 v_textureCoords;\n\nvoid main() {\n vec2 projected = (u_matrix * vec3(a_position, 1.0)).xy;\n vec2 normal = projected / u_resolution;\n vec2 clipspace = (normal * 2.0) - 1.0;\n\n gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0);\n v_textureCoords = a_textureCoords;\n}", fragment:"precision mediump float;\n\nuniform sampler2D u_image;\nvarying vec2 v_textureCoords;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_textureCoords);\n}"}};S.ctx=S.canvas.getContext("2d");var la=Two[Two.Types.webgl]=function(a){this.domElement=a.domElement||document.createElement("canvas");this.scene=new Two.Group;this.scene.parent=this;this._renderer={matrix:new Two.Array(g),scale:1};this._flagMatrix=!0;ha=_.defaults(a||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0, preserveDrawingBuffer:!0,overdraw:!1});this.overdraw=ha.overdraw;N=this.ctx=this.domElement.getContext("webgl",ha)||this.domElement.getContext("experimental-webgl",ha);if(!this.ctx)throw new Two.Utils.Error("unable to create a webgl context. Try using another renderer.");ka=S.shaders.create(N,S.shaders.vertex,S.shaders.types.vertex);ja=S.shaders.create(N,S.shaders.fragment,S.shaders.types.fragment);this.program=S.program.create(N,[ka,ja]);N.useProgram(this.program);this.program.position=N.getAttribLocation(this.program, "a_position");this.program.matrix=N.getUniformLocation(this.program,"u_matrix");this.program.textureCoords=N.getAttribLocation(this.program,"a_textureCoords");N.disable(N.DEPTH_TEST);N.enable(N.BLEND);N.blendEquationSeparate(N.FUNC_ADD,N.FUNC_ADD);N.blendFuncSeparate(N.SRC_ALPHA,N.ONE_MINUS_SRC_ALPHA,N.ONE,N.ONE_MINUS_SRC_ALPHA)};_.extend(la.prototype,Backbone.Events,{setSize:function(a,b,c){this.width=a;this.height=b;this.ratio=_.isUndefined(c)?m(this.ctx):c;this.domElement.width=a*this.ratio;this.domElement.height= b*this.ratio;_.extend(this.domElement.style,{width:a+"px",height:b+"px"});a*=this.ratio;b*=this.ratio;this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio;this._flagMatrix=!0;this.ctx.viewport(0,0,a,b);ia=this.ctx.getUniformLocation(this.program,"u_resolution");this.ctx.uniform2f(ia,a,b);return this},render:function(){N=this.ctx;this.overdraw||N.clear(N.COLOR_BUFFER_BIT|N.DEPTH_BUFFER_BIT);S.group.render.call(this.scene,N,this.program);this._flagMatrix=!1;return this}})})();(function(){var C,r=Two.Shape=function(g){this._renderer={};this.id=Two.uniqueId();this._matrix=new Two.Matrix;this.translation=new Two.Vector;this.translation.bind(Two.Events.change,_.bind(r.FlagMatrix,this));this.rotation=0;this.scale=1};_.extend(r,Backbone.Events,{FlagMatrix:function(){this._flagMatrix=!0},MakeObservable:function(g){Object.defineProperty(g,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e;this._flagMatrix=!0}});Object.defineProperty(g,"scale",{get:function(){return this._scale}, set:function(e){this._scale=e;this._flagScale=this._flagMatrix=!0}})}});_.extend(r.prototype,{_flagMatrix:!0,_rotation:0,_scale:1,addTo:function(g){g.add(this);return this},clone:function(){C=new r;C.translation.copy(this.translation);C.rotation=this.rotation;C.scale=this.scale;_.each(r.Properties,function(g){C[g]=this[g]},this);return C._update()},_update:function(){!this._matrix.manual&&this._flagMatrix&&this._matrix.identity().translate(this.translation.x,this.translation.y).scale(this.scale).rotate(this.rotation); this.parent&&_.isFunction(this.parent._update)&&this.parent._update();return this},flagReset:function(){this._flagScale=this._flagMatrix=!1;return this}});r.MakeObservable(r.prototype)})();(function(){var C=Math.min,r=Math.max,g=Math.round,e=Two.Utils.getComputedMatrix,m,n,c,p,l,D,F,s,y,d,z,q,w,x,B,H,G,a,b,k,v,K,u,A,L,J,O,M=Two.Polygon=function(a,b,c,d){Two.Shape.call(this);this._renderer.type="polygon";this._closed=!!b;this._curved=!!c;this.beginning=0;this.ending=1;this.fill="#fff";this.stroke="#000";this.opacity=this.linewidth=1;this.visible=!0;this.cap="butt";this.join="miter";this.miter=4;this._vertices=[];this.vertices=a;this.automatic=!d};_.extend(M,{Properties:"fill stroke linewidth opacity visible cap join miter closed curved automatic beginning ending".split(" "), FlagVertices:function(){this._flagVertices=!0},MakeObservable:function(a){Two.Shape.MakeObservable(a);_.each(M.Properties.slice(0,8),function(b){var c="_"+b,d="_flag"+b.charAt(0).toUpperCase()+b.slice(1);Object.defineProperty(a,b,{get:function(){return this[c]},set:function(a){this[c]=a;this[d]=!0}})});Object.defineProperty(a,"closed",{get:function(){return this._closed},set:function(a){this._closed=!!a;this._flagVertices=!0}});Object.defineProperty(a,"curved",{get:function(){return this._curved}, set:function(a){this._curved=!!a;this._flagVertices=!0}});Object.defineProperty(M.prototype,"automatic",{get:function(){return this._automatic},set:function(a){a!==this._automatic&&(method=(this._automatic=!!a)?"ignore":"listen",_.each(this.vertices,function(a){a[method]()}))}});Object.defineProperty(a,"beginning",{get:function(){return this._beginning},set:function(a){this._beginning=C(r(a,0),this._ending);this._flagVertices=!0}});Object.defineProperty(a,"ending",{get:function(){return this._ending}, set:function(a){this._ending=C(r(a,this._beginning),1);this._flagVertices=!0}});Object.defineProperty(a,"vertices",{get:function(){return this._collection},set:function(a){var b=_.bind(M.FlagVertices,this),c=_.bind(function(a){_.each(a,function(a){a.bind(Two.Events.change,b)},this);b()},this),d=_.bind(function(a){_.each(a,function(a){a.unbind(Two.Events.change,b)},this);b()},this);this._collection&&this._collection.unbind();this._collection=new Two.Utils.Collection(a.slice(0));this._collection.bind(Two.Events.insert, c);this._collection.bind(Two.Events.remove,d);verticesChanged=!0;c(this._collection)}})}});_.extend(M.prototype,Two.Shape.prototype,{_flagVertices:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagCap:!0,_flagJoin:!0,_flagMiter:!0,_fill:"#fff",_stroke:"#000",_linewidth:1,_opacity:1,_visible:!0,_cap:"round",_join:"round",_miter:4,_closed:!0,_curved:!1,_automatic:!0,_beginning:0,_ending:1,clone:function(a){a=a||this.parent;s=_.map(this.vertices,function(a){return a.clone()}); y=new M(s,this.closed,this.curved,!this.automatic);_.each(Two.Shape.Properties,function(a){y[a]=this[a]},this);y.translation.copy(this.translation);y.rotation=this.rotation;y.scale=this.scale;a.add(y);return y},toObject:function(){var a={vertices:_.map(this.vertices,function(a){return a.toObject()})};_.each(Two.Shape.Properties,function(b){a[b]=this[b]},this);a.translation=this.translation.toObject;a.rotation=this.rotation;a.scale=this.scale;return a},noFill:function(){this.fill="transparent";return this}, noStroke:function(){this.stroke="transparent";return this},corner:function(){d=this.getBoundingClientRect(!0);d.centroid={x:d.left+d.width/2,y:d.top+d.height/2};_.each(this.vertices,function(a){a.addSelf(d.centroid)});return this},center:function(){d=this.getBoundingClientRect(!0);d.centroid={x:d.left+d.width/2,y:d.top+d.height/2};_.each(this.vertices,function(a){a.subSelf(d.centroid)});return this},remove:function(){if(!this.parent)return this;this.parent.remove(this);return this},getBoundingClientRect:function(a){this._update(); b=a?this._matrix:e(this);z=this.linewidth/2;void 0;q=Infinity;w=-Infinity;x=Infinity;B=-Infinity;_.each(this._vertices,function(a){H=a.x;G=a.y;a=b.multiply(H,G,1);x=C(a.y-z,x);q=C(a.x-z,q);w=r(a.x+z,w);B=r(a.y+z,B)});return{top:x,left:q,right:w,bottom:B,width:w-q,height:B-x}},plot:function(){if(this.curved)return Two.Utils.getCurveFromPoints(this._vertices,this.closed),this;_.each(this._vertices,function(a,b){a._command=0===b?Two.Commands.move:Two.Commands.line},this);return this},subdivide:function(b){this._update(); p=this.vertices.length-1;a=this.vertices[p];l=this._closed||this.vertices[p]._command===Two.Commands.close;s=[];_.each(this.vertices,function(c,d){if(!(0>=d)||l)if(c.command===Two.Commands.move)s.push(new Two.Anchor(a.x,a.y)),0=c&&a.command===Two.Commands.move?Two.Commands.move:Two.Commands.line});d>=p&&(s.push(new Two.Anchor(J,O)),s[s.length-1].command=l?Two.Commands.close:Two.Commands.line)}a=c},this);this._curved=this._automatic=!1;this.vertices=s;return this},_update:function(){if(this._flagVertices){m=this.vertices.length;p=m-1;n=g(this._beginning*p);c=g(this._ending*p);this._vertices.length=0;for(F=n;F=l&&F)return F.remove(this),this;_.isArray(c)||(D=_.toArray(arguments));_.each(D,function(c){y=c.id;grandchildren= c.children;e=c.parent;y in m&&(delete m[y],delete c.parent,d=_.indexOf(e.additions,y),0<=d&&e.additions.splice(d,1),s.push(y),this._flagSubtractions=!0)},this);return this},getBoundingClientRect:function(d){this._update();var e=Infinity,g=-Infinity,l=Infinity,m=-Infinity;_.each(this.children,function(d){c=d.getBoundingClientRect();_.isNumber(c.top)&&(_.isNumber(c.left)&&_.isNumber(c.right)&&_.isNumber(c.bottom))&&(l=C(c.top,l),e=C(c.left,e),g=r(c.right,g),m=r(c.bottom,m))},this);return{top:l,left:e, right:g,bottom:m,width:g-e,height:m-l}},noFill:function(){_.each(this.children,function(c){c.noFill()});return this},noStroke:function(){_.each(this.children,function(c){c.noStroke()});return this},subdivide:function(){var c=arguments;_.each(this.children,function(d){d.subdivide.apply(d,c)});return this},flagReset:function(){this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1);this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1);Two.Shape.prototype.flagReset.call(this); return this}});z.MakeObservable(z.prototype)})();