webpackJsonp([7],{"/p1R":function(t,e){},"5R7W":function(t,e){},GGQW:function(t,e,i){(function(i){var r,n,s,a;this.Two=function(n){var s="undefined"!=typeof window?window:void 0!==i?i:null,a=Object.prototype.toString,o={_indexAmount:0,natural:{slice:Array.prototype.slice,indexOf:Array.prototype.indexOf,keys:Object.keys,bind:Function.prototype.bind,create:Object.create},identity:function(t){return t},isArguments:function(t){return"[object Arguments]"===a.call(t)},isFunction:function(t){return"[object Function]"===a.call(t)},isString:function(t){return"[object String]"===a.call(t)},isNumber:function(t){return"[object Number]"===a.call(t)},isDate:function(t){return"[object Date]"===a.call(t)},isRegExp:function(t){return"[object RegExp]"===a.call(t)},isError:function(t){return"[object Error]"===a.call(t)},isFinite:function(t){return isFinite(t)&&!isNaN(parseFloat(t))},isNaN:function(t){return o.isNumber(t)&&t!==+t},isBoolean:function(t){return!0===t||!1===t||"[object Boolean]"===a.call(t)},isNull:function(t){return null===t},isUndefined:function(t){return void 0===t},isEmpty:function(t){return null==t||(b&&(o.isArray(t)||o.isString(t)||o.isArguments(t))?0===t.length:0===o.keys(t).length)},isElement:function(t){return!(!t||1!==t.nodeType)},isArray:Array.isArray||function(t){return"[object Array]"===a.call(t)},isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},toArray:function(t){return t?o.isArray(t)?v.call(t):b(t)?o.map(t,o.identity):o.values(t):[]},range:function(t,e,i){null==e&&(e=t||0,t=0),i=i||1;for(var r=Math.max(Math.ceil((e-t)/i),0),n=Array(r),s=0;s<r;s++,t+=i)n[s]=t;return n},indexOf:function(t,e){if(o.natural.indexOf)return o.natural.indexOf.call(t,e);for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1},has:function(t,e){return null!=t&&hasOwnProperty.call(t,e)},bind:function(t,e){var i=o.natural.bind;if(i&&t.bind===i)return i.apply(t,v.call(arguments,1));var r=v.call(arguments,2);return function(){t.apply(e,r)}},extend:function(t){for(var e=v.call(arguments,1),i=0;i<e.length;i++){var r=e[i];for(var n in r)t[n]=r[n]}return t},defaults:function(t){for(var e=v.call(arguments,1),i=0;i<e.length;i++){var r=e[i];for(var n in r)void 0===t[n]&&(t[n]=r[n])}return t},keys:function(t){if(!o.isObject(t))return[];if(o.natural.keys)return o.natural.keys(t);var e=[];for(var i in t)o.has(t,i)&&e.push(i);return e},values:function(t){for(var e=o.keys(t),i=[],r=0;r<e.length;r++){var n=e[r];i.push(t[n])}return i},each:function(t,e,i){for(var r=i||this,n=!b(t)&&o.keys(t),s=(n||t).length,a=0;a<s;a++){var l=n?n[a]:a;e.call(r,t[l],l,t)}return t},map:function(t,e,i){for(var r=i||this,n=!b(t)&&o.keys(t),s=(n||t).length,a=[],l=0;l<s;l++){var h=n?n[l]:l;a[l]=e.call(r,t[h],h,t)}return a},once:function(t){var e=!1;return function(){return e?t:(e=!0,t.apply(this,arguments))}},after:function(t,e){return function(){for(;--t<1;)return e.apply(this,arguments)}},uniqueId:function(t){var e=++o._indexAmount+"";return t?t+e:e}},l=Math.sin,h=Math.cos,c=Math.atan2,d=Math.sqrt,u=(Math.round,Math.abs,Math.PI),f=u/2,_=Math.pow,g=Math.min,p=Math.max,m=0,v=o.natural.slice,y=s.performance&&s.performance.now?s.performance:Date,x=Math.pow(2,53)-1,b=function(t){var e,i=null==(e=t)?void 0:e.length;return"number"==typeof i&&i>=0&&i<=x},w={temp:s.document?s.document.createElement("div"):{},hasEventListeners:o.isFunction(s.addEventListener),bind:function(t,e,i,r){return this.hasEventListeners?t.addEventListener(e,i,!!r):t.attachEvent("on"+e,i),w},unbind:function(t,e,i,r){return w.hasEventListeners?t.removeEventListeners(e,i,!!r):t.detachEvent("on"+e,i),w},getRequestAnimationFrame:function(){var t,e=0,i=["ms","moz","webkit","o"],r=s.requestAnimationFrame;if(!r){for(var n=0;n<i.length;n++)r=s[i[n]+"RequestAnimationFrame"]||r,t=s[i[n]+"CancelAnimationFrame"]||s[i[n]+"CancelRequestAnimationFrame"]||t;r=r||function(t,i){var r=(new Date).getTime(),n=Math.max(0,16-(r-e)),a=s.setTimeout(function(){t(r+n)},n);return e=r+n,a}}return r.init=o.once(I),r}},S=s.Two=function(t){var e=o.defaults(t||{},{fullscreen:!1,width:640,height:480,type:S.Types.svg,autostart:!1});if(o.each(e,function(t,e){"fullscreen"!==e&&"autostart"!==e&&(this[e]=t)},this),o.isElement(e.domElement)){var i=e.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+i)||(this.type=S.Types[i])}if(this.renderer=new S[this.type](this),S.Utils.setPlaying.call(this,e.autostart),this.frameCount=0,e.fullscreen){var r=o.bind(P,this);o.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),o.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),w.bind(s,"resize",r),r()}else o.isElement(e.domElement)||(this.renderer.setSize(e.width,e.height,this.ratio),this.width=e.width,this.height=e.height);this.scene=this.renderer.scene,S.Instances.push(this),U.init()};o.extend(S,{root:s,Array:s.Float32Array||Array,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.7.0-alpha.1",Identifier:"two_",Properties:{hierarchy:"hierarchy",demotion:"demotion"},Events:{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"},Commands:{move:"M",line:"L",curve:"C",close:"Z"},Resolution:8,Instances:[],noConflict:function(){return s.Two=n,this},uniqueId:function(){var t=m;return m++,t},Utils:o.extend(o,{performance:y,defineProperty:function(t){var e="_"+t,i="_flag"+t.charAt(0).toUpperCase()+t.slice(1);Object.defineProperty(this,t,{enumerable:!0,get:function(){return this[e]},set:function(t){this[e]=t,this[i]=!0}})},release:function(t){o.isObject(t)&&(o.isFunction(t.unbind)&&t.unbind(),t.vertices&&(o.isFunction(t.vertices.unbind)&&t.vertices.unbind(),o.each(t.vertices,function(t){o.isFunction(t.unbind)&&t.unbind()})),t.children&&o.each(t.children,function(t){S.Utils.release(t)}))},xhr:function(t,e){var i=new XMLHttpRequest;return i.open("GET",t),i.onreadystatechange=function(){4===i.readyState&&200===i.status&&e(i.responseText)},i.send(),i},Curve:{CollinearityEpsilon:_(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:.01},abscissas:[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],weights:[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]]},devicePixelRatio:s.devicePixelRatio||1,getBackingStoreRatio:function(t){return t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1},getRatio:function(t){return S.Utils.devicePixelRatio/F(t)},setPlaying:function(t){return this.playing=!!t,this},getComputedMatrix:function(t,e){e=e&&e.identity()||new S.Matrix;for(var i=t,r=[];i&&i._matrix;)r.push(i._matrix),i=i.parent;return r.reverse(),o.each(r,function(t){var i=t.elements;e.multiply(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9])}),e},deltaTransformPoint:function(t,e,i){var r=e*t.a+i*t.c+0,n=e*t.b+i*t.d+0;return new S.Vector(r,n)},decomposeMatrix:function(t){var e=S.Utils.deltaTransformPoint(t,0,1),i=S.Utils.deltaTransformPoint(t,1,0),r=180/Math.PI*Math.atan2(e.y,e.x)-90,n=180/Math.PI*Math.atan2(i.y,i.x);return{translateX:t.e,translateY:t.f,scaleX:Math.sqrt(t.a*t.a+t.b*t.b),scaleY:Math.sqrt(t.c*t.c+t.d*t.d),skewX:r,skewY:n,rotation:r}},applySvgAttributes:function(t,e){var i,r,n,s,a={},l={};if(getComputedStyle){var h=getComputedStyle(t);for(i=h.length;i--;)void 0!==(n=h[r=h[i]])&&(l[r]=n)}for(i=t.attributes.length;i--;)a[(s=t.attributes[i]).nodeName]=s.value;for(r in o.isUndefined(l.opacity)||(l["stroke-opacity"]=l.opacity,l["fill-opacity"]=l.opacity),o.extend(l,a),l.visible=!(o.isUndefined(l.display)&&"none"===l.display)||o.isUndefined(l.visibility)&&"hidden"===l.visibility,l)switch(n=l[r],r){case"transform":if("none"===n)break;if(null===(t.getCTM?t.getCTM():null))break;var c=S.Utils.decomposeMatrix(t.getCTM());e.translation.set(c.translateX,c.translateY),e.rotation=c.rotation,e.scale=c.scaleX;var d=parseFloat((l.x+"").replace("px")),u=parseFloat((l.y+"").replace("px"));d&&(e.translation.x=d),u&&(e.translation.y=u);break;case"visible":e.visible=n;break;case"stroke-linecap":e.cap=n;break;case"stroke-linejoin":e.join=n;break;case"stroke-miterlimit":e.miter=n;break;case"stroke-width":e.linewidth=parseFloat(n);break;case"stroke-opacity":case"fill-opacity":case"opacity":e.opacity=parseFloat(n);break;case"fill":case"stroke":/url\(\#.*\)/i.test(n)?e[r]=this.getById(n.replace(/url\(\#(.*)\)/i,"$1")):e[r]="none"===n?"transparent":n;break;case"id":e.id=n;break;case"class":e.classList=n.split(" ")}return e},read:{svg:function(){return S.Utils.read.g.apply(this,arguments)},g:function(t){var e=new S.Group;S.Utils.applySvgAttributes.call(this,t,e);for(var i=0,r=t.childNodes.length;i<r;i++){var n=t.childNodes[i],s=n.nodeName;if(!s)return;var a=s.replace(/svg\:/gi,"").toLowerCase();if(a in S.Utils.read){var o=S.Utils.read[a].call(e,n);e.add(o)}}return e},polygon:function(t,e){var i=[];t.getAttribute("points").replace(/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,function(t,e,r){i.push(new S.Anchor(parseFloat(e),parseFloat(r)))});var r=new S.Path(i,!e).noStroke();return r.fill="black",S.Utils.applySvgAttributes.call(this,t,r)},polyline:function(t){return S.Utils.read.polygon.call(this,t,!0)},path:function(t){var e,i,r=t.getAttribute("d"),n=new S.Anchor,s=!1,a=!1,l=r.match(/[a-df-z][^a-df-z]*/gi),h=l.length-1;o.each(l.slice(0),function(t,e){var i,r=t[0],n=r.toLowerCase(),s=t.slice(1).trim().split(/[\s,]+|(?=\s?[+\-])/),a=[];switch(e<=0&&(l=[]),n){case"h":case"v":s.length>1&&(i=1);break;case"m":case"l":case"t":s.length>2&&(i=2);break;case"s":case"q":s.length>4&&(i=4);break;case"c":s.length>6&&(i=6)}if(i){for(var o=0,h=s.length,c=0;o<h;o+=i){var d=r;if(c>0)switch(r){case"m":d="l";break;case"M":d="L"}a.push([d].concat(s.slice(o,o+i)).join(" ")),c++}l=Array.prototype.concat.apply(l,a)}else l.push(t)});var c=[];if(o.each(l,function(t,r){var l,d,u,f,g,p,m,v,y,x,b,w,A=t[0],E=A.toLowerCase();switch(i=(i=(i=t.slice(1).trim()).replace(/(-?\d+(?:\.\d*)?)[eE]([+\-]?\d+)/g,function(t,e,i){return parseFloat(e)*_(10,i)})).split(/[\s,]+|(?=\s?[+\-])/),a=A===E,E){case"z":r>=h?s=!0:(d=n.x,u=n.y,l=new S.Anchor(d,u,void 0,void 0,void 0,void 0,S.Commands.close));break;case"m":case"l":d=parseFloat(i[0]),u=parseFloat(i[1]),l=new S.Anchor(d,u,void 0,void 0,void 0,void 0,"m"===E?S.Commands.move:S.Commands.line),a&&l.addSelf(n),n=l;break;case"h":case"v":var k="x"===(q="h"===E?"x":"y")?"y":"x";(l=new S.Anchor(void 0,void 0,void 0,void 0,void 0,void 0,S.Commands.line))[q]=parseFloat(i[0]),l[k]=n[k],a&&(l[q]+=n[q]),n=l;break;case"c":case"s":f=n.x,g=n.y,e||(e=new S.Vector),"c"===E?(p=parseFloat(i[0]),m=parseFloat(i[1]),v=parseFloat(i[2]),y=parseFloat(i[3]),x=parseFloat(i[4]),b=parseFloat(i[5])):(p=(w=L(n,e,a)).x,m=w.y,v=parseFloat(i[0]),y=parseFloat(i[1]),x=parseFloat(i[2]),b=parseFloat(i[3])),a&&(p+=f,m+=g,v+=f,y+=g,x+=f,b+=g),o.isObject(n.controls)||S.Anchor.AppendCurveProperties(n),n.controls.right.set(p-n.x,m-n.y),l=new S.Anchor(x,b,v-x,y-b,void 0,void 0,S.Commands.curve),n=l,e=l.controls.left;break;case"t":case"q":f=n.x,g=n.y,e||(e=new S.Vector),e.isZero()?(p=f,m=g):(p=e.x,g=e.y),"q"===E?(v=parseFloat(i[0]),y=parseFloat(i[1]),x=parseFloat(i[1]),b=parseFloat(i[2])):(v=(w=L(n,e,a)).x,y=w.y,x=parseFloat(i[0]),b=parseFloat(i[1])),a&&(p+=f,m+=g,v+=f,y+=g,x+=f,b+=g),o.isObject(n.controls)||S.Anchor.AppendCurveProperties(n),n.controls.right.set(p-n.x,m-n.y),l=new S.Anchor(x,b,v-x,y-b,void 0,void 0,S.Commands.curve),n=l,e=l.controls.left;break;case"a":f=n.x,g=n.y;var C=parseFloat(i[0]),M=parseFloat(i[1]),F=parseFloat(i[2])*Math.PI/180,O=parseFloat(i[3]),T=parseFloat(i[4]);x=parseFloat(i[5]),b=parseFloat(i[6]),a&&(x+=f,b+=g);var P=(x-f)/2,U=(b-g)/2,I=P*Math.cos(F)+U*Math.sin(F),N=-P*Math.sin(F)+U*Math.cos(F),j=C*C,D=M*M,B=I*I,G=N*N,V=B/j+G/D;V>1&&(C*=Math.sqrt(V),M*=Math.sqrt(V));var z=Math.sqrt((j*D-j*G-D*B)/(j*G+D*B));o.isNaN(z)?z=0:O!=T&&z>0&&(z*=-1);var q,H=z*C*N/M,$=-z*M*I/C,X=H*Math.cos(F)-$*Math.sin(F)+(f+x)/2,Y=H*Math.sin(F)+$*Math.cos(F)+(g+b)/2,W=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2))},J=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(W(t)*W(e))},K=(q=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(J(t,e))})([1,0],[(I-H)/C,(N-$)/M]),Z=[(I-H)/C,(N-$)/M],Q=[(-I-H)/C,(-N-$)/M],tt=q(Z,Q);J(Z,Q)<=-1&&(tt=Math.PI),J(Z,Q)>=1&&(tt=0),O&&(tt=R(tt,2*Math.PI)),T&&tt>0&&(tt-=2*Math.PI);var et=S.Resolution,it=(new S.Matrix).translate(X,Y).rotate(F);(l=o.map(o.range(et),function(t){var e=(1-t/(et-1))*tt+K,i=C*Math.cos(e),r=M*Math.sin(e),n=it.multiply(i,r,1);return new S.Anchor(n.x,n.y,!1,!1,!1,!1,S.Commands.line)})).push(new S.Anchor(x,b,!1,!1,!1,!1,S.Commands.line)),n=l[l.length-1],e=n.controls.left}l&&(o.isArray(l)?c=c.concat(l):c.push(l))}),!(c.length<=1)){(r=new S.Path(c,s,void 0,!0).noStroke()).fill="black";var d=r.getBoundingClientRect(!0);return d.centroid={x:d.left+d.width/2,y:d.top+d.height/2},o.each(r.vertices,function(t){t.subSelf(d.centroid)}),r.translation.addSelf(d.centroid),S.Utils.applySvgAttributes.call(this,t,r)}},circle:function(t){var e=parseFloat(t.getAttribute("cx")),i=parseFloat(t.getAttribute("cy")),r=parseFloat(t.getAttribute("r")),n=new S.Circle(e,i,r).noStroke();return n.fill="black",S.Utils.applySvgAttributes.call(this,t,n)},ellipse:function(t){var e=parseFloat(t.getAttribute("cx")),i=parseFloat(t.getAttribute("cy")),r=parseFloat(t.getAttribute("rx")),n=parseFloat(t.getAttribute("ry")),s=new S.Ellipse(e,i,r,n).noStroke();return s.fill="black",S.Utils.applySvgAttributes.call(this,t,s)},rect:function(t){var e=parseFloat(t.getAttribute("x"))||0,i=parseFloat(t.getAttribute("y"))||0,r=parseFloat(t.getAttribute("width")),n=parseFloat(t.getAttribute("height")),s=r/2,a=n/2,o=new S.Rectangle(e+s,i+a,r,n).noStroke();return o.fill="black",S.Utils.applySvgAttributes.call(this,t,o)},line:function(t){var e=parseFloat(t.getAttribute("x1")),i=parseFloat(t.getAttribute("y1")),r=parseFloat(t.getAttribute("x2")),n=parseFloat(t.getAttribute("y2")),s=new S.Line(e,i,r,n).noFill();return S.Utils.applySvgAttributes.call(this,t,s)},lineargradient:function(t){for(var e=parseFloat(t.getAttribute("x1")),i=parseFloat(t.getAttribute("y1")),r=parseFloat(t.getAttribute("x2")),n=parseFloat(t.getAttribute("y2")),s=(r+e)/2,a=(n+i)/2,l=[],h=0;h<t.children.length;h++){var c,d=t.children[h],u=parseFloat(d.getAttribute("offset")),f=d.getAttribute("stop-color"),_=d.getAttribute("stop-opacity"),g=d.getAttribute("style");if(o.isNull(f))f=(c=!!g&&g.match(/stop\-color\:\s?([\#a-fA-F0-9]*)/))&&c.length>1?c[1]:void 0;if(o.isNull(_))_=(c=!!g&&g.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&c.length>1?parseFloat(c[1]):1;l.push(new S.Gradient.Stop(u,f,_))}var p=new S.LinearGradient(e-s,i-a,r-s,n-a,l);return S.Utils.applySvgAttributes.call(this,t,p)},radialgradient:function(t){var e=parseFloat(t.getAttribute("cx"))||0,i=parseFloat(t.getAttribute("cy"))||0,r=parseFloat(t.getAttribute("r")),n=parseFloat(t.getAttribute("fx")),s=parseFloat(t.getAttribute("fy"));o.isNaN(n)&&(n=e),o.isNaN(s)&&(s=i);for(var a=Math.abs(e+n)/2,l=Math.abs(i+s)/2,h=[],c=0;c<t.children.length;c++){var d,u=t.children[c],f=parseFloat(u.getAttribute("offset")),_=u.getAttribute("stop-color"),g=u.getAttribute("stop-opacity"),p=u.getAttribute("style");if(o.isNull(_))_=(d=!!p&&p.match(/stop\-color\:\s?([\#a-fA-F0-9]*)/))&&d.length>1?d[1]:void 0;if(o.isNull(g))g=(d=!!p&&p.match(/stop\-opacity\:\s?([0-9\.\-]*)/))&&d.length>1?parseFloat(d[1]):1;h.push(new S.Gradient.Stop(f,_,g))}var m=new S.RadialGradient(e-a,i-l,r,h,n-a,s-l);return S.Utils.applySvgAttributes.call(this,t,m)}},subdivide:function(t,e,i,r,n,s,a,l,h){var c=(h=h||S.Utils.Curve.RecursionLimit)+1;return t===a&&e===l?[new S.Anchor(a,l)]:o.map(o.range(0,c),function(o){var h=o/c,d=O(h,t,i,n,a),u=O(h,e,r,s,l);return new S.Anchor(d,u)})},getPointOnCubicBezier:function(t,e,i,r,n){var s=1-t;return s*s*s*e+3*s*s*t*i+3*s*t*t*r+t*t*t*n},getCurveLength:function(t,e,i,r,n,s,a,o,l){if(t===i&&e===r&&n===a&&s===o){var h=a-t,c=o-e;return d(h*h+c*c)}var u=9*(i-n)+3*(a-t),f=6*(t+n)-12*i,_=3*(i-t),g=9*(r-s)+3*(o-e),p=6*(e+s)-12*r,m=3*(r-e);return T(function(t){var e=(u*t+f)*t+_,i=(g*t+p)*t+m;return d(e*e+i*i)},0,1,l||S.Utils.Curve.RecursionLimit)},integrate:function(t,e,i,r){for(var n=S.Utils.Curve.abscissas[r-2],s=S.Utils.Curve.weights[r-2],a=.5*(i-e),o=a+e,l=0,h=r+1>>1,c=1&r?s[l++]*t(o):0;l<h;){var d=a*n[l];c+=s[l++]*(t(o+d)+t(o-d))}return a*c},getCurveFromPoints:function(t,e){for(var i=t.length,r=i-1,n=0;n<i;n++){var s=t[n];o.isObject(s.controls)||S.Anchor.AppendCurveProperties(s);var a=e?R(n-1,i):p(n-1,0),l=e?R(n+1,i):g(n+1,r),h=t[a],c=s,d=t[l];M(h,c,d),c._command=0===n?S.Commands.move:S.Commands.curve,c.controls.left.x=o.isNumber(c.controls.left.x)?c.controls.left.x:c.x,c.controls.left.y=o.isNumber(c.controls.left.y)?c.controls.left.y:c.y,c.controls.right.x=o.isNumber(c.controls.right.x)?c.controls.right.x:c.x,c.controls.right.y=o.isNumber(c.controls.right.y)?c.controls.right.y:c.y}},getControlPoints:function(t,e,i){var r=C(t,e),n=C(i,e),s=E(t,e),a=E(i,e),c=(r+n)/2;return e.u=o.isObject(e.controls.left)?e.controls.left:new S.Vector(0,0),e.v=o.isObject(e.controls.right)?e.controls.right:new S.Vector(0,0),s<1e-4||a<1e-4?(e._relative||(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,n<r?c+=f:c-=f,e.controls.left.x=h(c)*s,e.controls.left.y=l(c)*s,c-=u,e.controls.right.x=h(c)*a,e.controls.right.y=l(c)*a,e._relative||(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)},getReflection:function(t,e,i){return new S.Vector(2*t.x-(e.x+t.x)-(i?t.x:0),2*t.y-(e.y+t.y)-(i?t.y:0))},getAnchorsFromArcData:function(t,e,i,r,n,s,a){(new S.Matrix).translate(t.x,t.y).rotate(e);var l=S.Resolution;return o.map(o.range(l),function(t){var e=(t+1)/l;a&&(e=1-e);var o=e*s+n,h=i*Math.cos(o),c=r*Math.sin(o),d=new S.Anchor(h,c);return S.Anchor.AppendCurveProperties(d),d.command=S.Commands.line,d})},ratioBetween:function(t,e){return(t.x*e.x+t.y*e.y)/(t.length()*e.length())},angleBetween:function(t,e){var i,r;return arguments.length>=4?(i=arguments[0]-arguments[2],r=arguments[1]-arguments[3],c(r,i)):(i=t.x-e.x,r=t.y-e.y,c(r,i))},distanceBetweenSquared:function(t,e){var i=t.x-e.x,r=t.y-e.y;return i*i+r*r},distanceBetween:function(t,e){return d(k(t,e))},lerp:function(t,e,i){return i*(e-t)+t},toFixed:function(t){return Math.floor(1e3*t)/1e3},mod:function(t,e){for(;t<0;)t+=e;return t%e},Collection:function(){Array.call(this),arguments.length>1?Array.prototype.push.apply(this,arguments):arguments[0]&&Array.isArray(arguments[0])&&Array.prototype.push.apply(this,arguments[0])},Error:function(t){this.name="two.js",this.message=t},Events:{on:function(t,e){return this._events||(this._events={}),(this._events[t]||(this._events[t]=[])).push(e),this},off:function(t,e){if(!this._events)return this;if(!t&&!e)return this._events={},this;for(var i=t?[t]:o.keys(this._events),r=0,n=i.length;r<n;r++){t=i[r];var s=this._events[t];if(s){var a=[];if(e)for(var l=0,h=s.length;l<h;l++){var c=s[l];c=c.callback?c.callback:c,e&&e!==c&&a.push(c)}this._events[t]=a}}return this},trigger:function(t){if(!this._events)return this;var e=v.call(arguments,1),i=this._events[t];return i&&A(this,i,e),this},listen:function(t,e,i){var r=this;if(t){var n=function(){i.apply(r,arguments)};n.obj=t,n.name=e,n.callback=i,t.on(e,n)}return this},ignore:function(t,e,i){return t.off(e,i),this}}})}),S.Utils.Events.bind=S.Utils.Events.on,S.Utils.Events.unbind=S.Utils.Events.off;var A=function(t,e,i){var r;switch(i.length){case 0:r=function(r){e[r].call(t,i[0])};break;case 1:r=function(r){e[r].call(t,i[0],i[1])};break;case 2:r=function(r){e[r].call(t,i[0],i[1],i[2])};break;case 3:r=function(r){e[r].call(t,i[0],i[1],i[2],i[3])};break;default:r=function(r){e[r].apply(t,i)}}for(var n=0;n<e.length;n++)r(n)};S.Utils.Error.prototype=new Error,S.Utils.Error.prototype.constructor=S.Utils.Error,S.Utils.Collection.prototype=new Array,S.Utils.Collection.prototype.constructor=S.Utils.Collection,o.extend(S.Utils.Collection.prototype,S.Utils.Events,{pop:function(){var t=Array.prototype.pop.apply(this,arguments);return this.trigger(S.Events.remove,[t]),t},shift:function(){var t=Array.prototype.shift.apply(this,arguments);return this.trigger(S.Events.remove,[t]),t},push:function(){var t=Array.prototype.push.apply(this,arguments);return this.trigger(S.Events.insert,arguments),t},unshift:function(){var t=Array.prototype.unshift.apply(this,arguments);return this.trigger(S.Events.insert,arguments),t},splice:function(){var t,e=Array.prototype.splice.apply(this,arguments);return this.trigger(S.Events.remove,e),arguments.length>2&&(t=this.slice(arguments[0],arguments[0]+arguments.length-2),this.trigger(S.Events.insert,t),this.trigger(S.Events.order)),e},sort:function(){return Array.prototype.sort.apply(this,arguments),this.trigger(S.Events.order),this},reverse:function(){return Array.prototype.reverse.apply(this,arguments),this.trigger(S.Events.order),this}});var E=S.Utils.distanceBetween,k=(S.Utils.getAnchorsFromArcData,S.Utils.distanceBetweenSquared),C=(S.Utils.ratioBetween,S.Utils.angleBetween),M=S.Utils.getControlPoints,R=(S.Utils.getCurveFromPoints,S.Utils.solveSegmentIntersection,S.Utils.decoupleShapes,S.Utils.mod),F=S.Utils.getBackingStoreRatio,O=S.Utils.getPointOnCubicBezier,T=(S.Utils.getCurveLength,S.Utils.integrate),L=S.Utils.getReflection;function P(){var t=document.body.getBoundingClientRect(),e=this.width=t.width,i=this.height=t.height;this.renderer.setSize(e,i,this.ratio),this.trigger(S.Events.resize,e,i)}o.extend(S.prototype,S.Utils.Events,{appendTo:function(t){return t.appendChild(this.renderer.domElement),this},play:function(){return S.Utils.setPlaying.call(this,!0),this.trigger(S.Events.play)},pause:function(){return this.playing=!1,this.trigger(S.Events.pause)},update:function(){var t=!!this._lastFrame,e=y.now();this.frameCount++,t&&(this.timeDelta=parseFloat((e-this._lastFrame).toFixed(3))),this._lastFrame=e;var i=this.width,r=this.height,n=this.renderer;return i===n.width&&r===n.height||n.setSize(i,r,this.ratio),this.trigger(S.Events.update,this.frameCount,this.timeDelta),this.render()},render:function(){return this.renderer.render(),this.trigger(S.Events.render,this.frameCount)},add:function(t){var e=t;return e instanceof Array||(e=o.toArray(arguments)),this.scene.add(e),this},remove:function(t){var e=t;return e instanceof Array||(e=o.toArray(arguments)),this.scene.remove(e),this},clear:function(){return this.scene.remove(o.toArray(this.scene.children)),this},makeLine:function(t,e,i,r){var n=new S.Line(t,e,i,r);return this.scene.add(n),n},makeRectangle:function(t,e,i,r){var n=new S.Rectangle(t,e,i,r);return this.scene.add(n),n},makeRoundedRectangle:function(t,e,i,r,n){var s=new S.RoundedRectangle(t,e,i,r,n);return this.scene.add(s),s},makeCircle:function(t,e,i){var r=new S.Circle(t,e,i);return this.scene.add(r),r},makeEllipse:function(t,e,i,r){var n=new S.Ellipse(t,e,i,r);return this.scene.add(n),n},makeStar:function(t,e,i,r,n){var s=new S.Star(t,e,i,r,n);return this.scene.add(s),s},makeCurve:function(t){var e=arguments.length,i=t;if(!o.isArray(t)){i=[];for(var r=0;r<e;r+=2){var n=arguments[r];if(!o.isNumber(n))break;var s=arguments[r+1];i.push(new S.Anchor(n,s))}}var a=arguments[e-1],l=new S.Path(i,!(o.isBoolean(a)?a:void 0),!0),h=l.getBoundingClientRect();return l.center().translation.set(h.left+h.width/2,h.top+h.height/2),this.scene.add(l),l},makePolygon:function(t,e,i,r){var n=new S.Polygon(t,e,i,r);return this.scene.add(n),n},makeArcSegment:function(t,e,i,r,n,s,a){var o=new S.ArcSegment(t,e,i,r,n,s,a);return this.scene.add(o),o},makePath:function(t){var e=arguments.length,i=t;if(!o.isArray(t)){i=[];for(var r=0;r<e;r+=2){var n=arguments[r];if(!o.isNumber(n))break;var s=arguments[r+1];i.push(new S.Anchor(n,s))}}var a=arguments[e-1],l=new S.Path(i,!(o.isBoolean(a)?a:void 0)),h=l.getBoundingClientRect();return l.center().translation.set(h.left+h.width/2,h.top+h.height/2),this.scene.add(l),l},makeText:function(t,e,i,r){var n=new S.Text(t,e,i,r);return this.add(n),n},makeLinearGradient:function(t,e,i,r){var n=v.call(arguments,4),s=new S.LinearGradient(t,e,i,r,n);return this.add(s),s},makeRadialGradient:function(t,e,i){var r=v.call(arguments,3),n=new S.RadialGradient(t,e,i,r);return this.add(n),n},makeSprite:function(t,e,i,r,n,s,a){var o=new S.Sprite(t,e,i,r,n,s);return a&&o.play(),this.add(o),o},makeImageSequence:function(t,e,i,r,n){var s=new S.ImageSequence(t,e,i,r);return n&&s.play(),this.add(s),s},makeTexture:function(t,e){return new S.Texture(t,e)},makeGroup:function(t){var e=t;e instanceof Array||(e=o.toArray(arguments));var i=new S.Group;return this.scene.add(i),i.add(e),i},interpret:function(t,e){var i=t.tagName.toLowerCase();if(!(i in S.Utils.read))return null;var r=S.Utils.read[i].call(this,t);return e&&r instanceof S.Group?this.add(r.children):this.add(r),r},load:function(t,e){var i,r,n=[];if(/.*\.svg/gi.test(t))return S.Utils.xhr(t,o.bind(function(t){for(w.temp.innerHTML=t,r=0;r<w.temp.children.length;r++)i=w.temp.children[r],n.push(this.interpret(i));e(n.length<=1?n[0]:n,w.temp.children.length<=1?w.temp.children[0]:w.temp.children)},this)),this;for(w.temp.innerHTML=t,r=0;r<w.temp.children.length;r++)i=w.temp.children[r],n.push(this.interpret(i));return e(n.length<=1?n[0]:n,w.temp.children.length<=1?w.temp.children[0]:w.temp.children),this}});var U=w.getRequestAnimationFrame();function I(){U(I);for(var t=0;t<S.Instances.length;t++){var e=S.Instances[t];e.playing&&e.update()}}return void 0===(r=function(){return S}.apply(e,[]))||(t.exports=r),S}((void 0!==i?i:this).Two),n=(void 0!==i?i:this).Two,s=n.Utils,a=n.Registry=function(){this.map={}},s.extend(a,{}),s.extend(a.prototype,{add:function(t,e){return this.map[t]=e,this},remove:function(t){return delete this.map[t],this},get:function(t){return this.map[t]},contains:function(t){return t in this.map}}),function(t){var e=t.Utils,i=t.Vector=function(t,e){this.x=t||0,this.y=e||0};e.extend(i,{zero:new t.Vector}),e.extend(i.prototype,t.Utils.Events,{set:function(t,e){return this.x=t,this.y=e,this},copy:function(t){return this.x=t.x,this.y=t.y,this},clear:function(){return this.x=0,this.y=0,this},clone:function(){return new i(this.x,this.y)},add:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addSelf:function(t){return this.x+=t.x,this.y+=t.y,this},sub:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},subSelf:function(t){return this.x-=t.x,this.y-=t.y,this},multiplySelf:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divideScalar:function(t){return t?(this.x/=t,this.y/=t):this.set(0,0),this},negate:function(){return this.multiplyScalar(-1)},dot:function(t){return this.x*t.x+this.y*t.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(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},setLength:function(t){return this.normalize().multiplyScalar(t)},equals:function(t,e){return e=void 0===e?1e-4:e,this.distanceTo(t)<e},lerp:function(t,e){var i=(t.x-this.x)*e+this.x,r=(t.y-this.y)*e+this.y;return this.set(i,r)},isZero:function(t){return t=void 0===t?1e-4:t,this.length()<t},toString:function(){return this.x+", "+this.y},toObject:function(){return{x:this.x,y:this.y}},rotate:function(t){var e=Math.cos(t),i=Math.sin(t);return this.x=this.x*e-this.y*i,this.y=this.x*i+this.y*e,this}});var r={set:function(e,i){return this._x=e,this._y=i,this.trigger(t.Events.change)},copy:function(e){return this._x=e.x,this._y=e.y,this.trigger(t.Events.change)},clear:function(){return this._x=0,this._y=0,this.trigger(t.Events.change)},clone:function(){return new i(this._x,this._y)},add:function(e,i){return this._x=e.x+i.x,this._y=e.y+i.y,this.trigger(t.Events.change)},addSelf:function(e){return this._x+=e.x,this._y+=e.y,this.trigger(t.Events.change)},sub:function(e,i){return this._x=e.x-i.x,this._y=e.y-i.y,this.trigger(t.Events.change)},subSelf:function(e){return this._x-=e.x,this._y-=e.y,this.trigger(t.Events.change)},multiplySelf:function(e){return this._x*=e.x,this._y*=e.y,this.trigger(t.Events.change)},multiplyScalar:function(e){return this._x*=e,this._y*=e,this.trigger(t.Events.change)},divideScalar:function(e){return e?(this._x/=e,this._y/=e,this.trigger(t.Events.change)):this.clear()},negate:function(){return this.multiplyScalar(-1)},dot:function(t){return this._x*t.x+this._y*t.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(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this._x-t.x,i=this._y-t.y;return e*e+i*i},setLength:function(t){return this.normalize().multiplyScalar(t)},equals:function(t,e){return e=void 0===e?1e-4:e,this.distanceTo(t)<e},lerp:function(t,e){var i=(t.x-this._x)*e+this._x,r=(t.y-this._y)*e+this._y;return this.set(i,r)},isZero:function(t){return t=void 0===t?1e-4:t,this.length()<t},toString:function(){return this._x+", "+this._y},toObject:function(){return{x:this._x,y:this._y}},rotate:function(t){var e=Math.cos(t),i=Math.sin(t);return this._x=this._x*e-this._y*i,this._y=this._x*i+this._y*e,this}},n={enumerable:!0,get:function(){return this._x},set:function(e){this._x=e,this.trigger(t.Events.change,"x")}},s={enumerable:!0,get:function(){return this._y},set:function(e){this._y=e,this.trigger(t.Events.change,"y")}};t.Vector.prototype.bind=t.Vector.prototype.on=function(){return this._bound||(this._x=this.x,this._y=this.y,Object.defineProperty(this,"x",n),Object.defineProperty(this,"y",s),e.extend(this,r),this._bound=!0),t.Utils.Events.bind.apply(this,arguments),this}}((void 0!==i?i:this).Two),function(t){var e=t.Commands,i=t.Utils,r=t.Anchor=function(n,s,a,o,l,h,c){if(t.Vector.call(this,n,s),this._broadcast=i.bind(function(){this.trigger(t.Events.change)},this),this._command=c||e.move,this._relative=!0,!c)return this;r.AppendCurveProperties(this),i.isNumber(a)&&(this.controls.left.x=a),i.isNumber(o)&&(this.controls.left.y=o),i.isNumber(l)&&(this.controls.right.x=l),i.isNumber(h)&&(this.controls.right.y=h)};i.extend(r,{AppendCurveProperties:function(e){e.controls={left:new t.Vector(0,0),right:new t.Vector(0,0)}}});var n={listen:function(){return i.isObject(this.controls)||r.AppendCurveProperties(this),this.controls.left.bind(t.Events.change,this._broadcast),this.controls.right.bind(t.Events.change,this._broadcast),this},ignore:function(){return this.controls.left.unbind(t.Events.change,this._broadcast),this.controls.right.unbind(t.Events.change,this._broadcast),this},clone:function(){var e=this.controls,i=new t.Anchor(this.x,this.y,e&&e.left.x,e&&e.left.y,e&&e.right.x,e&&e.right.y,this.command);return i.relative=this._relative,i},toObject:function(){var t={x:this.x,y:this.y};return this._command&&(t.command=this._command),this._relative&&(t.relative=this._relative),this.controls&&(t.controls={left:this.controls.left.toObject(),right:this.controls.right.toObject()}),t},toString:function(){return this.controls?[this._x,this._y,this.controls.left.x,this.controls.left.y,this.controls.right.x,this.controls.right.y].join(", "):[this._x,this._y].join(", ")}};Object.defineProperty(r.prototype,"command",{enumerable:!0,get:function(){return this._command},set:function(n){return this._command=n,this._command!==e.curve||i.isObject(this.controls)||r.AppendCurveProperties(this),this.trigger(t.Events.change)}}),Object.defineProperty(r.prototype,"relative",{enumerable:!0,get:function(){return this._relative},set:function(e){return this._relative==e?this:(this._relative=!!e,this.trigger(t.Events.change))}}),i.extend(r.prototype,t.Vector.prototype,n),t.Anchor.prototype.bind=t.Anchor.prototype.on=function(){t.Vector.prototype.bind.apply(this,arguments),i.extend(this,n)},t.Anchor.prototype.unbind=t.Anchor.prototype.off=function(){t.Vector.prototype.unbind.apply(this,arguments),i.extend(this,n)}}((void 0!==i?i:this).Two),function(t){var e=Math.cos,i=Math.sin,r=Math.tan,n=t.Utils,s=t.Matrix=function(e,i,r,s,a,o){this.elements=new t.Array(9);var l=e;n.isArray(l)||(l=n.toArray(arguments)),this.identity().set(l)};n.extend(s,{Identity:[1,0,0,0,1,0,0,0,1],Multiply:function(e,i,r){if(i.length<=3){var n=e,s=i[0]||0,a=i[1]||0,o=i[2]||0;return{x:n[0]*s+n[1]*a+n[2]*o,y:n[3]*s+n[4]*a+n[5]*o,z:n[6]*s+n[7]*a+n[8]*o}}var l=e[0],h=e[1],c=e[2],d=e[3],u=e[4],f=e[5],_=e[6],g=e[7],p=e[8],m=i[0],v=i[1],y=i[2],x=i[3],b=i[4],w=i[5],S=i[6],A=i[7],E=i[8];return(r=r||new t.Array(9))[0]=l*m+h*x+c*S,r[1]=l*v+h*b+c*A,r[2]=l*y+h*w+c*E,r[3]=d*m+u*x+f*S,r[4]=d*v+u*b+f*A,r[5]=d*y+u*w+f*E,r[6]=_*m+g*x+p*S,r[7]=_*v+g*b+p*A,r[8]=_*y+g*w+p*E,r}}),n.extend(s.prototype,t.Utils.Events,{set:function(e){var i=e;return n.isArray(i)||(i=n.toArray(arguments)),n.extend(this.elements,i),this.trigger(t.Events.change)},identity:function(){return this.set(s.Identity),this},multiply:function(e,i,r,s,a,o,l,h,c){var d=arguments,u=d.length;if(u<=1)return n.each(this.elements,function(t,i){this.elements[i]=t*e},this),this.trigger(t.Events.change);if(u<=3)return e=e||0,i=i||0,r=r||0,{x:(a=this.elements)[0]*e+a[1]*i+a[2]*r,y:a[3]*e+a[4]*i+a[5]*r,z:a[6]*e+a[7]*i+a[8]*r};var f=this.elements,_=d,g=f[0],p=f[1],m=f[2],v=f[3],y=f[4],x=f[5],b=f[6],w=f[7],S=f[8],A=_[0],E=_[1],k=_[2],C=_[3],M=_[4],R=_[5],F=_[6],O=_[7],T=_[8];return this.elements[0]=g*A+p*C+m*F,this.elements[1]=g*E+p*M+m*O,this.elements[2]=g*k+p*R+m*T,this.elements[3]=v*A+y*C+x*F,this.elements[4]=v*E+y*M+x*O,this.elements[5]=v*k+y*R+x*T,this.elements[6]=b*A+w*C+S*F,this.elements[7]=b*E+w*M+S*O,this.elements[8]=b*k+w*R+S*T,this.trigger(t.Events.change)},inverse:function(e){var i=this.elements;e=e||new t.Matrix;var r=i[0],n=i[1],s=i[2],a=i[3],o=i[4],l=i[5],h=i[6],c=i[7],d=i[8],u=d*o-l*c,f=-d*a+l*h,_=c*a-o*h,g=r*u+n*f+s*_;return g?(g=1/g,e.elements[0]=u*g,e.elements[1]=(-d*n+s*c)*g,e.elements[2]=(l*n-s*o)*g,e.elements[3]=f*g,e.elements[4]=(d*r-s*h)*g,e.elements[5]=(-l*r+s*a)*g,e.elements[6]=_*g,e.elements[7]=(-c*r+n*h)*g,e.elements[8]=(o*r-n*a)*g,e):null},scale:function(t,e){return arguments.length<=1&&(e=t),this.multiply(t,0,0,0,e,0,0,0,1)},rotate:function(t){var r=e(t),n=i(t);return this.multiply(r,-n,0,n,r,0,0,0,1)},translate:function(t,e){return this.multiply(1,0,t,0,1,e,0,0,1)},skewX:function(t){var e=r(t);return this.multiply(1,e,0,0,1,0,0,0,1)},skewY:function(t){var e=r(t);return this.multiply(1,0,0,e,1,0,0,0,1)},toString:function(t){var e=[];return this.toArray(t,e),e.join(" ")},toArray:function(t,e){var i=this.elements,r=!!e,n=parseFloat(i[0].toFixed(3)),s=parseFloat(i[1].toFixed(3)),a=parseFloat(i[2].toFixed(3)),o=parseFloat(i[3].toFixed(3)),l=parseFloat(i[4].toFixed(3)),h=parseFloat(i[5].toFixed(3));if(t){var c=parseFloat(i[6].toFixed(3)),d=parseFloat(i[7].toFixed(3)),u=parseFloat(i[8].toFixed(3));return r?(e[0]=n,e[1]=o,e[2]=c,e[3]=s,e[4]=l,e[5]=d,e[6]=a,e[7]=h,void(e[8]=u)):[n,o,c,s,l,d,a,h,u]}return r?(e[0]=n,e[1]=o,e[2]=s,e[3]=l,e[4]=a,void(e[5]=h)):[n,o,s,l,a,h]},clone:function(){var e,i,r,n,s,a,o,l,h;return e=this.elements[0],i=this.elements[1],r=this.elements[2],n=this.elements[3],s=this.elements[4],a=this.elements[5],o=this.elements[6],l=this.elements[7],h=this.elements[8],new t.Matrix(e,i,r,n,s,a,o,l,h)}})}((void 0!==i?i:this).Two),function(t){var e=t.Utils.mod,i=t.Utils.toFixed,r=t.Utils,n={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},createElement:function(t,e){var i=t,s=document.createElementNS(n.ns,i);return"svg"===i&&(e=r.defaults(e||{},{version:n.version})),r.isEmpty(e)||n.setAttributes(s,e),s},setAttributes:function(t,e){for(var i=Object.keys(e),r=0;r<i.length;r++)/href/.test(i[r])?t.setAttributeNS(n.xlink,i[r],e[i[r]]):t.setAttribute(i[r],e[i[r]]);return this},removeAttributes:function(t,e){for(var i in e)t.removeAttribute(i);return this},toString:function(r,n){for(var s,a=r.length,o=a-1,l="",h=0;h<a;h++){var c,d,u,f,_,g,p,m,v,y=r[h],x=n?e(h-1,a):Math.max(h-1,0),b=n?e(h+1,a):Math.min(h+1,o),w=r[x],S=r[b],A=i(y._x),E=i(y._y);switch(y._command){case t.Commands.close:c=t.Commands.close;break;case t.Commands.curve:g=w.controls&&w.controls.right||t.Vector.zero,p=y.controls&&y.controls.left||t.Vector.zero,w._relative?(d=i(g.x+w.x),u=i(g.y+w.y)):(d=i(g.x),u=i(g.y)),y._relative?(f=i(p.x+y.x),_=i(p.y+y.y)):(f=i(p.x),_=i(p.y)),c=(0===h?t.Commands.move:t.Commands.curve)+" "+d+" "+u+" "+f+" "+_+" "+A+" "+E;break;case t.Commands.move:s=y,c=t.Commands.move+" "+A+" "+E;break;default:c=y._command+" "+A+" "+E}h>=o&&n&&(y._command===t.Commands.curve&&(S=s,m=y.controls&&y.controls.right||y,v=S.controls&&S.controls.left||S,y._relative?(d=i(m.x+y.x),u=i(m.y+y.y)):(d=i(m.x),u=i(m.y)),S._relative?(f=i(v.x+S.x),_=i(v.y+S.y)):(f=i(v.x),_=i(v.y)),c+=" C "+d+" "+u+" "+f+" "+_+" "+(A=i(S.x))+" "+(E=i(S.y))),c+=" Z"),l+=c+" "}return l},getClip:function(t){var e=t._renderer.clip;if(!e){for(var i=t;i.parent;)i=i.parent;e=t._renderer.clip=n.createElement("clipPath"),i.defs.appendChild(e)}return e},group:{appendChild:function(t){var e=t._renderer.elem;if(e){var i=e.nodeName;!i||/(radial|linear)gradient/i.test(i)||t._clip||this.elem.appendChild(e)}},removeChild:function(t){var e=t._renderer.elem;e&&e.parentNode==this.elem&&(e.nodeName&&(t._clip||this.elem.removeChild(e)))},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){n[t._renderer.type].render.call(t,this)},render:function(t){if(this._update(),0===this._opacity&&!this._flagOpacity)return this;this._renderer.elem||(this._renderer.elem=n.createElement("g",{id:this.id}),t.appendChild(this._renderer.elem));var e=this._matrix.manual||this._flagMatrix,i={domElement:t,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(var r=0;r<this.children.length;r++){var s=this.children[r];n[s._renderer.type].render.call(s,t)}return this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagAdditions&&this.additions.forEach(n.group.appendChild,i),this._flagSubtractions&&this.subtractions.forEach(n.group.removeChild,i),this._flagOrder&&this.children.forEach(n.group.orderChild,i),this._flagMask&&(this._mask?this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")"):this._renderer.elem.removeAttribute("clip-path")),this.flagReset()}},path:{render:function(t){if(this._update(),0===this._opacity&&!this._flagOpacity)return this;var e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagVertices){var i=n.toString(this._vertices,this._closed);e.d=i}if(this._fill&&this._fill._renderer&&(this._fill._update(),n[this._fill._renderer.type].render.call(this._fill,t,!0)),this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),n[this._stroke._renderer.type].render.call(this._stroke,t,!0)),this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(e["stroke-width"]=this._linewidth),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this._renderer.elem?n.setAttributes(this._renderer.elem,e):(e.id=this.id,this._renderer.elem=n.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){var r=n.getClip(this),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}return this.flagReset()}},text:{render:function(t){this._update();var e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=n.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["alignment-baseline"]=e["dominant-baseline"]=this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),n[this._fill._renderer.type].render.call(this._fill,t,!0)),this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),n[this._stroke._renderer.type].render.call(this._stroke,t,!0)),this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(e["stroke-width"]=this._linewidth),this._flagOpacity&&(e.opacity=this._opacity),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._renderer.elem?n.setAttributes(this._renderer.elem,e):(e.id=this.id,this._renderer.elem=n.createElement("text",e),t.defs.appendChild(this._renderer.elem)),this._flagClip){var i=n.getClip(this),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),i.setAttribute("id",this.id),i.appendChild(r)):(i.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,e){e||this._update();var i={};if(this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._renderer.elem?n.setAttributes(this._renderer.elem,i):(i.id=this.id,i.gradientUnits="userSpaceOnUse",this._renderer.elem=n.createElement("linearGradient",i),t.defs.appendChild(this._renderer.elem)),this._flagStops){var r=this._renderer.elem.childNodes.length!==this.stops.length;r&&(this._renderer.elem.childNodes.length=0);for(var s=0;s<this.stops.length;s++){var a=this.stops[s],o={};a._flagOffset&&(o.offset=100*a._offset+"%"),a._flagColor&&(o["stop-color"]=a._color),a._flagOpacity&&(o["stop-opacity"]=a._opacity),a._renderer.elem?n.setAttributes(a._renderer.elem,o):a._renderer.elem=n.createElement("stop",o),r&&this._renderer.elem.appendChild(a._renderer.elem),a.flagReset()}}return this.flagReset()}},"radial-gradient":{render:function(t,e){e||this._update();var i={};if(this._flagCenter&&(i.cx=this.center._x,i.cy=this.center._y),this._flagFocal&&(i.fx=this.focal._x,i.fy=this.focal._y),this._flagRadius&&(i.r=this._radius),this._flagSpread&&(i.spreadMethod=this._spread),this._renderer.elem?n.setAttributes(this._renderer.elem,i):(i.id=this.id,i.gradientUnits="userSpaceOnUse",this._renderer.elem=n.createElement("radialGradient",i),t.defs.appendChild(this._renderer.elem)),this._flagStops){var r=this._renderer.elem.childNodes.length!==this.stops.length;r&&(this._renderer.elem.childNodes.length=0);for(var s=0;s<this.stops.length;s++){var a=this.stops[s],o={};a._flagOffset&&(o.offset=100*a._offset+"%"),a._flagColor&&(o["stop-color"]=a._color),a._flagOpacity&&(o["stop-opacity"]=a._opacity),a._renderer.elem?n.setAttributes(a._renderer.elem,o):a._renderer.elem=n.createElement("stop",o),r&&this._renderer.elem.appendChild(a._renderer.elem),a.flagReset()}}return this.flagReset()}},texture:{render:function(e,i){i||this._update();var s={},a={x:0,y:0},o=this.image;if(this._flagLoaded&&this.loaded)switch(o.nodeName.toLowerCase()){case"canvas":a.href=a["xlink:href"]=o.toDataURL("image/png");break;case"img":case"image":a.href=a["xlink:href"]=this.src}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(s.x=this._offset.x,s.y=this._offset.y,o&&(s.x-=o.width/2,s.y-=o.height/2,this._scale instanceof t.Vector?(s.x*=this._scale.x,s.y*=this._scale.y):(s.x*=this._scale,s.y*=this._scale)),s.x>0&&(s.x*=-1),s.y>0&&(s.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(s.width=0,s.height=0,o)){switch(a.width=s.width=o.width,a.height=s.height=o.height,this._repeat){case"no-repeat":s.width+=1,s.height+=1}this._scale instanceof t.Vector?(s.width*=this._scale.x,s.height*=this._scale.y):(s.width*=this._scale,s.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?r.isEmpty(a)||n.setAttributes(this._renderer.image,a):this._renderer.image=n.createElement("image",a)),this._renderer.elem?r.isEmpty(s)||n.setAttributes(this._renderer.elem,s):(s.id=this.id,s.patternUnits="userSpaceOnUse",this._renderer.elem=n.createElement("pattern",s),e.defs.appendChild(this._renderer.elem)),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),this.flagReset()}}},s=t[t.Types.svg]=function(e){this.domElement=e.domElement||n.createElement("svg"),this.scene=new t.Group,this.scene.parent=this,this.defs=n.createElement("defs"),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"};r.extend(s,{Utils:n}),r.extend(s.prototype,t.Utils.Events,{setSize:function(t,e){return this.width=t,this.height=e,n.setAttributes(this.domElement,{width:t,height:e}),this},render:function(){return n.group.render.call(this.scene,this.domElement),this}})}((void 0!==i?i:this).Two),function(t){var e=t.Utils.mod,i=t.Utils.toFixed,r=t.Utils.getRatio,n=t.Utils,s=function(t){return 1==t[0]&&0==t[3]&&0==t[1]&&1==t[4]&&0==t[2]&&0==t[5]},a={isHidden:/(none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},shim:function(t){return t.tagName="canvas",t.nodeType=1,t},group:{renderChild:function(t){a[t._renderer.type].render.call(t,this.ctx,!0,this.clip)},render:function(t){this._update();var e=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);var r=s(e),n=this._mask;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,r||(t.save(),t.transform(e[0],e[3],e[1],e[4],e[2],e[5])),n&&a[n._renderer.type].render.call(n,t,!0),this.opacity>0&&0!==this.scale)for(var o=0;o<this.children.length;o++){var l=this.children[o];a[l._renderer.type].render.call(l,t)}return r||t.restore(),this.flagReset()}},path:{render:function(r,o,l){var h,c,d,u,f,_,g,p,m,v,y,x,b,w,S,A,E,k,C,M,R,F,O,T,L,P,U,I,N,j,D,B;if(this._update(),h=this._matrix.elements,c=this._stroke,d=this._linewidth,u=this._fill,f=this._opacity*this.parent._renderer.opacity,_=this._visible,g=this._cap,p=this._join,m=this._miter,v=this._closed,b=(x=(y=this._vertices).length)-1,D=s(h),j=this._clip,!o&&(!_||j))return this;D||(r.save(),r.transform(h[0],h[3],h[1],h[4],h[2],h[5])),u&&(n.isString(u)?r.fillStyle=u:(a[u._renderer.type].render.call(u,r),r.fillStyle=u._renderer.effect)),c&&(n.isString(c)?r.strokeStyle=c:(a[c._renderer.type].render.call(c,r),r.strokeStyle=c._renderer.effect)),d&&(r.lineWidth=d),m&&(r.miterLimit=m),p&&(r.lineJoin=p),g&&(r.lineCap=g),n.isNumber(f)&&(r.globalAlpha=f),r.beginPath();for(var G=0;G<y.length;G++)switch(E=y[G],I=i(E._x),N=i(E._y),E._command){case t.Commands.close:r.closePath();break;case t.Commands.curve:S=v?e(G-1,x):Math.max(G-1,0),w=v?e(G+1,x):Math.min(G+1,b),A=y[S],k=y[w],T=A.controls&&A.controls.right||t.Vector.zero,L=E.controls&&E.controls.left||t.Vector.zero,A._relative?(F=T.x+i(A._x),O=T.y+i(A._y)):(F=i(T.x),O=i(T.y)),E._relative?(M=L.x+i(E._x),R=L.y+i(E._y)):(M=i(L.x),R=i(L.y)),r.bezierCurveTo(F,O,M,R,I,N),G>=b&&v&&(k=C,P=E.controls&&E.controls.right||t.Vector.zero,U=k.controls&&k.controls.left||t.Vector.zero,E._relative?(F=P.x+i(E._x),O=P.y+i(E._y)):(F=i(P.x),O=i(P.y)),k._relative?(M=U.x+i(k._x),R=U.y+i(k._y)):(M=i(U.x),R=i(U.y)),I=i(k._x),N=i(k._y),r.bezierCurveTo(F,O,M,R,I,N));break;case t.Commands.line:r.lineTo(I,N);break;case t.Commands.move:C=E,r.moveTo(I,N)}return v&&r.closePath(),j||l||(a.isHidden.test(u)||((B=u._renderer&&u._renderer.offset)&&(r.save(),r.translate(-u._renderer.offset.x,-u._renderer.offset.y),r.scale(u._renderer.scale.x,u._renderer.scale.y)),r.fill(),B&&r.restore()),a.isHidden.test(c)||((B=c._renderer&&c._renderer.offset)&&(r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(c._renderer.scale.x,c._renderer.scale.y),r.lineWidth=d/c._renderer.scale.x),r.stroke(),B&&r.restore())),D||r.restore(),j&&!l&&r.clip(),this.flagReset()}},text:{render:function(t,e,r){this._update();var o,l,h,c,d,u,f,_=this._matrix.elements,g=this._stroke,p=this._linewidth,m=this._fill,v=this._opacity*this.parent._renderer.opacity,y=this._visible,x=s(_),b=m._renderer&&m._renderer.offset&&g._renderer&&g._renderer.offset,w=this._clip;return e||y&&!w?(x||(t.save(),t.transform(_[0],_[3],_[1],_[4],_[2],_[5])),b||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=a.alignments[this._alignment]||this._alignment,t.textBaseline=this._baseline,m&&(n.isString(m)?t.fillStyle=m:(a[m._renderer.type].render.call(m,t),t.fillStyle=m._renderer.effect)),g&&(n.isString(g)?t.strokeStyle=g:(a[g._renderer.type].render.call(g,t),t.strokeStyle=g._renderer.effect)),p&&(t.lineWidth=p),n.isNumber(v)&&(t.globalAlpha=v),w||r||(a.isHidden.test(m)||(m._renderer&&m._renderer.offset?(u=i(m._renderer.scale.x),f=i(m._renderer.scale.y),t.save(),t.translate(-i(m._renderer.offset.x),-i(m._renderer.offset.y)),t.scale(u,f),o=this._size/m._renderer.scale.y,l=this._leading/m._renderer.scale.y,t.font=[this._style,this._weight,i(o)+"px/",i(l)+"px",this._family].join(" "),h=m._renderer.offset.x/m._renderer.scale.x,c=m._renderer.offset.y/m._renderer.scale.y,t.fillText(this.value,i(h),i(c)),t.restore()):t.fillText(this.value,0,0)),a.isHidden.test(g)||(g._renderer&&g._renderer.offset?(u=i(g._renderer.scale.x),f=i(g._renderer.scale.y),t.save(),t.translate(-i(g._renderer.offset.x),-i(g._renderer.offset.y)),t.scale(u,f),o=this._size/g._renderer.scale.y,l=this._leading/g._renderer.scale.y,t.font=[this._style,this._weight,i(o)+"px/",i(l)+"px",this._family].join(" "),h=g._renderer.offset.x/g._renderer.scale.x,c=g._renderer.offset.y/g._renderer.scale.y,d=p/g._renderer.scale.x,t.lineWidth=i(d),t.strokeText(this.value,i(h),i(c)),t.restore()):t.strokeText(this.value,0,0))),x||t.restore(),w&&!r&&t.clip(),this.flagReset()):this}},"linear-gradient":{render:function(t){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var e=0;e<this.stops.length;e++){var i=this.stops[e];this._renderer.effect.addColorStop(i._offset,i._color)}}return this.flagReset()}},"radial-gradient":{render:function(t){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops){this._renderer.effect=t.createRadialGradient(this.center._x,this.center._y,0,this.focal._x,this.focal._y,this._radius);for(var e=0;e<this.stops.length;e++){var i=this.stops[e];this._renderer.effect.addColorStop(i._offset,i._color)}}return this.flagReset()}},texture:{render:function(e){this._update();var i=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=e.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof t.Vector||(this._renderer.offset=new t.Vector),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,i&&(this._renderer.offset.x+=i.width/2,this._renderer.offset.y+=i.height/2,this._scale instanceof t.Vector?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof t.Vector||(this._renderer.scale=new t.Vector),this._scale instanceof t.Vector?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}}},o=t[t.Types.canvas]=function(e){var i=!1!==e.smoothing;this.domElement=e.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=e.overdraw||!1,n.isUndefined(this.ctx.imageSmoothingEnabled)||(this.ctx.imageSmoothingEnabled=i),this.scene=new t.Group,this.scene.parent=this};n.extend(o,{Utils:a}),n.extend(o.prototype,t.Utils.Events,{setSize:function(t,e,i){return this.width=t,this.height=e,this.ratio=n.isUndefined(i)?r(this.ctx):i,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&n.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this},render:function(){var t=1===this.ratio;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),a.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}})}((void 0!==i?i:this).Two),function(t){var e=t.root,i=t.Matrix.Multiply,r=t.Utils.mod,n=[1,0,0,0,1,0,0,0,1],s=new t.Array(9),a=t.Utils.getRatio,o=(t.Utils.getComputedMatrix,t.Utils.toFixed),l=t.Utils,h={isHidden:/(none|transparent)/i,canvas:e.document?e.document.createElement("canvas"):{getContext:l.identity},alignments:{left:"start",middle:"center",right:"end"},matrix:new t.Matrix,uv:new t.Array([0,0,1,0,0,1,0,1,1,0,1,1]),group:{removeChild:function(t,e){if(t.children)for(var i=0;i<t.children.length;i++)h.group.removeChild(t.children[i],e);else e.deleteTexture(t._renderer.texture),delete t._renderer.texture},renderChild:function(t){h[t._renderer.type].render.call(t,this.gl,this.program)},render:function(e,r){this._update();var n=this.parent,a=n._matrix&&n._matrix.manual||n._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((a||o)&&(this._renderer.matrix||(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,s),i(s,n._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*n._renderer.scale,a&&(this._flagMatrix=!0)),this._mask&&(e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,1),e.colorMask(!1,!1,!1,!0),e.stencilOp(e.KEEP,e.KEEP,e.INCR),h[this._mask._renderer.type].render.call(this._mask,e,r,this),e.colorMask(!0,!0,!0,!0),e.stencilFunc(e.NOTEQUAL,0,1),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)),this._flagOpacity=n._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1),this._flagSubtractions)for(var l=0;l<this.subtractions.length;l++)h.group.removeChild(this.subtractions[l],e);return this.children.forEach(h.group.renderChild,{gl:e,program:r}),this._mask&&(e.colorMask(!1,!1,!1,!1),e.stencilOp(e.KEEP,e.KEEP,e.DECR),h[this._mask._renderer.type].render.call(this._mask,e,r,this),e.colorMask(!0,!0,!0,!0),e.stencilFunc(e.NOTEQUAL,0,1),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.disable(e.STENCIL_TEST)),this.flagReset()}},path:{updateCanvas:function(e){var i,n,s,a,c,d,u,f,_,g,p,m,v,y,x,w=e._vertices,S=this.canvas,A=this.ctx,E=e._renderer.scale,k=e._stroke,C=e._linewidth,M=e._fill,R=e._renderer.opacity||e._opacity,F=e._cap,O=e._join,T=e._miter,L=e._closed,P=w.length,U=P-1;S.width=Math.max(Math.ceil(e._renderer.rect.width*E),1),S.height=Math.max(Math.ceil(e._renderer.rect.height*E),1);var I,N=e._renderer.rect.centroid,j=N.x,D=N.y;A.clearRect(0,0,S.width,S.height),M&&(l.isString(M)?A.fillStyle=M:(h[M._renderer.type].render.call(M,A,e),A.fillStyle=M._renderer.effect)),k&&(l.isString(k)?A.strokeStyle=k:(h[k._renderer.type].render.call(k,A,e),A.strokeStyle=k._renderer.effect)),C&&(A.lineWidth=C),T&&(A.miterLimit=T),O&&(A.lineJoin=O),F&&(A.lineCap=F),l.isNumber(R)&&(A.globalAlpha=R),A.save(),A.scale(E,E),A.translate(j,D),A.beginPath();for(var B=0;B<w.length;B++)switch(b=w[B],v=o(b._x),y=o(b._y),b._command){case t.Commands.close:A.closePath();break;case t.Commands.curve:n=L?r(B-1,P):Math.max(B-1,0),i=L?r(B+1,P):Math.min(B+1,U),s=w[n],a=w[i],_=s.controls&&s.controls.right||t.Vector.zero,g=b.controls&&b.controls.left||t.Vector.zero,s._relative?(u=o(_.x+s._x),f=o(_.y+s._y)):(u=o(_.x),f=o(_.y)),b._relative?(c=o(g.x+b._x),d=o(g.y+b._y)):(c=o(g.x),d=o(g.y)),A.bezierCurveTo(u,f,c,d,v,y),B>=U&&L&&(a=I,p=b.controls&&b.controls.right||t.Vector.zero,m=a.controls&&a.controls.left||t.Vector.zero,b._relative?(u=o(p.x+b._x),f=o(p.y+b._y)):(u=o(p.x),f=o(p.y)),a._relative?(c=o(m.x+a._x),d=o(m.y+a._y)):(c=o(m.x),d=o(m.y)),v=o(a._x),y=o(a._y),A.bezierCurveTo(u,f,c,d,v,y));break;case t.Commands.line:A.lineTo(v,y);break;case t.Commands.move:I=b,A.moveTo(v,y)}L&&A.closePath(),h.isHidden.test(M)||((x=M._renderer&&M._renderer.offset)&&(A.save(),A.translate(-M._renderer.offset.x,-M._renderer.offset.y),A.scale(M._renderer.scale.x,M._renderer.scale.y)),A.fill(),x&&A.restore()),h.isHidden.test(k)||((x=k._renderer&&k._renderer.offset)&&(A.save(),A.translate(-k._renderer.offset.x,-k._renderer.offset.y),A.scale(k._renderer.scale.x,k._renderer.scale.y),A.lineWidth=C/k._renderer.scale.x),A.stroke(),x&&A.restore()),A.restore()},getBoundingClientRect:function(t,e,i){var r,n,s=1/0,a=-1/0,o=1/0,h=-1/0;t.forEach(function(t){var e,i,r,n,l,c,d=t.x,u=t.y,f=t.controls;o=Math.min(u,o),s=Math.min(d,s),a=Math.max(d,a),h=Math.max(u,h),t.controls&&(l=f.left,c=f.right,l&&c&&(e=t._relative?l.x+d:l.x,i=t._relative?l.y+u:l.y,r=t._relative?c.x+d:c.x,n=t._relative?c.y+u:c.y,e&&i&&r&&n&&(o=Math.min(i,n,o),s=Math.min(e,r,s),a=Math.max(e,r,a),h=Math.max(i,n,h))))}),l.isNumber(e)&&(o-=e,s-=e,a+=e,h+=e),r=a-s,n=h-o,i.top=o,i.left=s,i.right=a,i.bottom=h,i.width=r,i.height=n,i.centroid||(i.centroid={}),i.centroid.x=-s,i.centroid.y=-o},render:function(e,r,n){if(!this._visible||!this._opacity)return this;this._update();var a=this.parent,o=a._matrix.manual||a._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof t.Texture&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||a._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||!this._renderer.texture;return(o||l)&&(this._renderer.matrix||(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,s),i(s,a._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*a._renderer.scale),c&&(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*a._renderer.opacity,h.path.getBoundingClientRect(this._vertices,this._linewidth,this._renderer.rect),h.getTriangles(this._renderer.rect,this._renderer.triangles),h.updateBuffer.call(h,e,this,r),h.updateTexture.call(h,e,this)),!this._clip||n?(e.bindBuffer(e.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),e.vertexAttribPointer(r.textureCoords,2,e.FLOAT,!1,0,0),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.buffer),e.vertexAttribPointer(r.position,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),this.flagReset()):void 0}},text:{updateCanvas:function(t){var e=this.canvas,i=this.ctx,r=t._renderer.scale,n=t._stroke,s=t._linewidth*r,a=t._fill,c=t._renderer.opacity||t._opacity;e.width=Math.max(Math.ceil(t._renderer.rect.width*r),1),e.height=Math.max(Math.ceil(t._renderer.rect.height*r),1);var d,u,f,_,g,p,m,v=t._renderer.rect.centroid,y=v.x,x=v.y,b=a._renderer&&a._renderer.offset&&n._renderer&&n._renderer.offset;i.clearRect(0,0,e.width,e.height),b||(i.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" ")),i.textAlign="center",i.textBaseline="middle",a&&(l.isString(a)?i.fillStyle=a:(h[a._renderer.type].render.call(a,i,t),i.fillStyle=a._renderer.effect)),n&&(l.isString(n)?i.strokeStyle=n:(h[n._renderer.type].render.call(n,i,t),i.strokeStyle=n._renderer.effect)),s&&(i.lineWidth=s),l.isNumber(c)&&(i.globalAlpha=c),i.save(),i.scale(r,r),i.translate(y,x),h.isHidden.test(a)||(a._renderer&&a._renderer.offset?(p=o(a._renderer.scale.x),m=o(a._renderer.scale.y),i.save(),i.translate(-o(a._renderer.offset.x),-o(a._renderer.offset.y)),i.scale(p,m),d=t._size/a._renderer.scale.y,u=t._leading/a._renderer.scale.y,i.font=[t._style,t._weight,o(d)+"px/",o(u)+"px",t._family].join(" "),f=a._renderer.offset.x/a._renderer.scale.x,_=a._renderer.offset.y/a._renderer.scale.y,i.fillText(t.value,o(f),o(_)),i.restore()):i.fillText(t.value,0,0)),h.isHidden.test(n)||(n._renderer&&n._renderer.offset?(p=o(n._renderer.scale.x),m=o(n._renderer.scale.y),i.save(),i.translate(-o(n._renderer.offset.x),-o(n._renderer.offset.y)),i.scale(p,m),d=t._size/n._renderer.scale.y,u=t._leading/n._renderer.scale.y,i.font=[t._style,t._weight,o(d)+"px/",o(u)+"px",t._family].join(" "),f=n._renderer.offset.x/n._renderer.scale.x,_=n._renderer.offset.y/n._renderer.scale.y,g=s/n._renderer.scale.x,i.lineWidth=o(g),i.strokeText(t.value,o(f),o(_)),i.restore()):i.strokeText(t.value,0,0)),i.restore()},getBoundingClientRect:function(t,e){var i=h.ctx;i.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),i.textAlign="center",i.textBaseline=t._baseline;var r=i.measureText(t._value).width,n=Math.max(t._size||t._leading);this._linewidth&&!h.isHidden.test(this._stroke)&&(n+=this._linewidth);var s=r/2,a=n/2;switch(h.alignments[t._alignment]||t._alignment){case h.alignments.left:e.left=0,e.right=r;break;case h.alignments.right:e.left=-r,e.right=0;break;default:e.left=-s,e.right=s}switch(t._baseline){case"bottom":e.top=-n,e.bottom=0;break;case"top":e.top=0,e.bottom=n;break;default:e.top=-a,e.bottom=a}e.width=r,e.height=n,e.centroid||(e.centroid={}),e.centroid.x=s,e.centroid.y=a},render:function(e,r,n){if(!this._visible||!this._opacity)return this;this._update();var a=this.parent,o=a._matrix.manual||a._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._flagVertices||this._flagFill||this._fill instanceof t.LinearGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof t.RadialGradient&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof t.Texture&&this._fill._flagLoaded&&this._fill.loaded||this._stroke instanceof t.LinearGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof t.RadialGradient&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._texture instanceof t.Texture&&this._texture._flagLoaded&&this._texture.loaded||this._flagStroke||this._flagLinewidth||this._flagOpacity||a._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||!this._renderer.texture;return(o||l)&&(this._renderer.matrix||(this._renderer.matrix=new t.Array(9)),this._matrix.toArray(!0,s),i(s,a._renderer.matrix,this._renderer.matrix),this._renderer.scale=this._scale*a._renderer.scale),c&&(this._renderer.rect||(this._renderer.rect={}),this._renderer.triangles||(this._renderer.triangles=new t.Array(12)),this._renderer.opacity=this._opacity*a._renderer.opacity,h.text.getBoundingClientRect(this,this._renderer.rect),h.getTriangles(this._renderer.rect,this._renderer.triangles),h.updateBuffer.call(h,e,this,r),h.updateTexture.call(h,e,this)),!this._clip||n?(e.bindBuffer(e.ARRAY_BUFFER,this._renderer.textureCoordsBuffer),e.vertexAttribPointer(r.textureCoords,2,e.FLOAT,!1,0,0),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(r.matrix,!1,this._renderer.matrix),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.buffer),e.vertexAttribPointer(r.position,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),this.flagReset()):void 0}},"linear-gradient":{render:function(t,e){if(t.canvas.getContext("2d")){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=t.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var i=0;i<this.stops.length;i++){var r=this.stops[i];this._renderer.effect.addColorStop(r._offset,r._color)}}return this.flagReset()}}},"radial-gradient":{render:function(t,e){if(t.canvas.getContext("2d")){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops){this._renderer.effect=t.createRadialGradient(this.center._x,this.center._y,0,this.focal._x,this.focal._y,this._radius);for(var i=0;i<this.stops.length;i++){var r=this.stops[i];this._renderer.effect.addColorStop(r._offset,r._color)}}return this.flagReset()}}},texture:{render:function(e,i){if(e.canvas.getContext("2d")){this._update();var r=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=e.createPattern(r,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof t.Vector||(this._renderer.offset=new t.Vector),this._renderer.offset.x=this._offset.x,this._renderer.offset.y=this._offset.y,r&&(this._renderer.offset.x-=r.width/2,this._renderer.offset.y+=r.height/2,this._scale instanceof t.Vector?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof t.Vector||(this._renderer.scale=new t.Vector),this._scale instanceof t.Vector?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}}},getTriangles:function(t,e){var i=t.top,r=t.left,n=t.right,s=t.bottom;e[0]=r,e[1]=i,e[2]=n,e[3]=i,e[4]=r,e[5]=s,e[6]=r,e[7]=s,e[8]=n,e[9]=i,e[10]=n,e[11]=s},updateTexture:function(t,e){this[e._renderer.type].updateCanvas.call(h,e),e._renderer.texture&&t.deleteTexture(e._renderer.texture),t.bindBuffer(t.ARRAY_BUFFER,e._renderer.textureCoordsBuffer),e._renderer.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,e._renderer.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),this.canvas.width<=0||this.canvas.height<=0||t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.canvas)},updateBuffer:function(t,e,i){l.isObject(e._renderer.buffer)&&t.deleteBuffer(e._renderer.buffer),e._renderer.buffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,e._renderer.buffer),t.enableVertexAttribArray(i.position),t.bufferData(t.ARRAY_BUFFER,e._renderer.triangles,t.STATIC_DRAW),l.isObject(e._renderer.textureCoordsBuffer)&&t.deleteBuffer(e._renderer.textureCoordsBuffer),e._renderer.textureCoordsBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,e._renderer.textureCoordsBuffer),t.enableVertexAttribArray(i.textureCoords),t.bufferData(t.ARRAY_BUFFER,this.uv,t.STATIC_DRAW)},program:{create:function(e,i){var r,n;if(r=e.createProgram(),l.each(i,function(t){e.attachShader(r,t)}),e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw n=e.getProgramInfoLog(r),e.deleteProgram(r),new t.Utils.Error("unable to link program: "+n);return r}},shaders:{create:function(e,i,r){var n,s;if(n=e.createShader(e[r]),e.shaderSource(n,i),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))throw s=e.getShaderInfoLog(n),e.deleteShader(n),new t.Utils.Error("unable to compile shader "+n+": "+s);return n},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},vertex:["attribute vec2 a_position;","attribute vec2 a_textureCoords;","","uniform mat3 u_matrix;","uniform vec2 u_resolution;","","varying vec2 v_textureCoords;","","void main() {"," vec2 projected = (u_matrix * vec3(a_position, 1.0)).xy;"," vec2 normal = projected / u_resolution;"," vec2 clipspace = (normal * 2.0) - 1.0;",""," gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0);"," v_textureCoords = a_textureCoords;","}"].join("\n"),fragment:["precision mediump float;","","uniform sampler2D u_image;","varying vec2 v_textureCoords;","","void main() {"," gl_FragColor = texture2D(u_image, v_textureCoords);","}"].join("\n")},TextureRegistry:new t.Registry};h.ctx=h.canvas.getContext("2d");var c=t[t.Types.webgl]=function(e){var i,r,s,a;if(this.domElement=e.domElement||document.createElement("canvas"),this.scene=new t.Group,this.scene.parent=this,this._renderer={matrix:new t.Array(n),scale:1,opacity:1},this._flagMatrix=!0,i=l.defaults(e||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=i.overdraw,r=this.ctx=this.domElement.getContext("webgl",i)||this.domElement.getContext("experimental-webgl",i),!this.ctx)throw new t.Utils.Error("unable to create a webgl context. Try using another renderer.");s=h.shaders.create(r,h.shaders.vertex,h.shaders.types.vertex),a=h.shaders.create(r,h.shaders.fragment,h.shaders.types.fragment),this.program=h.program.create(r,[s,a]),r.useProgram(this.program),this.program.position=r.getAttribLocation(this.program,"a_position"),this.program.matrix=r.getUniformLocation(this.program,"u_matrix"),this.program.textureCoords=r.getAttribLocation(this.program,"a_textureCoords"),r.disable(r.DEPTH_TEST),r.enable(r.BLEND),r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA)};l.extend(c,{Utils:h}),l.extend(c.prototype,t.Utils.Events,{setSize:function(t,e,i){this.width=t,this.height=e,this.ratio=l.isUndefined(i)?a(this.ctx):i,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,l.extend(this.domElement.style,{width:t+"px",height:e+"px"}),t*=this.ratio,e*=this.ratio,this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,this.ctx.viewport(0,0,t,e);var r=this.ctx.getUniformLocation(this.program,"u_resolution");return this.ctx.uniform2f(r,t,e),this},render:function(){var t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),h.group.render.call(this.scene,t,this.program),this._flagMatrix=!1,this}})}((void 0!==i?i:this).Two),function(t){var e=t.Utils,i=t.Shape=function(){this._renderer={},this._renderer.flagMatrix=e.bind(i.FlagMatrix,this),this.isShape=!0,this.id=t.Identifier+t.uniqueId(),this.classList=[],this._matrix=new t.Matrix,this.translation=new t.Vector,this.rotation=0,this.scale=1};e.extend(i,{FlagMatrix:function(){this._flagMatrix=!0},MakeObservable:function(e){Object.defineProperty(e,"translation",{enumerable:!0,get:function(){return this._translation},set:function(e){this._translation&&this._translation.unbind(t.Events.change,this._renderer.flagMatrix),this._translation=e,this._translation.bind(t.Events.change,this._renderer.flagMatrix),i.FlagMatrix.call(this)}}),Object.defineProperty(e,"rotation",{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}}),Object.defineProperty(e,"scale",{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof t.Vector&&this._scale.unbind(t.Events.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof t.Vector&&this._scale.bind(t.Events.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}})}}),e.extend(i.prototype,t.Utils.Events,{_flagMatrix:!0,_flagScale:!1,_rotation:0,_scale:1,_translation:null,addTo:function(t){return t.add(this),this},clone:function(){var t=new i;return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,e.each(i.Properties,function(e){t[e]=this[e]},this),t._update()},_update:function(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.translation.x,this.translation.y),this._scale instanceof t.Vector?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.rotate(this.rotation)),e&&this.parent&&this.parent._update&&this.parent._update(),this},flagReset:function(){return this._flagMatrix=this._flagScale=!1,this}}),i.MakeObservable(i.prototype)}((void 0!==i?i:this).Two),function(t){var e=Math.min,i=Math.max,r=Math.round,n=t.Utils.getComputedMatrix,s={},a=t.Utils;a.each(t.Commands,function(t,e){s[e]=new RegExp(t)});var o=t.Path=function(e,i,r,n){t.Shape.call(this),this._renderer.type="path",this._renderer.flagVertices=a.bind(o.FlagVertices,this),this._renderer.bindVertices=a.bind(o.BindVertices,this),this._renderer.unbindVertices=a.bind(o.UnbindVertices,this),this._renderer.flagFill=a.bind(o.FlagFill,this),this._renderer.flagStroke=a.bind(o.FlagStroke,this),this._closed=!!i,this._curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this._vertices=[],this.vertices=e,this.automatic=!n};function l(e,i,r){var n,s,a,o,l,h,c,d,u=i.controls&&i.controls.right,f=e.controls&&e.controls.left;return n=i.x,l=i.y,s=(u||i).x,h=(u||i).y,a=(f||e).x,c=(f||e).y,o=e.x,d=e.y,u&&i._relative&&(s+=i.x,h+=i.y),f&&e._relative&&(a+=e.x,c+=e.y),t.Utils.getCurveLength(n,l,s,h,a,c,o,d,r)}function h(e,i,r){var n,s,a,o,l,h,c,d,u=i.controls&&i.controls.right,f=e.controls&&e.controls.left;return n=i.x,l=i.y,s=(u||i).x,h=(u||i).y,a=(f||e).x,c=(f||e).y,o=e.x,d=e.y,u&&i._relative&&(s+=i.x,h+=i.y),f&&e._relative&&(a+=e.x,c+=e.y),t.Utils.subdivide(n,l,s,h,a,c,o,d,r)}a.extend(o,{Properties:["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending"],FlagVertices:function(){this._flagVertices=!0,this._flagLength=!0},BindVertices:function(e){for(var i=e.length;i--;)e[i].bind(t.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},UnbindVertices:function(e){for(var i=e.length;i--;)e[i].unbind(t.Events.change,this._renderer.flagVertices);this._renderer.flagVertices()},FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(e){t.Shape.MakeObservable(e),a.each(o.Properties.slice(2,8),t.Utils.defineProperty,e),Object.defineProperty(e,"fill",{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.unbind(t.Events.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.bind(t.Events.change,this._renderer.flagFill)}}),Object.defineProperty(e,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.unbind(t.Events.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.bind(t.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(e,"length",{get:function(){return this._flagLength&&this._updateLength(),this._length}}),Object.defineProperty(e,"closed",{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}}),Object.defineProperty(e,"curved",{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}}),Object.defineProperty(e,"automatic",{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t!==this._automatic){this._automatic=!!t;var e=this._automatic?"ignore":"listen";a.each(this.vertices,function(t){t[e]()})}}}),Object.defineProperty(e,"beginning",{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}}),Object.defineProperty(e,"ending",{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}}),Object.defineProperty(e,"vertices",{enumerable:!0,get:function(){return this._collection},set:function(e){this._renderer.flagVertices;var i=this._renderer.bindVertices,r=this._renderer.unbindVertices;this._collection&&this._collection.unbind(t.Events.insert,i).unbind(t.Events.remove,r),this._collection=new t.Utils.Collection((e||[]).slice(0)),this._collection.bind(t.Events.insert,i).bind(t.Events.remove,r),i(this._collection)}}),Object.defineProperty(e,"clip",{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),a.extend(o.prototype,t.Shape.prototype,{_flagVertices:!0,_flagLength:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagCap:!0,_flagJoin:!0,_flagMiter:!0,_flagClip:!1,_length: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,_clip:!1,clone:function(e){e=e||this.parent;var i=a.map(this.vertices,function(t){return t.clone()}),r=new o(i,this.closed,this.curved,!this.automatic);return a.each(t.Path.Properties,function(t){r[t]=this[t]},this),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,e&&e.add(r),r},toObject:function(){var e={vertices:a.map(this.vertices,function(t){return t.toObject()})};return a.each(t.Shape.Properties,function(t){e[t]=this[t]},this),e.translation=this.translation.toObject,e.rotation=this.rotation,e.scale=this.scale,e},noFill:function(){return this.fill="transparent",this},noStroke:function(){return this.stroke="transparent",this},corner:function(){var t=this.getBoundingClientRect(!0);return t.centroid={x:t.left+t.width/2,y:t.top+t.height/2},a.each(this.vertices,function(e){e.addSelf(t.centroid)}),this},center:function(){var t=this.getBoundingClientRect(!0);return t.centroid={x:t.left+t.width/2,y:t.top+t.height/2},a.each(this.vertices,function(e){e.subSelf(t.centroid)}),this},remove:function(){return this.parent?(this.parent.remove(this),this):this},getBoundingClientRect:function(t){var r,s,a,o,l,h,c,d=1/0,u=-1/0,f=1/0,_=-1/0;if(this._update(!0),r=t?this._matrix:n(this),s=this.linewidth/2,(a=this._vertices.length)<=0)return{top:(c=r.multiply(0,0,1)).y,left:c.x,right:c.x,bottom:c.y,width:0,height:0};for(h=0;h<a;h++)o=(c=this._vertices[h]).x,l=c.y,c=r.multiply(o,l,1),f=e(c.y-s,f),d=e(c.x-s,d),u=i(c.x+s,u),_=i(c.y+s,_);return{top:f,left:d,right:u,bottom:_,width:u-d,height:_-f}},getPointAt:function(e,i){for(var r,n,s,o,l,h,c,d,u,f,_,g,p,m,v=this.length*Math.min(Math.max(e,0),1),y=this.vertices.length,x=y-1,b=null,w=null,S=0,A=this._lengths.length,E=0;S<A;S++){if(E+this._lengths[S]>=v){this._closed?(r=t.Utils.mod(S,y),n=t.Utils.mod(S-1,y),0===S&&(r=n,n=S)):(r=S,n=Math.min(Math.max(S-1,0),x)),b=this.vertices[r],w=this.vertices[n],v-=E,0!==this._lengths[S]&&(e=v/this._lengths[S]);break}E+=this._lengths[S]}return a.isNull(b)||a.isNull(w)?null:(m=w.controls&&w.controls.right,p=b.controls&&b.controls.left,o=w.x,u=w.y,l=(m||w).x,f=(m||w).y,h=(p||b).x,_=(p||b).y,c=b.x,g=b.y,m&&w._relative&&(l+=w.x,f+=w.y),p&&b._relative&&(h+=b.x,_+=b.y),s=t.Utils.getPointOnCubicBezier(e,o,l,h,c),d=t.Utils.getPointOnCubicBezier(e,u,f,_,g),a.isObject(i)?(i.x=s,i.y=d,i):new t.Vector(s,d))},plot:function(){if(this.curved)return t.Utils.getCurveFromPoints(this._vertices,this.closed),this;for(var e=0;e<this._vertices.length;e++)this._vertices[e]._command=0===e?t.Commands.move:t.Commands.line;return this},subdivide:function(e){this._update();var i=this.vertices.length-1,r=this.vertices[i],n=this._closed||this.vertices[i]._command===t.Commands.close,s=[];return a.each(this.vertices,function(o,l){if(l<=0&&!n)r=o;else{if(o.command===t.Commands.move)return s.push(new t.Anchor(r.x,r.y)),l>0&&(s[s.length-1].command=t.Commands.line),void(r=o);var c=h(o,r,e);s=s.concat(c),a.each(c,function(e,i){i<=0&&r.command===t.Commands.move?e.command=t.Commands.move:e.command=t.Commands.line}),l>=i&&(this._closed&&this._automatic?(c=h(o,r=o,e),s=s.concat(c),a.each(c,function(e,i){i<=0&&r.command===t.Commands.move?e.command=t.Commands.move:e.command=t.Commands.line})):n&&s.push(new t.Anchor(o.x,o.y)),s[s.length-1].command=n?t.Commands.close:t.Commands.line),r=o}},this),this._automatic=!1,this._curved=!1,this.vertices=s,this},_updateLength:function(e){this._update();var i=this.vertices.length,r=i-1,n=this.vertices[r],s=this._closed||this.vertices[r]._command===t.Commands.close,o=0;return a.isUndefined(this._lengths)&&(this._lengths=[]),a.each(this.vertices,function(a,h){if(h<=0&&!s||a.command===t.Commands.move)return n=a,void(this._lengths[h]=0);this._lengths[h]=l(a,n,e),o+=this._lengths[h],h>=r&&s&&(n=this.vertices[(h+1)%i],this._lengths[h+1]=l(a,n,e),o+=this._lengths[h+1]),n=a},this),this._length=o,this},_update:function(){if(this._flagVertices){var e,i=this.vertices.length-1,n=r(this._beginning*i),s=r(this._ending*i);this._vertices.length=0;for(var a=n;a<s+1;a++)e=this.vertices[a],this._vertices.push(e);this._automatic&&this.plot()}return t.Shape.prototype._update.apply(this,arguments),this},flagReset:function(){return this._flagVertices=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=!1,t.Shape.prototype.flagReset.call(this),this}}),o.MakeObservable(o.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Path,i=t.Utils,r=t.Line=function(i,r,n,s){var a=(n-i)/2,o=(s-r)/2;e.call(this,[new t.Anchor(-a,-o),new t.Anchor(a,o)]),this.translation.set(i+a,r+o)};i.extend(r.prototype,e.prototype),e.MakeObservable(r.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Path,i=t.Utils,r=t.Rectangle=function(i,r,n,s){e.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this.width=n,this.height=s,this._update(),this.translation.set(i,r)};i.extend(r,{Properties:["width","height"],MakeObservable:function(n){e.MakeObservable(n),i.each(r.Properties,t.Utils.defineProperty,n)}}),i.extend(r.prototype,e.prototype,{_width:0,_height:0,_flagWidth:0,_flagHeight:0,_update:function(){if(this._flagWidth||this._flagHeight){var t=this._width/2,i=this._height/2;this.vertices[0].set(-t,-i),this.vertices[1].set(t,-i),this.vertices[2].set(t,i),this.vertices[3].set(-t,i)}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,e.prototype.flagReset.call(this),this}}),r.MakeObservable(r.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Path,i=2*Math.PI,r=Math.cos,n=Math.sin,s=t.Utils,a=t.Ellipse=function(i,r,n,a){s.isNumber(a)||(a=n);var o=t.Resolution,l=s.map(s.range(o),function(e){return new t.Anchor},this);e.call(this,l,!0,!0),this.width=2*n,this.height=2*a,this._update(),this.translation.set(i,r)};s.extend(a,{Properties:["width","height"],MakeObservable:function(i){e.MakeObservable(i),s.each(a.Properties,t.Utils.defineProperty,i)}}),s.extend(a.prototype,e.prototype,{_width:0,_height:0,_flagWidth:!1,_flagHeight:!1,_update:function(){if(this._flagWidth||this._flagHeight)for(var t=0,s=this.vertices.length;t<s;t++){var a=t/s*i,o=this._width*r(a)/2,l=this._height*n(a)/2;this.vertices[t].set(o,l)}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,e.prototype.flagReset.call(this),this}}),a.MakeObservable(a.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Path,i=2*Math.PI,r=Math.cos,n=Math.sin,s=t.Utils,a=t.Circle=function(i,r,n){var a=t.Resolution,o=s.map(s.range(a),function(e){return new t.Anchor},this);e.call(this,o,!0,!0),this.radius=n,this._update(),this.translation.set(i,r)};s.extend(a,{Properties:["radius"],MakeObservable:function(i){e.MakeObservable(i),s.each(a.Properties,t.Utils.defineProperty,i)}}),s.extend(a.prototype,e.prototype,{_radius:0,_flagRadius:!1,_update:function(){if(this._flagRadius)for(var t=0,s=this.vertices.length;t<s;t++){var a=t/s*i,o=this._radius*r(a),l=this._radius*n(a);this.vertices[t].set(o,l)}return e.prototype._update.call(this),this},flagReset:function(){return this._flagRadius=!1,e.prototype.flagReset.call(this),this}}),a.MakeObservable(a.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Path,i=2*Math.PI,r=Math.cos,n=Math.sin,s=t.Utils,a=t.Polygon=function(i,r,n,a){a=Math.max(a||0,3);var o=s.map(s.range(a),function(e){return new t.Anchor});e.call(this,o,!0),this.width=2*n,this.height=2*n,this.sides=a,this._update(),this.translation.set(i,r)};s.extend(a,{Properties:["width","height","sides"],MakeObservable:function(i){e.MakeObservable(i),s.each(a.Properties,t.Utils.defineProperty,i)}}),s.extend(a.prototype,e.prototype,{_width:0,_height:0,_sides:0,_flagWidth:!1,_flagHeight:!1,_flagSides:!1,_update:function(){if(this._flagWidth||this._flagHeight||this._flagSides){var s=this._sides,a=this.vertices.length;a>s&&this.vertices.splice(s-1,a-s);for(var o=0;o<s;o++){var l=i*((o+.5)/s)+Math.PI/2,h=this._width*r(l),c=this._height*n(l);o>=a?this.vertices.push(new t.Anchor(h,c)):this.vertices[o].set(h,c)}}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagSides=!1,e.prototype.flagReset.call(this),this}}),a.MakeObservable(a.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Path,i=(Math.PI,2*Math.PI),r=Math.PI/2,n=(Math.cos,Math.sin,Math.abs,t.Utils),s=t.ArcSegment=function(i,r,s,a,o,l,h){var c=n.map(n.range(h||3*t.Resolution),function(){return new t.Anchor});e.call(this,c,!1,!1,!0),this.innerRadius=s,this.outerRadius=a,this.startAngle=o,this.endAngle=l,this._update(),this.translation.set(i,r)};function a(t,e){for(;t<0;)t+=e;return t%e}n.extend(s,{Properties:["startAngle","endAngle","innerRadius","outerRadius"],MakeObservable:function(i){e.MakeObservable(i),n.each(s.Properties,t.Utils.defineProperty,i)}}),n.extend(s.prototype,e.prototype,{_flagStartAngle:!1,_flagEndAngle:!1,_flagInnerRadius:!1,_flagOuterRadius:!1,_startAngle:0,_endAngle:i,_innerRadius:0,_outerRadius:0,_update:function(){if(this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){var n,s=this._startAngle,o=this._endAngle,l=this._innerRadius,h=this._outerRadius,c=a(s,i)===a(o,i),d=l>0,u=this.vertices,f=d?u.length/2:u.length,_=0;c?f--:d||(f-=2);for(var g=0,p=f-1;g<f;g++){var m=g/p,v=u[_],y=m*(o-s)+s,x=(o-s)/f,b=h*Math.cos(y),w=h*Math.sin(y);switch(g){case 0:n=t.Commands.move;break;default:n=t.Commands.curve}if(v.command=n,v.x=b,v.y=w,v.controls.left.clear(),v.controls.right.clear(),v.command===t.Commands.curve){var S=h*x/Math.PI;v.controls.left.x=S*Math.cos(y-r),v.controls.left.y=S*Math.sin(y-r),v.controls.right.x=S*Math.cos(y+r),v.controls.right.y=S*Math.sin(y+r),1===g&&v.controls.left.multiplyScalar(2),g===p&&v.controls.right.multiplyScalar(2)}_++}if(d)for(c?(u[_].command=t.Commands.close,_++):p=--f-1,g=0;g<f;g++)m=g/p,v=u[_],y=(1-m)*(o-s)+s,x=(o-s)/f,b=l*Math.cos(y),w=l*Math.sin(y),n=t.Commands.curve,g<=0&&(n=c?t.Commands.move:t.Commands.line),v.command=n,v.x=b,v.y=w,v.controls.left.clear(),v.controls.right.clear(),v.command===t.Commands.curve&&(S=l*x/Math.PI,v.controls.left.x=S*Math.cos(y+r),v.controls.left.y=S*Math.sin(y+r),v.controls.right.x=S*Math.cos(y-r),v.controls.right.y=S*Math.sin(y-r),1===g&&v.controls.left.multiplyScalar(2),g===p&&v.controls.right.multiplyScalar(2)),_++;else c||(u[_].command=t.Commands.line,u[_].x=0,u[_].y=0,_++);u[_].command=t.Commands.close}return e.prototype._update.call(this),this},flagReset:function(){return e.prototype.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}}),s.MakeObservable(s.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Path,i=2*Math.PI,r=Math.cos,n=Math.sin,s=t.Utils,a=t.Star=function(i,r,n,a,o){s.isNumber(a)||(a=n/2),(!s.isNumber(o)||o<=0)&&(o=5);var l=2*o,h=s.map(s.range(l),function(e){return new t.Anchor});e.call(this,h,!0),this.innerRadius=a,this.outerRadius=n,this.sides=o,this._update(),this.translation.set(i,r)};s.extend(a,{Properties:["innerRadius","outerRadius","sides"],MakeObservable:function(i){e.MakeObservable(i),s.each(a.Properties,t.Utils.defineProperty,i)}}),s.extend(a.prototype,e.prototype,{_innerRadius:0,_outerRadius:0,_sides:0,_flagInnerRadius:!1,_flagOuterRadius:!1,_flagSides:!1,_update:function(){if(this._flagInnerRadius||this._flagOuterRadius||this._flagSides){var s=2*this._sides,a=this.vertices.length;a>s&&this.vertices.splice(s-1,a-s);for(var o=0;o<s;o++){var l=i*((o+.5)/s),h=o%2?this._innerRadius:this._outerRadius,c=h*r(l),d=h*n(l);o>=a?this.vertices.push(new t.Anchor(c,d)):this.vertices[o].set(c,d)}}return e.prototype._update.call(this),this},flagReset:function(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,e.prototype.flagReset.call(this),this}}),a.MakeObservable(a.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Path,i=t.Utils,r=t.RoundedRectangle=function(r,n,s,a,o){i.isNumber(o)||(o=Math.floor(Math.min(s,a)/12));var l=i.map(i.range(10),function(e){return new t.Anchor(0,0,0,0,0,0,0===e?t.Commands.move:t.Commands.curve)});l[l.length-1].command=t.Commands.close,e.call(this,l,!1,!1,!0),this.width=s,this.height=a,this.radius=o,this._update(),this.translation.set(r,n)};i.extend(r,{Properties:["width","height","radius"],MakeObservable:function(n){e.MakeObservable(n),i.each(r.Properties,t.Utils.defineProperty,n)}}),i.extend(r.prototype,e.prototype,{_width:0,_height:0,_radius:0,_flagWidth:!1,_flagHeight:!1,_flagRadius:!1,_update:function(){if(this._flagWidth||this._flagHeight||this._flagRadius){var t,i=this._width,r=this._height,n=Math.min(Math.max(this._radius,0),Math.min(i,r)),s=i/2,a=r/2;(t=this.vertices[0]).x=-(s-n),t.y=-a,(t=this.vertices[1]).x=s-n,t.y=-a,t.controls.left.clear(),t.controls.right.x=n,t.controls.right.y=0,(t=this.vertices[2]).x=s,t.y=-(a-n),t.controls.right.clear(),t.controls.left.clear(),(t=this.vertices[3]).x=s,t.y=a-n,t.controls.left.clear(),t.controls.right.x=0,t.controls.right.y=n,(t=this.vertices[4]).x=s-n,t.y=a,t.controls.right.clear(),t.controls.left.clear(),(t=this.vertices[5]).x=-(s-n),t.y=a,t.controls.left.clear(),t.controls.right.x=-n,t.controls.right.y=0,(t=this.vertices[6]).x=-s,t.y=a-n,t.controls.left.clear(),t.controls.right.clear(),(t=this.vertices[7]).x=-s,t.y=-(a-n),t.controls.left.clear(),t.controls.right.x=0,t.controls.right.y=-n,(t=this.vertices[8]).x=-(s-n),t.y=-a,t.controls.left.clear(),t.controls.right.clear(),(t=this.vertices[9]).copy(this.vertices[8])}return e.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,e.prototype.flagReset.call(this),this}}),r.MakeObservable(r.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.root,i=t.Utils.getComputedMatrix,r=t.Utils,n=((e.document?e.document.createElement("canvas"):{getContext:r.identity}).getContext("2d"),t.Text=function(e,i,s,a){if(t.Shape.call(this),this._renderer.type="text",this._renderer.flagFill=r.bind(n.FlagFill,this),this._renderer.flagStroke=r.bind(n.FlagStroke,this),this.value=e,r.isNumber(i)&&(this.translation.x=i),r.isNumber(s)&&(this.translation.y=s),!r.isObject(a))return this;r.each(t.Text.Properties,function(t){t in a&&(this[t]=a[t])},this)});r.extend(t.Text,{Properties:["value","family","size","leading","alignment","linewidth","style","weight","decoration","baseline","opacity","visible","fill","stroke"],FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(e){t.Shape.MakeObservable(e),r.each(t.Text.Properties.slice(0,12),t.Utils.defineProperty,e),Object.defineProperty(e,"fill",{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.unbind(t.Events.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof t.Gradient||this._fill instanceof t.LinearGradient||this._fill instanceof t.RadialGradient||this._fill instanceof t.Texture)&&this._fill.bind(t.Events.change,this._renderer.flagFill)}}),Object.defineProperty(e,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.unbind(t.Events.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof t.Gradient||this._stroke instanceof t.LinearGradient||this._stroke instanceof t.RadialGradient||this._stroke instanceof t.Texture)&&this._stroke.bind(t.Events.change,this._renderer.flagStroke)}}),Object.defineProperty(e,"clip",{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}})}}),r.extend(t.Text.prototype,t.Shape.prototype,{_flagValue:!0,_flagFamily:!0,_flagSize:!0,_flagLeading:!0,_flagAlignment:!0,_flagBaseline:!0,_flagStyle:!0,_flagWeight:!0,_flagDecoration:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagClip:!1,_value:"",_family:"sans-serif",_size:13,_leading:17,_alignment:"center",_baseline:"middle",_style:"normal",_weight:500,_decoration:"none",_fill:"#000",_stroke:"transparent",_linewidth:1,_opacity:1,_visible:!0,_clip:!1,remove:function(){return this.parent?(this.parent.remove(this),this):this},clone:function(e){e=e||this.parent;var i=new t.Text(this.value);return i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,r.each(t.Text.Properties,function(t){i[t]=this[t]},this),e&&e.add(i),i},toObject:function(){var e={translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale};return r.each(t.Text.Properties,function(t){e[t]=this[t]},this),e},noStroke:function(){return this.stroke="transparent",this},noFill:function(){return this.fill="transparent",this},getBoundingClientRect:function(t){var e;return this._update(!0),{top:(e=(t?this._matrix:i(this)).multiply(0,0,1)).x,left:e.y,right:e.x,bottom:e.y,width:0,height:0}},flagReset:function(){return this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpaicty=this._flagVisible=this._flagClip=this._flagDecoration=this._flagBaseline=!1,t.Shape.prototype.flagReset.call(this),this}}),t.Text.MakeObservable(t.Text.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Utils,i=t.Stop=function(t,r,n){this._renderer={},this._renderer.type="stop",this.offset=e.isNumber(t)?t:i.Index<=0?0:1,this.opacity=e.isNumber(n)?n:1,this.color=e.isString(r)?r:i.Index<=0?"#fff":"#000",i.Index=(i.Index+1)%2};e.extend(i,{Index:0,Properties:["offset","opacity","color"],MakeObservable:function(t){e.each(i.Properties,function(t){var e="_"+t,i="_flag"+t.charAt(0).toUpperCase()+t.slice(1);Object.defineProperty(this,t,{enumerable:!0,get:function(){return this[e]},set:function(t){this[e]=t,this[i]=!0,this.parent&&(this.parent._flagStops=!0)}})},t)}}),e.extend(i.prototype,t.Utils.Events,{clone:function(){var t=new i;return e.each(i.Properties,function(e){t[e]=this[e]},this),t},toObject:function(){var t={};return e.each(i.Properties,function(e){t[e]=this[e]},this),t},flagReset:function(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,this}}),i.MakeObservable(i.prototype);var r=t.Gradient=function(i){this._renderer={},this._renderer.type="gradient",this.id=t.Identifier+t.uniqueId(),this.classList=[],this._renderer.flagStops=e.bind(r.FlagStops,this),this._renderer.bindStops=e.bind(r.BindStops,this),this._renderer.unbindStops=e.bind(r.UnbindStops,this),this.spread="pad",this.stops=i};e.extend(r,{Stop:i,Properties:["spread"],MakeObservable:function(i){e.each(r.Properties,t.Utils.defineProperty,i),Object.defineProperty(i,"stops",{enumerable:!0,get:function(){return this._stops},set:function(e){this._renderer.flagStops;var i=this._renderer.bindStops,r=this._renderer.unbindStops;this._stops&&this._stops.unbind(t.Events.insert,i).unbind(t.Events.remove,r),this._stops=new t.Utils.Collection((e||[]).slice(0)),this._stops.bind(t.Events.insert,i).bind(t.Events.remove,r),i(this._stops)}})},FlagStops:function(){this._flagStops=!0},BindStops:function(e){for(var i=e.length;i--;)e[i].bind(t.Events.change,this._renderer.flagStops),e[i].parent=this;this._renderer.flagStops()},UnbindStops:function(e){for(var i=e.length;i--;)e[i].unbind(t.Events.change,this._renderer.flagStops),delete e[i].parent;this._renderer.flagStops()}}),e.extend(r.prototype,t.Utils.Events,{_flagStops:!1,_flagSpread:!1,clone:function(i){i=i||this.parent;var n=e.map(this.stops,function(t){return t.clone()}),s=new r(n);return e.each(t.Gradient.Properties,function(t){s[t]=this[t]},this),i&&i.add(s),s},toObject:function(){var t={stops:e.map(this.stops,function(t){return t.toObject()})};return e.each(r.Properties,function(e){t[e]=this[e]},this),t},_update:function(){return(this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagSpread=this._flagStops=!1,this}}),r.MakeObservable(r.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Utils,i=t.LinearGradient=function(r,n,s,a,o){t.Gradient.call(this,o),this._renderer.type="linear-gradient";var l=e.bind(i.FlagEndPoints,this);this.left=(new t.Vector).bind(t.Events.change,l),this.right=(new t.Vector).bind(t.Events.change,l),e.isNumber(r)&&(this.left.x=r),e.isNumber(n)&&(this.left.y=n),e.isNumber(s)&&(this.right.x=s),e.isNumber(a)&&(this.right.y=a)};e.extend(i,{Stop:t.Gradient.Stop,MakeObservable:function(e){t.Gradient.MakeObservable(e)},FlagEndPoints:function(){this._flagEndPoints=!0}}),e.extend(i.prototype,t.Gradient.prototype,{_flagEndPoints:!1,clone:function(r){r=r||this.parent;var n=e.map(this.stops,function(t){return t.clone()}),s=new i(this.left._x,this.left._y,this.right._x,this.right._y,n);return e.each(t.Gradient.Properties,function(t){s[t]=this[t]},this),r&&r.add(s),s},toObject:function(){var e=t.Gradient.prototype.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e},_update:function(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagEndPoints=!1,t.Gradient.prototype.flagReset.call(this),this}}),i.MakeObservable(i.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Utils,i=t.RadialGradient=function(i,r,n,s,a,o){t.Gradient.call(this,s),this._renderer.type="radial-gradient",this.center=(new t.Vector).bind(t.Events.change,e.bind(function(){this._flagCenter=!0},this)),this.radius=e.isNumber(n)?n:20,this.focal=(new t.Vector).bind(t.Events.change,e.bind(function(){this._flagFocal=!0},this)),e.isNumber(i)&&(this.center.x=i),e.isNumber(r)&&(this.center.y=r),this.focal.copy(this.center),e.isNumber(a)&&(this.focal.x=a),e.isNumber(o)&&(this.focal.y=o)};e.extend(i,{Stop:t.Gradient.Stop,Properties:["radius"],MakeObservable:function(r){t.Gradient.MakeObservable(r),e.each(i.Properties,t.Utils.defineProperty,r)}}),e.extend(i.prototype,t.Gradient.prototype,{_flagRadius:!1,_flagCenter:!1,_flagFocal:!1,clone:function(r){r=r||this.parent;var n=e.map(this.stops,function(t){return t.clone()}),s=new i(this.center._x,this.center._y,this._radius,n,this.focal._x,this.focal._y);return e.each(t.Gradient.Properties.concat(i.Properties),function(t){s[t]=this[t]},this),r&&r.add(s),s},toObject:function(){var r=t.Gradient.prototype.toObject.call(this);return e.each(i.Properties,function(t){r[t]=this[t]},this),r.center=this.center.toObject(),r.focal=this.focal.toObject(),r},_update:function(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(t.Events.change),this},flagReset:function(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,t.Gradient.prototype.flagReset.call(this),this}}),i.MakeObservable(i.prototype)}((void 0!==i?i:this).Two),function(t){var e,i=t.Utils,r={video:/\.(mp4|webm)$/i,image:/\.(jpe?g|png|gif|tiff)$/i};this.document&&(e=document.createElement("a"));var n=t.Texture=function(e,r){if(this._renderer={},this._renderer.type="texture",this._renderer.flagOffset=i.bind(n.FlagOffset,this),this._renderer.flagScale=i.bind(n.FlagScale,this),this.id=t.Identifier+t.uniqueId(),this.classList=[],this.offset=new t.Vector,i.isFunction(r)){var s=i.bind(function(){this.unbind(t.Events.load,s),i.isFunction(r)&&r()},this);this.bind(t.Events.load,s)}i.isString(e)?this.src=e:i.isElement(e)&&(this.image=e),this._update()};i.extend(n,{Properties:["src","loaded","repeat"],ImageRegistry:new t.Registry,getAbsoluteURL:function(t){return e?(e.href=t,e.href):t},getImage:function(t){var e,i=n.getAbsoluteURL(t);return n.ImageRegistry.contains(i)?n.ImageRegistry.get(i):((e=r.video.test(i)?document.createElement("video"):document.createElement("img")).crossOrigin="anonymous",e)},Register:{canvas:function(t,e){t._src="#"+t.id,n.ImageRegistry.add(t.src,t.image),i.isFunction(e)&&e()},img:function(e,r){var s=function(t){e.image.removeEventListener("load",s,!1),e.image.removeEventListener("error",a,!1),i.isFunction(r)&&r()},a=function(i){throw e.image.removeEventListener("load",s,!1),e.image.removeEventListener("error",a,!1),new t.Utils.Error("unable to load "+e.src)};i.isNumber(e.image.width)&&e.image.width>0&&i.isNumber(e.image.height)&&e.image.height>0?s():(e.image.addEventListener("load",s,!1),e.image.addEventListener("error",a,!1)),e._src=n.getAbsoluteURL(e._src),e.image&&e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),n.ImageRegistry.add(e.src,e.image),e.image.src=e.src)},video:function(e,r){var s=function(t){e.image.removeEventListener("load",s,!1),e.image.removeEventListener("error",a,!1),e.image.width=e.image.videoWidth,e.image.height=e.image.videoHeight,e.image.play(),i.isFunction(r)&&r()},a=function(i){throw e.image.removeEventListener("load",s,!1),e.image.removeEventListener("error",a,!1),new t.Utils.Error("unable to load "+e.src)};e._src=n.getAbsoluteURL(e._src),e.image.addEventListener("canplaythrough",s,!1),e.image.addEventListener("error",a,!1),e.image&&e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),n.ImageRegistry.add(e.src,e.image),e.image.src=e.src,e.image.loop=!0,e.image.load())}},load:function(t,e){t.src;var i=t.image,r=i&&i.nodeName.toLowerCase();t._flagImage&&(/canvas/i.test(r)?n.Register.canvas(t,e):(t._src=i.getAttribute("two-src")||i.src,n.Register[r](t,e))),t._flagSrc&&(i||(t.image=n.getImage(t.src)),r=t.image.nodeName.toLowerCase(),n.Register[r](t,e))},FlagOffset:function(){this._flagOffset=!0},FlagScale:function(){this._flagScale=!0},MakeObservable:function(e){i.each(n.Properties,t.Utils.defineProperty,e),Object.defineProperty(e,"image",{enumerable:!0,get:function(){return this._image},set:function(t){var e;switch(t&&t.nodeName.toLowerCase()){case"canvas":e="#"+t.id;break;default:e=t.src}n.ImageRegistry.contains(e)?this._image=n.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(t.Events.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(t.Events.change,this._renderer.flagOffset),this._flagOffset=!0}}),Object.defineProperty(e,"scale",{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof t.Vector&&this._scale.unbind(t.Events.change,this._renderer.flagScale),this._scale=e,this._scale instanceof t.Vector&&this._scale.bind(t.Events.change,this._renderer.flagScale),this._flagScale=!0}})}}),i.extend(n.prototype,t.Utils.Events,t.Shape.prototype,{_flagSrc:!1,_flagImage:!1,_flagVideo:!1,_flagLoaded:!1,_flagRepeat:!1,_flagOffset:!1,_flagScale:!1,_src:"",_image:null,_loaded:!1,_repeat:"no-repeat",_scale:1,_offset:null,clone:function(){return new n(this.src)},toObject:function(){return{src:this.src,image:this.image}},_update:function(){return(this._flagSrc||this._flagImage||this._flagVideo)&&(this.trigger(t.Events.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,n.load(this,i.bind(function(){this.loaded=!0,this.trigger(t.Events.change).trigger(t.Events.load)},this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this},flagReset:function(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagVideo=this._flagScale=this._flagOffset=!1,this}}),n.MakeObservable(n.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Utils,i=t.Path,r=t.Rectangle,n=t.Sprite=function(r,n,s,a,o,l){i.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this.noStroke(),this.noFill(),r instanceof t.Texture?this.texture=r:e.isString(r)&&(this.texture=new t.Texture(r)),this._update(),this.translation.set(n||0,s||0),e.isNumber(a)&&(this.columns=a),e.isNumber(o)&&(this.rows=o),e.isNumber(l)&&(this.frameRate=l)};e.extend(n,{Properties:["texture","columns","rows","frameRate","index"],MakeObservable:function(i){r.MakeObservable(i),e.each(n.Properties,t.Utils.defineProperty,i)}}),e.extend(n.prototype,r.prototype,{_flagTexture:!1,_flagColumns:!1,_flagRows:!1,_flagFrameRate:!1,flagIndex:!1,_amount:1,_duration:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_texture:null,_columns:1,_rows:1,_frameRate:0,_index:0,play:function(t,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=e.performance.now(),e.isNumber(t)&&(this._firstFrame=t),e.isNumber(i)&&(this._lastFrame=i),e.isFunction(r)?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){t=t||this.parent;var e=new n(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&(e.play(this._firstFrame,this._lastFrame),e._loop=this._loop),t&&t.add(e),e},_update:function(){var t,i,n,s,a,o,l,h,c,d=this._texture,u=this._columns,f=this._rows;if((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=this._texture),this._texture.loaded){t=(l=d.image.width)/u,i=(h=d.image.height)/f,s=this._amount,this.width!==t&&(this.width=t),this.height!==i&&(this.height=i),this._playing&&this._frameRate>0&&(e.isNaN(this._lastFrame)&&(this._lastFrame=s-1),n=e.performance.now()-this._startTime,a=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?n%=a:n=Math.min(n,a),o=e.lerp(this._firstFrame,c,n/a),(o=Math.floor(o))!==this._index&&(this._index=o,o>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));var _=-t*(this._index%u)+(l-t)/2,g=-i*Math.floor(this._index/u)+(h-i)/2;_!==d.offset.x&&(d.offset.x=_),g!==d.offset.y&&(d.offset.y=g)}return r.prototype._update.call(this),this},flagReset:function(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,r.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==i?i:this).Two),function(t){var e=t.Utils,i=t.Path,r=t.Rectangle,n=t.ImageSequence=function(r,s,a,o){i.call(this,[new t.Anchor,new t.Anchor,new t.Anchor,new t.Anchor],!0),this._renderer.flagTextures=e.bind(n.FlagTextures,this),this._renderer.bindTextures=e.bind(n.BindTextures,this),this._renderer.unbindTextures=e.bind(n.UnbindTextures,this),this.noStroke(),this.noFill(),this.textures=e.map(r,n.GenerateTexture,this),this._update(),this.translation.set(s||0,a||0),e.isNumber(o)?this.frameRate=o:this.frameRate=n.DefaultFrameRate};e.extend(n,{Properties:["frameRate","index"],DefaultFrameRate:30,FlagTextures:function(){this._flagTextures=!0},BindTextures:function(e){for(var i=e.length;i--;)e[i].bind(t.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},UnbindTextures:function(e){for(var i=e.length;i--;)e[i].unbind(t.Events.change,this._renderer.flagTextures);this._renderer.flagTextures()},MakeObservable:function(i){r.MakeObservable(i),e.each(n.Properties,t.Utils.defineProperty,i),Object.defineProperty(i,"textures",{enumerable:!0,get:function(){return this._textures},set:function(e){this._renderer.flagTextures;var i=this._renderer.bindTextures,r=this._renderer.unbindTextures;this._textures&&this._textures.unbind(t.Events.insert,i).unbind(t.Events.remove,r),this._textures=new t.Utils.Collection((e||[]).slice(0)),this._textures.bind(t.Events.insert,i).bind(t.Events.remove,r),i(this._textures)}})},GenerateTexture:function(i){return i instanceof t.Texture?i:e.isString(i)?new t.Texture(i):void 0}}),e.extend(n.prototype,r.prototype,{_flagTextures:!1,_flagFrameRate:!1,_flagIndex:!1,_amount:1,_duration:0,_index:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_textures:null,_frameRate:0,play:function(t,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=e.performance.now(),e.isNumber(t)&&(this._firstFrame=t),e.isNumber(i)&&(this._lastFrame=i),e.isFunction(r)?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(t){t=t||this.parent;var e=new n(this.textures,this.translation.x,this.translation.y,this.frameRate);return e._loop=this._loop,this._playing&&e.play(),t&&t.add(e),e},_update:function(){var i,n,s,a,o,l,h,c,d=this._textures;return this._flagTextures&&(this._amount=d.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,e.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=e.performance.now()-this._startTime,o=1e3*((c=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?s%=o:s=Math.min(s,o),h=e.lerp(this._firstFrame,c,s/o),(h=Math.floor(h))!==this._index&&(this._index=h,(l=d[this._index]).loaded&&(i=l.image.width,n=l.image.height,this.width!==i&&(this.width=i),this.height!==n&&(this.height=n),this.fill=l,h>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):!this._flagIndex&&this.fill instanceof t.Texture||((l=d[this._index]).loaded&&(i=l.image.width,n=l.image.height,this.width!==i&&(this.width=i),this.height!==n&&(this.height=n)),this.fill=l),r.prototype._update.call(this),this},flagReset:function(){return this._flagTextures=this._flagFrameRate=!1,r.prototype.flagReset.call(this),this}}),n.MakeObservable(n.prototype)}((void 0!==i?i:this).Two),function(t){var e=Math.min,i=Math.max,r=t.Utils,n=function(){t.Utils.Collection.apply(this,arguments),Object.defineProperty(this,"_events",{value:{},enumerable:!1}),this.ids={},this.on(t.Events.insert,this.attach),this.on(t.Events.remove,this.detach),n.prototype.attach.apply(this,arguments)};n.prototype=new t.Utils.Collection,n.prototype.constructor=n,r.extend(n.prototype,{attach:function(t){for(var e=0;e<t.length;e++)this.ids[t[e].id]=t[e];return this},detach:function(t){for(var e=0;e<t.length;e++)delete this.ids[t[e].id];return this}});var s=t.Group=function(){t.Shape.call(this,!0),this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=arguments};function a(t,e){var i,n=t.parent;return n===e?(this.additions.push(t),void(this._flagAdditions=!0)):(n&&n.children.ids[t.id]&&(i=r.indexOf(n.children,t),n.children.splice(i,1),(i=r.indexOf(n.additions,t))>=0?n.additions.splice(i,1):(n.subtractions.push(t),n._flagSubtractions=!0)),e?(t.parent=e,this.additions.push(t),void(this._flagAdditions=!0)):((i=r.indexOf(this.additions,t))>=0?this.additions.splice(i,1):(this.subtractions.push(t),this._flagSubtractions=!0),void delete t.parent))}r.extend(s,{Children:n,InsertChildren:function(t){for(var e=0;e<t.length;e++)a.call(this,t[e],this)},RemoveChildren:function(t){for(var e=0;e<t.length;e++)a.call(this,t[e])},OrderChildren:function(t){this._flagOrder=!0},MakeObservable:function(e){var i=t.Path.Properties.slice(0),a=r.indexOf(i,"opacity");a>=0&&(i.splice(a,1),Object.defineProperty(e,"opacity",{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!=t,this._opacity=t}})),t.Shape.MakeObservable(e),s.MakeGetterSetters(e,i),Object.defineProperty(e,"children",{enumerable:!0,get:function(){return this._children},set:function(e){var i=r.bind(s.InsertChildren,this),a=r.bind(s.RemoveChildren,this),o=r.bind(s.OrderChildren,this);this._children&&this._children.unbind(),this._children=new n(e),this._children.bind(t.Events.insert,i),this._children.bind(t.Events.remove,a),this._children.bind(t.Events.order,o)}}),Object.defineProperty(e,"mask",{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,t.clip||(t.clip=!0)}})},MakeGetterSetters:function(t,e){r.isArray(e)||(e=[e]),r.each(e,function(e){s.MakeGetterSetter(t,e)})},MakeGetterSetter:function(t,e){var i="_"+e;Object.defineProperty(t,e,{enumerable:!0,get:function(){return this[i]},set:function(t){this[i]=t,r.each(this.children,function(i){i[e]=t})}})}}),r.extend(s.prototype,t.Shape.prototype,{_flagAdditions:!1,_flagSubtractions:!1,_flagOrder:!1,_flagOpacity:!0,_flagMask:!1,_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,_mask:null,clone:function(t){t=t||this.parent;var e=new s,i=r.map(this.children,function(t){return t.clone(e)});return e.add(i),e.opacity=this.opacity,this.mask&&(e.mask=this.mask),e.translation.copy(this.translation),e.rotation=this.rotation,e.scale=this.scale,t&&t.add(e),e},toObject:function(){var t={children:[],translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale,opacity:this.opacity,mask:this.mask?this.mask.toObject():null};return r.each(this.children,function(e,i){t.children[i]=e.toObject()},this),t},corner:function(){var t=this.getBoundingClientRect(!0),e={x:t.left,y:t.top};return this.children.forEach(function(t){t.translation.subSelf(e)}),this},center:function(){var t=this.getBoundingClientRect(!0);return t.centroid={x:t.left+t.width/2,y:t.top+t.height/2},this.children.forEach(function(e){e.isShape&&e.translation.subSelf(t.centroid)}),this},getById:function(t){var e=function(t,i){if(t.id===i)return t;if(t.children)for(var r=t.children.length;r--;){var n=e(t.children[r],i);if(n)return n}};return e(this,t)||null},getByClassName:function(t){var e=[],i=function(t,r){return-1!=t.classList.indexOf(r)?e.push(t):t.children&&t.children.forEach(function(t){i(t,r)}),e};return i(this,t)},getByType:function(e){var i=[],r=function(e,n){for(var s in e.children)e.children[s]instanceof n?i.push(e.children[s]):e.children[s]instanceof t.Group&&r(e.children[s],n);return i};return r(this,e)},add:function(t){t=t instanceof Array?t.slice():r.toArray(arguments);for(var e=0;e<t.length;e++)t[e]&&t[e].id&&this.children.push(t[e]);return this},remove:function(t){var e=arguments.length,i=this.parent;if(e<=0&&i)return i.remove(this),this;t=t instanceof Array?t.slice():r.toArray(arguments);for(var n=0;n<t.length;n++)t[n]&&this.children.ids[t[n].id]&&this.children.splice(r.indexOf(this.children,t[n]),1);return this},getBoundingClientRect:function(t){var n;this._update(!0);var s=1/0,a=-1/0,o=1/0,l=-1/0;return this.children.forEach(function(h){/(linear-gradient|radial-gradient|gradient)/.test(h._renderer.type)||(n=h.getBoundingClientRect(t),r.isNumber(n.top)&&r.isNumber(n.left)&&r.isNumber(n.right)&&r.isNumber(n.bottom)&&(o=e(n.top,o),s=e(n.left,s),a=i(n.right,a),l=i(n.bottom,l)))},this),{top:o,left:s,right:a,bottom:l,width:a-s,height:l-o}},noFill:function(){return this.children.forEach(function(t){t.noFill()}),this},noStroke:function(){return this.children.forEach(function(t){t.noStroke()}),this},subdivide:function(){var t=arguments;return this.children.forEach(function(e){e.subdivide.apply(e,t)}),this},flagReset:function(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=!1,t.Shape.prototype.flagReset.call(this),this}}),s.MakeObservable(s.prototype)}((void 0!==i?i:this).Two)}).call(e,i("DuR2"))},u33e:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});i("XPMo"),i("+BTi");var r=i("uEG6"),n=i.n(r),s=(i("8mNY"),i("YnkO")),a=i.n(s),o=i("qaB4"),l=i("cCw9"),h=i("6/IS"),c=i("GGQW"),d=i.n(c),u=i("nznj"),f=function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)},_=function(t,e,i){document.querySelector("#"+t._renderer.elem.id).onmousedown=function(e){var r=e||event;r.preventDefault();var n=r.clientX-t.translation.x,s=r.clientY-t.translation.y;r.stopPropagation?r.stopPropagation():r.cancelBubble=!0,document.onmousemove=function(t){var e={x:t.clientX-n,y:t.clientY-s};i(e)},document.onmouseup=function(t){document.onmousemove=document.onmouseup=null}}},g={name:"svgDIYMapModel",props:{mapInfo:{default:null,type:Object},iconArr:{default:null,type:Array},iconSize:{default:function(){return{width:50,height:50}},type:Object},delIconSize:{default:20,type:Number},isIconEdit:{default:!1,type:Boolean},alarmDeviceList:{default:null,type:Array},unonlineDeviceList:{default:null,type:Array}},data:function(){return{svgMap:null,mapLayer:null,mapImg:null,iconLayer:null,iconObjArr:[]}},computed:{mapUrl:function(){return this.mapInfo&&this.mapInfo.url?this.mapInfo.url:""},imgSize:function(){return this.mapInfo&&this.mapInfo.revJson?JSON.parse(this.mapInfo.revJson):null}},methods:{svgMapInit:function(){var t=this;this.$refs.drawMap.innerHTML="",this.$store.commit("HANDLE_LOADING_OPEN");var e={width:this.$refs.drawMap.scrollWidth,height:this.$refs.drawMap.scrollHeight},i=this.imgSize&&this.imgSize.height?this.imgSize.height:"0",r=this.imgSize&&this.imgSize.width?this.imgSize.width:"0";this.svgMap=new d.a(e).appendTo(this.$refs.drawMap);this.mapImg=document.createElementNS("http://www.w3.org/2000/svg","image"),this.mapImg.href.baseVal="httpImage/"+this.mapUrl,this.mapImg.setAttributeNS(null,"x",0),this.mapImg.setAttributeNS(null,"y",0),this.mapImg.setAttributeNS(null,"height",i),this.mapImg.setAttributeNS(null,"width",r),this.mapLayer=this.svgMap.makeGroup(),this.iconLayer=this.svgMap.makeGroup(),this.svgMap.update(),document.querySelector("#"+this.mapLayer._renderer.elem.id).appendChild(this.mapImg),document.querySelector("#"+this.mapLayer._renderer.elem.id).style.cursor="all-scroll",this.mapImg.onload=function(e){t.$store.commit("HANDLE_LOADING_CLOSE")},function(t,e){function i(t){var i=t||event,r=i.wheelDelta?i.wheelDelta<0:i.detail>0;return e(r),i.preventDefault&&i.preventDefault(),!1}-1!==window.navigator.userAgent.indexOf("Firefox")?f(t,"DOMMouseScroll",i):f(t,"mousewheel",i)}(document.querySelector("#drawMap svg"),function(e){e?t.zoomSmall():t.zoomBig()}),_(this.mapLayer,0,function(e){t.mapLayer.translation.set(e.x,e.y),t.iconLayer.translation.set(e.x,e.y),t.svgMap.update(),t.$emit("dragMapLayerFn",e)})},zoomBig:function(){var t=this;this.mapLayer.scale+=.1,this.iconObjArr.map(function(e){e.translation.set(e.x*t.mapLayer.scale-t.iconSize.width/2,e.y*t.mapLayer.scale-t.iconSize.height/2)}),this.svgMap.update(),this.$emit("zoomMapLayerFn",this.mapLayer.scale)},zoomSmall:function(){var t=this;this.mapLayer.scale>.3?(this.mapLayer.scale-=.1,this.iconObjArr.map(function(e){e.translation.set(e.x*t.mapLayer.scale-t.iconSize.width/2,e.y*t.mapLayer.scale-t.iconSize.height/2)}),this.svgMap.update(),this.$emit("zoomMapLayerFn",this.mapLayer.scale)):this.$notify({group:"foo",type:"warn",title:"抱歉,真的不能再小了",text:"地图已经缩到最小,不能再小了"})},pantoHome:function(){var t=this;this.mapLayer.scale=1,this.iconObjArr.map(function(e){e.translation.set(1*e.x-t.iconSize.width/2,1*e.y-t.iconSize.height/2)}),this.mapLayer.translation.set(0,0),this.iconLayer.translation.set(0,0),this.svgMap.update()},iconListInit:function(t){var e=this;if(t&&this.svgMap&&this.mapLayer&&this.mapImg&&this.iconLayer){var i=[],r=[],n=[];this.iconObjArr=this.iconObjArr.reduce(function(e,i){return-1!==Object(u.c)(i.data.id,t,"id")?(e.push(i),n.push(i.data)):document.querySelector("#"+i._renderer.elem.id).remove(),e},[]);var s=!0,a=!1,o=void 0;try{for(var l,h=t[Symbol.iterator]();!(s=(l=h.next()).done);s=!0){var c=l.value;-1===Object(u.c)(c.id,n,"id")?r.push(c):i.push(c)}}catch(t){a=!0,o=t}finally{try{!s&&h.return&&h.return()}finally{if(a)throw o}}if(0===this.iconObjArr.length){var d=!0,f=!1,_=void 0;try{for(var g,p=t[Symbol.iterator]();!(d=(g=p.next()).done);d=!0){var m=g.value;this.drawIcon(m)}}catch(t){f=!0,_=t}finally{try{!d&&p.return&&p.return()}finally{if(f)throw _}}}else{var v=!0,y=!1,x=void 0;try{for(var b,w=r[Symbol.iterator]();!(v=(b=w.next()).done);v=!0){var S=b.value;this.drawIcon(S)}}catch(t){y=!0,x=t}finally{try{!v&&w.return&&w.return()}finally{if(y)throw x}}}var A=function(t){e.iconObjArr.map(function(e){if(t.id===e.data.id){var i=t&&t.position?JSON.parse(t.position):{x:0,y:0};e.data=t,e.x=i.x,e.y=i.y}})},E=!0,k=!1,C=void 0;try{for(var M,R=i[Symbol.iterator]();!(E=(M=R.next()).done);E=!0){A(M.value)}}catch(t){k=!0,C=t}finally{try{!E&&R.return&&R.return()}finally{if(k)throw C}}}},drawIcon:function(t){var e=this;if(!t||!t.position)return!1;var i=document.createElementNS("http://www.w3.org/2000/svg","image");i.href.baseVal=t&&t.icon?"/static/img/map/"+t.icon+".png":"/static/img/map/camera_device.png",i.setAttributeNS(null,"x",0),i.setAttributeNS(null,"y",-this.iconSize.height/2),i.setAttributeNS(null,"height",this.iconSize.height),i.setAttributeNS(null,"width",this.iconSize.width);var r=t&&t.position?JSON.parse(t.position):{x:0,y:0},n=this.svgMap.makeGroup(i);if(n.data=t,n.x=r.x,n.y=r.y,n.state="_unonline",n.translation.set(r.x*this.mapLayer.scale-this.iconSize.width/2,r.y*this.mapLayer.scale-this.iconSize.height/2),this.iconLayer.add(n),this.iconObjArr.push(n),this.svgMap.update(),document.querySelector("#"+n._renderer.elem.id).appendChild(i),document.querySelector("#"+n._renderer.elem.id).style.cursor="pointer",this.isIconEdit){var s=document.createElementNS("http://www.w3.org/2000/svg","image");s.href.baseVal="/static/img/map/mapDel.png",s.setAttributeNS(null,"x",this.iconSize.width-this.delIconSize),s.setAttributeNS(null,"y",-this.iconSize.height/2),s.setAttributeNS(null,"height",this.delIconSize),s.setAttributeNS(null,"width",this.delIconSize),document.querySelector("#"+n._renderer.elem.id).appendChild(s),f(s,"click",function(t){e.$emit("iconIteamDelFn",{data:n.data,id:n.data.id})}),_(n,0,function(t){n.translation.set(t.x,t.y),e.svgMap.update(),e.$emit("iconIteamDragFn",{x:(t.x+e.iconSize.width/2)/e.mapLayer.scale,y:(t.y+e.iconSize.height/2)/e.mapLayer.scale,iconGroup:n,data:n.data})})}else f(document.querySelector("#"+n._renderer.elem.id),"click",function(t){e.$emit("iconIteamFn",n)})},initIcon:function(t){if(!t)return!1;var e=[];this.unonlineDeviceList&&(e=this.unonlineDeviceList.map(function(t){return t.deviceId}));var i=t.data&&t.data.id?t.data.id:null,r=document.querySelector("#"+t._renderer.elem.id);this.unonlineDeviceList&&-1!==e.indexOf(i)?r&&"_unonline"!==t.state&&(t.state="_unonline",r.getElementsByTagNameNS("http://www.w3.org/2000/svg","image")[0].setAttributeNS(null,"href",t.data&&t.data.icon?"/static/img/map/"+t.data.icon+".png":"/static/img/map/camera_device.png")):r&&"_online"!==t.state&&(t.state="_online",r.getElementsByTagNameNS("http://www.w3.org/2000/svg","image")[0].setAttributeNS(null,"href",t.data&&t.data.icon?"/static/img/map/"+t.data.icon+"_online.png":"/static/img/map/camera_device.png"))}},created:function(){},mounted:function(){},watch:{mapInfo:{handler:function(t,e){var i=this;this.$nextTick(function(){i.svgMapInit()})},deep:!0,immediate:!0},iconArr:{handler:function(t,e){t&&t!==e&&this.iconListInit(t)},deep:!0,immediate:!0},alarmDeviceList:{handler:function(t,e){var i=this;if(t&&t!==e){var r=t.map(function(t){return t.deviceId});this.iconObjArr.map(function(t){var e=t.data&&t.data.id?t.data.id:null,n=document.querySelector("#"+t._renderer.elem.id);-1!==r.indexOf(e)?n&&"_alarm"!==t.state&&(t.state="_alarm",n.getElementsByTagNameNS("http://www.w3.org/2000/svg","image")[0].setAttributeNS(null,"href",t.data&&t.data.icon?"/static/img/map/"+t.data.icon+"_alarm.png":"/static/img/map/camera_device.png")):i.initIcon(t)})}},immediate:!0}}},p=i("XyMi");var m=function(t){i("5R7W")},v=Object(p.a)(g,function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"position-box pr p10"},[i("div",{ref:"drawMap",staticClass:"position-box",attrs:{id:"drawMap"}}),t._v(" "),i("b-button-group",{staticClass:"zoomBtnGroup",attrs:{vertical:"",size:"sm"}},[i("b-button",{attrs:{variant:"primary",title:"放大"},on:{click:t.zoomBig}},[i("span",{staticClass:"fa fa-plus"})]),t._v(" "),i("div",{staticClass:"border-top"}),t._v(" "),i("b-button",{attrs:{variant:"primary",title:"重置位置"},on:{click:t.pantoHome}},[i("span",{staticClass:"fa fa-circle"})]),t._v(" "),i("div",{staticClass:"border-top"}),t._v(" "),i("b-button",{attrs:{variant:"primary",title:"缩小"},on:{click:t.zoomSmall}},[i("span",{staticClass:"fa fa-minus"})])],1)],1)},[],!1,m,"data-v-4473dcf7",null).exports,y=i("Ls4C"),x={props:{index:{type:Number,default:0},w:{type:Number,default:100},h:{type:Number,default:100},data:{type:Object,default:null},tags:{type:Object,default:null},toDOMId:{type:String,default:""}},data:function(){return{grabEvents:["mousedown","touchstart"],moveEvents:["mousemove","touchmove"],releaseEvents:["mouseup","touchend"],isAdd:!1,isOnDowm:!1,boxContent:{},beginx:0,beginy:0,item:"",CloneDom:null}},mounted:function(){this.item=this.$refs.box,this.listenEvents()},methods:{_addGrabListeners:function(){var t=this;this.grabEvents.forEach(function(e){window.addEventListener(e,t._onMouseDown,{passive:!1})}),this.moveEvents.forEach(function(e){window.document.addEventListener(e,t._onMouseMove,{passive:!1})}),this.releaseEvents.forEach(function(e){window.document.addEventListener(e,t._onMouseUp,{passive:!1})})},listenEvents:function(){this._addGrabListeners()},_onMouseDown:function(t){this.boxContent=this._getContainerRect(this.item),this.isAdd=this._current(this.boxContent,t),!this.isOnDowm&&this.isAdd&&(this.isOnDowm=!0,this.$emit("down",{index:this.index,data:this.data,tags:this.tags}),this.beginx=t.clientX||t.changedTouches[0].clientX,this.beginy=t.clientY||t.changedTouches[0].clientY,this.CloneDom=this.item.cloneNode(!0),document.getElementsByTagName("body")[0].append(this.CloneDom),this.CloneDom.style.position="absolute",this.CloneDom.style.width=this.w+"px",this.CloneDom.style.height=this.h+"px",this.CloneDom.style.top=this.beginy-20+"px",this.CloneDom.style.left=this.beginx-20+"px",this.CloneDom.style.opacity=.4)},_onMouseMove:function(t){if(this.isOnDowm){var e=this._getContainerRect(this.item);this.boxContent=e;var i=t.clientX||t.changedTouches[0].clientX,r=t.clientY||t.changedTouches[0].clientY,n=i-this.beginx,s=r-this.beginy;if(this.beginy=r,this.beginx=i,this.isAdd&&this.CloneDom){var a=n+this.CloneDom.offsetLeft,o=s+this.CloneDom.offsetTop;this.CloneDom&&(this.CloneDom.style.position="absolute",this.CloneDom.style.top=o+"px",this.CloneDom.style.left=a+"px")}}},_onMouseUp:function(t){if(this.CloneDom&&document.getElementsByTagName("body")[0].removeChild(this.CloneDom),this.CloneDom=null,this.isOnDowm&&this.isAdd){var e=t.clientX||t.changedTouches[0].clientX,i=t.clientY||t.changedTouches[0].clientY;if(this.isOnDowm=!1,""!==this.toDOMId){var r=document.getElementById(this.toDOMId),n=this._getContainerRect(r);if(!(i>=n.top&&i<=n.bottom&&e>=n.left&&e<=n.right))return!1;e-=n.left,i-=n.top}this.$emit("_getContainerRect",{x:e,y:i,index:this.index,data:this.data,tags:this.tags})}return!1},_current:function(t,e){return t.left<=(e.clientX||e.changedTouches[0].clientX)&&t.right>=(e.clientX||e.changedTouches[0].clientX)&&t.top<=(e.clientY||e.changedTouches[0].clientY)&&t.bottom>=(e.clientY||e.changedTouches[0].clientY)},_getContainerRect:function(t){var e=t.getBoundingClientRect();return{left:e.left,right:e.right,top:e.top,bottom:e.bottom,width:e.width,height:e.height}},reset:function(){this.item.style.position&&(this.item.style.position="static")}}};var b=function(t){i("/p1R")},w=Object(p.a)(x,function(){var t=this.$createElement;return(this._self._c||t)("div",{ref:"box"},[this._t("default")],2)},[],!1,b,"data-v-f55f5b66",null).exports,S=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t};function A(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,i){return function r(n,s){try{var a=e[n](s),o=a.value}catch(t){return void i(t)}if(!a.done)return Promise.resolve(o).then(function(t){r("next",t)},function(t){r("throw",t)});t(o)}("next")})}}function E(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}var k={name:"mapDeviceAdd",metaInfo:{title:"设备地图添加"},data:function(){return{noneImg:'this.src="'+i("FiMw")+'"',userInfo:this.$store.getters.basicUserInfo,form:{deviceType:"",authorizationSystem:"",deviceName:""},deviceTypeDicts:[],sysDicts:[],listType:"未描点",deviceList:[],activeCollapse:"",mapInfo:null,deviceArr:[],mapLayerX:0,mapLayerY:0,mapLayerScale:1,saveLoading:!1,isEdit:!1}},computed:{newSysDicts:function(){return[{value:"",lable:"全部"}].concat(E(this.sysDicts))},newDeviceTypeDicts:function(){return[{value:"",lable:"全部"}].concat(E(this.deviceTypeDicts))},newDeviceList:function(){if(!this.deviceArr.length)return this.deviceList;var t=[],e=!0,i=!1,r=void 0;try{for(var n,s=this.deviceList[Symbol.iterator]();!(e=(n=s.next()).done);e=!0){var a=n.value;if(a.dataList.length){var o=[],l=!0,h=!1,c=void 0;try{for(var d,u=a.dataList[Symbol.iterator]();!(l=(d=u.next()).done);l=!0){var f=d.value;f.id&&!this.isMapHas(f.id)&&o.push(f)}}catch(t){h=!0,c=t}finally{try{!l&&u.return&&u.return()}finally{if(h)throw c}}if(o.length){var _={};_.deviceType=a.deviceType,_.deviceTypeName=a.deviceTypeName,_.dataList=o,t.push(_)}}}}catch(t){i=!0,r=t}finally{try{!e&&s.return&&s.return()}finally{if(i)throw r}}return t}},methods:{getSysDicts:function(){var t=this;return A(regeneratorRuntime.mark(function e(){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(l.f)({orgId:t.userInfo.orgId,userId:t.userInfo.id,tags:"device"});case 2:(i=e.sent)&&!i.error&&(t.sysDicts=i);case 4:case"end":return e.stop()}},e,t)}))()},getDeviceTypeDicts:function(){var t=this;return A(regeneratorRuntime.mark(function e(){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(l.d)({type:"DEVICE_TYPE"});case 2:(i=e.sent)&&i.data&&(t.deviceTypeDicts=i.data);case 4:case"end":return e.stop()}},e,t)}))()},getMapInfo:function(t){var e=this;return A(regeneratorRuntime.mark(function i(){var r;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,Object(h.e)({orgId:e.userInfo.orgId,id:t});case 2:(r=i.sent)&&!r.error?(e.mapInfo=r,e.getMapDeviceInfo(e.$route.query.id)):e.$toast({type:"error",message:r.message});case 4:case"end":return i.stop()}},i,e)}))()},getNoDrawPointList:function(){var t=this;return A(regeneratorRuntime.mark(function e(){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(h.g)(S({orgId:t.userInfo.orgId},t.form));case 2:(i=e.sent)&&!i.error&&(t.deviceList=i);case 4:case"end":return e.stop()}},e,t)}))()},getDrawPointList:function(){var t=this;return A(regeneratorRuntime.mark(function e(){var i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(h.c)(S({orgId:t.userInfo.orgId},t.form));case 2:(i=e.sent)&&!i.error&&(t.deviceList=i);case 4:case"end":return e.stop()}},e,t)}))()},getMapDeviceInfo:function(t){var e=this;return A(regeneratorRuntime.mark(function i(){var r;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,Object(h.d)({orgId:e.userInfo.orgId,mapId:t});case 2:(r=i.sent)&&(e.deviceArr=r);case 4:case"end":return i.stop()}},i,e)}))()},saveMapDevice:function(t){var e=this;return A(regeneratorRuntime.mark(function i(){var r;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,Object(h.h)(t);case 2:(r=i.sent)&&!r.error&&(e.saveLoading=!1,e.$toast({type:"success",message:"保存成功"}),e.$router.push({path:"/mapdevice"}));case 4:case"end":return i.stop()}},i,e)}))()},_initDeviceList:function(){"未描点"===this.listType&&this.getNoDrawPointList(),"已描点"===this.listType&&this.getDrawPointList()},saveDevice:function(t){if(t.preventDefault(),!this.$route.query.id)return this.$notify({group:"foo",type:"error",title:"抱歉,缺少重要参数,无法保存",text:"地图id是重要参数"}),!1;if(0===this.deviceArr.length)return this.$notify({group:"foo",type:"error",title:"抱歉,设备地图为空,无法保存",text:"必须在地图中添加设备,才能保存"}),!1;var e=this.deviceArr.map(function(t){var e={};return e.deviceId=t.id,e.position=t.position,e}),i={orgId:this.userInfo.orgId,id:this.$route.query.id,detailList:e};this.saveLoading=!0,this.saveMapDevice(i)},isMapHas:function(t){var e=!0,i=!1,r=void 0;try{for(var n,s=this.deviceArr[Symbol.iterator]();!(e=(n=s.next()).done);e=!0){if(n.value.id===t)return!0}}catch(t){i=!0,r=t}finally{try{!e&&s.return&&s.return()}finally{if(i)throw r}}return!1},addMapIconIteam:function(t){var e=t.x,i=t.y,r=t.data,n=(t.index,t.tags,{}),s=(e-this.mapLayerX)/this.mapLayerScale,a=(i-this.mapLayerY)/this.mapLayerScale;(n=r).position=JSON.stringify({x:s,y:a}),n.icon=r.icon,n.id=r.id,Object(u.c)(r.id,this.deviceArr,"id")&&(this.deviceArr=[].concat(E(this.deviceArr),[n]))},iconIteamDrag:function(t){var e=t.x,i=t.y,r=t.data,n=this.deviceArr.map(function(t){return t.id===r.id&&(t.position=JSON.stringify({x:e,y:i})),t});this.deviceArr=n},iconIteamDel:function(t){var e=this,i=t.id;t.data;this.$swal({title:"确定删除吗?",type:"warning",showCancelButton:!0,allowOutsideClick:!0,confirmButtonText:"确定删除!",cancelButtonText:"取消删除!",closeOnConfirm:!0},function(){var t=[];e.deviceArr.map(function(e){e.id!==i&&t.push(e)}),e.deviceArr=t,setTimeout(function(){e.$toast({type:"success",message:"删除成功"})},500)})}},created:function(){this.getSysDicts(),this.getDeviceTypeDicts(),this.$route.query.id&&"edit"===this.$route.query.type&&(this.isEdit=!0),this.$route.query.id&&""!==this.$route.query.id&&this.getMapInfo(this.$route.query.id)},mounted:function(){this.layoutHelpers.setCollapsed(!0,!1)},components:{svgDIYMapModelEdit:v,LaddaBtn:o.a,draggerBox:w,elCollapse:a.a,elCollapseItem:n.a,PerfectScrollbar:y.a}};var C=function(t){i("x3N2")},M=Object(p.a)(k,function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("h4",{staticClass:"font-weight-bold py-3 mb-0"},[i("router-link",{attrs:{to:"/mapdevice"}},[i("span",{staticClass:"text-muted font-weight-light"},[t._v("设备地图管理 /")])]),t._v("\n 设备地图"+t._s(t.isEdit?"编辑":"查看")+"\n ")],1),t._v(" "),i("b-card",{staticClass:"pl20 pr20 pt20 pb20",attrs:{"no-body":""}},[i("div",{staticClass:"row"},[i("div",{class:t.isEdit?"col-sm-6 col-md-8 mb-2":"col-12"},[i("b-card",{staticStyle:{height:"70vh"},attrs:{"no-body":""}},[i("svgDIYMapModelEdit",{attrs:{isIconEdit:t.isEdit,mapInfo:t.mapInfo,iconArr:t.deviceArr},on:{dragMapLayerFn:function(e){var i=e.x,r=e.y;t.mapLayerX=i,t.mapLayerY=r},zoomMapLayerFn:function(e){t.mapLayerScale=e},iconIteamDragFn:t.iconIteamDrag,iconIteamDelFn:t.iconIteamDel}})],1)],1),t._v(" "),t.isEdit?i("div",{staticClass:"col-sm-6 col-md-4 mb-2 border-right-0 pr"},[i("div",{staticClass:"mr20 pr10 pl10 pt10 pb10 border",staticStyle:{height:"70vh"}},[i("b-tabs",{attrs:{pills:""}},[i("b-tab",{attrs:{title:"未描点设备",active:"未描点"===t.listType},on:{click:function(e){t.listType="未描点",t._initDeviceList()}}}),t._v(" "),i("b-tab",{attrs:{title:"已描点设备",active:"已描点"===t.listType},on:{click:function(e){t.listType="已描点",t._initDeviceList()}}})],1),t._v(" "),i("hr",{staticClass:"mb-0 mt-2"}),t._v(" "),i("div",{staticClass:"pt10 pb10"},[i("b-input-group",[i("b-input-group-prepend",[i("b-form-select",{attrs:{"text-field":"lable",required:"",options:t.newDeviceTypeDicts},model:{value:t.form.deviceType,callback:function(e){t.$set(t.form,"deviceType",e)},expression:"form.deviceType"}})],1),t._v(" "),i("b-input",{attrs:{type:"text",autocomplete:"off"},nativeOn:{keyup:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;t._initDeviceList()}},model:{value:t.form.deviceName,callback:function(e){t.$set(t.form,"deviceName",e)},expression:"form.deviceName"}}),t._v(" "),i("b-input-group-append",[i("b-btn",{attrs:{variant:"primary"},on:{click:function(e){t._initDeviceList()}}},[t._v("搜索")])],1)],1),t._v(" "),i("div",{staticClass:"pt10",staticStyle:{height:"58vh"}},[i("perfect-scrollbar",{staticStyle:{height:"100%"},attrs:{options:{suppressScrollX:!0,wheelPropagation:!0}}},[i("div",{staticClass:"pr"},[i("el-collapse",{staticClass:"pl5 pr5",staticStyle:{"border-top":"0"},model:{value:t.activeCollapse,callback:function(e){t.activeCollapse=e},expression:"activeCollapse"}},t._l(t.newDeviceList,function(e,r){return i("el-collapse-item",{key:r,attrs:{title:e.deviceTypeName,name:e.deviceType}},[i("div",{staticClass:"kanban-box pt-2"},t._l(e.dataList,function(r){return i("dragger-box",{key:r.id,attrs:{data:r,toDOMId:"drawMap",tags:{deviceTypeName:e.deviceTypeName,deviceType:e.deviceType}},on:{_getContainerRect:t.addMapIconIteam}},[i("div",{staticClass:"ui-bordered p-2 mb-2 dragger-li flex-box cursor-move"},[i("div",{staticClass:"img-icon mr10",style:"background-image:url("+(r.icon?"/static/img/map/"+r.icon+".png":"")+")"}),t._v(" "),i("div",{staticClass:"dragger-content"},[t._v("\n "+t._s(r.deviceName)+"\n ")])])])}))])})),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:!t.newDeviceList.length,expression:"!newDeviceList.length"}],staticClass:"text-center pt-4 pb-4 text-muted font-weight-light"},[t._v("\n 暂无数据\n ")])],1)])],1)],1)],1),t._v(" "),i("div",{staticClass:"verticalTabs"},[i("perfect-scrollbar",{staticStyle:{height:"100%"},attrs:{options:{suppressScrollX:!0,wheelPropagation:!0}}},[i("ul",{staticClass:"verticalTabs"},t._l(t.newSysDicts,function(e){return i("li",{key:e.id,class:t.form.authorizationSystem===e.value?"active":"",on:{click:function(i){t.form.authorizationSystem=e.value,t._initDeviceList()}}},[i("a",{attrs:{href:"javascript:;"}},[t._v(t._s(e.lable))])])}))])],1)]):t._e()]),t._v(" "),i("div",{staticClass:"text-right mt-1"},[t.isEdit?i("ladda-btn",{staticClass:"btn btn-primary",attrs:{loading:t.saveLoading,"data-style":"slide-down"},nativeOn:{click:function(e){return t.saveDevice(e)}}},[t._v("保存")]):t._e(),t._v("\n \n "),i("b-btn",{attrs:{variant:"default"},on:{click:function(e){t.$router.push({path:"/mapdevice"})}}},[t._v("返回")])],1)])],1)},[],!1,C,null,null);e.default=M.exports},x3N2:function(t,e){}});
|