jsPlumbUtil={isArray:function(b){return Object.prototype.toString.call(b)==="[object Array]"},isString:function(a){return typeof a==="string"},isBoolean:function(a){return typeof a==="boolean"},isObject:function(a){return Object.prototype.toString.call(a)==="[object Object]"},isDate:function(a){return Object.prototype.toString.call(a)==="[object Date]"},isFunction:function(a){return Object.prototype.toString.call(a)==="[object Function]"},clone:function(d){if(this.isString(d)){return new String(d)}else{if(this.isBoolean(d)){return new Boolean(d)}else{if(this.isDate(d)){return new Date(d.getTime())}else{if(this.isFunction(d)){return d}else{if(this.isArray(d)){var c=[];for(var e=0;eb[0]){return(a[1]>b[1])?2:1}else{return(a[1]>b[1])?3:4}},intersects:function(f,e){var c=f.x,a=f.x+f.w,k=f.y,h=f.y+f.h,d=e.x,b=e.x+e.w,i=e.y,g=e.y+e.h;return((c<=d&&d<=a)&&(k<=i&&i<=h))||((c<=b&&b<=a)&&(k<=i&&i<=h))||((c<=d&&d<=a)&&(k<=g&&g<=h))||((c<=b&&d<=a)&&(k<=g&&g<=h))||((d<=c&&c<=b)&&(i<=k&&k<=g))||((d<=a&&a<=b)&&(i<=k&&k<=g))||((d<=c&&c<=b)&&(i<=h&&h<=g))||((d<=a&&c<=b)&&(i<=h&&h<=g))},segmentMultipliers:[null,[1,-1],[1,1],[-1,1],[-1,-1]],inverseSegmentMultipliers:[null,[-1,-1],[-1,1],[1,1],[1,-1]],pointOnLine:function(a,e,b){var d=jsPlumbUtil.gradient(a,e),i=jsPlumbUtil.segment(a,e),h=b>0?jsPlumbUtil.segmentMultipliers[i]:jsPlumbUtil.inverseSegmentMultipliers[i],c=Math.atan(d),f=Math.abs(b*Math.sin(c))*h[1],g=Math.abs(b*Math.cos(c))*h[0];return{x:a.x+g,y:a.y+f}},perpendicularLineTo:function(c,d,e){var b=jsPlumbUtil.gradient(c,d),f=Math.atan(-1/b),g=e/2*Math.sin(f),a=e/2*Math.cos(f);return[{x:d.x+a,y:d.y+g},{x:d.x-a,y:d.y-g}]},findWithFunction:function(b,d){if(b){for(var c=0;c-1){c.splice(b,1)}return b!=-1},remove:function(b,c){var a=jsPlumbUtil.indexOf(b,c);if(a>-1){b.splice(a,1)}return a!=-1},addWithFunction:function(c,b,a){if(jsPlumbUtil.findWithFunction(c,a)==-1){c.push(b)}},addToList:function(d,b,c){var a=d[b];if(a==null){a=[],d[b]=a}a.push(c);return a},EventGenerator:function(){var c={},b=this;var a=["ready"];this.bind=function(d,e){jsPlumbUtil.addToList(c,d,e);return b};this.fire=function(g,h,d){if(c[g]){for(var f=0;f';var e=f.firstChild;e.style.behavior="url(#default#VML)";d.vml=e?typeof e.adj=="object":true;f.parentNode.removeChild(f)}return d.vml};var c=function(i){var h={},g=[],f={},e={};this.register=function(n){var m=jsPlumb.CurrentLibrary;n=m.getElementObject(n);var p=i.getId(n),l=m.getDOMElement(n),k=m.getOffset(n);if(!h[p]){h[p]=n;g.push(n);f[p]={}}var o=function(u,q){if(u){for(var r=0;r0){var s=m.getOffset(t);f[p][v]={id:v,offset:{left:s.left-k.left,top:s.top-k.top}}}o(u.childNodes[r])}}}};o(l)};this.updateOffsets=function(o){var r=jsPlumb.CurrentLibrary,m=r.getElementObject(o),l=i.getId(m),n=f[l],k=r.getOffset(m);if(n){for(var q in n){var s=r.getElementObject(q),p=r.getOffset(s);f[l][q]={id:q,offset:{left:p.left-k.left,top:p.top-k.top}}}}};this.endpointAdded=function(m){var r=jsPlumb.CurrentLibrary,u=document.body,k=i.getId(m),t=r.getDOMElement(m),l=t.parentNode,o=l==u;e[k]=e[k]?e[k]+1:1;while(l!=u){var q=i.getId(l,null,true);if(q&&h[q]){var w=-1,s=r.getElementObject(l),n=r.getOffset(s);if(f[q][k]==null){var v=jsPlumb.CurrentLibrary.getOffset(m);f[q][k]={id:k,offset:{left:v.left-n.left,top:v.top-n.top}}}break}l=l.parentNode}};this.endpointDeleted=function(l){if(e[l.elementId]){e[l.elementId]--;if(e[l.elementId]<=0){for(var k in f){delete f[k][l.elementId]}}}};this.getElementsForDraggable=function(k){return f[k]};this.reset=function(){h={};g=[];f={};e={}}};if(!window.console){window.console={time:function(){},timeEnd:function(){},group:function(){},groupEnd:function(){},log:function(){}}}window.jsPlumbAdapter={headless:false,appendToRoot:function(e){document.body.appendChild(e)},getRenderModes:function(){return["canvas","svg","vml"]},isRenderModeAvailable:function(e){return{canvas:b,svg:a,vml:d()}[e]},getDragManager:function(e){return new c(e)},setRenderMode:function(i){var h;if(i){i=i.toLowerCase();var f=this.isRenderModeAvailable("canvas"),e=this.isRenderModeAvailable("svg"),g=this.isRenderModeAvailable("vml");if(i==="svg"){if(e){h="svg"}else{if(f){h="canvas"}else{if(g){h="vml"}}}}else{if(i==="canvas"&&f){h="canvas"}else{if(g){h="vml"}}}}return h}}})();(function(){var g=jsPlumbUtil.findWithFunction,G=jsPlumbUtil.indexOf,A=jsPlumbUtil.removeWithFunction,k=jsPlumbUtil.remove,r=jsPlumbUtil.addWithFunction,i=jsPlumbUtil.addToList,l=jsPlumbUtil.isArray,z=jsPlumbUtil.isString,u=jsPlumbUtil.isObject;var v=null,c=function(H,I){return n.CurrentLibrary.getAttribute(C(H),I)},d=function(I,J,H){n.CurrentLibrary.setAttribute(C(I),J,H)},y=function(I,H){n.CurrentLibrary.addClass(C(I),H)},h=function(I,H){return n.CurrentLibrary.hasClass(C(I),H)},m=function(I,H){n.CurrentLibrary.removeClass(C(I),H)},C=function(H){return n.CurrentLibrary.getElementObject(H)},s=function(I,H){var K=n.CurrentLibrary.getOffset(C(I));if(H!=null){var J=H.getZoom();return{left:K.left/J,top:K.top/J}}else{return K}},a=function(H){return n.CurrentLibrary.getSize(C(H))},o=jsPlumbUtil.log,F=jsPlumbUtil.group,f=jsPlumbUtil.groupEnd,E=jsPlumbUtil.time,t=jsPlumbUtil.timeEnd,p=function(){return""+(new Date()).getTime()},B=function(aa){var U=this,ab=arguments,S=false,M=aa.parameters||{},K=U.idPrefix,X=K+(new Date()).getTime(),W=null,ac=null;U._jsPlumb=aa._jsPlumb;U.getId=function(){return X};U.tooltip=aa.tooltip;U.hoverClass=aa.hoverClass||U._jsPlumb.Defaults.HoverClass||n.Defaults.HoverClass;jsPlumbUtil.EventGenerator.apply(this);this.clone=function(){var ad=new Object();U.constructor.apply(ad,ab);return ad};this.getParameter=function(ad){return M[ad]},this.getParameters=function(){return M},this.setParameter=function(ad,ae){M[ad]=ae},this.setParameters=function(ad){M=ad},this.overlayPlacements=[];var L=aa.beforeDetach;this.isDetachAllowed=function(ad){var ae=U._jsPlumb.checkCondition("beforeDetach",ad);if(L){try{ae=L(ad)}catch(af){o("jsPlumb: beforeDetach callback failed",af)}}return ae};var O=aa.beforeDrop;this.isDropAllowed=function(ai,af,ag,ad,ae){var ah=U._jsPlumb.checkCondition("beforeDrop",{sourceId:ai,targetId:af,scope:ag,connection:ad,dropEndpoint:ae});if(O){try{ah=O({sourceId:ai,targetId:af,scope:ag,connection:ad,dropEndpoint:ae})}catch(aj){o("jsPlumb: beforeDrop callback failed",aj)}}return ah};var Y=function(){if(W&&ac){var ad={};n.extend(ad,W);n.extend(ad,ac);delete U.hoverPaintStyle;if(ad.gradient&&W.fillStyle){delete ad.gradient}ac=ad}};this.setPaintStyle=function(ad,ae){W=ad;U.paintStyleInUse=W;Y();if(!ae){U.repaint()}};this.getPaintStyle=function(){return W};this.setHoverPaintStyle=function(ad,ae){ac=ad;Y();if(!ae){U.repaint()}};this.getHoverPaintStyle=function(){return ac};this.setHover=function(ad,af,ae){if(!U._jsPlumb.currentlyDragging&&!U._jsPlumb.isHoverSuspended()){S=ad;if(U.hoverClass!=null&&U.canvas!=null){if(ad){J.addClass(U.canvas,U.hoverClass)}else{J.removeClass(U.canvas,U.hoverClass)}}if(ac!=null){U.paintStyleInUse=ad?ac:W;ae=ae||p();U.repaint({timestamp:ae,recalc:false})}if(U.getAttachedElements&&!af){Z(ad,p(),U)}}};this.isHover=function(){return S};var V=null;this.setZIndex=function(ad){V=ad};this.getZIndex=function(){return V};var J=n.CurrentLibrary,I=["click","dblclick","mouseenter","mouseout","mousemove","mousedown","mouseup","contextmenu"],T={mouseout:"mouseexit"},N=function(af,ag,ae){var ad=T[ae]||ae;J.bind(af,ae,function(ah){ag.fire(ad,ag,ah)})},R=function(af,ae){var ad=T[ae]||ae;J.unbind(af,ae)};this.attachListeners=function(ae,af){for(var ad=0;ad1){for(var ad=0;ad=0?S.overlays[T]:null};this.getOverlays=function(){return S.overlays};this.hideOverlay=function(U){var T=S.getOverlay(U);if(T){T.hide()}};this.hideOverlays=function(){for(var T=0;T0){try{for(var bA=0;bA0){try{bz[0](bD,bC,bA)}catch(bE){o(br,"cannot asynchronously check condition ["+bB+"]"+bE)}}};this.connect=function(bC,bA){var bz=aC(bC,bA),bB;if(bz){if(bz.deleteEndpointsOnDetach==null){bz.deleteEndpointsOnDetach=true}bB=af(bz);bx(bB,bz)}return bB};this.deleteEndpoint=function(bA){var bF=(typeof bA=="string")?aW[bA]:bA;if(bF){var bC=bF.getUuid();if(bC){aW[bC]=null}bF.detachAll();if(bF.endpoint.cleanup){bF.endpoint.cleanup()}aZ(bF.endpoint.getDisplayElements());br.anchorManager.deleteEndpoint(bF);for(var bE in aV){var bz=aV[bE];if(bz){var bD=[];for(var bB=0;bB0?G(bB,bA)!=-1:!bz};this.getConnections=function(bI,bA){if(!bI){bI={}}else{if(bI.constructor==String){bI={scope:bI}}}var bH=bI.scope||br.getDefaultScope(),bG=bv(bH,true),bz=bv(bI.source),bE=bv(bI.target),bD=(!bA&&bG.length>1)?{}:[],bJ=function(bL,bM){if(!bA&&bG.length>1){var bK=bD[bL];if(bK==null){bK=[];bD[bL]=bK}bK.push(bM)}else{bD.push(bM)}};for(var bC in a0){if(aI(bG,bC)){for(var bB=0;bB0&&!bL.isSource),bG=(bC&&bJ.length>0&&!bL.isTarget);if(bN||bG){continue inner}bP.push(bL)}}}}return bf(bP)};this.getAllConnections=function(){return a0};this.getDefaultScope=function(){return R};this.getEndpoint=ax;this.getEndpoints=function(bz){return aV[H(bz)]};this.getId=H;this.getOffset=function(bA){var bz=aj[bA];return X({elId:bA})};this.getSelector=function(bz){return n.CurrentLibrary.getSelector(bz)};this.getSize=function(bA){var bz=ag[bA];if(!bz){X({elId:bA})}return ag[bA]};this.appendElement=aX;var aU=false;this.isHoverSuspended=function(){return aU};this.setHoverSuspended=function(bz){aU=bz};var aY=function(bz){return function(){return jsPlumbAdapter.isRenderModeAvailable(bz)}};this.isCanvasAvailable=aY("canvas");this.isSVGAvailable=aY("svg");this.isVMLAvailable=aY("vml");this.hide=function(bz,bA){a7(bz,"none",bA)};this.idstamp=an;this.init=function(){if(!K){br.setRenderMode(br.Defaults.RenderMode);var bz=function(bA){n.CurrentLibrary.bind(document,bA,function(bG){if(!br.currentlyDragging&&Y==n.CANVAS){for(var bF in a0){var bH=a0[bF];for(var bD=0;bD=4)?[bE[2],bE[3]]:[0,0],offsets:(bE.length==6)?[bE[4],bE[5]]:[0,0],elementId:bB};bC=new ab(bD);bC.clone=function(){return new ab(bD)}}}}}if(!bC.id){bC.id="anchor_"+an()}return bC};this.makeAnchors=function(bC,bA,bz){var bD=[];for(var bB=0;bB0&&bT>=at[bM]){if(bz){bz({element:bO,connection:bY},bR)}return false}bQ.anchor.locked=false;if(b1){bH.setDragScope(b3,b1)}var bW=proxyComponent.isDropAllowed(bY.sourceId,H(bO),bY.scope,bY,null);if(bY.endpointsToDeleteOnDetach){if(bQ===bY.endpointsToDeleteOnDetach[0]){bY.endpointsToDeleteOnDetach[0]=null}else{if(bQ===bY.endpointsToDeleteOnDetach[1]){bY.endpointsToDeleteOnDetach[1]=null}}}if(bY.suspendedEndpoint){bY.targetId=bY.suspendedEndpoint.elementId;bY.target=bH.getElementObject(bY.suspendedEndpoint.elementId);bY.endpoints[1]=bY.suspendedEndpoint}if(bW){bQ.detach(bY,false,true,false);var b2=aK[bM]||br.addEndpoint(bO,bA);if(bA.uniqueEndpoint){aK[bM]=b2}b2._makeTargetCreator=true;if(b2.anchor.positionFinder!=null){var bZ=bH.getUIPosition(arguments,br.getZoom()),bV=s(bO,br),b0=a(bO),bU=b2.anchor.positionFinder(bZ,bV,b0,b2.anchor.constructorParams);b2.anchor.x=bU[0];b2.anchor.y=bU[1]}var bX=br.connect({source:bQ,target:b2,scope:b1,previousConnection:bY,container:bY.parent,deleteEndpointsOnDetach:bE,doNotFireConnectionEvent:bQ.endpointWillMoveAfterConnection});if(bY.endpoints[1]._makeTargetCreator&&bY.endpoints[1].connections.length<2){br.deleteEndpoint(bY.endpoints[1])}if(bE){bX.endpointsToDeleteOnDetach=[bQ,b2]}bX.repaint()}else{if(bY.suspendedEndpoint){if(bY.isReattach()){bY.setHover(false);bY.floatingAnchorIndex=null;bY.suspendedEndpoint.addConnection(bY);br.repaint(bQ.elementId)}else{bQ.detach(bY,false,true,true,bR)}}}};var bN=bH.dragEvents.drop;bL.scope=bL.scope||bI;bL[bN]=ap(bL[bN],bK);bH.initDroppable(bO,bL,true)};bC=aL(bC);var bG=bC.length&&bC.constructor!=String?bC:[bC];for(var bF=0;bF=0&&bX>=N[bJ]){if(bA){bA({element:bQ,maxConnections:bC},bZ)}return false}if(bE.filter){var bV=bE.filter(bH.getOriginalEvent(bZ),bQ);if(bV===false){return}}var b3=X({elId:bK});var b2=((bZ.pageX||bZ.page.x)-b3.left)/b3.width,b1=((bZ.pageY||bZ.page.y)-b3.top)/b3.height,b7=b2,b6=b1;if(bB.parent){var b0=bH.getElementObject(bB.parent),bY=H(b0);b3=X({elId:bY});b7=((bZ.pageX||bZ.page.x)-b3.left)/b3.width,b6=((bZ.pageY||bZ.page.y)-b3.top)/b3.height}var b5={};n.extend(b5,bB);b5.isSource=true;b5.anchor=[b2,b1,0,0];b5.parentAnchor=[b7,b6,0,0];b5.dragOptions=bS;if(bB.parent){var bW=b5.container||br.Defaults.Container||n.Defaults.Container;if(bW){b5.container=bW}else{b5.container=n.CurrentLibrary.getParent(bB.parent)}}bU=br.addEndpoint(bK,b5);bO=true;bU.endpointWillMoveAfterConnection=bB.parent!=null;bU.endpointWillMoveTo=bB.parent?bH.getElementObject(bB.parent):null;var b4=function(){if(bO){br.deleteEndpoint(bU)}};br.registerListener(bU.canvas,"mouseup",b4);br.registerListener(bQ,"mouseup",b4);bH.trigger(bU.canvas,"mousedown",bZ)};br.registerListener(bQ,"mousedown",bM);J[bK]=bM};bD=aL(bD);var bG=bD.length&&bD.constructor!=String?bD:[bD];for(var bF=0;bF0?bJ[0]:null,bE=bJ.length>0?0:-1,bI=this,bD=function(bQ,bN,bM,bR,bL){var bK=bR[0]+(bQ.x*bL[0]),bS=bR[1]+(bQ.y*bL[1]),bP=bR[0]+(bL[0]/2),bO=bR[1]+(bL[1]/2);return(Math.sqrt(Math.pow(bN-bK,2)+Math.pow(bM-bS,2))+Math.sqrt(Math.pow(bP-bK,2)+Math.pow(bO-bS,2)))},bz=bA||function(bU,bL,bM,bN,bK){var bP=bM[0]+(bN[0]/2),bO=bM[1]+(bN[1]/2);var bR=-1,bT=Infinity;for(var bQ=0;bQ=bC.left)||(bF.left<=bC.right&&bF.right>=bC.right)||(bF.left<=bC.left&&bF.right>=bC.right)||(bC.left<=bF.left&&bC.right>=bF.right)),bK=((bF.top<=bC.top&&bF.bottom>=bC.top)||(bF.top<=bC.bottom&&bF.bottom>=bC.bottom)||(bF.top<=bC.top&&bF.bottom>=bC.bottom)||(bC.top<=bF.top&&bC.bottom>=bF.bottom));if(!(bE||bK)){var bH=null,bB=false,bz=false,bG=null;if(bC.left>bF.left&&bC.top>bF.top){bH=["right","top"]}else{if(bC.left>bF.left&&bF.top>bC.top){bH=["top","left"]}else{if(bC.leftbF.top){bH=["left","top"]}}}}return{orientation:U.DIAGONAL,a:bH,theta:bA,theta2:bD}}else{if(bE){return{orientation:U.HORIZONTAL,a:bF.topbz[0]?1:-1},aa=function(bz){return function(bB,bA){var bC=true;if(bz){if(bB[0][0]bA[0][1]}}else{if(bB[0][0]>bA[0][0]){bC=true}else{bC=bB[0][1]>bA[0][1]}}return bC===false?-1:1}},M=function(bA,bz){var bC=bA[0][0]<0?-Math.PI-bA[0][0]:Math.PI-bA[0][0],bB=bz[0][0]<0?-Math.PI-bz[0][0]:Math.PI-bz[0][0];if(bC>bB){return 1}else{return bA[0][1]>bz[0][1]?1:-1}},a2={top:bb,right:aa(true),bottom:aa(true),left:M},ar=function(bz,bA){return bz.sort(bA)},ao=function(bA,bz){var bC=ag[bA],bD=aj[bA],bB=function(bK,bR,bG,bJ,bP,bO,bF){if(bJ.length>0){var bN=ar(bJ,a2[bK]),bL=bK==="right"||bK==="top",bE=a5(bK,bR,bG,bN,bP,bO,bL);var bS=function(bV,bU){var bT=bs([bU[0],bU[1]],bV.canvas);ak[bV.id]=[bT[0],bT[1],bU[2],bU[3]];aM[bV.id]=bF};for(var bH=0;bH0){bS.connections[0].setHover(b7,false)}else{bS.setHover(b7)}};D(bS.endpoint,bS,b6);this.setPaintStyle(b5.paintStyle||b5.style||br.Defaults.EndpointStyle||n.Defaults.EndpointStyle,true);this.setHoverPaintStyle(b5.hoverPaintStyle||br.Defaults.EndpointHoverStyle||n.Defaults.EndpointHoverStyle,true);this.paintStyleInUse=this.getPaintStyle();var bN=this.getPaintStyle();this.connectorStyle=b5.connectorStyle;this.connectorHoverStyle=b5.connectorHoverStyle;this.connectorOverlays=b5.connectorOverlays;this.connector=b5.connector;this.connectorTooltip=b5.connectorTooltip;this.connectorClass=b5.connectorClass;this.connectorHoverClass=b5.connectorHoverClass;this.isSource=b5.isSource||false;this.isTarget=b5.isTarget||false;var bY=b5.maxConnections||br.Defaults.MaxConnections;this.getAttachedElements=function(){return bS.connections};this.canvas=this.endpoint.canvas;this.connections=b5.connections||[];this.scope=b5.scope||R;this.connectionType=b5.connectionType;this.timestamp=null;bS.reattachConnections=b5.reattach||br.Defaults.ReattachConnections;bS.connectionsDetachable=br.Defaults.ConnectionsDetachable;if(b5.connectionsDetachable===false||b5.detachable===false){bS.connectionsDetachable=false}var bM=b5.dragAllowedWhenFull||true;if(b5.onMaxConnections){bS.bind("maxConnections",b5.onMaxConnections)}this.computeAnchor=function(b7){return bS.anchor.compute(b7)};this.addConnection=function(b7){bS.connections.push(b7)};this.detach=function(b8,cd,b9,cg,b7){var cf=g(bS.connections,function(ci){return ci.id==b8.id}),ce=false;cg=(cg!==false);if(cf>=0){if(b9||b8._forceDetach||b8.isDetachable()||b8.isDetachAllowed(b8)){var ch=b8.endpoints[0]==bS?b8.endpoints[1]:b8.endpoints[0];if(b9||b8._forceDetach||(bS.isDetachAllowed(b8))){bS.connections.splice(cf,1);if(!cd){ch.detach(b8,true,b9);if(b8.endpointsToDeleteOnDetach){for(var cc=0;cc0){bS.detach(bS.connections[0],false,true,b8,b7)}};this.detachFrom=function(ca,b9,b7){var cb=[];for(var b8=0;b8=0){bS.connections.splice(b7,1)}};this.getElement=function(){return bR};this.setElement=function(ca,b7){var cc=H(ca);A(aV[bS.elementId],function(cd){return cd.id==bS.id});bR=C(ca);bJ=H(bR);bS.elementId=bJ;var cb=ay({source:cc,container:b7}),b9=bD.getParent(bS.canvas);bD.removeElement(bS.canvas,b9);bD.appendElement(bS.canvas,cb);for(var b8=0;b80){var cj=bO(ca.elementWithPrecedence),cl=cj.endpoints[0]==bS?1:0,cc=cl==0?cj.sourceId:cj.targetId,ci=aj[cc],ck=ag[cc];b9.txy=[ci.left,ci.top];b9.twh=ck;b9.tElement=cj.endpoints[cl]}cd=bS.anchor.compute(b9)}var ch=bP.compute(cd,bS.anchor.getOrientation(bS),bS.paintStyleInUse,cb||bS.paintStyleInUse);bP.paint(ch,bS.paintStyleInUse,bS.anchor);bS.timestamp=cg;for(var ce=0;ce0?u:n+u:u*n;return jsPlumbUtil.pointOnLine({x:i,y:h},{x:e,y:d},t)}}};this.gradientAtPoint=function(t){return f};this.pointAlongPathFrom=function(t,x,w){var v=s.pointOnPath(t,w),u=t==1?{x:i+((e-i)*10),y:h+((h-d)*10)}:x<=0?{x:i,y:h}:{x:e,y:d};if(x<=0&&Math.abs(x)>1){x*=-1}return jsPlumbUtil.pointOnLine(v,u,x)}};jsPlumb.Connectors.Bezier=function(w){var q=this;w=w||{};this.majorAnchor=w.curviness||150;this.minorAnchor=10;var u=null;this.type="Bezier";this._findControlPoint=function(I,x,D,y,B,G,z){var F=G.getOrientation(y),H=z.getOrientation(B),C=F[0]!=H[0]||F[1]==H[1],A=[],J=q.majorAnchor,E=q.minorAnchor;if(!C){if(F[0]==0){A.push(x[0]v){v=D}if(G<0){t+=G;var I=Math.abs(G);v+=I;r[0]+=I;g+=I;p+=I;m[0]+=I}var Q=Math.min(f,o),O=Math.min(r[1],m[1]),C=Math.min(Q,O),H=Math.max(f,o),F=Math.max(r[1],m[1]),z=Math.max(H,F);if(z>e){e=z}if(C<0){s+=C;var E=Math.abs(C);e+=E;r[1]+=E;f+=E;o+=E;m[1]+=E}if(M&&v0?0:1,x)}return x};this.pointOnPath=function(x,z){var y=d();x=n(y,x,z);return jsBezier.pointOnCurve(y,x)};this.gradientAtPoint=function(x,z){var y=d();x=n(y,x,z);return jsBezier.gradientAtPoint(y,x)};this.pointAlongPathFrom=function(x,A,z){var y=d();x=n(y,x,z);return jsBezier.pointAlongCurveFrom(y,x,A)}};jsPlumb.Connectors.Flowchart=function(A){this.type="Flowchart";A=A||{};var s=this,e=A.stub||A.minStubLength||30,k=jsPlumbUtil.isArray(e)?e[0]:e,p=jsPlumbUtil.isArray(e)?e[1]:e,u=A.gap||0,f=A.midpoint||0.5,v=[],n=0,h=[],r=[],w=[],t,q,z=-Infinity,x=-Infinity,B=Infinity,y=Infinity,d=A.grid,g=function(H,D){var G=H%D,E=Math.floor(H/D),F=G>(D/2)?1:0;return(E+F)*D},o=function(D,G,F,E){return[F||d==null?D:g(D,d[0]),E||d==null?G:g(G,d[1])]},C=function(E,D,I,H){var G=0;for(var F=0;F0?F/n:(n+F)/n}var D=h.length-1,E=1;for(var G=0;G=F){D=G;E=(F-h[G][0])/r[G];break}}return{segment:v[D],proportion:E,index:D}};this.compute=function(aa,ao,D,U,az,O,Y,T,au,aq){v=[];h=[];n=0;r=[];z=x=-Infinity;B=y=Infinity;s.lineWidth=Y;t=ao[0]ay?0:1,ai=[1,0][ag];R=[];aA=[];R[ag]=aa[ag]>ao[ag]?-1:1;aA[ag]=aa[ag]>ao[ag]?1:-1;R[ai]=0;aA[ai]=0}var M=t?(ap-F)+(u*R[0]):I+(u*R[0]),L=q?(ay-E)+(u*R[1]):H+(u*R[1]),aw=t?I+(u*aA[0]):(ap-F)+(u*aA[0]),av=q?H+(u*aA[1]):(ay-E)+(u*aA[1]),ad=M+(R[0]*k),ac=L+(R[1]*k),P=aw+(aA[0]*p),N=av+(aA[1]*p),Z=Math.abs(M-aw)>(k+p),ab=Math.abs(L-av)>(k+p),al=ad+((P-ad)*f),aj=ac+((N-ac)*f),S=((R[0]*aA[0])+(R[1]*aA[1])),af=S==-1,ah=S==0,G=S==1;an-=I;am-=H;w=[an,am,ap,ay,M,L,aw,av];var at=[];var W=R[0]==0?"y":"x",Q=af?"opposite":G?"orthogonal":"perpendicular",J=jsPlumbUtil.segment([M,L],[aw,av]),ak=R[W=="x"?0:1]==-1,V={x:[null,4,3,2,1],y:[null,2,1,4,3]};if(ak){J=V[W][J]}l(ad,ac,M,L,aw,av);var X=function(aE,aD,aB,aC){return aE+(aD*((1-aB)*aC)+Math.max(k,p))},K={oppositex:function(){if(D.elementId==U.elementId){var aB=ac+((1-az.y)*au.height)+Math.max(k,p);return[[ad,aB],[P,aB]]}else{if(Z&&(J==1||J==2)){return[[al,L],[al,av]]}else{return[[ad,aj],[P,aj]]}}},orthogonalx:function(){if(J==1||J==2){return[[P,ac]]}else{return[[ad,N]]}},perpendicularx:function(){var aB=(av+L)/2;if((J==1&&aA[1]==1)||(J==2&&aA[1]==-1)){if(Math.abs(aw-M)>Math.max(k,p)){return[[P,ac]]}else{return[[ad,ac],[ad,aB],[P,aB]]}}else{if((J==3&&aA[1]==-1)||(J==4&&aA[1]==1)){return[[ad,aB],[P,aB]]}else{if((J==3&&aA[1]==1)||(J==4&&aA[1]==-1)){return[[ad,N]]}else{if((J==1&&aA[1]==-1)||(J==2&&aA[1]==1)){if(Math.abs(aw-M)>Math.max(k,p)){return[[al,ac],[al,N]]}else{return[[ad,N]]}}}}}},oppositey:function(){if(D.elementId==U.elementId){var aB=ad+((1-az.x)*au.width)+Math.max(k,p);return[[aB,ac],[aB,N]]}else{if(ab&&(J==2||J==3)){return[[M,aj],[aw,aj]]}else{return[[al,ac],[al,N]]}}},orthogonaly:function(){if(J==2||J==3){return[[ad,N]]}else{return[[P,ac]]}},perpendiculary:function(){var aB=(aw+M)/2;if((J==2&&aA[0]==-1)||(J==3&&aA[0]==1)){if(Math.abs(aw-M)>Math.max(k,p)){return[[ad,N]]}else{return[[ad,aj],[P,aj]]}}else{if((J==1&&aA[0]==-1)||(J==4&&aA[0]==1)){var aB=(aw+M)/2;return[[aB,ac],[aB,N]]}else{if((J==1&&aA[0]==1)||(J==4&&aA[0]==-1)){return[[P,ac]]}else{if((J==2&&aA[0]==1)||(J==3&&aA[0]==-1)){if(Math.abs(av-L)>Math.max(k,p)){return[[ad,aj],[P,aj]]}else{return[[P,ac]]}}}}}}};var ar=K[Q+W]();if(ar){for(var ax=0;axw[3]){w[3]=x+(Y*2)}if(z>w[2]){w[2]=z+(Y*2)}return w};this.pointOnPath=function(D,E){return s.pointAlongPathFrom(D,0,E)};this.gradientAtPoint=function(D,E){return v[i(D,E)["index"]][4]};this.pointAlongPathFrom=function(K,D,J){var L=i(K,J),H=L.segment,E=L.proportion,G=v[L.index][5],F=v[L.index][4];var I={x:F==Infinity?H[2]:H[2]>H[0]?H[0]+((1-E)*G)-D:H[2]+(E*G)+D,y:F==0?H[3]:H[3]>H[1]?H[1]+((1-E)*G)-D:H[3]+(E*G)+D,segmentInfo:L};return I}};jsPlumb.Endpoints.Dot=function(e){this.type="Dot";var d=this;e=e||{};this.radius=e.radius||10;this.defaultOffset=0.5*this.radius;this.defaultInnerRadius=this.radius/3;this.compute=function(k,g,m,i){var h=m.radius||d.radius,f=k[0]-h,l=k[1]-h;return[f,l,h*2,h*2,h]}};jsPlumb.Endpoints.Rectangle=function(e){this.type="Rectangle";var d=this;e=e||{};this.width=e.width||20;this.height=e.height||20;this.compute=function(l,h,n,k){var i=n.width||d.width,g=n.height||d.height,f=l[0]-(i/2),m=l[1]-(g/2);return[f,m,i,g]}};var b=function(f){jsPlumb.DOMElementComponent.apply(this,arguments);var d=this;var e=[];this.getDisplayElements=function(){return e};this.appendDisplayElement=function(g){e.push(g)}};jsPlumb.Endpoints.Image=function(i){this.type="Image";b.apply(this,arguments);var n=this,h=false,g=false,f=i.width,e=i.height,l=null,d=i.endpoint;this.img=new Image();n.ready=false;this.img.onload=function(){n.ready=true;f=f||n.img.width;e=e||n.img.height;if(l){l(n)}};d.setImage=function(o,q){var p=o.constructor==String?o:o.src;l=q;n.img.src=o;if(n.canvas!=null){n.canvas.setAttribute("src",o)}};d.setImage(i.src||i.url,i.onload);this.compute=function(q,o,r,p){n.anchorPoint=q;if(n.ready){return[q[0]-f/2,q[1]-e/2,f,e]}else{return[0,0,0,0]}};n.canvas=document.createElement("img"),h=false;n.canvas.style.margin=0;n.canvas.style.padding=0;n.canvas.style.outline=0;n.canvas.style.position="absolute";var k=i.cssClass?" "+i.cssClass:"";n.canvas.className=jsPlumb.endpointClass+k;if(f){n.canvas.setAttribute("width",f)}if(e){n.canvas.setAttribute("height",e)}jsPlumb.appendElement(n.canvas,i.parent);n.attachListeners(n.canvas,n);n.cleanup=function(){g=true};var m=function(r,q,p){if(!g){if(!h){n.canvas.setAttribute("src",n.img.src);n.appendDisplayElement(n.canvas);h=true}var o=n.anchorPoint[0]-(f/2),s=n.anchorPoint[1]-(e/2);jsPlumb.sizeCanvas(n.canvas,o,s,f,e)}};this.paint=function(q,p,o){if(n.ready){m(q,p,o)}else{window.setTimeout(function(){n.paint(q,p,o)},200)}}};jsPlumb.Endpoints.Blank=function(e){var d=this;this.type="Blank";b.apply(this,arguments);this.compute=function(h,f,i,g){return[h[0],h[1],10,0]};d.canvas=document.createElement("div");d.canvas.style.display="block";d.canvas.style.width="1px";d.canvas.style.height="1px";d.canvas.style.background="transparent";d.canvas.style.position="absolute";d.canvas.className=d._jsPlumb.endpointClass;jsPlumb.appendElement(d.canvas,e.parent);this.paint=function(h,g,f){jsPlumb.sizeCanvas(d.canvas,h[0],h[1],h[2],h[3])}};jsPlumb.Endpoints.Triangle=function(d){this.type="Triangle";d=d||{};d.width=d.width||55;d.height=d.height||55;this.width=d.width;this.height=d.height;this.compute=function(k,g,m,i){var h=m.width||self.width,f=m.height||self.height,e=k[0]-(h/2),l=k[1]-(f/2);return[e,l,h,f]}};var c=function(f){var e=true,d=this;this.isAppendedAtTopLevel=true;this.component=f.component;this.loc=f.location==null?0.5:f.location;this.endpointLoc=f.endpointLocation==null?[0.5,0.5]:f.endpointLocation;this.setVisible=function(g){e=g;d.component.repaint()};this.isVisible=function(){return e};this.hide=function(){d.setVisible(false)};this.show=function(){d.setVisible(true)};this.incrementLocation=function(g){d.loc+=g;d.component.repaint()};this.setLocation=function(g){d.loc=g;d.component.repaint()};this.getLocation=function(){return d.loc}};jsPlumb.Overlays.Arrow=function(h){this.type="Arrow";c.apply(this,arguments);this.isAppendedAtTopLevel=false;h=h||{};var e=this;this.length=h.length||20;this.width=h.width||20;this.id=h.id;var g=(h.direction||1)<0?-1:1,f=h.paintStyle||{lineWidth:1},d=h.foldback||0.623;this.computeMaxSize=function(){return e.width*1.5};this.cleanup=function(){};this.draw=function(m,s,w){var y,A,u,t,k;if(m.pointAlongPathFrom){if(jsPlumbUtil.isString(e.loc)||e.loc>1||e.loc<0){var v=parseInt(e.loc);y=m.pointAlongPathFrom(v,g*e.length/2,true),A=m.pointOnPath(v,true),u=jsPlumbUtil.pointOnLine(y,A,e.length)}else{if(e.loc==1){y=m.pointOnPath(e.loc);A=m.pointAlongPathFrom(e.loc,-1);u=jsPlumbUtil.pointOnLine(y,A,e.length);if(g==-1){var B=u;u=y;y=B}}else{if(e.loc==0){u=m.pointOnPath(e.loc);A=m.pointAlongPathFrom(e.loc,1);y=jsPlumbUtil.pointOnLine(u,A,e.length);if(g==-1){var B=u;u=y;y=B}}else{y=m.pointAlongPathFrom(e.loc,g*e.length/2),A=m.pointOnPath(e.loc),u=jsPlumbUtil.pointOnLine(y,A,e.length)}}}t=jsPlumbUtil.perpendicularLineTo(y,u,e.width);k=jsPlumbUtil.pointOnLine(y,u,d*e.length);var q=Math.min(y.x,t[0].x,t[1].x),p=Math.max(y.x,t[0].x,t[1].x),o=Math.min(y.y,t[0].y,t[1].y),n=Math.max(y.y,t[0].y,t[1].y);var z={hxy:y,tail:t,cxy:k},x=f.strokeStyle||s.strokeStyle,r=f.fillStyle||s.strokeStyle,i=f.lineWidth||s.lineWidth;e.paint(m,z,i,x,r,w);return[q,p,o,n]}else{return[0,0,0,0]}}};jsPlumb.Overlays.PlainArrow=function(e){e=e||{};var d=jsPlumb.extend(e,{foldback:1});jsPlumb.Overlays.Arrow.call(this,d);this.type="PlainArrow"};jsPlumb.Overlays.Diamond=function(f){f=f||{};var d=f.length||40,e=jsPlumb.extend(f,{length:d/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,e);this.type="Diamond"};var a=function(i){jsPlumb.DOMElementComponent.apply(this,arguments);c.apply(this,arguments);var d=this,e=false;i=i||{};this.id=i.id;var l;var h=function(){l=i.create(i.component);l=jsPlumb.CurrentLibrary.getDOMElement(l);l.style.position="absolute";var m=i._jsPlumb.overlayClass+" "+(d.cssClass?d.cssClass:i.cssClass?i.cssClass:"");l.className=m;jsPlumb.appendElement(l,i.component.parent);i._jsPlumb.getId(l);d.attachListeners(l,d);d.canvas=l};this.getElement=function(){if(l==null){h()}return l};this.getDimensions=function(){return jsPlumb.CurrentLibrary.getSize(jsPlumb.CurrentLibrary.getElementObject(d.getElement()))};var f=null,k=function(m){if(f==null){f=d.getDimensions()}return f};this.clearCachedDimensions=function(){f=null};this.computeMaxSize=function(){var m=k();return Math.max(m[0],m[1])};var g=d.setVisible;d.setVisible=function(m){g(m);l.style.display=m?"block":"none"};this.cleanup=function(){if(l!=null){jsPlumb.CurrentLibrary.removeElement(l)}};this.paint=function(m,o,n){if(!e){d.getElement();m.appendDisplayElement(l);d.attachListeners(l,m);e=true}l.style.left=(n[0]+o.minx)+"px";l.style.top=(n[1]+o.miny)+"px"};this.draw=function(n,o,p){var t=k();if(t!=null&&t.length==2){var q={x:0,y:0};if(n.pointOnPath){var r=d.loc,s=false;if(jsPlumbUtil.isString(d.loc)||d.loc<0||d.loc>1){r=parseInt(d.loc);s=true}q=n.pointOnPath(r,s)}else{var m=d.loc.constructor==Array?d.loc:d.endpointLoc;q={x:m[0]*p[2],y:m[1]*p[3]}}minx=q.x-(t[0]/2),miny=q.y-(t[1]/2);d.paint(n,{minx:minx,miny:miny,td:t,cxy:q},p);return[minx,minx+t[0],miny,miny+t[1]]}else{return[0,0,0,0]}};this.reattachListeners=function(m){if(l){d.reattachListenersForElement(l,d,m)}}};jsPlumb.Overlays.Custom=function(d){this.type="Custom";a.apply(this,arguments)};jsPlumb.Overlays.Label=function(h){var d=this;this.labelStyle=h.labelStyle||jsPlumb.Defaults.LabelStyle;this.cssClass=this.labelStyle!=null?this.labelStyle.cssClass:null;h.create=function(){return document.createElement("div")};jsPlumb.Overlays.Custom.apply(this,arguments);this.type="Label";var f=h.label||"",d=this,g=null;this.setLabel=function(k){f=k;g=null;d.clearCachedDimensions();e();d.component.repaint()};var e=function(){if(typeof f=="function"){var k=f(d);d.getElement().innerHTML=k.replace(/\r\n/g,"
")}else{if(g==null){g=f;d.getElement().innerHTML=g.replace(/\r\n/g,"
")}}};this.getLabel=function(){return f};var i=this.getDimensions;this.getDimensions=function(){e();return i()}}})();(function(){var c=function(e,g,d,f){this.m=(f-g)/(d-e);this.b=-1*((this.m*e)-g);this.rectIntersect=function(q,p,s,o){var n=[];var k=(p-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*(q+s))+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}var k=((p+o)-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*q)+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}if(n.length==2){var m=(n[0][0]+n[1][0])/2,l=(n[0][1]+n[1][1])/2;n.push([m,l]);var i=m<=q+(s/2)?-1:1,r=l<=p+(o/2)?-1:1;n.push([i,r]);return n}return null}},a=function(e,g,d,f){if(e<=d&&f<=g){return 1}else{if(e<=d&&g<=f){return 2}else{if(d<=e&&f>=g){return 3}}}return 4},b=function(g,f,i,e,h,m,l,d,k){if(d<=k){return[g,f]}if(i==1){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==2){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}else{if(i==3){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==4){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}}}}};jsPlumb.Connectors.StateMachine=function(l){var u=this,n=null,o,m,g,e,p=[],d=l.curviness||10,k=l.margin||5,q=l.proximityLimit||80,f=l.orientation&&l.orientation=="clockwise",i=l.loopbackRadius||25,h=false,t=l.showLoopback!==false;this.type="StateMachine";l=l||{};this.compute=function(ad,H,W,I,ac,z,v,U){var Q=Math.abs(ad[0]-H[0]),Y=Math.abs(ad[1]-H[1]),S=0.45*Q,ab=0.45*Y;Q*=1.9;Y*=1.9;v=v||1;var O=Math.min(ad[0],H[0])-S,M=Math.min(ad[1],H[1])-ab;if(!t||(W.elementId!=I.elementId)){h=false;o=ad[0]0?0:1,v)}return v};this.pointOnPath=function(x,B){if(h){if(B){var y=Math.PI*2*i;x=x/y}if(x>0&&x<1){x=1-x}var z=(x*2*Math.PI)+(Math.PI/2),w=n[4]+(n[6]*Math.cos(z)),v=n[5]+(n[6]*Math.sin(z));return{x:w,y:v}}else{var A=r();x=s(A,x,B);return jsBezier.pointOnCurve(A,x)}};this.gradientAtPoint=function(v,y){if(h){if(y){var w=Math.PI*2*i;v=v/w}return Math.atan(v*2*Math.PI)}else{var x=r();v=s(x,v,y);return jsBezier.gradientAtPoint(x,v)}};this.pointAlongPathFrom=function(D,v,C){if(h){if(C){var B=Math.PI*2*i;D=D/B}if(D>0&&D<1){D=1-D}var B=2*Math.PI*n[6],w=v/B*2*Math.PI,z=(D*2*Math.PI)-w+(Math.PI/2),y=n[4]+(n[6]*Math.cos(z)),x=n[5]+(n[6]*Math.sin(z));return{x:y,y:x}}else{var A=r();D=s(A,D,C);return jsBezier.pointAlongCurveFrom(A,D,v)}}};jsPlumb.Connectors.canvas.StateMachine=function(f){f=f||{};var d=this,g=f.drawGuideline||true,e=f.avoidSelector;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.CanvasConnector.apply(this,arguments);this._paint=function(l){if(l.length==10){d.ctx.beginPath();d.ctx.moveTo(l[4],l[5]);d.ctx.bezierCurveTo(l[8],l[9],l[8],l[9],l[6],l[7]);d.ctx.stroke()}else{d.ctx.save();d.ctx.beginPath();var k=0,i=2*Math.PI,h=l[7];d.ctx.arc(l[4],l[5],l[6],0,i,h);d.ctx.stroke();d.ctx.closePath();d.ctx.restore()}};this.createGradient=function(i,h){return h.createLinearGradient(i[4],i[5],i[6],i[7])}};jsPlumb.Connectors.svg.StateMachine=function(){var d=this;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.SvgConnector.apply(this,arguments);this.getPath=function(e){if(e.length==10){return"M "+e[4]+" "+e[5]+" C "+e[8]+" "+e[9]+" "+e[8]+" "+e[9]+" "+e[6]+" "+e[7]}else{return"M"+(e[8]+4)+" "+e[9]+" A "+e[6]+" "+e[6]+" 0 1,0 "+(e[8]-4)+" "+e[9]}}};jsPlumb.Connectors.vml.StateMachine=function(){jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.VmlConnector.apply(this,arguments);var d=jsPlumb.vml.convertValue;this.getPath=function(k){if(k.length==10){return"m"+d(k[4])+","+d(k[5])+" c"+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+","+d(k[6])+","+d(k[7])+" e"}else{var h=d(k[8]-k[6]),g=d(k[9]-(2*k[6])),f=h+d(2*k[6]),e=g+d(2*k[6]),l=h+","+g+","+f+","+e;var i="ar "+l+","+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+" e";return i}}}})();(function(){var h={"stroke-linejoin":"joinstyle",joinstyle:"joinstyle",endcap:"endcap",miterlimit:"miterlimit"},c=null;if(document.createStyleSheet&&document.namespaces){var m=[".jsplumb_vml","jsplumb\\:textbox","jsplumb\\:oval","jsplumb\\:rect","jsplumb\\:stroke","jsplumb\\:shape","jsplumb\\:group"],g="behavior:url(#default#VML);position:absolute;";c=document.createStyleSheet();for(var r=0;rF?1:-1:0,K=N?Q>P?1:-1:0,O=D.lineWidth/2;G=G+" L "+H+" "+Q;G=G+" L "+(H+(L*O))+" "+(Q+(K*O));J=H;I=Q;G=G+" M "+H+" "+Q}G=G+" L "+E[6]+","+E[7];return G}};var y=window.SvgEndpoint=function(E){var D=this;s.apply(this,[{cssClass:E._jsPlumb.endpointClass,originalArgs:arguments,pointerEventsSpec:"all",useDivWrapper:true,_jsPlumb:E._jsPlumb}]);this._paint=function(H,G){var F=jsPlumb.extend({},G);if(F.outlineColor){F.strokeWidth=F.outlineWidth;F.strokeStyle=jsPlumbUtil.convertStyle(F.outlineColor,true)}if(D.node==null){D.node=D.makeNode(H,F);D.svg.appendChild(D.node);D.attachListeners(D.node,D)}x(D.svg,D.node,F,H,D);n(D.node,H)};this.reattachListeners=function(){if(D.node){D.reattachListenersForElement(D.node,D)}}};jsPlumb.Endpoints.svg.Dot=function(){jsPlumb.Endpoints.Dot.apply(this,arguments);y.apply(this,arguments);this.makeNode=function(E,D){return f("circle",{cx:E[2]/2,cy:E[3]/2,r:E[2]/2})}};jsPlumb.Endpoints.svg.Rectangle=function(){jsPlumb.Endpoints.Rectangle.apply(this,arguments);y.apply(this,arguments);this.makeNode=function(E,D){return f("rect",{width:E[2],height:E[3]})}};jsPlumb.Endpoints.svg.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.svg.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Overlays.svg.Label=jsPlumb.Overlays.Label;jsPlumb.Overlays.svg.Custom=jsPlumb.Overlays.Custom;var p=function(H,F){H.apply(this,F);jsPlumb.jsPlumbUIComponent.apply(this,F);this.isAppendedAtTopLevel=false;var D=this,G=null;this.paint=function(J,M,I,N,K){if(G==null){G=f("path",{"pointer-events":"all"});J.svg.appendChild(G);D.attachListeners(G,J);D.attachListeners(G,D)}var L=F&&(F.length==1)?(F[0].cssClass||""):"";g(G,{d:E(M),"class":L,stroke:N?N:null,fill:K?K:null})};var E=function(I){return"M"+I.hxy.x+","+I.hxy.y+" L"+I.tail[0].x+","+I.tail[0].y+" L"+I.cxy.x+","+I.cxy.y+" L"+I.tail[1].x+","+I.tail[1].y+" L"+I.hxy.x+","+I.hxy.y};this.reattachListeners=function(){if(G){D.reattachListenersForElement(G,D)}};this.cleanup=function(){if(G!=null){jsPlumb.CurrentLibrary.removeElement(G)}}};jsPlumb.Overlays.svg.Arrow=function(){p.apply(this,[jsPlumb.Overlays.Arrow,arguments])};jsPlumb.Overlays.svg.PlainArrow=function(){p.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])};jsPlumb.Overlays.svg.Diamond=function(){p.apply(this,[jsPlumb.Overlays.Diamond,arguments])};jsPlumb.Overlays.svg.GuideLines=function(){var I=null,D=this,H=null,G,F;jsPlumb.Overlays.GuideLines.apply(this,arguments);this.paint=function(K,M,J,N,L){if(I==null){I=f("path");K.svg.appendChild(I);D.attachListeners(I,K);D.attachListeners(I,D);G=f("path");K.svg.appendChild(G);D.attachListeners(G,K);D.attachListeners(G,D);F=f("path");K.svg.appendChild(F);D.attachListeners(F,K);D.attachListeners(F,D)}g(I,{d:E(M[0],M[1]),stroke:"red",fill:null});g(G,{d:E(M[2][0],M[2][1]),stroke:"blue",fill:null});g(F,{d:E(M[3][0],M[3][1]),stroke:"green",fill:null})};var E=function(K,J){return"M "+K.x+","+K.y+" L"+J.x+","+J.y}}})();(function(){var d=null,i=function(p,o){return jsPlumb.CurrentLibrary.hasClass(a(p),o)},a=function(o){return jsPlumb.CurrentLibrary.getElementObject(o)},m=function(o){return jsPlumb.CurrentLibrary.getOffset(a(o))},n=function(o){return jsPlumb.CurrentLibrary.getPageXY(o)},f=function(o){return jsPlumb.CurrentLibrary.getClientXY(o)};var k=function(){var q=this;q.overlayPlacements=[];jsPlumb.jsPlumbUIComponent.apply(this,arguments);jsPlumbUtil.EventGenerator.apply(this,arguments);this._over=function(z){var B=m(a(q.canvas)),D=n(z),u=D[0]-B.left,C=D[1]-B.top;if(u>0&&C>0&&u=u&&w[2]<=C&&w[3]>=C)){return true}}var A=q.canvas.getContext("2d").getImageData(parseInt(u),parseInt(C),1,1);return A.data[0]!=0||A.data[1]!=0||A.data[2]!=0||A.data[3]!=0}return false};var p=false,o=false,t=null,s=false,r=function(v,u){return v!=null&&i(v,u)};this.mousemove=function(x){var z=n(x),w=f(x),v=document.elementFromPoint(w[0],w[1]),y=r(v,"_jsPlumb_overlay");var u=d==null&&(r(v,"_jsPlumb_endpoint")||r(v,"_jsPlumb_connector"));if(!p&&u&&q._over(x)){p=true;q.fire("mouseenter",q,x);return true}else{if(p&&(!q._over(x)||!u)&&!y){p=false;q.fire("mouseexit",q,x)}}q.fire("mousemove",q,x)};this.click=function(u){if(p&&q._over(u)&&!s){q.fire("click",q,u)}s=false};this.dblclick=function(u){if(p&&q._over(u)&&!s){q.fire("dblclick",q,u)}s=false};this.mousedown=function(u){if(q._over(u)&&!o){o=true;t=m(a(q.canvas));q.fire("mousedown",q,u)}};this.mouseup=function(u){o=false;q.fire("mouseup",q,u)};this.contextmenu=function(u){if(p&&q._over(u)&&!s){q.fire("contextmenu",q,u)}s=false}};var c=function(p){var o=document.createElement("canvas");p._jsPlumb.appendElement(o,p.parent);o.style.position="absolute";if(p["class"]){o.className=p["class"]}p._jsPlumb.getId(o,p.uuid);if(p.tooltip){o.setAttribute("title",p.tooltip)}return o};var l=function(p){k.apply(this,arguments);var o=[];this.getDisplayElements=function(){return o};this.appendDisplayElement=function(q){o.push(q)}};var h=jsPlumb.CanvasConnector=function(r){l.apply(this,arguments);var o=function(v,t){p.ctx.save();jsPlumb.extend(p.ctx,t);if(t.gradient){var u=p.createGradient(v,p.ctx);for(var s=0;s0?c[0].tagName:null},getUIPosition:function(c,d){d=d||1;if(c.length==1){ret={left:c[0].pageX,top:c[0].pageY}}else{var e=c[1],b=e.offset;ret=b||e.absolutePosition;e.position.left/=d;e.position.top/=d}return{left:ret.left/d,top:ret.top/d}},hasClass:function(c,b){return c.hasClass(b)},initDraggable:function(c,b,d){b=b||{};b.helper=null;if(d){b.scope=b.scope||jsPlumb.Defaults.Scope}c.draggable(b)},initDroppable:function(c,b){b.scope=b.scope||jsPlumb.Defaults.Scope;c.droppable(b)},isAlreadyDraggable:function(b){b=jsPlumb.CurrentLibrary.getElementObject(b);return b.hasClass("ui-draggable")},isDragSupported:function(c,b){return c.draggable},isDropSupported:function(c,b){return c.droppable},removeClass:function(c,b){c=jsPlumb.CurrentLibrary.getElementObject(c);try{if(c[0].className.constructor==SVGAnimatedString){jsPlumbUtil.svg.removeClass(c[0],b)}}catch(d){}c.removeClass(b)},removeElement:function(b,c){jsPlumb.CurrentLibrary.getElementObject(b).remove()},setAttribute:function(c,d,b){c.attr(d,b)},setDraggable:function(c,b){c.draggable("option","disabled",!b)},setDragScope:function(c,b){c.draggable("option","scope",b)},setOffset:function(b,c){jsPlumb.CurrentLibrary.getElementObject(b).offset(c)},trigger:function(d,e,b){var c=jQuery._data(jsPlumb.CurrentLibrary.getElementObject(d)[0],"handle");c(b)},unbind:function(b,c,d){b=jsPlumb.CurrentLibrary.getElementObject(b);b.unbind(c,d)}};a(document).ready(jsPlumb.init)})(jQuery);(function(){"undefined"==typeof Math.sgn&&(Math.sgn=function(l){return 0==l?0:0=64){x[0]=(C[0].x+C[B].x)/2;return 1}var p,u=C[0].y-C[B].y;y=C[B].x-C[0].x;q=C[0].x*C[B].y-C[B].x*C[0].y;s=max_distance_below=0;for(p=1;ps?s=r:r0?1:-1,r=null;n1){l.location=1}if(l.location<0){l.location=0}return i(m,l.location)},nearestPointOnCurve:function(m,l){var n=h(m,l);return{point:k(l,l.length-1,n.location,null,null),location:n.location}},pointOnCurve:c,pointAlongCurveFrom:function(m,l,n){return b(m,l,n).point},perpendicularToCurveAt:function(m,l,n,o){l=b(m,l,o==null?0:o);m=i(m,l.location);o=Math.atan(-1/m);m=n/2*Math.sin(o);n=n/2*Math.cos(o);return[{x:l.point.x+n,y:l.point.y+m},{x:l.point.x-n,y:l.point.y-m}]},locationAlongCurveFrom:function(m,l,n){return b(m,l,n).location}}})();