(function(){var e=/MSIE/.test(navigator.userAgent)&&!window.opera,g=null,d=function(){j.repaintEverything()},f=true,k={},l=[],i={},o={},t=true,r=[],y=1200,E=function(a,b,c){var h=function(p,s){if(p===s)return true;else if(typeof p=="object"&&typeof s=="object"){var u=true;for(var v in p)if(!h(p[v],s[v])){u=false;break}for(v in s)if(!h(s[v],p[v])){u=false;break}return u}};c=+c||0;for(var m=a.length;c=0){delete a[c];a.splice(c,1);return true}}return false},Y=function(a,b){var c=B(a,"id");U(c,function(h){h.canvas.style.display=b})},Z=function(a){U(a,function(b){b.canvas.style.display="none"==b.canvas.style.display?"block":"none"})},L=function(a,b,c){if(c||b==null){x(a);r[a]=V(a);b=j.CurrentLibrary.getElementObject(a); b=j.CurrentLibrary.getOffset(b);l[a]=b}else l[a]=b},I=function(a,b){a=a||function(){};b=b||function(){};return function(){try{b.apply(this,arguments)}catch(c){}try{a.apply(this,arguments)}catch(h){}}},ba=function(a){var b=this;this.x=a.x||0;this.y=a.y||0;var c=a.orientation||[0,0];this.offsets=a.offsets||[0,0];this.compute=function(h,m){return[h[0]+b.x*m[0]+b.offsets[0],h[1]+b.y*m[1]+b.offsets[1]]};this.getOrientation=function(){return c}},ca=function(a){var b=a.reference,c=V(a.referenceCanvas),h= 0,m=0,p=null;this.compute=function(s){m=h=0;return[s[0]+c[0]/2,s[1]+c[1]/2]};this.getOrientation=function(){if(p)return p;else{var s=b.getOrientation();return[Math.abs(s[0])*h*-1,Math.abs(s[1])*m*-1]}};this.over=function(s){p=s.getOrientation()};this.out=function(){p=null}},aa=function(a){var b=this;this.source=x(a.source);this.target=x(a.target);this.sourceId=B(this.source,"id");this.targetId=B(this.target,"id");this.endpointsOnTop=a.endpointsOnTop!=null?a.endpointsOnTop:true;this.endpoints=[];this.endpointStyles= [];var c=function(p,s,u){if(p)b.endpoints[s]=p;else{if(!u.endpoints)u.endpoints=[null,null];p=u.endpoints[s]||u.endpoint||j.Defaults.Endpoints[s]||j.Defaults.Endpoint||new j.Endpoints.Dot;if(!u.endpointStyles)u.endpointStyles=[null,null];b.endpoints[s]=new S({style:u.endpointStyles[s]||u.endpointStyle||j.Defaults.EndpointStyles[s]||j.Defaults.EndpointStyle,endpoint:p,connections:[b],anchor:u.anchors?u.anchors[s]:j.Defaults.Anchors[s]||j.Anchors.BottomCenter,source:b.source})}};c(a.sourceEndpoint, 0,a);c(a.targetEndpoint,1,a);this.connector=this.endpoints[0].connector||this.endpoints[1].connector||a.connector||j.Defaults.Connector||new j.Connectors.Bezier;this.paintStyle=this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||a.paintStyle||j.Defaults.PaintStyle;L(this.sourceId);L(this.targetId);c=l[this.sourceId];var h=r[this.sourceId];c=this.endpoints[0].anchor.compute([c.left,c.top],h);this.endpoints[0].paint(c);c=l[this.targetId];h=r[this.targetId];c=this.endpoints[1].anchor.compute([c.left, c.top],h);this.endpoints[1].paint(c);var m=W(j.connectorClass);this.canvas=m;this.paint=function(p,s,u){g&&g.debug("Painting Connection; element in motion is "+p+"; ui is ["+s+"]; recalc is ["+u+"]");var v=p!=this.sourceId,D=v?this.sourceId:this.targetId,w=v?0:1,q=v?1:0;if(this.canvas.getContext){L(p,s,u);u&&L(D);s=l[p];u=l[D];p=r[p];var O=r[D];D=m.getContext("2d");var J=this.endpoints[q].anchor.compute([s.left,s.top],p,[u.left,u.top],O);this.endpoints[q].anchor.getOrientation();s=this.endpoints[w].anchor.compute([u.left, u.top],O,[s.left,s.top],p);this.endpoints[w].anchor.getOrientation();w=this.connector.compute(J,s,this.endpoints[q].anchor,this.endpoints[w].anchor,this.paintStyle.lineWidth);j.sizeCanvas(m,w[0],w[1],w[2],w[3]);j.extend(D,this.paintStyle);if(this.paintStyle.gradient&&!e){v=v?D.createLinearGradient(w[4],w[5],w[6],w[7]):D.createLinearGradient(w[6],w[7],w[4],w[5]);for(q=0;q=0&&b.connections.splice(n,1)};this.makeInPlaceCopy=function(){return new S({anchor:b.anchor,source:m,style:h,endpoint:c})};this.isConnectedTo=function(n){var C=false;if(n)for(var z=0;z=s};this.paint=function(n,C,z){g&&g.debug("Painting Endpoint with elementId ["+p+"]; anchorPoint is ["+n+"]");if(n==null){n=l[p];var N=r[p];if(n==null||N==null){L(p);n=l[p];N=r[p]}n=b.anchor.compute([n.left,n.top],N)}c.paint(n,b.anchor.getOrientation(),z||b.canvas,h,C||h)};if(a.isSource&&j.CurrentLibrary.isDragSupported(m)){var w=null,q=null,O=false,J=null,A=a.dragOptions|| {},K=j.extend({},j.CurrentLibrary.defaultDragOptions);A=j.extend(K,A);K=j.CurrentLibrary.dragEvents.start;var P=j.CurrentLibrary.dragEvents.stop,Q=j.CurrentLibrary.dragEvents.drag;A[K]=I(A[K],function(){D=b.makeInPlaceCopy();D.paint();w=document.createElement("div");document.body.appendChild(w);var n=""+new String((new Date).getTime());R(x(w),"id",n);L(n);R(x(b.canvas),"dragId",n);R(x(b.canvas),"elId",p);var C=new ca({reference:b.anchor,referenceCanvas:b.canvas});v=new S({style:{fillStyle:"rgba(0,0,0,0)"}, endpoint:c,anchor:C,source:w});q=b.connections.length==0||b.connections.length0)for(var h=0;h0)for(var m=0;m=4)c.orientation=[arguments[2],arguments[3]];if(arguments.length==6)c.offsets=[arguments[4],arguments[5]]}return new ba(c)},repaint:function(a){var b=function(h){h=x(h);F(h)};if(typeof a=="object")for(var c=0;co)o=k;if(f<0){r+=f;f=Math.abs(f);o+=f;G[0]+=f;E+=f;F+=f;d[0]+=f}f=Math.min(Math.min(H,i),Math.min(G[1], d[1]));k=Math.max(Math.max(H,i),Math.max(G[1],d[1]));if(k>t)t=k;if(f<0){y+=f;f=Math.abs(f);t+=f;G[1]+=f;H+=f;i+=f;d[1]+=f}return[r,y,o,t,E,H,F,i,G[0],G[1],d[0],d[1]]};this.paint=function(d,f){f.beginPath();f.moveTo(d[4],d[5]);f.bezierCurveTo(d[8],d[9],d[10],d[11],d[6],d[7]);f.stroke()}};jsPlumb.Endpoints.Dot=function(e){e=e||{radius:10};var g=this;this.radius=e.radius;var d=0.5*this.radius,f=this.radius/3,k=function(l){try{return parseInt(l)}catch(i){if(l.substring(l.length-1)=="%")return parseInt(l.substring(0, l-1))}};this.paint=function(l,i,o,t,r){var y=t.radius||g.radius;jsPlumb.sizeCanvas(o,l[0]-y,l[1]-y,y*2,y*2);l=o.getContext("2d");o=jsPlumb.extend({},t);if(o.fillStyle==null)o.fillStyle=r.strokeStyle;jsPlumb.extend(l,o);r=/MSIE/.test(navigator.userAgent)&&!window.opera;if(t.gradient&&!r){r=t.gradient;o=d;var E=f;if(r.offset)o=k(r.offset);if(r.innerRadius)E=k(r.innerRadius);r=[o,E];i=l.createRadialGradient(y,y,y,y+(i[0]==1?r[0]*-1:r[0]),y+(i[1]==1?r[0]*-1:r[0]),r[1]);for(r=0;r