!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/cdk/coercion"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-flowchart",["exports","@angular/core","rxjs","rxjs/operators","@angular/cdk/coercion","@angular/common"],t):t((e=e||self)["ngx-flowchart"]={},e.ng.core,e.rxjs,e.rxjs.operators,e.ng.cdk.coercion,e.ng.common)}(this,(function(e,t,n,o,i,r){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */var s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function d(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return(a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n=0;d--)(i=e[d])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function g(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}var p=new t.InjectionToken("fc-node.component.config"),h={htmlPrefix:"fc",leftConnectorType:"leftConnector",rightConnectorType:"rightConnector",curvedStyle:"curved",lineStyle:"line",dragAnimationRepaint:"repaint",dragAnimationShadow:"shadow",canvasClass:"fc-canvas",selectedClass:"fc-selected",editClass:"fc-edit",activeClass:"fc-active",hoverClass:"fc-hover",draggingClass:"fc-dragging",edgeClass:"fc-edge",edgeLabelClass:"fc-edge-label",connectorClass:"fc-connector",magnetClass:"fc-magnet",nodeClass:"fc-node",nodeOverlayClass:"fc-node-overlay",leftConnectorClass:"fc-leftConnectors",rightConnectorClass:"fc-rightConnectors",canvasResizeThreshold:200,canvasResizeStep:200},u=function(){Error.apply(this,arguments)};Object.defineProperty(u,"prototype",new Error);var f=function(e){function t(t){var n=e.call(this)||this;return n.message=t,n}return d(t,e),t}(u);function v(e){var t,n,o,i,r={};e.nodes.forEach((function(e){r[e.id]={incoming:0,outgoing:[]}})),e.edges.forEach((function(t){var n=e.nodes.filter((function(e){return e.connectors.some((function(e){return e.id===t.source}))}))[0],o=e.nodes.filter((function(e){return e.connectors.some((function(e){return e.id===t.destination}))}))[0];r[n.id].outgoing.push(o.id),r[o.id].incoming++}));var s=[],d=[];try{for(var a=g(Object.keys(r)),l=a.next();!l.done;l=a.next()){var c=l.value;0===r[c].incoming&&d.push(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}for(;0!==d.length;){for(var p=d.pop(),h=0;h=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom},e.prototype.getItemInfoAtPoint=function(e,t){return{node:this.getNodeAtPoint(e,t),edge:this.getEdgeAtPoint(e,t)}},e.prototype.getNodeAtPoint=function(e,t){var n,o;try{for(var i=g(this.model.nodes),r=i.next();!r.done;r=i.next()){var s=r.value,d=this.nodes.getHtmlElement(s.id).getBoundingClientRect();if(e>=d.left&&e<=d.right&&t>=d.top&&t<=d.bottom)return s}}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return null},e.prototype.getEdgeAtPoint=function(e,t){var n=document.elementFromPoint(e,t).id,o=-1;return n&&(n.startsWith("fc-edge-path-")?o=Number(n.substring("fc-edge-path-".length)):n.startsWith("fc-edge-label-")&&(o=Number(n.substring("fc-edge-label-".length)))),o>-1?this.model.edges[o]:null},e.prototype.selectAllInRect=function(e){var t=this;this.model.nodes.forEach((function(n){var o=t.nodes.getHtmlElement(n.id).getBoundingClientRect();if(!n.readonly){var i=o.left+o.width/2,r=o.top+o.height/2;t.inRectBox(i,r,e)?t.nodes.select(n):t.nodes.isSelected(n)&&t.nodes.deselect(n)}}));var n=this.canvasHtmlElement.getBoundingClientRect();this.model.edges.forEach((function(o){var i=t.edges.sourceCoord(o),r=t.edges.destCoord(o),s=(i.x+r.x)/2+n.left,d=(i.y+r.y)/2+n.top;t.inRectBox(s,d,e)?t.edges.select(o):t.edges.isSelected(o)&&t.edges.deselect(o)}))},e.prototype.deleteSelected=function(){var e=this;this.edges.getSelectedEdges().forEach((function(t){e.edges.delete(t)})),this.nodes.getSelectedNodes().forEach((function(t){e.nodes.delete(t)}))},e.prototype.isEditable=function(){return void 0===this.dropTargetId},e.prototype.isDropSource=function(){return void 0!==this.dropTargetId},e.prototype.getDragImage=function(){return this.dragImage||(this.dragImage=new Image,this.dragImage.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",this.dragImage.style.visibility="hidden"),this.dragImage},e}(),y=function(){function e(e){this.modelService=e}return e.prototype.select=function(e){this.modelService.selectObject(e)},e.prototype.deselect=function(e){this.modelService.deselectObject(e)},e.prototype.toggleSelected=function(e){this.modelService.toggleSelectedObject(e)},e.prototype.isSelected=function(e){return this.modelService.isSelectedObject(e)},e.prototype.isEdit=function(e){return this.modelService.isEditObject(e)},e}(),b=function(e){function t(t){return e.call(this,t)||this}return d(t,e),t.prototype.getConnector=function(e){var t,n,o,i,r=this.modelService.model;try{for(var s=g(r.nodes),d=s.next();!d.done;d=s.next()){var a=d.value;try{for(var l=(o=void 0,g(a.connectors)),c=l.next();!c.done;c=l.next()){var p=c.value;if(p.id===e)return p}}catch(e){o={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}},t.prototype.getConnectorRectInfo=function(e){return this.modelService.connectorsRectInfos[e]},t.prototype.setConnectorRectInfo=function(e,t){this.modelService.connectorsRectInfos[e]=t,this.modelService.detectChanges()},t.prototype._getCoords=function(e,t){var n=this.getConnectorRectInfo(e),o=this.modelService.canvasHtmlElement;if(null==n||null===o)return{x:0,y:0};var i=n.type===h.leftConnectorType?n.nodeRectInfo.left():n.nodeRectInfo.right(),r=n.nodeRectInfo.top()+n.nodeRectInfo.height()/2;return t||(i-=n.width/2,r-=n.height/2),{x:Math.round(i),y:Math.round(r)}},t.prototype.getCoords=function(e){return this._getCoords(e,!1)},t.prototype.getCenteredCoord=function(e){return this._getCoords(e,!0)},t}(y),C=function(e){function t(t){return e.call(this,t)||this}return d(t,e),t.prototype.getConnectorsByType=function(e,t){return e.connectors.filter((function(e){return e.type===t}))},t.prototype._addConnector=function(e,t){e.connectors.push(t);try{this.modelService.modelValidation.validateNode(e)}catch(n){throw e.connectors.splice(e.connectors.indexOf(t),1),n}},t.prototype.delete=function(e){this.isSelected(e)&&this.deselect(e);var t=this.modelService.model,n=t.nodes.indexOf(e);if(-1===n){if(void 0===e)throw new Error("Passed undefined");throw new Error("Tried to delete not existing node")}for(var o=this.getConnectorIds(e),i=0;i-1)return s}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},t.prototype.getHtmlElement=function(e){return this.modelService.nodesHtmlElements[e]},t.prototype.setHtmlElement=function(e,t){this.modelService.nodesHtmlElements[e]=t,this.modelService.detectChanges()},t}(y),S=function(e){function t(t){return e.call(this,t)||this}return d(t,e),t.prototype.sourceCoord=function(e){return this.modelService.connectors.getCenteredCoord(e.source)},t.prototype.destCoord=function(e){return this.modelService.connectors.getCenteredCoord(e.destination)},t.prototype.delete=function(e){var t=this.modelService.model,n=t.edges.indexOf(e);if(-1===n)throw new Error("Tried to delete not existing edge");this.isSelected(e)&&this.deselect(e),t.edges.splice(n,1),this.modelService.notifyModelChanged(),this.modelService.edgeRemovedCallback(e)},t.prototype.getSelectedEdges=function(){var e=this;return this.modelService.model.edges.filter((function(t){return e.modelService.edges.isSelected(t)}))},t.prototype.handleEdgeMouseClick=function(e,t){t?this.modelService.edges.toggleSelected(e):(this.modelService.deselectAll(),this.modelService.edges.select(e))},t.prototype.putEdge=function(e){this.modelService.model.edges.push(e),this.modelService.notifyModelChanged()},t.prototype._addEdge=function(e,t,n,o){var i=this;this.modelService.modelValidation.validateConnector(t),this.modelService.modelValidation.validateConnector(n);var r={};r.source=t.id,r.destination=n.id,r.label=o;var s=this.modelService.model;this.modelService.modelValidation.validateEdges(s.edges.concat([r]),s.nodes),this.modelService.createEdge(e,r).subscribe((function(e){s.edges.push(e),i.modelService.notifyModelChanged(),i.modelService.edgeAddedCallback(e)}))},t}(y),D=function(){function e(){}return e.prototype.validateModel=function(e){return this.validateNodes(e.nodes),this._validateEdges(e.edges,e.nodes),e},e.prototype.validateNodes=function(e){var t=this,n=[];e.forEach((function(e){if(t.validateNode(e),-1!==n.indexOf(e.id))throw new f("Id not unique.");n.push(e.id)}));var o=[];return e.forEach((function(e){e.connectors.forEach((function(e){if(-1!==o.indexOf(e.id))throw new f("Id not unique.");o.push(e.id)}))})),e},e.prototype.validateNode=function(e){var t=this;if(void 0===e.id)throw new f("Id not valid.");if("string"!=typeof e.name)throw new f("Name not valid.");if("number"!=typeof e.x||e.x<0||Math.round(e.x)!==e.x)throw new f("Coordinates not valid.");if("number"!=typeof e.y||e.y<0||Math.round(e.y)!==e.y)throw new f("Coordinates not valid.");if(!Array.isArray(e.connectors))throw new f("Connectors not valid.");return e.connectors.forEach((function(e){t.validateConnector(e)})),e},e.prototype._validateEdges=function(e,t){var n=this;if(e.forEach((function(e){n._validateEdge(e,t)})),e.forEach((function(t,n){e.forEach((function(e,o){if(n!==o&&(t.source===e.source&&t.destination===e.destination||t.source===e.destination&&t.destination===e.source))throw new f("Duplicated edge.")}))})),null===v({nodes:t,edges:e}))throw new f("Graph has a circle.");return e},e.prototype.validateEdges=function(e,t){return this.validateNodes(t),this._validateEdges(e,t)},e.prototype._validateEdge=function(e,t){if(void 0===e.source)throw new f("Source not valid.");if(void 0===e.destination)throw new f("Destination not valid.");if(e.source===e.destination)throw new f("Edge with same source and destination connectors.");var n=t.filter((function(t){return t.connectors.some((function(t){return t.id===e.source}))}))[0];if(void 0===n)throw new f("Source not valid.");var o=t.filter((function(t){return t.connectors.some((function(t){return t.id===e.destination}))}))[0];if(void 0===o)throw new f("Destination not valid.");if(n===o)throw new f("Edge with same source and destination nodes.");return e},e.prototype.validateEdge=function(e,t){return this.validateNodes(t),this._validateEdge(e,t)},e.prototype.validateConnector=function(e){if(void 0===e.id)throw new f("Id not valid.");if(void 0===e.type||null===e.type||"string"!=typeof e.type)throw new f("Type not valid.");return e},e=l([t.Injectable(),c("design:paramtypes",[])],e)}(),E={dropElement:null},w=function(){function e(e,t,n,o){this.nodeDraggingScope={shadowDragStarted:!1,dropElement:null,draggedNodes:[],shadowElements:[]},this.dragOffsets=[],this.draggedElements=[],this.destinationHtmlElements=[],this.oldDisplayStyles=[],this.modelService=e,this.automaticResize=n,this.dragAnimation=o,this.applyFunction=t}return e.prototype.getCoordinate=function(e,t){return e=Math.max(e,0),e=Math.min(e,t)},e.prototype.getXCoordinate=function(e){return this.getCoordinate(e,this.modelService.canvasHtmlElement.offsetWidth)},e.prototype.getYCoordinate=function(e){return this.getCoordinate(e,this.modelService.canvasHtmlElement.offsetHeight)},e.prototype.resizeCanvas=function(e,t){if(this.automaticResize&&!this.modelService.isDropSource()){var n=this.modelService.canvasHtmlElement;n.offsetWidth

'+O.name+"

"),R=$(this.draggedElements[x]).children()[0];I.children()[0].style.backgroundColor=R.style.backgroundColor,this.nodeDraggingScope.shadowElements.push(I),this.modelService.canvasHtmlElement.appendChild(this.nodeDraggingScope.shadowElements[x][0])}if(b.dataTransfer.setData("text","Just to support firefox"),b.dataTransfer.setDragImage)b.dataTransfer.setDragImage(this.modelService.getDragImage(),0,0);else if(this.draggedElements.forEach((function(e){var t=e.cloneNode(!0);e.parentNode.insertBefore(t,e),e.style.visibility="collapse",setTimeout((function(){e.parentNode.removeChild(t),e.style.visibility="visible"}),0)})),this.dragAnimation===h.dragAnimationShadow){for(x=0;x\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n {{edgeDraggingService.edgeDragging.dragLabel}}\n
\n
\n \n
\n
\n \n
\n
\n ×\n
\n {{edge.label}}\n
\n \n \n\n',changeDetection:t.ChangeDetectionStrategy.OnPush,styles:[":host{display:block;position:relative;width:100%;height:100%;background-size:25px 25px;background-image:linear-gradient(to right,rgba(0,0,0,.1) 1px,transparent 1px),linear-gradient(to bottom,rgba(0,0,0,.1) 1px,transparent 1px);background-color:transparent;min-width:100%;min-height:100%;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .fc-canvas-container{display:block;position:relative;width:100%;height:100%}:host .fc-canvas-container svg.fc-canvas-svg{display:block;position:relative;width:100%;height:100%}:host .fc-edge{stroke:gray;stroke-width:4;-webkit-transition:stroke-width .2s;transition:stroke-width .2s;fill:transparent}:host .fc-edge.fc-hover{stroke:gray;stroke-width:6;fill:transparent}:host .fc-edge.fc-selected{stroke:red;stroke-width:4;fill:transparent}:host .fc-edge.fc-active{-webkit-animation:3s linear infinite dash;animation:3s linear infinite dash;stroke-dasharray:20}:host .fc-edge.fc-dragging{pointer-events:none}:host .fc-arrow-marker polygon{stroke:gray;fill:gray}:host .fc-arrow-marker-selected polygon{stroke:red;fill:red}:host .edge-endpoint{fill:gray}:host .fc-noselect{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .fc-edge-label{position:absolute;opacity:.8;-webkit-transition:-webkit-transform .2s;transition:transform .2s;transition:transform .2s,-webkit-transform .2s;-webkit-transform-origin:bottom left;transform-origin:bottom left;margin:0 auto}:host .fc-edge-label .fc-edge-label-text{position:absolute;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);white-space:nowrap;text-align:center;font-size:16px}:host .fc-edge-label .fc-edge-label-text span{cursor:default;border:solid #ff3d00;border-radius:10px;color:#ff3d00;background-color:#fff;padding:3px 5px}:host .fc-edge-label .fc-nodeedit{top:-30px;right:14px}:host .fc-edge-label .fc-nodedelete{top:-30px;right:-13px}:host .fc-edge-label.fc-hover{-webkit-transform:scale(1.25);transform:scale(1.25)}:host .fc-edge-label.fc-edit .fc-edge-label-text span,:host .fc-edge-label.fc-selected .fc-edge-label-text span{border:solid red;color:#fff;font-weight:600;background-color:red}:host .fc-select-rectangle{border:2px dashed #5262ff;position:absolute;background:rgba(20,125,255,.1);z-index:2}@-webkit-keyframes dash{from{stroke-dashoffset:500}}@keyframes dash{from{stroke-dashoffset:500}}:host ::ng-deep .fc-nodeedit{display:none;font-size:15px}:host ::ng-deep .fc-nodedelete{display:none;font-size:18px}:host ::ng-deep .fc-edit .fc-nodedelete,:host ::ng-deep .fc-edit .fc-nodeedit{display:block;position:absolute;border:2px solid #eee;border-radius:50%;font-weight:600;line-height:20px;height:20px;padding-top:2px;width:22px;background:#494949;color:#fff;text-align:center;vertical-align:bottom;cursor:pointer}:host ::ng-deep .fc-edit .fc-nodeedit{top:-24px;right:16px}:host ::ng-deep .fc-edit .fc-nodedelete{top:-24px;right:-13px}"]}),c("design:paramtypes",[t.ElementRef,t.IterableDiffers,D,x,t.ChangeDetectorRef,t.NgZone])],e)}(),P=function(){function e(e){this.elementRef=e}return e.prototype.ngOnInit=function(){$(this.elementRef.nativeElement).addClass(h.magnetClass)},e.prototype.dragover=function(e){return this.callbacks.edgeDragoverMagnet(e,this.connector)},e.prototype.dragleave=function(e){this.callbacks.edgeDragleaveMagnet(e)},e.prototype.drop=function(e){return this.callbacks.edgeDrop(e,this.connector)},e.prototype.dragend=function(e){this.callbacks.edgeDragend(e)},e.ctorParameters=function(){return[{type:t.ElementRef}]},l([t.Input(),c("design:type",Object)],e.prototype,"callbacks",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"connector",void 0),l([t.HostListener("dragover",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"dragover",null),l([t.HostListener("dragleave",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"dragleave",null),l([t.HostListener("drop",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"drop",null),l([t.HostListener("dragend",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"dragend",null),e=l([t.Directive({selector:"[fc-magnet]"}),c("design:paramtypes",[t.ElementRef])],e)}(),H=function(){function e(e){this.elementRef=e}return e.prototype.ngOnInit=function(){var e=$(this.elementRef.nativeElement);e.addClass(h.connectorClass),this.modelservice.isEditable()&&(e.attr("draggable","true"),this.updateConnectorClass());var t={type:this.connector.type,width:this.elementRef.nativeElement.offsetWidth,height:this.elementRef.nativeElement.offsetHeight,nodeRectInfo:this.nodeRectInfo};this.modelservice.connectors.setConnectorRectInfo(this.connector.id,t)},e.prototype.ngOnChanges=function(e){var t,n,o=!1;try{for(var i=g(Object.keys(e)),r=i.next();!r.done;r=i.next()){var s=r.value,d=e[s];d.firstChange||d.currentValue===d.previousValue||"mouseOverConnector"===s&&(o=!0)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}o&&this.modelservice.isEditable()&&this.updateConnectorClass()},e.prototype.updateConnectorClass=function(){var e=$(this.elementRef.nativeElement);this.connector===this.mouseOverConnector?e.addClass(h.hoverClass):e.removeClass(h.hoverClass)},e.prototype.dragover=function(e){},e.prototype.drop=function(e){if(this.modelservice.isEditable())return this.callbacks.edgeDrop(e,this.connector)},e.prototype.dragend=function(e){this.modelservice.isEditable()&&this.callbacks.edgeDragend(e)},e.prototype.dragstart=function(e){this.modelservice.isEditable()&&this.callbacks.edgeDragstart(e,this.connector)},e.prototype.mouseenter=function(e){this.modelservice.isEditable()&&this.callbacks.connectorMouseEnter(e,this.connector)},e.prototype.mouseleave=function(e){this.modelservice.isEditable()&&this.callbacks.connectorMouseLeave(e,this.connector)},e.ctorParameters=function(){return[{type:t.ElementRef}]},l([t.Input(),c("design:type",Object)],e.prototype,"callbacks",void 0),l([t.Input(),c("design:type",m)],e.prototype,"modelservice",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"connector",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"nodeRectInfo",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"mouseOverConnector",void 0),l([t.HostListener("dragover",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"dragover",null),l([t.HostListener("drop",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"drop",null),l([t.HostListener("dragend",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"dragend",null),l([t.HostListener("dragstart",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"dragstart",null),l([t.HostListener("mouseenter",["$event"]),c("design:type",Function),c("design:paramtypes",[MouseEvent]),c("design:returntype",void 0)],e.prototype,"mouseenter",null),l([t.HostListener("mouseleave",["$event"]),c("design:type",Function),c("design:paramtypes",[MouseEvent]),c("design:returntype",void 0)],e.prototype,"mouseleave",null),e=l([t.Directive({selector:"[fc-connector]"}),c("design:paramtypes",[t.ElementRef])],e)}(),F=function(){function e(e,t,n){this.nodeComponentConfig=e,this.elementRef=t,this.componentFactoryResolver=n}var n,o;return Object.defineProperty(e.prototype,"nodeId",{get:function(){return this.node.id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.node.y+"px"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"left",{get:function(){return this.node.x+"px"},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.userNodeCallbacks||(this.userNodeCallbacks={}),this.userNodeCallbacks.nodeEdit=this.userNodeCallbacks.nodeEdit||function(){},this.userNodeCallbacks.doubleClick=this.userNodeCallbacks.doubleClick||function(){},this.userNodeCallbacks.mouseDown=this.userNodeCallbacks.mouseDown||function(){},this.userNodeCallbacks.mouseEnter=this.userNodeCallbacks.mouseEnter||function(){},this.userNodeCallbacks.mouseLeave=this.userNodeCallbacks.mouseLeave||function(){};var e=$(this.elementRef.nativeElement);e.addClass(h.nodeClass),this.node.readonly||e.attr("draggable","true"),this.updateNodeClass(),this.modelservice.nodes.setHtmlElement(this.node.id,e[0]),this.nodeContentContainer.clear();var t=this.componentFactoryResolver.resolveComponentFactory(this.nodeComponentConfig.nodeComponentType),n=this.nodeContentContainer.createComponent(t);this.nodeComponent=n.instance,this.nodeComponent.callbacks=this.callbacks,this.nodeComponent.userNodeCallbacks=this.userNodeCallbacks,this.nodeComponent.node=this.node,this.nodeComponent.modelservice=this.modelservice,this.updateNodeComponent(),this.nodeComponent.width=this.elementRef.nativeElement.offsetWidth,this.nodeComponent.height=this.elementRef.nativeElement.offsetHeight},e.prototype.ngAfterViewInit=function(){this.nodeComponent.width=this.elementRef.nativeElement.offsetWidth,this.nodeComponent.height=this.elementRef.nativeElement.offsetHeight},e.prototype.ngOnChanges=function(e){var t,n,o=!1;try{for(var i=g(Object.keys(e)),r=i.next();!r.done;r=i.next()){var s=r.value,d=e[s];d.firstChange||d.currentValue===d.previousValue||["selected","edit","underMouse","mouseOverConnector","dragging"].includes(s)&&(o=!0)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}o&&(this.updateNodeClass(),this.updateNodeComponent())},e.prototype.updateNodeClass=function(){var e=$(this.elementRef.nativeElement);this.toggleClass(e,h.selectedClass,this.selected),this.toggleClass(e,h.editClass,this.edit),this.toggleClass(e,h.hoverClass,this.underMouse),this.toggleClass(e,h.draggingClass,this.dragging)},e.prototype.updateNodeComponent=function(){this.nodeComponent.selected=this.selected,this.nodeComponent.edit=this.edit,this.nodeComponent.underMouse=this.underMouse,this.nodeComponent.mouseOverConnector=this.mouseOverConnector,this.nodeComponent.dragging=this.dragging},e.prototype.toggleClass=function(e,t,n){n?e.addClass(t):e.removeClass(t)},e.prototype.mousedown=function(e){e.stopPropagation()},e.prototype.dragstart=function(e){this.node.readonly||this.callbacks.nodeDragstart(e,this.node)},e.prototype.dragend=function(e){this.node.readonly||this.callbacks.nodeDragend(e)},e.prototype.click=function(e){this.node.readonly||this.callbacks.nodeClicked(e,this.node)},e.prototype.mouseover=function(e){this.node.readonly||this.callbacks.nodeMouseOver(e,this.node)},e.prototype.mouseout=function(e){this.node.readonly||this.callbacks.nodeMouseOut(e,this.node)},e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[p]}]},{type:t.ElementRef},{type:t.ComponentFactoryResolver}]},l([t.Input(),c("design:type",Object)],e.prototype,"callbacks",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"userNodeCallbacks",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"node",void 0),l([t.Input(),c("design:type",Boolean)],e.prototype,"selected",void 0),l([t.Input(),c("design:type",Boolean)],e.prototype,"edit",void 0),l([t.Input(),c("design:type",Boolean)],e.prototype,"underMouse",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"mouseOverConnector",void 0),l([t.Input(),c("design:type",m)],e.prototype,"modelservice",void 0),l([t.Input(),c("design:type",Boolean)],e.prototype,"dragging",void 0),l([t.HostBinding("attr.id"),c("design:type",String),c("design:paramtypes",[])],e.prototype,"nodeId",null),l([t.HostBinding("style.top"),c("design:type",String),c("design:paramtypes",[])],e.prototype,"top",null),l([t.HostBinding("style.left"),c("design:type",String),c("design:paramtypes",[])],e.prototype,"left",null),l([t.ViewChild("nodeContent",{read:t.ViewContainerRef,static:!0}),c("design:type",t.ViewContainerRef)],e.prototype,"nodeContentContainer",void 0),l([t.HostListener("mousedown",["$event"]),c("design:type",Function),c("design:paramtypes",[MouseEvent]),c("design:returntype",void 0)],e.prototype,"mousedown",null),l([t.HostListener("dragstart",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"dragstart",null),l([t.HostListener("dragend",["$event"]),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],e.prototype,"dragend",null),l([t.HostListener("click",["$event"]),c("design:type",Function),c("design:paramtypes",[MouseEvent]),c("design:returntype",void 0)],e.prototype,"click",null),l([t.HostListener("mouseover",["$event"]),c("design:type",Function),c("design:paramtypes",[MouseEvent]),c("design:returntype",void 0)],e.prototype,"mouseover",null),l([t.HostListener("mouseout",["$event"]),c("design:type",Function),c("design:paramtypes",[MouseEvent]),c("design:returntype",void 0)],e.prototype,"mouseout",null),e=l([t.Component({selector:"fc-node",template:"",styles:[":host{position:absolute;z-index:1}:host.fc-dragging{z-index:10}:host ::ng-deep .fc-leftConnectors,:host ::ng-deep .fc-rightConnectors{position:absolute;top:0;height:100%;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;z-index:-10}:host ::ng-deep .fc-leftConnectors .fc-magnet,:host ::ng-deep .fc-rightConnectors .fc-magnet{-webkit-box-align:center;align-items:center}:host ::ng-deep .fc-leftConnectors{left:-20px}:host ::ng-deep .fc-rightConnectors{right:-20px}:host ::ng-deep .fc-magnet{display:-webkit-box;display:flex;-webkit-box-flex:1;flex-grow:1;height:60px;-webkit-box-pack:center;justify-content:center}:host ::ng-deep .fc-connector{width:18px;height:18px;border:10px solid transparent;-moz-background-clip:padding;-webkit-background-clip:padding;background-clip:padding-box;border-radius:50%;background-color:#f7a789;color:#fff;pointer-events:all}:host ::ng-deep .fc-connector.fc-hover{background-color:#000}"]}),(n=0,o=t.Inject(p),function(e,t){o(e,t,n)}),c("design:paramtypes",[Object,t.ElementRef,t.ComponentFactoryResolver])],e)}(),T=function(){function e(){var e=this;this.flowchartConstants=h,this.nodeRectInfo={top:function(){return e.node.y},left:function(){return e.node.x},bottom:function(){return e.node.y+e.height},right:function(){return e.node.x+e.width},width:function(){return e.width},height:function(){return e.height}}}return e.prototype.ngOnInit=function(){},l([t.Input(),c("design:type",Object)],e.prototype,"callbacks",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"userNodeCallbacks",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"node",void 0),l([t.Input(),c("design:type",Boolean)],e.prototype,"selected",void 0),l([t.Input(),c("design:type",Boolean)],e.prototype,"edit",void 0),l([t.Input(),c("design:type",Boolean)],e.prototype,"underMouse",void 0),l([t.Input(),c("design:type",Object)],e.prototype,"mouseOverConnector",void 0),l([t.Input(),c("design:type",m)],e.prototype,"modelservice",void 0),l([t.Input(),c("design:type",Boolean)],e.prototype,"dragging",void 0),e=l([t.Directive()],e)}(),L=function(e){function n(){return e.call(this)||this}return d(n,e),n=l([t.Component({selector:"fc-default-node",template:'\n
\n
\n

{{ node.name }}

\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n ×\n
\n\n',styles:[":host .fc-node-overlay{position:absolute;pointer-events:none;left:0;top:0;right:0;bottom:0;background-color:#000;opacity:0}:host :host-context(.fc-hover) .fc-node-overlay{opacity:.25;-webkit-transition:opacity .2s;transition:opacity .2s}:host :host-context(.fc-selected) .fc-node-overlay{opacity:.25}:host .innerNode{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;min-width:100px;border-radius:5px;background-color:#f15b26;color:#fff;font-size:16px;pointer-events:none}:host .innerNode p{padding:0 15px;text-align:center}"]}),c("design:paramtypes",[])],n)}(T),B={nodeComponentType:L},z=function(){function e(){}return e=l([t.NgModule({entryComponents:[L],declarations:[N,P,H,F,L],providers:[D,x,{provide:p,useValue:B}],imports:[r.CommonModule],exports:[N,P,H,L]})],e)}();e.DefaultFcNodeComponent=L,e.FC_NODE_COMPONENT_CONFIG=p,e.FcConnectorDirective=H,e.FcMagnetDirective=P,e.FcNodeComponent=T,e.FlowchartConstants=h,e.ModelvalidationError=f,e.NgxFlowchartComponent=N,e.NgxFlowchartModule=z,e.fcTopSort=v,e.ɵ0=B,e.ɵa=F,e.ɵb=D,e.ɵc=x,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=ngx-flowchart.umd.min.js.map