"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e);function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n1&&this.node.children.map((function(e,n){var r=t.classNames("p-organizationchart-line-left",{"p-organizationchart-line-top":0!==n}),i=t.classNames("p-organizationchart-line-right",{"p-organizationchart-line-top":n!==p-1});return[o.default.createElement("td",{key:n+"_lineleft",className:r}," "),o.default.createElement("td",{key:n+"_lineright",className:i}," ")]}))),f=o.default.createElement("tr",{style:{visibility:c},className:"p-organizationchart-nodes"},this.node.children&&this.node.children.map((function(t,n){return o.default.createElement("td",{key:n,colSpan:"2"},o.default.createElement(i,{node:t,nodeTemplate:e.props.nodeTemplate,selectionMode:e.props.selectionMode,onNodeClick:e.props.onNodeClick,isSelected:e.props.isSelected}))})));return o.default.createElement("table",{className:"p-organizationchart-table"},o.default.createElement("tbody",null,s,d,u,f))}}]),i}();g(S,"defaultProps",{node:null,nodeTemplate:null,root:!1,first:!1,last:!1,selectionMode:null,onNodeClick:null,isSelected:null});var E=function(n){h(p,e.Component);var r=b(p);function p(e){var t;return d(this,p),(t=r.call(this,e)).root=t.props.value&&t.props.value.length?t.props.value[0]:null,t.onNodeClick=t.onNodeClick.bind(c(t)),t.isSelected=t.isSelected.bind(c(t)),t}return u(p,[{key:"onNodeClick",value:function(e,t){if(this.props.selectionMode){var n=e.target;if(n.className&&(-1!==n.className.indexOf("p-node-toggler")||-1!==n.className.indexOf("p-node-toggler-icon")))return;if(!1===t.selectable)return;var o,r=this.findIndexInSelection(t),c=r>=0;"single"===this.props.selectionMode?c?(o=null,this.props.onNodeUnselect&&this.props.onNodeUnselect({originalEvent:e,node:t})):(o=t,this.props.onNodeSelect&&this.props.onNodeSelect({originalEvent:e,node:t})):"multiple"===this.props.selectionMode&&(c?(o=this.props.selection.filter((function(e,t){return t!==r})),this.props.onNodeUnselect&&this.props.onNodeUnselect({originalEvent:e,node:t})):(o=[].concat(i(d=this.props.selection||[])||l(d)||a(d)||s(),[t]),this.props.onNodeSelect&&this.props.onNodeSelect({originalEvent:e,node:t}))),this.props.onSelectionChange&&this.props.onSelectionChange({originalEvent:e,data:o})}var d}},{key:"findIndexInSelection",value:function(e){var t=-1;if(this.props.selectionMode&&this.props.selection)if("single"===this.props.selectionMode)t=this.props.selection===e?0:-1;else if("multiple"===this.props.selectionMode)for(var n=0;n