(function(){var Z=function(){var w=function(){var a={};this.bind=function(b,e){if(b.constructor==Array)for(var h=0;h=0){delete a[e];a.splice(e,1);return true}}return false},ja=function(a,b){ea(J(a,"id"),function(e){e.canvas.style.display=b})},na=function(a){ea(a,function(b){b.canvas.style.display="none"==b.canvas.style.display?"block":"none"})},V=function(a){var b=a.timestamp,e=a.recalc,h=a.offset;a=a.elId;if(!e)if(b&&b===f[a])return;if(e||h==null){e=x(a);q[a]=R(e); j[a]=l.CurrentLibrary.getOffset(x(e));f[a]=b}else j[a]=h},T=function(a,b){a=a||function(){};b=b||function(){};return function(){var e=null;try{e=b.apply(this,arguments)}catch(h){G("jsPlumb function failed : "+h)}try{a.apply(this,arguments)}catch(n){G("wrapped function failed : "+n)}return e}},ka=function(a){var b=this;this.x=a.x||0;this.y=a.y||0;var e=a.orientation||[0,0],h=null;this.offsets=a.offsets||[0,0];b.timestamp=null;this.compute=function(n){var m=n.xy,A=n.wh,D=n.element;if((n=n.timestamp)&& n===b.timestamp)return h;h=[m[0]+b.x*A[0]+b.offsets[0],m[1]+b.y*A[1]+b.offsets[1]];A=D?D.container:null;m={left:0,top:0};if(A!=null){var F=x(A);A=l.CurrentLibrary.getOffset(x(F));D=l.CurrentLibrary.getScrollLeft(F);F=l.CurrentLibrary.getScrollTop(F);m.left=A.left-D;m.top=A.top-F;h[0]-=m.left;h[1]-=m.top}b.timestamp=n;return h};this.getOrientation=function(){return e};this.equals=function(n){if(!n)return false;var m=n.getOrientation(),A=this.getOrientation();return this.x==n.x&&this.y==n.y&&this.offsets[0]== n.offsets[0]&&this.offsets[1]==n.offsets[1]&&A[0]==m[0]&&A[1]==m[1]};this.getCurrentLocation=function(){return h}},oa=function(a){var b=a.reference,e=R(x(a.referenceCanvas)),h=null,n=null;this.compute=function(m){var A=m.xy;m=m.element;A=[A[0]+e[0]/2,A[1]+e[1]/2];if(m.container!=null){m=l.CurrentLibrary.getOffset(x(m.container));A[0]-=m.left;A[1]-=m.top}return n=A};this.getOrientation=function(){if(h)return h;else{var m=b.getOrientation();return[Math.abs(m[0])*0*-1,Math.abs(m[1])*0*-1]}};this.over= function(m){h=m.getOrientation()};this.out=function(){h=null};this.getCurrentLocation=function(){return n}},pa=function(a){this.isDynamic=this.isSelective=true;var b=a||[];for(a=0;a0?b[0]:null;this.locked=false;var h=this;this.compute=function(n){var m=n.xy,A=n.wh,D=n.txy,F=n.twh;if(h.locked||D==null||F==null)return e.compute(n); else n.timestamp=null;var B=D[0]+F[0]/2;D=D[1]+F[1]/2;F=-1;for(var N=Infinity,K=0;KE)E=Q}var M=this.connector.compute(O,B,this.endpoints[0].anchor,this.endpoints[1].anchor, this.paintStyle.lineWidth,E);l.sizeCanvas(F,M[0],M[1],M[2],M[3]);O=function(P,U){P.save();l.extend(P,U);if(U.gradient&&!y){for(var Y=b.connector.createGradient(M,P,N==this.sourceId),s=0;s=0){b.connections.splice(z,1);L||(s.endpoints[0]==b?s.endpoints[1]:s.endpoints[0]).detach(s,true)}X(s.canvas,s.container);da(u,s.scope,s);aa(s)};this.detachAll=function(){for(;b.connections.length>0;)b.detach(b.connections[0])};this.detachFrom= function(s){for(var L=[],z=0;z=0&&b.connections.splice(s,1)};this.getElement=function(){return m};this.getUuid=function(){return A};this.makeInPlaceCopy=function(){return new fa({anchor:b.anchor,source:m,style:n,endpoint:h})};this.isConnectedTo=function(s){var L=false;if(s)for(var z= 0;z=N};this.setDragAllowedWhenFull=function(s){b.dragAllowedWhenFull=s};this.equals=function(s){return this.anchor.equals(s.anchor)};this.paint=function(s){s=s||{};var L=s.timestamp;if(!L||b.timestamp!==L){var z=s.anchorPoint,ba=s.canvas,qa=s.connectorPaintStyle;if(z==null){z=s.offset||j[B];s=s.dimensions||q[B]; if(z==null||s==null){V({elId:B,timestamp:L});z=j[B];s=q[B]}s={xy:[z.left,z.top],wh:s,element:b,timestamp:L};if(b.anchor.isDynamic)if(b.connections.length>0){z=b.connections[0];var la=z.endpoints[0]==b?1:0,ga=la==0?z.sourceId:z.targetId,ma=j[ga];ga=q[ga];s.txy=[ma.left,ma.top];s.twh=ga;s.tElement=z.endpoints[la]}z=b.anchor.compute(s)}h.paint(z,b.anchor.getOrientation(),ba||b.canvas,n,qa||n);b.timestamp=L}};this.removeConnection=this.detach;if(a.isSource&&l.CurrentLibrary.isDragSupported(m)){var O= null;var E=e=null,S=false,Q=null,M=a.dragOptions||{},P=l.extend({},l.CurrentLibrary.defaultDragOptions);M=l.extend(P,M);M.scope=M.scope||b.scope;P=l.CurrentLibrary.dragEvents.start;var U=l.CurrentLibrary.dragEvents.stop,Y=l.CurrentLibrary.dragEvents.drag;M[P]=T(M[P],function(){E=b.connections.length0)for(var h=0;h0)for(var n=0;n0?p(h,m)!=-1:true){b[m]=[];for(e= 0;e0?p(n,A.sourceId)!=-1:true)&&(a.length>0?p(a,A.targetId)!=-1:true)&&b[m].push({sourceId:A.sourceId,targetId:A.targetId,source:A.source,target:A.target,sourceEndpoint:A.endpoints[0],targetEndpoint:A.endpoints[1],connection:A})}}return b};this.getDefaultScope=function(){return k};this.getEndpoint=function(a){return v[a]};this.getId=W;this.hide=function(a){ja(a,"none")};this.makeAnchor=function(a,b){if(arguments.length==0)return null;var e={};if(arguments.length== 1){var h=arguments[0];if(h.compute&&h.getOrientation)return h;else if(typeof h=="string")return o.Anchors[arguments[0]]();else if(h.constructor==Array)return l.makeAnchor.apply(this,h);else typeof arguments[0]=="object"&&l.extend(e,a)}else{e={x:a,y:b};if(arguments.length>=4)e.orientation=[arguments[2],arguments[3]];if(arguments.length==6)e.offsets=[arguments[4],arguments[5]]}h=new ka(e);h.clone=function(){return new ka(e)};return h};this.makeAnchors=function(a){for(var b=[],e=0;e0?1:-1,C=Math.abs(k*Math.sin(j));if(c>r)C*=-1;var I=Math.abs(k*Math.cos(j));if(f>d)I*=-1;return[g[0]+p*I,g[1]+p*C]};this.perpendicularToPathAt=function(q,k,g){q=w.pointAlongPathFrom(q,k);k=w.gradientAtPoint(q.location);var p=Math.atan(-1/k);k=g/2*Math.sin(p);g=g/2*Math.cos(p);return[[q[0]+g,q[1]+k],[q[0]-g,q[1]-k]]};this.createGradient=function(q,k){return k.createLinearGradient(q[4],q[5],q[6],q[7])}};jsPlumb.Connectors.Bezier=function(w){var o=this;this.majorAnchor=w||150;this.minorAnchor=10; var y=null;this._findControlPoint=function(g,p,C,I,H){I=I.getOrientation();H=H.getOrientation();var G=[],J=o.majorAnchor,x=o.minorAnchor;if(I[0]!=H[0]||I[1]==H[1]){H[0]==0?G.push(C[0]r)r=p;if(g<0){c+=g;g=Math.abs(g);r+=g;t[0]+=g;u+=g;j+=g;v[0]+=g}g=Math.min(Math.min(f,_ty),Math.min(t[1],v[1]));p=Math.max(Math.max(f,_ty),Math.max(t[1],v[1])); if(p>q)q=p;if(g<0){d+=g;g=Math.abs(g);q+=g;t[1]+=g;f+=g;_ty+=g;v[1]+=g}if(G&&rr)r=q}d=r;r=f.measureText("M").width;u=o.labelStyle.padding||0.25;y=d+2*d*u;t=c.length*r+2*r*u;d=c.length*r;f.restore();c={width:y,height:t,lines:c,oneLine:r,padding:u,textHeight:d}}if(typeof o.label!="function")o.cachedDimensions=c;return c};this.computeMaxSize=function(f,c){var d=j(c);return d.width?Math.max(d.width,d.height)*1.5:0};this.draw=function(f, c){var d=j(c);if(d.width){var r=f.pointOnPath(o.location);if(o.labelStyle.font)c.font=o.labelStyle.font;c.fillStyle=o.labelStyle.fillStyle?o.labelStyle.fillStyle:"rgba(0,0,0,0)";c.fillRect(r[0]-d.width/2,r[1]-d.height/2,d.width,d.height);if(o.labelStyle.color)c.fillStyle=o.labelStyle.color;c.textBaseline="middle";c.textAlign="center";for(i=0;i0){c.strokeStyle=o.labelStyle.borderStyle|| "black";c.strokeRect(r[0]-d.width/2,r[1]-d.height/2,d.width,d.height)}}}};jsPlumb.Overlays.Image=function(w){var o=this;this.location=w.location||0.5;this.img=new Image;var y=null,t=null,v,u,j=w.events||{};this.img.onload=function(){o.ready=true};this.img.src=w.src||w.url;t=window.setInterval(function(){if(o.ready){window.clearInterval(t);y=document.createElement("img");y.src=o.img.src;y.style.position="absolute";y.style.display="none";y.className="_jsPlumb_overlay";document.body.appendChild(y);for(var c in j)jsPlumb.CurrentLibrary.bind(y, c,j[c]);if(v&&u){f(v,u);v=u=null}}},250);this.computeMaxSize=function(){return[o.img.width,o.img.height]};var f=function(c,d){var r=c.pointOnPath(o.location),q=jsPlumb.CurrentLibrary.getElementObject(d.canvas);q=jsPlumb.CurrentLibrary.getOffset(q);jsPlumb.CurrentLibrary.setOffset(y,{left:q.left+r[0]-o.img.width/2,top:q.top+r[1]-o.img.height/2});y.style.display="block"};this.draw=function(c,d){if(o.ready)f(c,d);else{v=c;u=d}}}})(); (function(){var Z=new Class({Extends:Fx.Morph,onStep:null,initialize:function(j,f){this.parent(j,f);if(f.onStep)this.onStep=f.onStep},step:function(){this.parent();if(this.onStep)try{this.onStep()}catch(j){}}}),l={},w={},o={},y={},t=function(j,f,c){if(f){var d=f.get("id");if(d)(d=w[d])&&d[c]&&d[c](j,f)}},v=function(j,f){if(j){var c=j.get("id");if(c)if(c=w[c])if(c.hoverClass)f?j.addClass(c.hoverClass):j.removeClass(c.hoverClass)}},u=function(j,f,c){var d=j[f];if(!d){d=[];j[f]=d}d.push(c)};jsPlumb.CurrentLibrary= {dragEvents:{start:"onStart",stop:"onComplete",drag:"onDrag",step:"onStep",over:"onEnter",out:"onLeave",drop:"onDrop",complete:"onComplete"},appendElement:function(j,f){jsPlumb.CurrentLibrary.getElementObject(f).grab(j)},bind:function(j,f,c){j=jsPlumb.CurrentLibrary.getElementObject(j);j.addEvent(f,c)},extend:function(j,f){return $extend(j,f)},getElementObject:function(j){return $(j)},getOffset:function(j){j=j.getPosition();return{left:j.x,top:j.y}},setOffset:function(j,f){jsPlumb.CurrentLibrary.getElementObject(j).setPosition({x:f.left, y:f.top})},getSize:function(j){j=j.getSize();return[j.x,j.y]},getAttribute:function(j,f){return j.get(f)},setAttribute:function(j,f,c){j.set(f,c)},addClass:function(j,f){j.addClass(f)},removeClass:function(j,f){j.removeClass(f)},initDraggable:function(j,f){var c=jsPlumb.getId(j),d=y[c];if(!d){var r=0,q=null,k=jsPlumb.Defaults.DragOptions.zIndex||2E3;f.onStart=jsPlumb.wrap(f.onStart,function(){r=this.element.getStyle("z-index");this.element.setStyle("z-index",k);if(jsPlumb.Defaults.DragOptions.cursor){q= this.element.getStyle("cursor");this.element.setStyle("cursor",jsPlumb.Defaults.DragOptions.cursor)}});f.onComplete=jsPlumb.wrap(f.onComplete,function(){this.element.setStyle("z-index",r);q&&this.element.setStyle("cursor",q)});c=f.scope||jsPlumb.Defaults.Scope;d=function(g){return g.get("id")!=j.get("id")};d=l[c]?l[c].filter(d):[];f.droppables=d;f.onLeave=jsPlumb.wrap(f.onLeave,function(g,p){if(p){v(p,false);t(g,p,"onLeave")}});f.onEnter=jsPlumb.wrap(f.onEnter,function(g,p){if(p){v(p,true);t(g,p, "onEnter")}});f.onDrop=function(g,p){if(p){v(p,false);t(g,p,"onDrop")}};d=new Drag.Move(j,f);u(o,c,d);u(y,j.get("id"),d);f.disabled&&d.detach()}return d},isDragSupported:function(){return typeof Drag!="undefined"},setDraggable:function(j,f){var c=y[j.get("id")];c&&c.each(function(d){f?d.attach():d.detach()})},initDroppable:function(j,f){var c=f.scope||jsPlumb.Defaults.Scope;u(l,c,j);var d=jsPlumb.getId(j);w[d]=f;d=function(r){return r.element!=j};c=o[c]?o[c].filter(d):[];for(d=0;d0?1:-1;for(var G=1;G<=5;G++){g=d[G].y==0?0:d[G].y>0?1:-1;g!=H&&C++;H=g}switch(C){case 0:d=0;break a;case 1:var J,x,R;C=d[0].y-d[5].y;g=d[5].x-d[0].x;H=d[0].x*d[5].y-d[5].x*d[0].y;G=max_distance_below=0;for(R=1;R<5;R++){J=C*d[R].x+g*d[R].y+H;if(J>G)G=J;else if(J0?1:-1,g=null;q