yui.jsPlumb-1.3.7-all-min.js 113 KB

1
  1. (function(){var w=!!document.createElement("canvas").getContext,e=!!window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),b=!(w|e);var i=function(E,G){if(E){for(var F=0;F<E.length;F++){if(G(E[F])){return F}}}return -1},D=function(E,F){return i(E,function(G){return G==F})},y=function(F,G){var E=i(F,G);if(E>-1){F.splice(E,1)}return E!=-1},m=function(F,G){var E=D(F,G);if(E>-1){F.splice(E,1)}return E!=-1},r=function(G,F,E){if(i(G,E)==-1){G.push(F)}},l=function(H,F,G){var E=H[F];if(E==null){E=[],H[F]=E}E.push(G);return E};if(!window.console){window.console={time:function(){},timeEnd:function(){},group:function(){},groupEnd:function(){},log:function(){}}}var u=null,d=function(E,F){return o.CurrentLibrary.getAttribute(A(E),F)},f=function(F,G,E){o.CurrentLibrary.setAttribute(A(F),G,E)},x=function(F,E){o.CurrentLibrary.addClass(A(F),E)},k=function(F,E){return o.CurrentLibrary.hasClass(A(F),E)},n=function(F,E){o.CurrentLibrary.removeClass(A(F),E)},A=function(E){return o.CurrentLibrary.getElementObject(E)},s=function(E){return o.CurrentLibrary.getOffset(A(E))},a=function(E){return o.CurrentLibrary.getSize(A(E))},z=true,p=function(){if(z&&typeof console!="undefined"){try{var F=arguments[arguments.length-1];console.log(F)}catch(E){}}},C=function(E){if(z&&typeof console!="undefined"){console.group(E)}},h=function(E){if(z&&typeof console!="undefined"){console.groupEnd(E)}},B=function(E){if(z&&typeof console!="undefined"){console.time(E)}},t=function(E){if(z&&typeof console!="undefined"){console.timeEnd(E)}};EventGenerator=function(){var G={},F=this;var E=["ready"];this.bind=function(H,I){l(G,H,I)};this.fire=function(J,K,H){if(G[J]){for(var I=0;I<G[J].length;I++){if(i(E,function(M){return M===J})!=-1){G[J][I](K,H)}else{try{G[J][I](K,H)}catch(L){p("jsPlumb: fire failed for event "+J+" : "+L)}}}}};this.clearListeners=function(H){if(H){delete G[H]}else{delete G;G={}}};this.getListener=function(H){return G[H]}},_timestamp=function(){return""+(new Date()).getTime()},jsPlumbUIComponent=function(I){var T=this,P=arguments,N=false,R=I.parameters||{},F=T.idPrefix,H=F+(new Date()).getTime();T._jsPlumb=I._jsPlumb;T.getId=function(){return H};T.tooltip=I.tooltip;T.hoverClass=I.hoverClass;EventGenerator.apply(this);this.clone=function(){var U=new Object();T.constructor.apply(U,P);return U};this.getParameter=function(U){return R[U]},this.getParameters=function(){return R},this.setParameter=function(U,V){R[U]=V},this.setParameters=function(U){R=U},this.overlayPlacements=[],this.paintStyle=null,this.hoverPaintStyle=null;var J=I.beforeDetach;this.isDetachAllowed=function(U){var V=T._jsPlumb.checkCondition("beforeDetach",U);if(J){try{V=J(U)}catch(W){p("jsPlumb: beforeDetach callback failed",W)}}return V};var L=I.beforeDrop;this.isDropAllowed=function(X,U,V){var W=T._jsPlumb.checkCondition("beforeDrop",{sourceId:X,targetId:U,scope:V});if(L){try{W=L({sourceId:X,targetId:U,scope:V})}catch(Y){p("jsPlumb: beforeDrop callback failed",Y)}}return W};var Q=function(){if(T.paintStyle&&T.hoverPaintStyle){var U={};o.extend(U,T.paintStyle);o.extend(U,T.hoverPaintStyle);delete T.hoverPaintStyle;if(U.gradient&&T.paintStyle.fillStyle){delete U.gradient}T.hoverPaintStyle=U}};this.setPaintStyle=function(U,V){T.paintStyle=U;T.paintStyleInUse=T.paintStyle;Q();if(!V){T.repaint()}};this.setHoverPaintStyle=function(U,V){T.hoverPaintStyle=U;Q();if(!V){T.repaint()}};this.setHover=function(U,W,V){if(!T._jsPlumb.currentlyDragging&&!T._jsPlumb.isHoverSuspended()){N=U;if(T.hoverClass!=null&&T.canvas!=null){if(U){K.addClass(T.canvas,T.hoverClass)}else{K.removeClass(T.canvas,T.hoverClass)}}if(T.hoverPaintStyle!=null){T.paintStyleInUse=U?T.hoverPaintStyle:T.paintStyle;V=V||_timestamp();T.repaint({timestamp:V,recalc:false})}if(T.getAttachedElements&&!W){O(U,_timestamp(),T)}}};this.isHover=function(){return N};var K=o.CurrentLibrary,S=["click","dblclick","mouseenter","mouseout","mousemove","mousedown","mouseup","contextmenu"],M={mouseout:"mouseexit"},G=function(W,X,V){var U=M[V]||V;K.bind(W,V,function(Y){X.fire(U,X,Y)})},E=function(W,V){var U=M[V]||V;K.unbind(W,V)};this.attachListeners=function(V,W){for(var U=0;U<S.length;U++){G(V,W,S[U])}};var O=function(Y,X,U){var W=T.getAttachedElements();if(W){for(var V=0;V<W.length;V++){if(!U||U!=W[V]){W[V].setHover(Y,true,X)}}}};this.reattachListenersForElement=function(V){if(arguments.length>1){for(var U=0;U<S.length;U++){E(V,S[U])}for(var U=1;U<arguments.length;U++){T.attachListeners(V,arguments[U])}}}},overlayCapableJsPlumbUIComponent=function(J){jsPlumbUIComponent.apply(this,arguments);var O=this;this.overlays=[];var H=function(T){var R=null;if(T.constructor==Array){var Q=T[0],S=o.extend({component:O,_jsPlumb:O._jsPlumb},T[1]);if(T.length==3){o.extend(S,T[2])}R=new o.Overlays[O._jsPlumb.getRenderMode()][Q](S);if(S.events){for(var P in S.events){R.bind(P,S.events[P])}}}else{if(T.constructor==String){R=new o.Overlays[O._jsPlumb.getRenderMode()][T]({component:O,_jsPlumb:O._jsPlumb})}else{R=T}}O.overlays.push(R)},I=function(T){var P=O.defaultOverlayKeys||[],S=T.overlays,Q=function(U){return O._jsPlumb.Defaults[U]||o.Defaults[U]||[]};if(!S){S=[]}for(var R=0;R<P.length;R++){S.unshift.apply(S,Q(P[R]))}return S};var F=I(J);if(F){for(var K=0;K<F.length;K++){H(F[K])}}var E=function(R){var P=-1;for(var Q=0;Q<O.overlays.length;Q++){if(R===O.overlays[Q].id){P=Q;break}}return P};this.addOverlay=function(P){H(P);O.repaint()};this.getOverlay=function(Q){var P=E(Q);return P>=0?O.overlays[P]:null};this.getOverlays=function(){return O.overlays};this.hideOverlay=function(Q){var P=O.getOverlay(Q);if(P){P.hide()}};this.hideOverlays=function(){for(var P=0;P<O.overlays.length;P++){O.overlays[P].hide()}};this.showOverlay=function(Q){var P=O.getOverlay(Q);if(P){P.show()}};this.showOverlays=function(){for(var P=0;P<O.overlays.length;P++){O.overlays[P].show()}};this.removeAllOverlays=function(){O.overlays.splice(0,O.overlays.length);O.repaint()};this.removeOverlay=function(Q){var P=E(Q);if(P!=-1){var R=O.overlays[P];R.cleanup();O.overlays.splice(P,1)}};this.removeOverlays=function(){for(var P=0;P<arguments.length;P++){O.removeOverlay(arguments[P])}};var G="__label",N=function(R){var P={cssClass:R.cssClass,labelStyle:this.labelStyle,id:G,component:O,_jsPlumb:O._jsPlumb},Q=o.extend(P,R);return new o.Overlays[O._jsPlumb.getRenderMode()].Label(Q)};if(J.label){var L=J.labelLocation||O.defaultLabelLocation||0.5,M=J.labelStyle||O._jsPlumb.Defaults.LabelStyle||o.Defaults.LabelStyle;this.overlays.push(N({label:J.label,location:L,labelStyle:M}))}this.setLabel=function(P){var Q=O.getOverlay(G);if(!Q){var R=P.constructor==String||P.constructor==Function?{label:P}:P;Q=N(R);this.overlays.push(Q)}else{if(P.constructor==String||P.constructor==Function){Q.setLabel(P)}else{if(P.label){Q.setLabel(P.label)}if(P.location){Q.setLocation(P.location)}}}O.repaint()};this.getLabel=function(){var P=O.getOverlay(G);return P!=null?P.getLabel():null};this.getLabelOverlay=function(){return O.getOverlay(G)}},_bindListeners=function(G,E,F){G.bind("click",function(H,I){E.fire("click",E,I)});G.bind("dblclick",function(H,I){E.fire("dblclick",E,I)});G.bind("contextmenu",function(H,I){E.fire("contextmenu",E,I)});G.bind("mouseenter",function(H,I){if(!E.isHover()){F(true);E.fire("mouseenter",E,I)}});G.bind("mouseexit",function(H,I){if(E.isHover()){F(false);E.fire("mouseexit",E,I)}})};var g=0,c=function(){var E=g+1;g++;return E};var v=function(F){this.Defaults={Anchor:"BottomCenter",Anchors:[null,null],ConnectionsDetachable:true,ConnectionOverlays:[],Connector:"Bezier",Container:null,DragOptions:{},DropOptions:{},Endpoint:"Dot",EndpointOverlays:[],Endpoints:[null,null],EndpointStyle:{fillStyle:"#456"},EndpointStyles:[null,null],EndpointHoverStyle:null,EndpointHoverStyles:[null,null],HoverPaintStyle:null,LabelStyle:{color:"black"},LogEnabled:false,Overlays:[],MaxConnections:1,PaintStyle:{lineWidth:8,strokeStyle:"#456"},RenderMode:"svg",Scope:"jsPlumb_DefaultScope"};if(F){o.extend(this.Defaults,F)}this.logEnabled=this.Defaults.LogEnabled;EventGenerator.apply(this);var bc=this,aB=c(),aD=bc.bind,ar={};for(var aq in this.Defaults){ar[aq]=this.Defaults[aq]}this.bind=function(bl,bk){if("ready"===bl&&G){bk()}else{aD.apply(bc,[bl,bk])}};bc.importDefaults=function(bl){for(var bk in bl){bc.Defaults[bk]=bl[bk]}};bc.restoreDefaults=function(){bc.Defaults=o.extend({},ar)};var I=null,ah=function(){o.repaintEverything()},be=true,aE=function(){if(be){ah()}},a3=null,G=false,aN={},aI={},aJ={},Z={},bg={},a4={},bb={},bj=[],W=[],J=this.Defaults.Scope,Q=null,O=function(bn,bl,bm){var bk=bn[bl];if(bk==null){bk=[];bn[bl]=bk}bk.push(bm);return bk},aL=function(bl,bk){if(bc.Defaults.Container){o.CurrentLibrary.appendElement(bl,bc.Defaults.Container)}else{if(!bk){document.body.appendChild(bl)}else{o.CurrentLibrary.appendElement(bl,bk)}}},at=1,ab=function(){return""+at++},ay=function(bk){return bk._nodes?bk._nodes:bk},aV=false,a5=function(bl,bk){aV=bl;if(bk){bc.repaintEverything()}},aZ=function(bm,bo,bn){if(!aV){var bp=d(bm,"id"),bk=bc.dragManager.getElementsForDraggable(bp);if(bn==null){bn=_timestamp()}bc.anchorManager.redraw(bp,bo,bn);if(bk){for(var bl in bk){bc.anchorManager.redraw(bk[bl].id,bo,bn,bk[bl].offset)}}}},aw=function(bl,bn){var bo=null;if(bl.constructor==Array){bo=[];for(var bk=0;bk<bl.length;bk++){var bm=A(bl[bk]),bp=d(bm,"id");bo.push(bn(bm,bp))}}else{var bm=A(bl),bp=d(bm,"id");bo=bn(bm,bp)}return bo},ak=function(bk){return aJ[bk]},a0=function(bn,bk,bq){var bs=bk==null?false:bk,bo=o.CurrentLibrary;if(bs){if(bo.isDragSupported(bn)&&!bo.isAlreadyDraggable(bn)){var br=bq||bc.Defaults.DragOptions||o.Defaults.DragOptions;br=o.extend({},br);var bp=bo.dragEvents.drag,bl=bo.dragEvents.stop,bm=bo.dragEvents.start;br[bp]=ad(br[bp],function(){var bt=bo.getUIPosition(arguments);aZ(bn,bt);x(bn,"jsPlumb_dragged")});br[bl]=ad(br[bl],function(){var bt=bo.getUIPosition(arguments);aZ(bn,bt);n(bn,"jsPlumb_dragged")});bb[E(bn)]=true;var bs=bb[E(bn)];br.disabled=bs==null?false:!bs;bo.initDraggable(bn,br,false);bc.dragManager.register(bn)}}},ap=function(bq,bl){var bk=o.extend({},bq);if(bl){o.extend(bk,bl)}if(bk.source&&bk.source.endpoint){bk.sourceEndpoint=bk.source}if(bk.source&&bk.target.endpoint){bk.targetEndpoint=bk.target}if(bq.uuids){bk.sourceEndpoint=ak(bq.uuids[0]);bk.targetEndpoint=ak(bq.uuids[1])}if(bk.sourceEndpoint&&bk.sourceEndpoint.isFull()){p(bc,"could not add connection; source endpoint is full");return}if(bk.targetEndpoint&&bk.targetEndpoint.isFull()){p(bc,"could not add connection; target endpoint is full");return}if(bk.sourceEndpoint&&bk.sourceEndpoint.connectorOverlays){bk.overlays=bk.overlays||[];for(var bo=0;bo<bk.sourceEndpoint.connectorOverlays.length;bo++){bk.overlays.push(bk.sourceEndpoint.connectorOverlays[bo])}}bk.tooltip=bq.tooltip;if(!bk.tooltip&&bk.sourceEndpoint&&bk.sourceEndpoint.connectorTooltip){bk.tooltip=bk.sourceEndpoint.connectorTooltip}if(bk.target&&!bk.target.endpoint&&!bk.targetEndpoint&&!bk.newConnection){var bp=E(bk.target),br=aO[bp],bm=ax[bp];if(br){var bn=bm!=null?bm:bc.addEndpoint(bk.target,br);if(a6[bp]){ax[bp]=bn}bk.targetEndpoint=bn}}if(bk.source&&!bk.source.endpoint&&!bk.sourceEndpoint&&!bk.newConnection){var bp=E(bk.source),br=ao[bp],bm=aU[bp];if(br){var bn=bm!=null?bm:bc.addEndpoint(bk.source,br);if(aY[bp]){aU[bp]=bn}bk.sourceEndpoint=bn}}return bk},V=function(bo){var bn=bc.Defaults.ConnectionType||bc.getDefaultConnectionType(),bm=bc.Defaults.EndpointType||X,bl=o.CurrentLibrary.getParent;if(bo.container){bo.parent=bo.container}else{if(bo.sourceEndpoint){bo.parent=bo.sourceEndpoint.parent}else{if(bo.source.constructor==bm){bo.parent=bo.source.parent}else{bo.parent=bl(bo.source)}}}bo._jsPlumb=bc;var bk=new bn(bo);bk.id="con_"+ab();bh("click","click",bk);bh("dblclick","dblclick",bk);bh("contextmenu","contextmenu",bk);return bk},bi=function(bl,bm,bk){bm=bm||{};if(!bl.suspendedEndpoint){O(aN,bl.scope,bl)}if(!bm.doNotFireConnectionEvent&&bm.fireEvent!==false){bc.fire("jsPlumbConnection",{connection:bl,source:bl.source,target:bl.target,sourceId:bl.sourceId,targetId:bl.targetId,sourceEndpoint:bl.endpoints[0],targetEndpoint:bl.endpoints[1]},bk)}bc.anchorManager.newConnection(bl);aZ(bl.source)},bh=function(bk,bl,bm){bm.bind(bk,function(bo,bn){bc.fire(bl,bm,bn)})},al=function(bm){if(bm.container){return bm.container}else{var bk=o.CurrentLibrary.getTagName(bm.source),bl=o.CurrentLibrary.getParent(bm.source);if(bk&&bk.toLowerCase()==="td"){return o.CurrentLibrary.getParent(bl)}else{return bl}}},av=function(bm){var bl=bc.Defaults.EndpointType||X;bm.parent=al(bm);bm._jsPlumb=bc;var bk=new bl(bm);bk.id="ep_"+ab();bh("click","endpointClick",bk);bh("dblclick","endpointDblClick",bk);bh("contextmenu","contextmenu",bk);return bk},N=function(bm,bp,bo){var bk=aI[bm];if(bk&&bk.length){for(var bn=0;bn<bk.length;bn++){for(var bl=0;bl<bk[bn].connections.length;bl++){var bq=bp(bk[bn].connections[bl]);if(bq){return}}if(bo){bo(bk[bn])}}}},R=function(bl){for(var bk in aI){N(bk,bl)}},aj=function(bk,bl){if(bk!=null&&bk.parentNode!=null){bk.parentNode.removeChild(bk)}},aM=function(bm,bl){for(var bk=0;bk<bm.length;bk++){aj(bm[bk],bl)}},a9=function(bl,bk){return aw(bl,function(bm,bn){bb[bn]=bk;if(o.CurrentLibrary.isDragSupported(bm)){o.CurrentLibrary.setDraggable(bm,bk)}})},aS=function(bm,bn,bk){bn=bn==="block";var bl=null;if(bk){if(bn){bl=function(bp){bp.setVisible(true,true,true)}}else{bl=function(bp){bp.setVisible(false,true,true)}}}var bo=d(bm,"id");N(bo,function(bq){if(bn&&bk){var bp=bq.sourceId===bo?1:0;if(bq.endpoints[bp].isVisible()){bq.setVisible(true)}}else{bq.setVisible(bn)}},bl)},a7=function(bk){return aw(bk,function(bm,bl){var bn=bb[bl]==null?false:bb[bl];bn=!bn;bb[bl]=bn;o.CurrentLibrary.setDraggable(bm,bn);return bn})},aF=function(bk,bm){var bl=null;if(bm){bl=function(bn){var bo=bn.isVisible();bn.setVisible(!bo)}}N(bk,function(bo){var bn=bo.isVisible();bo.setVisible(!bn)},bl)},P=function(bp){var bn=bp.timestamp,bk=bp.recalc,bo=bp.offset,bl=bp.elId;if(!bk){if(bn&&bn===bg[bl]){return Z[bl]}}if(bk||!bo){var bm=A(bl);if(bm!=null){W[bl]=a(bm);Z[bl]=s(bm);bg[bl]=bn}}else{Z[bl]=bo;if(W[bl]==null){var bm=A(bl);if(bm!=null){W[bl]=a(bm)}}}if(Z[bl]&&!Z[bl].right){Z[bl].right=Z[bl].left+W[bl][0];Z[bl].bottom=Z[bl].top+W[bl][1];Z[bl].width=W[bl][0];Z[bl].height=W[bl][1];Z[bl].centerx=Z[bl].left+(Z[bl].width/2);Z[bl].centery=Z[bl].top+(Z[bl].height/2)}return Z[bl]},aC=function(bk){var bl=Z[bk];if(!bl){bl=P({elId:bk})}return{o:bl,s:W[bk]}},E=function(bk,bl){var bm=A(bk);var bn=d(bm,"id");if(!bn||bn=="undefined"){if(arguments.length==2&&arguments[1]!=undefined){bn=bl}else{bn="jsPlumb_"+aB+"_"+ab()}f(bm,"id",bn)}return bn},ad=function(bm,bk,bl){bm=bm||function(){};bk=bk||function(){};return function(){var bn=null;try{bn=bk.apply(this,arguments)}catch(bo){p(bc,"jsPlumb function failed : "+bo)}if(bl==null||(bn!==bl)){try{bm.apply(this,arguments)}catch(bo){p(bc,"wrapped function failed : "+bo)}}return bn}};this.connectorClass="_jsPlumb_connector";this.endpointClass="_jsPlumb_endpoint";this.overlayClass="_jsPlumb_overlay";this.Anchors={};this.Connectors={canvas:{},svg:{},vml:{}};this.Endpoints={canvas:{},svg:{},vml:{}};this.Overlays={canvas:{},svg:{},vml:{}};this.addClass=function(bl,bk){return o.CurrentLibrary.addClass(bl,bk)};this.removeClass=function(bl,bk){return o.CurrentLibrary.removeClass(bl,bk)};this.hasClass=function(bl,bk){return o.CurrentLibrary.hasClass(bl,bk)};this.addEndpoint=function(bm,bn,bw){bw=bw||{};var bl=o.extend({},bw);o.extend(bl,bn);bl.endpoint=bl.endpoint||bc.Defaults.Endpoint||o.Defaults.Endpoint;bl.paintStyle=bl.paintStyle||bc.Defaults.EndpointStyle||o.Defaults.EndpointStyle;bm=ay(bm);var bo=[],br=bm.length&&bm.constructor!=String?bm:[bm];for(var bp=0;bp<br.length;bp++){var bu=A(br[bp]),bk=E(bu);bl.source=bu;P({elId:bk});var bt=av(bl);if(bl.parentAnchor){bt.parentAnchor=bl.parentAnchor}O(aI,bk,bt);var bs=Z[bk],bq=W[bk];var bv=bt.anchor.compute({xy:[bs.left,bs.top],wh:bq,element:bt});bt.paint({anchorLoc:bv});bo.push(bt);bc.dragManager.endpointAdded(bu)}return bo.length==1?bo[0]:bo};this.addEndpoints=function(bo,bl,bk){var bn=[];for(var bm=0;bm<bl.length;bm++){var bp=bc.addEndpoint(bo,bl[bm],bk);if(bp.constructor==Array){Array.prototype.push.apply(bn,bp)}else{bn.push(bp)}}return bn};this.animate=function(bm,bl,bk){var bn=A(bm),bq=d(bm,"id");bk=bk||{};var bp=o.CurrentLibrary.dragEvents.step;var bo=o.CurrentLibrary.dragEvents.complete;bk[bp]=ad(bk[bp],function(){bc.repaint(bq)});bk[bo]=ad(bk[bo],function(){bc.repaint(bq)});o.CurrentLibrary.animate(bn,bl,bk)};this.checkCondition=function(bm,bo){var bk=bc.getListener(bm);var bn=true;if(bk&&bk.length>0){try{for(var bl=0;bl<bk.length;bl++){bn=bn&&bk[bl](bo)}}catch(bp){p(bc,"cannot check condition ["+bm+"]"+bp)}}return bn};this.connect=function(bn,bl){var bk=ap(bn,bl);if(bk){if(bk.deleteEndpointsOnDetach==null){bk.deleteEndpointsOnDetach=true}var bm=V(bk);bi(bm,bk);return bm}};this.deleteEndpoint=function(bl){var bq=(typeof bl=="string")?aJ[bl]:bl;if(bq){var bn=bq.getUuid();if(bn){aJ[bn]=null}bq.detachAll();aM(bq.endpoint.getDisplayElements());bc.anchorManager.deleteEndpoint(bq);for(var bp in aI){var bk=aI[bp];if(bk){var bo=[];for(var bm=0;bm<bk.length;bm++){if(bk[bm]!=bq){bo.push(bk[bm])}}aI[bp]=bo}}bc.dragManager.endpointDeleted(bq)}};this.deleteEveryEndpoint=function(){for(var bm in aI){var bk=aI[bm];if(bk&&bk.length){for(var bl=0;bl<bk.length;bl++){bc.deleteEndpoint(bk[bl])}}}delete aI;aI={};delete aJ;aJ={}};var aW=function(bn,bp,bk){var bm=bc.Defaults.ConnectionType||bc.getDefaultConnectionType(),bl=bn.constructor==bm,bo=bl?{connection:bn,source:bn.source,target:bn.target,sourceId:bn.sourceId,targetId:bn.targetId,sourceEndpoint:bn.endpoints[0],targetEndpoint:bn.endpoints[1]}:bn;if(bp){bc.fire("jsPlumbConnectionDetached",bo,bk)}bc.anchorManager.connectionDetached(bo)},aT=function(bk){bc.fire("connectionDrag",bk)},aG=function(bk){bc.fire("connectionDragStop",bk)};this.detach=function(){if(arguments.length==0){return}var bo=bc.Defaults.ConnectionType||bc.getDefaultConnectionType(),bp=arguments[0].constructor==bo,bn=arguments.length==2?bp?(arguments[1]||{}):arguments[0]:arguments[0],bs=(bn.fireEvent!==false),bm=bn.forceDetach,bl=bp?arguments[0]:bn.connection;if(bl){if(bm||(bl.isDetachAllowed(bl)&&bl.endpoints[0].isDetachAllowed(bl)&&bl.endpoints[1].isDetachAllowed(bl))){if(bm||bc.checkCondition("beforeDetach",bl)){bl.endpoints[0].detach(bl,false,true,bs)}}}else{var bk=o.extend({},bn);if(bk.uuids){ak(bk.uuids[0]).detachFrom(ak(bk.uuids[1]),bs)}else{if(bk.sourceEndpoint&&bk.targetEndpoint){bk.sourceEndpoint.detachFrom(bk.targetEndpoint)}else{var br=E(bk.source),bq=E(bk.target);N(br,function(bt){if((bt.sourceId==br&&bt.targetId==bq)||(bt.targetId==br&&bt.sourceId==bq)){if(bc.checkCondition("beforeDetach",bt)){bt.endpoints[0].detach(bt,false,true,bs)}}})}}}};this.detachAllConnections=function(bm,bn){bn=bn||{};bm=A(bm);var bo=d(bm,"id"),bk=aI[bo];if(bk&&bk.length){for(var bl=0;bl<bk.length;bl++){bk[bl].detachAll(bn.fireEvent)}}};this.detachEveryConnection=function(bm){bm=bm||{};for(var bn in aI){var bk=aI[bn];if(bk&&bk.length){for(var bl=0;bl<bk.length;bl++){bk[bl].detachAll(bm.fireEvent)}}}delete aN;aN={}};this.draggable=function(bm,bk){if(typeof bm=="object"&&bm.length){for(var bl=0;bl<bm.length;bl++){var bn=A(bm[bl]);if(bn){a0(bn,true,bk)}}}else{if(bm._nodes){for(var bl=0;bl<bm._nodes.length;bl++){var bn=A(bm._nodes[bl]);if(bn){a0(bn,true,bk)}}}else{var bn=A(bm);if(bn){a0(bn,true,bk)}}}};this.extend=function(bl,bk){return o.CurrentLibrary.extend(bl,bk)};this.getDefaultEndpointType=function(){return X};this.getDefaultConnectionType=function(){return am};var bf=function(bo,bn,bl,bk){for(var bm=0;bm<bo.length;bm++){bo[bm][bn].apply(bo[bm],bl)}return bk(bo)},L=function(bo,bn,bl){var bk=[];for(var bm=0;bm<bo.length;bm++){bk.push([bo[bm][bn].apply(bo[bm],bl),bo[bm]])}return bk},ae=function(bm,bl,bk){return function(){return bf(bm,bl,arguments,bk)}},an=function(bl,bk){return function(){return L(bl,bk,arguments)}};this.getConnections=function(bw,bl){if(!bw){bw={}}else{if(bw.constructor==String){bw={scope:bw}}}var bt=function(bx){var by=[];if(bx){if(typeof bx=="string"){if(bx==="*"){return bx}by.push(bx)}else{by=bx}}return by},bu=bw.scope||bc.getDefaultScope(),bs=bt(bu),bk=bt(bw.source),bq=bt(bw.target),bm=function(by,bx){if(by==="*"){return true}return by.length>0?D(by,bx)!=-1:true},bp=(!bl&&bs.length>1)?{}:[],bv=function(by,bz){if(!bl&&bs.length>1){var bx=bp[by];if(bx==null){bx=[];bp[by]=bx}bx.push(bz)}else{bp.push(bz)}};for(var bo in aN){if(bm(bs,bo)){for(var bn=0;bn<aN[bo].length;bn++){var br=aN[bo][bn];if(bm(bk,br.sourceId)&&bm(bq,br.targetId)){bv(bo,br)}}}}return bp};var aA=function(bk){return{setHover:ae(bk,"setHover",aA),removeAllOverlays:ae(bk,"removeAllOverlays",aA),setLabel:ae(bk,"setLabel",aA),addOverlay:ae(bk,"addOverlay",aA),removeOverlay:ae(bk,"removeOverlay",aA),removeOverlays:ae(bk,"removeOverlays",aA),showOverlay:ae(bk,"showOverlay",aA),hideOverlay:ae(bk,"hideOverlay",aA),showOverlays:ae(bk,"showOverlays",aA),hideOverlays:ae(bk,"hideOverlays",aA),setPaintStyle:ae(bk,"setPaintStyle",aA),setHoverPaintStyle:ae(bk,"setHoverPaintStyle",aA),setDetachable:ae(bk,"setDetachable",aA),setConnector:ae(bk,"setConnector",aA),setParameter:ae(bk,"setParameter",aA),setParameters:ae(bk,"setParameters",aA),detach:function(){for(var bl=0;bl<bk.length;bl++){bc.detach(bk[bl])}},getLabel:an(bk,"getLabel"),getOverlay:an(bk,"getOverlay"),isHover:an(bk,"isHover"),isDetachable:an(bk,"isDetachable"),getParameter:an(bk,"getParameter"),getParameters:an(bk,"getParameters"),length:bk.length,each:function(bm){for(var bl=0;bl<bk.length;bl++){bm(bk[bl])}return aA(bk)},get:function(bl){return bk[bl]}}};this.select=function(bk){bk=bk||{};bk.scope=bk.scope||"*";var bl=bc.getConnections(bk,true);return aA(bl)};this.getAllConnections=function(){return aN};this.getDefaultScope=function(){return J};this.getEndpoint=ak;this.getEndpoints=function(bk){return aI[E(bk)]};this.getId=E;this.getOffset=function(bl){var bk=Z[bl];return P({elId:bl})};this.getSelector=function(bk){return o.CurrentLibrary.getSelector(bk)};this.getSize=function(bl){var bk=W[bl];if(!bk){P({elId:bl})}return W[bl]};this.appendElement=aL;var aH=false;this.isHoverSuspended=function(){return aH};this.setHoverSuspended=function(bk){aH=bk};this.hide=function(bk,bl){aS(bk,"none",bl)};this.idstamp=ab;this.init=function(){if(!G){bc.setRenderMode(bc.Defaults.RenderMode);var bk=function(bl){o.CurrentLibrary.bind(document,bl,function(br){if(!bc.currentlyDragging&&Q==o.CANVAS){for(var bq in aN){var bs=aN[bq];for(var bo=0;bo<bs.length;bo++){var bn=bs[bo].connector[bl](br);if(bn){return}}}for(var bp in aI){var bm=aI[bp];for(var bo=0;bo<bm.length;bo++){if(bm[bo].endpoint[bl](br)){return}}}}})};bk("click");bk("dblclick");bk("mousemove");bk("mousedown");bk("mouseup");bk("contextmenu");G=true;bc.fire("ready")}};this.log=I;this.jsPlumbUIComponent=jsPlumbUIComponent;this.EventGenerator=EventGenerator;this.makeAnchor=function(){if(arguments.length==0){return null}var bp=arguments[0],bm=arguments[1],bl=arguments[2],bn=null;if(!bl){throw"NO JSPLUMB SET"}if(bp.compute&&bp.getOrientation){return bp}else{if(typeof bp=="string"){bn=o.Anchors[arguments[0]]({elementId:bm,jsPlumbInstance:bc})}else{if(bp.constructor==Array){if(bp[0].constructor==Array||bp[0].constructor==String){if(bp.length==2&&bp[0].constructor==String&&bp[1].constructor==Object){var bk=o.extend({elementId:bm,jsPlumbInstance:bc},bp[1]);bn=o.Anchors[bp[0]](bk)}else{bn=new ag(bp,null,bm)}}else{var bo={x:bp[0],y:bp[1],orientation:(bp.length>=4)?[bp[2],bp[3]]:[0,0],offsets:(bp.length==6)?[bp[4],bp[5]]:[0,0],elementId:bm};bn=new T(bo);bn.clone=function(){return new T(bo)}}}}}if(!bn.id){bn.id="anchor_"+ab()}return bn};this.makeAnchors=function(bn,bl,bk){var bo=[];for(var bm=0;bm<bn.length;bm++){if(typeof bn[bm]=="string"){bo.push(o.Anchors[bn[bm]]({elementId:bl,jsPlumbInstance:bk}))}else{if(bn[bm].constructor==Array){bo.push(bc.makeAnchor(bn[bm],bl,bk))}}}return bo};this.makeDynamicAnchor=function(bk,bl){return new ag(bk,bl)};var aO={},ax={},a6={},U=function(bk,bl){bk.paintStyle=bk.paintStyle||bc.Defaults.EndpointStyles[bl]||bc.Defaults.EndpointStyle||o.Defaults.EndpointStyles[bl]||o.Defaults.EndpointStyle;bk.hoverPaintStyle=bk.hoverPaintStyle||bc.Defaults.EndpointHoverStyles[bl]||bc.Defaults.EndpointHoverStyle||o.Defaults.EndpointHoverStyles[bl]||o.Defaults.EndpointHoverStyle;bk.anchor=bk.anchor||bc.Defaults.Anchors[bl]||bc.Defaults.Anchor||o.Defaults.Anchors[bl]||o.Defaults.Anchor;bk.endpoint=bk.endpoint||bc.Defaults.Endpoints[bl]||bc.Defaults.Endpoint||o.Defaults.Endpoints[bl]||o.Defaults.Endpoint};this.makeTarget=function(bm,bn,bt){var bl=o.extend({_jsPlumb:bc},bt);o.extend(bl,bn);U(bl,1);var br=o.CurrentLibrary,bs=bl.scope||bc.Defaults.Scope,bo=!(bl.deleteEndpointsOnDetach===false),bk=function(by){var bw=E(by);aO[bw]=bl;a6[bw]=bl.uniqueEndpoint,proxyComponent=new jsPlumbUIComponent(bl);var bv=o.extend({},bl.dropOptions||{}),bu=function(){var bB=o.CurrentLibrary.getDropEvent(arguments);bc.currentlyDragging=false;var bM=A(br.getDragObject(arguments)),bC=d(bM,"dragId"),bK=d(bM,"originalScope"),bH=a4[bC],bA=bH.endpoints[0],bz=bl.endpoint?o.extend({},bl.endpoint):{};bA.anchor.locked=false;if(bK){br.setDragScope(bM,bK)}var bF=proxyComponent.isDropAllowed(bH.sourceId,E(by),bH.scope);if(bH.endpointsToDeleteOnDetach){if(bA===bH.endpointsToDeleteOnDetach[0]){bH.endpointsToDeleteOnDetach[0]=null}else{if(bA===bH.endpointsToDeleteOnDetach[1]){bH.endpointsToDeleteOnDetach[1]=null}}}if(bH.suspendedEndpoint){bH.targetId=bH.suspendedEndpoint.elementId;bH.target=br.getElementObject(bH.suspendedEndpoint.elementId);bH.endpoints[1]=bH.suspendedEndpoint}if(bF){bA.detach(bH,false,true,false);var bL=ax[bw]||bc.addEndpoint(by,bl);if(bl.uniqueEndpoint){ax[bw]=bL}if(bL.anchor.positionFinder!=null){var bI=br.getUIPosition(arguments),bE=br.getOffset(by),bJ=br.getSize(by),bD=bL.anchor.positionFinder(bI,bE,bJ,bL.anchor.constructorParams);bL.anchor.x=bD[0];bL.anchor.y=bD[1]}var bG=bc.connect({source:bA,target:bL,scope:bK,previousConnection:bH,container:bH.parent,deleteEndpointsOnDetach:bo,doNotFireConnectionEvent:bA.endpointWillMoveAfterConnection});if(bo){bG.endpointsToDeleteOnDetach=[bA,bL]}bG.repaint()}else{if(bH.suspendedEndpoint){if(bA.isReattach){bH.setHover(false);bH.floatingAnchorIndex=null;bH.suspendedEndpoint.addConnection(bH);bc.repaint(bA.elementId)}else{bA.detach(bH,false,true,true,bB)}}}};var bx=br.dragEvents.drop;bv.scope=bv.scope||bs;bv[bx]=ad(bv[bx],bu);br.initDroppable(by,bv,true)};bm=ay(bm);var bq=bm.length&&bm.constructor!=String?bm:[bm];for(var bp=0;bp<bq.length;bp++){bk(A(bq[bp]))}};this.makeTargets=function(bm,bn,bk){for(var bl=0;bl<bm.length;bl++){bc.makeTarget(bm[bl],bn,bk)}};var ao={},aU={},aY={};this.makeSource=function(bo,br,bk){var bp=o.extend({},bk);o.extend(bp,br);U(bp,0);var bn=o.CurrentLibrary,bq=function(bz){var bt=E(bz),bA=bp.parent,bs=bA!=null?bc.getId(bn.getElementObject(bA)):bt;ao[bs]=bp;aY[bs]=bp.uniqueEndpoint;var bu=bn.dragEvents.stop,by=bn.dragEvents.drag,bB=o.extend({},bp.dragOptions||{}),bw=bB.drag,bC=bB.stop,bD=null,bx=false;bB.scope=bB.scope||bp.scope;bB[by]=ad(bB[by],function(){if(bw){bw.apply(this,arguments)}bx=false});bB[bu]=function(){if(bC){bC.apply(this,arguments)}bc.currentlyDragging=false;if(bD.connections.length==0){bc.deleteEndpoint(bD)}else{bn.unbind(bD.canvas,"mousedown");var bF=bp.anchor||bc.Defaults.Anchor,bG=bD.anchor;bD.anchor=bc.makeAnchor(bF,bt,bc);if(bp.parent){var bH=bn.getElementObject(bp.parent);if(bH){var bE=bD.elementId;bD.setElement(bH);bD.endpointWillMoveAfterConnection=false;bc.anchorManager.rehomeEndpoint(bE,bH);bD.connections[0].previousConnection=null;bc.anchorManager.connectionDetached({sourceId:bD.connections[0].sourceId,targetId:bD.connections[0].targetId,connection:bD.connections[0]});bi(bD.connections[0])}}bD.repaint();bc.repaint(bD.elementId);bc.repaint(bD.connections[0].targetId)}};var bv=function(bF){var bK=P({elId:bt});var bJ=((bF.pageX||bF.page.x)-bK.left)/bK.width,bI=((bF.pageY||bF.page.y)-bK.top)/bK.height,bO=bJ,bN=bI;if(bp.parent){var bH=o.CurrentLibrary.getElementObject(bp.parent),bG=E(bH);bK=P({elId:bG});bO=((bF.pageX||bF.page.x)-bK.left)/bK.width,bN=((bF.pageY||bF.page.y)-bK.top)/bK.height}var bM={};o.extend(bM,bp);bM.isSource=true;bM.anchor=[bJ,bI,0,0];bM.parentAnchor=[bO,bN,0,0];bM.dragOptions=bB;if(bp.parent){var bE=bM.container||bc.Defaults.Container;if(bE){bM.container=bE}else{bM.container=o.CurrentLibrary.getParent(bp.parent)}}bD=bc.addEndpoint(bt,bM);bx=true;bD.endpointWillMoveAfterConnection=bp.parent!=null;bD.endpointWillMoveTo=bp.parent?bn.getElementObject(bp.parent):null;var bL=function(){if(bx){bc.deleteEndpoint(bD)}};bc.registerListener(bD.canvas,"mouseup",bL);bc.registerListener(bz,"mouseup",bL);bn.trigger(bD.canvas,"mousedown",bF)};bc.registerListener(bz,"mousedown",bv)};bo=ay(bo);var bl=bo.length&&bo.constructor!=String?bo:[bo];for(var bm=0;bm<bl.length;bm++){bq(A(bl[bm]))}};this.makeSources=function(bm,bn,bk){for(var bl=0;bl<bm.length;bl++){bc.makeSource(bm[bl],bn,bk)}};this.ready=function(bk){bc.bind("ready",bk)},this.repaint=function(bl){var bm=function(bn){aZ(A(bn))};if(typeof bl=="object"){for(var bk=0;bk<bl.length;bk++){bm(bl[bk])}}else{bm(bl)}};this.repaintEverything=function(){var bl=_timestamp();for(var bk in aI){aZ(A(bk),null,bl)}};this.removeAllEndpoints=function(bm){var bk=d(bm,"id"),bn=aI[bk];if(bn){for(var bl=0;bl<bn.length;bl++){bc.deleteEndpoint(bn[bl])}}aI[bk]=[]};this.removeEveryEndpoint=this.deleteEveryEndpoint;this.removeEndpoint=function(bk,bl){bc.deleteEndpoint(bl)};var Y={},a2=function(){for(var bl in Y){for(var bk=0;bk<Y[bl].length;bk++){var bm=Y[bl][bk];o.CurrentLibrary.unbind(bm.el,bm.event,bm.listener)}}Y={}};this.registerListener=function(bl,bk,bm){o.CurrentLibrary.bind(bl,bk,bm);O(Y,bk,{el:bl,event:bk,listener:bm})};this.reset=function(){bc.deleteEveryEndpoint();bc.clearListeners();aO={};ax={};a6={};ao={};aU={};aY={};a2();bc.anchorManager.reset();bc.dragManager.reset()};this.setDefaultScope=function(bk){J=bk};this.setDraggable=a9;this.setId=function(bo,bk,bq){var br=bo.constructor==String?bo:bc.getId(bo),bn=bc.getConnections({source:br,scope:"*"},true),bm=bc.getConnections({target:br,scope:"*"},true);bk=""+bk;if(!bq){bo=o.CurrentLibrary.getElementObject(br);o.CurrentLibrary.setAttribute(bo,"id",bk)}bo=o.CurrentLibrary.getElementObject(bk);aI[bk]=aI[br]||[];for(var bl=0;bl<aI[bk].length;bl++){aI[bk][bl].elementId=bk;aI[bk][bl].element=bo;aI[bk][bl].anchor.elementId=bk}delete aI[br];bc.anchorManager.changeId(br,bk);var bp=function(bv,bs,bu){for(var bt=0;bt<bv.length;bt++){bv[bt].endpoints[bs].elementId=bk;bv[bt].endpoints[bs].element=bo;bv[bt][bu+"Id"]=bk;bv[bt][bu]=bo}};bp(bn,0,"source");bp(bm,1,"target")};this.setIdChanged=function(bl,bk){bc.setId(bl,bk,true)};this.setDebugLog=function(bk){I=bk};this.setRepaintFunction=function(bk){ah=bk};this.setSuspendDrawing=a5;this.CANVAS="canvas";this.SVG="svg";this.VML="vml";this.setRenderMode=function(bk){if(bk){bk=bk.toLowerCase()}else{return}if(bk!==o.CANVAS&&bk!==o.SVG&&bk!==o.VML){throw new Error("render mode must be one of jsPlumb.CANVAS, jsPlumb.SVG or jsPlumb.VML")}if(bk===o.CANVAS&&w){Q=o.CANVAS}else{if(bk===o.SVG&&e){Q=o.SVG}else{if(b){Q=o.VML}}}return Q};this.getRenderMode=function(){return Q};this.show=function(bk,bl){aS(bk,"block",bl)};this.sizeCanvas=function(bm,bk,bo,bl,bn){if(bm){bm.style.height=bn+"px";bm.height=bn;bm.style.width=bl+"px";bm.width=bl;bm.style.left=bk+"px";bm.style.top=bo+"px"}};this.getTestHarness=function(){return{endpointsByElement:aI,endpointCount:function(bk){var bl=aI[bk];return bl?bl.length:0},connectionCount:function(bk){bk=bk||J;var bl=aN[bk];return bl?bl.length:0},getId:E,makeAnchor:self.makeAnchor,makeDynamicAnchor:self.makeDynamicAnchor}};this.toggle=aF;this.toggleVisible=aF;this.toggleDraggable=a7;this.unload=function(){};this.wrap=ad;this.addListener=this.bind;var bd=function(bp,bm){var bn=null,bk=bp;if(bm.tagName.toLowerCase()==="svg"&&bm.parentNode){bn=bm.parentNode}else{if(bm.offsetParent){bn=bm.offsetParent}}if(bn!=null){var bl=bn.tagName.toLowerCase()==="body"?{left:0,top:0}:s(bn),bo=bn.tagName.toLowerCase()==="body"?{left:0,top:0}:{left:bn.scrollLeft,top:bn.scrollTop};bk[0]=bp[0]-bl.left+bo.left;bk[1]=bp[1]-bl.top+bo.top}return bk};var T=function(bo){var bm=this;this.x=bo.x||0;this.y=bo.y||0;this.elementId=bo.elementId;var bl=bo.orientation||[0,0];var bn=null,bk=null;this.offsets=bo.offsets||[0,0];bm.timestamp=null;this.compute=function(bt){var bs=bt.xy,bp=bt.wh,bq=bt.element,br=bt.timestamp;if(br&&br===bm.timestamp){return bk}bk=[bs[0]+(bm.x*bp[0])+bm.offsets[0],bs[1]+(bm.y*bp[1])+bm.offsets[1]];bk=bd(bk,bq.canvas);bm.timestamp=br;return bk};this.getOrientation=function(bp){return bl};this.equals=function(bp){if(!bp){return false}var bq=bp.getOrientation();var br=this.getOrientation();return this.x==bp.x&&this.y==bp.y&&this.offsets[0]==bp.offsets[0]&&this.offsets[1]==bp.offsets[1]&&br[0]==bq[0]&&br[1]==bq[1]};this.getCurrentLocation=function(){return bk}};var aQ=function(bq){var bo=bq.reference,bp=bq.referenceCanvas,bm=a(A(bp)),bl=0,br=0,bk=null,bn=null;this.x=0;this.y=0;this.isFloating=true;this.compute=function(bv){var bu=bv.xy,bt=bv.element,bs=[bu[0]+(bm[0]/2),bu[1]+(bm[1]/2)];bs=bd(bs,bt.canvas);bn=bs;return bs};this.getOrientation=function(bt){if(bk){return bk}else{var bs=bo.getOrientation(bt);return[Math.abs(bs[0])*bl*-1,Math.abs(bs[1])*br*-1]}};this.over=function(bs){bk=bs.getOrientation()};this.out=function(){bk=null};this.getCurrentLocation=function(){return bn}};var ag=function(bm,bl,br){this.isSelective=true;this.isDynamic=true;var bu=[],bt=this,bs=function(bv){return bv.constructor==T?bv:bc.makeAnchor(bv,br,bc)};for(var bq=0;bq<bm.length;bq++){bu[bq]=bs(bm[bq])}this.addAnchor=function(bv){bu.push(bs(bv))};this.getAnchors=function(){return bu};this.locked=false;var bn=bu.length>0?bu[0]:null,bp=bu.length>0?0:-1,bt=this,bo=function(bx,bv,bB,bA,bw){var bz=bA[0]+(bx.x*bw[0]),by=bA[1]+(bx.y*bw[1]);return Math.sqrt(Math.pow(bv-bz,2)+Math.pow(bB-by,2))},bk=bl||function(bF,bw,bx,by,bv){var bA=bx[0]+(by[0]/2),bz=bx[1]+(by[1]/2);var bC=-1,bE=Infinity;for(var bB=0;bB<bv.length;bB++){var bD=bo(bv[bB],bA,bz,bF,bw);if(bD<bE){bC=bB+0;bE=bD}}return bv[bC]};this.compute=function(bz){var by=bz.xy,bv=bz.wh,bx=bz.timestamp,bw=bz.txy,bA=bz.twh;if(bt.locked||bw==null||bA==null){return bn.compute(bz)}else{bz.timestamp=null}bn=bk(by,bv,bw,bA,bu);bt.x=bn.x;bt.y=bn.y;return bn.compute(bz)};this.getCurrentLocation=function(){return bn!=null?bn.getCurrentLocation():null};this.getOrientation=function(bv){return bn!=null?bn.getOrientation(bv):[0,0]};this.over=function(bv){if(bn!=null){bn.over(bv)}};this.out=function(){if(bn!=null){bn.out()}}};var a8={},aa={},az={},M={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"},ba=function(bt,bu,bq,bn){if(bt===bu){return{orientation:M.IDENTITY,a:["top","top"]}}var bl=Math.atan2((bn.centery-bq.centery),(bn.centerx-bq.centerx)),bo=Math.atan2((bq.centery-bn.centery),(bq.centerx-bn.centerx)),bp=((bq.left<=bn.left&&bq.right>=bn.left)||(bq.left<=bn.right&&bq.right>=bn.right)||(bq.left<=bn.left&&bq.right>=bn.right)||(bn.left<=bq.left&&bn.right>=bq.right)),bv=((bq.top<=bn.top&&bq.bottom>=bn.top)||(bq.top<=bn.bottom&&bq.bottom>=bn.bottom)||(bq.top<=bn.top&&bq.bottom>=bn.bottom)||(bn.top<=bq.top&&bn.bottom>=bq.bottom));if(!(bp||bv)){var bs=null,bm=false,bk=false,br=null;if(bn.left>bq.left&&bn.top>bq.top){bs=["right","top"]}else{if(bn.left>bq.left&&bq.top>bn.top){bs=["top","left"]}else{if(bn.left<bq.left&&bn.top<bq.top){bs=["top","right"]}else{if(bn.left<bq.left&&bn.top>bq.top){bs=["left","top"]}}}}return{orientation:M.DIAGONAL,a:bs,theta:bl,theta2:bo}}else{if(bp){return{orientation:M.HORIZONTAL,a:bq.top<bn.top?["bottom","top"]:["top","bottom"],theta:bl,theta2:bo}}else{return{orientation:M.VERTICAL,a:bq.left<bn.left?["right","left"]:["left","right"],theta:bl,theta2:bo}}}},aR=function(by,bu,bs,bt,bz,bv,bm){var bA=[],bl=bu[bz?0:1]/(bt.length+1);for(var bw=0;bw<bt.length;bw++){var bB=(bw+1)*bl,bk=bv*bu[bz?1:0];if(bm){bB=bu[bz?0:1]-bB}var br=(bz?bB:bk),bo=bs[0]+br,bq=br/bu[0],bp=(bz?bk:bB),bn=bs[1]+bp,bx=bp/bu[1];bA.push([bo,bn,bq,bx,bt[bw][1],bt[bw][2]])}return bA},aX=function(bl,bk){return bl[0]>bk[0]?1:-1},S=function(bk){return function(bm,bl){var bn=true;if(bk){if(bm[0][0]<bl[0][0]){bn=true}else{bn=bm[0][1]>bl[0][1]}}else{if(bm[0][0]>bl[0][0]){bn=true}else{bn=bm[0][1]>bl[0][1]}}return bn===false?-1:1}},H=function(bl,bk){var bn=bl[0][0]<0?-Math.PI-bl[0][0]:Math.PI-bl[0][0],bm=bk[0][0]<0?-Math.PI-bk[0][0]:Math.PI-bk[0][0];if(bn>bm){return 1}else{return bl[0][1]>bk[0][1]?1:-1}},aP={top:aX,right:S(true),bottom:S(true),left:H},af=function(bk,bl){return bk.sort(bl)},ac=function(bl,bk){var bn=W[bl],bo=Z[bl],bm=function(bv,bC,br,bu,bA,bz,bq){if(bu.length>0){var by=af(bu,aP[bv]),bw=bv==="right"||bv==="top",bp=aR(bv,bC,br,by,bA,bz,bw);var bD=function(bG,bF){var bE=bd([bF[0],bF[1]],bG.canvas);aa[bG.id]=[bE[0],bE[1],bF[2],bF[3]];az[bG.id]=bq};for(var bs=0;bs<bp.length;bs++){var bx=bp[bs][4],bB=bx.endpoints[0].elementId===bl,bt=bx.endpoints[1].elementId===bl;if(bB){bD(bx.endpoints[0],bp[bs])}else{if(bt){bD(bx.endpoints[1],bp[bs])}}}}};bm("bottom",bn,[bo.left,bo.top],bk.bottom,true,1,[0,1]);bm("top",bn,[bo.left,bo.top],bk.top,true,0,[0,-1]);bm("left",bn,[bo.left,bo.top],bk.left,false,0,[-1,0]);bm("right",bn,[bo.left,bo.top],bk.right,false,1,[1,0])},au=function(){var bk={},bo={},bl=this,bn={};this.reset=function(){bk={};bo={};bn={}};this.newConnection=function(bs){var bu=bs.sourceId,br=bs.targetId,bp=bs.endpoints,bt=true,bq=function(bv,bw,by,bx,bz){if((bu==br)&&by.isContinuous){o.CurrentLibrary.removeElement(bp[1].canvas);bt=false}O(bo,bx,[bz,bw,by.constructor==ag])};bq(0,bp[0],bp[0].anchor,br,bs);if(bt){bq(1,bp[1],bp[1].anchor,bu,bs)}};this.connectionDetached=function(bp){var bq=bp.connection||bp;var bv=bq.sourceId,bw=bq.targetId,bz=bq.endpoints,bu=function(bA,bB,bD,bC,bE){if(bD.constructor==aQ){}else{y(bo[bC],function(bF){return bF[0].id==bE.id})}};bu(1,bz[1],bz[1].anchor,bv,bq);bu(0,bz[0],bz[0].anchor,bw,bq);var br=bq.sourceId,bs=bq.targetId,by=bq.endpoints[0].id,bt=bq.endpoints[1].id,bx=function(bC,bA){if(bC){var bB=function(bD){return bD[4]==bA};y(bC.top,bB);y(bC.left,bB);y(bC.bottom,bB);y(bC.right,bB)}};bx(bn[br],by);bx(bn[bs],bt);bl.redraw(br);bl.redraw(bs)};this.add=function(bq,bp){O(bk,bp,bq)};this.changeId=function(bq,bp){bo[bp]=bo[bq];bk[bp]=bk[bq];delete bo[bq];delete bk[bq]};this.getConnectionsFor=function(bp){return bo[bp]||[]};this.getEndpointsFor=function(bp){return bk[bp]||[]};this.deleteEndpoint=function(bp){y(bk[bp.elementId],function(bq){return bq.id==bp.id})};this.clearFor=function(bp){delete bk[bp];bk[bp]=[]};var bm=function(bJ,bw,bE,bt,bz,bA,bC,by,bL,bB,bs,bI){var bG=-1,br=-1,bu=bt.endpoints[bC],bD=bu.id,bx=[1,0][bC],bp=[[bw,bE],bt,bz,bA,bD],bq=bJ[bL],bK=bu._continuousAnchorEdge?bJ[bu._continuousAnchorEdge]:null;if(bK){var bH=i(bK,function(bM){return bM[4]==bD});if(bH!=-1){bK.splice(bH,1);for(var bF=0;bF<bK.length;bF++){r(bs,bK[bF][1],function(bM){return bM.id==bK[bF][1].id});r(bI,bK[bF][1].endpoints[bC],function(bM){return bM.id==bK[bF][1].endpoints[bC].id})}}}for(var bF=0;bF<bq.length;bF++){if(bC==1&&bq[bF][3]===bA&&br==-1){br=bF}r(bs,bq[bF][1],function(bM){return bM.id==bq[bF][1].id});r(bI,bq[bF][1].endpoints[bC],function(bM){return bM.id==bq[bF][1].endpoints[bC].id})}if(bG!=-1){bq[bG]=bp}else{var bv=by?br!=-1?br:0:bq.length;bq.splice(bv,0,bp)}bu._continuousAnchorEdge=bL};this.redraw=function(bE,bG,br,bu){var bP=bk[bE]||[],bO=bo[bE]||[],bq=[],bN=[],bs=[];br=br||_timestamp();bu=bu||{left:0,top:0};if(bG){bG={left:bG.left+bu.left,top:bG.top+bu.top}}P({elId:bE,offset:bG,recalc:false,timestamp:br});var bz=Z[bE],bv=W[bE],bB={};for(var bL=0;bL<bO.length;bL++){var bw=bO[bL][0],by=bw.sourceId,bt=bw.targetId,bx=bw.endpoints[0].anchor.isContinuous,bD=bw.endpoints[1].anchor.isContinuous;if(bx||bD){var bM=by+"_"+bt,bJ=bt+"_"+by,bI=bB[bM],bC=bw.sourceId==bE?1:0;if(bx&&!bn[by]){bn[by]={top:[],right:[],bottom:[],left:[]}}if(bD&&!bn[bt]){bn[bt]={top:[],right:[],bottom:[],left:[]}}if(bE!=bt){P({elId:bt,timestamp:br})}if(bE!=by){P({elId:by,timestamp:br})}var bA=aC(bt),bp=aC(by);if(bt==by&&(bx||bD)){bm(bn[by],-Math.PI/2,0,bw,false,bt,0,false,"top",by,bq,bN)}else{if(!bI){bI=ba(by,bt,bp.o,bA.o);bB[bM]=bI}if(bx){bm(bn[by],bI.theta,0,bw,false,bt,0,false,bI.a[0],by,bq,bN)}if(bD){bm(bn[bt],bI.theta2,-1,bw,true,by,1,true,bI.a[1],bt,bq,bN)}}if(bx){r(bs,by,function(bQ){return bQ===by})}if(bD){r(bs,bt,function(bQ){return bQ===bt})}r(bq,bw,function(bQ){return bQ.id==bw.id});if((bx&&bC==0)||(bD&&bC==1)){r(bN,bw.endpoints[bC],function(bQ){return bQ.id==bw.endpoints[bC].id})}}}for(var bL=0;bL<bs.length;bL++){ac(bs[bL],bn[bs[bL]])}for(var bL=0;bL<bP.length;bL++){bP[bL].paint({timestamp:br,offset:bz,dimensions:bv})}for(var bL=0;bL<bN.length;bL++){bN[bL].paint({timestamp:br,offset:bz,dimensions:bv})}for(var bL=0;bL<bO.length;bL++){var bF=bO[bL][1];if(bF.anchor.constructor==ag){bF.paint({elementWithPrecedence:bE});r(bq,bO[bL][0],function(bQ){return bQ.id==bO[bL][0].id});for(var bK=0;bK<bF.connections.length;bK++){if(bF.connections[bK]!==bO[bL][0]){r(bq,bF.connections[bK],function(bQ){return bQ.id==bF.connections[bK].id})}}}else{if(bF.anchor.constructor==T){r(bq,bO[bL][0],function(bQ){return bQ.id==bO[bL][0].id})}}}var bH=a4[bE];if(bH){bH.paint({timestamp:br,recalc:false,elId:bE})}for(var bL=0;bL<bq.length;bL++){bq[bL].paint({elId:bE,timestamp:br,recalc:false})}};this.rehomeEndpoint=function(bp,bt){var bq=bk[bp]||[],br=bc.getId(bt);for(var bs=0;bs<bq.length;bs++){bl.add(bq[bs],br)}bq.splice(0,bq.length)}};bc.anchorManager=new au();bc.continuousAnchorFactory={get:function(bl){var bk=a8[bl.elementId];if(!bk){bk={type:"Continuous",compute:function(bm){return aa[bm.element.id]||[0,0]},getCurrentLocation:function(bm){return aa[bm.id]||[0,0]},getOrientation:function(bm){return az[bm.id]||[0,0]},isDynamic:true,isContinuous:true};a8[bl.elementId]=bk}return bk}};var aK=function(){var bn={},bm=[],bl={},bk={};this.register=function(bp){bp=o.CurrentLibrary.getElementObject(bp);var br=bc.getId(bp),bo=o.CurrentLibrary.getDOMElement(bp);if(!bn[br]){bn[br]=bp;bm.push(bp);bl[br]={}}var bq=function(bv){var by=o.CurrentLibrary.getElementObject(bv),bx=o.CurrentLibrary.getOffset(by);for(var bs=0;bs<bv.childNodes.length;bs++){if(bv.childNodes[bs].nodeType!=3){var bu=o.CurrentLibrary.getElementObject(bv.childNodes[bs]),bw=bc.getId(bu);if(bk[bw]&&bk[bw]>0){var bt=o.CurrentLibrary.getOffset(bu);bl[br][bw]={id:bw,offset:{left:bt.left-bx.left,top:bt.top-bx.top}}}}}};bq(bo)};this.endpointAdded=function(bq){var bu=o.CurrentLibrary,bx=document.body,bo=bc.getId(bq),bw=bu.getDOMElement(bq),bp=bw.parentNode,bs=bp==bx;bk[bo]=bk[bo]?bk[bo]+1:1;while(bp!=bx){var bt=bc.getId(bp);if(bn[bt]){var bz=-1,bv=bu.getElementObject(bp),br=o.CurrentLibrary.getOffset(bv);if(bl[bt][bo]==null){var by=o.CurrentLibrary.getOffset(bq);bl[bt][bo]={id:bo,offset:{left:by.left-br.left,top:by.top-br.top}}}break}bp=bp.parentNode}};this.endpointDeleted=function(bp){if(bk[bp.elementId]){bk[bp.elementId]--;if(bk[bp.elementId]<=0){for(var bo in bl){delete bl[bo][bp.elementId]}}}};this.getElementsForDraggable=function(bo){return bl[bo]};this.reset=function(){bn={};bm=[];bl={};bk={}}};bc.dragManager=new aK();var am=function(bC){var bv=this,bm=true;bv.idPrefix="_jsplumb_c_";bv.defaultLabelLocation=0.5;bv.defaultOverlayKeys=["Overlays","ConnectionOverlays"];this.parent=bC.parent;overlayCapableJsPlumbUIComponent.apply(this,arguments);this.isVisible=function(){return bm};this.setVisible=function(bE){bm=bE;bv[bE?"showOverlays":"hideOverlays"]();if(bv.connector&&bv.connector.canvas){bv.connector.canvas.style.display=bE?"block":"none"}};this.source=A(bC.source);this.target=A(bC.target);if(bC.sourceEndpoint){this.source=bC.sourceEndpoint.endpointWillMoveTo||bC.sourceEndpoint.getElement()}if(bC.targetEndpoint){this.target=bC.targetEndpoint.getElement()}bv.previousConnection=bC.previousConnection;var bs=bC.cost;bv.getCost=function(){return bs};bv.setCost=function(bE){bs=bE};var bq=bC.bidirectional===false?false:true;bv.isBidirectional=function(){return bq};this.sourceId=d(this.source,"id");this.targetId=d(this.target,"id");this.getAttachedElements=function(){return bv.endpoints};this.scope=bC.scope;this.endpoints=[];this.endpointStyles=[];var bB=function(bF,bE){if(bF){return bc.makeAnchor(bF,bE,bc)}},bz=function(bE,bK,bF,bH,bI,bG,bJ){if(bE){bv.endpoints[bK]=bE;bE.addConnection(bv)}else{if(!bF.endpoints){bF.endpoints=[null,null]}var bQ=bF.endpoints[bK]||bF.endpoint||bc.Defaults.Endpoints[bK]||o.Defaults.Endpoints[bK]||bc.Defaults.Endpoint||o.Defaults.Endpoint;if(!bF.endpointStyles){bF.endpointStyles=[null,null]}if(!bF.endpointHoverStyles){bF.endpointHoverStyles=[null,null]}var bO=bF.endpointStyles[bK]||bF.endpointStyle||bc.Defaults.EndpointStyles[bK]||o.Defaults.EndpointStyles[bK]||bc.Defaults.EndpointStyle||o.Defaults.EndpointStyle;if(bO.fillStyle==null&&bG!=null){bO.fillStyle=bG.strokeStyle}if(bO.outlineColor==null&&bG!=null){bO.outlineColor=bG.outlineColor}if(bO.outlineWidth==null&&bG!=null){bO.outlineWidth=bG.outlineWidth}var bN=bF.endpointHoverStyles[bK]||bF.endpointHoverStyle||bc.Defaults.EndpointHoverStyles[bK]||o.Defaults.EndpointHoverStyles[bK]||bc.Defaults.EndpointHoverStyle||o.Defaults.EndpointHoverStyle;if(bJ!=null){if(bN==null){bN={}}if(bN.fillStyle==null){bN.fillStyle=bJ.strokeStyle}}var bM=bF.anchors?bF.anchors[bK]:bF.anchor?bF.anchor:bB(bc.Defaults.Anchors[bK],bI)||bB(o.Defaults.Anchors[bK],bI)||bB(bc.Defaults.Anchor,bI)||bB(o.Defaults.Anchor,bI),bP=bF.uuids?bF.uuids[bK]:null,bL=av({paintStyle:bO,hoverPaintStyle:bN,endpoint:bQ,connections:[bv],uuid:bP,anchor:bM,source:bH,scope:bF.scope,container:bF.container,reattach:bF.reattach,detachable:bF.detachable});bv.endpoints[bK]=bL;if(bF.drawEndpoints===false){bL.setVisible(false,true,true)}return bL}};var bx=bz(bC.sourceEndpoint,0,bC,bv.source,bv.sourceId,bC.paintStyle,bC.hoverPaintStyle);if(bx){O(aI,this.sourceId,bx)}var bn=((bv.sourceId==bv.targetId)&&bC.targetEndpoint==null)?bx:bC.targetEndpoint,bw=bz(bn,1,bC,bv.target,bv.targetId,bC.paintStyle,bC.hoverPaintStyle);if(bw){O(aI,this.targetId,bw)}if(!this.scope){this.scope=this.endpoints[0].scope}if(bC.deleteEndpointsOnDetach){bv.endpointsToDeleteOnDetach=[bx,bw]}var bl=bc.Defaults.ConnectionsDetachable;if(bC.detachable===false){bl=false}if(bv.endpoints[0].connectionsDetachable===false){bl=false}if(bv.endpoints[1].connectionsDetachable===false){bl=false}if(bs==null){bs=bv.endpoints[0].getConnectionCost()}if(bC.bidirectional==null){bq=bv.endpoints[0].areConnectionsBidirectional()}this.isDetachable=function(){return bl===true};this.setDetachable=function(bE){bl=bE===true};var bD=o.extend({},this.endpoints[0].getParameters());o.extend(bD,this.endpoints[1].getParameters());o.extend(bD,bv.getParameters());bv.setParameters(bD);var bt=bv.setHover;bv.setHover=function(){bv.connector.setHover.apply(bv.connector,arguments);bt.apply(bv,arguments)};var bA=function(bE){if(u==null){bv.setHover(bE,false)}};this.setConnector=function(bE,bF){if(bv.connector!=null){aM(bv.connector.getDisplayElements(),bv.parent)}var bG={_jsPlumb:bv._jsPlumb,parent:bC.parent,cssClass:bC.cssClass,container:bC.container,tooltip:bv.tooltip};if(bE.constructor==String){this.connector=new o.Connectors[Q][bE](bG)}else{if(bE.constructor==Array){this.connector=new o.Connectors[Q][bE[0]](o.extend(bE[1],bG))}}bv.canvas=bv.connector.canvas;_bindListeners(bv.connector,bv,bA);if(!bF){bv.repaint()}};bv.setConnector(this.endpoints[0].connector||this.endpoints[1].connector||bC.connector||bc.Defaults.Connector||o.Defaults.Connector,true);this.setPaintStyle(this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||bC.paintStyle||bc.Defaults.PaintStyle||o.Defaults.PaintStyle,true);this.setHoverPaintStyle(this.endpoints[0].connectorHoverStyle||this.endpoints[1].connectorHoverStyle||bC.hoverPaintStyle||bc.Defaults.HoverPaintStyle||o.Defaults.HoverPaintStyle,true);this.paintStyleInUse=this.paintStyle;this.moveParent=function(bH){var bG=o.CurrentLibrary,bF=bG.getParent(bv.connector.canvas);bG.removeElement(bv.connector.canvas,bF);bG.appendElement(bv.connector.canvas,bH);if(bv.connector.bgCanvas){bG.removeElement(bv.connector.bgCanvas,bF);bG.appendElement(bv.connector.bgCanvas,bH)}for(var bE=0;bE<bv.overlays.length;bE++){if(bv.overlays[bE].isAppendedAtTopLevel){bG.removeElement(bv.overlays[bE].canvas,bF);bG.appendElement(bv.overlays[bE].canvas,bH);if(bv.overlays[bE].reattachListeners){bv.overlays[bE].reattachListeners(bv.connector)}}}if(bv.connector.reattachListeners){bv.connector.reattachListeners()}};P({elId:this.sourceId});P({elId:this.targetId});var bp=Z[this.sourceId],bo=W[this.sourceId],bk=Z[this.targetId],br=W[this.targetId],bu=_timestamp(),by=this.endpoints[0].anchor.compute({xy:[bp.left,bp.top],wh:bo,element:this.endpoints[0],elementId:this.endpoints[0].elementId,txy:[bk.left,bk.top],twh:br,tElement:this.endpoints[1],timestamp:bu});this.endpoints[0].paint({anchorLoc:by,timestamp:bu});by=this.endpoints[1].anchor.compute({xy:[bk.left,bk.top],wh:br,element:this.endpoints[1],elementId:this.endpoints[1].elementId,txy:[bp.left,bp.top],twh:bo,tElement:this.endpoints[0],timestamp:bu});this.endpoints[1].paint({anchorLoc:by,timestamp:bu});this.paint=function(bV){bV=bV||{};var bM=bV.elId,bN=bV.ui,bK=bV.recalc,bF=bV.timestamp,bO=false,bU=bO?this.sourceId:this.targetId,bJ=bO?this.targetId:this.sourceId,bG=bO?0:1,bW=bO?1:0;var bX=P({elId:bM,offset:bN,recalc:bK,timestamp:bF}),bL=P({elId:bU,timestamp:bF});var bQ=this.endpoints[bW],bE=this.endpoints[bG],bI=bQ.anchor.getCurrentLocation(bQ),bT=bE.anchor.getCurrentLocation(bE);var bH=0;for(var bS=0;bS<bv.overlays.length;bS++){var bP=bv.overlays[bS];if(bP.isVisible()){bH=Math.max(bH,bP.computeMaxSize(bv.connector))}}var bR=this.connector.compute(bI,bT,this.endpoints[bW],this.endpoints[bG],this.endpoints[bW].anchor,this.endpoints[bG].anchor,bv.paintStyleInUse.lineWidth,bH,bX,bL);bv.connector.paint(bR,bv.paintStyleInUse);for(var bS=0;bS<bv.overlays.length;bS++){var bP=bv.overlays[bS];if(bP.isVisible){bv.overlayPlacements[bS]=bP.draw(bv.connector,bv.paintStyleInUse,bR)}}};this.repaint=function(bF){bF=bF||{};var bE=!(bF.recalc===false);this.paint({elId:this.sourceId,recalc:bE,timestamp:bF.timestamp})}};var a1=function(bl){var bk=false;return{drag:function(){if(bk){bk=false;return true}var bm=o.CurrentLibrary.getUIPosition(arguments),bn=bl.element;if(bn){o.CurrentLibrary.setOffset(bn,bm);aZ(A(bn),bm)}},stopDrag:function(){bk=true}}};var ai=function(bo,bn,bp,bm,bk){var bl=new aQ({reference:bn,referenceCanvas:bm});return av({paintStyle:bo,endpoint:bp,anchor:bl,source:bk,scope:"__floating"})};var K=function(bm,bk){var bo=document.createElement("div");bo.style.position="absolute";var bl=A(bo);aL(bo,bk);var bn=E(bl);P({elId:bn});bm.id=bn;bm.element=bl};var X=function(bP){var bE=this;bE.idPrefix="_jsplumb_e_";bE.defaultLabelLocation=[0.5,0.5];bE.defaultOverlayKeys=["Overlays","EndpointOverlays"];this.parent=bP.parent;overlayCapableJsPlumbUIComponent.apply(this,arguments);bP=bP||{};var bp=true,bn=!(bP.enabled===false);this.isVisible=function(){return bp};this.setVisible=function(bS,bV,bR){bp=bS;if(bE.canvas){bE.canvas.style.display=bS?"block":"none"}bE[bS?"showOverlays":"hideOverlays"]();if(!bV){for(var bU=0;bU<bE.connections.length;bU++){bE.connections[bU].setVisible(bS);if(!bR){var bT=bE===bE.connections[bU].endpoints[0]?1:0;if(bE.connections[bU].endpoints[bT].connections.length==1){bE.connections[bU].endpoints[bT].setVisible(bS,true,true)}}}}};this.isEnabled=function(){return bn};this.setEnabled=function(bR){bn=bR};var bD=bP.source,bx=bP.uuid,bN=null,br=null;if(bx){aJ[bx]=bE}var bu=d(bD,"id");this.elementId=bu;this.element=bD;var bm=bP.connectionCost;this.getConnectionCost=function(){return bm};this.setConnectionCost=function(bR){bm=bR};var bM=bP.connectionsBidirectional===false?false:true;this.areConnectionsBidirectional=function(){return bM};this.setConnectionsBidirectional=function(bR){bM=bR};bE.anchor=bP.anchor?bc.makeAnchor(bP.anchor,bu,bc):bP.anchors?bc.makeAnchor(bP.anchors,bu,bc):bc.makeAnchor("TopCenter",bu,bc);if(!bP._transient){bc.anchorManager.add(bE,bu)}var bB=bP.endpoint||bc.Defaults.Endpoint||o.Defaults.Endpoint||"Dot",bv={_jsPlumb:bE._jsPlumb,parent:bP.parent,container:bP.container,tooltip:bP.tooltip,connectorTooltip:bP.connectorTooltip,endpoint:bE};if(bB.constructor==String){bB=new o.Endpoints[Q][bB](bv)}else{if(bB.constructor==Array){bv=o.extend(bB[1],bv);bB=new o.Endpoints[Q][bB[0]](bv)}else{bB=bB.clone()}}var by=o.extend({},bv);bB.clone=function(){var bR=new Object();bB.constructor.apply(bR,[by]);return bR};bE.endpoint=bB;bE.type=bE.endpoint.type;var bC=bE.setHover;bE.setHover=function(){bE.endpoint.setHover.apply(bE.endpoint,arguments);bC.apply(bE,arguments)};var bQ=function(bR){if(bE.connections.length>0){bE.connections[0].setHover(bR,false)}else{bE.setHover(bR)}};_bindListeners(bE.endpoint,bE,bQ);this.setPaintStyle(bP.paintStyle||bP.style||bc.Defaults.EndpointStyle||o.Defaults.EndpointStyle,true);this.setHoverPaintStyle(bP.hoverPaintStyle||bc.Defaults.EndpointHoverStyle||o.Defaults.EndpointHoverStyle,true);this.paintStyleInUse=this.paintStyle;this.connectorStyle=bP.connectorStyle;this.connectorHoverStyle=bP.connectorHoverStyle;this.connectorOverlays=bP.connectorOverlays;this.connector=bP.connector;this.connectorTooltip=bP.connectorTooltip;this.isSource=bP.isSource||false;this.isTarget=bP.isTarget||false;var bJ=bP.maxConnections||bc.Defaults.MaxConnections;this.getAttachedElements=function(){return bE.connections};this.canvas=this.endpoint.canvas;this.connections=bP.connections||[];this.scope=bP.scope||J;this.timestamp=null;bE.isReattach=bP.reattach||false;bE.connectionsDetachable=bc.Defaults.ConnectionsDetachable;if(bP.connectionsDetachable===false||bP.detachable===false){bE.connectionsDetachable=false}var bz=bP.dragAllowedWhenFull||true;this.computeAnchor=function(bR){return bE.anchor.compute(bR)};this.addConnection=function(bR){bE.connections.push(bR)};this.detach=function(bS,bX,bT,b0,bR){var bZ=i(bE.connections,function(b2){return b2.id==bS.id}),bY=false;b0=(b0!==false);if(bZ>=0){if(bT||bS._forceDetach||bS.isDetachable()||bS.isDetachAllowed(bS)){var b1=bS.endpoints[0]==bE?bS.endpoints[1]:bS.endpoints[0];if(bT||bS._forceDetach||(bE.isDetachAllowed(bS))){bE.connections.splice(bZ,1);if(!bX){b1.detach(bS,true,bT);if(bS.endpointsToDeleteOnDetach){for(var bW=0;bW<bS.endpointsToDeleteOnDetach.length;bW++){var bU=bS.endpointsToDeleteOnDetach[bW];if(bU&&bU.connections.length==0){bc.deleteEndpoint(bU)}}}}aM(bS.connector.getDisplayElements(),bS.parent);y(aN[bS.scope],function(b2){return b2.id==bS.id});bY=true;var bV=(!bX&&b0);aW(bS,bV,bR)}}}return bY};this.detachAll=function(bS,bR){while(bE.connections.length>0){bE.detach(bE.connections[0],false,true,bS,bR)}};this.detachFrom=function(bU,bT,bR){var bV=[];for(var bS=0;bS<bE.connections.length;bS++){if(bE.connections[bS].endpoints[1]==bU||bE.connections[bS].endpoints[0]==bU){bV.push(bE.connections[bS])}}for(var bS=0;bS<bV.length;bS++){if(bE.detach(bV[bS],false,true,bT,bR)){bV[bS].setHover(false,false)}}};this.detachFromConnection=function(bS){var bR=i(bE.connections,function(bT){return bT.id==bS.id});if(bR>=0){bE.connections.splice(bR,1)}};this.getElement=function(){return bD};this.setElement=function(bT){var bV=E(bT);y(aI[bu],function(bW){return bW.id==bE.id});bD=A(bT);bu=E(bD);bE.elementId=bu;var bU=al({source:bV}),bS=bo.getParent(bE.canvas);bo.removeElement(bE.canvas,bS);bo.appendElement(bE.canvas,bU);for(var bR=0;bR<bE.connections.length;bR++){bE.connections[bR].moveParent(bU);bE.connections[bR].sourceId=bu;bE.connections[bR].source=bD}O(aI,bV,bE)};this.getUuid=function(){return bx};this.makeInPlaceCopy=function(){return av({anchor:bE.anchor,source:bD,paintStyle:this.paintStyle,endpoint:bB,_transient:true,scope:bE.scope})};this.isConnectedTo=function(bT){var bS=false;if(bT){for(var bR=0;bR<bE.connections.length;bR++){if(bE.connections[bR].endpoints[1]==bT){bS=true;break}}}return bS};this.isFloating=function(){return bN!=null};this.connectorSelector=function(){var bR=bE.connections[0];if(bE.isTarget&&bR){return bR}else{return(bE.connections.length<bJ)||bJ==-1?null:bR}};this.isFull=function(){return !(bE.isFloating()||bJ<1||bE.connections.length<bJ)};this.setDragAllowedWhenFull=function(bR){bz=bR};this.setStyle=bE.setPaintStyle;this.equals=function(bR){return this.anchor.equals(bR.anchor)};var bA=function(bS){var bR=0;if(bS!=null){for(var bT=0;bT<bE.connections.length;bT++){if(bE.connections[bT].sourceId==bS||bE.connections[bT].targetId==bS){bR=bT;break}}}return bE.connections[bR]};this.paint=function(bU){bU=bU||{};var b0=bU.timestamp,bZ=!(bU.recalc===false);if(!b0||bE.timestamp!==b0){P({elId:bu,timestamp:b0,recalc:bZ});var b6=bU.offset||Z[bu];if(b6){var bX=bU.anchorPoint,bV=bU.connectorPaintStyle;if(bX==null){var bR=bU.dimensions||W[bu];if(b6==null||bR==null){P({elId:bu,timestamp:b0});b6=Z[bu];bR=W[bu]}var bT={xy:[b6.left,b6.top],wh:bR,element:bE,timestamp:b0};if(bZ&&bE.anchor.isDynamic&&bE.connections.length>0){var b3=bA(bU.elementWithPrecedence),b5=b3.endpoints[0]==bE?1:0,bW=b5==0?b3.sourceId:b3.targetId,b2=Z[bW],b4=W[bW];bT.txy=[b2.left,b2.top];bT.twh=b4;bT.tElement=b3.endpoints[b5]}bX=bE.anchor.compute(bT)}var b1=bB.compute(bX,bE.anchor.getOrientation(bB),bE.paintStyleInUse,bV||bE.paintStyleInUse);bB.paint(b1,bE.paintStyleInUse,bE.anchor);bE.timestamp=b0;for(var bY=0;bY<bE.overlays.length;bY++){var bS=bE.overlays[bY];if(bS.isVisible){bE.overlayPlacements[bY]=bS.draw(bE.endpoint,bE.paintStyleInUse,b1)}}}}};this.repaint=this.paint;this.removeConnection=this.detach;if(o.CurrentLibrary.isDragSupported(bD)){var bI={id:null,element:null},bH=null,bl=false,bq=null,bk=a1(bI);var bs=function(){bH=bE.connectorSelector();var bR=true;if(!bE.isEnabled()){bR=false}if(bH==null&&!bP.isSource){bR=false}if(bP.isSource&&bE.isFull()&&!bz){bR=false}if(bH!=null&&!bH.isDetachable()){bR=false}if(bR===false){if(o.CurrentLibrary.stopDrag){o.CurrentLibrary.stopDrag()}bk.stopDrag();return false}if(bH&&!bE.isFull()&&bP.isSource){bH=null}P({elId:bu});br=bE.makeInPlaceCopy();br.paint();K(bI,bE.parent);var bX=A(br.canvas),bV=o.CurrentLibrary.getOffset(bX),bS=bd([bV.left,bV.top],br.canvas);o.CurrentLibrary.setOffset(bI.element,{left:bS[0],top:bS[1]});if(bE.parentAnchor){bE.anchor=bc.makeAnchor(bE.parentAnchor,bE.elementId,bc)}f(A(bE.canvas),"dragId",bI.id);f(A(bE.canvas),"elId",bu);bN=ai(bE.paintStyle,bE.anchor,bB,bE.canvas,bI.element);if(bH==null){bE.anchor.locked=true;bE.setHover(false,false);bH=V({sourceEndpoint:bE,targetEndpoint:bN,source:bE.endpointWillMoveTo||A(bD),target:bI.element,anchors:[bE.anchor,bN.anchor],paintStyle:bP.connectorStyle,hoverPaintStyle:bP.connectorHoverStyle,connector:bP.connector,overlays:bP.connectorOverlays})}else{bl=true;bH.connector.setHover(false,false);bt(A(br.canvas),false,true);var bU=bH.endpoints[0].id==bE.id?0:1;bH.floatingAnchorIndex=bU;bE.detachFromConnection(bH);var bY=A(bE.canvas),bW=o.CurrentLibrary.getDragScope(bY);f(bY,"originalScope",bW);var bT=o.CurrentLibrary.getDropScope(bY);o.CurrentLibrary.setDragScope(bY,bT);if(bU==0){bq=[bH.source,bH.sourceId,bL,bW];bH.source=bI.element;bH.sourceId=bI.id}else{bq=[bH.target,bH.targetId,bL,bW];bH.target=bI.element;bH.targetId=bI.id}bH.endpoints[bU==0?1:0].anchor.locked=true;bH.suspendedEndpoint=bH.endpoints[bU];bH.suspendedEndpoint.setHover(false);bH.endpoints[bU]=bN;aT(bH)}a4[bI.id]=bH;bN.addConnection(bH);O(aI,bI.id,bN);bc.currentlyDragging=true};var bo=o.CurrentLibrary,bK=bP.dragOptions||{},bF=o.extend({},bo.defaultDragOptions),bG=bo.dragEvents.start,bO=bo.dragEvents.stop,bw=bo.dragEvents.drag;bK=o.extend(bF,bK);bK.scope=bK.scope||bE.scope;bK[bG]=ad(bK[bG],bs);bK[bw]=ad(bK[bw],bk.drag);bK[bO]=ad(bK[bO],function(){bc.currentlyDragging=false;y(aI[bI.id],function(bS){return bS.id==bN.id});aM([bI.element[0],bN.canvas],bD);aj(br.canvas,bD);bc.anchorManager.clearFor(bI.id);var bR=bH.floatingAnchorIndex==null?1:bH.floatingAnchorIndex;bH.endpoints[bR==0?1:0].anchor.locked=false;if(bH.endpoints[bR]==bN){if(bl&&bH.suspendedEndpoint){if(bR==0){bH.source=bq[0];bH.sourceId=bq[1]}else{bH.target=bq[0];bH.targetId=bq[1]}o.CurrentLibrary.setDragScope(bq[2],bq[3]);bH.endpoints[bR]=bH.suspendedEndpoint;if(bE.isReattach||bH._forceDetach||!bH.endpoints[bR==0?1:0].detach(bH)){bH.setHover(false);bH.floatingAnchorIndex=null;bH.suspendedEndpoint.addConnection(bH);bc.repaint(bq[1])}bH._forceDetach=null}else{aM(bH.connector.getDisplayElements(),bE.parent);bE.detachFromConnection(bH)}}bE.anchor.locked=false;bE.paint({recalc:false});bH.setHover(false,false);aG(bH);bH=null;br=null;delete aI[bN.elementId];bN.anchor=null;bN=null;bc.currentlyDragging=false});var bL=A(bE.canvas);o.CurrentLibrary.initDraggable(bL,bK,true)}var bt=function(bT,bY,bW,bZ){if((bP.isTarget||bY)&&o.CurrentLibrary.isDropSupported(bD)){var bU=bP.dropOptions||bc.Defaults.DropOptions||o.Defaults.DropOptions;bU=o.extend({},bU);bU.scope=bU.scope||bE.scope;var bS=o.CurrentLibrary.dragEvents.drop,bX=o.CurrentLibrary.dragEvents.over,bR=o.CurrentLibrary.dragEvents.out,bV=function(){var b0=o.CurrentLibrary.getDropEvent(arguments);var cb=A(o.CurrentLibrary.getDragObject(arguments)),b1=d(cb,"dragId"),b3=d(cb,"elId"),ca=d(cb,"originalScope"),b6=a4[b1];if(b6!=null){var b7=b6.floatingAnchorIndex==null?1:b6.floatingAnchorIndex,b8=b7==0?1:0;if(ca){o.CurrentLibrary.setDragScope(cb,ca)}var b9=bZ!=null?bZ.isEnabled():true;if(!bE.isFull()&&!(b7==0&&!bE.isSource)&&!(b7==1&&!bE.isTarget)&&b9){var b4=true;if(b6.suspendedEndpoint&&b6.suspendedEndpoint.id!=bE.id){if(b7==0){b6.source=b6.suspendedEndpoint.element;b6.sourceId=b6.suspendedEndpoint.elementId}else{b6.target=b6.suspendedEndpoint.element;b6.targetId=b6.suspendedEndpoint.elementId}if(!b6.isDetachAllowed(b6)||!b6.endpoints[b7].isDetachAllowed(b6)||!b6.suspendedEndpoint.isDetachAllowed(b6)||!bc.checkCondition("beforeDetach",b6)){b4=false}}if(b7==0){b6.source=bE.element;b6.sourceId=bE.elementId}else{b6.target=bE.element;b6.targetId=bE.elementId}b4=b4&&bE.isDropAllowed(b6.sourceId,b6.targetId,b6.scope);if(b4){b6.endpoints[b7].detachFromConnection(b6);if(b6.suspendedEndpoint){b6.suspendedEndpoint.detachFromConnection(b6)}b6.endpoints[b7]=bE;bE.addConnection(b6);if(!b6.suspendedEndpoint){a0(bE.element,bP.draggable,{})}else{var b5=b6.suspendedEndpoint.getElement(),b2=b6.suspendedEndpoint.elementId;aW({source:b7==0?b5:b6.source,target:b7==1?b5:b6.target,sourceId:b7==0?b2:b6.sourceId,targetId:b7==1?b2:b6.targetId,sourceEndpoint:b7==0?b6.suspendedEndpoint:b6.endpoints[0],targetEndpoint:b7==1?b6.suspendedEndpoint:b6.endpoints[1],connection:b6},true,b0)}bi(b6,null,b0)}else{if(b6.suspendedEndpoint){b6.endpoints[b7]=b6.suspendedEndpoint;b6.setHover(false);b6._forceDetach=true;if(b7==0){b6.source=b6.suspendedEndpoint.element;b6.sourceId=b6.suspendedEndpoint.elementId}else{b6.target=b6.suspendedEndpoint.element;b6.targetId=b6.suspendedEndpoint.elementId}b6.suspendedEndpoint.addConnection(b6);b6.endpoints[0].repaint();b6.repaint();bc.repaint(b6.source.elementId);b6._forceDetach=false}}b6.floatingAnchorIndex=null}bc.currentlyDragging=false;delete a4[b1]}};bU[bS]=ad(bU[bS],bV);bU[bX]=ad(bU[bX],function(){if(bE.isTarget){var b1=o.CurrentLibrary.getDragObject(arguments),b3=d(A(b1),"dragId"),b2=a4[b3];if(b2!=null){var b0=b2.floatingAnchorIndex==null?1:b2.floatingAnchorIndex;b2.endpoints[b0].anchor.over(bE.anchor)}}});bU[bR]=ad(bU[bR],function(){if(bE.isTarget){var b1=o.CurrentLibrary.getDragObject(arguments),b3=d(A(b1),"dragId"),b2=a4[b3];if(b2!=null){var b0=b2.floatingAnchorIndex==null?1:b2.floatingAnchorIndex;b2.endpoints[b0].anchor.out()}}});o.CurrentLibrary.initDroppable(bT,bU,true,bW)}};bt(A(bE.canvas),true,!(bP._transient||bE.anchor.isFloating),bE);return bE}};var o=window.jsPlumb=new v();o.getInstance=function(F){var E=new v(F);E.init();return E};o.util={convertStyle:function(F,E){if("transparent"===F){return F}var K=F,J=function(L){return L.length==1?"0"+L:L},G=function(L){return J(Number(L).toString(16))},H=/(rgb[a]?\()(.*)(\))/;if(F.match(H)){var I=F.match(H)[2].split(",");K="#"+G(I[0])+G(I[1])+G(I[2]);if(!E&&I.length==4){K=K+G(I[3])}}return K},gradient:function(F,E){F=F.constructor==Array?F:[F.x,F.y];E=E.constructor==Array?E:[E.x,E.y];return(E[1]-F[1])/(E[0]-F[0])},normal:function(F,E){return -1/o.util.gradient(F,E)},segment:function(F,E){F=F.constructor==Array?F:[F.x,F.y];E=E.constructor==Array?E:[E.x,E.y];if(E[0]>F[0]){return(E[1]>F[1])?2:1}else{return(E[1]>F[1])?3:4}},intersects:function(J,I){var G=J.x,E=J.x+J.w,N=J.y,L=J.y+J.h,H=I.x,F=I.x+I.w,M=I.y,K=I.y+I.h;return((G<H&&H<E)&&(N<M&&M<L))||((G<F&&F<E)&&(N<M&&M<L))||((G<H&&H<E)&&(N<K&&K<L))||((G<F&&H<E)&&(N<K&&K<L))||((H<G&&G<F)&&(M<N&&N<K))||((H<E&&E<F)&&(M<N&&N<K))||((H<G&&G<F)&&(M<L&&L<K))||((H<E&&G<F)&&(M<L&&L<K))},segmentMultipliers:[null,[1,-1],[1,1],[-1,1],[-1,-1]],inverseSegmentMultipliers:[null,[-1,-1],[-1,1],[1,1],[1,-1]],pointOnLine:function(E,I,F){var H=o.util.gradient(E,I),M=o.util.segment(E,I),L=F>0?o.util.segmentMultipliers[M]:o.util.inverseSegmentMultipliers[M],G=Math.atan(H),J=Math.abs(F*Math.sin(G))*L[1],K=Math.abs(F*Math.cos(G))*L[0];return{x:E.x+K,y:E.y+J}},perpendicularLineTo:function(G,H,I){var F=o.util.gradient(G,H),J=Math.atan(-1/F),K=I/2*Math.sin(J),E=I/2*Math.cos(J);return[{x:H.x+E,y:H.y+K},{x:H.x-E,y:H.y-K}]}};var q=function(E,J,G,F,I,H){return function(L){L=L||{};var K=L.jsPlumbInstance.makeAnchor([E,J,G,F,0,0],L.elementId,L.jsPlumbInstance);K.type=I;if(H){H(K,L)}return K}};o.Anchors.TopCenter=q(0.5,0,0,-1,"TopCenter");o.Anchors.BottomCenter=q(0.5,1,0,1,"BottomCenter");o.Anchors.LeftMiddle=q(0,0.5,-1,0,"LeftMiddle");o.Anchors.RightMiddle=q(1,0.5,1,0,"RightMiddle");o.Anchors.Center=q(0.5,0.5,0,0,"Center");o.Anchors.TopRight=q(1,0,0,-1,"TopRight");o.Anchors.BottomRight=q(1,1,0,1,"BottomRight");o.Anchors.TopLeft=q(0,0,0,-1,"TopLeft");o.Anchors.BottomLeft=q(0,1,0,1,"BottomLeft");o.Defaults.DynamicAnchors=function(E){return E.jsPlumbInstance.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],E.elementId,E.jsPlumbInstance)};o.Anchors.AutoDefault=function(F){var E=F.jsPlumbInstance.makeDynamicAnchor(o.Defaults.DynamicAnchors(F));E.type="AutoDefault";return E};o.Anchors.Assign=q(0,0,0,0,"Assign",function(F,G){var E=G.position||"Fixed";F.positionFinder=E.constructor==String?G.jsPlumbInstance.AnchorPositionFinders[E]:E;F.constructorParams=G});o.Anchors.Continuous=function(E){return E.jsPlumbInstance.continuousAnchorFactory.get(E)};o.AnchorPositionFinders={Fixed:function(H,E,G,F){return[(H.left-E.left)/G[0],(H.top-E.top)/G[1]]},Grid:function(E,N,I,F){var M=E.left-N.left,L=E.top-N.top,K=I[0]/(F.grid[0]),J=I[1]/(F.grid[1]),H=Math.floor(M/K),G=Math.floor(L/J);return[((H*K)+(K/2))/I[0],((G*J)+(J/2))/I[1]]}}})();(function(){jsPlumb.DOMElementComponent=function(c){jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.mousemove=this.dblclick=this.click=this.mousedown=this.mouseup=function(d){}};jsPlumb.Connectors.Straight=function(){this.type="Straight";var r=this,i=null,e,k,p,n,l,f,q,h,g,d,c,o,m;this.compute=function(A,J,s,z,F,t,D,v){var I=Math.abs(A[0]-J[0]),C=Math.abs(A[1]-J[1]),B=0.45*I,u=0.45*C;I*=1.9;C*=1.9;var G=Math.min(A[0],J[0])-B;var E=Math.min(A[1],J[1])-u;var H=Math.max(2*D,v);if(I<H){I=H;G=A[0]+((J[0]-A[0])/2)-(H/2);B=(I-Math.abs(A[0]-J[0]))/2}if(C<H){C=H;E=A[1]+((J[1]-A[1])/2)-(H/2);u=(C-Math.abs(A[1]-J[1]))/2}h=A[0]<J[0]?B:I-B;g=A[1]<J[1]?u:C-u;d=A[0]<J[0]?I-B:B;c=A[1]<J[1]?C-u:u;i=[G,E,I,C,h,g,d,c];n=d-h,l=c-g;e=jsPlumb.util.gradient({x:h,y:g},{x:d,y:c}),k=-1/e;p=-1*((e*h)-g);f=Math.atan(e);q=Math.atan(k);m=Math.sqrt((n*n)+(l*l));return i};this.pointOnPath=function(s){if(s==0){return{x:h,y:g}}else{if(s==1){return{x:d,y:c}}else{return jsPlumb.util.pointOnLine({x:h,y:g},{x:d,y:c},s*m)}}};this.gradientAtPoint=function(s){return e};this.pointAlongPathFrom=function(s,v){var u=r.pointOnPath(s),t=s==1?{x:h+((d-h)*10),y:g+((g-c)*10)}:{x:d,y:c};return jsPlumb.util.pointOnLine(u,t,v)}};jsPlumb.Connectors.Bezier=function(u){var o=this;u=u||{};this.majorAnchor=u.curviness||150;this.minorAnchor=10;var s=null;this.type="Bezier";this._findControlPoint=function(G,v,B,w,z,E,x){var D=E.getOrientation(w),F=x.getOrientation(z),A=D[0]!=F[0]||D[1]==F[1],y=[],H=o.majorAnchor,C=o.minorAnchor;if(!A){if(D[0]==0){y.push(v[0]<B[0]?G[0]+C:G[0]-C)}else{y.push(G[0]-(H*D[0]))}if(D[1]==0){y.push(v[1]<B[1]?G[1]+C:G[1]-C)}else{y.push(G[1]+(H*F[1]))}}else{if(F[0]==0){y.push(B[0]<v[0]?G[0]+C:G[0]-C)}else{y.push(G[0]+(H*F[0]))}if(F[1]==0){y.push(B[1]<v[1]?G[1]+C:G[1]-C)}else{y.push(G[1]+(H*D[1]))}}return y};var p,l,f,n,m,f,e,r,q,t,d,h,g,k,i;this.compute=function(R,y,L,z,P,w,v,K){v=v||0;t=Math.abs(R[0]-y[0])+v;d=Math.abs(R[1]-y[1])+v;r=Math.min(R[0],y[0])-(v/2);q=Math.min(R[1],y[1])-(v/2);f=R[0]<y[0]?t-(v/2):(v/2);e=R[1]<y[1]?d-(v/2):(v/2);n=R[0]<y[0]?(v/2):t-(v/2);m=R[1]<y[1]?(v/2):d-(v/2);p=o._findControlPoint([f,e],R,y,L,z,P,w);l=o._findControlPoint([n,m],y,R,L,z,w,P);var J=Math.min(f,n),I=Math.min(p[0],l[0]),E=Math.min(J,I),Q=Math.max(f,n),N=Math.max(p[0],l[0]),B=Math.max(Q,N);if(B>t){t=B}if(E<0){r+=E;var G=Math.abs(E);t+=G;p[0]+=G;f+=G;n+=G;l[0]+=G}var O=Math.min(e,m),M=Math.min(p[1],l[1]),A=Math.min(O,M),F=Math.max(e,m),D=Math.max(p[1],l[1]),x=Math.max(F,D);if(x>d){d=x}if(A<0){q+=A;var C=Math.abs(A);d+=C;p[1]+=C;e+=C;m+=C;l[1]+=C}if(K&&t<K){var H=(K-t)/2;t=K;r-=H;f=f+H;n=n+H;p[0]=p[0]+H;l[0]=l[0]+H}if(K&&d<K){var H=(K-d)/2;d=K;q-=H;e=e+H;m=m+H;p[1]=p[1]+H;l[1]=l[1]+H}s=[r,q,t,d,f,e,n,m,p[0],p[1],l[0],l[1]];return s};var c=function(){return[{x:f,y:e},{x:p[0],y:p[1]},{x:l[0],y:l[1]},{x:n,y:m}]};this.pointOnPath=function(v){return jsBezier.pointOnCurve(c(),v)};this.gradientAtPoint=function(v){return jsBezier.gradientAtPoint(c(),v)};this.pointAlongPathFrom=function(v,w){return jsBezier.pointAlongCurveFrom(c(),v,w)}};jsPlumb.Connectors.Flowchart=function(k){this.type="Flowchart";k=k||{};var r=this,f=k.stub||k.minStubLength||30,m=[],q=0,o=[],e=[],p=[],h,g,d=0,c=0,l=function(u,t,y,x){var w=0;for(var v=0;v<m.length;v++){e[v]=m[v][5]/q;o[v]=[w,(w+=(m[v][5]/q))]}},s=function(){p.push(m.length);for(var t=0;t<m.length;t++){p.push(m[t][0]);p.push(m[t][1])}},i=function(E,B,D,C,A,z){var u=m.length==0?D:m[m.length-1][0],t=m.length==0?C:m[m.length-1][1],v=E==u?Infinity:0,w=Math.abs(E==u?B-t:E-u);m.push([E,B,u,t,v,w]);q+=w;d=Math.max(d,E);c=Math.max(c,B)},n=function(v){var t=o.length-1,u=1;for(var w=0;w<o.length;w++){if(o[w][1]>=v){t=w;u=(v-o[w][0])/e[w];break}}return{segment:m[t],proportion:u,index:t}};this.compute=function(R,af,t,L,ap,F,P,K,ak,ah){m=[];q=0;e=[];d=c=0;h=af[0]<R[0];g=af[1]<R[1];var V=P||1,D=(V/2)+(f*2),B=(V/2)+(f*2),I=ap.orientation||ap.getOrientation(t),aq=F.orientation||F.getOrientation(L),ae=h?af[0]:R[0],ad=g?af[1]:R[1],ag=Math.abs(af[0]-R[0])+2*D,ao=Math.abs(af[1]-R[1])+2*B;if(I[0]==0&&I[1]==0||aq[0]==0&&aq[1]==0){var X=ag>ao?0:1,Z=[1,0][X];I=[];aq=[];I[X]=R[X]>af[X]?-1:1;aq[X]=R[X]>af[X]?1:-1;I[Z]=0;aq[Z]=0}if(ag<K){D+=(K-ag)/2;ag=K}if(ao<K){B+=(K-ao)/2;ao=K}var C=h?ag-D:D,A=g?ao-B:B,am=h?D:ag-D,al=g?B:ao-B,U=C+(I[0]*f),T=A+(I[1]*f),G=am+(aq[0]*f),E=al+(aq[1]*f),Q=Math.abs(C-am)>2*f,S=Math.abs(A-al)>2*f,ac=U+((G-U)/2),aa=T+((E-T)/2),J=((I[0]*aq[0])+(I[1]*aq[1])),W=J==-1,Y=J==0,u=J==1;ae-=D;ad-=B;p=[ae,ad,ag,ao,C,A,am,al];var aj=[];i(U,T,C,A,am,al);var N=I[0]==0?"y":"x",H=W?"opposite":u?"orthogonal":"perpendicular",v=jsPlumb.util.segment([C,A],[am,al]),ab=I[N=="x"?0:1]==-1,M={x:[null,4,3,2,1],y:[null,2,1,4,3]};if(ab){v=M[N][v]}var O=function(ar,y,w,x){return ar+(y*((1-w)*x)+f)},z={oppositex:function(){if(t.elementId==L.elementId){var w=T+((1-ap.y)*ak.height)+f;return[[U,w],[G,w]]}else{if(Q&&(v==1||v==2)){return[[ac,A],[ac,al]]}else{return[[U,aa],[G,aa]]}}},orthogonalx:function(){if(v==1||v==2){return[[G,T]]}else{return[[U,E]]}},perpendicularx:function(){var w=(al+A)/2;if((v==1&&aq[1]==1)||(v==2&&aq[1]==-1)){if(Math.abs(am-C)>f){return[[G,T]]}else{return[[U,T],[U,w],[G,w]]}}else{if((v==3&&aq[1]==-1)||(v==4&&aq[1]==1)){return[[U,w],[G,w]]}else{if((v==3&&aq[1]==1)||(v==4&&aq[1]==-1)){return[[U,E]]}else{if((v==1&&aq[1]==-1)||(v==2&&aq[1]==1)){if(Math.abs(am-C)>f){return[[ac,T],[ac,E]]}else{return[[U,E]]}}}}}},oppositey:function(){if(t.elementId==L.elementId){var w=U+((1-ap.x)*ak.width)+f;return[[w,T],[w,E]]}else{if(S&&(v==2||v==3)){return[[C,aa],[am,aa]]}else{return[[ac,T],[ac,E]]}}},orthogonaly:function(){if(v==2||v==3){return[[U,E]]}else{return[[G,T]]}},perpendiculary:function(){var w=(am+C)/2;if((v==2&&aq[0]==-1)||(v==3&&aq[0]==1)){if(Math.abs(am-C)>f){return[[U,E]]}else{return[[U,aa],[G,aa]]}}else{if((v==1&&aq[0]==-1)||(v==4&&aq[0]==1)){var w=(am+C)/2;return[[w,T],[w,E]]}else{if((v==1&&aq[0]==1)||(v==4&&aq[0]==-1)){return[[G,T]]}else{if((v==2&&aq[0]==1)||(v==3&&aq[0]==-1)){if(Math.abs(al-A)>f){return[[U,aa],[G,aa]]}else{return[[G,T]]}}}}}}};var ai=z[H+N]();if(ai){for(var an=0;an<ai.length;an++){i(ai[an][0],ai[an][1],C,A,am,al)}}i(G,E,C,A,am,al);i(am,al,C,A,am,al);s();l(C,A,am,al);if(c>p[3]){p[3]=c+(P*2)}if(d>p[2]){p[2]=d+(P*2)}return p};this.pointOnPath=function(t){return r.pointAlongPathFrom(t,0)};this.gradientAtPoint=function(t){return m[n(t)["index"]][4]};this.pointAlongPathFrom=function(w,A){var x=n(w),v=x.segment,z=x.proportion,u=m[x.index][5],t=m[x.index][4];var y={x:t==Infinity?v[2]:v[2]>v[0]?v[0]+((1-z)*u)-A:v[2]+(z*u)+A,y:t==0?v[3]:v[3]>v[1]?v[1]+((1-z)*u)-A:v[3]+(z*u)+A,segmentInfo:x};return y}};jsPlumb.Endpoints.Dot=function(d){this.type="Dot";var c=this;d=d||{};this.radius=d.radius||10;this.defaultOffset=0.5*this.radius;this.defaultInnerRadius=this.radius/3;this.compute=function(i,f,l,h){var g=l.radius||c.radius,e=i[0]-g,k=i[1]-g;return[e,k,g*2,g*2,g]}};jsPlumb.Endpoints.Rectangle=function(d){this.type="Rectangle";var c=this;d=d||{};this.width=d.width||20;this.height=d.height||20;this.compute=function(k,g,m,i){var h=m.width||c.width,f=m.height||c.height,e=k[0]-(h/2),l=k[1]-(f/2);return[e,l,h,f]}};var a=function(e){jsPlumb.DOMElementComponent.apply(this,arguments);var c=this;var d=[];this.getDisplayElements=function(){return d};this.appendDisplayElement=function(f){d.push(f)}};jsPlumb.Endpoints.Image=function(g){this.type="Image";a.apply(this,arguments);var l=this,f=false,e=g.width,d=g.height,i=null,c=g.endpoint;this.img=new Image();l.ready=false;this.img.onload=function(){l.ready=true;e=e||l.img.width;d=d||l.img.height;if(i){i(l)}};c.setImage=function(m,o){var n=m.constructor==String?m:m.src;i=o;l.img.src=m};c.setImage(g.src||g.url,g.onload);this.compute=function(o,m,p,n){l.anchorPoint=o;if(l.ready){return[o[0]-e/2,o[1]-d/2,e,d]}else{return[0,0,0,0]}};l.canvas=document.createElement("img"),f=false;l.canvas.style.margin=0;l.canvas.style.padding=0;l.canvas.style.outline=0;l.canvas.style.position="absolute";var h=g.cssClass?" "+g.cssClass:"";l.canvas.className=jsPlumb.endpointClass+h;if(e){l.canvas.setAttribute("width",e)}if(d){l.canvas.setAttribute("height",d)}jsPlumb.appendElement(l.canvas,g.parent);l.attachListeners(l.canvas,l);var k=function(p,o,n){if(!f){l.canvas.setAttribute("src",l.img.src);f=true}var m=l.anchorPoint[0]-(e/2),q=l.anchorPoint[1]-(d/2);jsPlumb.sizeCanvas(l.canvas,m,q,e,d)};this.paint=function(o,n,m){if(l.ready){k(o,n,m)}else{window.setTimeout(function(){l.paint(o,n,m)},200)}}};jsPlumb.Endpoints.Blank=function(d){var c=this;this.type="Blank";a.apply(this,arguments);this.compute=function(g,e,h,f){return[g[0],g[1],10,0]};c.canvas=document.createElement("div");c.canvas.style.display="block";c.canvas.style.width="1px";c.canvas.style.height="1px";c.canvas.style.background="transparent";c.canvas.style.position="absolute";c.canvas.className=c._jsPlumb.endpointClass;jsPlumb.appendElement(c.canvas,d.parent);this.paint=function(g,f,e){jsPlumb.sizeCanvas(c.canvas,g[0],g[1],g[2],g[3])}};jsPlumb.Endpoints.Triangle=function(c){this.type="Triangle";c=c||{};c.width=c.width||55;c.height=c.height||55;this.width=c.width;this.height=c.height;this.compute=function(i,f,l,h){var g=l.width||self.width,e=l.height||self.height,d=i[0]-(g/2),k=i[1]-(e/2);return[d,k,g,e]}};var b=function(e){var d=true,c=this;this.isAppendedAtTopLevel=true;this.component=e.component;this.loc=e.location==null?0.5:e.location;this.endpointLoc=e.endpointLocation==null?[0.5,0.5]:e.endpointLocation;this.setVisible=function(f){d=f;c.component.repaint()};this.isVisible=function(){return d};this.hide=function(){c.setVisible(false)};this.show=function(){c.setVisible(true)};this.incrementLocation=function(f){c.loc+=f;c.component.repaint()};this.setLocation=function(f){c.loc=f;c.component.repaint()};this.getLocation=function(){return c.loc}};jsPlumb.Overlays.Arrow=function(g){this.type="Arrow";b.apply(this,arguments);this.isAppendedAtTopLevel=false;g=g||{};var d=this;this.length=g.length||20;this.width=g.width||20;this.id=g.id;var f=(g.direction||1)<0?-1:1,e=g.paintStyle||{lineWidth:1},c=g.foldback||0.623;this.computeMaxSize=function(){return d.width*1.5};this.cleanup=function(){};this.draw=function(i,x,s){var m,t,h,n,l;if(i.pointAlongPathFrom){if(d.loc==1){m=i.pointOnPath(d.loc);t=i.pointAlongPathFrom(d.loc,-1);h=jsPlumb.util.pointOnLine(m,t,d.length)}else{if(d.loc==0){h=i.pointOnPath(d.loc);t=i.pointAlongPathFrom(d.loc,1);m=jsPlumb.util.pointOnLine(h,t,d.length)}else{m=i.pointAlongPathFrom(d.loc,f*d.length/2),t=i.pointOnPath(d.loc),h=jsPlumb.util.pointOnLine(m,t,d.length)}}n=jsPlumb.util.perpendicularLineTo(m,h,d.width);l=jsPlumb.util.pointOnLine(m,h,c*d.length);var w=Math.min(m.x,n[0].x,n[1].x),q=Math.max(m.x,n[0].x,n[1].x),v=Math.min(m.y,n[0].y,n[1].y),p=Math.max(m.y,n[0].y,n[1].y);var o={hxy:m,tail:n,cxy:l},r=e.strokeStyle||x.strokeStyle,u=e.fillStyle||x.strokeStyle,k=e.lineWidth||x.lineWidth;d.paint(i,o,k,r,u,s);return[w,q,v,p]}else{return[0,0,0,0]}}};jsPlumb.Overlays.PlainArrow=function(d){d=d||{};var c=jsPlumb.extend(d,{foldback:1});jsPlumb.Overlays.Arrow.call(this,c);this.type="PlainArrow"};jsPlumb.Overlays.Diamond=function(e){e=e||{};var c=e.length||40,d=jsPlumb.extend(e,{length:c/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,d);this.type="Diamond"};jsPlumb.Overlays.Label=function(i){this.type="Label";jsPlumb.DOMElementComponent.apply(this,arguments);b.apply(this,arguments);this.labelStyle=i.labelStyle||jsPlumb.Defaults.LabelStyle;this.id=i.id;this.cachedDimensions=null;var e=i.label||"",c=this,f=false,k=document.createElement("div"),g=null;k.style.position="absolute";var d=i._jsPlumb.overlayClass+" "+(c.labelStyle.cssClass?c.labelStyle.cssClass:i.cssClass?i.cssClass:"");k.className=d;jsPlumb.appendElement(k,i.component.parent);jsPlumb.getId(k);c.attachListeners(k,c);c.canvas=k;var h=c.setVisible;c.setVisible=function(l){h(l);k.style.display=l?"block":"none"};this.getElement=function(){return k};this.cleanup=function(){if(k!=null){jsPlumb.CurrentLibrary.removeElement(k)}};this.setLabel=function(m){e=m;g=null;c.component.repaint()};this.getLabel=function(){return e};this.paint=function(l,n,m){if(!f){l.appendDisplayElement(k);c.attachListeners(k,l);f=true}k.style.left=(m[0]+n.minx)+"px";k.style.top=(m[1]+n.miny)+"px"};this.getTextDimensions=function(){if(typeof e=="function"){var l=e(c);k.innerHTML=l.replace(/\r\n/g,"<br/>")}else{if(g==null){g=e;k.innerHTML=g.replace(/\r\n/g,"<br/>")}}var n=jsPlumb.CurrentLibrary.getElementObject(k),m=jsPlumb.CurrentLibrary.getSize(n);return{width:m[0],height:m[1]}};this.computeMaxSize=function(l){var m=c.getTextDimensions(l);return m.width?Math.max(m.width,m.height)*1.5:0};this.draw=function(m,n,o){var q=c.getTextDimensions(m);if(q.width!=null){var p={x:0,y:0};if(m.pointOnPath){p=m.pointOnPath(c.loc)}else{var l=c.loc.constructor==Array?c.loc:c.endpointLoc;p={x:l[0]*o[2],y:l[1]*o[3]}}minx=p.x-(q.width/2),miny=p.y-(q.height/2);c.paint(m,{minx:minx,miny:miny,td:q,cxy:p},o);return[minx,minx+q.width,miny,miny+q.height]}else{return[0,0,0,0]}};this.reattachListeners=function(l){if(k){c.reattachListenersForElement(k,c,l)}}};jsPlumb.Overlays.GuideLines=function(){var c=this;c.length=50;c.lineWidth=5;this.type="GuideLines";b.apply(this,arguments);jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.draw=function(e,l,k){var i=e.pointAlongPathFrom(c.loc,c.length/2),h=e.pointOnPath(c.loc),g=jsPlumb.util.pointOnLine(i,h,c.length),f=jsPlumb.util.perpendicularLineTo(i,g,40),d=jsPlumb.util.perpendicularLineTo(g,i,20);c.paint(e,[i,g,f,d],c.lineWidth,"red",null,k);return[Math.min(i.x,g.x),Math.min(i.y,g.y),Math.max(i.x,g.x),Math.max(i.y,g.y)]};this.computeMaxSize=function(){return 50};this.cleanup=function(){}}})();(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 s=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;this.type="StateMachine";l=l||{};this.compute=function(ab,F,U,G,aa,u,t,S){var O=Math.abs(ab[0]-F[0]),W=Math.abs(ab[1]-F[1]),Q=0.45*O,Z=0.45*W;O*=1.9;W*=1.9;t=t||1;var M=Math.min(ab[0],F[0])-Q,K=Math.min(ab[1],F[1])-Z;if(U.elementId!=G.elementId){h=false;o=ab[0]<F[0]?Q:O-Q;m=ab[1]<F[1]?Z:W-Z;g=ab[0]<F[0]?O-Q:Q;e=ab[1]<F[1]?W-Z:Z;if(ab[2]==0){o-=k}if(ab[2]==1){o+=k}if(ab[3]==0){m-=k}if(ab[3]==1){m+=k}if(F[2]==0){g-=k}if(F[2]==1){g+=k}if(F[3]==0){e-=k}if(F[3]==1){e+=k}var L=(o+g)/2,J=(m+e)/2,v=(-1*L)/J,T=Math.atan(v),N=(v==Infinity||v==-Infinity)?0:Math.abs(d/2*Math.sin(T)),P=(v==Infinity||v==-Infinity)?0:Math.abs(d/2*Math.cos(T)),z=a(o,m,g,e),H=Math.sqrt(Math.pow(g-o,2)+Math.pow(e-m,2));p=b(L,J,z,ab,F,d,d,H,q);var E=Math.max(Math.abs(p[0]-o)*3,Math.abs(p[0]-g)*3,Math.abs(g-o),2*t,S),I=Math.max(Math.abs(p[1]-m)*3,Math.abs(p[1]-e)*3,Math.abs(e-m),2*t,S);if(O<E){var R=E-O;M-=(R/2);o+=(R/2);g+=(R/2);O=E;p[0]+=(R/2)}if(W<I){var Y=I-W;K-=(Y/2);m+=(Y/2);e+=(Y/2);W=I;p[1]+=(Y/2)}n=[M,K,O,W,o,m,g,e,p[0],p[1]]}else{h=true;var X=ab[0],V=ab[0],D=ab[1]-k,B=ab[1]-k,C=X,A=D-i;O=((2*t)+(4*i)),W=((2*t)+(4*i));M=C-i-t-i,K=A-i-t-i;n=[M,K,O,W,C-M,A-K,i,f,X-M,D-K,V-M,B-K]}return n};var r=function(){return[{x:g,y:e},{x:p[0],y:p[1]},{x:p[0]+1,y:p[1]+1},{x:o,y:m}]};this.pointOnPath=function(v){if(h){if(v>0&&v<1){v=1-v}var w=(v*2*Math.PI)+(Math.PI/2),u=n[4]+(n[6]*Math.cos(w)),t=n[5]+(n[6]*Math.sin(w));return{x:u,y:t}}else{return jsBezier.pointOnCurve(r(),v)}};this.gradientAtPoint=function(t){if(h){return Math.atan(t*2*Math.PI)}else{return jsBezier.gradientAtPoint(r(),t)}};this.pointAlongPathFrom=function(v,z){if(h){if(v>0&&v<1){v=1-v}var w=2*Math.PI*n[6],y=z/w*2*Math.PI,x=(v*2*Math.PI)-y+(Math.PI/2),u=n[4]+(n[6]*Math.cos(x)),t=n[5]+(n[6]*Math.sin(x));return{x:u,y:t}}return jsBezier.pointAlongCurveFrom(r(),v,z)}};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.quadraticCurveTo(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 k={"stroke-linejoin":"joinstyle",joinstyle:"joinstyle",endcap:"endcap",miterlimit:"miterlimit"};if(document.createStyleSheet){document.createStyleSheet().addRule(".jsplumb_vml","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:textbox","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:oval","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:rect","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:stroke","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:shape","behavior:url(#default#VML);position:absolute;");document.createStyleSheet().addRule("jsplumb\\:group","behavior:url(#default#VML);position:absolute;");document.namespaces.add("jsplumb","urn:schemas-microsoft-com:vml")}jsPlumb.vml={};var b=1000,d={},h=function(q,p){var s=jsPlumb.getId(q),r=d[s];if(!r){r=o("group",[0,0,b,b],{"class":p});r.style.backgroundColor="red";d[s]=r;jsPlumb.appendElement(r,q)}return r},c=function(q,r){for(var p in r){q[p]=r[p]}},o=function(p,r,s){s=s||{};var q=document.createElement("jsplumb:"+p);q.className=(s["class"]?s["class"]+" ":"")+"jsplumb_vml";n(q,r);c(q,s);return q},n=function(q,p){q.style.left=p[0]+"px";q.style.top=p[1]+"px";q.style.width=p[2]+"px";q.style.height=p[3]+"px";q.style.position="absolute"},i=jsPlumb.vml.convertValue=function(p){return Math.floor(p*b)},e=function(s,q,r,p){if("transparent"===q){p.setOpacity(r,"0.0")}else{p.setOpacity(r,"1.0")}},g=function(t,p,w){var s={};if(p.strokeStyle){s.stroked="true";var x=jsPlumb.util.convertStyle(p.strokeStyle,true);s.strokecolor=x;e(s,x,"stroke",w);s.strokeweight=p.lineWidth+"px"}else{s.stroked="false"}if(p.fillStyle){s.filled="true";var q=jsPlumb.util.convertStyle(p.fillStyle,true);s.fillcolor=q;e(s,q,"fill",w)}else{s.filled="false"}if(p.dashstyle){if(w.strokeNode==null){w.strokeNode=o("stroke",[0,0,0,0],{dashstyle:p.dashstyle});t.appendChild(w.strokeNode)}else{w.strokeNode.dashstyle=p.dashstyle}}else{if(p["stroke-dasharray"]&&p.lineWidth){var y=p["stroke-dasharray"].indexOf(",")==-1?" ":",",u=p["stroke-dasharray"].split(y),r="";for(var v=0;v<u.length;v++){r+=(Math.floor(u[v]/p.lineWidth)+y)}if(w.strokeNode==null){w.strokeNode=o("stroke",[0,0,0,0],{dashstyle:r});t.appendChild(w.strokeNode)}else{w.strokeNode.dashstyle=r}}}c(t,s)},l=function(){var p=this;jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.opacityNodes={stroke:null,fill:null};this.initOpacityNodes=function(r){p.opacityNodes.stroke=o("stroke",[0,0,1,1],{opacity:"0.0"});p.opacityNodes.fill=o("fill",[0,0,1,1],{opacity:"0.0"});r.appendChild(p.opacityNodes.stroke);r.appendChild(p.opacityNodes.fill)};this.setOpacity=function(r,t){var s=p.opacityNodes[r];if(s){s.opacity=""+t}};var q=[];this.getDisplayElements=function(){return q};this.appendDisplayElement=function(s,r){if(!r){p.canvas.parentNode.appendChild(s)}q.push(s)}},f=jsPlumb.VmlConnector=function(r){var p=this;p.strokeNode=null;p.canvas=null;l.apply(this,arguments);var q=p._jsPlumb.connectorClass+(r.cssClass?(" "+r.cssClass):"");this.paint=function(w,t,v){if(t!=null){var A=p.getPath(w),u={path:A};if(t.outlineColor){var y=t.outlineWidth||1,z=t.lineWidth+(2*y),x={strokeStyle:jsPlumb.util.convertStyle(t.outlineColor),lineWidth:z};for(var s in k){x[s]=t[s]}if(p.bgCanvas==null){u["class"]=q;u.coordsize=(w[2]*b)+","+(w[3]*b);p.bgCanvas=o("shape",w,u);r._jsPlumb.appendElement(p.bgCanvas,r.parent);n(p.bgCanvas,w);p.appendDisplayElement(p.bgCanvas,true)}else{u.coordsize=(w[2]*b)+","+(w[3]*b);n(p.bgCanvas,w);c(p.bgCanvas,u)}g(p.bgCanvas,x,p)}if(p.canvas==null){u["class"]=q;u.coordsize=(w[2]*b)+","+(w[3]*b);if(p.tooltip){u.label=p.tooltip}p.canvas=o("shape",w,u);r._jsPlumb.appendElement(p.canvas,r.parent);p.appendDisplayElement(p.canvas,true);p.attachListeners(p.canvas,p);p.initOpacityNodes(p.canvas,["stroke"])}else{u.coordsize=(w[2]*b)+","+(w[3]*b);n(p.canvas,w);c(p.canvas,u)}g(p.canvas,t,p)}};this.reattachListeners=function(){if(p.canvas){p.reattachListenersForElement(p.canvas,p)}}},m=function(t){l.apply(this,arguments);var p=null,r=this,q=null,s=null;r.canvas=document.createElement("div");r.canvas.style.position="absolute";t._jsPlumb.appendElement(r.canvas,t.parent);if(r.tooltip){r.canvas.setAttribute("label",r.tooltip)}this.paint=function(x,v,u){var w={};jsPlumb.sizeCanvas(r.canvas,x[0],x[1],x[2],x[3]);if(p==null){w["class"]=jsPlumb.endpointClass;p=r.getVml([0,0,x[2],x[3]],w,u);r.canvas.appendChild(p);r.attachListeners(p,r);r.appendDisplayElement(p,true);r.appendDisplayElement(r.canvas,true);r.initOpacityNodes(p,["fill"])}else{n(p,[0,0,x[2],x[3]]);c(p,w)}g(p,v,r)};this.reattachListeners=function(){if(p){r.reattachListenersForElement(p,r)}}};jsPlumb.Connectors.vml.Bezier=function(){jsPlumb.Connectors.Bezier.apply(this,arguments);f.apply(this,arguments);this.getPath=function(p){return"m"+i(p[4])+","+i(p[5])+" c"+i(p[8])+","+i(p[9])+","+i(p[10])+","+i(p[11])+","+i(p[6])+","+i(p[7])+" e"}};jsPlumb.Connectors.vml.Straight=function(){jsPlumb.Connectors.Straight.apply(this,arguments);f.apply(this,arguments);this.getPath=function(p){return"m"+i(p[4])+","+i(p[5])+" l"+i(p[6])+","+i(p[7])+" e"}};jsPlumb.Connectors.vml.Flowchart=function(){jsPlumb.Connectors.Flowchart.apply(this,arguments);f.apply(this,arguments);this.getPath=function(r){var s="m "+i(r[4])+","+i(r[5])+" l";for(var q=0;q<r[8];q++){s=s+" "+i(r[9+(q*2)])+","+i(r[10+(q*2)])}s=s+" "+i(r[6])+","+i(r[7])+" e";return s}};jsPlumb.Endpoints.vml.Dot=function(){jsPlumb.Endpoints.Dot.apply(this,arguments);m.apply(this,arguments);this.getVml=function(q,r,p){return o("oval",q,r)}};jsPlumb.Endpoints.vml.Rectangle=function(){jsPlumb.Endpoints.Rectangle.apply(this,arguments);m.apply(this,arguments);this.getVml=function(q,r,p){return o("rect",q,r)}};jsPlumb.Endpoints.vml.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.vml.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Overlays.vml.Label=jsPlumb.Overlays.Label;var a=function(t,r){t.apply(this,r);l.apply(this,arguments);var q=this,s=null;q.canvas=null;var p=function(v,u){return"m "+i(v.hxy.x)+","+i(v.hxy.y)+" l "+i(v.tail[0].x)+","+i(v.tail[0].y)+" "+i(v.cxy.x)+","+i(v.cxy.y)+" "+i(v.tail[1].x)+","+i(v.tail[1].y)+" x e"};this.paint=function(y,D,C,E,I,H){var v={};if(E){v.stroked="true";v.strokecolor=jsPlumb.util.convertStyle(E,true)}if(C){v.strokeweight=C+"px"}if(I){v.filled="true";v.fillcolor=I}var u=Math.min(D.hxy.x,D.tail[0].x,D.tail[1].x,D.cxy.x),G=Math.min(D.hxy.y,D.tail[0].y,D.tail[1].y,D.cxy.y),z=Math.max(D.hxy.x,D.tail[0].x,D.tail[1].x,D.cxy.x),x=Math.max(D.hxy.y,D.tail[0].y,D.tail[1].y,D.cxy.y),F=Math.abs(z-u),B=Math.abs(x-G),A=[u,G,F,B];v.path=p(D,H);v.coordsize=(H[2]*b)+","+(H[3]*b);A[0]=H[0];A[1]=H[1];A[2]=H[2];A[3]=H[3];if(q.canvas==null){q.canvas=o("shape",A,v);y.appendDisplayElement(q.canvas);q.attachListeners(q.canvas,y)}else{n(q.canvas,A);c(q.canvas,v)}};this.reattachListeners=function(){if(q.canvas){q.reattachListenersForElement(q.canvas,q)}}};jsPlumb.Overlays.vml.Arrow=function(){a.apply(this,[jsPlumb.Overlays.Arrow,arguments])};jsPlumb.Overlays.vml.PlainArrow=function(){a.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])};jsPlumb.Overlays.vml.Diamond=function(){a.apply(this,[jsPlumb.Overlays.Diamond,arguments])}})();(function(){var l={joinstyle:"stroke-linejoin","stroke-linejoin":"stroke-linejoin","stroke-dashoffset":"stroke-dashoffset","stroke-linecap":"stroke-linecap"},w="stroke-dasharray",A="dashstyle",e="linearGradient",b="radialGradient",c="fill",a="stop",z="stroke",q="stroke-width",h="style",m="none",t="jsplumb_gradient_",o="lineWidth",C={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml"},g=function(F,D){for(var E in D){F.setAttribute(E,""+D[E])}},f=function(E,D){var F=document.createElementNS(C.svg,E);D=D||{};D.version="1.1";D.xmlns=C.xhtml;g(F,D);return F},n=function(D){return"position:absolute;left:"+D[0]+"px;top:"+D[1]+"px"},i=function(E){for(var D=0;D<E.childNodes.length;D++){if(E.childNodes[D].tagName==e||E.childNodes[D].tagName==b){E.removeChild(E.childNodes[D])}}},v=function(N,I,F,D,J){var G=t+J._jsPlumb.idstamp();i(N);if(!F.gradient.offset){var L=f(e,{id:G});N.appendChild(L)}else{var L=f(b,{id:G});N.appendChild(L)}for(var K=0;K<F.gradient.stops.length;K++){var H=K;if(D.length==8){H=D[4]<D[6]?K:F.gradient.stops.length-1-K}else{H=D[4]<D[6]?F.gradient.stops.length-1-K:K}var M=jsPlumb.util.convertStyle(F.gradient.stops[H][1],true);var O=f(a,{offset:Math.floor(F.gradient.stops[K][0]*100)+"%","stop-color":M});L.appendChild(O)}var E=F.strokeStyle?z:c;I.setAttribute(h,E+":url(#"+G+")")},x=function(K,G,E,D,H){if(E.gradient){v(K,G,E,D,H)}else{i(K);G.setAttribute(h,"")}G.setAttribute(c,E.fillStyle?jsPlumb.util.convertStyle(E.fillStyle,true):m);G.setAttribute(z,E.strokeStyle?jsPlumb.util.convertStyle(E.strokeStyle,true):m);if(E.lineWidth){G.setAttribute(q,E.lineWidth)}if(E[A]&&E[o]&&!E[w]){var L=E[A].indexOf(",")==-1?" ":",",I=E[A].split(L),F="";I.forEach(function(M){F+=(Math.floor(M*E.lineWidth)+L)});G.setAttribute(w,F)}else{if(E[w]){G.setAttribute(w,E[w])}}for(var J in l){if(E[J]){G.setAttribute(l[J],E[J])}}},B=function(F){var D=/([0-9].)(p[xt])\s(.*)/;var E=F.match(D);return{size:E[1]+E[2],font:E[3]}},r=function(I,J,E){var K=E.split(" "),H=I.className,G=H.baseVal.split(" ");for(var F=0;F<K.length;F++){if(J){if(G.indexOf(K[F])==-1){G.push(K[F])}}else{var D=G.indexOf(K[F]);if(D!=-1){G.splice(D,1)}}}I.className.baseVal=G.join(" ")},u=function(E,D){r(E,true,D)},k=function(E,D){r(E,false,D)};jsPlumb.util.svg={addClass:u,removeClass:k};var s=function(H){var D=this,G=H.pointerEventsSpec||"all";jsPlumb.jsPlumbUIComponent.apply(this,H.originalArgs);D.canvas=null,D.path=null,D.svg=null;var F=H.cssClass+" "+(H.originalArgs[0].cssClass||""),I={style:"",width:0,height:0,"pointer-events":G,position:"absolute"};if(D.tooltip){I.title=D.tooltip}D.svg=f("svg",I);if(H.useDivWrapper){D.canvas=document.createElement("div");D.canvas.style.position="absolute";jsPlumb.sizeCanvas(D.canvas,0,0,1,1);D.canvas.className=F;if(D.tooltip){D.canvas.setAttribute("title",D.tooltip)}}else{g(D.svg,{"class":F});D.canvas=D.svg}H._jsPlumb.appendElement(D.canvas,H.originalArgs[0]["parent"]);if(H.useDivWrapper){D.canvas.appendChild(D.svg)}var E=[D.canvas];this.getDisplayElements=function(){return E};this.appendDisplayElement=function(J){E.push(J)};this.paint=function(M,L,K){if(L!=null){var J=M[0],N=M[1];if(H.useDivWrapper){jsPlumb.sizeCanvas(D.canvas,M[0],M[1],M[2],M[3]);J=0,N=0}g(D.svg,{style:n([J,N,M[2],M[3]]),width:M[2],height:M[3]});D._paint.apply(this,arguments)}}};var d=jsPlumb.SvgConnector=function(E){var D=this;s.apply(this,[{cssClass:E._jsPlumb.connectorClass,originalArgs:arguments,pointerEventsSpec:"none",tooltip:E.tooltip,_jsPlumb:E._jsPlumb}]);this._paint=function(L,H){var K=D.getPath(L),F={d:K},J=null;F["pointer-events"]="all";if(H.outlineColor){var I=H.outlineWidth||1,G=H.lineWidth+(2*I),J=jsPlumb.CurrentLibrary.extend({},H);J.strokeStyle=jsPlumb.util.convertStyle(H.outlineColor);J.lineWidth=G;if(D.bgPath==null){D.bgPath=f("path",F);D.svg.appendChild(D.bgPath);D.attachListeners(D.bgPath,D)}else{g(D.bgPath,F)}x(D.svg,D.bgPath,J,L,D)}if(D.path==null){D.path=f("path",F);D.svg.appendChild(D.path);D.attachListeners(D.path,D)}else{g(D.path,F)}x(D.svg,D.path,H,L,D)};this.reattachListeners=function(){if(D.bgPath){D.reattachListenersForElement(D.bgPath,D)}if(D.path){D.reattachListenersForElement(D.path,D)}}};jsPlumb.Connectors.svg.Bezier=function(D){jsPlumb.Connectors.Bezier.apply(this,arguments);d.apply(this,arguments);this.getPath=function(F){var E="M "+F[4]+" "+F[5];E+=(" C "+F[8]+" "+F[9]+" "+F[10]+" "+F[11]+" "+F[6]+" "+F[7]);return E}};jsPlumb.Connectors.svg.Straight=function(D){jsPlumb.Connectors.Straight.apply(this,arguments);d.apply(this,arguments);this.getPath=function(E){return"M "+E[4]+" "+E[5]+" L "+E[6]+" "+E[7]}};jsPlumb.Connectors.svg.Flowchart=function(){var D=this;jsPlumb.Connectors.Flowchart.apply(this,arguments);d.apply(this,arguments);this.getPath=function(F){var G="M "+F[4]+","+F[5];for(var E=0;E<F[8];E++){G=G+" L "+F[9+(E*2)]+" "+F[10+(E*2)]}G=G+" "+F[6]+","+F[7];return G}};var y=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=jsPlumb.util.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;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");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)}}};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);jsPlumb.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<q.canvas.width&&C<q.canvas.height){for(var v=0;v<q.overlayPlacements.length;v++){var w=q.overlayPlacements[v];if(w&&(w[0]<=u&&w[1]>=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;s<t.gradient.stops.length;s++){u.addColorStop(t.gradient.stops[s][0],t.gradient.stops[s][1])}p.ctx.strokeStyle=u}p._paint(v);p.ctx.restore()};var p=this,q=p._jsPlumb.connectorClass+" "+(r.cssClass||"");p.canvas=c({"class":q,_jsPlumb:p._jsPlumb,parent:r.parent,tooltip:r.tooltip});p.ctx=p.canvas.getContext("2d");p.appendDisplayElement(p.canvas);p.paint=function(w,t){if(t!=null){jsPlumb.sizeCanvas(p.canvas,w[0],w[1],w[2],w[3]);if(t.outlineColor!=null){var v=t.outlineWidth||1,s=t.lineWidth+(2*v),u={strokeStyle:t.outlineColor,lineWidth:s};o(w,u)}o(w,t)}}};var b=function(r){var p=this;l.apply(this,arguments);var q=p._jsPlumb.endpointClass+" "+(r.cssClass||""),o={"class":q,_jsPlumb:p._jsPlumb,parent:r.parent,tooltip:p.tooltip};p.canvas=c(o);p.ctx=p.canvas.getContext("2d");p.appendDisplayElement(p.canvas);this.paint=function(x,u,s){jsPlumb.sizeCanvas(p.canvas,x[0],x[1],x[2],x[3]);if(u.outlineColor!=null){var w=u.outlineWidth||1,t=u.lineWidth+(2*w);var v={strokeStyle:u.outlineColor,lineWidth:t}}p._paint.apply(this,arguments)}};jsPlumb.Endpoints.canvas.Dot=function(r){jsPlumb.Endpoints.Dot.apply(this,arguments);b.apply(this,arguments);var q=this,p=function(s){try{return parseInt(s)}catch(t){if(s.substring(s.length-1)=="%"){return parseInt(s.substring(0,s-1))}}},o=function(u){var s=q.defaultOffset,t=q.defaultInnerRadius;u.offset&&(s=p(u.offset));u.innerRadius&&(t=p(u.innerRadius));return[s,t]};this._paint=function(A,t,x){if(t!=null){var B=q.canvas.getContext("2d"),u=x.getOrientation(q);jsPlumb.extend(B,t);if(t.gradient){var v=o(t.gradient),y=u[1]==1?v[0]*-1:v[0],s=u[0]==1?v[0]*-1:v[0],z=B.createRadialGradient(A[4],A[4],A[4],A[4]+s,A[4]+y,v[1]);for(var w=0;w<t.gradient.stops.length;w++){z.addColorStop(t.gradient.stops[w][0],t.gradient.stops[w][1])}B.fillStyle=z}B.beginPath();B.arc(A[4],A[4],A[4],0,Math.PI*2,true);B.closePath();if(t.fillStyle||t.gradient){B.fill()}if(t.strokeStyle){B.stroke()}}}};jsPlumb.Endpoints.canvas.Rectangle=function(p){var o=this;jsPlumb.Endpoints.Rectangle.apply(this,arguments);b.apply(this,arguments);this._paint=function(x,r,v){var A=o.canvas.getContext("2d"),t=v.getOrientation(o);jsPlumb.extend(A,r);if(r.gradient){var z=t[1]==1?x[3]:t[1]==0?x[3]/2:0;var y=t[1]==-1?x[3]:t[1]==0?x[3]/2:0;var s=t[0]==1?x[2]:t[0]==0?x[2]/2:0;var q=t[0]==-1?x[2]:t[0]==0?x[2]/2:0;var w=A.createLinearGradient(s,z,q,y);for(var u=0;u<r.gradient.stops.length;u++){w.addColorStop(r.gradient.stops[u][0],r.gradient.stops[u][1])}A.fillStyle=w}A.beginPath();A.rect(0,0,x[2],x[3]);A.closePath();if(r.fillStyle||r.gradient){A.fill()}if(r.strokeStyle){A.stroke()}}};jsPlumb.Endpoints.canvas.Triangle=function(p){var o=this;jsPlumb.Endpoints.Triangle.apply(this,arguments);b.apply(this,arguments);this._paint=function(z,q,v){var s=z[2],C=z[3],B=z[0],A=z[1],D=o.canvas.getContext("2d"),w=0,u=0,t=0,r=v.getOrientation(o);if(r[0]==1){w=s;u=C;t=180}if(r[1]==-1){w=s;t=90}if(r[1]==1){u=C;t=-90}D.fillStyle=q.fillStyle;D.translate(w,u);D.rotate(t*Math.PI/180);D.beginPath();D.moveTo(0,0);D.lineTo(s/2,C/2);D.lineTo(0,C);D.closePath();if(q.fillStyle||q.gradient){D.fill()}if(q.strokeStyle){D.stroke()}}};jsPlumb.Endpoints.canvas.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.canvas.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Connectors.canvas.Bezier=function(){var o=this;jsPlumb.Connectors.Bezier.apply(this,arguments);h.apply(this,arguments);this._paint=function(p){o.ctx.beginPath();o.ctx.moveTo(p[4],p[5]);o.ctx.bezierCurveTo(p[8],p[9],p[10],p[11],p[6],p[7]);o.ctx.stroke()};this.createGradient=function(r,p,q){return o.ctx.createLinearGradient(r[6],r[7],r[4],r[5])}};jsPlumb.Connectors.canvas.Straight=function(){var o=this;jsPlumb.Connectors.Straight.apply(this,arguments);h.apply(this,arguments);this._paint=function(p){o.ctx.beginPath();o.ctx.moveTo(p[4],p[5]);o.ctx.lineTo(p[6],p[7]);o.ctx.stroke()};this.createGradient=function(q,p){return p.createLinearGradient(q[4],q[5],q[6],q[7])}};jsPlumb.Connectors.canvas.Flowchart=function(){var o=this;jsPlumb.Connectors.Flowchart.apply(this,arguments);h.apply(this,arguments);this._paint=function(q){o.ctx.beginPath();o.ctx.moveTo(q[4],q[5]);for(var p=0;p<q[8];p++){o.ctx.lineTo(q[9+(p*2)],q[10+(p*2)])}o.ctx.lineTo(q[6],q[7]);o.ctx.stroke()};this.createGradient=function(q,p){return p.createLinearGradient(q[4],q[5],q[6],q[7])}};jsPlumb.Overlays.canvas.Label=jsPlumb.Overlays.Label;var g=function(){jsPlumb.jsPlumbUIComponent.apply(this,arguments)};var e=function(p,o){p.apply(this,o);g.apply(this,arguments);this.paint=function(s,u,q,v,t){var r=s.ctx;r.lineWidth=q;r.beginPath();r.moveTo(u.hxy.x,u.hxy.y);r.lineTo(u.tail[0].x,u.tail[0].y);r.lineTo(u.cxy.x,u.cxy.y);r.lineTo(u.tail[1].x,u.tail[1].y);r.lineTo(u.hxy.x,u.hxy.y);r.closePath();if(v){r.strokeStyle=v;r.stroke()}if(t){r.fillStyle=t;r.fill()}}};jsPlumb.Overlays.canvas.Arrow=function(){e.apply(this,[jsPlumb.Overlays.Arrow,arguments])};jsPlumb.Overlays.canvas.PlainArrow=function(){e.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])};jsPlumb.Overlays.canvas.Diamond=function(){e.apply(this,[jsPlumb.Overlays.Diamond,arguments])}})();(function(){if(!Array.prototype.indexOf){Array.prototype.indexOf=function(w,t,y){for(var x=+t||0,u=this.length;x<u;x++){if(this[x]===w||y&&this[x]==w){return x}}return -1}}var c;YUI().use("node","dd","anim","node-event-simulate",function(s){c=s;c.on("domready",function(){jsPlumb.init()})});var e=function(v,t,u){var s=v[t];if(!s){s=[];v[t]=s}s.push(u)},g=["drag:mouseDown","drag:afterMouseDown","drag:mouseup","drag:align","drag:removeHandle","drag:addHandle","drag:removeInvalid","drag:addInvalid","drag:start","drag:end","drag:drag","drag:over","drag:enter","drag:exit","drag:drophit","drag:dropmiss","drop:over","drop:enter","drop:exit","drop:hit"],m=["tween"],r=function(s){return function(){try{return s.apply(this,arguments)}catch(t){}}},f=function(s){var u={};for(var t in s){if(g.indexOf(t)==-1){u[t]=s[t]}}return u},n=function(s,u,x){for(var v in u){if(x.indexOf(v)!=-1){var t=r(u[v]);s.on(v,t)}}},d={},p={},l={},q={},h={},k=function(t,v){if(t){var u=t.get("id");if(u){var s=p[u];if(s){if(s.hoverClass){if(v){t.addClass(s.hoverClass)}else{t.removeClass(s.hoverClass)}}}}}},i=null,b=function(u,t){for(var s in t){u[s]=t[s]}return u},o=function(s,t){return s.getAttribute(t)},a=function(t){if(t==null){return null}var s=null;s=typeof t=="string"?c.one("#"+t):t._node?t:c.one(t);return s};jsPlumb.CurrentLibrary={addClass:function(t,s){jsPlumb.CurrentLibrary.getElementObject(t).addClass(s)},animate:function(v,u,t){var w=b({node:v,to:u},t);var x=o(v,"id");w.tween=jsPlumb.wrap(u.tween,function(){jsPlumb.repaint(x)});var s=new c.Anim(w);n(s,w,m);s.run()},appendElement:function(t,s){a(s).append(t)},bind:function(s,t,u){a(s).on(t,u)},dragEvents:{start:"drag:start",stop:"drag:end",drag:"drag:drag",step:"step",over:"drop:enter",out:"drop:exit",drop:"drop:hit"},extend:b,getAttribute:o,getClientXY:function(s){return[s.clientX,s.clientY]},getDragObject:function(s){if(s[0].drag){i=s[0].drag.el}return i},getDragScope:function(t){var u=jsPlumb.getId(t);var s=q[u];return s.scope},getDropEvent:function(s){return s[0]},getDropScope:function(s){var t=jsPlumb.getId(s);return h[t]},getDOMElement:function(s){if(typeof(s)=="String"){return document.getElementById(s)}else{if(s._node){return s._node}else{return s}}},getElementObject:a,getOffset:function(s){var t=c.DOM.getXY(s._node);return{left:t[0],top:t[1]}},getPageXY:function(s){return[s.pageX,s.pageY]},getParent:function(s){return jsPlumb.CurrentLibrary.getElementObject(s).get("parentNode")},getScrollLeft:function(s){return 0},getScrollTop:function(s){return 0},getSelector:function(t){var u=c.all(t);return u&&u._nodes?u._nodes:[]},getSize:function(s){return[s._node.offsetWidth,s._node.offsetHeight]},getTagName:function(s){var t=jsPlumb.CurrentLibrary.getElementObject(s);return t!=null&&t._node!=null?t._node.tagName:null},getUIPosition:function(s){var u=s[0].currentTarget.el._node,t=c.DOM.getXY(u);return{left:t[0],top:t[1]}},hasClass:function(t,s){return t.hasClass(s)},initDraggable:function(w,t){var u=f(t);var x=jsPlumb.getId(w);u.node="#"+x;var s=new c.DD.Drag(u);s.el=w;var v=t.scope||jsPlumb.Defaults.Scope;s.scope=v;q[x]=s;e(l,v,s);n(s,t,g)},initDroppable:function(w,t){var u=f(t);var x=jsPlumb.getId(w);u.node="#"+x;var s=new c.DD.Drop(u);p[x]=t;t=b({},t);var v=t.scope||jsPlumb.Defaults.Scope;h[x]=v;t["drop:enter"]=jsPlumb.wrap(t["drop:enter"],function(y){if(y.drag.scope!==v){return true}k(w,true)},true);t["drop:exit"]=jsPlumb.wrap(t["drop:exit"],function(y){k(w,false)});t["drop:hit"]=jsPlumb.wrap(t["drop:hit"],function(y){if(y.drag.scope!==v){return true}k(w,false)},true);n(s,t,g)},isAlreadyDraggable:function(s){s=a(s);return s.hasClass("yui3-dd-draggable")},isDragSupported:function(s){return true},isDropSupported:function(s){return true},removeClass:function(t,s){jsPlumb.CurrentLibrary.getElementObject(t).removeClass(s)},removeElement:function(s){a(s).remove()},setAttribute:function(u,s,t){u.setAttribute(s,t)},setDraggable:function(u,t){var v=jsPlumb.getId(u);var s=q[v];if(s){s.set("lock",!t)}},setDragScope:function(u,t){var v=jsPlumb.getId(u);var s=q[v];if(s){s.scope=t}},setOffset:function(s,t){s=a(s);s.set("top",t.top);s.set("left",t.left)},stopDrag:function(){c.DD.DDM.stopDrag()},trigger:function(t,u,s){s.stopPropagation();a(t).simulate(u,{pageX:s.pageX,pageY:s.pageY,clientX:s.clientX,clientY:s.clientY})},unbind:function(s,t,u){a(s).detach(t,u)}}})();(function(){if("undefined"==typeof Math.sgn){Math.sgn=function(l){return 0==l?0:0<l?1:-1}}var d={subtract:function(m,l){return{x:m.x-l.x,y:m.y-l.y}},dotProduct:function(m,l){return m.x*l.x+m.y*l.y},square:function(l){return Math.sqrt(l.x*l.x+l.y*l.y)},scale:function(m,l){return{x:m.x*l,y:m.y*l}}},f=Math.pow(2,-65),h=function(y,x){for(var t=[],v=x.length-1,r=2*v-1,s=[],w=[],p=[],q=[],o=[[1,0.6,0.3,0.1],[0.4,0.6,0.6,0.4],[0.1,0.3,0.6,1]],u=0;u<=v;u++){s[u]=d.subtract(x[u],y)}for(u=0;u<=v-1;u++){w[u]=d.subtract(x[u+1],x[u]),w[u]=d.scale(w[u],3)}for(u=0;u<=v-1;u++){for(var l=0;l<=v;l++){p[u]||(p[u]=[]),p[u][l]=d.dotProduct(w[u],s[l])}}for(u=0;u<=r;u++){q[u]||(q[u]=[]),q[u].y=0,q[u].x=parseFloat(u)/r}r=v-1;for(s=0;s<=v+r;s++){u=Math.max(0,s-r);for(w=Math.min(s,v);u<=w;u++){j=s-u,q[u+j].y+=p[j][u]*o[j][u]}}v=x.length-1;q=b(q,2*v-1,t,0);r=d.subtract(y,x[0]);p=d.square(r);for(u=o=0;u<q;u++){r=d.subtract(y,a(x,v,t[u],null,null)),r=d.square(r),r<p&&(p=r,o=t[u])}r=d.subtract(y,x[v]);r=d.square(r);r<p&&(p=r,o=1);return{location:o,distance:p}},b=function(C,B,x,z){var v=[],w=[],A=[],t=[],u=0,r,y;y=Math.sgn(C[0].y);for(var q=1;q<=B;q++){r=Math.sgn(C[q].y),r!=y&&u++,y=r}switch(u){case 0:return 0;case 1:if(64<=z){return x[0]=(C[0].x+C[B].x)/2,1}var p,u=C[0].y-C[B].y;r=C[B].x-C[0].x;y=C[0].x*C[B].y-C[B].x*C[0].y;q=max_distance_below=0;for(p=1;p<B;p++){var s=u*C[p].x+r*C[p].y+y;s>q?q=s:s<max_distance_below&&(max_distance_below=s)}p=r;q=(1*(y-q)-0*p)*(1/(0*p-1*u));p=r;u=(1*(y-max_distance_below)-0*p)*(1/(0*p-1*u));r=Math.min(q,u);if(Math.max(q,u)-r<f){return A=C[B].x-C[0].x,t=C[B].y-C[0].y,x[0]=0+1*(A*(C[0].y-0)-t*(C[0].x-0))*(1/(0*A-1*t)),1}}a(C,B,0.5,v,w);C=b(v,B,A,z+1);B=b(w,B,t,z+1);for(z=0;z<C;z++){x[z]=A[z]}for(z=0;z<B;z++){x[z+C]=t[z]}return C+B},a=function(m,l,p,q,n){for(var o=[[]],r=0;r<=l;r++){o[0][r]=m[r]}for(m=1;m<=l;m++){for(r=0;r<=l-m;r++){o[m]||(o[m]=[]),o[m][r]||(o[m][r]={}),o[m][r].x=(1-p)*o[m-1][r].x+p*o[m-1][r+1].x,o[m][r].y=(1-p)*o[m-1][r].y+p*o[m-1][r+1].y}}if(null!=q){for(r=0;r<=l;r++){q[r]=o[r][0]}}if(null!=n){for(r=0;r<=l;r++){n[r]=o[l-r][r]}}return o[l][0]},g={},e=function(t){var s=g[t];if(!s){var s=[],p=function(u){return function(){return u}},q=function(){return function(u){return u}},n=function(){return function(u){return 1-u}},o=function(u){return function(v){for(var x=1,w=0;w<u.length;w++){x*=u[w](v)}return x}};s.push(new function(){return function(u){return Math.pow(u,t)}});for(var r=1;r<t;r++){for(var l=[new p(t)],m=0;m<t-r;m++){l.push(new q)}for(m=0;m<r;m++){l.push(new n)}s.push(new o(l))}s.push(new function(){return function(u){return Math.pow(1-u,t)}});g[t]=s}return s},c=function(m,l){for(var p=e(m.length-1),q=0,n=0,o=0;o<m.length;o++){q+=m[o].x*p[o](l),n+=m[o].y*p[o](l)}return{x:q,y:n}},k=function(m,l,p){for(var q=c(m,l),n=0,o=0<p?1:-1,r=null;n<Math.abs(p);){l+=0.005*o,r=c(m,l),n+=Math.sqrt(Math.pow(r.x-q.x,2)+Math.pow(r.y-q.y,2)),q=r}return{point:r,location:l}},i=function(m,l){var o=c(m,l),p=c(m.slice(0,m.length-1),l),n=p.y-o.y,o=p.x-o.x;return 0==n?Infinity:Math.atan(n/o)};window.jsBezier={distanceFromCurve:h,gradientAtPoint:i,gradientAtPointAlongCurveFrom:function(m,l,n){l=k(m,l,n);if(1<l.location){l.location=1}if(0>l.location){l.location=0}return i(m,l.location)},nearestPointOnCurve:function(m,l){var n=h(m,l);return{point:a(l,l.length-1,n.location,null,null),location:n.location}},pointOnCurve:c,pointAlongCurveFrom:function(m,l,n){return k(m,l,n).point},perpendicularToCurveAt:function(m,l,n,o){l=k(m,l,null==o?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}]}}})();