1// ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ \\ 2// â Raphaël 2.1.2 - JavaScript Vector Library â \\ 3// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ⤠\\ 4// â Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) â \\ 5// â Copyright © 2008-2012 Sencha Labs (http://sencha.com) â \\ 6// âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ⤠\\ 7// â Licensed under the MIT (http://raphaeljs.com/license.html) license.â \\ 8// ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ \\ 9!function(a){var b,c,d="0.4.2",e="hasOwnProperty",f=/[\.\/]/,g="*",h=function(){},i=function(a,b){return a-b},j={n:{}},k=function(a,d){a=String(a);var e,f=c,g=Array.prototype.slice.call(arguments,2),h=k.listeners(a),j=0,l=[],m={},n=[],o=b;b=a,c=0;for(var p=0,q=h.length;q>p;p++)"zIndex"in h[p]&&(l.push(h[p].zIndex),h[p].zIndex<0&&(m[h[p].zIndex]=h[p]));for(l.sort(i);l[j]<0;)if(e=m[l[j++]],n.push(e.apply(d,g)),c)return c=f,n;for(p=0;q>p;
vendor: 10,924 bytes, line 9
9p++)if(e=h[p],"zIndex"in e)if(e.zIndex==l[j]){if(n.push(e.apply(d,g)),c)break;do if(j++,e=m[l[j]],e&&n.push(e.apply(d,g)),c)break;while(e)}else m[e.zIndex]=e;else if(n.push(e.apply(d,g)),c)break;return c=f,b=o,n.length?n:null};k._events=j,k.listeners=function(a){var b,c,d,e,h,i,k,l,m=a.split(f),n=j,o=[n],p=[];for(e=0,h=m.length;h>e;e++){for(l=[],i=0,k=o.length;k>i;i++)for(n=o[i].n,c=[n[m[e]],n[g]],d=2;d--;)b=c[d],b&&(l.push(b),p=p.concat(b.f||[]));o=l}return p},k.on=function(a,b){if(a=String(a),"function"!=typeof b)return function(){};for(var c=a.split(f),d=j,e=0,g=c.length;g>e;e++)d=d.n,d=d.hasOwnProperty(c[e])&&d[c[e]]||(d[c[e]]={n:{}});for(d.f=d.f||[],e=0,g=d.f.length;g>e;e++)if(d.f[e]==b)return h;return d.f.push(b),function(a){+a==+a&&(b.zIndex=+a)}},k.f=function(a){var b=[].slice.call(arguments,1);return function(){k.apply(null,[a,null].concat(b).concat([].slice.call(arguments,0)))}},k.stop=function(){c=1},k.nt=function(a){return a?new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)").test(b):b},k.nts=function(){return b.split(f)},k.off=k.unbind=function(a,b){if(!a)return k._events=j={n:{}},void 0;var c,d,h,i,l,m,n,o=a.split(f),p=[j];for(i=0,l=o.length;l>i;i++)for(m=0;m<p.length;m+=h.length-2){if(h=[m,1],c=p[m].n,o[i]!=g)c[o[i]]&&h.push(c[o[i]]);else for(d in c)c[e](d)&&h.push(c[d]);p.splice.apply(p,h)}for(i=0,l=p.length;l>i;i++)for(c=p[i];c.n;){if(b){if(c.f){for(m=0,n=c.f.length;n>m;m++)if(c.f[m]==b){c.f.splice(m,1);break}!c.f.length&&delete c.f}for(d in c.n)if(c.n[e](d)&&c.n[d].f){var q=c.n[d].f;for(m=0,n=q.length;n>m;m++)if(q[m]==b){q.splice(m,1);break}!q.length&&delete c.n[d].f}}else{delete c.f;for(d in c.n)c.n[e](d)&&c.n[d].f&&delete c.n[d].f}c=c.n}},k.once=function(a,b){var c=function(){return k.unbind(a,c),b.apply(this,arguments)};return k.on(a,c)},k.version=d,k.toString=function(){return"You are running Eve "+d},"undefined"!=typeof module&&module.exports?module.exports=k:"undefined"!=typeof define?define("eve",[],function(){return k}):a.eve=k}(this),function(a,b){"function"==typeof define&&define.amd?define(["eve"],function(c){return b(a,c)}):b(a,a.eve)}(this,function(a,b){function c(a){if(c.is(a,"function"))return u?a():b.on("raphael.DOMload",a);if(c.is(a,V))return c._engine.create[D](c,a.splice(0,3+c.is(a[0],T))).add(a);var d=Array.prototype.slice.call(arguments,0);if(c.is(d[d.length-1],"function")){var e=d.pop();return u?e.call(c._engine.create[D](c,d)):b.on("raphael.DOMload",function(){e.call(c._engine.create[D](c,d))})}return c._engine.create[D](c,arguments)}function d(a){if("function"==typeof a||Object(a)!==a)return a;var b=new a.constructor;for(var c in a)a[z](c)&&(b[c]=d(a[c]));return b}function e(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function f(a,b,c){function d(){var f=Array.prototype.slice.call(arguments,0),g=f.join("â"),h=d.cache=d.cache||{},i=d.count=d.count||[];return h[z](g)?(e(i,g),c?c(h[g]):h[g]):(i.length>=1e3&&delete h[i.shift()],i.push(g),h[g]=a[D](b,f),c?c(h[g]):h[g])}return d}function g(){return this.hex}function h(a,b){for(var c=[],d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function i(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function j(a,b,c,d,e,f,g,h,j){null==j&&(j=1),j=j>1?1:0>j?0:j;for(var k=j/2,l=12,m=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],n=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],o=0,p=0;l>p;p++){var q=k*m[p]+k,r=i(q,a,c,e,g),s=i(q,b,d,f,h),t=r*r+s*s;o+=n[p]*N.sqrt(t)}return k*o}function k(a,b,c,d,e,f,g,h,i){if(!(0>i||j(a,b,c,d,e,f,g,h)<i)){var k,l=1,m=l/2,n=l-m,o=.01;for(k=j(a,b,c,d,e,f,g,h,n);Q(k-i)>o;)m/=2,n+=(i>k?1:-1)*m,k=j(a,b,c,d,e,f,g,h,n);return n}}function l(a,b,c,d,e,f,g,h){if(!(O(a,c)<P(e,g)||P(a,c)>O(e,g)||O(b,d)<P(f,h)||P(b,d)>O(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(k){var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(!(n<+P(a,c).toFixed(2)||n>+O(a,c).toFixed(2)||n<+P(e,g).toFixed(2)||n>+O(e,g).toFixed(2)||o<+P(b,d).toFixed(2)||o>+O(b,d).toFixed(2)||o<+P(f,h).toFixed(2)||o>+O(f,h).toFixed(2)))return{x:l,y:m}}}}function m(a,b,d){var e=c.bezierBBox(a),f=c.bezierBBox(b);if(!c.isBBoxIntersect(e,f))return d?0:[];for(var g=j.apply(0,a),h=j.apply(0,b),i=O(~~(g/5),1),k=O(~~(h/5),1),m=[],n=[],o={},p=d?0:[],q=0;i+1>q;q++){var r=c.findDotsAtSegment.apply(c,a.concat(q/i));m.push({x:r.x,y:r.y,t:q/i})}for(q=0;k+1>q;q++)r=c.findDotsAtSegment.apply(c,b.concat(q/k)),n.push({x:r.x,y:r.y,t:q/k});for(q=0;i>q;q++)for(var s=0;k>s;s++){var t=m[q],u=m[q+1],v=n[s],w=n[s+1],x=Q(u.x-t.x)<.001?"y":"x",y=Q(w.x-v.x)<.001?"y":"x",z=l(t.x,t.y,u.x,u.y,v.x,v.y,w.x,w.y);if(z){if(o[z.x.toFixed(4)]==z.y.toFixed(4))continue;o[z.x.toFixed(4)]=z.y.toFixed(4);var A=t.t+Q((z[x]-t[x])/(u[x]-t[x]))*(u.t-t.t),B=v.t+Q((z[y]-v[y])/(w[y]-v[y]))*(w.t-v.t);A>=0&&1.001>=A&&B>=0&&1.001>=B&&(d?p++:p.push({x:z.x,y:z.y,t1:P(A,1),t2:P(B,1)}))}}return p}function n(a,b,d){a=c._path2curve(a),b=c._path2curve(b);for(var e,f,g,h,i,j,k,l,n,o,p=d?0:[],q=0,r=a.length;r>q;q++){var s=a[q];if("M"==s[0])e=i=s[1],f=j=s[2];else{"C"==s[0]?(n=[e,f].concat(s.slice(1)),e=n[6],f=n[7]):(n=[e,f,e,f,i,j,i,j],e=i,f=j);for(var t=0,u=b.length;u>t;t++){var v=b[t];if("M"==v[0])g=k=v[1],h=l=v[2];else{"C"==v[0]?(o=[g,h].concat(v.slice(1)),g=o[6],h=o[7]):(o=[g,h,g,h,k,l,k,l],g=k,h=l);var w=m(n,o,d);if(d)p+=w;else{for(var x=0,y=w.length;y>x;x++)w[x].segment1=q,w[x].segment2=t,w[x].bez1=n,w[x].bez2=o;p=p.concat(w)}}}}}return p}function o(a,b,c,d,e,f){null!=a?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function p(){return this.x+H+this.y+H+this.width+" Ã "+this.height}function q(a,b,c,d,e,f){function g(a){return((l*a+k)*a+j)*a}function h(a,b){var c=i(a,b);return((o*c+n)*c+m)*c}function i(a,b){var c,d,e,f,h,i;for(e=a,i=0;8>i;i++){if(f=g(e)-a,Q(f)<b)return e;if(h=(3*l*e+2*k)*e+j,Q(h)<1e-6)break;e-=f/h}if(c=0,d=1,e=a,c>e)return c;if(e>d)return d;for(;d>c;){if(f=g(e),Q(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}var j=3*b,k=3*(d-b)-j,l=1-j-k,m=3*c,n=3*(e-c)-m,o=1-m-n;return h(a,1/(200*f))}function r(a,b){var c=[],d={};if(this.ms=b,this.times=1,a){for(var e in a)a[z](e)&&(d[_(e)]=a[e],c.push(_(e)));c.sort(lb)}this.anim=d,this.top=c[c.length-1],this.percents=c}function s(a,d,e,f,g,h){e=_(e);var i,j,k,l,m,n,p=a.ms,r={},s={},t={};if(f)for(v=0,x=ic.length;x>v;v++){var u=ic[v];if(u.el.id==d.id&&u.anim==a){u.percent!=e?(ic.splice(v,1),k=1):j=u,d.attr(u.totalOrigin);break}}else f=+s;for(var v=0,x=a.percents.length;x>v;v++){if(a.percents[v]==e||a.percents[v]>f*a.top){e=a.percents[v],m=a.percents[v-1]||0,p=p/a.top*(e-m),l=a.percents[v+1],i=a.anim[e];break}f&&d.attr(a.anim[a.percents[v]])}if(i){if(j)j.initstatus=f,j.start=new Date-j.ms*f;else{for(var y in i)if(i[z](y)&&(db[z](y)||d.paper.customAttributes[z](y)))switch(r[y]=d.attr(y),null==r[y]&&(r[y]=cb[y]),s[y]=i[y],db[y]){case T:t[y]=(s[y]-r[y])/p;break;case"colour":r[y]=c.getRGB(r[y]);var A=c.getRGB(s[y]);t[y]={r:(A.r-r[y].r)/p,g:(A.g-r[y].g)/p,b:(A.b-r[y].b)/p};break;case"path":var B=Kb(r[y],s[y]),C=B[1];for(r[y]=B[0],t[y]=[],v=0,x=r[y].length;x>v;v++){t[y][v]=[0];for(var D=1,F=r[y][v].length;F>D;D++)t[y][v][D]=(C[v][D]-r[y][v][D])/p}break;case"transform":var G=d._,H=Pb(G[y],s[y]);if(H)for(r[y]=H.from,s[y]=H.to,t[y]=[],t[y].real=!0,v=0,x=r[y].length;x>v;v++)for(t[y][v]=[r[y][v][0]],D=1,F=r[y][v].length;F>D;D++)t[y][v][D]=(s[y][v][D]-r[y][v][D])/p;else{var K=d.matrix||new o,L={_:{transform:G.transform},getBBox:function(){return d.getBBox(1)}};r[y]=[K.a,K.b,K.c,K.d,K.e,K.f],Nb(L,s[y]),s[y]=L._.transform,t[y]=[(L.matrix.a-K.a)/p,(L.matrix.b-K.b)/p,(L.matrix.c-K.c)/p,(L.matrix.d-K.d)/p,(L.matrix.e-K.e)/p,(L.matrix.f-K.f)/p]}break;case"csv":var M=I(i[y])[J](w),N=I(r[y])[J](w);if("clip-rect"==y)for(r[y]=N,t[y]=[],v=N.length;v--;)t[y][v]=(M[v]-r[y][v])/p;s[y]=M;break;default:for(M=[][E](i[y]),N=[][E](r[y]),t[y]=[],v=d.paper.customAttributes[y].length;v--;)t[y][v]=((M[v]||0)-(N[v]||0))/p}var O=i.easing,P=c.easing_formulas[O];if(!P)if(P=I(O).match(Z),P&&5==P.length){var Q=P;P=function(a){return q(a,+Q[1],+Q[2],+Q[3],+Q[4],p)}}else P=nb;if(n=i.start||a.start||+new Date,u={anim:a,percent:e,timestamp:n,start:n+(a.del||0),status:0,initstatus:f||0,stop:!1,ms:p,easing:P,from:r,diff:t,to:s,el:d,callback:i.callback,prev:m,next:l,repeat:h||a.times,origin:d.attr(),totalOrigin:g},ic.push(u),f&&!j&&!k&&(u.stop=!0,u.start=new Date-p*f,1==ic.length))return kc();k&&(u.start=new Date-u.ms*f),1==ic.length&&jc(kc)}b("raphael.anim.start."+d.id,d,a)}}function t(a){for(var b=0;b<ic.length;b++)ic[b].el.paper==a&&ic.splice(b--,1)}c.version="2.1.2",c.eve=b;var u,v,w=/[, ]+/,x={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},y=/\{(\d+)\}/g,z="hasOwnProperty",A={doc:document,win:a},B={was:Object.prototype[z].call(A.win,"Raphael"),is:A.win.Raphael},C=function(){this.ca=this.customAttributes={}},D="apply",E="concat",F="ontouchstart"in A.win||A.win.DocumentTouch&&A.doc instanceof DocumentTouch,G="",H=" ",I=String,J="split",K="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[J](H),L={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},M=I.prototype.toLowerCase,N=Math,O=N.max,P=N.min,Q=N.abs,R=N.pow,S=N.PI,T="number",U="string",V="array",W=Object.prototype.toString,X=(c._ISURL=/^url\(['"]?([^\)]+?)['"]?\)$/i,/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i),Y={NaN:1,Infinity:1,"-Infinity":1},Z=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,$=N.round,_=parseFloat,ab=parseInt,bb=I.prototype.toUpperCase,cb=c._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0},db=c._availableAnimAttrs={blur:T,"clip-rect":"csv",cx:T,cy:T,fill:"
9colour","fill-opacity":T,"font-size":T,height:T,opacity:T,path:"path",r:T,rx:T,ry:T,stroke:"colour","stroke-opacity":T,"stroke-width":T,transform:"transform",width:T,x:T,y:T},eb=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,fb={hs:1,rg:1},gb=/,?([achlmqrstvxz]),?/gi,hb=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,ib=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi,jb=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/gi,kb=(c._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,{}),lb=function(a,b){return _(a)-_(b)},mb=function(){},nb=function(a){return a},ob=c._rectPath=function(a,b,c,d,e){return e?[["M",a+e,b],["l",c-2*e,0],["a",e,e,0,0,1,e,e],["l",0,d-2*e],["a",e,e,0,0,1,-e,e],["l",2*e-c,0],["a",e,e,0,0,1,-e,-e],["l",0,2*e-d],["a",e,e,0,0,1,e,-e],["z"]]:[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]]},pb=function(a,b,c,d){return null==d&&(d=c),[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]]},qb=c._getPath={path:function(a){return a.attr("path")},circle:function(a){var b=a.attrs;return pb(b.cx,b.cy,b.r)},ellipse:function(a){var b=a.attrs;return pb(b.cx,b.cy,b.rx,b.ry)},rect:function(a){var b=a.attrs;return ob(b.x,b.y,b.width,b.height,b.r)},image:function(a){var b=a.attrs;return ob(b.x,b.y,b.width,b.height)},text:function(a){var b=a._getBBox();return ob(b.x,b.y,b.width,b.height)},set:function(a){var b=a._getBBox();return ob(b.x,b.y,b.width,b.height)}},rb=c.mapPath=function(a,b){if(!b)return a;var c,d,e,f,g,h,i;for(a=Kb(a),e=0,g=a.length;g>e;e++)for(i=a[e],f=1,h=i.length;h>f;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d;return a};if(c._g=A,c.type=A.win.SVGAngle||A.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML","VML"==c.type){var sb,tb=A.doc.createElement("div");if(tb.innerHTML='<v:shape adj="1"/>',sb=tb.firstChild,sb.style.behavior="url(#default#VML)",!sb||"object"!=typeof sb.adj)return c.type=G;tb=null}c.svg=!(c.vml="VML"==c.type),c._Paper=C,c.fn=v=C.prototype=c.prototype,c._id=0,c._oid=0,c.is=function(a,b){return b=M.call(b),"finite"==b?!Y[z](+a):"array"==b?a instanceof Array:"null"==b&&null===a||b==typeof a&&null!==a||"object"==b&&a===Object(a)||"array"==b&&Array.isArray&&Array.isArray(a)||W.call(a).slice(8,-1).toLowerCase()==b},c.angle=function(a,b,d,e,f,g){if(null==f){var h=a-d,i=b-e;return h||i?(180+180*N.atan2(-i,-h)/S+360)%360:0}return c.angle(a,b,f,g)-c.angle(d,e,f,g)},c.rad=function(a){return a%360*S/180},c.deg=function(a){return 180*a/S%360},c.snapTo=function(a,b,d){if(d=c.is(d,"finite")?d:10,c.is(a,V)){for(var e=a.length;e--;)if(Q(a[e]-b)<=d)return a[e]}else{a=+a;var f=b%a;if(d>f)return b-f;if(f>a-d)return b-f+a}return b},c.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=0|16*N.random(),c="x"==a?b:8|3&b;return c.toString(16)}),c.setWindow=function(a){b("raphael.setWindow",c,A.win,a),A.win=a,A.doc=A.win.document,c._engine.initWin&&c._engine.initWin(A.win)};
vendor: 18,881 bytes, lines 9-10
9var ub=function(a){if(c.vml){var b,d=/^\s+|\s+$/g;try{var e=new ActiveXObject("htmlfile");e.write("<body>"),e.close(),b=e.body}catch(g){b=createPopup().document.body}var h=b.createTextRange();ub=f(function(a){try{b.style.color=I(a).replace(d,G);var c=h.queryCommandValue("ForeColor");return c=(255&c)<<16|65280&c|(16711680&c)>>>16,"#"+("000000"+c.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=A.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",A.doc.body.appendChild(i),ub=f(function(a){return i.style.color=a,A.doc.defaultView.getComputedStyle(i,G).getPropertyValue("color")})}return ub(a)},vb=function(){return"hsb("+[this.h,this.s,this.b]+")"},wb=function(){return"hsl("+[this.h,this.s,this.l]+")"},xb=function(){return this.hex},yb=function(a,b,d){if(null==b&&c.is(a,"object")&&"r"in a&&"g"in a&&"b"in a&&(d=a.b,b=a.g,a=a.r),null==b&&c.is(a,U)){var e=c.getRGB(a);a=e.r,b=e.g,d=e.b}return(a>1||b>1||d>1)&&(a/=255,b/=255,d/=255),[a,b,d]},zb=function(a,b,d,e){a*=255,b*=255,d*=255;var f={r:a,g:b,b:d,hex:c.rgb(a,b,d),toString:xb};return c.is(e,"finite")&&(f.opacity=e),f};c.color=function(a){var b;return c.is(a,"object")&&"h"in a&&"s"in a&&"b"in a?(b=c.hsb2rgb(a),a.r=b.r,a.g=b.g,a.b=b.b,a.hex=b.hex):c.is(a,"object")&&"h"in a&&"s"in a&&"l"in a?(b=c.hsl2rgb(a),a.r=b.r,a.g=b.g,a.b=b.b,a.hex=b.hex):(c.is(a,"string")&&(a=c.getRGB(a)),c.is(a,"object")&&"r"in a&&"g"in a&&"b"in a?(b=c.rgb2hsl(a),a.h=b.h,a.s=b.s,a.l=b.l,b=c.rgb2hsb(a),a.v=b.b):(a={hex:"none"},a.r=a.g=a.b=a.h=a.s=a.v=a.l=-1)),a.toString=xb,a},c.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;return a=a%360/60,i=c*b,h=i*(1-Q(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],zb(e,f,g,d)},c.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h),(a>1||b>1||c>1)&&(a/=360,b/=100,c/=100),a*=360;var e,f,g,h,i;return a=a%360/60,i=2*b*(.5>c?c:1-c),h=i*(1-Q(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],zb(e,f,g,d)},c.rgb2hsb=function(a,b,c){c=yb(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;return f=O(a,b,c),g=f-P(a,b,c),d=0==g?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=60*((d+360)%6)/360,e=0==g?0:g/f,{h:d,s:e,b:f,toString:vb}},c.rgb2hsl=function(a,b,c){c=yb(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;return g=O(a,b,c),h=P(a,b,c),i=g-h,d=0==i?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=60*((d+360)%6)/360,f=(g+h)/2,e=0==i?0:.5>f?i/(2*f):i/(2-2*f),{h:d,s:e,l:f,toString:wb}},c._path2string=function(){return this.join(",").replace(gb,"$1")},c._preload=function(a,b){var c=A.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,A.doc.body.removeChild(this)},c.onerror=function(){A.doc.body.removeChild(this)},A.doc.body.appendChild(c),c.src=a},c.getRGB=f(function(a){if(!a||(a=I(a)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:g};if("none"==a)return{r:-1,g:-1,b:-1,hex:"none",toString:g};!(fb[z](a.toLowerCase().substring(0,2))||"#"==a.charAt())&&(a=ub(a));var b,d,e,f,h,i,j=a.match(X);return j?(j[2]&&(e=ab(j[2].substring(5),16),d=ab(j[2].substring(3,5),16),b=ab(j[2].substring(1,3),16)),j[3]&&(e=ab((h=j[3].charAt(3))+h,16),d=ab((h=j[3].charAt(2))+h,16),b=ab((h=j[3].charAt(1))+h,16)),j[4]&&(i=j[4][J](eb),b=_(i[0]),"%"==i[0].slice(-1)&&(b*=2.55),d=_(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=_(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),"rgba"==j[1].toLowerCase().slice(0,4)&&(f=_(i[3])),i[3]&&"%"==i[3].slice(-1)&&(f/=100)),j[5]?(i=j[5][J](eb),b=_(i[0]),"%"==i[0].slice(-1)&&(b*=2.55),d=_(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=_(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),("deg"==i[0].slice(-3)||"°"==i[0].slice(-1))&&(b/=360),"hsba"==j[1].toLowerCase().slice(0,4)&&(f=_(i[3])),i[3]&&"%"==i[3].slice(-1)&&(f/=100),c.hsb2rgb(b,d,e,f)):j[6]?(i=j[6][J](eb),b=_(i[0]),"%"==i[0].slice(-1)&&(b*=2.55),d=_(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=_(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),("deg"==i[0].slice(-3)||"°"==i[0].slice(-1))&&(b/=360),"hsla"==j[1].toLowerCase().slice(0,4)&&(f=_(i[3])),i[3]&&"%"==i[3].slice(-1)&&(f/=100),c.hsl2rgb(b,d,e,f)):(j={r:b,g:d,b:e,toString:g},j.hex="#"+(16777216|e|d<<8|b<<16).toString(16).slice(1),c.is(f,"finite")&&(j.opacity=f),j)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:g}},c),c.hsb=f(function(a,b,d){return c.hsb2rgb(a,b,d).hex}),c.hsl=f(function(a,b,d){return c.hsl2rgb(a,b,d).hex}),c.rgb=f(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),c.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);return b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b})),c.hex},c.getColor.reset=function(){delete this.start},c.parsePathString=function(a){if(!a)return null;var b=Ab(a);if(b.arr)return Cb(b.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];return c.is(a,V)&&c.is(a[0],V)&&(e=Cb(a)),e.length||I(a).replace(hb,function(a,b,c){var f=[],g=b.toLowerCase();if(c.replace(jb,function(a,b){b&&f.push(+b)}),"m"==g&&f.length>2&&(e.push([b][E](f.splice(0,2))),g="l",b="m"==b?"l":"L"),"r"==g)e.push([b][E](f));else for(;f.length>=d[g]&&(e.push([b][E](f.splice(0,d[g]))),d[g]););}),e.toString=c._path2string,b.arr=Cb(e),e},c.parseTransformString=f(function(a){if(!a)return null;var b=[];return c.is(a,V)&&c.is(a[0],V)&&(b=Cb(a)),b.length||I(a).replace(ib,function(a,c,d){var e=[];M.call(c),d.replace(jb,function(a,b){b&&e.push(+b)}),b.push([c][E](e))}),b.toString=c._path2string,b});var Ab=function(a){var b=Ab.ps=Ab.ps||{};return b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[z](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])}),b[a]};c.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=R(j,3),l=R(j,2),m=i*i,n=m*i,o=k*a+3*l*i*c+3*j*i*i*e+n*g,p=k*b+3*l*i*d+3*j*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,w=j*e+i*g,x=j*f+i*h,y=90-180*N.atan2(q-s,r-t)/S;return(q>s||t>r)&&(y+=180),{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:w,y:x},alpha:y}},c.bezierBBox=function(a,b,d,e,f,g,h,i){c.is(a,"array")||(a=[a,b,d,e,f,g,h,i]);var j=Jb.apply(null,a);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},c.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},c.isBBoxIntersect=function(a,b){var d=c.isPointInsideBBox;return d(b,a.x,a.y)||d(b,a.x2,a.y)||d(b,a.x,a.y2)||d(b,a.x2,a.y2)||d(a,b.x,b.y)||d(a,b.x2,b.y)||d(a,b.x,b.y2)||d(a,b.x2,b.y2)||(a.x<b.x2&&a.x>b.x||b.x<a.x2&&b.x>a.x)&&(a.y<b.y2&&a.y>b.y||b.y<a.y2&&b.y>a.y)},c.pathIntersection=function(a,b){return n(a,b)},c.pathIntersectionNumber=function(a,b){return n(a,b,1)},c.isPointInsidePath=function(a,b,d){var e=c.pathBBox(a);return c.isPointInsideBBox(e,b,d)&&1==n(a,[["M",b,d],["H",e.x2+10]],1)%2},c._removedFactory=function(a){return function(){b("raphael.log",null,"Raphaël: you are calling to method â"+a+"â of removed object",a)}};var Bb=c.pathBBox=function(a){var b=Ab(a);if(b.bbox)return d(b.bbox);if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=Kb(a);for(var c,e=0,f=0,g=[],h=[],i=0,j=a.length;j>i;i++)if(c=a[i],"M"==c[0])e=c[1],f=c[2],g.push(e),h.push(f);else{var k=Jb(e,f,c[1],c[2],c[3],c[4],c[5],c[6]);g=g[E](k.min.x,k.max.x),h=h[E](k.min.y,k.max.y),e=c[5],f=c[6]}var l=P[D](0,g),m=P[D](0,h),n=O[D](0,g),o=O[D](0,h),p=n-l,q=o-m,r={x:l,y:m,x2:n,y2:o,width:p,height:q,cx:l+p/2,cy:m+q/2};return b.bbox=d(r),r},Cb=function(a){var b=d(a);return b.toString=c._path2string,b},Db=c._pathToRelative=function(a){var b=Ab(a);if(b.rel)return Cb(b.rel);c.is(a,V)&&c.is(a&&a[0],V)||(a=c.parsePathString(a));var d=[],e=0,f=0,g=0,h=0,i=0;"M"==a[0][0]&&(e=a[0][1],f=a[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=a.length;k>j;j++){var l=d[j]=[],m=a[j];if(m[0]!=M.call(m[0]))switch(l[0]=M.call(m[0]),l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;o>n;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}else{l=d[j]=[],"m"==m[0]&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;q>p;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}return d.toString=c._path2string,b.rel=Cb(d),d},Eb=c._pathToAbsolute=function(a){var b=Ab(a);if(b.abs)return Cb(b.abs);if(c.is(a,V)&&c.is(a&&a[0],V)||(a=c.parsePathString(a)),!a||!a.length)return[["M",0,0]];var d=[],e=0,f=0,g=0,i=0,j=0;"M"==a[0][0]&&(e=+a[0][1],f=+a[0][2],g=e,i=f,j++,d[0]=["M",e,f]);for(var k,l,m=3==a.length&&"M"==a[0][0]&&"R"==a[1][0].toUpperCase()&&"Z"==a[2][0].toUpperCase(),n=j,o=a.length;o>n;n++){if(d.push(k=[]),l=a[n],l[0]!=bb.call(l[0]))switch(k[0]=bb.call(l[0]),k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":for(var p=[e,f][E](l.slice(1)),q=2,r=p.length;r>q;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[E](h(p,m));break;case"M":g=+l[1]+e,i=+l[2]+f;default:for(q=1,r=l.length;r>q;q++)k[q]=+l[q]+(q%2?e:f)}else if("R"==l[0])p=[e,f][E](l.slice(1)),d.pop(),d=d[E](h(p,m)),k=["R"][E](l.slice(-2));else for(var s=0,t=l.length;t>s;s++)k[s]=l[s];switch(k[0]){case"Z":e=g,f=i;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":g=k[k.length-2],i=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}return d.toString=c._path2string,b.abs=Cb(d),d},Fb=function(a,b,c,d){return[a,b,c,d,c,d]},Gb=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},Hb=function(a,b,c,d,e,g,h,i,j,k){var l,m=120*S/180,n=S/180*(+e||0),o=[],p=f(function(a,b,c){var d=a*N.cos(c)-b*N.sin(c),e=a*N.sin(c)+b*N.cos(c);return{x:d,y:e}});if(k)y=k[0],z=k[1],w=k[2],x=k[3];else{l=p(a,b,-n),a=l.x,b=l.y,l=p(i,j,-n),i=l.x,j=l.y;var q=(N.cos(S/180*e),N.sin(S/180*e),(a-i)/2),r=(b-j)/2,s=q*q/(c*c)+r*r/(d*d);s>1&&(s=N.sqrt(s),c=s*c,d=s*d);var t=c*c,u=d*d,v=(g==h?-1:1)*N.sqrt(Q((t*u-t*r*r-u*q*q)/(t*r*r+u*q*q))),w=v*c*r/d+(a+i)/2,x=v*-d*q/c+(b+j)/2,y=N.asin(((b-x)/d).toFixed(9)),z=N.asin(((j-x)/d).toFixed(9));y=w>a?S-y:y,z=w>i?S-z:z,0>y&&(y=2*S+y),0>z&&(z=2*S+z),h&&y>z&&(y-=2*S),!h&&z>y&&(z-=2*S)}var A=z-y;if(Q(A)>m){var B=z,C=i,D=j;z=y+m*(h&&z>y?1:-1),i=w+c*N.cos(z),j=x+d*N.sin(z),o=Hb(i,j,c,d,e,0,h,C,D,[z,B,w,x])}A=z-y;var F=N.cos(y),G=N.sin(y),H=N.cos(z),I=N.sin(z),K=N.tan(A/4),L=4/3*c*K,M=4/3*d*K,O=[a,b],P=[a+L*G,b-M*F],R=[i+L*I,j-M*H],T=[i,j];if(P[0]=2*O[0]-P[0],P[1]=2*O[1]-P[1],k)return[P,R,T][E](o);o=[P,R,T][E](o).join()[J](",");for(var U=[],V=0,W=o.length;W>V;V++)U[V]=V%2?p(o[V-1],o[V],n).y:p(o[V],o[V+1],n).x;return U},Ib=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:R(j,3)*a+3*R(j,2)*i*c+3*j*i*i*e+R(i,3)*g,y:R(j,3)*b+3*R(j,2)*i*d+3*j*i*i*f+R(i,3)*h}},Jb=f(function(a,b,c,d,e,f,g,h){var i,j=e-2*c+a-(g-2*e+c),k=2*(c-a)-2*(e-c),l=a-c,m=(-k+N.sqrt(k*k-4*j*l))/2/j,n=(-k-N.sqrt(k*k-4*j*l))/2/j,o=[b,h],p=[a,g];return Q(m)>"1e12"&&(m=.5),Q(n)>"1e12"&&(n=.5),m>0&&1>m&&(i=Ib(a,b,c,d,e,f,g,h,m),p.push(i.x),o.push(i.y)),n>0&&1>n&&(i=Ib(a,b,c,d,e,f,g,h,n),p.push(i.x),o.push(i.y)),j=f-2*d+b-(h-2*f+d),k=2*(d-b)-2*(f-d),l=b-d,m=(-k+N.sqrt(k*k-4*j*l))/2/j,n=(-k-N.sqrt(k*k-4*j*l))/2/j,Q(m)>"1e12"&&(m=.5),Q(n)>"1e12"&&(n=.5),m>0&&1>m&&(i=Ib(a,b,c,d,e,f,g,h,m),p.push(i.x),o.push(i.y)),n>0&&1>n&&(i=Ib(a,b,c,d,e,f,g,h,n),p.push(i.x),o.push(i.y)),{min:{x:P[D](0,p),y:P[D](0,o)},max:{x:O[D](0,p),y:O[D](0,o)}}}),Kb=c._path2curve=f(function(a,b){var c=!b&&Ab(a);if(!b&&c.curve)return Cb(c.curve);for(var d=Eb(a),e=b&&Eb(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=(function(a,b,c){var d,e;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];switch(!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null),a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][E](Hb[D](0,[b.x,b.y][E](a.slice(1))));break;case"S":"C"==c||"S"==c?(d=2*b.x-b.bx,e=2*b.y-b.by):(d=b.x,e=b.y),a=["C",d,e][E](a.slice(1));break;case"T":"Q"==c||"T"==c?(b.qx=2*b.x-b.qx,b.qy=2*b.y-b.qy):(b.qx=b.x,b.qy=b.y),a=["C"][E](Gb(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][E](Gb(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][E](Fb(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][E](Fb(b.x,b.y,a[1],b.y));break;case"V":a=["C"][E](Fb(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][E](Fb(b.x,b.y,b.X,b.Y))}return a}),i=function(a,b){if(a[b].length>7){a[b].shift();for(var c=a[b];c.length;)a.splice(b++,0,["C"][E](c.splice(0,6)));a.splice(b,1),l=O(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&"M"==a[g][0]&&"M"!=b[g][0]&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],l=O(d.length,e&&e.length||0))},k=0,l=O(d.length,e&&e.length||0);l>k;k++){d[k]=h(d[k],f),i(d,k),e&&(e[k]=h(e[k],g)),e&&i(e,k),j(d,e,f,g,k),j(e,d,g,f,k);var m=d[k],n=e&&e[k],o=m.length,p=e&&n.length;f.x=m[o-2],f.y=m[o-1],f.bx=_(m[o-4])||f.x,f.by=_(m[o-3])||f.y,g.bx=e&&(_(n[p-4])||g.x),g.by=e&&(_(n[p-3])||g.y),g.x=e&&n[p-2],g.y=e&&n[p-1]}return e||(c.curve=Cb(d)),e?[d,e]:d},null,Cb),Lb=(c._parseDots=f(function(a){for(var b=[],d=0,e=a.length;e>d;d++){var f={},g=a[d].match(/^([^:]*):?([\d\.]*)/);if(f.color=c.getRGB(g[1]),f.color.error)return null;f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),b.push(f)}for(d=1,e=b.length-1;e>d;d++)if(!b[d].offset){for(var h=_(b[d-1].offset||0),i=0,j=d+1;e>j;j++)if(b[j].offset){i=b[j].offset;break}i||(i=100,j=e),i=_(i);for(var k=(i-h)/(j-d+1);j>d;d++)h+=k,b[d].offset=h+"%"}return b}),c._tear=function(a,b){a==b.top&&(b.top=a.prev),a==b.bottom&&(b.bottom=a.next),a.next&&(a.next.prev=a.prev),a.prev&&(a.prev.next=a.next)}),Mb=(c._tofront=function(a,b){b.top!==a&&(Lb(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},c._toback=function(a,b){b.bottom!==a&&(Lb(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},c._insertafter=function(a,b,c){Lb(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},c._insertbefore=function(a,b,c){Lb(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},c.toMatrix=function(a,b){var c=Bb(a),d={_:{transform:G},getBBox:function(){return c}};return Nb(d,b),d.matrix}),Nb=(c.transformPath=function(a,b){return rb(a,Mb(a,b))},c._extractTransform=function(a,b){if(null==b)return a._.transform;b=I(b).replace(/\.{3}|\u2026/g,a._.transform||G);var d=c.parseTransformString(b),e=0,f=0,g=0,h=1,i=1,j=a._,k=new o;if(j.transform=d||[],d)for(var l=0,m=d.length;m>l;l++){var n,p,q,r,s,t=d[l],u=t.length,v=I(t[0]).toLowerCase(),w=t[0]!=v,x=w?k.invert():0;"t"==v&&3==u?w?(n=x.x(0,0),p=x.y(0,0),q=x.x(t[1],t[2]),r=x.y(t[1],t[2]),k.translate(q-n,r-p)):k.translate(t[1],t[2]):"r"==v?2==u?(s=s||a.getBBox(1),k.rotate(t[1],s.x+s.width/2,s.y+s.height/2),e+=t[1]):4==u&&(w?(q=x.x(t[2],t[3]),r=x.y(t[2],t[3]),k.rotate(t[1],q,r)):k.rotate(t[1],t[2],t[3]),e+=t[1]):"s"==v?2==u||3==u?(s=s||a.getBBox(1),k.scale(t[1],t[u-1],s.x+s.width/2,s.y+s.height/2),h*=t[1],i*=t[u-1]):5==u&&(w?(q=x.x(t[3],t[4]),r=x.y(t[3],t[4]),k.scale(t[1],t[2],q,r)):k.scale(t[1],t[2],t[3],t[4]),h*=t[1],i*=t[2]):"m"==v&&7==u&&k.add(t[1],t[2],t[3],t[4],t[5],t[6]),j.dirtyT=1,a.matrix=k}a.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,1==h&&1==i&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1}),Ob=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return 4==a.length?[b,0,a[2],a[3]]:[b,0];case"s":return 5==a.length?[b,1,1,a[3],a[4]]:3==a.length?[b,1,1]:[b,1]}},Pb=c._equaliseTransform=function(a,b){b=I(b).replace(/\.{3}|\u2026/g,a),a=c.parseTransformString(a)||[],b=c.parseTransformString(b)||[];for(var d,e,f,g,h=O(a.length,b.length),i=[],j=[],k=0;h>k;k++){if(f=a[k]||Ob(b[k]),g=b[k]||Ob(f),f[0]!=g[0]||"r"==f[0].toLowerCase()&&(f[2]!=g[2]||f[3]!=g[3])||"s"==f[0].toLowerCase()&&(f[3]!=g[3]||f[4]!=g[4]))return;for(i[k]=[],j[k]=[],d=0,e=O(f.length,g.length);e>d;d++)d in f&&(i[k][d]=f[d]),d in g&&(j[k][d]=g[d]) 10}return{from:i,to:j}};c._getContainer=function(a,b,d,e){var f;return f=null!=e||c.is(a,"object")?a:A.doc.getElementById(a),null!=f?f.tagName?null==b?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:b,height:d}:{container:1,x:a,y:b,width:d,height:e}:void 0},c.pathToRelative=Db,c._engine={},c.path2curve=Kb,c.matrix=function(a,b,c,d,e,f){return new o(a,b,c,d,e,f)},function(a){function b(a){return a[0]*a[0]+a[1]*a[1]}function d(a){var c=N.sqrt(b(a));a[0]&&(a[0]/=c),a[1]&&(a[1]/=c)}a.add=function(a,b,c,d,e,f){var g,h,i,j,k=[[],[],[]],l=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],m=[[a,c,e],[b,d,f],[0,0,1]];for(a&&a instanceof o&&(m=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]),g=0;3>g;g++)for(h=0;3>h;h++){for(j=0,i=0;3>i;i++)j+=l[g][i]*m[i][h];k[g][h]=j}this.a=k[0][0],this.b=k[1][0],this.c=k[0][1],this.d=k[1][1],this.e=k[0][2],this.f=k[1][2]},a.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new o(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},a.clone=function(){return new o(this.a,this.b,this.c,this.d,this.e,this.f)},a.translate=function(a,b){this.add(1,0,0,1,a,b)},a.scale=function(a,b,c,d){null==b&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},a.rotate=function(a,b,d){a=c.rad(a),b=b||0,d=d||0;var e=+N.cos(a).toFixed(9),f=+N.sin(a).toFixed(9);this.add(e,f,-f,e,b,d),this.add(1,0,0,1,-b,-d)},a.x=function(a,b){return a*this.a+b*this.c+this.e},a.y=function(a,b){return a*this.b+b*this.d+this.f},a.get=function(a){return+this[I.fromCharCode(97+a)].toFixed(4)},a.toString=function(){return c.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},a.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},a.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},a.split=function(){var a={};a.dx=this.e,a.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];a.scalex=N.sqrt(b(e[0])),d(e[0]),a.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*a.shear,e[1][1]-e[0][1]*a.shear],a.scaley=N.sqrt(b(e[1])),d(e[1]),a.shear/=a.scaley;var f=-e[0][1],g=e[1][1];return 0>g?(a.rotate=c.deg(N.acos(g)),0>f&&(a.rotate=360-a.rotate)):a.rotate=c.deg(N.asin(f)),a.isSimple=!(+a.shear.toFixed(9)||a.scalex.toFixed(9)!=a.scaley.toFixed(9)&&a.rotate),a.isSuperSimple=!+a.shear.toFixed(9)&&a.scalex.toFixed(9)==a.scaley.toFixed(9)&&!a.rotate,a.noRotation=!+a.shear.toFixed(9)&&!a.rotate,a},a.toTransformString=function(a){var b=a||this[J]();
10return b.isSimple?(b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4),(b.dx||b.dy?"t"+[b.dx,b.dy]:G)+(1!=b.scalex||1!=b.scaley?"s"+[b.scalex,b.scaley,0,0]:G)+(b.rotate?"r"+[b.rotate,0,0]:G)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(o.prototype);var Qb=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);v.safari="Apple Computer, Inc."==navigator.vendor&&(Qb&&Qb[1]<4||"iP"==navigator.platform.slice(0,2))||"Google Inc."==navigator.vendor&&Qb&&Qb[1]<8?function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:mb;for(var Rb=function(){this.returnValue=!1},Sb=function(){return this.originalEvent.preventDefault()},Tb=function(){this.cancelBubble=!0},Ub=function(){return this.originalEvent.stopPropagation()},Vb=function(a){var b=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,c=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft;return{x:a.clientX+c,y:a.clientY+b}},Wb=function(){return A.doc.addEventListener?function(a,b,c,d){var e=function(a){var b=Vb(a);return c.call(d,a,b.x,b.y)};if(a.addEventListener(b,e,!1),F&&L[b]){var f=function(b){for(var e=Vb(b),f=b,g=0,h=b.targetTouches&&b.targetTouches.length;h>g;g++)if(b.targetTouches[g].target==a){b=b.targetTouches[g],b.originalEvent=f,b.preventDefault=Sb,b.stopPropagation=Ub;break}return c.call(d,b,e.x,e.y)};a.addEventListener(L[b],f,!1)}return function(){return a.removeEventListener(b,e,!1),F&&L[b]&&a.removeEventListener(L[b],e,!1),!0}}:A.doc.attachEvent?function(a,b,c,d){var e=function(a){a=a||A.win.event;var b=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,e=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;return a.preventDefault=a.preventDefault||Rb,a.stopPropagation=a.stopPropagation||Tb,c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){return a.detachEvent("on"+b,e),!0};return f}:void 0}(),Xb=[],Yb=function(a){for(var c,d=a.clientX,e=a.clientY,f=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,g=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,h=Xb.length;h--;){if(c=Xb[h],F&&a.touches){for(var i,j=a.touches.length;j--;)if(i=a.touches[j],i.identifier==c.el._drag.id){d=i.clientX,e=i.clientY,(a.originalEvent?a.originalEvent:a).preventDefault();break}}else a.preventDefault();var k,l=c.el.node,m=l.nextSibling,n=l.parentNode,o=l.style.display;A.win.opera&&n.removeChild(l),l.style.display="none",k=c.el.paper.getElementByPoint(d,e),l.style.display=o,A.win.opera&&(m?n.insertBefore(l,m):n.appendChild(l)),k&&b("raphael.drag.over."+c.el.id,c.el,k),d+=g,e+=f,b("raphael.drag.move."+c.el.id,c.move_scope||c.el,d-c.el._drag.x,e-c.el._drag.y,d,e,a)}},Zb=function(a){c.unmousemove(Yb).unmouseup(Zb);for(var d,e=Xb.length;e--;)d=Xb[e],d.el._drag={},b("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,a);Xb=[]},$b=c.el={},_b=K.length;_b--;)!function(a){c[a]=$b[a]=function(b,d){return c.is(b,"function")&&(this.events=this.events||[],this.events.push({name:a,f:b,unbind:Wb(this.shape||this.node||A.doc,a,b,d||this)})),this},c["un"+a]=$b["un"+a]=function(b){for(var d=this.events||[],e=d.length;e--;)d[e].name!=a||!c.is(b,"undefined")&&d[e].f!=b||(d[e].unbind(),d.splice(e,1),!d.length&&delete this.events);return this}}(K[_b]);$b.data=function(a,d){var e=kb[this.id]=kb[this.id]||{};if(0==arguments.length)return e;if(1==arguments.length){if(c.is(a,"object")){for(var f in a)a[z](f)&&this.data(f,a[f]);return this}return b("raphael.data.get."+this.id,this,e[a],a),e[a]}return e[a]=d,b("raphael.data.set."+this.id,this,d,a),this},$b.removeData=function(a){return null==a?kb[this.id]={}:kb[this.id]&&delete kb[this.id][a],this},$b.getData=function(){return d(kb[this.id]||{})},$b.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},$b.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var ac=[];$b.drag=function(a,d,e,f,g,h){function i(i){(i.originalEvent||i).preventDefault();var j=i.clientX,k=i.clientY,l=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,m=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft;if(this._drag.id=i.identifier,F&&i.touches)for(var n,o=i.touches.length;o--;)if(n=i.touches[o],this._drag.id=n.identifier,n.identifier==this._drag.id){j=n.clientX,k=n.clientY;break}this._drag.x=j+m,this._drag.y=k+l,!Xb.length&&c.mousemove(Yb).mouseup(Zb),Xb.push({el:this,move_scope:f,start_scope:g,end_scope:h}),d&&b.on("raphael.drag.start."+this.id,d),a&&b.on("raphael.drag.move."+this.id,a),e&&b.on("raphael.drag.end."+this.id,e),b("raphael.drag.start."+this.id,g||f||this,i.clientX+m,i.clientY+l,i)}return this._drag={},ac.push({el:this,start:i}),this.mousedown(i),this},$b.onDragOver=function(a){a?b.on("raphael.drag.over."+this.id,a):b.unbind("raphael.drag.over."+this.id
vendor: 17,268 bytes, line 10
10)},$b.undrag=function(){for(var a=ac.length;a--;)ac[a].el==this&&(this.unmousedown(ac[a].start),ac.splice(a,1),b.unbind("raphael.drag.*."+this.id));!ac.length&&c.unmousemove(Yb).unmouseup(Zb),Xb=[]},v.circle=function(a,b,d){var e=c._engine.circle(this,a||0,b||0,d||0);return this.__set__&&this.__set__.push(e),e},v.rect=function(a,b,d,e,f){var g=c._engine.rect(this,a||0,b||0,d||0,e||0,f||0);return this.__set__&&this.__set__.push(g),g},v.ellipse=function(a,b,d,e){var f=c._engine.ellipse(this,a||0,b||0,d||0,e||0);return this.__set__&&this.__set__.push(f),f},v.path=function(a){a&&!c.is(a,U)&&!c.is(a[0],V)&&(a+=G);var b=c._engine.path(c.format[D](c,arguments),this);return this.__set__&&this.__set__.push(b),b},v.image=function(a,b,d,e,f){var g=c._engine.image(this,a||"about:blank",b||0,d||0,e||0,f||0);return this.__set__&&this.__set__.push(g),g},v.text=function(a,b,d){var e=c._engine.text(this,a||0,b||0,I(d));return this.__set__&&this.__set__.push(e),e},v.set=function(a){!c.is(a,"array")&&(a=Array.prototype.splice.call(arguments,0,arguments.length));var b=new mc(a);return this.__set__&&this.__set__.push(b),b.paper=this,b.type="set",b},v.setStart=function(a){this.__set__=a||this.set()},v.setFinish=function(){var a=this.__set__;return delete this.__set__,a},v.setSize=function(a,b){return c._engine.setSize.call(this,a,b)},v.setViewBox=function(a,b,d,e,f){return c._engine.setViewBox.call(this,a,b,d,e,f)},v.top=v.bottom=null,v.raphael=c;var bc=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,h=b.top+(A.win.pageYOffset||e.scrollTop||d.scrollTop)-f,i=b.left+(A.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:h,x:i}};v.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=A.doc.elementFromPoint(a,b);if(A.win.opera&&"svg"==e.tagName){var f=bc(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var h=d.getIntersectionList(g,null);h.length&&(e=h[h.length-1])}if(!e)return null;for(;e.parentNode&&e!=d.parentNode&&!e.raphael;)e=e.parentNode;return e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null},v.getElementsByBBox=function(a){var b=this.set();return this.forEach(function(d){c.isBBoxIntersect(d.getBBox(),a)&&b.push(d)}),b},v.getById=function(a){for(var b=this.bottom;b;){if(b.id==a)return b;b=b.next}return null},v.forEach=function(a,b){for(var c=this.bottom;c;){if(a.call(b,c)===!1)return this;c=c.next}return this},v.getElementsByPoint=function(a,b){var c=this.set();return this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)}),c},$b.isPointInside=function(a,b){var d=this.realPath=qb[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(d=c.transformPath(d,this.attr("transform"))),c.isPointInsidePath(d,a,b)},$b.getBBox=function(a){if(this.removed)return{};var b=this._;return a?((b.dirty||!b.bboxwt)&&(this.realPath=qb[this.type](this),b.bboxwt=Bb(this.realPath),b.bboxwt.toString=p,b.dirty=0),b.bboxwt):((b.dirty||b.dirtyT||!b.bbox)&&((b.dirty||!this.realPath)&&(b.bboxwt=0,this.realPath=qb[this.type](this)),b.bbox=Bb(rb(this.realPath,this.matrix)),b.bbox.toString=p,b.dirty=b.dirtyT=0),b.bbox)},$b.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(a),a},$b.glow=function(a){if("text"==this.type)return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:a.opacity||.5,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||qb[this.type](this);f=this.matrix?rb(f,this.matrix):f;for(var g=1;c+1>g;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var cc=function(a,b,d,e,f,g,h,i,l){return null==l?j(a,b,d,e,f,g,h,i):c.findDotsAtSegment(a,b,d,e,f,g,h,i,k(a,b,d,e,f,g,h,i,l))},dc=function(a,b){return function(d,e,f){d=Kb(d);for(var g,h,i,j,k,l="",m={},n=0,o=0,p=d.length;p>o;o++){if(i=d[o],"M"==i[0])g=+i[1],h=+i[2];else{if(j=cc(g,h,i[1],i[2],i[3],i[4],i[5],i[6]),n+j>e){if(b&&!m.start){if(k=cc(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),l+=["C"+k.start.x,k.start.y,k.m.x,k.m.y,k.x,k.y],f)return l;m.start=l,l=["M"+k.x,k.y+"C"+k.n.x,k.n.y,k.end.x,k.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!a&&!b)return k=cc(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),{x:k.x,y:k.y,alpha:k.alpha}}n+=j,g=+i[5],h=+i[6]}l+=i.shift()+i}return m.end=l,k=a?n:b?m:c.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),k.alpha&&(k={x:k.x,y:k.y,alpha:k.alpha}),k}},ec=dc(1),fc=dc(),gc=dc(0,1);c.getTotalLength=ec,c.getPointAtLength=fc,c.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return gc(a,b).end;var d=gc(a,c,1);return b?gc(d,b).end:d},$b.getTotalLength=function(){var a=this.getPath();if(a)return this.node.getTotalLength?this.node.getTotalLength():ec(a)},$b.getPointAtLength=function(a){var b=this.getPath();if(b)return fc(b,a)},$b.getPath=function(){var a,b=c._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return b&&(a=b(this)),a},$b.getSubpath=function(a,b){var d=this.getPath();if(d)return c.getSubpath(d,a,b)};var hc=c.easing_formulas={linear:function(a){return a},"<":function(a){return R(a,1.7)},">":function(a){return R(a,.48)},"<>":function(a){var b=.48-a/1.04,c=N.sqrt(.1734+b*b),d=c-b,e=R(Q(d),1/3)*(0>d?-1:1),f=-c-b,g=R(Q(f),1/3)*(0>f?-1:1),h=e+g+.5;return 3*(1-h)*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a-=1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){return a==!!a?a:R(2,-10*a)*N.sin((a-.075)*2*S/.3)+1},bounce:function(a){var b,c=7.5625,d=2.75;return 1/d>a?b=c*a*a:2/d>a?(a-=1.5/d,b=c*a*a+.75):2.5/d>a?(a-=2.25/d,b=c*a*a+.9375):(a-=2.625/d,b=c*a*a+.984375),b}};hc.easeIn=hc["ease-in"]=hc["<"],hc.easeOut=hc["ease-out"]=hc[">"],hc.easeInOut=hc["ease-in-out"]=hc["<>"],hc["back-in"]=hc.backIn,hc["back-out"]=hc.backOut;var ic=[],jc=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||function(a){setTimeout(a,16)},kc=function(){for(var a=+new Date,d=0;d<ic.length;d++){var e=ic[d];if(!e.el.removed&&!e.paused){var f,g,h=a-e.start,i=e.ms,j=e.easing,k=e.from,l=e.diff,m=e.to,n=(e.t,e.el),o={},p={};if(e.initstatus?(h=(e.initstatus*e.anim.top-e.prev)/(e.percent-e.prev)*i,e.status=e.initstatus,delete e.initstatus,e.stop&&ic.splice(d--,1)):e.status=(e.prev+(e.percent-e.prev)*(h/i))/e.anim.top,!(0>h))if(i>h){var q=j(h/i);for(var r in k)if(k[z](r)){switch(db[r]){case T:f=+k[r]+q*i*l[r];break;case"colour":f="rgb("+[lc($(k[r].r+q*i*l[r].r)),lc($(k[r].g+q*i*l[r].g)),lc($(k[r].b+q*i*l[r].b))].join(",")+")";break;case"path":f=[];for(var t=0,u=k[r].length;u>t;t++){f[t]=[k[r][t][0]];for(var v=1,w=k[r][t].length;w>v;v++)f[t][v]=+k[r][t][v]+q*i*l[r][t][v];f[t]=f[t].join(H)}f=f.join(H);break;case"transform":if(l[r].real)for(f=[],t=0,u=k[r].length;u>t;t++)for(f[t]=[k[r][t][0]],v=1,w=k[r][t].length;w>v;v++)f[t][v]=k[r][t][v]+q*i*l[r][t][v];else{var x=function(a){return+k[r][a]+q*i*l[r][a]};f=[["m",x(0),x(1),x(2),x(3),x(4),x(5)]]}break;case"csv":if("clip-rect"==r)for(f=[],t=4;t--;)f[t]=+k[r][t]+q*i*l[r][t];break;default:var y=[][E](k[r]);for(f=[],t=n.paper.customAttributes[r].length;t--;)f[t]=+y[t]+q*i*l[r][t]}o[r]=f}n.attr(o),function(a,c,d){setTimeout(function(){b("raphael.anim.frame."+a,c,d)})}(n.id,n,e.anim)}else{if(function(a,d,e){setTimeout(function(){b("raphael.anim.frame."+d.id,d,e),b("raphael.anim.finish."+d.id,d,e),c.is(a,"function")&&a.call(d)})}(e.callback,n,e.anim),n.attr(m),ic.splice(d--,1),e.repeat>1&&!e.next){for(g in m)m[z](g)&&(p[g]=e.totalOrigin[g]);e.el.attr(p),s(e.anim,e.el,e.anim.percents[0],null,e.totalOrigin,e.repeat-1)}e.next&&!e.stop&&s(e.anim,e.el,e.next,null,e.totalOrigin,e.repeat)}}}c.svg&&n&&n.paper&&n.paper.safari(),ic.length&&jc(kc)},lc=function(a){return a>255?255:0>a?0:a};$b.animateWith=function(a,b,d,e,f,g){var h=this;if(h.removed)return g&&g.call(h),h;var i=d instanceof r?d:c.animation(d,e,f,g);s(i,h,i.percents[0],null,h.attr());for(var j=0,k=ic.length;k>j;j++)if(ic[j].anim==b&&ic[j].el==a){ic[k-1].start=ic[j].start;break}return h},$b.onAnimation=function(a){return a?b.on("raphael.anim.frame."+this.id,a):b.unbind("raphael.anim.frame."+this.id),this},r.prototype.delay=function(a){var b=new r(this.anim,this.ms);return b.times=this.times,b.del=+a||0,b},r.prototype.repeat=function(a){var b=new r(this.anim,this.ms);return b.del=this.del,b.times=N.floor(O(a,0))||1,b},c.animation=function(a,b,d,e){if(a instanceof r)return a;(c.is(d,"function")||!d)&&(e=e||d||null,d=null),a=Object(a),b=+b||0;var f,g,h={};for(g in a)a[z](g)&&_(g)!=g&&_(g)+"%"!=g&&(f=!0,h[g]=a[g]);return f?(d&&(h.easing=d),e&&(h.callback=e),new r({100:h},b)):new r(a,b)},$b.animate=function(a,b,d,e){var f=this;if(f.removed)return e&&e.call(f),f;var g=a instanceof r?a:c.animation(a,b,d,e);return s(g,f,g.percents[0],null,f.attr()),f},$b.setTime=function(a,b){return a&&null!=b&&this.status(a,P(b,a.ms)/a.ms),this},$b.status=function(a,b){var c,d,e=[],f=0;if(null!=b)return s(a,this,-1,P(b,1)),this;for(c=ic.length;c>f;f++)if(d=ic[f],d.el.id==this.id&&(!a||d.anim==a)){if(a)return d.status;e.push({anim:d.anim,status:d.status})}return a?0:e},$b.pause=function(a){for(var c=0;c<ic.length;c++)ic[c].el.id!=this.id||a&&ic[c].anim!=a||b("raphael.anim.pause."+this.id,this,ic[c].anim)!==!1&&(ic[c].paused=!0);return this},$b.resume=function(a){for(var c=0;c<ic.length;c++)if(ic[c].el.id==this.id&&(!a||ic[c].anim==a)){var d=ic[c];b("raphael.anim.resume."+this.id,this,d.anim)!==!1&&(delete d.paused,this.status(d.anim,d.status))}return this},$b.stop=function(a){for(var c=0;c<ic.length;c++)ic[c].el.id!=this.id||a&&ic[c].anim!=a||b("raphael.anim.stop."+this.id,this,ic[c].anim)!==!1&&ic.splice(c--,1);return this},b.on("raphael.remove",t),b.on("raphael.clear",t),$b.toString=function(){return"Raphaëlâs object"};var mc=function(a){if(this.items=[],this.length=0,this.type="set",a)for(var b=0,c=a.length;c>b;b++)!a[b]||a[b].constructor!=$b.constructor&&a[b].constructor!=mc||(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},nc=mc.prototype;nc.push=function(){for(var a,b,c=0,d=arguments.length;d>c;c++)a=arguments[c],!a||a.constructor!=$b.constructor&&a.constructor!=mc||(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},nc.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},nc.forEach=function(a,b){for(var c=0,d=this.items.length;d>c;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var oc in $b)$b[z](oc)&&(nc[oc]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][D](c,b)})}}(oc));return nc.attr=function(a,b){if(a&&c.is(a,V)&&c.is(a[0],"object"))for(var d=0,e=a.length;e>d;d++)this.items[d].attr(a[d]);else for(var f=0,g=this.items.length;g>f;f++)this.items[f].attr(a,b);return this},nc.clear=function(){for(;this.length;)this.pop()},nc.splice=function(a,b){a=0>a?O(this.length+a,0):a,b=O(0,P(this.length-a,b));var c,d=[],e=[],f=[];for(c=2;c<arguments.length;c++)f.push(arguments[c]);for(c=0;b>c;c++)e.push(this[a+c]);for(;c<this.length-a;c++)d.push(this[a+c]);var g=f.length;for(c=0;c<g+d.length;c++)this.items[a+c]=this[a+c]=g>c?f[c]:d[c-g];for(c=this.items.length=this.length-=b-g;this[c];)delete this[c++];return new mc(e)},nc.exclude=function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]==a)return this.splice(b,1),!0},nc.animate=function(a,b,d,e){(c.is(d,"function")||!d)&&(e=d||null);var f,g,h=this.items.length,i=h,j=this;if(!h)return this;e&&(g=function(){!--h&&e.call(j)}),d=c.is(d,U)?d:g;var k=c.animation(a,b,d,g);for(f=this.items[--i].animate(k);i--;)this.items[i]&&!this.items[i].removed&&this.items[i].animateWith(f,k,k),this.items[i]&&!this.items[i].removed||h--;return this},nc.insertAfter=function(a){for(var b=this.items.length;b--;)this.items[b].insertAfter(a);return this},nc.getBBox=function(){for(var a=[],b=[],c=[],d=[],e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}return a=P[D](0,a),b=P[D](0,b),c=O[D](0,c),d=O[D](0,d),{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},nc.clone=function(a){a=this.paper.set();for(var b=0,c=this.items.length;c>b;b++)a.push(this.items[b].clone());return a},nc.toString=function(){return"Raphaëlâs set"},nc.glow=function(a){var b=this.paper.set();return this.forEach(function(c){var d=c.glow(a);null!=d&&d.forEach(function(a){b.push(a)})}),b},nc.isPointInside=function(a,b){var c=!1;return this.forEach(function(d){return d.isPointInside(a,b)?(console.log("runned"),c=!0,!1):void 0}),c},c.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[z](d)&&(b.face[d]=a.face[d]);if(this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b],!a.svg){b.face["units-per-em"]=ab(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[z](e)){var f=a.glyphs[e];if(b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"},f.k)for(var g in f.k)f[z](g)&&(b.glyphs[e].k[g]=f.k[g])}}return a},v.getFont=function(a,b,d,e){if(e=e||"normal",d=d||"normal",b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400,c.fonts){var f=c.fonts[a];if(!f){var g=new RegExp("(^|\\s)"+a.replace(/[^\w\d\s+!~.:_-]/g,G)+"(\\s|$)","i");for(var h in c.fonts)if(c.fonts[z](h)&&g.test(h)){f=c.fonts[h];break}}var i;if(f)for(var j=0,k=f.length;k>j&&(i=f[j],i.face["font-weight"]!=b||i.face["font-style"]!=d&&i.face["font-style"]||i.face["font-stretch"]!=e);j++);return i}},v.print=function(a,b,d,e,f,g,h,i){g=g||"middle",h=O(P(h||0,1),-1),i=O(P(i||1,3),1);var j,k=I(d)[J](G),l=0,m=0,n=G;if(c.is(e,"string")&&(e=this.getFont(e)),e){j=(f||16)/e.face["units-per-em"];for(var o=e.face.bbox[J](w),p=+o[0],q=o[3]-o[1],r=0,s=+o[1]+("baseline"==g?q+ +e.face.descent:q/2),t=0,u=k.length;u>t;t++){if("\n"==k[t])l=0,x=0,m=0,r+=q*i;else{var v=m&&e.glyphs[k[t-1]]||{},x=e.glyphs[k[t]];l+=m?(v.w||e.w)+(v.k&&v.k[k[t]]||0)+e.w*h:0,m=1}x&&x.d&&(n+=c.transformPath(x.d,["t",l*j,r*j,"s",j,j,p,s,"t",(a-p)/j,(b-s)/j]))}}return this.path(n).attr({fill:"#000",stroke:"none"})},v.add=function(a){if(c.is(a,"array"))for(var b,d=this.set(),e=0,f=a.length;f>e;e++)b=a[e]||{},x[z](b.type)&&d.push(this[b.type]().attr(b));return d},c.format=function(a,b){var d=c.is(b,V)?[0][E](b):arguments;return a&&c.is(a,U)&&d.length-1&&(a=a.replace(y,function(a,b){return null==d[++b]?G:d[b]})),a||G},c.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;return c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),"function"==typeof e&&f&&(e=e()))}),e=(null==e||e==d?a:e)+""};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),c.ninja=function(){return B.was?A.win.Raphael=B.is:delete Raphael,c},c.st=nc,function(a,b,d){function e(){/in/.test(a.readyState)?setTimeout(e,9):c.eve("raphael.DOMload")}null==a.readyState&&a.addEventListener&&(a.addEventListener(b,d=function(){a.removeEventListener(b,d,!1),a.readyState="complete"},!1),a.readyState="loading"),e()}(document,"DOMContentLoaded"),b.on("raphael.DOMload",function(){u=!0}),function(){if(c.svg){var a="hasOwnProperty",b=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=c.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};c.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){"string"==typeof d&&(d=q(d));for(var f in e)e[a](f)&&("xlink:"==f.substring(0,6)?d.setAttributeNS(n,f.substring(6),b(e[f])):d.setAttribute(f,b(e[f])))}else d=c._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(a,e){var j="linear",k=a.id+e,m=.5,n=.5,o=a.node,p=a.paper,r=o.style,s=c._g.doc.getElementById(k);if(!s){if(e=b(e).replace(c._radial_gradient,function(a,b,c){if(j="radial",b&&c){m=d(b),n=d(c);var e=2*(n>.5)-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&.5!=n&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/),"linear"==j){var t=e.shift();if(t=-d(t),isNaN(t))return null;var u=[0,0,f.cos(c.rad(t)),f.sin(c.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=c._parseDots(e);if(!w)return null;if(k=k.replace(/[\(\)\s,\xb0#]/g,"_"),a.gradient&&k!=a.gradient.id&&(p.defs.removeChild(a.gradient),delete a.gradient),!a.gradient){s=q(j+"Gradient",{id:k}),a.gradient=s,q(s,"radial"==j?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:a.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;y>x;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"
100%","stop-color":w[x].color||"#fff"}))}}return q(o,{fill:"url(#"+k+")",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1,1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if("path"==d.type){for(var g,h,i,j,k,m=b(e).toLowerCase().split("-"),n=d.paper,r=f?"end":"start",s=d.node,t=d.attrs,u=t["stroke-width"],v=m.length,w="classic",x=3,y=3,z=5;v--;)switch(m[v]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":w=m[v];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}if("open"==w?(x+=2,y+=2,z+=2,i=1,j=f?4:1,k={fill:"none",stroke:t.stroke}):(j=i=x/2,k={fill:t.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={},"none"!=w){var A="raphael-marker-"+w,B="raphael-marker-"+r+w+x+y;c._g.doc.getElementById(A)?p[A]++:(n.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[w],id:A})),p[A]=1);var C,D=c._g.doc.getElementById(B);D?(p[B]++,C=D.getElementsByTagName("use")[0]):(D=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:j,refY:y/2}),C=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),D.appendChild(C),n.defs.appendChild(D),p[B]=1),q(C,k);var E=i*("diamond"!=w&&"oval"!=w);f?(g=d._.arrows.startdx*u||0,h=c.getTotalLength(t.path)-E*u):(g=E*u,h=c.getTotalLength(t.path)-(d._.arrows.enddx*u||0)),k={},k["marker-"+r]="url(#"+B+")",(h||g)&&(k.d=c.getSubpath(t.path,g,h)),q(s,k),d._.arrows[r+"Path"]=A,d._.arrows[r+"Marker"]=B,d._.arrows[r+"dx"]=E,d._.arrows[r+"Type"]=w,d._.arrows[r+"String"]=e}else f?(g=d._.arrows.startdx*u||0,h=c.getTotalLength(t.path)-g):(g=0,h=c.getTotalLength(t.path)-(d._.arrows.enddx*u||0)),d._.arrows[r+"Path"]&&q(s,{d:c.getSubpath(t.path,g,h)}),delete d._.arrows[r+"Path"],delete d._.arrows[r+"Marker"],delete d._.arrows[r+"dx"],delete d._.arrows[r+"Type"],delete d._.arrows[r+"String"];for(k in p)if(p[a](k)&&!p[k]){var F=c._g.doc.getElementById(k);F&&F.parentNode.removeChild(F)}}},u={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},v=function(a,c,d){if(c=u[b(c).toLowerCase()]){for(var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=c.length;h--;)g[h]=c[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}},w=function(d,f){var i=d.node,k=d.attrs,m=i.style.visibility;i.style.visibility="hidden";for(var o in f)if(f[a](o)){if(!c._availableAttrs[a](o))continue;var p=f[o];switch(k[o]=p,o){case"blur":d.blur(p);break;case"href":case"title":var u=q("title"),w=c._g.doc.createTextNode(p);u.appendChild(w),i.appendChild(u);break;case"target":var x=i.parentNode;if("a"!=x.tagName.toLowerCase()){var u=q("a");x.insertBefore(u,i),u.appendChild(i),x=u}"target"==o?x.setAttributeNS(n,"show","blank"==p?"new":p):x.setAttributeNS(n,o,p);break;case"cursor":i.style.cursor=p;break;case"transform":d.transform(p);break;case"arrow-start":t(d,p);break;case"arrow-end":t(d,p,1);break;case"clip-rect":var z=b(p).split(j);if(4==z.length){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var A=q("clipPath"),B=q("rect");A.id=c.createUUID(),q(B,{x:z[0],y:z[1],width:z[2],height:z[3]}),A.appendChild(B),d.paper.defs.appendChild(A),q(i,{"clip-path":"url(#"+A.id+")"}),d.clip=B}if(!p){var C=i.getAttribute("clip-path");if(C){var D=c._g.doc.getElementById(C.replace(/(^url\(#|\)$)/g,l));D&&D.parentNode.removeChild(D),q(i,{"clip-path":l}),delete d.clip}}break;case"path":"path"==d.type&&(q(i,{d:p?k.path=c._pathToAbsolute(p):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":if(i.setAttribute(o,p),d._.dirty=1,!k.fx)break;o="x",p=k.x;case"x":k.fx&&(p=-k.x-(k.width||0));case"rx":if("rx"==o&&"rect"==d.type)break;case"cx":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"height":if(i.setAttribute(o,p),d._.dirty=1,!k.fy)break;o="y",p=k.y;
vendor: 5,237 bytes, lines 10-11
10case"y":k.fy&&(p=-k.y-(k.height||0));case"ry":if("ry"==o&&"rect"==d.type)break;case"cy":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"r":"rect"==d.type?q(i,{rx:p,ry:p}):i.setAttribute(o,p),d._.dirty=1;break;case"src":"image"==d.type&&i.setAttributeNS(n,"href",p);break;case"stroke-width":(1!=d._.sx||1!=d._.sy)&&(p/=g(h(d._.sx),h(d._.sy))||1),d.paper._vbSize&&(p*=d.paper._vbSize),i.setAttribute(o,p),k["stroke-dasharray"]&&v(d,k["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,p,f);break;case"fill":var E=b(p).match(c._ISURL);if(E){A=q("pattern");var F=q("image");A.id=c.createUUID(),q(A,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(F,{x:0,y:0,"xlink:href":E[1]}),A.appendChild(F),function(a){c._preload(E[1],function(){var b=this.offsetWidth,c=this.offsetHeight;q(a,{width:b,height:c}),q(F,{width:b,height:c}),d.paper.safari()})}(A),d.paper.defs.appendChild(A),q(i,{fill:"url(#"+A.id+")"}),d.pattern=A,d.pattern&&s(d);break}var G=c.getRGB(p);if(G.error){if(("circle"==d.type||"ellipse"==d.type||"r"!=b(p).charAt())&&r(d,p)){if("opacity"in k||"fill-opacity"in k){var H=c._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(H){var I=H.getElementsByTagName("stop");q(I[I.length-1],{"stop-opacity":("opacity"in k?k.opacity:1)*("fill-opacity"in k?k["fill-opacity"]:1)})}}k.gradient=p,k.fill="none";break}}else delete f.gradient,delete k.gradient,!c.is(k.opacity,"undefined")&&c.is(f.opacity,"undefined")&&q(i,{opacity:k.opacity}),!c.is(k["fill-opacity"],"undefined")&&c.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":k["fill-opacity"]});G[a]("opacity")&&q(i,{"fill-opacity":G.opacity>1?G.opacity/100:G.opacity});case"stroke":G=c.getRGB(p),i.setAttribute(o,G.hex),"stroke"==o&&G[a]("opacity")&&q(i,{"stroke-opacity":G.opacity>1?G.opacity/100:G.opacity}),"stroke"==o&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":("circle"==d.type||"ellipse"==d.type||"r"!=b(p).charAt())&&r(d,p);break;case"opacity":k.gradient&&!k[a]("stroke-opacity")&&q(i,{"stroke-opacity":p>1?p/100:p});case"fill-opacity":if(k.gradient){H=c._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),H&&(I=H.getElementsByTagName("stop"),q(I[I.length-1],{"stop-opacity":p}));break}default:"font-size"==o&&(p=e(p,10)+"px");var J=o.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[J]=p,d._.dirty=1,i.setAttribute(o,p)}}y(d,f),i.style.visibility=m},x=1.2,y=function(d,f){if("text"==d.type&&(f[a]("text")||f[a]("font")||f[a]("font-size")||f[a]("x")||f[a]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(c._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10; 11if(f[a]("text")){for(g.text=f.text;h.firstChild;)h.removeChild(h.firstChild);for(var j,k=b(f.text).split("\n"),m=[],n=0,o=k.length;o>n;n++)j=q("tspan"),n&&q(j,{dy:i*x,x:g.x}),j.appendChild(c._g.doc.createTextNode(k[n])),h.appendChild(j),m[n]=j}else for(m=h.getElementsByTagName("tspan"),n=0,o=m.length;o>n;n++)n?q(m[n],{dy:i*x,x:g.x}):q(m[0],{dy:0});q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&c.is(r,"finite")&&q(m[0],{dy:r})}},z=function(a,b){this[0]=this.node=a,a.raphael=!0,this.id=c._oid++,a.raphaelid=this.id,this.matrix=c.matrix(),this.realPath=null,this.paper=b,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!b.bottom&&(b.bottom=this),this.prev=b.top,b.top&&(b.top.next=this),b.top=this,this.next=null},A=c.el;z.prototype=A,A.constructor=z,c._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new z(c,b);return d.type="path",w(d,{fill:"none",stroke:"#000",path:a}),d},A.rotate=function(a,c,e){if(this.removed)return this;if(a=b(a).split(j),a.length-1&&(c=d(a[1]),e=d(a[2])),a=d(a[0]),null==e&&(c=e),null==c||null==e){var f=this.getBBox(1);c=f.x+f.width/2,e=f.y+f.height/2}return this.transform(this._.transform.concat([["r",a,c,e]])),this},A.scale=function(a,c,e,f){if(this.removed)return this;if(a=b(a).split(j),a.length-1&&(c=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),null==c&&(c=a),null==f&&(e=f),null==e||null==f)var g=this.getBBox(1);return e=null==e?g.x+g.width/2:e,f=null==f?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,c,e,f]])),this},A.translate=function(a,c){return this.removed?this:(a=b(a).split(j),a.length-1&&(c=d(a[1])),a=d(a[0])||0,c=+c||0,this.transform(this._.transform.concat([["t",a,c]])),this)},A.transform=function(b){var d=this._;if(null==b)return d.transform;if(c._extractTransform(this,b),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix}),1!=d.sx||1!=d.sy){var e=this.attrs[a]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},A.hide=function(){return!this.removed&&this.paper.safari(this.node.style.display="none"),this},A.show=function(){return!this.removed&&this.paper.safari(this.node.style.display=""),this},A.remove=function(){if(!this.removed&&this.node.parentNode){var a=this.paper;
11a.__set__&&a.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&a.defs.removeChild(this.gradient),c._tear(this,a),"a"==this.node.parentNode.tagName.toLowerCase()?this.node.parentNode.parentNode.removeChild(this.node.parentNode):this.node.parentNode.removeChild(this.node);for(var b in this)this[b]="function"==typeof this[b]?c._removedFactory(b):null;this.removed=!0}},A._getBBox=function(){if("none"==this.node.style.display){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}return a&&this.hide(),b},A.attr=function(b,d){if(this.removed)return this;if(null==b){var e={};for(var f in this.attrs)this.attrs[a](f)&&(e[f]=this.attrs[f]);return e.gradient&&"none"==e.fill&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform,e}if(null==d&&c.is(b,"string")){if("fill"==b&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;if("transform"==b)return this._.transform;for(var g=b.split(j),h={},i=0,l=g.length;l>i;i++)b=g[i],h[b]=b in this.attrs?this.attrs[b]:c.is(this.paper.customAttributes[b],"function")?this.paper.customAttributes[b].def:c._availableAttrs[b];return l-1?h:h[g[0]]}if(null==d&&c.is(b,"array")){for(h={},i=0,l=b.length;l>i;i++)h[b[i]]=this.attr(b[i]);return h}if(null!=d){var m={};m[b]=d}else null!=b&&c.is(b,"object")&&(m=b);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[a](n)&&m[a](n)&&c.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[a](p)&&(m[p]=o[p])}return w(this,m),this},A.toFront=function(){if(this.removed)return this;"a"==this.node.parentNode.tagName.toLowerCase()?this.node.parentNode.parentNode.appendChild(this.node.parentNode):this.node.parentNode.appendChild(this.node);var a=this.paper;return a.top!=this&&c._tofront(this,a),this},A.toBack=function(){if(this.removed)return this;var a=this.node.parentNode;return"a"==a.tagName.toLowerCase()?a.parentNode.insertBefore(this.node.parentNode,this.node.parentNode.parentNode.firstChild):a.firstChild!=this.node&&a.insertBefore(this.node,this.node.parentNode.firstChild),c._toback(this,this.paper),this.paper,this},A.insertAfter=function(a){if(this.removed)return this;var b=a.node||a[a.length-1].node;return b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):b.parentNode.appendChild(this.node),c._insertafter(this,a,this.paper),this},A.insertBefore=function(a){if(this.removed)return this;var b=a.node||a[0].node;return b.parentNode.insertBefore(this.node,b),c._insertbefore(this,a,this.paper),this},A.blur=function(a){var b=this;if(0!==+a){var d=q("filter"),e=q("feGaussianBlur");b.attrs.blur=a,d.id=c.createUUID(),q(e,{stdDeviation:+a||1.5}),d.appendChild(e),b.paper.defs.appendChild(d),b._blur=d,q(b.node,{filter:"url(#"+d.id+")"})}else b._blur&&(b._blur.parentNode.removeChild(b._blur),delete b._blur,delete b.attrs.blur),b.node.removeAttribute("filter");return b},c._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new z(e,a);return f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs),f},c._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);return h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs),h},c._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);return g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs),g},c._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);return h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image",h},c._engine.text=function(a,b,d,e){var f=q("text");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);return g.attrs={x:b,y:d,"text-anchor":"middle",text:e,font:c._availableAttrs.font,stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs),g},c._engine.setSize=function(a,b){return this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},c._engine.create=function(){var a=c._getContainer.apply(0,arguments),b=a&&a.container,d=a.x,e=a.y,f=a.width,g=a.height;if(!b)throw new Error("SVG container not found.");var h,i=q("svg"),j="overflow:hidden;";return d=d||0,e=e||0,f=f||512,g=g||342,q(i,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg"}),1==b?(i.style.cssText=j+"position:absolute;
11left:"+d+"px;top:"+e+"px",c._g.doc.body.appendChild(i),h=1):(i.style.cssText=j+"position:relative",b.firstChild?b.insertBefore(i,b.firstChild):b.appendChild(i)),b=new c._Paper,b.width=f,b.height=g,b.canvas=i,b.clear(),b._left=b._top=0,h&&(b.renderfix=function(){}),b.renderfix(),b},c._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);var f,h,i=g(c/this.width,d/this.height),j=this.top,l=e?"meet":"xMinYMin";for(null==a?(this._vbSize&&(i=1),delete this._vbSize,f="0 0 "+this.width+m+this.height):(this._vbSize=i,f=a+m+b+m+c+m+d),q(this.canvas,{viewBox:f,preserveAspectRatio:l});i&&j;)h="stroke-width"in j.attrs?j.attrs["stroke-width"]:1,j.attr({"stroke-width":h}),j._.dirty=1,j._.dirtyT=1,j=j.prev;return this._viewBox=[a,b,c,d,!!e],this},c.prototype.renderfix=function(){var a,b=this.canvas,c=b.style;try{a=b.getScreenCTM()||b.createSVGMatrix()}catch(d){a=b.createSVGMatrix()}var e=-a.e%1,f=-a.f%1;(e||f)&&(e&&(this._left=(this._left+e)%1,c.left=this._left+"px"),f&&(this._top=(this._top+f)%1,c.top=this._top+"px"))},c.prototype.clear=function(){c.eve("raphael.clear",this);for(var a=this.canvas;a.firstChild;)a.removeChild(a.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(c._g.doc.createTextNode("Created with Raphaël "+c.version)),a.appendChild(this.desc),a.appendChild(this.defs=q("defs"))},c.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]="function"==typeof this[a]?c._removedFactory(a):null};var B=c.st;for(var C in A)A[a](C)&&!B[a](C)&&(B[C]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(C))}}(),function(){if(c.vml){var a="hasOwnProperty",b=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=c.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(a){var d=/[ahqstv]/gi,e=c._pathToAbsolute;if(b(a).match(d)&&(e=c._path2curve),d=/[clmz]/g,e==c._pathToAbsolute&&!b(a).match(d)){var g=b(a).replace(q,function(a,b,c){var d=[],e="m"==b.toLowerCase(),g=p[b];return c.replace(s,function(a){e&&2==d.length&&(g+=d+p["m"==b?"l":"L"],d=[]),d.push(f(a*u))}),g+d});return g}var h,i,j=e(a);g=[];for(var k=0,l=j.length;l>k;k++){h=j[k],i=j[k][0].toLowerCase(),"z"==i&&(i="x");for(var m=1,r=h.length;r>m;m++)i+=f(h[m]*u)+(m!=r-1?",":o);g.push(i)}return g.join(n)},y=function(a,b,d){var e=c.matrix();return e.rotate(-a,.5,.5),{dx:e.x(b,d),dy:e.y(b,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q=u/b,r=u/c;if(m.visibility="hidden",b&&c){if(l.coordsize=i(q)+n+i(r),m.rotation=f*(0>b*c?-1:1),f){var s=y(f,d,e);d=s.dx,e=s.dy}if(0>b&&(p+="x"),0>c&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-q+n+e*-r,k||g.fillsize){var t=l.getElementsByTagName(j);t=t&&t[0],l.removeChild(t),k&&(s=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),t.position=s.dx*o+n+s.dy*o),g.fillsize&&(t.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(t)}m.visibility="visible"}};c.toString=function(){return"Your browser doesnât support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,c,d){for(var e=b(c).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";g--;)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),r=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),s=e;
vendor: 13,683 bytes, line 11
11for(var t in i)i[a](t)&&(m[t]=i[t]);if(q&&(m.path=c._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur),(i.path&&"path"==e.type||q)&&(l.path=x(~b(m.path).toLowerCase().indexOf("r")?c._pathToAbsolute(m.path):m.path),"image"==e.type&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0))),"transform"in i&&e.transform(i.transform),r){var y=+m.cx,B=+m.cy,D=+m.rx||+m.r||0,E=+m.ry||+m.r||0;l.path=c.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((y-D)*u),f((B-E)*u),f((y+D)*u),f((B+E)*u),f(y*u)),e._.dirty=1}if("clip-rect"in i){var G=b(i["clip-rect"]).split(k);if(4==G.length){G[2]=+G[2]+ +G[0],G[3]=+G[3]+ +G[1];var H=l.clipRect||c._g.doc.createElement("div"),I=H.style;I.clip=c.format("rect({1}px {2}px {3}px {0}px)",G),l.clipRect||(I.position="absolute",I.top=0,I.left=0,I.width=e.paper.width+"px",I.height=e.paper.height+"px",l.parentNode.insertBefore(H,l),H.appendChild(l),l.clipRect=H)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var J=e.textpath.style;i.font&&(J.font=i.font),i["font-family"]&&(J.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(J.fontSize=i["font-size"]),i["font-weight"]&&(J.fontWeight=i["font-weight"]),i["font-style"]&&(J.fontStyle=i["font-style"])}if("arrow-start"in i&&A(s,i["arrow-start"]),"arrow-end"in i&&A(s,i["arrow-end"],1),null!=i.opacity||null!=i["stroke-width"]||null!=i.fill||null!=i.src||null!=i.stroke||null!=i["stroke-width"]||null!=i["stroke-opacity"]||null!=i["fill-opacity"]||null!=i["stroke-dasharray"]||null!=i["stroke-miterlimit"]||null!=i["stroke-linejoin"]||null!=i["stroke-linecap"]){var K=l.getElementsByTagName(j),L=!1;if(K=K&&K[0],!K&&(L=K=F(j)),"image"==e.type&&i.src&&(K.src=i.src),i.fill&&(K.on=!0),(null==K.on||"none"==i.fill||null===i.fill)&&(K.on=!1),K.on&&i.fill){var M=b(i.fill).match(c._ISURL);if(M){K.parentNode==l&&l.removeChild(K),K.rotate=!0,K.src=M[1],K.type="tile";var N=e.getBBox(1);K.position=N.x+n+N.y,e._.fillpos=[N.x,N.y],c._preload(M[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else K.color=c.getRGB(i.fill).hex,K.src=o,K.type="solid",c.getRGB(i.fill).error&&(s.type in{circle:1,ellipse:1}||"r"!=b(i.fill).charAt())&&C(s,i.fill,K)&&(m.fill="none",m.gradient=i.fill,K.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var O=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+c.getRGB(i.fill).o+1||2)-1);O=h(g(O,0),1),K.opacity=O,K.src&&(K.color="none")}l.appendChild(K);var P=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],Q=!1;!P&&(Q=P=F("stroke")),(i.stroke&&"none"!=i.stroke||i["stroke-width"]||null!=i["stroke-opacity"]||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])&&(P.on=!0),("none"==i.stroke||null===i.stroke||null==P.on||0==i.stroke||0==i["stroke-width"])&&(P.on=!1);var R=c.getRGB(i.stroke);P.on&&i.stroke&&(P.color=R.hex),O=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+R.o+1||2)-1);var S=.75*(d(i["stroke-width"])||1);if(O=h(g(O,0),1),null==i["stroke-width"]&&(S=m["stroke-width"]),i["stroke-width"]&&(P.weight=S),S&&1>S&&(O*=S)&&(P.weight=1),P.opacity=O,i["stroke-linejoin"]&&(P.joinstyle=i["stroke-linejoin"]||"miter"),P.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(P.endcap="butt"==i["stroke-linecap"]?"flat":"square"==i["stroke-linecap"]?"square":"round"),i["stroke-dasharray"]){var T={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};P.dashstyle=T[a](i["stroke-dasharray"])?T[i["stroke-dasharray"]]:o}Q&&l.appendChild(P)}if("text"==s.type){s.paper.canvas.style.display=o;var U=s.paper.span,V=100,W=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=U.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),W=d(m["font-size"]||W&&W[0])||10,p.fontSize=W*V+"px",s.textpath.string&&(U.innerHTML=b(s.textpath.string).replace(/</g,"<").replace(/&/g,"&").replace(/\n/g,"<br>"));var X=U.getBoundingClientRect();s.W=m.w=(X.right-X.left)/V,s.H=m.h=(X.bottom-X.top)/V,s.X=m.x,s.Y=m.y+s.H/2,("x"in i||"y"in i)&&(s.path.v=c.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));for(var Y=["x","y","text","font","font-family","font-weight","font-style","font-size"],Z=0,$=Y.length;$>Z;Z++)if(Y[Z]in i){s._.dirty=1;break}switch(m["text-anchor"]){case"start":s.textpath.style["v-text-align"]="left",s.bbx=s.W/2;break;case"end":s.textpath.style["v-text-align"]="right",s.bbx=-s.W/2;break;default:s.textpath.style["v-text-align"]="center",s.bbx=0}s.textpath.style["v-text-kern"]=!0}},C=function(a,f,g){a.attrs=a.attrs||{};var h=(a.attrs,Math.pow),i="linear",j=".5 .5";if(a.attrs.gradient=f,f=b(f).replace(c._radial_gradient,function(a,b,c){return i="radial",b&&c&&(b=d(b),c=d(c),h(b-.5,2)+h(c-.5,2)>.25&&(c=e.sqrt(.25-h(b-.5,2))*(2*(c>.5)-1)+.5),j=b+n+c),o}),f=f.split(/\s*\-\s*/),"linear"==i){var k=f.shift();if(k=-d(k),isNaN(k))return null}var l=c._parseDots(f);if(!l)return null;if(a=a.shape||a.node,l.length){a.removeChild(g),g.on=!0,g.method="none",g.color=l[0].color,g.color2=l[l.length-1].color;for(var m=[],p=0,q=l.length;q>p;p++)l[p].offset&&m.push(l[p].offset+n+l[p].color);g.colors=m.length?m.join():"0% "+g.color,"radial"==i?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=j,g.angle=0):(g.type="gradient",g.angle=(270-k)%360),a.appendChild(g)}return 1},D=function(a,b){this[0]=this.node=a,a.raphael=!0,this.id=c._oid++,a.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=b,this.matrix=c.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!b.bottom&&(b.bottom=this),this.prev=b.top,b.top&&(b.top.next=this),b.top=this,this.next=null},E=c.el;D.prototype=E,E.constructor=D,E.transform=function(a){if(null==a)return this._.transform;var d,e=this.paper._viewBoxShift,f=e?"s"+[e.scale,e.scale]+"-1-1t"+[e.dx,e.dy]:o;e&&(d=a=b(a).replace(/\.{3}|\u2026/g,this._.transform||o)),c._extractTransform(this,f+a);var g,h=this.matrix.clone(),i=this.skew,j=this.node,k=~b(this.attrs.fill).indexOf("-"),l=!b(this.attrs.fill).indexOf("url(");if(h.translate(1,1),l||k||"image"==this.type)if(i.matrix="1 0 0 1",i.offset="0 0",g=h.split(),k&&g.noRotation||!g.isSimple){j.style.filter=h.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;j.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else j.style.filter=o,z(this,g.scalex,g.scaley,g.dx,g.dy,g.rotate);else j.style.filter=o,i.matrix=b(h),i.offset=h.offset();return d&&(this._.transform=d),this},E.rotate=function(a,c,e){if(this.removed)return this;if(null!=a){if(a=b(a).split(k),a.length-1&&(c=d(a[1]),e=d(a[2])),a=d(a[0]),null==e&&(c=e),null==c||null==e){var f=this.getBBox(1);c=f.x+f.width/2,e=f.y+f.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,c,e]])),this}},E.translate=function(a,c){return this.removed?this:(a=b(a).split(k),a.length-1&&(c=d(a[1])),a=d(a[0])||0,c=+c||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=c),this.transform(this._.transform.concat([["t",a,c]])),this)},E.scale=function(a,c,e,f){if(this.removed)return this;if(a=b(a).split(k),a.length-1&&(c=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),null==c&&(c=a),null==f&&(e=f),null==e||null==f)var g=this.getBBox(1);return e=null==e?g.x+g.width/2:e,f=null==f?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,c,e,f]])),this._.dirtyT=1,this},E.hide=function(){return!this.removed&&(this.node.style.display="none"),this},E.show=function(){return!this.removed&&(this.node.style.display=o),this},E._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),c.eve.unbind("raphael.*.*."+this.id),c._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)this[a]="function"==typeof this[a]?c._removedFactory(a):null;this.removed=!0}},E.attr=function(b,d){if(this.removed)return this;if(null==b){var e={};for(var f in this.attrs)this.attrs[a](f)&&(e[f]=this.attrs[f]);return e.gradient&&"none"==e.fill&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform,e}if(null==d&&c.is(b,"string")){if(b==j&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;for(var g=b.split(k),h={},i=0,m=g.length;m>i;i++)b=g[i],h[b]=b in this.attrs?this.attrs[b]:c.is(this.paper.customAttributes[b],"function")?this.paper.customAttributes[b].def:c._availableAttrs[b];return m-1?h:h[g[0]]}if(this.attrs&&null==d&&c.is(b,"array")){for(h={},i=0,m=b.length;m>i;i++)h[b[i]]=this.attr(b[i]);return h}var n;null!=d&&(n={},n[b]=d),null==d&&c.is(b,"object")&&(n=b);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[a](o)&&n[a](o)&&c.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[a](q)&&(n[q]=p[q])}n.text&&"text"==this.type&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&c._tofront(this,this.paper),this},E.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),c._toback(this,this.paper)),this)},E.insertAfter=function(a){return this.removed?this:(a.constructor==c.st.constructor&&(a=a[a.length-1]),a.node.nextSibling?a.node.parentNode.insertBefore(this.node,a.node.nextSibling):a.node.parentNode.appendChild(this.node),c._insertafter(this,a,this.paper),this)},E.insertBefore=function(a){return this.removed?this:(a.constructor==c.st.constructor&&(a=a[0]),a.node.parentNode.insertBefore(this.node,a.node),c._insertbefore(this,a,this.paper),this)},E.blur=function(a){var b=this.node.runtimeStyle,d=b.filter;return d=d.replace(r,o),0!==+a?(this.attrs.blur=a,b.filter=d+n+m+".Blur(pixelradius="+(+a||1.5)+")",b.margin=c.format("-{0}px 0 0 -{0}px",f(+a||1.5))):(b.filter=d,b.margin=0,delete this.attrs.blur),this},c._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");return f.on=!0,c.appendChild(f),d.skew=f,d.transform(o),d},c._engine.rect=function(a,b,d,e,f,g){var h=c._rectPath(b,d,e,f,g),i=a.path(h),j=i.attrs;return i.X=j.x=b,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect",i},c._engine.ellipse=function(a,b,c,d,e){var f=a.path();return f.attrs,f.X=b-d,f.Y=c-e,f.W=2*d,f.H=2*e,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e}),f},c._engine.circle=function(a,b,c,d){var e=a.path();return e.attrs,e.X=b-d,e.Y=c-d,e.W=e.H=2*d,e.type="circle",B(e,{cx:b,cy:c,r:d}),e},c._engine.image=function(a,b,d,e,f,g){var h=c._rectPath(d,e,f,g),i=a.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];return k.src=b,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=b,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0),i},c._engine.text=function(a,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=c.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=b(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,a),l={fill:"#000",stroke:"none",font:c._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=b(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),a.canvas.appendChild(h);var m=F("skew");return m.on=!0,h.appendChild(m),k.skew=m,k.transform(o),k},c._engine.setSize=function(a,b){var d=this.canvas.style;return this.width=a,this.height=b,a==+a&&(a+="px"),b==+b&&(b+="px"),d.width=a,d.height=b,d.clip="rect(0 "+a+" "+b+" 0)",this._viewBox&&c._engine.setViewBox.apply(this,this._viewBox),this},c._engine.setViewBox=function(a,b,d,e,f){c.eve("raphael.setViewBox",this,this._viewBox,[a,b,d,e,f]);var h,i,j=this.width,k=this.height,l=1/g(d/j,e/k);return f&&(h=k/e,i=j/d,j>d*h&&(a-=(j-d*h)/2/h),k>e*i&&(b-=(k-e*i)/2/i)),this._viewBox=[a,b,d,e,!!f],this._viewBoxShift={dx:-a,dy:-b,scale:l},this.forEach(function(a){a.transform("...")}),this};var F;c._engine.initWin=function(a){var b=a.document;b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("<rvml:"+a+' class="rvml">')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},c._engine.initWin(c._g.win),c._engine.create=function(){var a=c._getContainer.apply(0,arguments),b=a.container,d=a.height,e=a.width,f=a.x,g=a.y;if(!b)throw new Error("VML container not found.");var h=new c._Paper,i=h.canvas=c._g.doc.createElement("div"),j=i.style;return f=f||0,g=g||0,e=e||512,d=d||342,h.width=e,h.height=d,e==+e&&(e+="px"),d==+d&&(d+="px"),h.coordsize=1e3*u+n+1e3*u,h.coordorigin="0 0",h.span=c._g.doc.createElement("span"),h.span.style.cssText="position:absolute;
11left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",i.appendChild(h.span),j.cssText=c.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",e,d),1==b?(c._g.doc.body.appendChild(i),j.left=f+"px",j.top=g+"px",j.position="absolute"):b.firstChild?b.insertBefore(i,b.firstChild):b.appendChild(i),h.renderfix=function(){},h},c.prototype.clear=function(){c.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=c._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},c.prototype.remove=function(){c.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]="function"==typeof this[a]?c._removedFactory(a):null;return!0};var G=c.st;for(var H in E)E[a](H)&&!G[a](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}}(),B.was?A.win.Raphael=c:Raphael=c,c});; 12/* @license 13morris.js v0.5.1 14Copyright 2014 Olly Smith All rights reserved. 15Licensed under the BSD-2-Clause License. 16*/ 17 18 19(function() { 20 var $, Morris, minutesSpecHelper, secondsSpecHelper, 21 __slice = [].slice, 22 __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, 23 __hasProp = {}.hasOwnProperty, 24 __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, 25 __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; 26 27 Morris = window.Morris = {}; 28 29 $ = jQuery; 30 31 Morris.EventEmitter = (function() { 32 function EventEmitter() {} 33 34 EventEmitter.prototype.on = function(name, handler) { 35 if (this.handlers == null) { 36 this.handlers = {}; 37 } 38 if (this.handlers[name] == null) { 39 this.handlers[name] = []; 40 } 41 this.handlers[name].push(handler); 42 return this; 43 }; 44 45 EventEmitter.prototype.fire = function() { 46 var args, handler, name, _i, _len, _ref, _results; 47 name = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 48 if ((this.handlers != null) && (this.handlers[name] != null)) { 49 _ref = this.handlers[name]; 50 _results = []; 51 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 52 handler = _ref[_i]; 53 _results.push(handler.apply(null, args)); 54 } 55 return _results; 56 } 57 }; 58 59 return EventEmitter; 60 61 })(); 62 63 Morris.commas = function(num) { 64 var absnum, intnum, ret, strabsnum; 65 if (num != null) { 66 ret = num < 0 ? "-" : ""; 67 absnum = Math.abs(num); 68 intnum = Math.floor(absnum).toFixed(0); 69 ret += intnum.replace(/(?=(?:\d{3})+$)(?!^)/g, ','); 70 strabsnum = absnum.toString(); 71 if (strabsnum.length > intnum.length) { 72 ret += strabsnum.slice(intnum.length); 73 } 74 return ret; 75 } else { 76 return '-'; 77 } 78 }; 79 80 Morris.pad2 = function(number) { 81 return (number < 10 ? '0' : '') + number; 82 }; 83 84 Morris.Grid = (function(_super) { 85 __extends(Grid, _super); 86 87 function Grid(options) { 88 this.hasToShow = __bind(this.hasToShow, this); 89 this.resizeHandler = __bind(this.resizeHandler, this); 90 var _this = this; 91 if (typeof options.element === 'string') { 92 this.el = $(document.getElementById(options.element)); 93 } else { 94 this.el = $(options.element); 95 } 96 if ((this.el == null) || this.el.length === 0) { 97 throw new Error("Graph container element not found"); 98 } 99 if (this.el.css('position') === 'static') { 100 this.el.css('position', 'relative'); 101 } 102 this.options = $.extend({}, this.gridDefaults, this.defaults || {}, options); 103 if (typeof this.options.units === 'string') { 104 this.options.postUnits = options.units; 105 } 106 this.raphael = new Raphael(this.el[0]); 107 this.elementWidth = null; 108 this.elementHeight = null; 109 this.dirty = false;
110 this.selectFrom = null; 111 if (this.init) { 112 this.init(); 113 } 114 this.setData(this.options.data); 115 this.el.bind('mousemove', function(evt) { 116 var left, offset, right, width, x; 117 offset = _this.el.offset(); 118 x = evt.pageX - offset.left; 119 if (_this.selectFrom) { 120 left = _this.data[_this.hitTest(Math.min(x, _this.selectFrom))]._x; 121 right = _this.data[_this.hitTest(Math.max(x, _this.selectFrom))]._x; 122 width = right - left; 123 return _this.selectionRect.attr({ 124 x: left, 125 width: width 126 }); 127 } else { 128 return _this.fire('hovermove', x, evt.pageY - offset.top); 129 } 130 }); 131 this.el.bind('mouseleave', function(evt) { 132 if (_this.selectFrom) { 133 _this.selectionRect.hide(); 134 _this.selectFrom = null; 135 } 136 return _this.fire('hoverout'); 137 }); 138 this.el.bind('touchstart touchmove touchend', function(evt) { 139 var offset, touch; 140 touch = evt.originalEvent.touches[0] || evt.originalEvent.changedTouches[0]; 141 offset = _this.el.offset(); 142 return _this.fire('hovermove', touch.pageX - offset.left, touch.pageY - offset.top); 143 }); 144 this.el.bind('click', function(evt) { 145 var offset; 146 offset = _this.el.offset(); 147 return _this.fire('gridclick', evt.pageX - offset.left, evt.pageY - offset.top); 148 }); 149 if (this.options.rangeSelect) { 150 this.selectionRect = this.raphael.rect(0, 0, 0, this.el.innerHeight()).attr({ 151 fill: this.options.rangeSelectColor, 152 stroke: false 153 }).toBack().hide(); 154 this.el.bind('mousedown', function(evt) { 155 var offset; 156 offset = _this.el.offset(); 157 return _this.startRange(evt.pageX - offset.left); 158 }); 159 this.el.bind('mouseup', function(evt) { 160 var offset; 161 offset = _this.el.offset(); 162 _this.endRange(evt.pageX - offset.left); 163 return _this.fire('hovermove', evt.pageX - offset.left, evt.pageY - offset.top); 164 }); 165 } 166 if (this.options.resize) { 167 $(window).bind('resize', function(evt) { 168 if (_this.timeoutId != null) { 169 window.clearTimeout(_this.timeoutId); 170 } 171 return _this.timeoutId = window.setTimeout(_this.resizeHandler, 100); 172 }); 173 } 174 this.el.css('-webkit-tap-highlight-color', 'rgba(0,0,0,0)'); 175 if (this.postInit) { 176 this.postInit(); 177 } 178 } 179 180 Grid.prototype.gridDefaults = { 181 dateFormat: null, 182 axes: true, 183 grid: true, 184 gridLineColor: '#aaa', 185 gridStrokeWidth: 0.5, 186 gridTextColor: '#888', 187 gridTextSize: 12, 188 gridTextFamily: 'sans-serif', 189 gridTextWeight: 'normal', 190 hideHover: false, 191 yLabelFormat: null, 192 xLabelAngle: 0, 193 numLines: 5, 194 padding: 25, 195 parseTime: true, 196 postUnits: '', 197 preUnits: '', 198 ymax: 'auto', 199 ymin: 'auto 0', 200 goals: [], 201 goalStrokeWidth: 1.0, 202 goalLineColors: ['#666633', '#999966', '#cc6666', '#663333'], 203 events: [], 204 eventStrokeWidth: 1.0, 205 eventLineColors: ['#005a04', '#ccffbb', '#3a5f0b', '#005502'], 206 rangeSelect: null, 207 rangeSelectColor: '#eef', 208 resize: false 209 }; 210 211 Grid.prototype.setData = function(data, redraw) { 212 var e, flatEvents, from, idx, index, maxGoal, minGoal, ret, row, step, to, total, y, ykey, ymax, ymin, yval, _i, _len, _ref, _ref1; 213 if (redraw == null) { 214 redraw = true; 215 } 216 this.options.data = data; 217 if ((data == null) || data.length === 0) { 218 this.data = []; 219 this.raphael.clear(); 220 if (this.hover != null) { 221 this.hover.hide(); 222 } 223 return; 224 } 225 ymax = this.cumulative ? 0 : null; 226 ymin = this.cumulative ? 0 : null; 227 if (this.options.goals.length > 0) { 228 minGoal = Math.min.apply(Math, this.options.goals); 229 maxGoal = Math.max.apply(Math, this.options.goals); 230 ymin = ymin != null ? Math.min(ymin, minGoal) : minGoal; 231 ymax = ymax != null ? Math.max(ymax, maxGoal) : maxGoal; 232 } 233 this.data = (function() { 234 var _i, _len, _results; 235 _results = []; 236 for (index = _i = 0, _len = data.length; _i < _len; index = ++_i) { 237 row = data[index]; 238 ret = { 239 src: row 240 }; 241 ret.label = row[this.options.xkey]; 242 if (this.options.parseTime) { 243 ret.x = Morris.parseDate(ret.label); 244 if (this.options.dateFormat) { 245 ret.label = this.options.dateFormat(ret.x); 246 } else if (typeof ret.label === 'number') { 247 ret.label = new Date(ret.label).toString(); 248 } 249 } else { 250 ret.x = index; 251 if (this.options.xLabelFormat) { 252 ret.label = this.options.xLabelFormat(ret); 253 } 254 } 255 total = 0; 256 ret.y = (function() { 257 var _j, _len1, _ref, _results1; 258 _ref = this.options.ykeys; 259 _results1 = []; 260 for (idx = _j = 0, _len1 = _ref.length; _j < _len1; idx = ++_j) { 261 ykey = _ref[idx]; 262 yval = row[ykey]; 263 if (typeof yval === 'string') { 264 yval = parseFloat(yval); 265 } 266 if ((yval != null) && typeof yval !== 'number') { 267 yval = null; 268 } 269 if ((yval != null) && this.hasToShow(idx)) { 270 if (this.cumulative) { 271 total += yval; 272 } else { 273 if (ymax != null) { 274 ymax = Math.max(yval, ymax); 275 ymin = Math.min(yval, ymin); 276 } else { 277 ymax = ymin = yval; 278 } 279 } 280 } 281 if (this.cumulative && (total != null)) { 282 ymax = Math.max(total, ymax); 283 ymin = Math.min(total, ymin); 284 } 285 _results1.push(yval); 286 } 287 return _results1; 288 }).call(this); 289 _results.push(ret); 290 } 291 return _results; 292 }).call(this); 293 if (this.options.parseTime) { 294 this.data = this.data.sort(function(a, b) { 295 return (a.x > b.x) - (b.x > a.x); 296 }); 297 } 298 this.xmin = this.data[0].x; 299 this.xmax = this.data[this.data.length - 1].x; 300 this.events = []; 301 if (this.options.events.length > 0) { 302 if (this.options.parseTime) { 303 _ref = this.options.events; 304 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 305 e = _ref[_i]; 306 if (e instanceof Array) { 307 from = e[0], to = e[1]; 308 this.events.push([Morris.parseDate(from), Morris.parseDate(to)]); 309 } else { 310 this.events.push(Morris.parseDate(e)); 311 } 312 } 313 } else { 314 this.events = this.options.events; 315 } 316 flatEvents = $.map(this.events, function(e) { 317 return e; 318 }); 319 this.xmax = Math.max(this.xmax, Math.max.apply(Math, flatEvents)); 320 this.xmin = Math.min(this.xmin, Math.min.apply(Math, flatEvents)); 321 } 322 if (this.xmin === this.xmax) { 323 this.xmin -= 1; 324 this.xmax += 1; 325 } 326 this.ymin = this.yboundary('min', ymin); 327 this.ymax = this.yboundary('max', ymax); 328 if (this.ymin === this.ymax) { 329 if (ymin) { 330 this.ymin -= 1; 331 } 332 this.ymax += 1; 333 } 334 if (((_ref1 = this.options.axes) === true || _ref1 === 'both' || _ref1 === 'y') || this.options.grid === true) { 335 if (this.options.ymax === this.gridDefaults.ymax && this.options.ymin === this.gridDefaults.ymin) { 336 this.grid = this.autoGridLines(this.ymin, this.ymax, this.options.numLines); 337 this.ymin = Math.min(this.ymin, this.grid[0]); 338 this.ymax = Math.max(this.ymax, this.grid[this.grid.length - 1]); 339 } else { 340 step = (this.ymax - this.ymin) / (this.options.numLines - 1); 341 this.grid = (function() { 342 var _j, _ref2, _ref3, _results; 343 _results = []; 344 for (y = _j = _ref2 = this.ymin, _ref3 = this.ymax; step > 0 ? _j <= _ref3 : _j >= _ref3; y = _j += step) { 345 _results.push(y); 346 } 347 return _results; 348 }).call(this); 349 } 350 } 351 this.dirty = true; 352 if (redraw) { 353 return this.redraw(); 354 } 355 }; 356
357 Grid.prototype.yboundary = function(boundaryType, currentValue) { 358 var boundaryOption, suggestedValue; 359 boundaryOption = this.options["y" + boundaryType]; 360 if (typeof boundaryOption === 'string') { 361 if (boundaryOption.slice(0, 4) === 'auto') { 362 if (boundaryOption.length > 5) { 363 suggestedValue = parseInt(boundaryOption.slice(5), 10); 364 if (currentValue == null) { 365 return suggestedValue; 366 } 367 return Math[boundaryType](currentValue, suggestedValue); 368 } else { 369 if (currentValue != null) { 370 return currentValue; 371 } else { 372 return 0; 373 } 374 } 375 } else { 376 return parseInt(boundaryOption, 10); 377 } 378 } else { 379 return boundaryOption; 380 } 381 }; 382 383 Grid.prototype.autoGridLines = function(ymin, ymax, nlines) { 384 var gmax, gmin, grid, smag, span, step, unit, y, ymag; 385 span = ymax - ymin; 386 ymag = Math.floor(Math.log(span) / Math.log(10)); 387 unit = Math.pow(10, ymag); 388 gmin = Math.floor(ymin / unit) * unit; 389 gmax = Math.ceil(ymax / unit) * unit; 390 step = (gmax - gmin) / (nlines - 1); 391 if (unit === 1 && step > 1 && Math.ceil(step) !== step) { 392 step = Math.ceil(step); 393 gmax = gmin + step * (nlines - 1); 394 } 395 if (gmin < 0 && gmax > 0) { 396 gmin = Math.floor(ymin / step) * step; 397 gmax = Math.ceil(ymax / step) * step; 398 } 399 if (step < 1) { 400 smag = Math.floor(Math.log(step) / Math.log(10)); 401 grid = (function() { 402 var _i, _results; 403 _results = []; 404 for (y = _i = gmin; step > 0 ? _i <= gmax : _i >= gmax; y = _i += step) { 405 _results.push(parseFloat(y.toFixed(1 - smag))); 406 } 407 return _results; 408 })(); 409 } else { 410 grid = (function() { 411 var _i, _results; 412 _results = []; 413 for (y = _i = gmin; step > 0 ? _i <= gmax : _i >= gmax; y = _i += step) { 414 _results.push(y); 415 } 416 return _results; 417 })(); 418 } 419 return grid; 420 }; 421 422 Grid.prototype._calc = function() { 423 var angle, bottomOffsets, gridLine, h, i, w, yLabelWidths, _ref, _ref1; 424 w = this.el.width(); 425 h = this.el.height(); 426 if (this.elementWidth !== w || this.elementHeight !== h || this.dirty) { 427 this.elementWidth = w; 428 this.elementHeight = h; 429 this.dirty = false; 430 this.left = this.options.padding; 431 this.right = this.elementWidth - this.options.padding; 432 this.top = this.options.padding; 433 this.bottom = this.elementHeight - this.options.padding; 434 if ((_ref = this.options.axes) === true || _ref === 'both' || _ref === 'y') { 435 yLabelWidths = (function() { 436 var _i, _len, _ref1, _results; 437 _ref1 = this.grid; 438 _results = []; 439 for (_i = 0, _len = _ref1.length; _i < _len; _i++) { 440 gridLine = _ref1[_i]; 441 _results.push(this.measureText(this.yAxisFormat(gridLine)).width); 442 } 443 return _results; 444 }).call(this); 445 if (!this.options.horizontal) { 446 this.left += Math.max.apply(Math, yLabelWidths); 447 } else { 448 this.bottom -= Math.max.apply(Math, yLabelWidths); 449 } 450 } 451 if ((_ref1 = this.options.axes) === true || _ref1 === 'both' || _ref1 === 'x') { 452 if (!this.options.horizontal) { 453 angle = -this.options.xLabelAngle; 454 } else { 455 angle = -90; 456 } 457 bottomOffsets = (function() { 458 var _i, _ref2, _results; 459 _results = []; 460 for (i = _i = 0, _ref2 = this.data.length; 0 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 0 <= _ref2 ? ++_i : --_i) { 461 _results.push(this.measureText(this.data[i].label, angle).height); 462 } 463 return _results; 464 }).call(this); 465 if (!this.options.horizontal) { 466 this.bottom -= Math.max.apply(Math, bottomOffsets); 467 } else { 468 this.left += Math.max.apply(Math, bottomOffsets); 469 } 470 } 471 this.width = Math.max(1, this.right - this.left); 472 this.height = Math.max(1, this.bottom - this.top); 473 if (!this.options.horizontal) { 474 this.dx = this.width / (this.xmax - this.xmin);
475 this.dy = this.height / (this.ymax - this.ymin); 476 this.yStart = this.bottom; 477 this.yEnd = this.top; 478 this.xStart = this.left; 479 this.xEnd = this.right; 480 this.xSize = this.width; 481 this.ySize = this.height; 482 } else { 483 this.dx = this.height / (this.xmax - this.xmin); 484 this.dy = this.width / (this.ymax - this.ymin); 485 this.yStart = this.left; 486 this.yEnd = this.right; 487 this.xStart = this.top; 488 this.xEnd = this.bottom; 489 this.xSize = this.height; 490 this.ySize = this.width; 491 } 492 if (this.calc) { 493 return this.calc(); 494 } 495 } 496 }; 497 498 Grid.prototype.transY = function(y) { 499 if (!this.options.horizontal) { 500 return this.bottom - (y - this.ymin) * this.dy; 501 } else { 502 return this.left + (y - this.ymin) * this.dy; 503 } 504 }; 505 506 Grid.prototype.transX = function(x) { 507 if (this.data.length === 1) { 508 return (this.xStart + this.xEnd) / 2; 509 } else { 510 return this.xStart + (x - this.xmin) * this.dx; 511 } 512 }; 513 514 Grid.prototype.redraw = function() { 515 this.raphael.clear(); 516 this._calc(); 517 this.drawGrid(); 518 this.drawGoals(); 519 this.drawEvents(); 520 if (this.draw) { 521 return this.draw(); 522 } 523 }; 524 525 Grid.prototype.measureText = function(text, angle) { 526 var ret, tt; 527 if (angle == null) { 528 angle = 0; 529 } 530 tt = this.raphael.text(100, 100, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).rotate(angle); 531 ret = tt.getBBox(); 532 tt.remove(); 533 return ret; 534 }; 535 536 Grid.prototype.yAxisFormat = function(label) { 537 return this.yLabelFormat(label, 0); 538 }; 539 540 Grid.prototype.yLabelFormat = function(label, i) { 541 if (typeof this.options.yLabelFormat === 'function') { 542 return this.options.yLabelFormat(label, i); 543 } else { 544 return "" + this.options.preUnits + (Morris.commas(label)) + this.options.postUnits; 545 } 546 }; 547 548 Grid.prototype.getYAxisLabelX = function() { 549 return this.left - this.options.padding / 2; 550 }; 551 552 Grid.prototype.drawGrid = function() { 553 var basePos, lineY, pos, _i, _len, _ref, _ref1, _ref2, _results; 554 if (this.options.grid === false && ((_ref = this.options.axes) !== true && _ref !== 'both' && _ref !== 'y')) { 555 return; 556 } 557 if (!this.options.horizontal) { 558 basePos = this.getYAxisLabelX(); 559 } else { 560 basePos = this.getXAxisLabelY(); 561 } 562 _ref1 = this.grid; 563 _results = []; 564 for (_i = 0, _len = _ref1.length; _i < _len; _i++) { 565 lineY = _ref1[_i]; 566 pos = this.transY(lineY); 567 if ((_ref2 = this.options.axes) === true || _ref2 === 'both' || _ref2 === 'y') { 568 if (!this.options.horizontal) { 569 this.drawYAxisLabel(basePos, pos, this.yAxisFormat(lineY)); 570 } else { 571 this.drawXAxisLabel(pos, basePos, this.yAxisFormat(lineY)); 572 } 573 } 574 if (this.options.grid) { 575 pos = Math.floor(pos) + 0.5; 576 if (!this.options.horizontal) { 577 _results.push(this.drawGridLine("M" + this.xStart + "," + pos + "H" + this.xEnd)); 578 } else { 579 _results.push(this.drawGridLine("M" + pos + "," + this.xStart + "V" + this.xEnd)); 580 } 581 } else { 582 _results.push(void 0); 583 } 584 } 585 return _results; 586 }; 587 588 Grid.prototype.drawGoals = function() { 589 var color, goal, i, _i, _len, _ref, _results; 590 _ref = this.options.goals; 591 _results = []; 592 for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { 593 goal = _ref[i]; 594 color = this.options.goalLineColors[i % this.options.goalLineColors.length]; 595 _results.push(this.drawGoal(goal, color)); 596 } 597 return _results; 598 }; 599 600 Grid.prototype.drawEvents = function() { 601 var color, event, i, _i, _len, _ref, _results; 602 _ref = this.events; 603 _results = []; 604 for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { 605 event = _ref[i]; 606 color = this.options.eventLineColors[i % this.options.eventLineColors.length]; 607 _results.push(this.drawEvent(event, color)); 608 } 609 return _results; 610 }; 611 612 Grid.prototype.drawGoal = function(goal, color) { 613 var path, y; 614 y = Math.floor(this.transY(goal)) + 0.5; 615 if (!this.options.horizontal) { 616 path = "M" + this.xStart + "," + y + "H" + this.xEnd; 617 } else { 618 path = "M" + y + "," + this.xStart + "V" + this.xEnd; 619 } 620 return this.raphael.path(path).attr('stroke', color).attr('stroke-width', this.options.goalStrokeWidth); 621 }; 622 623 Grid.prototype.drawEvent = function(event, color) { 624 var from, path, to, x; 625 if (event instanceof Array) { 626 from = event[0], to = event[1]; 627 from = Math.floor(this.transX(from)) + 0.5; 628 to = Math.floor(this.transX(to)) + 0.5; 629 if (!this.options.horizontal) { 630 return this.raphael.rect(from, this.yEnd, to - from, this.yStart - this.yEnd).attr({ 631 fill: color, 632 stroke: false 633 }).toBack(); 634 } else { 635 return this.raphael.rect(this.yStart, from, this.yEnd - this.yStart, to - from).attr({ 636 fill: color, 637 stroke: false 638 }).toBack(); 639 } 640 } else { 641 x = Math.floor(this.transX(event)) + 0.5; 642 if (!this.options.horizontal) { 643 path = "M" + x + "," + this.yStart + "V" + this.yEnd; 644 } else { 645 path = "M" + this.yStart + "," + x + "H" + this.yEnd; 646 } 647 return this.raphael.path(path).attr('stroke', color).attr('stroke-width', this.options.eventStrokeWidth); 648 } 649 }; 650 651 Grid.prototype.drawYAxisLabel = function(xPos, yPos, text) { 652 return this.raphael.text(xPos, yPos, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).attr('fill', this.options.gridTextColor).attr('text-anchor', 'end'); 653 }; 654 655 Grid.prototype.drawGridLine = function(path) { 656 return this.raphael.path(path).attr('stroke', this.options.gridLineColor).attr('stroke-width', this.options.gridStrokeWidth); 657 }; 658 659 Grid.prototype.startRange = function(x) { 660 this.hover.hide(); 661 this.selectFrom = x; 662 return this.selectionRect.attr({ 663 x: x, 664 width: 0 665 }).show(); 666 }; 667 668 Grid.prototype.endRange = function(x) { 669 var end, start; 670 if (this.selectFrom) { 671 start = Math.min(this.selectFrom, x); 672 end = Math.max(this.selectFrom, x); 673 this.options.rangeSelect.call(this.el, { 674 start: this.data[this.hitTest(start)].x, 675 end: this.data[this.hitTest(end)].x 676 }); 677 return this.selectFrom = null; 678 } 679 }; 680 681 Grid.prototype.resizeHandler = function() { 682 this.timeoutId = null; 683 this.raphael.setSize(this.el.width(), this.el.height()); 684 return this.redraw(); 685 }; 686 687 Grid.prototype.hasToShow = function(i) { 688 return this.options.shown === true || this.options.shown[i] === true; 689 }; 690 691 return Grid; 692 693 })(Morris.EventEmitter); 694 695 Morris.parseDate = function(date) { 696 var isecs, m, msecs, n, o, offsetmins, p, q, r, ret, secs; 697 if (typeof date === 'number') { 698 return date; 699 } 700 m = date.match(/^(\d+) Q(\d)$/); 701 n = date.match(/^(\d+)-(\d+)$/); 702 o = date.match(/^(\d+)-(\d+)-(\d+)$/); 703 p = date.match(/^(\d+) W(\d+)$/); 704 q = date.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+)(Z|([+-])(\d\d):?(\d\d))?$/); 705 r = date.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+):(\d+(\.\d+)?)(Z|([+-])(\d\d):?(\d\d))?$/); 706 if (m) { 707 return new Date(parseInt(m[1], 10), parseInt(m[2], 10) * 3 - 1, 1).getTime(); 708 } else if (n) { 709 return new Date(parseInt(n[1], 10), parseInt(n[2], 10) - 1, 1).getTime(); 710 } else if (o) { 711 return new Date(parseInt(o[1], 10), parseInt(o[2], 10) - 1, parseInt(o[3], 10)).getTime(); 712 } else if (p) { 713 ret = new Date(parseInt(p[1], 10), 0, 1); 714 if (ret.getDay() !== 4) { 715 ret.setMonth(0, 1 + ((4 - ret.getDay()) + 7) % 7); 716 } 717 return ret.getTime() + parseInt(p[2], 10) * 604800000; 718 } else if (q) { 719 if (!q[6]) { 720 return new Date(parseInt(q[1], 10), parseInt(q[2], 10) - 1, parseInt(q[3], 10), parseInt(q[4], 10), parseInt(q[5], 10)).getTime(); 721 } else { 722 offsetmins = 0; 723 if (q[6] !== 'Z') { 724 offsetmins = parseInt(q[8], 10) * 60 + parseInt(q[9], 10); 725 if (q[7] === '+') { 726 offsetmins = 0 - offsetmins; 727 } 728 } 729 return Date.UTC(parseInt(q[1], 10), parseInt(q[2], 10) - 1, parseInt(q[3], 10), parseInt(q[4], 10), parseInt(q[5], 10) + offsetmins); 730 } 731 } else if (r) { 732 secs = parseFloat(r[6]); 733 isecs = Math.floor(secs); 734 msecs = Math.round((secs - isecs) * 1000); 735 if (!r[8]) { 736 return new Date(parseInt(r[1], 10), parseInt(r[2], 10) - 1, parseInt(r[3], 10), parseInt(r[4], 10), parseInt(r[5], 10), isecs, msecs).getTime(); 737 } else { 738 offsetmins = 0; 739 if (r[8] !== 'Z') { 740 offsetmins = parseInt(r[10], 10) * 60 + parseInt(r[11], 10);
741 if (r[9] === '+') { 742 offsetmins = 0 - offsetmins; 743 } 744 } 745 return Date.UTC(parseInt(r[1], 10), parseInt(r[2], 10) - 1, parseInt(r[3], 10), parseInt(r[4], 10), parseInt(r[5], 10) + offsetmins, isecs, msecs); 746 } 747 } else { 748 return new Date(parseInt(date, 10), 0, 1).getTime(); 749 } 750 }; 751 752 Morris.Hover = (function() { 753 Hover.defaults = { 754 "class": 'morris-hover morris-default-style' 755 }; 756 757 function Hover(options) { 758 if (options == null) { 759 options = {}; 760 } 761 this.options = $.extend({}, Morris.Hover.defaults, options); 762 this.el = $("<div class='" + this.options["class"] + "'></div>"); 763 this.el.hide(); 764 this.options.parent.append(this.el); 765 } 766 767 Hover.prototype.update = function(html, x, y, centre_y) { 768 if (!html) { 769 return this.hide(); 770 } else { 771 this.html(html); 772 this.show(); 773 return this.moveTo(x, y, centre_y); 774 } 775 }; 776 777 Hover.prototype.html = function(content) { 778 return this.el.html(content); 779 }; 780 781 Hover.prototype.moveTo = function(x, y, centre_y) { 782 var hoverHeight, hoverWidth, left, parentHeight, parentWidth, top; 783 parentWidth = this.options.parent.innerWidth(); 784 parentHeight = this.options.parent.innerHeight(); 785 hoverWidth = this.el.outerWidth(); 786 hoverHeight = this.el.outerHeight(); 787 left = Math.min(Math.max(0, x - hoverWidth / 2), parentWidth - hoverWidth); 788 if (y != null) { 789 if (centre_y === true) { 790 top = y - hoverHeight / 2; 791 if (top < 0) { 792 top = 0; 793 } 794 } else { 795 top = y - hoverHeight - 10; 796 if (top < 0) { 797 top = y + 10; 798 if (top + hoverHeight > parentHeight) { 799 top = parentHeight / 2 - hoverHeight / 2; 800 } 801 } 802 } 803 } else { 804 top = parentHeight / 2 - hoverHeight / 2; 805 } 806 return this.el.css({ 807 left: left + "px", 808 top: parseInt(top) + "px" 809 }); 810 }; 811 812 Hover.prototype.show = function() { 813 return this.el.show(); 814 }; 815 816 Hover.prototype.hide = function() { 817 return this.el.hide(); 818 }; 819 820 return Hover; 821 822 })(); 823 824 Morris.Line = (function(_super) { 825 __extends(Line, _super); 826 827 function Line(options) { 828 this.hilight = __bind(this.hilight, this); 829 this.onHoverOut = __bind(this.onHoverOut, this); 830 this.onHoverMove = __bind(this.onHoverMove, this); 831 this.onGridClick = __bind(this.onGridClick, this); 832 if (!(this instanceof Morris.Line)) { 833 return new Morris.Line(options); 834 } 835 Line.__super__.constructor.call(this, options); 836 } 837 838 Line.prototype.init = function() { 839 if (this.options.hideHover !== 'always') { 840 this.hover = new Morris.Hover({ 841 parent: this.el 842 }); 843 this.on('hovermove', this.onHoverMove); 844 this.on('hoverout', this.onHoverOut); 845 return this.on('gridclick', this.onGridClick); 846 } 847 }; 848 849 Line.prototype.defaults = { 850 lineWidth: 3, 851 pointSize: 4, 852 lineColors: ['#0b62a4', '#7A92A3', '#4da74d', '#afd8f8', '#edc240', '#cb4b4b', '#9440ed'], 853 pointStrokeWidths: [1], 854 pointStrokeColors: ['#ffffff'], 855 pointFillColors: [], 856 smooth: true, 857 shown: true, 858 xLabels: 'auto', 859 xLabelFormat: null, 860 xLabelMargin: 24, 861 hideHover: false, 862 trendLine: false, 863 trendLineWidth: 2, 864 trendLineColors: ['#689bc3', '#a2b3bf', '#64b764'] 865 }; 866 867 Line.prototype.calc = function() { 868 this.calcPoints(); 869 return this.generatePaths(); 870 }; 871 872 Line.prototype.calcPoints = function() { 873 var row, y, _i, _len, _ref, _results; 874 _ref = this.data; 875 _results = []; 876 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 877 row = _ref[_i]; 878 row._x = this.transX(row.x); 879 row._y = (function() { 880 var _j, _len1, _ref1, _results1; 881 _ref1 = row.y; 882 _results1 = []; 883 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { 884 y = _ref1[_j]; 885 if (y != null) { 886 _results1.push(this.transY(y)); 887 } else { 888 _results1.push(y); 889 } 890 } 891 return _results1; 892 }).call(this); 893 _results.push(row._ymax = Math.min.apply(Math, [this.bottom].concat((function() { 894 var _j, _len1, _ref1, _results1; 895 _ref1 = row._y; 896 _results1 = []; 897 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { 898 y = _ref1[_j]; 899 if (y != null) { 900 _results1.push(y); 901 } 902 } 903 return _results1; 904 })()))); 905 } 906 return _results; 907 }; 908 909 Line.prototype.hitTest = function(x) { 910 var index, r, _i, _len, _ref; 911 if (this.data.length === 0) { 912 return null; 913 } 914 _ref = this.data.slice(1); 915 for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) { 916 r = _ref[index]; 917 if (x < (r._x + this.data[index]._x) / 2) { 918 break; 919 } 920 } 921 return index; 922 }; 923 924 Line.prototype.onGridClick = function(x, y) { 925 var index; 926 index = this.hitTest(x); 927 return this.fire('click', index, this.data[index].src, x, y); 928 }; 929 930 Line.prototype.onHoverMove = function(x, y) { 931 var index; 932 index = this.hitTest(x); 933 return this.displayHoverForRow(index); 934 }; 935 936 Line.prototype.onHoverOut = function() { 937 if (this.options.hideHover !== false) { 938 return this.displayHoverForRow(null); 939 } 940 }; 941 942 Line.prototype.displayHoverForRow = function(index) { 943 var _ref; 944 if (index != null) { 945 (_ref = this.hover).update.apply(_ref, this.hoverContentForRow(index)); 946 return this.hilight(index); 947 } else { 948 this.hover.hide(); 949 return this.hilight(); 950 } 951 }; 952 953 Line.prototype.hoverContentForRow = function(index) { 954 var content, j, row, y, _i, _len, _ref; 955 row = this.data[index]; 956 content = $("<div class='morris-hover-row-label'>").text(row.label); 957 content = content.prop('outerHTML'); 958 _ref = row.y; 959 for (j = _i = 0, _len = _ref.length; _i < _len; j = ++_i) { 960 y = _ref[j]; 961 if (this.options.labels[j] === false) { 962 continue; 963 } 964 content += "<div class='morris-hover-point' style='color: " + (this.colorFor(row, j, 'label')) + "'>\n " + this.options.labels[j] + ":\n " + (this.yLabelFormat(y, j)) + "\n</div>"; 965 } 966 if (typeof this.options.hoverCallback === 'function') { 967 content = this.options.hoverCallback(index, this.options, content, row.src
967); 968 } 969 return [content, row._x, row._ymax]; 970 }; 971 972 Line.prototype.generatePaths = function() { 973 var coords, i, r, smooth; 974 return this.paths = (function() { 975 var _i, _ref, _ref1, _results; 976 _results = []; 977 for (i = _i = 0, _ref = this.options.ykeys.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { 978 smooth = typeof this.options.smooth === "boolean" ? this.options.smooth : (_ref1 = this.options.ykeys[i], __indexOf.call(this.options.smooth, _ref1) >= 0); 979 coords = (function() { 980 var _j, _len, _ref2, _results1; 981 _ref2 = this.data; 982 _results1 = []; 983 for (_j = 0, _len = _ref2.length; _j < _len; _j++) { 984 r = _ref2[_j]; 985 if (r._y[i] !== void 0) { 986 _results1.push({ 987 x: r._x, 988 y: r._y[i] 989 }); 990 } 991 } 992 return _results1; 993 }).call(this); 994 if (coords.length > 1) { 995 _results.push(Morris.Line.createPath(coords, smooth, this.bottom)); 996 } else { 997 _results.push(null); 998 } 999 } 1000 return _results; 1001 }).call(this); 1002 }; 1003 1004 Line.prototype.draw = function() { 1005 var _ref; 1006 if ((_ref = this.options.axes) === true || _ref === 'both' || _ref === 'x') { 1007 this.drawXAxis(); 1008 } 1009 this.drawSeries(); 1010 if (this.options.hideHover === false) { 1011 return this.displayHoverForRow(this.data.length - 1); 1012 } 1013 }; 1014 1015 Line.prototype.drawXAxis = function() { 1016 var drawLabel, l, labels, prevAngleMargin, prevLabelMargin, row, ypos, _i, _len, _results, 1017 _this = this; 1018 ypos = this.bottom + this.options.padding / 2; 1019 prevLabelMargin = null; 1020 prevAngleMargin = null; 1021 drawLabel = function(labelText, xpos) { 1022 var label, labelBox, margin, offset, textBox; 1023 label = _this.drawXAxisLabel(_this.transX(xpos), ypos, labelText); 1024 textBox = label.getBBox(); 1025 label.transform("r" + (-_this.options.xLabelAngle)); 1026 labelBox = label.getBBox(); 1027 label.transform("t0," + (labelBox.height / 2) + "..."); 1028 if (_this.options.xLabelAngle !== 0) { 1029 offset = -0.5 * textBox.width * Math.cos(_this.options.xLabelAngle * Math.PI / 180.0); 1030 label.transform("t" + offset + ",0..."); 1031 } 1032 labelBox = label.getBBox(); 1033 if (((prevLabelMargin == null) || prevLabelMargin >= labelBox.x + labelBox.width || (prevAngleMargin != null) && prevAngleMargin >= labelBox.x) && labelBox.x >= 0 && (labelBox.x + labelBox.width) < _this.el.width()) { 1034 if (_this.options.xLabelAngle !== 0) { 1035 margin = 1.25 * _this.options.gridTextSize / Math.sin(_this.options.xLabelAngle * Math.PI / 180.0); 1036 prevAngleMargin = labelBox.x - margin; 1037 } 1038 return prevLabelMargin = labelBox.x - _this.options.xLabelMargin; 1039 } else { 1040 return label.remove(); 1041 } 1042 }; 1043 if (this.options.parseTime) { 1044 if (this.data.length === 1 && this.options.xLabels === 'auto') { 1045 labels = [[this.data[0].label, this.data[0].x]]; 1046 } else { 1047 labels = Morris.labelSeries(this.xmin, this.xmax, this.width, this.options.xLabels, this.options.xLabelFormat); 1048 } 1049 } else { 1050 labels = (function() { 1051 var _i, _len, _ref, _results; 1052 _ref = this.data; 1053 _results = []; 1054 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1055 row = _ref[_i]; 1056 _results.push([row.label, row.x]); 1057 } 1058 return _results; 1059 }).call(this); 1060 } 1061 labels.reverse(); 1062 _results = []; 1063 for (_i = 0, _len = labels.length; _i < _len; _i++) { 1064 l = labels[_i]; 1065 _results.push(drawLabel(l[0], l[1])); 1066 } 1067 return _results; 1068 }; 1069 1070 Line.prototype.drawSeries = function() { 1071 var i, _i, _j, _ref, _ref1, _results; 1072 this.seriesPoints = []; 1073 for (i = _i = _ref = this.options.ykeys.length - 1; _ref <= 0 ? _i <= 0 : _i >= 0; i = _ref <= 0 ? ++_i : --_i) { 1074 if (this.hasToShow(i)) { 1075 if (this.options.trendLine !== false && this.options.trendLine === true || this.options.trendLine[i] === true) { 1076 this._drawTrendLine(i); 1077 } 1078 this._drawLineFor(i); 1079 } 1080 } 1081 _results = []; 1082 for (i = _j = _ref1 = this.options.ykeys.length - 1; _ref1 <= 0 ? _j <= 0 : _j >= 0; i = _ref1 <= 0 ? ++_j : --_j) { 1083 if (this.hasToShow(i)) { 1084 _results.push(this._drawPointFor(i)); 1085 } else { 1086 _results.push(void 0); 1087 } 1088 } 1089 return _results; 1090 }; 1091 1092 Line.prototype._drawPointFor = function(index) { 1093 var circle, row, _i, _len, _ref, _results; 1094 this.seriesPoints[index] = []; 1095 _ref = this.data; 1096 _results = []; 1097 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1098 row = _ref[_i]; 1099 circle = null; 1100 if (row._y[index] != null) { 1101 circle = this.drawLinePoint(row._x, row._y[index], this.colorFor(row, index, 'point'), index); 1102 } 1103 _results.push(this.seriesPoints[index].push(circle)); 1104 } 1105 return _results; 1106 }; 1107 1108 Line.prototype._drawLineFor = function(index) { 1109 var path; 1110 path = this.paths[index]; 1111 if (path !== null) { 1112 return this.drawLinePath(path, this.colorFor(null, index, 'line'), index); 1113 } 1114 }; 1115 1116 Line.prototype._drawTrendLine = function(index) { 1117 var a, b, data, datapoints, path, sum_x, sum_xx, sum_xy, sum_y, val, x, y, _i, _len, _ref; 1118 sum_x = 0; 1119 sum_y = 0; 1120 sum_xx = 0; 1121 sum_xy = 0; 1122 datapoints = 0; 1123 _ref = this.data; 1124 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1125 val = _ref[_i]; 1126 x = val.x; 1127 y = val.y[index]; 1128 if (y === void 0) { 1129 continue; 1130 } 1131 datapoints += 1; 1132 sum_x += x; 1133 sum_y += y; 1134 sum_xx += x * x; 1135 sum_xy += x * y; 1136 } 1137 a = (datapoints * sum_xy - sum_x * sum_y) / (datapoints * sum_xx - sum_x * sum_x); 1138 b = (sum_y / datapoints) - ((a * sum_x) / datapoints); 1139 data = [{}, {}]; 1140 data[0].x = this.transX(this.data[0].x); 1141 data[0].y = this.transY(this.data[0].x * a + b); 1142 data[1].x = this.transX(this.data[this.data.length - 1].x); 1143 data[1].y = this.transY(this.data[this.data.length - 1].x * a + b); 1144 path = Morris.Line.createPath(data, false, this.bottom); 1145 return path = this.raphael.path(path).attr('stroke', this.colorFor(null, index, 'trendLine')).attr('stroke-width', this.options.trendLineWidth); 1146 }; 1147 1148 Line.createPath = function(coords, smooth, bottom) { 1149 var coord, g, grads, i, ix, lg, path, prevCoord, x1, x2, y1, y2, _i, _len; 1150 path = ""; 1151 if (smooth) { 1152 grads = Morris.Line.gradients(coords); 1153 } 1154 prevCoord = { 1155 y: null 1156 };
1157 for (i = _i = 0, _len = coords.length; _i < _len; i = ++_i) { 1158 coord = coords[i]; 1159 if (coord.y != null) { 1160 if (prevCoord.y != null) { 1161 if (smooth) { 1162 g = grads[i]; 1163 lg = grads[i - 1]; 1164 ix = (coord.x - prevCoord.x) / 4; 1165 x1 = prevCoord.x + ix; 1166 y1 = Math.min(bottom, prevCoord.y + ix * lg); 1167 x2 = coord.x - ix; 1168 y2 = Math.min(bottom, coord.y - ix * g); 1169 path += "C" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + coord.x + "," + coord.y; 1170 } else { 1171 path += "L" + coord.x + "," + coord.y; 1172 } 1173 } else { 1174 if (!smooth || (grads[i] != null)) { 1175 path += "M" + coord.x + "," + coord.y; 1176 } 1177 } 1178 } 1179 prevCoord = coord; 1180 } 1181 return path; 1182 }; 1183 1184 Line.gradients = function(coords) { 1185 var coord, grad, i, nextCoord, prevCoord, _i, _len, _results; 1186 grad = function(a, b) { 1187 return (a.y - b.y) / (a.x - b.x); 1188 }; 1189 _results = []; 1190 for (i = _i = 0, _len = coords.length; _i < _len; i = ++_i) { 1191 coord = coords[i]; 1192 if (coord.y != null) { 1193 nextCoord = coords[i + 1] || { 1194 y: null 1195 }; 1196 prevCoord = coords[i - 1] || { 1197 y: null 1198 }; 1199 if ((prevCoord.y != null) && (nextCoord.y != null)) { 1200 _results.push(grad(prevCoord, nextCoord)); 1201 } else if (prevCoord.y != null) { 1202 _results.push(grad(prevCoord, coord)); 1203 } else if (nextCoord.y != null) { 1204 _results.push(grad(coord, nextCoord)); 1205 } else { 1206 _results.push(null); 1207 } 1208 } else { 1209 _results.push(null); 1210 } 1211 } 1212 return _results; 1213 }; 1214 1215 Line.prototype.hilight = function(index) { 1216 var i, _i, _j, _ref, _ref1; 1217 if (this.prevHilight !== null && this.prevHilight !== index) { 1218 for (i = _i = 0, _ref = this.seriesPoints.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) { 1219 if (this.seriesPoints[i][this.prevHilight]) { 1220 this.seriesPoints[i][this.prevHilight].animate(this.pointShrinkSeries(i)); 1221 } 1222 } 1223 } 1224 if (index !== null && this.prevHilight !== index) { 1225 for (i = _j = 0, _ref1 = this.seriesPoints.length - 1; 0 <= _ref1 ? _j <= _ref1 : _j >= _ref1; i = 0 <= _ref1 ? ++_j : --_j) { 1226 if (this.seriesPoints[i][index]) { 1227 this.seriesPoints[i][index].animate(this.pointGrowSeries(i)); 1228 } 1229 } 1230 } 1231 return this.prevHilight = index; 1232 }; 1233 1234 Line.prototype.colorFor = function(row, sidx, type) { 1235 if (typeof this.options.lineColors === 'function') { 1236 return this.options.lineColors.call(this, row, sidx, type); 1237 } else if (type === 'point') { 1238 return this.options.pointFillColors[sidx % this.options.pointFillColors.length] || this.options.lineColors[sidx % this.options.lineColors.length]; 1239 } else if (type === 'line') { 1240 return this.options.lineColors[sidx % this.options.lineColors.length]; 1241 } else { 1242 return this.options.trendLineColors[sidx % this.options.trendLineColors.length]; 1243 } 1244 }; 1245 1246 Line.prototype.drawXAxisLabel = function(xPos, yPos, text) { 1247 return this.raphael.text(xPos, yPos, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).attr('fill', this.options.gridTextColor); 1248 }; 1249 1250 Line.prototype.drawLinePath = function(path, lineColor, lineIndex) { 1251 return this.raphael.path(path).attr('stroke', lineColor).attr('stroke-width', this.lineWidthForSeries(lineIndex)); 1252 }; 1253 1254 Line.prototype.drawLinePoint = function(xPos, yPos, pointColor, lineIndex) { 1255 return this.raphael.circle(xPos, yPos, this.pointSizeForSeries(lineIndex)).attr('fill', pointColor).attr('stroke-width', this.pointStrokeWidthForSeries(lineIndex)).attr('stroke', this.pointStrokeColorForSeries(lineIndex)); 1256 }; 1257 1258 Line.prototype.pointStrokeWidthForSeries = function(index) { 1259 return this.options.pointStrokeWidths[index % this.options.pointStrokeWidths.length]; 1260 }; 1261 1262 Line.prototype.pointStrokeColorForSeries = function(index) { 1263 return this.options.pointStrokeColors[index % this.options.pointStrokeColors.length]; 1264 }; 1265 1266 Line.prototype.lineWidthForSeries = function(index) { 1267 if (this.options.lineWidth instanceof Array) { 1268 return this.options.lineWidth[index % this.options.lineWidth.length]; 1269 } else { 1270 return this.options.lineWidth; 1271 } 1272 }; 1273 1274 Line.prototype.pointSizeForSeries = function(index) { 1275 if (this.options.pointSize instanceof Array) { 1276 return this.options.pointSize[index % this.options.pointSize.length]; 1277 } else { 1278 return this.options.pointSize; 1279 } 1280 }; 1281 1282 Line.prototype.pointGrowSeries = function(index) { 1283 if (this.pointSizeForSeries(index) === 0) { 1284 return; 1285 } 1286 return Raphael.animation({ 1287 r: this.pointSizeForSeries(index) + 3 1288 }, 25, 'linear'); 1289 }; 1290 1291 Line.prototype.pointShrinkSeries = function(index) { 1292 return Raphael.animation({ 1293 r: this.pointSizeForSeries(index) 1294 }, 25, 'linear'); 1295 }; 1296 1297 return Line; 1298 1299 })(Morris.Grid); 1300 1301 Morris.labelSeries = function(dmin, dmax, pxwidth, specName, xLabelFormat) { 1302 var d, d0, ddensity, name, ret, s, spec, t, _i, _len, _ref; 1303 ddensity = 200 * (dmax - dmin) / pxwidth; 1304 d0 = new Date(dmin); 1305 spec = Morris.LABEL_SPECS[specName]; 1306 if (spec === void 0) { 1307 _ref = Morris.AUTO_LABEL_ORDER; 1308 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1309 name = _ref[_i]; 1310 s = Morris.LABEL_SPECS[name]; 1311 if (ddensity >= s.span) { 1312 spec = s; 1313 break; 1314 } 1315 } 1316 } 1317 if (spec === void 0) { 1318 spec = Morris.LABEL_SPECS["second"]; 1319 } 1320 if (xLabelFormat) { 1321 spec = $.extend({}, spec, { 1322 fmt: xLabelFormat 1323 }); 1324 } 1325 d = spec.start(d0); 1326 ret = []; 1327 while ((t = d.getTime()) <= dmax) { 1328 if (t >= dmin) {
1329 ret.push([spec.fmt(d), t]); 1330 } 1331 spec.incr(d); 1332 } 1333 return ret; 1334 }; 1335 1336 minutesSpecHelper = function(interval) { 1337 return { 1338 span: interval * 60 * 1000, 1339 start: function(d) { 1340 return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours()); 1341 }, 1342 fmt: function(d) { 1343 return "" + (Morris.pad2(d.getHours())) + ":" + (Morris.pad2(d.getMinutes())); 1344 }, 1345 incr: function(d) { 1346 return d.setUTCMinutes(d.getUTCMinutes() + interval); 1347 } 1348 }; 1349 }; 1350 1351 secondsSpecHelper = function(interval) { 1352 return { 1353 span: interval * 1000, 1354 start: function(d) { 1355 return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes()); 1356 }, 1357 fmt: function(d) { 1358 return "" + (Morris.pad2(d.getHours())) + ":" + (Morris.pad2(d.getMinutes())) + ":" + (Morris.pad2(d.getSeconds())); 1359 }, 1360 incr: function(d) { 1361 return d.setUTCSeconds(d.getUTCSeconds() + interval); 1362 } 1363 }; 1364 }; 1365 1366 Morris.LABEL_SPECS = { 1367 "decade": { 1368 span: 172800000000, 1369 start: function(d) { 1370 return new Date(d.getFullYear() - d.getFullYear() % 10, 0, 1); 1371 }, 1372 fmt: function(d) { 1373 return "" + (d.getFullYear()); 1374 }, 1375 incr: function(d) { 1376 return d.setFullYear(d.getFullYear() + 10); 1377 } 1378 }, 1379 "year": { 1380 span: 17280000000, 1381 start: function(d) { 1382 return new Date(d.getFullYear(), 0, 1); 1383 }, 1384 fmt: function(d) { 1385 return "" + (d.getFullYear()); 1386 }, 1387 incr: function(d) { 1388 return d.setFullYear(d.getFullYear() + 1); 1389 } 1390 }, 1391 "month": { 1392 span: 2419200000, 1393 start: function(d) { 1394 return new Date(d.getFullYear(), d.getMonth(), 1); 1395 }, 1396 fmt: function(d) { 1397 return "" + (d.getFullYear()) + "-" + (Morris.pad2(d.getMonth() + 1)); 1398 }, 1399 incr: function(d) { 1400 return d.setMonth(d.getMonth() + 1); 1401 } 1402 }, 1403 "week": { 1404 span: 604800000, 1405 start: function(d) { 1406 return new Date(d.getFullYear(), d.getMonth(), d.getDate()); 1407 }, 1408 fmt: function(d) { 1409 return "" + (d.getFullYear()) + "-" + (Morris.pad2(d.getMonth() + 1)) + "-" + (Morris.pad2(d.getDate())); 1410 }, 1411 incr: function(d) { 1412 return d.setDate(d.getDate() + 7); 1413 } 1414 }, 1415 "day": { 1416 span: 86400000, 1417 start: function(d) { 1418 return new Date(d.getFullYear(), d.getMonth(), d.getDate()); 1419 }, 1420 fmt: function(d) { 1421 return "" + (d.getFullYear()) + "-" + (Morris.pad2(d.getMonth() + 1)) + "-" + (Morris.pad2(d.getDate())); 1422 }, 1423 incr: function(d) { 1424 return d.setDate(d.getDate() + 1); 1425 } 1426 }, 1427 "hour": minutesSpecHelper(60), 1428 "30min": minutesSpecHelper(30), 1429 "15min": minutesSpecHelper(15), 1430 "10min": minutesSpecHelper(10), 1431 "5min": minutesSpecHelper(5), 1432 "minute": minutesSpecHelper(1), 1433 "30sec": secondsSpecHelper(30), 1434 "15sec": secondsSpecHelper(15), 1435 "10sec": secondsSpecHelper(10), 1436 "5sec": secondsSpecHelper(5), 1437 "second": secondsSpecHelper(1) 1438 }; 1439 1440 Morris.AUTO_LABEL_ORDER = ["decade", "year", "month", "week", "day", "hour", "30min", "15min", "10min", "5min", "minute", "30sec", "15sec", "10sec", "5sec", "second"]; 1441 1442 Morris.Area = (function(_super) { 1443 var areaDefaults; 1444 1445 __extends(Area, _super); 1446 1447 areaDefaults = { 1448 fillOpacity: 'auto', 1449 behaveLikeLine: false 1450 }; 1451 1452 function Area(options) { 1453 var areaOptions; 1454 if (!(this instanceof Morris.Area)) { 1455 return new Morris.Area(options); 1456 } 1457 areaOptions = $.extend({}, areaDefaults, options); 1458 this.cumulative = !areaOptions.behaveLikeLine; 1459 if (areaOptions.fillOpacity === 'auto') { 1460 areaOptions.fillOpacity = areaOptions.behaveLikeLine ? .8 : 1; 1461 } 1462 Area.__super__.constructor.call(this, areaOptions); 1463 } 1464 1465 Area.prototype.calcPoints = function() { 1466 var row, total, y, _i, _len, _ref, _results; 1467 _ref = this.data; 1468 _results = []; 1469 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1470 row = _ref[_i]; 1471 row._x = this.transX(row.x); 1472 total = 0; 1473 row._y = (function() { 1474 var _j, _len1, _ref1, _results1; 1475 _ref1 = row.y; 1476 _results1 = []; 1477 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { 1478 y = _ref1[_j]; 1479 if (this.options.behaveLikeLine) { 1480 _results1.push(this.transY(y)); 1481 } else { 1482 total += y || 0; 1483 _results1.push(this.transY(total)); 1484 } 1485 } 1486 return _results1; 1487 }).call(this); 1488 _results.push(row._ymax = Math.max.apply(Math, row._y)); 1489 } 1490 return _results; 1491 }; 1492 1493 Area.prototype.drawSeries = function() { 1494 var i, range, _i, _j, _k, _len, _ref, _ref1, _results, _results1, _results2; 1495 this.seriesPoints = []; 1496 if (this.options.behaveLikeLine) { 1497 range = (function() { 1498 _results = []; 1499 for (var _i = 0, _ref = this.options.ykeys.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; 0 <= _ref ? _i++ : _i--){ _results.push(_i); } 1500 return _results; 1501 }).apply(this); 1502 } else { 1503 range = (function() { 1504 _results1 = []; 1505 for (var _j = _ref1 = this.options.ykeys.length - 1; _ref1 <= 0 ? _j <= 0 : _j >= 0; _ref1 <= 0 ? _j++ : _j--){ _results1.push(_j); } 1506 return _results1; 1507 }).apply(this); 1508 } 1509 _results2 = []; 1510 for (_k = 0, _len = range.length; _k < _len; _k++) { 1511 i = range[_k]; 1512 this._drawFillFor(i); 1513 this._drawLineFor(i); 1514 _results2.push(this._drawPointFor(i)); 1515 } 1516 return _results2; 1517 }; 1518 1519 Area.prototype._drawFillFor = function(index) { 1520 var path; 1521 path = this.paths[index]; 1522 if (path !== null) { 1523 path = path + ("L" + (this.transX(this.xmax)) + "," + this.bottom + "L" + (this.transX(this.xmin)) + "," + this.bottom + "Z"); 1524 return this.drawFilledPath(path, this.fillForSeries(index)); 1525 } 1526 }; 1527 1528 Area.prototype.fillForSeries = function(i) { 1529 var color; 1530 color = Raphael.rgb2hsl(this.colorFor(this.data[i], i, 'line')); 1531 return Raphael.hsl(color.h, this.options.behaveLikeLine ? color.s * 0.9 : color.s * 0.75, Math.min(0.98, this.options.behaveLikeLine ? color.l * 1.2 : color.l * 1.25)); 1532 }; 1533 1534 Area.prototype.drawFilledPath = function(path, fill) { 1535 return this.raphael.path(path).attr('fill', fill).attr('fill-opacity', this.options.fillOpacity).attr('stroke', 'none'); 1536 }; 1537 1538 return Area; 1539 1540 })(Morris.Line); 1541 1542 Morris.Bar = (function(_super) { 1543 __extends(Bar, _super); 1544 1545 function Bar(options) { 1546 this.onHoverOut = __bind(this.onHoverOut, this); 1547 this.onHoverMove = __bind(this.onHoverMove, this); 1548 this.onGridClick = __bind(this.onGridClick, this); 1549 if (!(this instanceof Morris.Bar)) { 1550 return new Morris.Bar(options); 1551 } 1552 Bar.__super__.constructor.call(this, $.extend({}, options, { 1553 parseTime: false 1554 })); 1555 } 1556 1557 Bar.prototype.init = function() { 1558 this.cumulative = this.options.stacked; 1559 if (this.options.hideHover !== 'always') { 1560 this.hover = new Morris.Hover({ 1561 parent: this.el 1562 }); 1563 this.on('hovermove', this.onHoverMove); 1564 this.on('hoverout', this.onHoverOut); 1565 return this.on('gridclick', this.onGridClick); 1566 } 1567 }; 1568 1569 Bar.prototype.defaults = { 1570 barSizeRatio: 0.75, 1571 barGap: 3, 1572 barColors: ['#0b62a4', '#7a92a3', '#4da74d', '#afd8f8', '#edc240', '#cb4b4b', '#9440ed'], 1573 barOpacity: 1.0, 1574 barRadius: [0, 0, 0, 0], 1575 xLabelMargin: 50, 1576 horizontal: false, 1577 shown: true 1578 }; 1579 1580 Bar.prototype.calc = function() { 1581 var _ref; 1582 this.calcBars(); 1583 if (this.options.hideHover === false) { 1584 return (_ref = this.hover).update.apply(_ref, this.hoverContentForRow(this.data.length - 1)); 1585 } 1586 }; 1587 1588 Bar.prototype.calcBars = function() { 1589 var idx, row, y, _i, _len, _ref, _results; 1590 _ref = this.data; 1591 _results = []; 1592 for (idx = _i = 0, _len = _ref.length; _i < _len; idx = ++_i) { 1593 row = _ref[idx]; 1594 row._x = this.xStart + this.xSize * (idx + 0.5) / this.data.length; 1595 _results.push(row._y = (function() { 1596 var _j, _len1, _ref1, _results1; 1597 _ref1 = row.y; 1598 _results1 = []; 1599 for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { 1600 y = _ref1[_j]; 1601 if (y != null) { 1602 _results1.push(this.transY(y)); 1603 } else { 1604 _results1.push(null); 1605 } 1606 } 1607 return _results1; 1608 }).call(this)); 1609 } 1610 return _results; 1611 }; 1612 1613 Bar.prototype.draw = function() { 1614 var _ref; 1615 if ((_ref = this.options.axes) === true || _ref === 'both' || _ref === 'x') { 1616 this.drawXAxis(); 1617 } 1618 return this.drawSeries(); 1619 }; 1620 1621 Bar.prototype.drawXAxis = function() { 1622 var angle, basePos, i, label, labelBox, margin, maxSize, offset, prevAngleMargin, prevLabelMargin, row, size, startPos, textBox, _i, _ref, _results; 1623 if (!this.options.horizontal) { 1624 basePos = this.getXAxisLabelY(); 1625 } else { 1626 basePos = this.getYAxisLabelX(); 1627 } 1628 prevLabelMargin = null; 1629 prevAngleMargin = null; 1630 _results = []; 1631 for (i = _i = 0, _ref = this.data.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { 1632 row = this.data[this.data.length - 1 - i]; 1633 if (!this.options.horizontal) { 1634 label = this.drawXAxisLabel(row._x, basePos, row.label); 1635 } else { 1636 label = this.drawYAxisLabel(basePos, row._x - 0.5 * this.options.gridTextSize, row.label); 1637 } 1638 if (!this.options.horizontal) { 1639 angle = this.options.xLabelAngle; 1640 } else { 1641 angle = 0; 1642 } 1643 textBox = label.getBBox(); 1644 label.transform("r" + (-angle)); 1645 labelBox = label.getBBox(); 1646 label.transform("t0," + (labelBox.height / 2) + "..."); 1647 if (angle !== 0) { 1648 offset = -0.5 * textBox.width * Math.cos(angle * Math.PI / 180.0); 1649 label.transform("t" + offset + ",0..."); 1650 } 1651 if (!this.options.horizontal) { 1652 startPos = labelBox.x; 1653 size = labelBox.width; 1654 maxSize = this.el.width(); 1655 } else { 1656 startPos = labelBox.y; 1657 size = labelBox.height; 1658 maxSize = this.el.height(); 1659 } 1660 if (((prevLabelMargin == null) || prevLabelMargin >= startPos + size || (prevAngleMargin != null) && prevAngleMargin >= startPos) && startPos >= 0 && (startPos + size) < maxSize) { 1661 if (angle !== 0) { 1662 margin = 1.25 * this.options.gridTextSize / Math.sin(angle * Math.PI / 180.0); 1663 prevAngleMargin = startPos - margin; 1664 } 1665 if (!this.options.horizontal) { 1666 _results.push(prevLabelMargin = startPos - this.options.xLabelMargin); 1667 } else { 1668 _results.push(prevLabelMargin = startPos); 1669 } 1670 } else { 1671 _results.push(label.remove()); 1672 } 1673 } 1674 return _results; 1675 }; 1676 1677 Bar.prototype.getXAxisLabelY = function() { 1678 return this.bottom + (this.options.xAxisLabelTopPadding || this.options.padding / 2); 1679 }; 1680 1681 Bar.prototype.drawSeries = function() { 1682 var barWidth, bottom, groupWidth, i, idx, lastTop, left, leftPadding, numBars, row, sidx, size, space
1682Left, top, ypos, zeroPos, _i, _ref; 1683 groupWidth = this.xSize / this.options.data.length; 1684 if (this.options.stacked) { 1685 numBars = 1; 1686 } else { 1687 numBars = 0; 1688 for (i = _i = 0, _ref = this.options.ykeys.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) { 1689 if (this.hasToShow(i)) { 1690 numBars += 1; 1691 } 1692 } 1693 } 1694 barWidth = (groupWidth * this.options.barSizeRatio - this.options.barGap * (numBars - 1)) / numBars; 1695 if (this.options.barSize) { 1696 barWidth = Math.min(barWidth, this.options.barSize); 1697 } 1698 spaceLeft = groupWidth - barWidth * numBars - this.options.barGap * (numBars - 1); 1699 leftPadding = spaceLeft / 2; 1700 zeroPos = this.ymin <= 0 && this.ymax >= 0 ? this.transY(0) : null; 1701 return this.bars = (function() { 1702 var _j, _len, _ref1, _results; 1703 _ref1 = this.data; 1704 _results = []; 1705 for (idx = _j = 0, _len = _ref1.length; _j < _len; idx = ++_j) { 1706 row = _ref1[idx]; 1707 lastTop = 0; 1708 _results.push((function() { 1709 var _k, _len1, _ref2, _results1; 1710 _ref2 = row._y; 1711 _results1 = []; 1712 for (sidx = _k = 0, _len1 = _ref2.length; _k < _len1; sidx = ++_k) { 1713 ypos = _ref2[sidx]; 1714 if (!this.hasToShow(sidx)) { 1715 continue; 1716 } 1717 if (ypos !== null) { 1718 if (zeroPos) { 1719 top = Math.min(ypos, zeroPos); 1720 bottom = Math.max(ypos, zeroPos); 1721 } else { 1722 top = ypos; 1723 bottom = this.bottom; 1724 } 1725 left = this.xStart + idx * groupWidth + leftPadding; 1726 if (!this.options.stacked) { 1727 left += sidx * (barWidth + this.options.barGap); 1728 } 1729 size = bottom - top; 1730 if (this.options.verticalGridCondition && this.options.verticalGridCondition(row.x)) { 1731 if (!this.options.horizontal) { 1732 this.drawBar(this.xStart + idx * groupWidth, this.yEnd, groupWidth, this.ySize, this.options.verticalGridColor, this.options.verticalGridOpacity, this.options.barRadius); 1733 } else { 1734 this.drawBar(this.yStart, this.xStart + idx * groupWidth, this.ySize, groupWidth, this.options.verticalGridColor, this.options.verticalGridOpacity, this.options.barRadius); 1735 } 1736 } 1737 if (this.options.stacked) { 1738 top -= lastTop; 1739 } 1740 if (!this.options.horizontal) { 1741 this.drawBar(left, top, barWidth, size, this.colorFor(row, sidx, 'bar'), this.options.barOpacity, this.options.barRadius); 1742 _results1.push(lastTop += size); 1743 } else { 1744 this.drawBar(top, left, size, barWidth, this.colorFor(row, sidx, 'bar'), this.options.barOpacity, this.options.barRadius); 1745 _results1.push(lastTop -= size); 1746 } 1747 } else { 1748 _results1.push(null); 1749 } 1750 } 1751 return _results1; 1752 }).call(this)); 1753 } 1754 return _results; 1755 }).call(this); 1756 }; 1757 1758 Bar.prototype.colorFor = function(row, sidx, type) { 1759 var r, s; 1760 if (typeof this.options.barColors === 'function') { 1761 r = { 1762 x: row.x, 1763 y: row.y[sidx], 1764 label: row.label 1765 }; 1766 s = { 1767 index: sidx, 1768 key: this.options.ykeys[sidx], 1769 label: this.options.labels[sidx] 1770 }; 1771 return this.options.barColors.call(this, r, s, type); 1772 } else { 1773 return this.options.barColors[sidx % this.options.barColors.length]; 1774 } 1775 }; 1776 1777 Bar.prototype.hitTest = function(x, y) { 1778 var pos; 1779 if (this.data.length === 0) { 1780 return null; 1781 } 1782 if (!this.options.horizontal) { 1783 pos = x; 1784 } else { 1785 pos = y; 1786 } 1787 pos = Math.max(Math.min(pos, this.xEnd), this.xStart); 1788 return Math.min(this.data.length - 1, Math.floor((pos - this.xStart) / (this.xSize / this.data.length))); 1789 }; 1790 1791 Bar.prototype.onGridClick = function(x, y) { 1792 var index; 1793 index = this.hitTest(x, y); 1794 return this.fire('click', index, this.data[index].src, x, y); 1795 }; 1796 1797 Bar.prototype.onHoverMove = function(x, y) { 1798 var index, _ref; 1799 index = this.hitTest(x, y); 1800 return (_ref = this.hover).update.apply(_ref, this.hoverContentForRow(index)); 1801 }; 1802 1803 Bar.prototype.onHoverOut = function() { 1804 if (this.options.hideHover !== false) { 1805 return this.hover.hide(); 1806 } 1807 }; 1808 1809 Bar.prototype.hoverContentForRow = function(index) { 1810 var content, j, row, x, y, _i, _len, _ref; 1811 row = this.data[index]; 1812 content = $("<div class='morris-hover-row-label'>").text(row.label); 1813 content = content.prop('outerHTML'); 1814 _ref = row.y; 1815 for (j = _i = 0, _len = _ref.length; _i < _len; j = ++_i) { 1816 y = _ref[j]; 1817 if (this.options.labels[j] === false) { 1818 continue; 1819 } 1820 content += "<div class='morris-hover-point' style='color: " + (this.colorFor(row, j, 'label')) + "'>\n " + this.options.labels[j] + ":\n " + (this.yLabelFormat(y, j)) + "\n</div>"; 1821 } 1822 if (typeof this.options.hoverCallback === 'function') { 1823 content = this.options.hoverCallback(index, this.options, content, row.src
1823); 1824 } 1825 if (!this.options.horizontal) { 1826 x = this.left + (index + 0.5) * this.width / this.data.length; 1827 return [content, x]; 1828 } else { 1829 x = this.left + 0.5 * this.width; 1830 y = this.top + (index + 0.5) * this.height / this.data.length; 1831 return [content, x, y, true]; 1832 } 1833 }; 1834 1835 Bar.prototype.drawXAxisLabel = function(xPos, yPos, text) { 1836 var label; 1837 return label = this.raphael.text(xPos, yPos, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).attr('fill', this.options.gridTextColor); 1838 }; 1839 1840 Bar.prototype.drawBar = function(xPos, yPos, width, height, barColor, opacity, radiusArray) { 1841 var maxRadius, path; 1842 maxRadius = Math.max.apply(Math, radiusArray); 1843 if (maxRadius === 0 || maxRadius > height) { 1844 path = this.raphael.rect(xPos, yPos, width, height); 1845 } else { 1846 path = this.raphael.path(this.roundedRect(xPos, yPos, width, height, radiusArray)); 1847 } 1848 return path.attr('fill', barColor).attr('fill-opacity', opacity).attr('stroke', 'none'); 1849 }; 1850 1851 Bar.prototype.roundedRect = function(x, y, w, h, r) { 1852 if (r == null) { 1853 r = [0, 0, 0, 0]; 1854 } 1855 return ["M", x, r[0] + y, "Q", x, y, x + r[0], y, "L", x + w - r[1], y, "Q", x + w, y, x + w, y + r[1], "L", x + w, y + h - r[2], "Q", x + w, y + h, x + w - r[2], y + h, "L", x + r[3], y + h, "Q", x, y + h, x, y + h - r[3], "Z"]; 1856 }; 1857 1858 return Bar; 1859 1860 })(Morris.Grid); 1861 1862 Morris.Donut = (function(_super) { 1863 __extends(Donut, _super); 1864 1865 Donut.prototype.defaults = { 1866 colors: ['#0B62A4', '#3980B5', '#679DC6', '#95BBD7', '#B0CCE1', '#095791', '#095085', '#083E67', '#052C48', '#042135'], 1867 backgroundColor: '#FFFFFF', 1868 labelColor: '#000000', 1869 formatter: Morris.commas, 1870 resize: false 1871 }; 1872 1873 function Donut(options) { 1874 this.resizeHandler = __bind(this.resizeHandler, this); 1875 this.select = __bind(this.select, this); 1876 this.click = __bind(this.click, this); 1877 var _this = this; 1878 if (!(this instanceof Morris.Donut)) { 1879 return new Morris.Donut(options); 1880 } 1881 this.options = $.extend({}, this.defaults, options); 1882 if (typeof options.element === 'string') { 1883 this.el = $(document.getElementById(options.element)); 1884 } else { 1885 this.el = $(options.element); 1886 } 1887 if (this.el === null || this.el.length === 0) { 1888 throw new Error("Graph placeholder not found."); 1889 } 1890 if (options.data === void 0 || options.data.length === 0) { 1891 return; 1892 } 1893 this.raphael = new Raphael(this.el[0]); 1894 if (this.options.resize) { 1895 $(window).bind('resize', function(evt) { 1896 if (_this.timeoutId != null) { 1897 window.clearTimeout(_this.timeoutId); 1898 } 1899 return _this.timeoutId = window.setTimeout(_this.resizeHandler, 100); 1900 }); 1901 } 1902 this.setData(options.data); 1903 } 1904 1905 Donut.prototype.redraw = function() { 1906 var C, cx, cy, i, idx, last, max_value, min, next, seg, total, value, w, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results; 1907 this.raphael.clear(); 1908 cx = this.el.width() / 2; 1909 cy = this.el.height() / 2; 1910 w = (Math.min(cx, cy) - 10) / 3; 1911 total = 0; 1912 _ref = this.values; 1913 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1914 value = _ref[_i]; 1915 total += value; 1916 } 1917 min = 5 / (2 * w); 1918 C = 1.9999 * Math.PI - min * this.data.length; 1919 last = 0; 1920 idx = 0; 1921 this.segments = []; 1922 _ref1 = this.values; 1923 for (i = _j = 0, _len1 = _ref1.length; _j < _len1; i = ++_j) { 1924 value = _ref1[i]; 1925 next = last + min + C * (value / total); 1926 seg = new Morris.DonutSegment(cx, cy, w * 2, w, last, next, this.data[i].color || this.options.colors[idx % this.options.colors.length], this.options.backgroundColor, idx, this.raphael); 1927 seg.render(); 1928 this.segments.push(seg); 1929 seg.on('hover', this.select); 1930 seg.on('click', this.click); 1931 last = next; 1932 idx += 1; 1933 } 1934 this.text1 = this.drawEmptyDonutLabel(cx, cy - 10, this.options.labelColor, 15, 800); 1935 this.text2 = this.drawEmptyDonutLabel(cx, cy + 10, this.options.labelColor, 14); 1936 max_value = Math.max.apply(Math, this.values); 1937 idx = 0; 1938 _ref2 = this.values; 1939 _results = []; 1940 for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { 1941 value = _ref2[_k]; 1942 if (value === max_value) { 1943 this.select(idx); 1944 break; 1945 } 1946 _results.push(idx += 1); 1947 } 1948 return _results; 1949 }; 1950 1951 Donut.prototype.setData = function(data) { 1952 var row; 1953 this.data = data; 1954 this.values = (function() { 1955 var _i, _len, _ref, _results; 1956 _ref = this.data; 1957 _results = []; 1958 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1959 row = _ref[_i]; 1960 _results.push(parseFloat(row.value)); 1961 } 1962 return _results; 1963 }).call(this); 1964 return this.redraw(); 1965 }; 1966 1967 Donut.prototype.click = function(idx) { 1968 return this.fire('click', idx, this.data[idx]); 1969 }; 1970 1971 Donut.prototype.select = function(idx) { 1972 var row, s, segment, _i, _len, _ref; 1973 _ref = this.segments; 1974 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1975 s = _ref[_i]; 1976 s.deselect(); 1977 } 1978 segment = this.segments[idx]; 1979 segment.select(); 1980 row = this.data[idx]; 1981 return this.setLabels(row.label, this.options.formatter(row.value, row)); 1982 }; 1983 1984 Donut.prototype.setLabels = function(label1, label2) { 1985 var inner, maxHeightBottom, maxHeightTop, maxWidth, text1bbox, text1scale, text2bbox, text2scale; 1986 inner = (Math.min(this.el.width() / 2, this.el.height() / 2) - 10) * 2 / 3; 1987 maxWidth = 1.8 * inner; 1988 maxHeightTop = inner / 2; 1989 maxHeightBottom = inner / 3; 1990 this.text1.attr({ 1991 text: label1, 1992 transform: '' 1993 }); 1994 text1bbox = this.text1.getBBox(); 1995 text1scale = Math.min(maxWidth / text1bbox.width, maxHeightTop / text1bbox.height); 1996 this.text1.attr({ 1997 transform: "S" + text1scale + "," + text1scale + "," + (text1bbox.x + text1bbox.width / 2) + "," + (text1bbox.y + text1bbox.height) 1998 }); 1999 this.text2.attr({ 2000 text: label2, 2001 transform: '' 2002 }); 2003 text2bbox = this.text2.getBBox(); 2004 text2scale = Math.min(maxWidth / text2bbox.width, maxHeightBottom / text2bbox.height); 2005 return this.text2.attr({ 2006 transform: "S" + text2scale + "," + text2scale + "," + (text2bbox.x + text2bbox.width / 2) + "," + text2bbox.y 2007 }); 2008 }; 2009 2010 Donut.prototype.drawEmptyDonutLabel = function(xPos, yPos, color, fontSize, fontWeight) { 2011 var text; 2012 text = this.raphael.text(xPos, yPos, '').attr('font-size', fontSize).attr('fill', color); 2013 if (fontWeight != null) { 2014 text.attr('font-weight', fontWeight); 2015 } 2016 return text; 2017 }; 2018 2019 Donut.prototype.resizeHandler = function() { 2020 this.timeoutId = null; 2021 this.raphael.setSize(this.el.width(), this.el.height()); 2022 return this.redraw(); 2023 }; 2024 2025 return Donut; 2026 2027 })(Morris.EventEmitter); 2028 2029 Morris.DonutSegment = (function(_super) { 2030 __extends(DonutSegment, _super); 2031 2032 function DonutSegment(cx, cy, inner, outer, p0, p1, color, backgroundColor, index, raphael) { 2033 this.cx = cx; 2034 this.cy = cy; 2035 this.inner = inner; 2036 this.outer = outer; 2037 this.color = color; 2038 this.backgroundColor = backgroundColor; 2039 this.index = index; 2040 this.raphael = raphael; 2041 this.deselect = __bind(this.deselect, this); 2042 this.select = __bind(this.select, this); 2043 this.sin_p0 = Math.sin(p0); 2044 this.cos_p0 = Math.cos(p0); 2045 this.sin_p1 = Math.sin(p1); 2046 this.cos_p1 = Math.cos(p1); 2047 this.is_long = (p1 - p0) > Math.PI ? 1 : 0; 2048 this.path = this.calcSegment(this.inner + 3, this.inner + this.outer - 5); 2049 this.selectedPath = this.calcSegment(this.inner + 3, this.inner + this.outer); 2050 this.hilight = this.calcArc(this.inner); 2051 } 2052 2053 DonutSegment.prototype.calcArcPoints = function(r) { 2054 return [this.cx + r * this.sin_p0, this.cy + r * this.cos_p0, this.cx + r * this.sin_p1, this.cy + r * this.cos_p1]; 2055 }; 2056 2057 DonutSegment.prototype.calcSegment = function(r1, r2) { 2058 var ix0, ix1, iy0, iy1, ox0, ox1, oy0, oy1, _ref, _ref1; 2059 _ref = this.calcArcPoints(r1), ix0 = _ref[0], iy0 = _ref[1], ix1
2059= _ref[2], iy1 = _ref[3]; 2060 _ref1 = this.calcArcPoints(r2), ox0 = _ref1[0], oy0 = _ref1[1], ox1 = _ref1[2], oy1 = _ref1[3]; 2061 return ("M" + ix0 + "," + iy0) + ("A" + r1 + "," + r1 + ",0," + this.is_long + ",0," + ix1 + "," + iy1) + ("L" + ox1 + "," + oy1) + ("A" + r2 + "," + r2 + ",0," + this.is_long + ",1," + ox0 + "," + oy0) + "Z"; 2062 }; 2063 2064 DonutSegment.prototype.calcArc = function(r) { 2065 var ix0, ix1, iy0, iy1, _ref; 2066 _ref = this.calcArcPoints(r), ix0 = _ref[0], iy0 = _ref[1], ix1 = _ref[2], iy1 = _ref[3]; 2067 return ("M" + ix0 + "," + iy0) + ("A" + r + "," + r + ",0," + this.is_long + ",0," + ix1 + "," + iy1); 2068 }; 2069 2070 DonutSegment.prototype.render = function() { 2071 var _this = this; 2072 this.arc = this.drawDonutArc(this.hilight, this.color); 2073 return this.seg = this.drawDonutSegment(this.path, this.color, this.backgroundColor, function() { 2074 return _this.fire('hover', _this.index); 2075 }, function() { 2076 return _this.fire('click', _this.index); 2077 }); 2078 }; 2079 2080 DonutSegment.prototype.drawDonutArc = function(path, color) { 2081 return this.raphael.path(path).attr({ 2082 stroke: color, 2083 'stroke-width': 2, 2084 opacity: 0 2085 }); 2086 }; 2087 2088 DonutSegment.prototype.drawDonutSegment = function(path, fillColor, strokeColor, hoverFunction, clickFunction) { 2089 return this.raphael.path(path).attr({ 2090 fill: fillColor, 2091 stroke: strokeColor, 2092 'stroke-width': 3 2093 }).hover(hoverFunction).click(clickFunction); 2094 }; 2095 2096 DonutSegment.prototype.select = function() { 2097 if (!this.selected) { 2098 this.seg.animate({ 2099 path: this.selectedPath 2100 }, 150, '<>'); 2101 this.arc.animate({ 2102 opacity: 1 2103 }, 150, '<>'); 2104 return this.selected = true; 2105 } 2106 }; 2107 2108 DonutSegment.prototype.deselect = function() { 2109 if (this.selected) { 2110 this.seg.animate({ 2111 path: this.path 2112 }, 150, '<>'); 2113 this.arc.animate({ 2114 opacity: 0 2115 }, 150, '<>'); 2116 return this.selected = false; 2117 } 2118 }; 2119 2120 return DonutSegment; 2121 2122 })(Morris.EventEmitter); 2123 2124}).call(this); 2125; 2126jQuery(window).on('load', function() { 2127 if (jQuery('div[id="tags-by-cat"]').length > 1) { 2128 jQuery('.featuresDataContainerOuterSubmit').first().remove(); 2129 } 2130 // if (!jQuery('#lp-submit-form').hasClass("lpeditlistingform")) { 2131 if (jQuery('#inputCategory').val()) { 2132 $haveFeature = jQuery('#inputCategory').find(':selected').data('doajax'); 2133 if ($haveFeature) { 2134 $catid = jQuery('#inputCategory').val(); 2135 $listingid = ''; 2136 if (jQuery("input[name='lp_post']").length) { 2137 $listingid = jQuery("input[name='lp_post']").val(); 2138 } 2139 jQuery('.lp-nested').hide(); 2140 jQuery('#inputCategory').attr("disabled", !0); 2141 jQuery('#tags-by-cat').html(' '); 2142 jQuery('label.featuresBycat').remove(); 2143 jQuery('form#lp-submit-form div.pre-load:first').addClass('loader'); 2144 jQuery('#features-by-cat').html(' '); 2145 jQuery(".chosen-select").prop('disabled', !0).trigger('chosen:updated'); 2146 2147 jQuery.ajax({ 2148 type: 'POST', 2149 dataType: 'json', 2150 url: ajax_term_object.ajaxurl, 2151 data: { 2152 'action': 'ajax_term', 2153 'term_id': $catid, 2154 'listing_id': $listingid, 2155 }, 2156 success: function(data) { 2157 jQuery('#inputCategory').removeAttr("disabled"); 2158 if (data) { 2159 if (data.hasfeatues == !0) { 2160 2161 jQuery('.featuresDataContainerOuterSubmit').show(); 2162 jQuery('.labelforfeatures.lp-nested').show(); 2163 jQuery('#tags-by-cat').show() 2164 } 2165 if (data.hasfields == !0) { 2166 jQuery('#features-by-cat').show() 2167 } 2168 jQuery('form#lp-submit-form div.pre-load').removeClass('loader'); 2169 jQuery(".chosen-select").prop('disabled', !1).trigger('chosen:updated'); 2170 if (data.tags != null) { 2171 jQuery('.lpfeatures_fields').prepend('<label for="inputTags" class="featuresBycat">' + data.featuretitle + '</label>'); 2172 jQuery.each(data.tags, function(i, v) { 2173 var lpchecked = ''; 2174 if (data.lpselectedtags != null) { 2175 jQuery.each(data.lpselectedtags, function(lk, ls) { 2176 if (i.trim() === lk) { 2177 lpchecked = 'checked' 2178 } 2179 }); 2180 } 2181 jQuery('#tags-by-cat').append('<div class="col-md-2 col-sm-4 col-xs-6"><div class="checkbox pad-bottom-10"><input id="check_' + v + '" type="checkbox" name="lp_form_fields_inn[lp_feature][]" value="' + i + '" ' + lpchecked + '><label for="check_' + v + '">' + v + '</label></div></div>') 2182 }) 2183 }
2184 if (jQuery('#lp-form-builder-is-enabled').length) { 2185 var catsVal = jQuery('form#lp-submit-form #inputCategory').val(); 2186 if (typeof catsVal === 'object') { 2187 jQuery.each(catsVal, function(k, v) { 2188 var targetFieldsClass = '.lp-form-builder-field-' + v; 2189 jQuery('.lp-form-builder-field').fadeOut(500, function() { 2190 if (jQuery(targetFieldsClass).length) { 2191 jQuery(targetFieldsClass).fadeIn(); 2192 } 2193 }); 2194 }) 2195 } else { 2196 var targetFieldsClass = '.lp-form-builder-field-' + jQuery('form#lp-submit-form #inputCategory').val(); 2197 jQuery('.lp-form-builder-field').fadeOut(500, function() { 2198 if (jQuery(targetFieldsClass).length) { 2199 jQuery(targetFieldsClass).fadeIn(); 2200 } 2201 }); 2202 } 2203 } else { 2204 jQuery('#features-by-cat').append(data.fields); 2205 } 2206 } 2207 } 2208 }); 2209 } else { 2210 jQuery('.lpfeatures_fields').hide(); 2211 if (jQuery('.featuresDataContainerOuterSubmit').data('exclusive') == 'no') { 2212 jQuery('.featuresDataContainerOuterSubmit').hide(); 2213 } else if (jQuery('.featuresDataContainerOuterSubmit').data('exclusive') == 'yes') { 2214 jQuery('.featuresDataContainerOuterSubmit').fadeIn(); 2215 } 2216 if (jQuery('#lp-form-builder-is-enabled').length) { 2217 jQuery('.featuresDataContainerOuterSubmit').hide(); 2218 jQuery('.lp-form-builder-field').fadeOut(); 2219 } 2220 } 2221 2222 } 2223 // } 2224}); 2225 2226jQuery(document).ready(function($) { 2227 jQuery("#inputCategory").change(function() { 2228 2229 $this = jQuery(this); 2230 // jQuery('.featuresDataContainerOuterSubmit').hide(); 2231 2232 if (jQuery('.lpfeatures_fields').is(':empty') && jQuery('#tags-by-cat').is(':empty') && jQuery('#features-by-cat').is(':empty')) { jQuery('.lpfeatures_fields').parents('.white-section').first().hide(); } 2233 2234 jQuery('#tags-by-cat, #features-by-cat').hide(); 2235 2236 if ($this.find(':selected').length > 1) { 2237 jQuery($this.find(':selected')).each(function() { 2238 if (jQuery(this).data('doajax') != '' || jQuery(this).data('doajax') != false) { 2239 $haveFeature = jQuery(this).data('doajax'); 2240 } 2241 }); 2242 } else { 2243 $haveFeature = $this.find(':selected').data('doajax'); 2244 } 2245 2246 if ($haveFeature) { 2247 jQuery('.lpfeatures_fields').show(); 2248 var lpchecked = ''; 2249 jQuery('.featuresDataContainerOuterSubmit').show(); 2250 jQuery('.lp-nested').hide(); 2251 jQuery('#inputCategory').attr("disabled", !0); 2252 jQuery('#tags-by-cat').html(' '); 2253 jQuery('label.featuresBycat').remove(); 2254 jQuery('form#lp-submit-form div.pre-load:first').addClass('loader'); 2255 jQuery('#features-by-cat').html(' '); 2256 jQuery(".chosen-select").prop('disabled', !0).trigger('chosen:updated'); 2257 var $catTerms = []; 2258 var $cTerms = jQuery('form#lp-submit-form #inputCategory').val(); 2259 $catTerms.push($cTerms); 2260 if (document.getElementById("pre-selected-cat") !== null) { 2261 var $preSelected = jQuery('#pre-selected-cat').val(); 2262 $catTerms.push($preSelected) 2263 } 2264 2265 jQuery.ajax({ 2266 type: 'POST', 2267 dataType: 'json', 2268 url: ajax_term_object.ajaxurl, 2269 data: { 2270 'action': 'ajax_term', 2271 'term_id': jQuery('form#lp-submit-form #inputCategory').val(), 2272 'listing_id': jQuery('input[name=lp_post]').val(), 2273 }, 2274 success: function(data) { 2275 jQuery('#inputCategory').removeAttr("disabled"); 2276 if (data) { 2277 if (data.hasfeatues == !0) { 2278 jQuery('.labelforfeatures.lp-nested').show(); 2279 jQuery('#tags-by-cat').show() 2280 } 2281 if (data.hasfields == !0) { 2282 jQuery('#features-by-cat').show() 2283 } 2284 $('form#lp-submit-form div.pre-load').removeClass('loader'); 2285 jQuery(".chosen-select").prop('disabled', !1).trigger('chosen:updated'); 2286 if (data.tags != null) { 2287 jQuery('.lpfeatures_fields').prepend('<label for="inputTags" class="featuresBycat">' + data.featuretitle + '</label>'); 2288 jQuery.each(data.tags, function(i, v) { 2289 var lpchecked = ''; 2290 if (data.lpselectedtags != null) { 2291 jQuery.each(data.lpselectedtags, function(lk, ls) { 2292 if (i.trim() === lk) { 2293 lpchecked = 'checked' 2294 } 2295 }); 2296 } 2297 jQuery('#tags-by-cat').append('<div class="col-md-2 col-sm-4 col-xs-6"><div class="checkbox pad-bottom-10"><input id="check_' + v + '" type="checkbox" name="lp_form_fields_inn[lp_feature][]" value="' + i + '" ' + lpchecked + '><label for="check_' + v + '">' + v + '</label></div></div>') 2298 }) 2299 }
2300 if (jQuery('#lp-form-builder-is-enabled').length) { 2301 var catsVal = jQuery('form#lp-submit-form #inputCategory').val(); 2302 if (typeof catsVal === 'object') { 2303 jQuery.each(catsVal, function(k, v) { 2304 var targetFieldsClass = '.lp-form-builder-field-' + v; 2305 jQuery('.lp-form-builder-field').fadeOut(500, function() { 2306 if (jQuery(targetFieldsClass).length) { 2307 jQuery(targetFieldsClass).fadeIn(); 2308 } 2309 }); 2310 }) 2311 } else { 2312 var targetFieldsClass = '.lp-form-builder-field-' + jQuery('form#lp-submit-form #inputCategory').val(); 2313 jQuery('.lp-form-builder-field').fadeOut(500, function() { 2314 if (jQuery(targetFieldsClass).length) { 2315 jQuery(targetFieldsClass).fadeIn(); 2316 } 2317 }); 2318 } 2319 } else { 2320 jQuery('#features-by-cat').append(data.fields); 2321 } 2322 } 2323 } 2324 2325 }); 2326 } else { 2327 jQuery('.lpfeatures_fields').hide(); 2328 if (jQuery('.featuresDataContainerOuterSubmit').data('exclusive') == 'no') { 2329 jQuery('.featuresDataContainerOuterSubmit').hide(); 2330 } else if (jQuery('.featuresDataContainerOuterSubmit').data('exclusive') == 'yes') { 2331 jQuery('.featuresDataContainerOuterSubmit').fadeIn(); 2332 } 2333 if (jQuery('#lp-form-builder-is-enabled').length) { 2334 jQuery('.featuresDataContainerOuterSubmit').hide(); 2335 jQuery('.lp-form-builder-field').fadeOut(); 2336 } 2337 } 2338 }); 2339 jQuery(".lp-slected-plan-cat").on('click', function() { 2340 jQuery('.lp_show_hide_plans').removeClass('active'); 2341 jQuery('.lp_show_hide_plans').removeClass('isactive'); 2342 jQuery('.lp_plan_result_section').html(''); 2343 jQuery('.lp_hide_general_plans').html(''); 2344 jQuery('.lpmonthyearswitcher').hide(); 2345 $this = jQuery(this); 2346 $durationType = ''; 2347 if (jQuery(".lpmonthyearswitcher a.switch-fields").length) { 2348 if (jQuery('.lpmonthyearswitcher a.switch-fields').hasClass('active')) { 2349 $durationType = 'yearly'; 2350 } else { 2351 $durationType = 'monthly'; 2352 } 2353 } 2354 $currentStyle = jQuery('#select_style').data('style'); 2355 jQuery("body").addClass("listingpro-loading"); 2356 jQuery('#cats-selected-plans').html(''); 2357 jQuery.ajax({ 2358 type: 'POST', 2359 dataType: 'json', 2360 url: ajax_term_object.ajaxurl, 2361 data: { 2362 'action': 'listingpro_select_plan_by_cat', 2363 'term_id': $this.val(), 2364 'currentStyle': $currentStyle, 2365 'duration_type': $durationType, 2366 }, 2367 success: function(data) { 2368 jQuery("body").removeClass("listingpro-loading"); 2369 if (data.plans) { 2370 if (data.switcher) { 2371 if (data.switcher == "1") { 2372 jQuery('.lpmonthyearswitcher').show() 2373 } 2374 } 2375 //jQuery('.lp_plan_result_section').html(data.plans); 2376 jQuery('.lp_plan_result_section[data-style=' + $currentStyle + ']').html(data.plans); 2377 jQuery('.lp_plan_result_section').addClass('lp-plan-view-border'); 2378 var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />'; 2379 jQuery($hiddenField).appendTo(".price-plan-button") 2380 } 2381 } 2382 }) 2383 }); 2384 jQuery(".lp_show_hide_by_duration").on('click', function() { 2385 $this = jQuery(this); 2386 $durationType = $this.data('durationtype'); 2387 $catID = jQuery('.lp-slected-plan-cat:checked').val(); 2388 jQuery("body").addClass("listingpro-loading"); 2389 jQuery('#cats-selected-plans').html(''); 2390 jQuery.ajax({ 2391 type: 'POST', 2392 dataType: 'json', 2393 url: ajax_term_object.ajaxurl, 2394 data: { 2395 'action': 'filter_pricingplan', 2396 'term_id': $catID, 2397 'duration_type': $durationType, 2398 }, 2399 success: function(data) { 2400 jQuery("body").removeClass("listingpro-loading"); 2401 if (data.plans) { 2402 jQuery('#cats-selected-plans').html(data.plans); 2403 var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />'; 2404 jQuery($hiddenField).appendTo(".price-plan-button") 2405 } 2406 } 2407 }) 2408 }); 2409 jQuery('.lp_plans_switcher_btn').on('click', function() { 2410 $this = jQuery(this); 2411 jQuery('.lp_cats_on_plan_wrap').css({ 2412 "visibility": "hidden", 2413 "height": "0px", 2414 "padding-bottom": "0px" 2415 }); 2416 2417 //$currentVal = jQuery('.lpmonthyearswitcher span.active').html(); 2418 //$duration_type = 'monthly'; 2419 /* if ($currentVal == "Monthly") { 2420 $duration_type = 'monthly' 2421 } else if ($currentVal == "Annually") { 2422 $duration_type = 'yearly' 2423 } */ 2424 2425 $duration_type = ''; 2426 if (jQuery(".lpmonthyearswitcher a.switch-fields").length) { 2427 if (jQuery('.lpmonthyearswitcher a.switch-fields').hasClass('active')) { 2428 $duration_type = 'yearly'; 2429 } else { 2430 $duration_type = 'monthly'; 2431 } 2432 } 2433 2434 jQuery('.lp_plans_switcher_btn').removeClass('isactive'); 2435 jQuery('.lp_hide_general_plans').html(''); 2436 jQuery('.lp_hide_general_plans').removeClass('lp-plan-view-border'); 2437 jQuery('.lp_plan_result_section').html(''); 2438 $this.toggleClass('isactive'); 2439 if ($this.hasClass('isactive') && $this.data('val') == 'standard') { 2440 $currentStyle = jQuery('#select_style').data('style'); 2441 jQuery("body").addClass("listingpro-loading"); 2442 //jQuery('input.lp-slected-plan-cat').prop('checked', !1); 2443 jQuery('input.lp-slected-plan-cat').prop('checked', false); 2444 jQuery('label.active-category-radio').removeClass('active-category-radio'); 2445 jQuery.ajax({ 2446 type: 'POST', 2447 dataType: 'json', 2448 url: ajax_term_object.ajaxurl, 2449 data: { 2450 'action': 'listingpro_select_general_plans', 2451 'currentStyle': $currentStyle, 2452 'duration_type': $duration_type, 2453 }, 2454 success: function(data) { 2455 jQuery("body").removeClass("listingpro-loading"); 2456 if (data.plans) { 2457 jQuery('.lpmonthyearswitcher').show(); 2458 //jQuery('.lp_plan_result_section').html(data.plans); 2459 jQuery('.lp_plan_result_section[data-style=' + $currentStyle + ']').html(data.plans); 2460 jQuery('.lp_plan_result_section').addClass('lp-plan-view-border'); 2461 var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />'; 2462 jQuery($hiddenField).appendTo(".price-plan-button") 2463 } 2464 } 2465 }) 2466 } else { 2467 jQuery('.lp_cats_on_plan_wrap').css({ 2468 "visibility": "visible", 2469 "height": "auto", 2470 "padding-bottom": "40px" 2471 }); 2472 jQuery('.lp_plan_result_sectiolp_cats_on_plan_wrapn').html(''); 2473 jQuery('.lp_plan_result_section').removeClass('lp-plan-view-border'); 2474 jQuery('.lpmonthyearswitcher').hide() 2475 } 2476 }); 2477 jQuery('ul.switch_month_year li span').on('click', function() { 2478 jQuery("body").addClass("listingpro-loading"); 2479 $this = jQuery(this); 2480 jQuery('ul.switch_month_year li span').removeClass('active_switch'); 2481 $this.toggleClass('active_switch'); 2482 $currentVal = $this.html(); 2483 $duration_type = ''; 2484 $currentStyle = jQuery('#select_style').data('style'); 2485 if ($currentVal == "Monthly") { 2486 $duration_type = 'monthly' 2487 } else if ($currentVal == "Annually") { 2488 $duration_type = 'yearly' 2489 } 2490 $catID = ''; 2491 $planUsage = ''; 2492 if (jQuery('label').hasClass('active-category-radio')) { 2493 $catID = jQuery('label.active-category-radio').find('input').val() 2494 } else { 2495 $planUsage = 'default' 2496 } 2497 jQuery('.lp_hide_general_plans').html(''); 2498 jQuery('.lp_plan_result_section').html(''); 2499 jQuery.ajax({ 2500 type: 'POST', 2501 dataType: 'json', 2502 url: ajax_term_object.ajaxurl, 2503 data: { 2504 'action': 'filter_pricingplan', 2505 'cat_id': $catID, 2506 'duration_type': $duration_type, 2507 'currentStyle': $currentStyle, 2508 'planUsage': $planUsage, 2509 }, 2510 success: function(data) { 2511 jQuery("body").removeClass("listingpro-loading"); 2512 if (data) { 2513 jQuery('.lp_plan_result_section:first').html(data.plans); 2514 var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />'; 2515 jQuery($hiddenField).appendTo(".price-plan-button"); 2516 } 2517 } 2518 }) 2519 }); 2520 jQuery('.lp_button_switcher span').on('click', function() { 2521 jQuery('.lp_hide_general_plans').removeClass('lp-plan-view-border'); 2522 jQuery('.lp_button_switcher span').removeClass('active'); 2523 jQuery(this).toggleClass('active'); 2524 jQuery("body").addClass("listingpro-loading"); 2525 $this = jQuery(this); 2526 $currentVal = $this.html(); 2527 $duration_type = ''; 2528 $currentStyle = jQuery('#select_style').data('style'); 2529 if ($currentVal == "Monthly") { 2530 $duration_type = 'monthly'; 2531 jQuery('.switch-fields').removeClass('active') 2532 } else if ($currentVal == "Annually") { 2533 $duration_type = 'yearly'; 2534 jQuery('.switch-fields').addClass('active') 2535 } 2536 $catID = ''; 2537 $planUsage = ''; 2538 if (jQuery('label').hasClass('active-category-radio')) { 2539 $catID = jQuery('label.active-category-radio').find('input').val() 2540 } else { 2541 $planUsage = 'default' 2542 } 2543 jQuery('.lp_hide_general_plans').html(''); 2544 jQuery('.lp_plan_result_section').html(''); 2545 jQuery.ajax({ 2546 type: 'POST', 2547 dataType: 'json', 2548 url: ajax_term_object.ajaxurl, 2549 data: { 2550 'action': 'filter_pricingplan', 2551 'cat_id': $catID, 2552 'duration_type': $duration_type, 2553 'currentStyle': $currentStyle, 2554 'planUsage': $planUsage, 2555 }, 2556 success: function(data) { 2557 jQuery("body").removeClass("listingpro-loading"); 2558 if (data) { 2559 jQuery('.lp_plan_result_section:first').html(data.plans); 2560 var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />'; 2561 jQuery($hiddenField).appendTo(".price-plan-button"); 2562 jQuery('.lp_plan_result_section').addClass('lp-plan-view-border') 2563 } 2564 } 2565 }) 2566 }); 2567 jQuery('.lp_button_switcher a').on('click', function() { 2568 jQuery('.lp_hide_general_plans').removeClass('lp-plan-view-border'); 2569 $duration_type = ''; 2570 $currentStyle = jQuery('#select_style').data('style'); 2571 if (jQuery(this).hasClass('active')) { 2572 jQuery('.lp-monthly-side').addClass('active'); 2573 jQuery('.lp-year-side').removeClass('active'); 2574 $duration_type = 'monthly' 2575 } else { 2576 $duration_type = 'yearly'; 2577 jQuery('.lp-year-side').addClass('active'); 2578 jQuery('.lp-monthly-side').removeClass('active') 2579 } 2580 jQuery("body").addClass("listingpro-loading"); 2581 $this = jQuery(this); 2582 $catID = ''; 2583 $planUsage = ''; 2584 if (jQuery('label').hasClass('active-category-radio')) { 2585 $catID = jQuery('label.active-category-radio').find('input').val() 2586 } else { 2587 $planUsage = 'listingonly' 2588 } 2589 jQuery('.lp_hide_general_plans').html(''); 2590 jQuery('.lp_plan_result_section').html(''); 2591 jQuery.ajax({ 2592 type: 'POST', 2593 dataType: 'json', 2594 url: ajax_term_object.ajaxurl, 2595 data: { 2596 'action': 'filter_pricingplan', 2597 'cat_id': $catID, 2598 'duration_type': $duration_type, 2599 'currentStyle': $currentStyle, 2600 'planUsage': $planUsage, 2601 }, 2602 success: function(data) { 2603 jQuery("body").removeClass("listingpro-loading"); 2604 if (data) { 2605 jQuery('.lp_plan_result_section:first').html(data.plans); 2606 var $hiddenField = '<input type="hidden" name="lp_pre_selected_cats" value="' + $this.val() + '" />'; 2607 jQuery($hiddenField).appendTo(".price-plan-button"); 2608 jQuery('.lp_plan_result_section').addClass('lp-plan-view-border') 2609 } 2610 } 2611 }) 2612 }) 2613});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.