forked from sdrdis/jquery.flowchart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.flowchart.min.js
1 lines (1 loc) · 22.1 KB
/
jquery.flowchart.min.js
1
$(function(){$.widget("flowchart.flowchart",{options:{canUserEditLinks:!0,canUserMoveOperators:!0,data:{},distanceFromArrow:3,defaultOperatorClass:"flowchart-default-operator",defaultLinkColor:"#3366ff",defaultSelectedLinkColor:"black",linkWidth:10,grid:20,multipleLinksOnOutput:!1,multipleLinksOnInput:!1,linkVerticalDecal:0,onOperatorSelect:function(){return!0},onOperatorUnselect:function(){return!0},onLinkSelect:function(){return!0},onLinkUnselect:function(){return!0},onOperatorCreate:function(){return!0},onLinkCreate:function(){return!0},onOperatorDelete:function(){return!0},onLinkDelete:function(){return!0},onOperatorMoved:function(){},onAfterChange:function(){}},data:null,objs:null,maskNum:0,linkNum:0,operatorNum:0,lastOutputConnectorClicked:null,selectedOperatorId:null,selectedLinkId:null,positionRatio:1,globalId:null,_create:function(){"undefined"==typeof document.__flowchartNumber?document.__flowchartNumber=0:document.__flowchartNumber++,this.globalId=document.__flowchartNumber,this._unitVariables(),this.element.addClass("flowchart-container"),this.objs.layers.links=$('<svg class="flowchart-links-layer"></svg>'),this.objs.layers.links.appendTo(this.element),this.objs.layers.operators=$('<div class="flowchart-operators-layer unselectable"></div>'),this.objs.layers.operators.appendTo(this.element),this.objs.layers.temporaryLink=$('<svg class="flowchart-temporary-link-layer"></svg>'),this.objs.layers.temporaryLink.appendTo(this.element);var a=document.createElementNS("http://www.w3.org/2000/svg","line");a.setAttribute("x1","0"),a.setAttribute("y1","0"),a.setAttribute("x2","0"),a.setAttribute("y2","0"),a.setAttribute("stroke-dasharray","6,6"),a.setAttribute("stroke-width","4"),a.setAttribute("stroke","black"),a.setAttribute("fill","none"),this.objs.layers.temporaryLink[0].appendChild(a),this.objs.temporaryLink=a,this._initEvents(),"undefined"!=typeof this.options.data&&this.setData(this.options.data)},_unitVariables:function(){this.data={operators:{},links:{},linkRestrictions:{}},this.objs={layers:{operators:null,temporaryLink:null,links:null},linksContext:null,temporaryLink:null}},_initEvents:function(){var a=this;this.element.mousemove(function(b){var c=$(this),d=c.offset();a._mousemove((b.pageX-d.left)/a.positionRatio,(b.pageY-d.top)/a.positionRatio,b)}),this.element.click(function(b){var c=$(this),d=c.offset();a._click((b.pageX-d.left)/a.positionRatio,(b.pageY-d.top)/a.positionRatio,b)}),this.objs.layers.operators.on("touchdown mousedown touchstart",".flowchart-operator",function(a){a.stopImmediatePropagation()}),this.objs.layers.operators.on("click",".flowchart-operator",function(b){0==$(b.target).closest(".flowchart-operator-connector").length&&a.selectOperator($(this).data("operator_id"))}),this.objs.layers.operators.on("click",".flowchart-operator-connector",function(){var b=$(this);a.options.canUserEditLinks&&a._connectorClicked(b.closest(".flowchart-operator").data("operator_id"),b.data("connector"),b.data("sub_connector"),b.closest(".flowchart-operator-connector-set").data("connector_type"))}),this.objs.layers.links.on("mousedown touchstart",".flowchart-link",function(a){a.stopImmediatePropagation()}),this.objs.layers.links.on("mouseover",".flowchart-link",function(){a._connecterMouseOver($(this).data("link_id"))}),this.objs.layers.links.on("mouseout",".flowchart-link",function(){a._connecterMouseOut($(this).data("link_id"))}),this.objs.layers.links.on("click",".flowchart-link",function(){a.selectLink($(this).data("link_id"))})},setData:function(a){this._clearOperatorsLayer(),this.data.operatorTypes={},"undefined"!=typeof a.operatorTypes&&(this.data.operatorTypes=a.operatorTypes),this.data.linkRestrictions=[],"undefined"!=typeof a.linkRestrictions&&a.linkRestrictions.length>0&&(this.data.linkRestrictions=a.linkRestrictions),this.data.operators={};for(var b in a.operators)a.operators.hasOwnProperty(b)&&this.createOperator(b,a.operators[b]);this.data.links={};for(var c in a.links)a.links.hasOwnProperty(c)&&this.createLink(c,a.links[c]);this.redrawLinksLayer()},addLink:function(a){for(;"undefined"!=typeof this.data.links[this.linkNum];)this.linkNum++;return this.createLink(this.linkNum,a),this.linkNum},createLink:function(a,b){var c=$.extend(!0,{},b);if(this.callbackEvent("linkCreate",[a,c])){var d=this._indexOfLinkGranted(c);if(-1!=d){var e=this._getSubConnectors(c),f=e[0],g=e[1],h=this.options.multipleLinksOnOutput,i=this.options.multipleLinksOnInput;if(!h||!i)for(var j in this.data.links)if(this.data.links.hasOwnProperty(j)){var k=this.data.links[j],l=this._getSubConnectors(k),m=l[0],n=l[1];if(!h&&k.fromOperator==c.fromOperator&&k.fromConnector==c.fromConnector&&m==f){this.deleteLink(j);continue}i||k.toOperator!=c.toOperator||k.toConnector!=c.toConnector||n!=g||this.deleteLink(j)}if(this._autoCreateSubConnector(c.fromOperator,c.fromConnector,"outputs",f),this._autoCreateSubConnector(c.toOperator,c.toConnector,"inputs",g),null!=d){var o=this.data.linkRestrictions[d];"undefined"!=typeof o.color&&(c.color=o.color)}this.data.links[a]=c,this._drawLink(a),this.callbackEvent("afterChange",["link_create"])}}},_indexOfLinkGranted:function(a){if(0==this.data.linkRestrictions.length)return null;for(var b=this.data.linkRestrictions,c=0;c<b.length;c++){var d=b[c],e=this.data.operators[a.fromOperator].type,f=this.data.operators[a.toOperator].type;if(d.fromOperatorType==e&&d.fromConnector==a.fromConnector&&d.toOperatorType==f&&d.toConnector==a.toConnector)return c}return-1},_autoCreateSubConnector:function(a,b,c,d){var e=this.data.operators[a].properties[c][b];if(e.multiple)for(var f=this.data.operators[a].internal.els,g=this.data.operators[a].internal.els.connectors[b].length,h=g;d+2>h;h++)this._createSubConnector(b,e,f,c)},redrawLinksLayer:function(){this._clearLinksLayer();for(var a in this.data.links)this.data.links.hasOwnProperty(a)&&this._drawLink(a)},_clearLinksLayer:function(){this.objs.layers.links.empty(),this.objs.layers.operators.find(".flowchart-operator-connector-small-arrow").css("border-left-color","transparent")},_clearOperatorsLayer:function(){this.objs.layers.operators.empty()},getConnectorPosition:function(a,b,c,d){var e=this.data.operators[a],f=e.internal.els[d].connectorArrows[b][c],g=f.offset(),h=this.element.offset(),i=(g.left-h.left)/this.positionRatio,j=parseInt(f.css("border-top-width")),k=(g.top-h.top-1)/this.positionRatio+parseInt(f.css("border-left-width"));return{x:i,width:j,y:k}},getLinkMainColor:function(a){var b=this.options.defaultLinkColor,c=this.data.links[a];return"undefined"!=typeof c.color&&(b=c.color),b},setLinkMainColor:function(a,b){this.data.links[a].color=b,this.callbackEvent("afterChange",["link_change_main_color"])},_drawLink:function(a){var b=this.data.links[a];"undefined"==typeof b.internal&&(b.internal={}),b.internal.els={};var c=b.fromOperator,d=b.fromConnector,e=b.toOperator,f=b.toConnector,g=this._getSubConnectors(b),h=g[0],i=g[1],j=(this.getLinkMainColor(a),this.data.operators[c]),k=this.data.operators[e],l=j.internal.els.outputs.connectorSmallArrows[d][h],m=k.internal.els.inputs.connectorSmallArrows[f][i];b.internal.els.fromSmallConnector=l,b.internal.els.toSmallConnector=m;var n=document.createElementNS("http://www.w3.org/2000/svg","g");this.objs.layers.links[0].appendChild(n),b.internal.els.overallGroup=n;var o=document.createElementNS("http://www.w3.org/2000/svg","mask"),p="fc_mask_"+this.globalId+"_"+this.maskNum;this.maskNum++,o.setAttribute("id",p),n.appendChild(o);var q=document.createElementNS("http://www.w3.org/2000/svg","rect");q.setAttribute("x","0"),q.setAttribute("y","0"),q.setAttribute("width","100%"),q.setAttribute("height","100%"),q.setAttribute("stroke","none"),q.setAttribute("fill","white"),o.appendChild(q);var r=document.createElementNS("http://www.w3.org/2000/svg","polygon");r.setAttribute("stroke","none"),r.setAttribute("fill","black"),o.appendChild(r),b.internal.els.mask=r;var s=document.createElementNS("http://www.w3.org/2000/svg","g");s.setAttribute("class","flowchart-link"),s.setAttribute("data-link_id",a),n.appendChild(s);var t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("stroke-width",this.options.linkWidth.toString()),t.setAttribute("fill","none"),s.appendChild(t),b.internal.els.path=t;var u=document.createElementNS("http://www.w3.org/2000/svg","rect");u.setAttribute("stroke","none"),u.setAttribute("mask","url(#"+p+")"),s.appendChild(u),b.internal.els.rect=u,this._refreshLinkPositions(a),this.uncolorizeLink(a)},_getSubConnectors:function(a){var b=0;"undefined"!=typeof a.fromSubConnector&&(b=a.fromSubConnector);var c=0;return"undefined"!=typeof a.toSubConnector&&(c=a.toSubConnector),[b,c]},_refreshLinkPositions:function(a){var b=this.data.links[a],c=this._getSubConnectors(b),d=c[0],e=c[1],f=this.getConnectorPosition(b.fromOperator,b.fromConnector,d,"outputs"),g=this.getConnectorPosition(b.toOperator,b.toConnector,e,"inputs"),h=f.x,i=f.width,j=f.y,k=g.x,l=g.y;j+=this.options.linkVerticalDecal,l+=this.options.linkVerticalDecal;var m=this.options.distanceFromArrow;b.internal.els.mask.setAttribute("points",h+","+(j-i-m)+" "+(h+i+m)+","+j+" "+h+","+(j+i+m));var n=h+i+m,o=k+1,p=Math.min(100,Math.max(Math.abs(n-o)/2,Math.abs(j-l)));b.internal.els.path.setAttribute("d","M"+n+","+j+" C"+(h+i+m+p)+","+j+" "+(k-p)+","+l+" "+o+","+l),b.internal.els.rect.setAttribute("x",h),b.internal.els.rect.setAttribute("y",j-this.options.linkWidth/2),b.internal.els.rect.setAttribute("width",i+m+1),b.internal.els.rect.setAttribute("height",this.options.linkWidth)},getOperatorCompleteData:function(a){"undefined"==typeof a.internal&&(a.internal={}),this._refreshInternalProperties(a);var b=$.extend(!0,{},a.internal.properties);for(var c in b.inputs)b.inputs.hasOwnProperty(c)&&null==b.inputs[c]&&delete b.inputs[c];for(var d in b.outputs)b.outputs.hasOwnProperty(d)&&null==b.outputs[d]&&delete b.outputs[d];return"undefined"==typeof b.class&&(b.class=this.options.defaultOperatorClass),b},_getOperatorFullElement:function(a){function b(a,b,c,d){var e=$('<div class="flowchart-operator-connector-set"></div>');e.data("connector_type",d),e.appendTo(c),j[d].connectorArrows[a]=[],j[d].connectorSmallArrows[a]=[],j[d].connectors[a]=[],j[d].connectorSets[a]=e,i._createSubConnector(a,b,j,d)}var c=this.getOperatorCompleteData(a),d=$('<div class="flowchart-operator"></div>');d.addClass(c.class);var e=$('<div class="flowchart-operator-title"></div>');e.html(c.title),e.appendTo(d);var f=$('<div class="flowchart-operator-inputs-outputs"></div>');f.appendTo(d);var g=$('<div class="flowchart-operator-inputs"></div>');g.appendTo(f);var h=$('<div class="flowchart-operator-outputs"></div>');h.appendTo(f);var i=this,j={operator:d,title:e,inputs:{connectorSets:{},connectors:{},connectorArrows:{},connectorSmallArrows:{}},outputs:{connectorSets:{},connectors:{},connectorArrows:{},connectorSmallArrows:{}}};for(var k in c.inputs)c.inputs.hasOwnProperty(k)&&b(k,c.inputs[k],g,"inputs");for(var l in c.outputs)c.outputs.hasOwnProperty(l)&&b(l,c.outputs[l],h,"outputs");return j},_createSubConnector:function(a,b,c,d){var e=c[d].connectorSets[a],f=c[d].connectors[a].length,g=$('<div class="flowchart-operator-connector"></div>');g.appendTo(e),g.data("connector",a),g.data("sub_connector",f);var h=$('<div class="flowchart-operator-connector-label"></div>');h.text(b.label.replace("(:i)",f+1)),h.appendTo(g);var i=$('<div class="flowchart-operator-connector-arrow"></div>');i.appendTo(g);var j=$('<div class="flowchart-operator-connector-small-arrow"></div>');j.appendTo(g),c[d].connectors[a].push(g),c[d].connectorArrows[a].push(i),c[d].connectorSmallArrows[a].push(j)},getOperatorElement:function(a){var b=this._getOperatorFullElement(a);return b.operator},addOperator:function(a){for(;"undefined"!=typeof this.data.operators[this.operatorNum];)this.operatorNum++;return this.createOperator(this.operatorNum,a),this.operatorNum},createOperator:function(a,b){function c(a,c){b.top=c.top,b.left=c.left;for(var d in f.data.links)if(f.data.links.hasOwnProperty(d)){var e=f.data.links[d];(e.fromOperator==a||e.toOperator==a)&&f._refreshLinkPositions(d)}}b.internal={},this._refreshInternalProperties(b);var d=this._getOperatorFullElement(b);if(!this.callbackEvent("operatorCreate",[a,b,d]))return!1;var e=this.options.grid;e&&(b.top=Math.round(b.top/e)*e,b.left=Math.round(b.left/e)*e),d.operator.appendTo(this.objs.layers.operators),d.operator.css({top:b.top,left:b.left}),d.operator.data("operator_id",a),this.data.operators[a]=b,this.data.operators[a].internal.els=d,a==this.selectedOperatorId&&this._addSelectedClass(a);var f=this;if(this.options.canUserMoveOperators){var g,h;d.operator.draggable({containment:b.internal.properties.uncontained?!1:this.element,handle:".flowchart-operator-title",start:function(a){if(null!=f.lastOutputConnectorClicked)return void a.preventDefault();var b=f.element.offset();g=(a.pageX-b.left)/f.positionRatio-parseInt($(a.target).css("left")),h=(a.pageY-b.top)/f.positionRatio-parseInt($(a.target).css("top"))},drag:function(a,e){if(f.options.grid){var i=f.options.grid,j=f.element.offset();if(e.position.left=Math.round(((a.pageX-j.left)/f.positionRatio-g)/i)*i,e.position.top=Math.round(((a.pageY-j.top)/f.positionRatio-h)/i)*i,!b.internal.properties.uncontained){var k=$(this);e.position.left=Math.min(Math.max(e.position.left,0),f.element.width()-k.outerWidth()),e.position.top=Math.min(Math.max(e.position.top,0),f.element.height()-k.outerHeight())}e.offset.left=Math.round(e.position.left+j.left),e.offset.top=Math.round(e.position.top+j.top),d.operator.css({left:e.position.left,top:e.position.top})}c($(this).data("operator_id"),e.position)},stop:function(a,b){f._unsetTemporaryLink();var e=$(this).data("operator_id");c(e,b.position),d.operator.css({height:"auto"}),f.callbackEvent("operatorMoved",[e,b.position]),f.callbackEvent("afterChange",["operator_moved"])}})}this.callbackEvent("afterChange",["operator_create"])},_connectorClicked:function(a,b,c,d){if("outputs"==d){this._restoreGrantedConnectorsColor();{new Date}this.lastOutputConnectorClicked={operator:a,connector:b,subConnector:c,grantedConnectors:this._getGrantedConnectors(a,b)},this.objs.layers.temporaryLink.show();var e=this.getConnectorPosition(a,b,c,d),f=e.x+e.width,g=e.y;this.objs.temporaryLink.setAttribute("x1",f.toString()),this.objs.temporaryLink.setAttribute("y1",g.toString()),this._mousemove(f,g),this._colorizeGrantedConnectors()}if("inputs"==d&&null!=this.lastOutputConnectorClicked){var h={fromOperator:this.lastOutputConnectorClicked.operator,fromConnector:this.lastOutputConnectorClicked.connector,fromSubConnector:this.lastOutputConnectorClicked.subConnector,toOperator:a,toConnector:b,toSubConnector:c};this._unsetTemporaryLink(),this.addLink(h)}},_getGrantedConnectors:function(a,b){var c=this.data.operators[a].type;if("undefined"==typeof c||0==this.data.linkRestrictions.length)return[];var d=this.data.linkRestrictions.filter(function(a){return c==a.fromOperatorType&&b==a.fromConnector}),e=[];for(var f in d){var g=d[f];for(var h in this.data.operators){var i=this.data.operators[h];if(i.type==g.toOperatorType){var j=i.internal.els.inputs.connectorArrows[g.toConnector];void 0!=j&&(j=j.map(function(a){return{els:a,oldColor:a.css("border-left-color")}}),e.push({color:"undefined"==typeof g.color?this.options.defaultLinkColor:g.color,arrows:j}))}}}return e},_colorizeGrantedConnectors:function(){if(null!=this.lastOutputConnectorClicked){var a=this.lastOutputConnectorClicked.grantedConnectors;a.forEach(function(a){a.arrows.forEach(function(b){b.els.css("border-left-color",a.color)})})}},_restoreGrantedConnectorsColor:function(){if(null!=this.lastOutputConnectorClicked){var a=this.lastOutputConnectorClicked.grantedConnectors;a.forEach(function(a){a.arrows.forEach(function(a){a.els.css("border-left-color",a.oldColor)})})}},_unsetTemporaryLink:function(){this._restoreGrantedConnectorsColor(),this.lastOutputConnectorClicked=null,this.objs.layers.temporaryLink.hide()},_mousemove:function(a,b){null!=this.lastOutputConnectorClicked&&(this.objs.temporaryLink.setAttribute("x2",a),this.objs.temporaryLink.setAttribute("y2",b))},_click:function(a,b,c){var d=$(c.target);0==d.closest(".flowchart-operator-connector").length&&this._unsetTemporaryLink(),0==d.closest(".flowchart-operator").length&&this.unselectOperator(),0==d.closest(".flowchart-link").length&&this.unselectLink()},_removeSelectedClassOperators:function(){this.objs.layers.operators.find(".flowchart-operator").removeClass("selected")},unselectOperator:function(){if(null!=this.selectedOperatorId){if(!this.callbackEvent("operatorUnselect",[]))return;this._removeSelectedClassOperators(),this.selectedOperatorId=null}},_addSelectedClass:function(a){this.data.operators[a].internal.els.operator.addClass("selected")},callbackEvent:function(a,b){var c="on"+a.charAt(0).toUpperCase()+a.slice(1),d=this.options[c].apply(this,b);if(d!==!1){var e={result:d};this.element.trigger(a,b.concat([e])),d=e.result}return d},selectOperator:function(a){this.callbackEvent("operatorSelect",[a])&&(this.unselectLink(),this._removeSelectedClassOperators(),this._addSelectedClass(a),this.selectedOperatorId=a)},addClassOperator:function(a,b){this.data.operators[a].internal.els.operator.addClass(b)},removeClassOperator:function(a,b){this.data.operators[a].internal.els.operator.removeClass(b)},removeClassOperators:function(a){this.objs.layers.operators.find(".flowchart-operator").removeClass(a)},_addHoverClassOperator:function(a){this.data.operators[a].internal.els.operator.addClass("hover")},_removeHoverClassOperators:function(){this.objs.layers.operators.find(".flowchart-operator").removeClass("hover")},_operatorMouseOver:function(a){this.callbackEvent("operatorMouseOver",[a])&&this._addHoverClassOperator(a)},_operatorMouseOut:function(a){this.callbackEvent("operatorMouseOut",[a])&&this._removeHoverClassOperators()},getSelectedOperatorId:function(){return this.selectedOperatorId},getSelectedLinkId:function(){return this.selectedLinkId},_shadeColor:function(a,b){var c=parseInt(a.slice(1),16),d=0>b?0:255,e=0>b?-1*b:b,f=c>>16,g=c>>8&255,h=255&c;return"#"+(16777216+65536*(Math.round((d-f)*e)+f)+256*(Math.round((d-g)*e)+g)+(Math.round((d-h)*e)+h)).toString(16).slice(1)},colorizeLink:function(a,b){var c=this.data.links[a];c.internal.els.path.setAttribute("stroke",b),c.internal.els.rect.setAttribute("fill",b),c.internal.els.fromSmallConnector.css("border-left-color",b),c.internal.els.toSmallConnector.css("border-left-color",b)},uncolorizeLink:function(a){this.colorizeLink(a,this.getLinkMainColor(a))},_connecterMouseOver:function(a){this.selectedLinkId!=a&&this.colorizeLink(a,this._shadeColor(this.getLinkMainColor(a),-.4))},_connecterMouseOut:function(a){this.selectedLinkId!=a&&this.uncolorizeLink(a)},unselectLink:function(){if(null!=this.selectedLinkId){if(!this.callbackEvent("linkUnselect",[]))return;this.uncolorizeLink(this.selectedLinkId,this.options.defaultSelectedLinkColor),this.selectedLinkId=null}},selectLink:function(a){this.unselectLink(),this.callbackEvent("linkSelect",[a])&&(this.unselectOperator(),this.selectedLinkId=a,this.colorizeLink(a,this.options.defaultSelectedLinkColor))},deleteOperator:function(a){this._deleteOperator(a,!1)},_deleteOperator:function(a,b){if(!this.callbackEvent("operatorDelete",[a,b]))return!1;if(!b)for(var c in this.data.links)if(this.data.links.hasOwnProperty(c)){var d=this.data.links[c];(d.fromOperator==a||d.toOperator==a)&&this._deleteLink(c,!0)}b||a!=this.selectedOperatorId||this.unselectOperator(),this.data.operators[a].internal.els.operator.remove(),delete this.data.operators[a],this.callbackEvent("afterChange",["operator_delete"])},deleteLink:function(a){this._deleteLink(a,!1)},_deleteLink:function(a,b){if(this.selectedLinkId==a&&this.unselectLink(),this.callbackEvent("linkDelete",[a,b])||b){this.colorizeLink(a,"transparent");var c=this.data.links[a],d=c.fromOperator,e=c.fromConnector,f=c.toOperator,g=c.toConnector;c.internal.els.overallGroup.remove(),delete this.data.links[a],this._cleanMultipleConnectors(d,e,"from"),this._cleanMultipleConnectors(f,g,"to"),this.callbackEvent("afterChange",["link_delete"])}},_cleanMultipleConnectors:function(a,b,c){var d="from"==c?"outputs":"inputs";if(this.data.operators[a].properties[d][b].multiple){var e=-1,f=c+"Operator",g=c+"Connector",h=c+"SubConnector",i=this.data.operators[a].internal.els,j=i.connectors[b],k=j.length;for(var l in this.data.links)if(this.data.links.hasOwnProperty(l)){var m=this.data.links[l];m[f]==a&&m[g]==b&&e<m[h]&&(e=m[h])}for(var n=Math.min(k-e-2,k-1),o=0;n>o;o++)j[j.length-1].remove(),j.pop(),i.connectorArrows[b].pop(),i.connectorSmallArrows[b].pop()}},deleteSelected:function(){null!=this.selectedLinkId&&this.deleteLink(this.selectedLinkId),null!=this.selectedOperatorId&&this.deleteOperator(this.selectedOperatorId)},setPositionRatio:function(a){this.positionRatio=a},getPositionRatio:function(){return this.positionRatio},getData:function(){var a=["operators","links","linkRestrictions"],b={};b.operators=$.extend(!0,{},this.data.operators),b.links=$.extend(!0,{},this.data.links),b.linkRestrictions=$.extend(!0,[],this.data.linkRestrictions);for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];for(var e in b[d])b[d].hasOwnProperty(e)&&delete b[d][e].internal}return b.operatorTypes=this.data.operatorTypes,b},setOperatorTitle:function(a,b){this.data.operators[a].internal.els.title.html(b),"undefined"==typeof this.data.operators[a].properties&&(this.data.operators[a].properties={}),this.data.operators[a].properties.title=b,this._refreshInternalProperties(this.data.operators[a]),this.callbackEvent("afterChange",["operator_title_change"])},getOperatorTitle:function(a){return this.data.operators[a].internal.properties.title},setOperatorData:function(a,b){var c=this.getOperatorCompleteData(b);for(var d in this.data.links)if(this.data.links.hasOwnProperty(d)){var e=this.data.links[d];(e.fromOperator==a&&"undefined"==typeof c.outputs[e.fromConnector]||e.toOperator==a&&"undefined"==typeof c.inputs[e.toConnector])&&this._deleteLink(d,!0)}this._deleteOperator(a,!0),this.createOperator(a,b),this.redrawLinksLayer(),this.callbackEvent("afterChange",["operator_data_change"])},getOperatorData:function(a){var b=$.extend(!0,{},this.data.operators[a]);return delete b.internal,b},getOperatorFullProperties:function(a){if("undefined"!=typeof a.type){var b=this.data.operatorTypes[a.type],c={};return"undefined"!=typeof a.properties&&(c=a.properties),$.extend({},b,c)}return a.properties},_refreshInternalProperties:function(a){a.internal.properties=this.getOperatorFullProperties(a)}})});