function asyncGeneratorStep(t,e,r,n,o,a,i){try{var s=t[a](i),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)} /** * @file ext-connector.js * * @license MIT * * @copyright 2010 Alexis Deveria * */ var t={name:"connector",init:function init(t){var e=this;return function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function _next(t){asyncGeneratorStep(a,n,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(a,n,o,_next,_throw,"throw",t)}_next(void 0)}))}}(regeneratorRuntime.mark((function _callee(){var r,n,o,a,i,s,c,l,u,d,g,f,m,h,v,_,b,p,y,x,k,S,A,w,B,E,N,I,M,C;return regeneratorRuntime.wrap((function _callee$(G){for(;;)switch(G.prev=G.next){case 0:return N=function _init(){a(_).find("*").each((function(){var t=this.getAttributeNS(v,"connector");if(t){this.setAttribute("class",l.substr(1));var e=t.split(" "),r=n.getStrokedBBox([o(e[0])]),i=n.getStrokedBBox([o(e[1])]);a(this).data("c_start",e[0]).data("c_end",e[1]).data("start_bb",r).data("end_bb",i),n.getEditorNS(!0)}}))},E=function _updateConnectors(t){if(B(t),p.length)for(var e=p.length;e--;){var r=p[e],o=r.connector,a=r.elem,i=r.is_start?"start":"end",s=n.getStrokedBBox([a]);s.x=r.start_x,s.y=r.start_y,u(o,i+"_bb",s),u(o,i+"_off");var c=r.is_start?"end":"start",l=u(o,c+"_bb"),d=l.x+l.width/2,g=l.y+l.height/2,f=x(d,g,s,k(i,o));A(o,r.is_start?0:"end",f.x,f.y,!0);var m=x(f.x,f.y,u(o,c+"_bb"),k(c,o));if(A(o,r.is_start?"end":0,m.x,m.y,!0),navigator.userAgent.includes("AppleWebKit")){for(var h=o.points,v=h.numberOfItems,_=[],b=0;b0&&void 0!==arguments[0]?arguments[0]:y,e=a(_).find(l);p=[],e.each((function(){var e;function add(){t.includes(this)&&(e=!0)}var r=[];["start","end"].forEach((function(t,e){var o=u(this,"c_"+t);null==o?(o=document.getElementById(this.attributes["se:connector"].value.split(" ")[e]),u(this,"c_"+t,o.id),u(this,t+"_bb",n.getStrokedBBox([o]))):o=document.getElementById(o),r.push(o)}),this);for(var o=0;o<2;o++){var i=r[o];if(e=!1,a(i).parents().each(add),i&&i.parentNode){if(t.includes(i)||e){var s=n.getStrokedBBox([i]);p.push({elem:i,connector:this,is_start:0===o,start_x:s.x,start_y:s.y})}}else a(this).remove()}}))},w=function _updateLine(t,e){for(var r=p.length;r--;){var n=p[r],o=n.connector,a=n.is_start?"start":"end",i=u(o,a+"_bb");i.x=n.start_x+t,i.y=n.start_y+e,u(o,a+"_bb",i);var s=n.is_start?"end":"start",c=u(o,s+"_bb"),l=c.x+c.width/2,d=c.y+c.height/2,g=x(l,d,i,k(a,o));A(o,n.is_start?0:"end",g.x,g.y,!0);var f=x(g.x,g.y,u(o,s+"_bb"),k(s,o));A(o,n.is_start?"end":0,f.x,f.y,!0)}},A=function _setPoint(t,e,r,n,o){var a=t.points,s=i.createSVGPoint();s.x=r,s.y=n,"end"===e&&(e=a.numberOfItems-1);try{a.replaceItem(s,e)}catch(o){for(var c=t.getAttribute("points").split(" "),l=0;l').appendTo("head")),e.text(t?"#tool_clone, #tool_topath, #tool_angle, #xy_panel { display: none !important; }":""),a("#connector_panel").toggle(t)},k=function _getOffset(t,e){var r=e.getAttribute("marker-"+t),n=5*e.getAttribute("stroke-width");return r?n:0},x=function _getBBintersect(t,e,r,n){n&&(n-=0,(r=a.extend({},r)).width+=n,r.height+=n,r.x-=n/2,r.y-=n/2);var o,i=r.x+r.width/2,s=r.y+r.height/2,c=t-i,l=e-s;return{x:i+c*(o=Math.abs(l/c)