var OrgChart=function(t,e){var r=this;if(("string"==typeof t||t instanceof String)&&(t=document.querySelector(t)),this.element=t,this.config=OrgChart.mergeDeep(OrgChart._defaultConfig(e),e),this._layoutConfigs={base:{orientation:this.config.orientation,levelSeparation:this.config.levelSeparation,mixedHierarchyNodesSeparation:this.config.mixedHierarchyNodesSeparation,assistantSeparation:this.config.assistantSeparation,subtreeSeparation:this.config.subtreeSeparation,siblingSeparation:this.config.siblingSeparation,layout:this.config.layout,columns:this.config.columns,collapse:this.config.collapse,partnerNodeSeparation:this.config.partnerNodeSeparation}},this.config.tags)for(var i in this.config.tags){var a=this.config.tags[i];null!=a.subTreeConfig&&(this._layoutConfigs[i]={orientation:null!=a.subTreeConfig.orientation?a.subTreeConfig.orientation:this.config.orientation,levelSeparation:null!=a.subTreeConfig.levelSeparation?a.subTreeConfig.levelSeparation:this.config.levelSeparation,mixedHierarchyNodesSeparation:null!=a.subTreeConfig.mixedHierarchyNodesSeparation?a.subTreeConfig.mixedHierarchyNodesSeparation:this.config.mixedHierarchyNodesSeparation,assistantSeparation:null!=a.subTreeConfig.assistantSeparation?a.subTreeConfig.assistantSeparation:this.config.assistantSeparation,subtreeSeparation:null!=a.subTreeConfig.subtreeSeparation?a.subTreeConfig.subtreeSeparation:this.config.subtreeSeparation,siblingSeparation:null!=a.subTreeConfig.siblingSeparation?a.subTreeConfig.siblingSeparation:this.config.siblingSeparation,layout:null!=a.subTreeConfig.layout?a.subTreeConfig.layout:this.config.layout,columns:null!=a.subTreeConfig.columns?a.subTreeConfig.columns:this.config.columns,collapse:null!=a.subTreeConfig.collapse?a.subTreeConfig.collapse:this.config.collapse,partnerNodeSeparation:null!=a.subTreeConfig.partnerNodeSeparation?a.subTreeConfig.partnerNodeSeparation:this.config.partnerNodeSeparation})}this._event_id=OrgChart._guid(),OrgChart._validateConfig(this.config)&&(this._vScroll={},this.config.ui||(this.ui=OrgChart.ui),this.config.editUI?this.editUI=this.config.editUI:this.editUI=new OrgChart.editUI,this.editUI.init(this),this.config.filterUI?this.filterUI=this.config.filterUI:this.filterUI=new OrgChart.filterUI,this.filterUI.init(this),this.manager=new OrgChart.manager(this),this.config.searchUI?this.searchUI=this.config.searchUI:this.searchUI=new OrgChart.searchUI,this.config.nodeMenuUI?this.nodeMenuUI=this.config.nodeMenuUI:this.nodeMenuUI=new OrgChart.menuUI,this.nodeMenuUI.init(this,this.config.nodeMenu),this.config.nodeCircleMenuUI?this.nodeCircleMenuUI=this.config.nodeCircleMenuUI:this.nodeCircleMenuUI=new OrgChart.circleMenuUI,this.nodeCircleMenuUI.init(this,this.config.nodeCircleMenu),this.config.nodeContextMenuUI?this.nodeContextMenuUI=this.config.nodeContextMenuUI:this.nodeContextMenuUI=new OrgChart.menuUI,this.nodeContextMenuUI.init(this,this.config.nodeContextMenu),this.config.toolbarUI?this.toolbarUI=this.config.toolbarUI:this.toolbarUI=new OrgChart.toolbarUI,this.config.notifierUI?this.notifierUI=this.config.notifierUI:this.notifierUI=new OrgChart.notifierUI,this.notifierUI.init(this),this.config.menuUI?this.menuUI=this.config.menuUI:this.menuUI=new OrgChart.menuUI,this.menuUI.init(this,this.config.menu),this.config.xScrollUI||(this.xScrollUI=new OrgChart.xScrollUI(this.element,this.config,(function(){return{boundary:r.response.boundary,scale:r.getScale(),viewBox:r.getViewBox(),padding:r.config.padding}}),(function(t){r.setViewBox(t)}),(function(){r._draw(!0,OrgChart.action.xScroll)}))),this.config.yScrollUI||(this.yScrollUI=new OrgChart.yScrollUI(this.element,this.config,(function(){return{boundary:r.response.boundary,scale:r.getScale(),viewBox:r.getViewBox(),padding:r.config.padding}}),(function(t){r.setViewBox(t)}),(function(){r._draw(!0,OrgChart.action.xScroll)}))),this.config.undoRedoUI?this.undoRedoUI=this.config.undoRedoUI:this.undoRedoUI=new OrgChart.undoRedoUI,this.element.classList.add("boc-"+this.config.mode),this._gragStartedId=null,this._timeout=null,this._touch=null,this._initialized=!1,this._loaded=!1,this._moveInterval=null,this._movePosition=null,this.response=null,this.nodes=null,this.isVisible=null,OrgChart._intersectionObserver(this.element,(function(t){r.isVisible=t,!1!==OrgChart.events.publish("visibility-change",[r])&&OrgChart.LAZY_LOADING&&r.isVisible&&(r._loaded?r._draw(!1,OrgChart.action.update):(r._setInitialSizeIfNotSet(),r._draw(!1,OrgChart.action.init)))})))};OrgChart._defaultConfig=function(t){return{interactive:!0,mode:"light",lazyLoading:!0,enableDragDrop:!1,enableSearch:!0,enableTouch:!1,enablePan:!0,keyNavigation:!1,miniMap:!1,nodeMenu:null,nodeCircleMenu:null,nodeContextMenu:null,menu:null,toolbar:!1,sticky:!0,nodeMouseClick:OrgChart.action.details,nodeMouseDbClick:OrgChart.none,mouseScrool:OrgChart.action.zoom,showXScroll:OrgChart.none,showYScroll:OrgChart.none,template:"ana",tags:{},min:!1,nodeBinding:{},linkBinding:{},searchFields:null,searchDisplayField:null,searchFieldsWeight:null,searchFieldsAbbreviation:null,nodes:[],clinks:[],slinks:[],groupDottedLines:[],dottedLines:[],undoRedoStorageName:null,levelSeparation:60,siblingSeparation:20,subtreeSeparation:40,mixedHierarchyNodesSeparation:15,assistantSeparation:100,minPartnerSeparation:50,partnerChildrenSplitSeparation:20,partnerNodeSeparation:15,columns:10,padding:30,orientation:OrgChart.orientation.top,layout:OrgChart.layout.normal,layoutGridColumns:"dynamic",scaleInitial:1,movable:null,scaleMin:.1,scaleMax:5,orderBy:null,editUI:null,filterUI:null,searchUI:null,xScrollUI:null,yScrollUI:null,nodeMenuUI:null,nodeCircleMenuUI:null,nodeContextMenuUI:null,toolbarUI:null,notifierUI:null,menuUI:null,undoRedoUI:null,exportUrl:"https://balkan.app/export",collapse:{},expand:{},align:OrgChart.CENTER,UI:null,anim:{func:OrgChart.anim.outPow,duration:200},zoom:{speed:120,smooth:12},roots:null,state:null,editForm:{readOnly:!1,titleBinding:"name",photoBinding:"img",addMore:"Add more fields",addMoreBtn:"Add",addMoreFieldName:"Field name",saveAndCloseBtn:"Save and close",cancelBtn:"Cancel",generateElementsFromFields:!0,focusBinding:null,buttons:{edit:{icon:OrgChart.icon.edit(24,24,"#fff"),text:"Edit",hideIfEditMode:!0,hideIfDetailsMode:!1},share:{icon:OrgChart.icon.share(24,24,"#fff"),text:"Share"},pdf:{icon:OrgChart.icon.pdf(24,24,"#fff"),text:"Save as PDF"},remove:{icon:OrgChart.icon.remove(24,24,"#fff"),text:"Remove",hideIfDetailsMode:!0}},elements:[]}}},OrgChart.prototype.load=function(t,e){var r=this;return this.config.nodes=t,this._draw(!1,OrgChart.action.init,void 0,(function(){r.filterUI.update(),e&&e()})),this},OrgChart.prototype.loadXML=function(t,e){var r=OrgChart._xml2json(t);return this.load(r,e)},OrgChart.prototype.getXML=function(){return OrgChart._json2xml(this.config.nodes)},OrgChart.prototype.on=function(t,e){return OrgChart.events.on(t,e,this._event_id),this},OrgChart.prototype.removeListener=function(t,e){return OrgChart.events.remove(t,e,this._event_id)},OrgChart.prototype.draw=function(t,e,r){null==t&&(t=OrgChart.action.update),this._draw(!1,t,e,r)},OrgChart.prototype._draw=function(t,e,r,i){var a=this;if(!OrgChart.LAZY_LOADING||this.isVisible)if(OrgChart.LAZY_LOADING||this._initialized||(this._setInitialSizeIfNotSet(),0!=this.width()&&0!=this.height())){this._hideBeforeAnimationCompleted=!1;var n=e==OrgChart.action.init?null:this.getViewBox();this.manager.read(t,this.width(),this.height(),n,e,r,(function(t){if(!a.notifierUI.show(t.notif)){e!=OrgChart.action.exporting&&(a.nodes=t.nodes,a.visibleNodeIds=t.visibleNodeIds,a.roots=t.roots),a.editUI.fields=t.allFields;var n={defs:""};OrgChart.events.publish("renderdefs",[a,n]);var o=a.ui.defs(n.defs),l=a.getScale(t.viewBox);o+=a.ui.pointer(a.config,e,l);var s=a.getViewBox(),h=t.viewBox;n={content:o,res:t};OrgChart.events.publish("prerender",[a,n]),o=n.content;var d=[];if(OrgChart.RENDER_LINKS_BEFORE_NODES)for(var c=0;c0){a._hideBeforeAnimation(C[0].length);for(c=0;cthis.config.scaleMax&&(t=this.config.scaleMax),tn?n:a,l=e,s=e[2],h=e[3];return e[2]=e[2]/(t/o),e[3]=e[3]/(t/o),e[0]=l[0]-(e[2]-s)/2,e[1]=l[1]-(e[3]-h)/2,this.setViewBox(e),OrgChart.events.publish("redraw",[this]),t},OrgChart.prototype.ripple=function(t,e,r){var i=this.getNode(t);if(null!=i){var a=this.getNodeElement(t);if(null!=a){var n=this.getScale(),o=i.w/2,l=i.h/2;if(void 0!==e&&void 0!==r){var s=a.getBoundingClientRect();o=e/n-s.left/n,l=r/n-s.top/n}var h=i.w,d=i.h,c=h-o>o?h-o:o,g=d-l>l?d-l:l,p=c>g?c:g,u=document.createElementNS("http://www.w3.org/2000/svg","g"),f=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),m=document.createElementNS("http://www.w3.org/2000/svg","rect"),C=document.createElementNS("http://www.w3.org/2000/svg","circle"),b=OrgChart.randomId();f.setAttribute("id",b);var O={ripple:OrgChart.t(i.templateName,i.min,this.getScale()).ripple,node:i};OrgChart.events.publish("ripple",[this,O]),m.setAttribute("x",O.ripple.rect?O.ripple.rect.x:0),m.setAttribute("y",O.ripple.rect?O.ripple.rect.y:0),m.setAttribute("width",O.ripple.rect?O.ripple.rect.width:i.w),m.setAttribute("height",O.ripple.rect?O.ripple.rect.height:i.h),m.setAttribute("rx",O.ripple.radius),m.setAttribute("ry",O.ripple.radius),C.setAttribute("clip-path","url(#"+b+")"),C.setAttribute("cx",o),C.setAttribute("cy",l),C.setAttribute("r",0),C.setAttribute("fill",O.ripple.color),C.setAttribute("class","boc-ripple"),f.appendChild(m),u.appendChild(f),u.appendChild(C),a.appendChild(u),OrgChart.animate(C,{r:0,opacity:1},{r:p,opacity:0},500,OrgChart.anim.outPow,(function(){a.removeChild(u)}))}}},OrgChart.prototype.center=function(t,e,r){var i,a,n=t,o=!0,l=!0;e&&null!=e.parentState&&(i=e.parentState),e&&null!=e.childrenState&&(a=e.childrenState),e&&null!=e.rippleId&&(n=e.rippleId),e&&null!=e.vertical&&(o=e.vertical),e&&null!=e.horizontal&&(l=e.horizontal);var s={parentState:i,childrenState:a,rippleId:n,vertical:o,horizontal:l};this._draw(!1,OrgChart.action.centerNode,{id:t,options:s},r)},OrgChart.prototype.fit=function(t){this.config.scaleInitial=OrgChart.match.boundary,this._draw(!0,OrgChart.action.init,{method:"fit"},t)},OrgChart.prototype.toggleFullScreen=function(){var t=document.querySelector("["+OrgChart.attr.tlbr+"r='fullScreen']");document.fullscreenElement==this.element||document.webkitFullscreenElement==this.element||document.mozFullScreenElement==this.element||document.msFullscreenElement==this.element?(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen(),t&&(t.innerHTML=OrgChart.toolbarUI.openFullScreenIcon)):(this.element.requestFullscreen?this.element.requestFullscreen():this.element.mozRequestFullScreen?this.element.mozRequestFullScreen():this.element.webkitRequestFullscreen?this.element.webkitRequestFullscreen():this.element.msRequestFullscreen&&this.element.msRequestFullscreen(),t&&(t.innerHTML=OrgChart.toolbarUI.closeFullScreenIcon))},OrgChart.prototype.getNode=function(t){return this.nodes[t]},OrgChart.prototype.setLayout=function(t,e){e||(e="base"),this._layoutConfigs[e].layout=t,"base"==e&&(this.config.layout=t),this._draw(!1,OrgChart.action.update)},OrgChart.prototype.setOrientation=function(t,e,r){var i=this;e||(e="base"),this._layoutConfigs[e].orientation=t,"base"==e&&(this.config.orientation=t),this._draw(!1,OrgChart.action.update,void 0,(function(){OrgChart._moveToBoundaryArea(i.getSvg(),i.getViewBox(),i.response.boundary,(function(){i._draw(!0,OrgChart.action.pan),r&&r()}))}))},OrgChart.prototype.search=function(t,e,r){return OrgChart.isNEU(e)&&(e=this.searchUI._searchFields),OrgChart.isNEU(r)&&(r=e),OrgChart._search.search(this.config.nodes,t,e,r,this.config.searchDisplayField,this.config.searchFieldsWeight,this.searchUI._searchFieldsAbbreviation)},OrgChart.prototype._hideBeforeAnimation=function(t){if(1!=this._hideBeforeAnimationCompleted&&!(t&&tOrgChart.TEXT_THRESHOLD)for(var r=0;rOrgChart.IMAGES_THRESHOLD)for(r=0;rOrgChart.LINKS_THRESHOLD)for(r=0;rOrgChart.BUTTONS_THRESHOLD)for(r=0;rOrgChart.BUTTONS_THRESHOLD)for(r=0;rd.x)&&(l=d.x),(null===s||s>d.y)&&(s=d.y)}var c=this.width(),g=this.height(),p=c/(b=n-l+2*this.config.padding),u=g/(O=o-s+2*this.config.padding),f=p>u?u:p,m=Math.ceil(c/f),C=Math.ceil(g/f),b=0,O=0;if(m-2*this.config.padding>=n-l)b=(n+l)/2-m/2;else switch(b=firstRoot.x-m/2+OrgChart.manager._getNodeWidth(firstRoot,this.config)/2,this.config.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:(b=-(m/2-(l-n)/2))-this.config.padding&&(b=-this.config.padding)}if(C-2*this.config.padding>=o-s)O=(o+s)/2-C/2;else switch((O=-(C/2-(o-s)/2))>-this.config.padding&&(O=-this.config.padding),this.config.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:(O=-(C/2-(s-o)/2))=0;r--)this.config.nodes[r].pid!=t&&this.config.nodes[r].stpid!=t||(this.config.nodes[r].pid=e.pid,this.config.nodes[r].stpid=e.stpid),this.config.nodes[r].id==t&&this.config.nodes.splice(r,1)}return this},OrgChart.prototype._getNewPidsAndStpidsForIds=function(t){var e=this.get(t),r={},i={};if(e)for(var a=this.config.nodes.length-1;a>=0;a--)this.config.nodes[a].pid==t?r[this.config.nodes[a].id]=e.pid:this.config.nodes[a].stpid==t&&(i[this.config.nodes[a].id]=e.stpid);return{newPidsForIds:r,newStpidsForIds:i}},OrgChart.prototype.addNode=function(t,e,r){var i=this;if(!0===r&&!1===OrgChart.events.publish("add",[this,t]))return!1;this.add(t),OrgChart.events.publish("updated",[this]),this.filterUI.update(),i._draw(!1,OrgChart.action.insert,{id:t.pid,insertedNodeId:t.id},(function(){i.ripple(t.id),e&&e()}))},OrgChart.prototype.add=function(t){if(null==t.id&&console.error("Call addNode without id"),this._putInUndoStack(),this.clearRedo(),this.config.movable&&!OrgChart.isNEU(t.pid)){var e=this._get(t.pid);e&&(null!=e.movex&&(t.movex=e.movex),null!=e.movey&&(t.movey=e.movey))}return this.config.nodes.push(t),this},OrgChart.prototype.replaceIds=function(t,e){this._replaceIds(t),this._draw(!1,OrgChart.action.update,void 0,e)},OrgChart.prototype._replaceIds=function(t){for(var e=function(e){for(var r=0;rd+1&&(clearInterval(l),n&&n(t))}),s)},OrgChart.anim={},OrgChart.anim.inPow=function(t){return t<0?0:t>1?1:Math.pow(t,2)},OrgChart.anim.outPow=function(t){if(t<0)return 0;if(t>1)return 1;return-1*(Math.pow(t-1,2)+-1)},OrgChart.anim.inOutPow=function(t){if(t<0)return 0;if(t>1)return 1;if((t*=2)<1)return OrgChart.anim.inPow(t,2)/2;return-.5*(Math.pow(t-2,2)+-2)},OrgChart.anim.inSin=function(t){return t<0?0:t>1?1:1-Math.cos(t*(Math.PI/2))},OrgChart.anim.outSin=function(t){return t<0?0:t>1?1:Math.sin(t*(Math.PI/2))},OrgChart.anim.inOutSin=function(t){return t<0?0:t>1?1:-.5*(Math.cos(Math.PI*t)-1)},OrgChart.anim.inExp=function(t){return t<0?0:t>1?1:Math.pow(2,10*(t-1))},OrgChart.anim.outExp=function(t){return t<0?0:t>1?1:1-Math.pow(2,-10*t)},OrgChart.anim.inOutExp=function(t){return t<0?0:t>1?1:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,10*(-2*t+1)))},OrgChart.anim.inCirc=function(t){return t<0?0:t>1?1:-(Math.sqrt(1-t*t)-1)},OrgChart.anim.outCirc=function(t){return t<0?0:t>1?1:Math.sqrt(1-(t-1)*(t-1))},OrgChart.anim.inOutCirc=function(t){return t<0?0:t>1?1:t<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(2*t-2)*(2*t-2))+1)},OrgChart.anim.rebound=function(t){return t<0?0:t>1?1:t<1/2.75?1-7.5625*t*t:t<2/2.75?1-(7.5625*(t-1.5/2.75)*(t-1.5/2.75)+.75):t<2.5/2.75?1-(7.5625*(t-2.25/2.75)*(t-2.25/2.75)+.9375):1-(7.5625*(t-2.625/2.75)*(t-2.625/2.75)+.984375)},OrgChart.anim.inBack=function(t){return t<0?0:t>1?1:t*t*(2.70158*t-1.70158)},OrgChart.anim.outBack=function(t){return t<0?0:t>1?1:(t-1)*(t-1)*(2.70158*(t-1)+1.70158)+1},OrgChart.anim.inOutBack=function(t){return t<0?0:t>1?1:t<.5?4*t*t*(7.1898*t-2.5949)*.5:.5*((2*t-2)*(2*t-2)*(3.5949*(2*t-2)+2.5949)+2)},OrgChart.anim.impulse=function(t){var e=2*t;return e*Math.exp(1-e)},OrgChart.anim.expPulse=function(t){return Math.exp(-2*Math.pow(t,2))},void 0===OrgChart&&(OrgChart={}),OrgChart.prototype._attachInitEventHandlers=function(t){this._addEvent(window,"resize",this._resizeHandler)},OrgChart.prototype._attachEventHandlers=function(t){if(this.config.interactive){t=this.getSvg();this.config.enableTouch||OrgChart.isMobile()?(this._addEvent(t,"touchstart",this._globalMouseDownHandler),this._addEvent(t,"touchend",this._globalClickHandler)):(this._addEvent(t,"mousedown",this._globalMouseDownHandler),this._addEvent(t,"click",this._globalClickHandler),this._addEvent(t,"contextmenu",this._globalContextHandler),this._addEvent(t,"dblclick",this._globalDbClickHandler),this.config.mouseScrool!=OrgChart.action.none&&this._addEvent(t,"wheel",this._mouseScrollHandler));var e=this.getMenuButton();e&&this._addEvent(e,"click",this._menuClickHandler)}},OrgChart.prototype._addEvent=function(t,e,r,i){var a,n;(i||(i=""),t.getListenerList||(t.getListenerList={}),t.getListenerList[e+i])||(a=this,n=r,r=function(){if(n)return n.apply(a,[this,arguments[0]])},t.addEventListener?"mousewheel"==e?t.addEventListener(e,o,{passive:!1}):t.addEventListener(e,o,!1):t.attachEvent("on"+e,(function(){var e=r.call(t,window.event);return!1===e&&(window.event.returnValue=!1,window.event.cancelBubble=!0),e})),t.getListenerList[e+i]=o);function o(t){var e=r.apply(this,arguments);return!1===e&&(t.stopPropagation(),t.preventDefault()),e}},OrgChart.prototype._removeEvent=function(t,e){if(t.getListenerList[e]){var r=t.getListenerList[e];t.removeEventListener(e,r,!1),delete t.getListenerList[e]}},void 0===OrgChart&&(OrgChart={}),OrgChart.VERSION="8.14.19",OrgChart.orientation={},OrgChart.orientation.top=0,OrgChart.orientation.bottom=1,OrgChart.orientation.right=2,OrgChart.orientation.left=3,OrgChart.orientation.top_left=4,OrgChart.orientation.bottom_left=5,OrgChart.orientation.right_top=6,OrgChart.orientation.left_top=7,OrgChart.align={},OrgChart.align.center=OrgChart.CENTER=8,OrgChart.align.orientation=OrgChart.ORIENTATION=9,OrgChart.attr={},OrgChart.attr.l="data-l",OrgChart.attr.id="data-id",OrgChart.attr.sl="data-sl",OrgChart.attr.lbl="data-lbl",OrgChart.attr.val="data-val",OrgChart.attr.tlbr="data-tlbr",OrgChart.attr.item="data-item",OrgChart.attr.layout="data-layout",OrgChart.attr.node_id="data-n-id",OrgChart.attr.link_id="data-l-id",OrgChart.attr.field_name="data-f-name",OrgChart.attr.c_link_to="data-c-l-to",OrgChart.attr.c_link_from="data-c-l-from",OrgChart.attr.s_link_to="data-s-l-to",OrgChart.attr.s_link_from="data-s-l-from",OrgChart.attr.control_add="data-ctrl-add",OrgChart.attr.control_expcoll_id="data-ctrl-ec-id",OrgChart.attr.control_up_id="data-ctrl-up-id",OrgChart.attr.control_export_menu="data-ctrl-menu",OrgChart.attr.control_node_menu_id="data-ctrl-n-menu-id",OrgChart.attr.control_node_circle_menu_id="data-ctrl-n-c-menu-id",OrgChart.attr.control_node_circle_menu_name="data-ctrl-n-c-menu-name",OrgChart.attr.control_node_circle_menu_wrraper_id="data-ctrl-n-c-menu-wrapper-id",OrgChart.attr.width="data-width",OrgChart.attr.text_overflow="data-text-overflow",OrgChart.ID="id",OrgChart.PID="pid",OrgChart.STPID="stpid",OrgChart.TAGS="tags",OrgChart.NODES="nodes",OrgChart.ELASTIC="elastic",OrgChart.ASSISTANT="Assistant",OrgChart.action={},OrgChart.action.expand=0,OrgChart.action.collapse=1,OrgChart.action.maximize=101,OrgChart.action.minimize=102,OrgChart.action.expandCollapse=501,OrgChart.action.edit=1,OrgChart.action.zoom=2,OrgChart.action.ctrlZoom=22,OrgChart.action.scroll=41,OrgChart.action.xScroll=3,OrgChart.action.yScroll=4,OrgChart.action.none=5,OrgChart.action.init=6,OrgChart.action.update=7,OrgChart.action.move=70,OrgChart.action.pan=8,OrgChart.action.centerNode=9,OrgChart.action.resize=10,OrgChart.action.insert=11,OrgChart.action.insertfirst=12,OrgChart.action.details=13,OrgChart.action.exporting=14,OrgChart.none=400001,OrgChart.scroll={},OrgChart.scroll.visible=!0,OrgChart.scroll.smooth=12,OrgChart.scroll.speed=120,OrgChart.scroll.safari={smooth:12,speed:250},OrgChart.match={},OrgChart.match.height=100001,OrgChart.match.width=100002,OrgChart.match.boundary=100003,OrgChart.movable={},OrgChart.movable.node="node",OrgChart.movable.tree="tree",OrgChart.movable.detachTree="detachTree",OrgChart.layout={},OrgChart.layout.normal=OrgChart.normal=0,OrgChart.layout.mixed=OrgChart.mixed=1,OrgChart.layout.tree=OrgChart.tree=2,OrgChart.layout.treeLeftOffset=OrgChart.treeLeftOffset=3,OrgChart.layout.treeRightOffset=OrgChart.treeRightOffset=4,OrgChart.layout.treeLeft=5,OrgChart.layout.treeRight=6,OrgChart.layout.grid=-1,OrgChart.nodeOpenTag="",OrgChart.linkOpenTag="',OrgChart.expcollOpenTag="',OrgChart.upOpenTag="',OrgChart.linkFieldsOpenTag='',OrgChart.grCloseTag="",OrgChart.A5w=420,OrgChart.A5h=595,OrgChart.A4w=595,OrgChart.A4h=842,OrgChart.A3w=842,OrgChart.A3h=1191,OrgChart.A2w=1191,OrgChart.A2h=1684,OrgChart.A1w=1684,OrgChart.A1h=2384,OrgChart.Letterw=612,OrgChart.Letterh=791,OrgChart.Legalw=612,OrgChart.Legalh=1009,OrgChart.COLLAPSE_PARENT_NEIGHBORS=1,OrgChart.COLLAPSE_SUB_CHILDRENS=2,OrgChart.COLLAPSE_PARENT_SUB_CHILDREN_EXCEPT_CLICKED=3,OrgChart.TEXT_THRESHOLD=400,OrgChart.IMAGES_THRESHOLD=100,OrgChart.LINKS_THRESHOLD=200,OrgChart.BUTTONS_THRESHOLD=70,OrgChart.ANIM_THRESHOLD=50,OrgChart.IT_IS_LONELY_HERE='{link}',OrgChart.RES={},OrgChart.RES.IT_IS_LONELY_HERE_LINK="It's lonely here, add your first node",OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE=3,OrgChart.STRING_TAGS=!1,OrgChart.MAX_NODES_MESS="The trial has expired or 200 nodes limit was reached!
See more",OrgChart.OFFLINE_MESS="The evaluation version requires internet connection!
See more",OrgChart.SEARCH_PLACEHOLDER="Search... type ? to get help.",OrgChart.SEARCH_HELP_SYMBOL="?",OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE=!1,OrgChart.SEARCH_RESULT_LIMIT=10,OrgChart.IMPORT_MESSAGE="Choose the columns (fields) in your data file that contain the required information.",OrgChart.FIXED_POSITION_ON_CLICK=!1,OrgChart.RENDER_LINKS_BEFORE_NODES=!1,OrgChart.RENDER_CLINKS_BEFORE_NODES=!1,OrgChart.MIXED_LAYOUT_ALL_NODES=!0,OrgChart.MIXED_LAYOUT_FOR_NODES_WITH_COLLAPSED_CHILDREN=!1,OrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN=1,OrgChart.LINK_ROUNDED_CORNERS=5,OrgChart.MOVE_STEP=5,OrgChart.CLINK_CURVE=1,OrgChart.MAX_DEPTH=200,OrgChart.SCALE_FACTOR=1.44,OrgChart.LAZY_LOADING_FACTOR=500,OrgChart.HIDE_EDIT_FORM_ON_PAN=!0,OrgChart.LAZY_LOADING=!0,OrgChart.ARRAY_FIELDS=["tags"],OrgChart.CSV_DELIMITER=",",OrgChart.EDITFORM_CLOSE_BTN='',OrgChart.ESCAPE_HTML=!1,OrgChart.VERTICAL_CHILDREN_ASSISTANT=!1,OrgChart.EXPORT_PAGES_CUT_NODES=!1,OrgChart.RESET_MOVABLE_ONEXPANDCOLLAPSE=!1,"undefined"!=typeof module&&(module.exports=OrgChart),OrgChart._intersects=function(t,e,r){var i=t.x-r.siblingSeparation/4,a=t.y,n=t.x+t.w+r.siblingSeparation/4,o=t.y;switch(r.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:i=t.x,a=t.y-r.siblingSeparation/4,n=t.x,o=t.y+t.h+r.siblingSeparation/4}var l,s,h,d=e.p,c=e.q,g=e.r,p=e.s;return 0!==(l=(n-i)*(p-c)-(g-d)*(o-a))&&(s=((a-o)*(g-i)+(n-i)*(p-a))/l,0<(h=((p-c)*(g-i)+(d-g)*(p-a))/l)&&h<1&&0`},OrgChart.editUI.prototype.content=function(t,e,r,i,a){var n,o=this.obj.config.editForm.readOnly,l=JSON.parse(JSON.stringify(this.obj.config.editForm.elements)),s=this.obj.config.editForm.addMore,h=this.obj.config.editForm.saveAndCloseBtn,d=this.obj.config.editForm.cancelBtn,c=this.obj.config.editForm.buttons,g=this.obj.config.editForm.titleBinding,p=this.obj.config.editForm.photoBinding,u=this.obj.getNode(t),f=this.obj._get(t),m=OrgChart.t(u.templateName,u.min,this.obj.getScale()),C=f[g],b=f[p];if(this.obj.config.editForm.generateElementsFromFields)for(var O=0;O`;var w=!e,k=e?"display:none;":"",S=e||!s?"display:none;":"",I=m.editFormHeaderColor?`style="background-color:${m.editFormHeaderColor};"`:"",A=document.createElement("form");if(A.setAttribute("data-boc-edit-form",""),A.classList.add("boc-edit-form"),A.classList.add(this.obj.config.mode),A.classList.add(u.templateName),A.classList.add(OrgChart.ui._defsIds[u.templateName]),Array.isArray(u.tags)&&u.tags.length)for(O=0;O\n
\n ${N}\n ${OrgChart.editUI.renderHeaderContent(C,b,u,f)}\n
\n
\n ${function(){if(a)return"";var t="";for(var r in c){var i=c[r];OrgChart.isNEU(i)||(w&&i.hideIfEditMode||e&&i.hideIfDetailsMode||o&&"Edit"==i.text||(t+=`
${i.icon}
`))}return t}()} \n
\n \n
\n
\n
\n ${function(){for(var t="",r=0;r';for(var a=0;a"}else{s=OrgChart.elements[i.type](f,i,"280px",e);!OrgChart.isNEU(s.id)&&OrgChart.isNEU(n)&&OrgChart.isNEU(s.value)&&(n=s.id),OrgChart.isNEU(s.value)||L.push(`${i.label}: ${s.value}`),t+=s.html}}return t}()}\n\n
\n ${s}\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
`,{element:A,focusId:n,title:C,shareText:L.join("\n")}},OrgChart.editUI.prototype.hide=function(){if(!1===OrgChart.events.publish("hide",[this]))return!1;OrgChart.isNEU(this.interval)&&(clearInterval(this.interval),this.interval=null);var t=this.obj.element.querySelector("[data-boc-edit-form]");t&&t.parentNode&&t.parentNode.removeChild(t)},OrgChart.editUI.renderHeaderContent=function(t,e,r,i){return`

${OrgChart._escapeGreaterLessSign(t)}

\n
${e}
`},OrgChart.prototype.getSvg=function(){var t=this.element.getElementsByTagName("svg");return t&&t.length?t[0]:null},OrgChart.prototype.getPointerElement=function(){return this.element.querySelector("g[data-pointer]")},OrgChart.prototype.getNodeElement=function(t){return this.element.querySelector("["+OrgChart.attr.node_id+"='"+t+"']")},OrgChart.prototype.getMenuButton=function(){return this.element.querySelector("["+OrgChart.attr.control_export_menu+"]")},OrgChart.menuUI=function(){},OrgChart.menuUI.prototype.init=function(t,e){this.obj=t,this.wrapper=null,this.menu=e,this._event_id=OrgChart._guid()},OrgChart.menuUI.prototype.showStickIn=function(t,e,r,i){this._show(t,null,e,r,i)},OrgChart.menuUI.prototype.show=function(t,e,r,i,a){this._show(t,e,r,i,a)},OrgChart.menuUI.prototype._show=function(t,e,r,i,a){var n=this;this.hide();var o="";a||(a=this.menu);var l={firstNodeId:r,secondNodeId:i,menu:a};if(!1===OrgChart.events.publish("show",[this,l]))return!1;for(var s in a=l.menu){var h=a[s].icon,d=a[s].text;void 0===h&&(h=OrgChart.icon[s]?OrgChart.icon[s](24,24,"#7A7A7A"):""),"function"==typeof d&&(d=d()),"function"==typeof h&&(h=h()),o+="
'+h+"  "+d+"
"}if(""!=o){if(this.wrapper=document.createElement("div"),this.wrapper.className="boc-chart-menu",this.wrapper.style.left="-99999px",this.wrapper.style.top="-99999px",this.wrapper.innerHTML=o,this.obj.element.appendChild(this.wrapper),null==e){var c=OrgChart._menuPosition(t,this.wrapper,this.obj.getSvg());t=c.x,e=c.y}var g=t+45;this.wrapper.style.left=g+"px",this.wrapper.style.top=e+"px",this.wrapper.style.left=g-this.wrapper.offsetWidth+"px";var p=t-this.wrapper.offsetWidth;OrgChart.animate(this.wrapper,{opacity:0,left:g-this.wrapper.offsetWidth},{opacity:1,left:p},300,OrgChart.anim.inOutPow);for(var u=this.wrapper.getElementsByTagName("div"),f=0;f=0;t--)clearInterval(this._buttonsInterval[t]),this._buttonsInterval.splice(t,1);this._buttonsInterval=[];for(t=this._linesInterval.length-1;t>=0;t--)clearInterval(this._linesInterval[t]),this._linesInterval.splice(t,1);this._linesInterval=[];var e=this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_wrraper_id+"]");if(null!=e){var r=e.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id),i=this.obj.getNode(r),a=OrgChart.t(i.templateName,i.min,this.obj.getScale()),n=this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_id+'="'+r+'"]').querySelectorAll("line");n[0].setAttribute("x1",-a.nodeCircleMenuButton.radius/2),n[0].setAttribute("x2",a.nodeCircleMenuButton.radius/2),n[0].setAttribute("y1",-6),n[0].setAttribute("y2",-6),n[1].setAttribute("x1",-a.nodeCircleMenuButton.radius/2),n[1].setAttribute("x2",a.nodeCircleMenuButton.radius/2),n[1].setAttribute("y1",0),n[1].setAttribute("y2",0),n[2].setAttribute("x1",-a.nodeCircleMenuButton.radius/2),n[2].setAttribute("x2",a.nodeCircleMenuButton.radius/2),n[2].setAttribute("y1",6),n[2].setAttribute("y2",6),e.parentElement.removeChild(e),e=null}},OrgChart.circleMenuUI.prototype.on=function(t,e){return OrgChart.events.on(t,e,this._event_id),this},void 0===OrgChart&&(OrgChart={}),OrgChart.idb={version:1,dbName:"BALKAN",tableName:"orgchart-js",keyPath:"id"},OrgChart.idb.db=null,OrgChart.idb._open=function(t){if(OrgChart._browser().msie)t&&t(!1);else if((navigator.userAgent.toLowerCase().indexOf("safari")>0||navigator.userAgent.toLowerCase().indexOf("firefox")>0)&&window.location!==window.parent.location)t&&t(!1);else{if(!window.indexedDB)return console.error("Your browser doesn't support a stable version of IndexedDB."),void(t&&t(!1));if(null==OrgChart.idb.db){var e=indexedDB.open(OrgChart.idb.dbName,OrgChart.idb.version);e.onerror=function(e){console.error("Cannot open database!"),t&&t(!1)},e.onsuccess=function(e){OrgChart.idb.db=e.target.result,t&&t(!0)},e.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(OrgChart.idb.tableName)&&e.deleteObjectStore(OrgChart.idb.tableName);e.createObjectStore(OrgChart.idb.tableName,{keyPath:OrgChart.idb.keyPath})}}else t&&t(!0)}},OrgChart.idb.read=function(t,e){OrgChart.idb._open((function(r){if(r){var i=OrgChart.idb.db.transaction([OrgChart.idb.tableName]).objectStore(OrgChart.idb.tableName).get(t);i.onerror=function(t){console.error("Unable to retrieve data from database!"),e&&e(!1)},i.onsuccess=function(t){i.result?e&&e(!0,i.result):e&&e(null)}}else e&&e(!1)}))},OrgChart.idb.write=function(t,e){OrgChart.idb.read(t.id,(function(r){if(null==r){var i=OrgChart.idb.db.transaction([OrgChart.idb.tableName],"readwrite").objectStore(OrgChart.idb.tableName).add(t);i.onerror=function(t){console.error("Unable to add data to database!"),e&&e(!1)},i.onsuccess=function(t){e&&e(!0)}}else e&&e(r)}))},OrgChart.idb.put=function(t,e){OrgChart.idb._open((function(r){if(r){var i=OrgChart.idb.db.transaction([OrgChart.idb.tableName],"readwrite").objectStore(OrgChart.idb.tableName).put(t);i.onerror=function(t){console.error("Unable to put data to database!"),e&&e(!1)},i.onsuccess=function(t){e&&e(!0)}}else e&&e(!1)}))},OrgChart.idb.delete=function(t,e){OrgChart.idb._open((function(r){if(r){var i=OrgChart.idb.db.transaction([OrgChart.idb.tableName],"readwrite").objectStore(OrgChart.idb.tableName).delete(t);i.onerror=function(t){console.error("Unable to retrieve data from database!"),e&&e(!1)},i.onsuccess=function(t){i.error?e&&e(!1):e&&e(!0)}}else e&&e(!1)}))},OrgChart.toolbarUI=function(){},OrgChart.toolbarUI.expandAllIcon='',OrgChart.toolbarUI.fitIcon='',OrgChart.toolbarUI.openFullScreenIcon='',OrgChart.toolbarUI.closeFullScreenIcon='',OrgChart.toolbarUI.zoomInIcon='',OrgChart.toolbarUI.zoomOutIcon='',OrgChart.toolbarUI.layoutIcon="',OrgChart.toolbarUI.prototype.init=function(t,e){if(e){this.obj=t,this.toolbar=e,this._visible=!1,this.div=document.createElement("div"),this.div.classList.add("boc-toolbar-container"),Object.assign(this.div.style,{position:"absolute",padding:"3px",right:this.obj.config.padding-10+"px",bottom:this.obj.config.padding-10+"px"}),e.expandAll&&(this.div.innerHTML+="
'+OrgChart.toolbarUI.expandAllIcon+"
"),e.fit&&(this.div.innerHTML+="
'+OrgChart.toolbarUI.fitIcon+"
"),e.zoom&&(this.div.innerHTML+="
'+OrgChart.toolbarUI.zoomInIcon+"
",this.div.innerHTML+="
'+OrgChart.toolbarUI.zoomOutIcon+"
"),e.layout&&(this.div.innerHTML+="
'+OrgChart.toolbarUI.layoutIcon+"
",this.layouts=document.createElement("div"),this.layouts.classList.add("boc-toolbar-layout"),this.layouts.innerHTML='\n \n \n \n \n ',this.obj.element.appendChild(this.layouts)),e.fullScreen&&(this.div.innerHTML+="
'+OrgChart.toolbarUI.openFullScreenIcon+"
"),this.obj.element.appendChild(this.div),this.layoutBtn=this.div.querySelector("["+OrgChart.attr.tlbr+'="layout"]');var r=this.div.querySelector("["+OrgChart.attr.tlbr+'="plus"]'),i=this.div.querySelector("["+OrgChart.attr.tlbr+'="minus"]'),a=this.div.querySelector("["+OrgChart.attr.tlbr+'="fit"]'),n=this.div.querySelector("["+OrgChart.attr.tlbr+'="fullScreen"]'),o=this.div.querySelector("["+OrgChart.attr.tlbr+'="expand"]'),l=this;r&&r.addEventListener("click",(function(){l.obj.zoom(!0,null,!0)})),i&&i.addEventListener("click",(function(){l.obj.zoom(!1,null,!0)})),a&&a.addEventListener("click",(function(){l.obj.fit()})),n&&n.addEventListener("click",(function(){l.obj.toggleFullScreen()})),o&&o.addEventListener("click",(function(){l.obj.expand(null,"all")})),this.layoutBtn&&this.layoutBtn.addEventListener("click",(function(){l._visible?l.hideLayout():l.showLayout()})),this.layouts&&this.layouts.addEventListener("click",(function(t){for(var e=t.target;e;){if(e.hasAttribute&&e.hasAttribute(OrgChart.attr.layout)){e=e.getAttribute(OrgChart.attr.layout),l.obj.setLayout(OrgChart.layout[e]);break}e=e.parentNode}}))}},OrgChart.toolbarUI.prototype.showLayout=function(){this._visible=!0,this.layoutBtn.style.transform="rotate(180deg) translateX(0px) translateY(0px)",OrgChart.animate(this.div,{bottom:this.obj.config.padding-10},{bottom:this.obj.config.padding+135},this.obj.config.anim.duration,this.obj.config.anim.func),OrgChart.animate(this.layouts,{bottom:-145},{bottom:0},this.obj.config.anim.duration,this.obj.config.anim.func)},OrgChart.toolbarUI.prototype.hideLayout=function(){this._visible=!1,this.layoutBtn.style.transform="rotate(0deg) translateX(0px) translateY(0px)",OrgChart.animate(this.div,{bottom:this.obj.config.padding+135},{bottom:this.obj.config.padding-10},this.obj.config.anim.duration,this.obj.config.anim.func),OrgChart.animate(this.layouts,{bottom:0},{bottom:-145},this.obj.config.anim.duration,this.obj.config.anim.func)},OrgChart.notifierUI=function(){},OrgChart.notifierUI.prototype.init=function(t){this.obj=t},OrgChart.notifierUI.prototype.show=function(t,e){if(null==t)return!1;1==t&&(t=OrgChart.MAX_NODES_MESS,e="#FFCA28"),2==t&&(t=OrgChart.OFFLINE_MESS,e="#FFCA28");var r=document.createElement("div");r.innerHTML=t,Object.assign(r.style,{position:"absolute","background-color":e,color:"#ffffff",padding:"15px","border-radius":"40px",opacity:0,overflow:"hidden","white-space":"nowrap","text-align":"center"}),this.obj.element.appendChild(r);var i=this.obj.width()/2-r.offsetWidth/2,a=this.obj.height()/2-r.offsetHeight/2;r.style.left=i+"px",r.style.top=a+"px";var n=r.offsetWidth;return r.style.width="20px",OrgChart.animate(r,{opacity:0,width:10},{opacity:1,width:n},this.obj.config.anim.duration,this.obj.config.anim.func),!0},void 0===OrgChart&&(OrgChart={}),OrgChart.icon={},OrgChart.icon.png=function(t,e,r){return''},OrgChart.icon.pdf=function(t,e,r){return''},OrgChart.icon.svg=function(t,e,r){return''},OrgChart.icon.csv=function(t,e,r){return''},OrgChart.icon.json=function(t,e,r){return''},OrgChart.icon.excel=function(t,e,r){return''},OrgChart.icon.edit=function(t,e,r){return''},OrgChart.icon.details=function(t,e,r){return''},OrgChart.icon.remove=function(t,e,r){return''},OrgChart.icon.add=function(t,e,r){return''},OrgChart.icon.search=function(t,e,r){return''},OrgChart.icon.xml=function(t,e,r){return''},OrgChart.icon.link=function(t,e,r){return''},OrgChart.icon.happy=function(t,e,r){return''},OrgChart.icon.sad=function(t,e,r){return''},OrgChart.icon.share=function(t,e,r,i,a){return null==i&&(i=0),null==a&&(a=0),`\n \n `},OrgChart.icon.user=function(t,e,r,i,a){return OrgChart.isNEU(i)&&(i=0),OrgChart.isNEU(a)&&(a=0),`\n \n \n `},OrgChart.icon.close=function(t,e,r,i,a){return null==i&&(i=0),null==a&&(a=0),`\n \n `},OrgChart.icon.undo=function(t,e,r,i,a){return null==i&&(i=0),null==a&&(a=0),`\n \n \n `},OrgChart.icon.redo=function(t,e,r,i,a){return null==i&&(i=0),null==a&&(a=0),`\n \n \n `},OrgChart.prototype.exportPDFProfile=function(t,e){t=this._defaultExportProfileOptions(t,"pdf"),this._exportProfile(t,e)},OrgChart.prototype.exportPDFPreview=function(t){OrgChart.pdfPrevUI.show(this,t)},OrgChart.prototype.exportPNGProfile=function(t,e){t=this._defaultExportProfileOptions(t,"png"),this._exportProfile(t,e)},OrgChart.prototype.shareProfile=function(t){var e;"object"==typeof t?t=(e=t).focusId:e=this.editUI.content(t,!0,!0,"100%",!0);var r=new URL(window.location.href);r.searchParams.append("nodeId",t);var i={title:e.title,text:e.shareText,url:r.href};try{navigator.share(i)}catch(t){console.error("error: "+t)}},OrgChart.prototype.exportPDF=function(t,e){t=this._defaultExportOptions(t,"pdf"),this._export(t,e)},OrgChart.prototype.exportPNG=function(t,e){t=this._defaultExportOptions(t,"png"),this._export(t,e)},OrgChart.prototype.exportSVG=function(t,e){t=this._defaultExportOptions(t,"svg"),this._export(t,e)},OrgChart.prototype._defaultExportOptions=function(t,e){return null==t&&(t={}),"svg"==e?(t.ext="svg",t.mime="image/svg+xml"):"pdf"==e?(t.mime="application/pdf",t.ext="pdf"):"png"==e&&(t.mime="image/png",t.ext="png"),null==t.margin&&(t.margin=[50,40,50,40]),null==t.padding&&(t.padding=0),null==t.landscape&&(t.landscape=!1),null==t.filename&&(t.filename="OrgChart."+t.ext),null==t.scale&&(t.scale="fit"),null==t.format&&(t.format="fit"),null==t.header&&(t.header=""),"pdf"==e&&null==t.footer?t.footer="Page {current-page} of {total-pages}":null==t.footer&&(t.footer=""),null==t.openInNewTab&&(t.openInNewTab=!1),null==t.mode&&(t.mode="boc-"+this.config.mode),t},OrgChart.prototype._export=function(t,e){var r=this,i={id:t.nodeId,expandChildren:t.expandChildren,min:t.min};t.margin&&t.margin[0]<2&&(t.margin[0]=2),t.margin&&t.margin[1]<2&&(t.margin[1]=2),t.margin&&t.margin[2]<2&&(t.margin[2]=2),t.margin&&t.margin[3]<2&&(t.margin[3]=2),this._draw(!1,OrgChart.action.exporting,i,(function(i,a){var n=document.createElement("div");if(n.innerHTML=i,t.padding>0){var o=n.querySelector("svg"),l=OrgChart._getViewBox(o);l[0]-=t.padding,l[1]-=t.padding,l[2]+=2*t.padding,l[3]+=2*t.padding,o.setAttribute("viewBox",l.join()),o.setAttribute("width",l[2]),o.setAttribute("height",l[3])}if("svg"==t.ext)if(e)e(t,n.innerHTML);else{(o=n.querySelector("svg")).classList.add("boc-"+r.config.mode);var s={content:n.innerHTML,options:t,styles:""},h=OrgChart.events.publish("exportstart",[r,s]),d=r.element.querySelector("[data-boc-styles]");if(d&&(s.styles+=d.outerHTML),s.styles&&(n.childNodes[0].insertAdjacentHTML("afterbegin",s.styles),s.content=n.innerHTML),!1===h)return!1;if(!1===(h=OrgChart.events.publish("exportend",[r,s])))return!1;OrgChart._downloadFile(t.mime,s.content,s.options.filename,s.options.openInNewTab,s.options.ext)}else r._pages(t,n.querySelector("svg"),a,(function(i){var a={content:n.innerHTML,options:t,pages:i,styles:""},o=OrgChart.events.publish("exportstart",[r,a]),l=r.element.querySelector("[data-boc-styles]");if(l&&(a.styles+=l.outerHTML),!1===o)return!1;e||OrgChart.loading.show(r),e?e(r,a,n.querySelector("svg")):(a=JSON.stringify(a),OrgChart._ajax(r.config.exportUrl+"/v3","POST",a,"arraybuffer",(function(e){var i=OrgChart.events.publish("exportend",[r,e]);if(OrgChart.loading.hide(r),!1===i)return!1;OrgChart._downloadFile(t.mime,e,t.filename,t.openInNewTab,t.ext)})))}))}))},OrgChart.prototype.exportCSV=function(t){var e=OrgChart._defaultExportProfileOptionsForCSV_SVG_JSON(t,"csv"),r=this.getNode(e.nodeId),i=null;r?(i=[],OrgChart._exportIterateForJSON_XML_CSV(this,r,e,i)):!1===e.min||!1===e.expandChildren?OrgChart._exportIterateForJSON_XML_CSV(this,this.roots,e,i):i=JSON.parse(JSON.stringify(this.config.nodes));var a={ext:"csv",filename:t,options:e,nodes:i};if(!1===OrgChart.events.publish("exportstart",[this,a]))return!1;var n=OrgChart._json2csv(a.nodes),o={ext:a.ext,filename:a.filename,options:e,nodes:a.nodes,content:n};if(!1===OrgChart.events.publish("exportend",[this,o]))return!1;OrgChart._downloadFile("text/csv;charset=utf-8;","\ufeff"+o.content,o.options.filename,o.options.openInNewTab,o.ext)},OrgChart.prototype.exportXML=function(t){var e=OrgChart._defaultExportProfileOptionsForCSV_SVG_JSON(t,"xml"),r=this.getNode(e.nodeId),i=null;r?(i=[],OrgChart._exportIterateForJSON_XML_CSV(this,r,e,i)):!1===e.min||!1===e.expandChildren?OrgChart._exportIterateForJSON_XML_CSV(this,this.roots,e,i):i=JSON.parse(JSON.stringify(this.config.nodes));var a={ext:"xml",filename:t,options:e,nodes:i};if(!1===OrgChart.events.publish("exportstart",[this,a]))return!1;var n=OrgChart._json2xml(a.nodes),o={ext:a.ext,filename:a.filename,options:e,nodes:a.nodes,content:n};if(!1===OrgChart.events.publish("exportend",[this,o]))return!1;OrgChart._downloadFile("application/xml",o.content,o.options.filename,o.options.openInNewTab,o.ext)},OrgChart.prototype.exportJSON=function(t){var e=OrgChart._defaultExportProfileOptionsForCSV_SVG_JSON(t,"json"),r=this.getNode(e.nodeId),i=null;r?(i=[],OrgChart._exportIterateForJSON_XML_CSV(this,r,e,i)):!1===e.min||!1===e.expandChildren?OrgChart._exportIterateForJSON_XML_CSV(this,this.roots,e,i):i=JSON.parse(JSON.stringify(this.config.nodes));var a={ext:"json",filename:e.filename,options:e,nodes:i};if(!1===OrgChart.events.publish("exportstart",[this,a]))return!1;var n={ext:a.ext,filename:a.filename,options:e,nodes:a.nodes,content:JSON.stringify(a.nodes)};if(!1===OrgChart.events.publish("exportend",[this,n]))return!1;OrgChart._downloadFile("application/json",n.content,n.options.filename,n.options.openInNewTab,n.ext)},OrgChart._exportIterateForJSON_XML_CSV=function(t,e,r,i){if(Array.isArray(e))for(var a=0;ac.h){b=!1;break}var k=(v[_].minY-v[w].minY)/(100/r);if(_==y-1&&(k=(v[_].maxY-v[w].minY)/(100/r)),k>c.h)break;_++}if(!b)break;var S=(_==y?v[_-1].maxY:v[_-1].minY)-v[w].minY;if(0==S){b=!1;break}if(I=(I=[f,v[w].minY,p,S]).join(),C.push({vb:I,innerSize:{w:c.x,h:S/(100/r)-1},size:g}),_==y)break;_--}C.length&&(C[C.length-1].innerSize.h+=1)}if(!b||OrgChart.EXPORT_PAGES_CUT_NODES||"fit"!=t.scale)for(e.setAttribute("preserveAspectRatio","xMinYMin slice"),C=[];f0)for(var n=t[e].length-1;n>=0;n--)(!OrgChart.isNEU(i)&&!OrgChart.isNEU(r)&&t[e][n].event_id==i&&t[e][n].listener==r||!OrgChart.isNEU(i)&&OrgChart.isNEU(r)&&t[e][n].event_id==i||OrgChart.isNEU(i)&&!OrgChart.isNEU(r)&&t[e][n].listener==r||OrgChart.isNEU(i)&&OrgChart.isNEU(r))&&(t[e].splice(n,1),a=!0);return a},has:function(e,r){if(t[e]&&Array.isArray(t[e])&&t[e].length>0){if(OrgChart.isNEU(r))return!0;for(var i=0;i=0;i--)t[r][i].event_id==e&&t[r].splice(i,1)},publish:function(e,r){if(t[e]){for(var i=[],a=0;a0){var o=!0;for(a=0;a0?this.substring(0,t)+e+this.substr(t):e+this}),Array.prototype.unique||Object.defineProperty(Array.prototype,"unique",{value:function(){for(var t=this.concat(),e=0;ei[0]/10)return;if(o>i[1]/10)return}}else if(-1!=e.type.indexOf("touch")&&null==this._touch)return;for(var l=e.target;l!=t;){if(l.hasAttribute(OrgChart.attr.control_expcoll_id)){var s=l.getAttribute(OrgChart.attr.control_expcoll_id),h=this.getNode(s);return void this._expCollHandler(h.id)}if(l.hasAttribute(OrgChart.attr.node_id)){s=l.getAttribute(OrgChart.attr.node_id),h=this.getNode(s);return void this._nodeClickHandler(h.id,e)}if(l.hasAttribute(OrgChart.attr.control_node_menu_id)){e.stopPropagation(),e.preventDefault();s=l.getAttribute(OrgChart.attr.control_node_menu_id),h=this.getNode(s);return void this._nodeMenuClickHandler(h.id,l,e)}if(l.hasAttribute(OrgChart.attr.control_node_circle_menu_id)){e.stopPropagation(),e.preventDefault();s=l.getAttribute(OrgChart.attr.control_node_circle_menu_id);return void this._nodeCircleMenuClickHandler(s)}if(l.hasAttribute(OrgChart.attr.control_node_circle_menu_name))return e.stopPropagation(),e.preventDefault(),void this._nodeCircleMenuItemClickHandler(l,e);if(l.hasAttribute(OrgChart.attr.control_add))return void this._lonelyButtonHandler();if(l.hasAttribute(OrgChart.attr.control_up_id)){s=l.getAttribute(OrgChart.attr.control_up_id);return e.stopPropagation(),e.preventDefault(),void this._upHandler(s)}if(l.hasAttribute(OrgChart.attr.c_link_from))return void OrgChart.events.publish("clink-click",[this,{from:l.getAttribute(OrgChart.attr.c_link_from),to:l.getAttribute(OrgChart.attr.c_link_to),event:e}]);if(l.hasAttribute(OrgChart.attr.s_link_from))return void OrgChart.events.publish("slink-click",[this,{from:l.getAttribute(OrgChart.attr.s_link_from),to:l.getAttribute(OrgChart.attr.s_link_to),event:e}]);l=l.parentNode}},OrgChart.prototype._globalContextHandler=function(t,e){for(var r=e.target;r!=t;){if(r.hasAttribute(OrgChart.attr.node_id)){var i=r.getAttribute(OrgChart.attr.node_id),a=this.getNode(i);return void this._nodeContextHandler(a.id,e)}r=r.parentNode}},OrgChart.prototype._nodeContextHandler=function(t,e){e.preventDefault(),OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE&&this.searchUI.hide(),this.nodeMenuUI.hide(),this.nodeContextMenuUI.hide(),this.menuUI.hide(),this.nodeCircleMenuUI.hide();var r=this.get(t),i=null;if(null!=r&&Array.isArray(r.tags))for(var a=0;a0?e++:e--,l+=e,r.zoom(1-e/12/50,s),parseInt(l)==parseInt(o)?i=!1:h(t)}()},OrgChart.prototype._nodeCircleNodeMenuItemMouseDownHandler=function(t,e,r){var i=t.parentNode.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id),a=t.getAttribute(OrgChart.attr.control_node_circle_menu_name),n=this.nodeCircleMenuUI._menu[a];if(n.draggable){var o=this,l=OrgChart._getClientXY(e),s=this.getNode(i);t._dragEventFired=!1;var h=o.getScale(),d=null,c=null;this._gragStartedId=i,document.body.style.mozUserSelect=document.body.style.webkitUserSelect=document.body.style.userSelect="none";var g=this.getSvg(),p={x:l.x,y:l.y},u=t.cloneNode(!0);g.insertBefore(u,g.firstChild);var f=OrgChart._getTransform(u),m=f[4],C=f[5],b=function(t){for(;t&&!t.hasAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id);)t=t.parentNode;if(t){var e=OrgChart._getTransform(t);return{x:e[4],y:e[5]}}console.error("cannot find parent"+OrgChart.attr.control_node_circle_menu_wrraper_id)}(t);u.setAttribute("transform","matrix(1,0,0,1,"+(m+b.x)+","+(C+b.y)+")"),u.style.opacity=.7;var O=function(t,e){if(null!=t){e.classList.remove("boc-drag-over");for(var r=OrgChart.getStParentNodes(o.getNode(d)),i=0;iOrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE||Math.abs(r.y-p.y)>OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE))!1===OrgChart.events.publish("drag",[o.nodeCircleMenuUI,{from:I,menuItem:n,menuItemName:a}])&&y(),t._dragEventFired=!0;u.setAttribute("transform","matrix("+f.toString()+")")}}},y=function(e){if(o.moveEnd(),g.classList&&(g.classList.remove("boc-cursor-grab"),g.classList.remove("boc-cursor-move"),g.classList.remove("boc-cursor-nodrop"),g.classList.remove("boc-cursor-copy")),g.removeEventListener(r.move,v),g.removeEventListener(r.up,y),r.leave&&g.removeEventListener(r.leave,y),s.id==d||null==d)return g.removeChild(u),o._gragStartedId=null,void(t._dragEventFired&&OrgChart.events.publish("drop",[o.nodeCircleMenuUI,{from:s.id,menuItemName:a,menuItem:n,event:e}]));var i=o.getNode(d);OrgChart.events.publish("drop",[o.nodeCircleMenuUI,{from:s.id,to:i.id,menuItem:n,menuItemName:a,event:e}]),O(d,c),g.removeChild(u),o._gragStartedId=null};g.addEventListener(r.move,v),g.addEventListener(r.up,y),r.leave&&g.addEventListener(r.leave,y)}},OrgChart.prototype._nodeMouseDownHandler=function(t,e,r){var i=t.getAttribute(OrgChart.attr.node_id),a=this.getNode(i);this.config.movable&&!OrgChart.getRootOf(a).stParent?this._movableHandler(t,e,r):this.config.enableDragDrop&&this._dragDropHandler(t,e,r)},OrgChart.prototype._movableHandler=function(t,e,r){var i=this,a=t.getAttribute(OrgChart.attr.node_id),n=[],o=function(t,e){if(Array.isArray(t))for(var r=0;rOrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE||Math.abs(r.y-I.y)>OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE)){if(!1===OrgChart.events.publish("drag",[i,a,e,n])&&E(),i.config.enableDragDrop)for(_=0;_OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE||Math.abs(r.y-d.y)>OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE))!1===OrgChart.events.publish("drag",[s,k,e])&&b(),t._dragEventFired=!0;f.setAttribute("transform","matrix("+c.toString()+")")}}},b=function(e){if(s.moveEnd(),h.classList&&(h.classList.remove("boc-cursor-grab"),h.classList.remove("boc-cursor-move"),h.classList.remove("boc-cursor-nodrop"),h.classList.remove("boc-cursor-copy")),h.removeEventListener(r.move,C),h.removeEventListener(r.up,b),r.leave&&h.removeEventListener(r.leave,b),n.id==o||null==o)return t._dragEventFired&&OrgChart.events.publish("drop",[s,n.id,void 0,f,e]),h.removeChild(f),void(s._gragStartedId=null);var i=s.getNode(o);if(!1===OrgChart.events.publish("drop",[s,n.id,i.id,f,e]))return m(o,l),h.removeChild(f),void(s._gragStartedId=null);if(s.canUpdateLink(n.id,o)){var a=s.get(n.id);a.pid=o,a.stpid=null,null!=a.movex&&(a.movex=void 0),null!=a.movey&&(a.movey=void 0),s.updateNode(a,null,!0)}else h.removeChild(f),m(o,l);s._gragStartedId=null};h.addEventListener(r.move,C),h.addEventListener(r.up,b),r.leave&&h.addEventListener(r.leave,b)},OrgChart.prototype._resizeHandler=function(t,e){if(this.isVisible){var r=this.getViewBox(),i=this.getSvg(),a=i.getAttribute("width"),n=i.getAttribute("height"),o=a/r[2],l=n/r[3],s=o>l?l:o;i.setAttribute("width",this.width()),i.setAttribute("height",this.height()),r[2]=this.width()/s,r[3]=this.height()/s,this.setViewBox(r),this.xScrollUI.create(this.width()),this.yScrollUI.create(this.height()),this._draw(!1,OrgChart.action.resize)}},OrgChart.prototype._nodeDbClickHandler=function(t,e){if(!1===OrgChart.events.publish("dbclick",[this,this.get(t)]))return!1;this._commonClickHandler(t,e,this.config.nodeMouseDbClick)},OrgChart.prototype._nodeClickHandler=function(t,e){var r=this.getNodeElement(t);if(r&&r._dragEventFired)r._dragEventFired=!1;else{if(!1===OrgChart.events.publish("click",[this,{node:this.getNode(t),event:e}]))return!1;this._commonClickHandler(t,e,this.config.nodeMouseClick)}},OrgChart.prototype._nodeCircleMenuItemClickHandler=function(t,e){var r=t.parentNode.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id),i=t.getAttribute(OrgChart.attr.control_node_circle_menu_name),a=this.nodeCircleMenuUI._menu[i];OrgChart.events.publish("click",[this.nodeCircleMenuUI,{nodeId:r,menuItemName:i,menuItem:a,event:e}])},OrgChart.prototype._nodeCircleMenuClickHandler=function(t){OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE&&this.searchUI.hide(),this.nodeMenuUI.hide(),this.nodeContextMenuUI.hide(),this.menuUI.hide();var e=this.getNode(t),r=null;if(Array.isArray(e.tags))for(var i=0;i1&&(s.type="pinch",s.dist=Math.sqrt((o.x-l.x)*(o.x-l.x)+(o.y-l.y)*(o.y-l.y))),"pan"==s.type&&(this._hideBeforeAnimation(),this._changeCursorOnPanStart(a,n,e));var h=function(t){var e=OrgChart._getClientTouchesXY(t,0);if(s&&"pan"==s.type){i._hideBeforeAnimation(),s.diffX=e.x-s.x0,s.diffY=e.y-s.y0;var r=-s.diffY/n+s.viewBoxTop,o=-s.diffX/n+s.viewBoxLeft;i._move(r,o,a)}else if(s&&"pinch"==s.type){var l=OrgChart._getClientTouchesXY(t,1),h=Math.sqrt((e.x-l.x)*(e.x-l.x)+(e.y-l.y)*(e.y-l.y)),d=1+(h-s.dist)/(s.dist/100)/100;s.dist=h;var c=OrgChart._pinchMiddlePointInPercent(i.element,i.width(),i.height(),t);i.zoom(d,c)}},d=function(){"pan"==s.type&&i.config.sticky?setTimeout((function(){OrgChart._moveToBoundaryArea(t,i.getViewBox(),i.response.boundary,(function(){i._draw(!0,OrgChart.action.pan)}))}),0):"pan"!=s.type||i.config.sticky||setTimeout((function(){i._draw(!0,OrgChart.action.pan)}),0),"pan"==s.type&&i._changeCursorOnPanEnd(),s=null,t.removeEventListener(r.move,h),t.removeEventListener(r.up,d),r.leave&&t.removeEventListener(r.leave,d),r.touchstart&&t.removeEventListener(r.touchstart,d)};this.config.enablePan&&(t.addEventListener(r.move,h),t.addEventListener(r.up,d),r.leave&&t.addEventListener(r.leave,d),r.touchstart&&t.addEventListener(r.touchstart,d))},OrgChart.prototype._changeCursorOnPanStart=function(t,e,r){var i=this.getPointerElement(),a=OrgChart._getOffsetXY(this.element,r),n=a.x/e+t[0]-16/e,o=a.y/e+t[1]-16/e;i.style.display="inherit",i.setAttribute("transform","matrix(0,0,0,0,"+n+","+o+")"),OrgChart.animate(i,{transform:[0,0,0,0,n,o],opacity:0},{transform:[1/e,0,0,1/e,n,o],opacity:1},300,OrgChart.anim.outBack)},OrgChart.prototype._changeCursorOnPanEnd=function(){this.getPointerElement().style.display="none"},OrgChart.searchUI=function(){this.lastSearch=[],this._searchAfterEnterPress=!1,this._event_id=OrgChart._guid(),this.instance=null},OrgChart.searchUI.prototype.init=function(t){this.instance=t,this.obj=this.instance,this._initSearchFields();var e=this,r=this.instance.config.padding-10,i=this.instance.config.padding-10,a=this.instance.getMenuButton();if(a){var n=a.getBoundingClientRect(),o=this.instance.getSvg().getBoundingClientRect();r=o.right-n.left+10,i=n.top-o.top-10}var l=document.createElement("div");l.classList.add("boc-search"),l.style.right=r+"px",l.style.top=i+"px";var s=OrgChart.elements.textbox({},{label:OrgChart.SEARCH_PLACEHOLDER,btn:"X"},"320px");l.innerHTML+=s.html,this.xBtn=l.querySelector("[data-input-btn]"),this.xBtn.style.display="none",this.searchTableWrapper=document.createElement("div"),l.appendChild(this.searchTableWrapper);var h=this.instance.getSvg().nextSibling;this.instance.element.insertBefore(l,h),OrgChart.input.init(l),this.input=document.getElementById(s.id),this.xBtn.addEventListener("click",(function(t){t.preventDefault(),e.hide()})),this.input.addEventListener("keypress",(function(t){"Enter"==t.key&&t.preventDefault()})),this.input.addEventListener("focus",(function(t){e.xBtn.style.display="",e._search()})),this.input.addEventListener("blur",(function(t){OrgChart.isNEU(e.input.value)&&OrgChart.SEARCH_HELP_SYMBOL!=e.input.value&&(e.xBtn.style.display="none")})),this.input.addEventListener("keydown",(function(t){("ArrowDown"==t.key||"ArrowUp"==t.key)&&t.preventDefault()})),this.input.addEventListener("keyup",(function(t){"ArrowDown"==t.key?d():"ArrowUp"==t.key?c():"Enter"==t.key?e._enterHandler():"Escape"==t.key?e.hide():e._search()}));var d=function(){var t=e.instance.element.querySelectorAll("[data-search-item-id]"),r=e.instance.element.querySelector('[data-selected="yes"]');null==r&&t.length>0?t[0].setAttribute("data-selected","yes"):t.length>0&&r.nextSibling&&r.nextSibling.setAttribute&&(r.removeAttribute("data-selected"),r.nextSibling.setAttribute("data-selected","yes"))},c=function(){var t=e.instance.element.querySelectorAll("[data-search-item-id]"),r=e.instance.element.querySelector('[data-selected="yes"]');null==r&&t.length>0?t[t.length-1].setAttribute("data-selected","yes"):t.length>0&&r.previousSibling&&r.previousSibling.setAttribute&&(r.removeAttribute("data-selected"),r.previousSibling.setAttribute("data-selected","yes"))}},OrgChart.searchUI.prototype._enterHandler=function(){var t=this.instance.element.querySelector('[data-selected="yes"]');if(t){if(t.hasAttribute("data-search-item-id")){var e=t.getAttribute("data-search-item-id");if(this.input.value!=OrgChart.SEARCH_HELP_SYMBOL){var r=OrgChart.events.publish("",[this.instance,e]),i=OrgChart.events.publish("searchclick",[this,{nodeId:e}]);!1===r&&(i=!1),0!=i&&this.instance.center(e)}else this.input.value=e+" ",this.searchTableWrapper.innerHTML=""}}else this._searchAfterEnterPress=!0,this.__search(),this.searchTableWrapper.innerHTML="",this.instance.draw()},OrgChart.searchUI.prototype._initSearchFields=function(){if(null==this.instance.config.searchFields){this._searchFields=[];for(var t=0;t\n \n ${function(){for(var t="",i=0;i=OrgChart.SEARCH_RESULT_LIMIT);i++){var a=e.lastSearch[i],n="";if(r){var o=e.instance._get(a.id);"function"==typeof r?n=r(e.instance,e.instance.getNode(a.id),o):o[r]&&(n=o[r])}var l="",s="";e.instance.config.searchDisplayField==a.__searchField?l=a.__searchMarks:e.instance.config.searchDisplayField?(l=a[e.instance.config.searchDisplayField],OrgChart.isNEU(l)&&(l=""),s=a.__searchMarks):l=a.__searchMarks;var h={img:n,nodeId:a.id,first:l,second:s,searchItem:a,html:OrgChart.searchUI.createItem(n,a.id,l,s)};OrgChart.events.publish("add-item",[e,h]),t+=h.html}return t}()} \n \n `}this.searchTableWrapper.innerHTML=t;for(var i=this.instance.element.querySelectorAll("[data-search-item-id]"),a=0;a${e}${this.searchFieldsAbbreviation[e]}`;return t+=""},OrgChart.searchUI.createItem=function(t,e,r,i){return r&&(r=""+r+""),`\n \n ${t=t?`
`:`
${OrgChart.icon.user(32,32,"#aeaeae")}
`}\n \n ${r}
${i}\n `},OrgChart.searchUI.prototype.hide=function(){if(!1===OrgChart.events.publish("hide",[this]))return!1;this._searchAfterEnterPress&&(this._searchAfterEnterPress=!1,this.instance.draw()),this.lastSearch=[],this.xBtn&&(this.xBtn.style.display="none"),this.searchTableWrapper&&(this.searchTableWrapper.innerHTML=""),this.input&&(this.input.value="",document.activeElement==this.input&&this.input.blur(),document.activeElement==this.xBtn&&OrgChart.input.blurHandler(this.input))},OrgChart.searchUI.prototype.on=function(t,e){return OrgChart.events.on(t,e,this._event_id),this},void 0===OrgChart&&(OrgChart={}),OrgChart.manager=function(t){this.config=t.config,this.layoutConfigs=t._layoutConfigs,this.visibleNodeIds=[],this.viewBox=null,this.action=null,this.actionParams=null,this.nodes={},this.oldNodes={},this.maxX=null,this.maxY=null,this.minX=null,this.minY=null,this.bordersByRootIdAndLevel=null,this.roots=null,this.state=null,this.vbIsInitializedFromState=!1,this.rootList=[],this.instance=t,this._fixAdjustForExport={x:0,y:0}},OrgChart.manager.prototype.read=function(t,e,r,i,a,n,o,l){var s=this;OrgChart.state._get(this.config.state,e,r,(function(h){s.state=h,s.action=a,s.actionParams=n,a!=OrgChart.action.init||!s.state||n&&n.method&&"fit"==n.method?(s.viewBox=i,s.vbIsInitializedFromState=!1):(s.viewBox=s.state.vb,s.vbIsInitializedFromState=!0,Array.isArray(s.state.roots)&&(s.config.roots=s.state.roots));var d=s.maxX,c=s.maxY,g=s.minX,p=s.minY,u=s.bordersByRootIdAndLevel,f=s.roots,m=s.nodes;if(t){var C=OrgChart.manager._getResponse(e,r,s.visibleNodeIds,s.config,d,c,g,p,s.viewBox,f,s.action,s.actionParams,m,s.oldNodes,s.vbIsInitializedFromState);a!=OrgChart.action.exporting&&(s.maxX=d,s.maxY=c,s.minX=g,s.minY=p,s.roots=f,s.nodes=m,s.visibleNodeIds=C.visibleNodeIds),C.bordersByRootIdAndLevel=u,C.roots=f,C.adjustify={x:0,y:0},s.state&&(C.adjustify=s.state.adjustify),o(C)}else s.oldNodes=m||null,s._read((function(t){d=t.maxX,c=t.maxY,g=t.minX,p=t.minY,u=t.bordersByRootIdAndLevel,f=t.roots,m=t.nodes;var i=OrgChart.manager._getResponse(e,r,s.visibleNodeIds,s.config,d,c,g,p,s.viewBox,f,s.action,s.actionParams,m,s.oldNodes,s.vbIsInitializedFromState);i.notif=t.limit,i.roots=f,i.bordersByRootIdAndLevel=u,i.adjustify=t.adjustify,a!=OrgChart.action.exporting&&(s.maxX=d,s.maxY=c,s.minX=g,s.minY=p,s.roots=f,s.nodes=m,s.visibleNodeIds=i.visibleNodeIds,s.bordersByRootIdAndLevel=u,s.rootList=t.rootList),o(i)}),l)}))},OrgChart.manager.prototype._read=function(t,e){var r=this,i=OrgChart.manager._createNodes(this.instance);e(i);var a=i.nodes,n=i.roots,o=OrgChart.remote;null==o&&(o=OrgChart.local),o._setPositions(n,r.layoutConfigs,(function(e){var o=OrgChart.manager._doNotChangePositionOfClickedNodeIfAny(n,a,r.action,r.actionParams,r.oldNodes,r.config.orientation);r.state&&r.action==OrgChart.action.init&&(o=r.state.adjustify),r.action==OrgChart.action.exporting?o=r._fixAdjustForExport:r._fixAdjustForExport=o;for(var l={minX:null,minY:null,maxX:null,maxY:null},s={},h=0;h=e.collapse.level-1&&-1==i.indexOf(t.id):a==OrgChart.action.centerNode||a==OrgChart.action.insert||a==OrgChart.action.expand||a==OrgChart.action.collapse?i.has(t.id)&&(t.collapsed=!1):a==OrgChart.action.update&&r&&r.changeRoots&&r.changeRoots.has(t.id)&&(t.collapsed=!1)},OrgChart.manager._initNode=function(t,e,r,i,a,n,o){var l=o.manager.config,s=o.manager.layoutConfigs,h=o.manager.action,d=o.manager.actionParams,c=o.manager.state,g=s[r||"base"];null==t.parent&&OrgChart.manager._setCollpasedProperty(t,g,d,a,h,i-1,c);for(var p=0;p0&&(t.subLevels=m),-1!=t.tags.indexOf("assistant")&&null!=t.parent&&(t.isAssistant=!0);var C=OrgChart.t(t.templateName,t.min);t.w=C&&C.size?C.size[0]:0,t.h=C&&C.size?C.size[1]:0,t.padding=C&&C.padding?C.padding:[0,0,0,0];var b={node:t};OrgChart.events.publish("node-initialized",[o,b]),OrgChart.events.publish("node-created",[t])},OrgChart.manager._iterate=function(t,e,r,i,a,n,o,l,s,h,d,c){var g=c.manager.layoutConfigs;if(OrgChart.manager._initNode(e,r,s,i,h,d,c),e.isAssistant&&(n[e.pid]||(n[e.pid]=[]),n[e.pid].push(e.id)),e.subLevels>0&&o.push(e.id),OrgChart.MIXED_LAYOUT_FOR_NODES_WITH_COLLAPSED_CHILDREN&&!e.isAssistant&&e.parent){if(e.parent&&e.parent.children.length&&e.parent.children[e.parent.children.length-1]==e){for(var p=[],u=0,f=0,m=0;m1&&p.length==e.parent.children.length-u-f||!OrgChart.MIXED_LAYOUT_ALL_NODES&&p.length>1)&&(l[e.pid]=p)}}else if(!e.isAssistant&&0==e.childrenIds.length&&e.parent&&!l[e.pid]){for(p=[],u=0,f=0,m=0;mOrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN&&p.length==e.parent.childrenIds.length-u-f||!OrgChart.MIXED_LAYOUT_ALL_NODES&&p.length>OrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN)&&(l[e.pid]=p)}e.stChildren.length&&(t.stContainerNodes||(t.stContainerNodes=[]),t.stContainerNodes.push(e));for(var b=0;b-1&&b.childrenIds.splice(ft,1);s.push(c)}}}e.roots=[];for(d=0;d=0;d--)s[d].collapsed&&s.splice(d,1);for(d=0;d=0;v--)if(N[L[v]])for(f=0;f-1&&(b.children.splice(ft,1),b.children.splice(ft,0,z)),z.children.push(C),z.parent=b,C.parent=z,l[z.id]=z}}for(var j in _){(b=l[j]).hasAssistants=!0;z=new OrgChart.node(b.id+"_split_assitant_0",b.id,["assistant"],"split");OrgChart.manager._initDinamicNode(z,b.lcn,!0),l[z.id]=z;var Y=[];for(v=b.children.length-1;v>=0;v--){(H=b.children[v]).isAssistant?(H.parent=null,b.children.splice(v,1),Y.splice(0,0,H.id)):H.isPartner||(H.parent&&k[H.parent.id]&&z&&H.parent.id!=z.id&&(Object.defineProperty(k,z.id,Object.getOwnPropertyDescriptor(k,H.parent.id)),delete k[H.parent.id]),H.parent=z,z.children.unshift(H),b.children.splice(v,1))}if(Y.length%2){var q=l[Y[Y.length-1]],$=new OrgChart.node(q.id+"_mirror",b.pid,[],"mirror");OrgChart.manager._initDinamicNode($,q.lcn,!0),$.isAssistant=!0,$.w=q.w,$.h=q.h,l[$.id]=$,Y.splice(Y.length-1,0,$.id)}var X=1;for(v=Y.length-1;v>=0;v--)if(v%2&&v!=Y.length-1){var V=new OrgChart.node(b.id+"_split_assitant_"+X,b.pid,[],"split");OrgChart.manager._initDinamicNode(V,b.lcn,!0),l[V.id]=V,Y.splice(v,0,V.id),X++}else v%2&&Y.splice(v,0,z.id);for(v=0;v0)),at[st]||(at[st]=[]),at[st].push(ht),lt&&(ot[st]=j,nt[st]||(nt[st]=[]),nt[st].push(ht))}}for(var j in k={},nt)if(nt[j].length>OrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN){var dt=ot[j];for(d=l[dt].children.length-1;d>=0;d--){H=l[dt].children[d];nt[j].has(H.id)&&l[dt].children.splice(d,1)}}for(var j in at)at[j].length>OrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN&&(k[j]=at[j])}}for(var j in k){for(var ct=b=l[j];ct.isSplit;)ct=l[ct.pid];for(;ct.isSubLevel;)ct=l[ct.pid];if(0!=(D=r[b.lcn?b.lcn:"base"]).layout||tt){et.pnode=b,et.layout=D.layout,et.layoutGridColumns=e.layoutGridColumns,et.childrenIds=k[j],et.lastChildrenPidIds=k,et.subLevels=0,et.layouts=[],OrgChart.events.publish("node-layout",[t,et]),OrgChart.events.publish("layout",[et]),et.layouts.length||et.layouts.push({layout:et.layout,childrenIds:et.childrenIds,subLevels:et.subLevels,layoutGridColumns:et.layoutGridColumns});for(var gt=0;gt2){"dynamic"==pt.layoutGridColumns&&(pt.layoutGridColumns=OrgChart._getDynamicGridCoulumns(pt.childrenIds.length));var mt=b.id;for(d=b.children.length-1;d>=0;d--)for(v=0;v2&&Ct--;for(d=0;d=pt.childrenIds.length;if(pt.childrenIds.length-1=0;d--){b=(H=l[vt[d]]).parent,H.layout=OrgChart.layout.mixed;for(v=b.children.length-1;v>=0;v--)if(H.id==b.children[v].id){b.children.splice(v,1);break}if(d>0){var yt=l[vt[d-1]];H.parent=yt,H.layout=OrgChart.layout.mixed,yt.children.push(H)}else b.children.push(H)}}else if(pt.layout>1){z=new OrgChart.node(gt+"_"+b.id+"_split_0",ct.id,[],"split");OrgChart.manager._initDinamicNode(z,b.lcn),l[z.id]=z,z.layout=pt.layout;var xt=[];for(d=pt.childrenIds.length-1;d>=0;d--){for(H=l[pt.childrenIds[d]],v=0;v2){var _t=new OrgChart.node(gt+"_"+H.id+"_mirror",ct.id,[],"mirror");OrgChart.manager._initDinamicNode(_t,H.lcn),_t.layout=pt.layout,l[_t.id]=_t,xt.splice(0,0,_t.id)}pt.layout!=OrgChart.layout.treeRightOffset&&pt.layout!=OrgChart.layout.treeRight&&xt.splice(0,0,H.id)}for(X=1,v=xt.length-1;v>=0;v--)if(v%2&&v!=xt.length-1){V=new OrgChart.node(gt+"_"+b.id+"_split_"+X,ct.id,[],"split");OrgChart.manager._initDinamicNode(V,b.lcn),V.layout=pt.layout,l[V.id]=V,xt.splice(v,0,V.id),X++}else v%2&&xt.splice(v,0,z.id);for(v=0;vo&&l>r;return d&&(d=i+n>s&&h>i),d}if(a(t,r))return!0;for(var n=0;ne.sl&&(e=r);for(var i=0;i=a-o)switch(w=(a+o)/2-x/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:w=(o-a)/2-x/2}else switch(w=f.x-x/2+OrgChart.manager._getNodeWidth(f,i)/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:(w=-(x/2-(o-a)/2))-i.padding&&(w=-i.padding)}if(_-2*i.padding>=n-l)switch(k=(n+l)/2-_/2,i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:k=(l-n)/2-_/2}else switch((k=-(_/2-(n-l)/2))>-i.padding&&(k=-i.padding),i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:(k=-(_/2-(l-n)/2))C.right?C.right:C.left),s[0]>C.right&&s[0]>C.left&&(s[0]=C.left>C.right?C.left:C.right),s[1]C.bottom?C.bottom:C.top),s[1]>C.bottom&&s[1]>C.top&&(s[1]=C.top>C.bottom?C.top:C.bottom))}if(d==OrgChart.action.centerNode||d==OrgChart.action.maximize){var S=g[c.id];1==c.options.horizontal&&(s[0]=S.x+S.w/2-s[2]/2),1==c.options.vertical&&(s[1]=S.y+S.h/2-s[3]/2),i.sticky&&(s[0]C.right?C.right:C.left),s[0]>C.right&&s[0]>C.left&&(s[0]=C.left>C.right?C.left:C.right),s[1]C.bottom?C.bottom:C.top),s[1]>C.bottom&&s[1]>C.top&&(s[1]=C.top>C.bottom?C.top:C.bottom))}if(d==OrgChart.action.insert||d==OrgChart.action.expand||d==OrgChart.action.collapse||d==OrgChart.action.update||d==OrgChart.action.centerNode){var I=null;if(d==OrgChart.action.insert&&c&&null!=c.insertedNodeId&&null!=c.insertedNodeId)I=g[c.insertedNodeId];else if(d==OrgChart.action.update&&c&&null!=c.visId&&null!=c.visId)I=g[c.visId];else if(d!=OrgChart.action.expand&&d!=OrgChart.action.collapse||!c||null==c.id||null==c.id){if(d==OrgChart.action.centerNode){switch(i.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:c.options.vertical||(I=g[c.id]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:c.options.horizontal||(I=g[c.id])}I&&(I=OrgChart.manager._getMostDeepChild(I,g))}}else I=g[c.id],I=OrgChart.manager._getMostDeepChild(I,g);if(!OrgChart.FIXED_POSITION_ON_CLICK&&I)switch(i.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:var A=I.y+I.h-s[3]+i.padding;s[1]A&&(s[1]=A);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:A=I.x-i.padding;s[0]>A&&(s[0]=A);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:A=I.x+I.w-s[2]+i.padding;s[0]0&&(h[r-1].children.push(d),d.parent=h[r-1]),e[d.id]=d,h.push(d)}if(h.length){for(var c=h[h.length-1],g=h[0],p=t.children.length-1;p>=0;p--){var u=t.children[p];c.children.unshift(u),u.parent=c,t.children.splice(p,1)}t.children.push(g),g.parent=t}}},OrgChart.manager._verticalAssistantLevelCountIterate=function(t,e,r){r.max',svg:'{content}',link:'',pointer:'',node:'',plus:'',minus:'',nodeMenuButton:'',menuButton:'



',img_0:'',link_field_0:'{val}',editFormHeaderColor:"#039BE5"},OrgChart.templates.ana={defs:"",size:[250,120],linkAdjuster:{fromX:0,fromY:0,toX:0,toY:0},ripple:{radius:0,color:"#e6e6e6",rect:null},expandCollapseSize:30,svg:'{content}',link:'',assistanseLink:'',pointer:'',node:'',plus:'',minus:'',up:'',nodeMenuButton:'',menuButton:OrgChart.templates.base.menuButton,img_0:'',link_field_0:'{val}',field_0:"{val}',field_1:"{val}',padding:[50,20,35,20],editFormHeaderColor:"#039BE5"},OrgChart.templates.split=Object.assign({},OrgChart.templates.ana),OrgChart.templates.split.size=[10,10],OrgChart.templates.split.node='',OrgChart.templates.split.field_0="",OrgChart.templates.split.field_1="",OrgChart.templates.split.img_0="",OrgChart.templates.dot=Object.assign({},OrgChart.templates.split),OrgChart.templates.group=Object.assign({},OrgChart.templates.ana),OrgChart.templates.group.size=[250,120],OrgChart.templates.group.node='',OrgChart.templates.group.link='',OrgChart.templates.group.nodeMenuButton='',OrgChart.templates.group.field_0="{val}',OrgChart.templates.group.field_1="",OrgChart.templates.group.ripple={radius:50,color:"#aeaeae"},OrgChart.templates.invisibleGroup=Object.assign({},OrgChart.templates.group),OrgChart.templates.invisibleGroup.node="",OrgChart.templates.invisibleGroup.padding=[0,0,0,0],OrgChart.templates.invisibleGroup.field_0="",OrgChart.templates.invisibleGroup.nodeMenuButton="",OrgChart.templates.mirror={linkAdjuster:{},link:"",node:"",nodeMenuButton:"",size:[0,0]},OrgChart.templates.ula=Object.assign({},OrgChart.templates.ana),OrgChart.templates.ula.field_0="{val}',OrgChart.templates.ula.field_1="{val}',OrgChart.templates.ula.node='',OrgChart.templates.ula.img_0='',OrgChart.templates.ula.menu='',OrgChart.templates.ula.nodeMenuButton='',OrgChart.templates.olivia=Object.assign({},OrgChart.templates.ana),OrgChart.templates.olivia.defs='\n \'',OrgChart.templates.olivia.field_0="{val}',OrgChart.templates.olivia.field_1="{val}',OrgChart.templates.olivia.node='',OrgChart.templates.olivia.img_0='',OrgChart.templates.olivia.nodeMenuButton='',OrgChart.templates.belinda=Object.assign({},OrgChart.templates.ana),OrgChart.templates.belinda.size=[180,180],OrgChart.templates.belinda.ripple={radius:90,color:"#e6e6e6",rect:null},OrgChart.templates.belinda.node='',OrgChart.templates.belinda.img_0='',OrgChart.templates.belinda.field_0="{val}',OrgChart.templates.belinda.field_1="{val}',OrgChart.templates.belinda.link='',OrgChart.templates.belinda.nodeMenuButton='',OrgChart.templates.rony=Object.assign({},OrgChart.templates.ana),OrgChart.templates.rony.svg='{content}',OrgChart.templates.rony.defs='',OrgChart.templates.rony.size=[180,250],OrgChart.templates.rony.ripple={color:"#F57C00",radius:5,rect:null},OrgChart.templates.rony.img_0='',OrgChart.templates.rony.node='',OrgChart.templates.rony.field_0="{val}',OrgChart.templates.rony.field_1="{val}',OrgChart.templates.rony.field_2="{val}',OrgChart.templates.rony.link='',OrgChart.templates.rony.plus='',OrgChart.templates.rony.minus='',OrgChart.templates.rony.nodeMenuButton='',OrgChart.templates.mery=Object.assign({},OrgChart.templates.ana),OrgChart.templates.mery.ripple={color:"#e6e6e6",radius:50,rect:null},OrgChart.templates.mery.node='',OrgChart.templates.mery.link='',OrgChart.templates.mery.img_0='',OrgChart.templates.mery.field_0="{val}',OrgChart.templates.mery.field_1="{val}',OrgChart.templates.mery.nodeMenuButton='',OrgChart.templates.polina=Object.assign({},OrgChart.templates.ana),OrgChart.templates.polina.size=[300,80],OrgChart.templates.polina.ripple={color:"#e6e6e6",radius:40,rect:null},OrgChart.templates.polina.node='',OrgChart.templates.polina.img_0='',OrgChart.templates.polina.field_0="{val}',OrgChart.templates.polina.field_1="{val}',OrgChart.templates.polina.link='',OrgChart.templates.polina.nodeMenuButton='',OrgChart.templates.mila=Object.assign({},OrgChart.templates.ana),OrgChart.templates.mila.node='',OrgChart.templates.mila.img_0='',OrgChart.templates.mila.field_0="{val}',OrgChart.templates.mila.nodeMenuButton='',OrgChart.templates.diva=Object.assign({},OrgChart.templates.ana),OrgChart.templates.diva.size=[200,170],OrgChart.templates.diva.node='',OrgChart.templates.diva.img_0='',OrgChart.templates.diva.field_0="{val}',OrgChart.templates.diva.field_1="{val}',OrgChart.templates.diva.pointer='',OrgChart.templates.diva.nodeMenuButton='',OrgChart.templates.luba=Object.assign({},OrgChart.templates.ana),OrgChart.templates.luba.svg='{content}',OrgChart.templates.luba.defs='',OrgChart.templates.luba.node='',OrgChart.templates.luba.img_0='',OrgChart.templates.luba.nodeMenuButton='',OrgChart.templates.luba.field_0="{val}',OrgChart.templates.luba.field_1="{val}',OrgChart.templates.luba.plus='',OrgChart.templates.luba.minus='',OrgChart.templates.luba.expandCollapseSize=36,OrgChart.templates.isla=Object.assign({},OrgChart.templates.ana),OrgChart.templates.isla.defs='',OrgChart.templates.isla.size=[180,120],OrgChart.templates.isla.node='',OrgChart.templates.isla.field_0="{val}',OrgChart.templates.isla.field_1="{val}',OrgChart.templates.isla.img_0='',OrgChart.templates.isla.minus='',OrgChart.templates.isla.plus='',OrgChart.templates.isla.nodeMenuButton='',OrgChart.templates.isla.ripple={radius:0,color:"#F57C00",rect:{x:0,y:20,width:180,height:100}},OrgChart.templates.deborah=Object.assign({},OrgChart.templates.polina),OrgChart.templates.deborah.size=[150,150],OrgChart.templates.deborah.node='',OrgChart.templates.deborah.img_0='',OrgChart.templates.deborah.field_0="{val}',OrgChart.templates.deborah.field_1="{val}',OrgChart.templates.deborah.nodeMenuButton='',OrgChart.templates.subLevel=Object.assign({},OrgChart.templates.base),OrgChart.templates.subLevel.size=[0,0],OrgChart.templates.subLevel.node="",OrgChart.templates.subLevel.plus="",OrgChart.templates.subLevel.minus="",OrgChart.templates.subLevel.nodeMenuButton="",OrgChart.templates.group_dotted_lines=Object.assign({},OrgChart.templates.group),OrgChart.templates.group_dotted_lines.size=[250,120],OrgChart.templates.group_dotted_lines.link='',OrgChart.templates.group_dotted_lines.node='',OrgChart.templates.group_dotted_lines.nodeGroupDottedCloseButton=''+OrgChart.icon.close(25,25,"#fff",-13,8)+"",OrgChart.templates.group_dotted_lines.field_0='Dotted Lines',OrgChart.templates.group_dotted_lines.field_1="",OrgChart.templates.group_dotted_lines.img_0="",OrgChart.templates.group_dotted_lines.ripple.radius=5,OrgChart.templates.group_dotted_lines.min=Object.assign({},OrgChart.templates.olivia),OrgChart.templates.group_dotted_lines.min.nodeGroupDottedOpenButton='{children-total-count}',OrgChart.ui={_defsIds:{},defs:function(t){var e="";for(var r in OrgChart.templates){var i=OrgChart.templates[r];i.defs&&(OrgChart.ui._defsIds[r]=OrgChart.randomId(),e+=i.defs.replaceAll("{randId}",OrgChart.ui._defsIds[r]))}return""+e+t+""},lonely:function(t){return t.nodes&&t.nodes.length?"":OrgChart.IT_IS_LONELY_HERE.replace("{link}",OrgChart.RES.IT_IS_LONELY_HERE_LINK)},pointer:function(t,e,r){return e===OrgChart.action.exporting?"":OrgChart.t(t.template,!1,r).pointer},node:function(t,e,r,i,a,n,o,l,s,h){var d=OrgChart.t(t.templateName,t.min,s),c=d.node.replaceAll("{w}",t.w).replaceAll("{h}",t.h);d.defs&&(c=c.replaceAll("{randId}",OrgChart.ui._defsIds[t.templateName])),null==o&&(o=i.nodeBinding);var g={node:t,data:e};for(var p in o){var u,f=o[p];e&&(u=e[f]);var m=OrgChart._lblIsImg(i,p);if(g.value=u,g.element=d[p],g.name=f,g.field=p,!1!==OrgChart.events.publish("field",[h,g])&&null!=g.value&&null!=g.value&&null!=g.element&&(!m||m&&!OrgChart.isNEU(g.value))){if(!m&&"string"==typeof g.value){var C=g.element;C&&(C=C.replaceAll("{ew}",t.w-(t.padding?t.padding[1]:0)).replaceAll("{cw}",t.w/2)),g.value=OrgChart.wrapText(g.value,C)}var b=g.element.replace("{val}",g.value);c+=b=b.replaceAll("{ew}",t.w-(t.padding?t.padding[1]:0)).replaceAll("{cw}",t.w/2).replaceAll("{randId}",OrgChart.randomId()).replaceAll("{randId2}",OrgChart.randomId())}}var O=OrgChart._getPosition(r,t,a,n),v="node";Array.isArray(t.tags)&&t.tags.length&&(v+=" "+t.tags.join(" ")),t.layout&&(v+=" tree-layout");var y="";t.lcn&&(y='lcn="'+t.lcn+'"');var x=OrgChart.nodeOpenTag.replace("{lcn}",y).replace("{id}",t.id).replace("{class}",v).replace("{sl}",t.sl).replace("{level}",t.level).replace("{x}",O.x).replace("{y}",O.y),_=OrgChart._getOpacity(r,t);return c=(x=x.replace("{opacity}",_))+(c+=OrgChart.ui.nodeBtns(i,t,l,d,h))+OrgChart.grCloseTag},nodeBtns:function(t,e,r,i,a){var n="";return null==t.nodeMenu||e.isSplit||r===OrgChart.action.exporting||(n+=i.nodeMenuButton.replace("{id}",e.id).replace("{cw}",e.w/2).replace("{ch}",e.h/2).replace("{ew}",e.w-(e.padding?e.padding[1]:0)).replace("{eh}",e.h-(e.padding?e.padding[2]:0))),null==t.nodeCircleMenu||e.isSplit||r===OrgChart.action.exporting||OrgChart.isNEU(i.nodeCircleMenuButton)||(n+=''),n},expandCollapseBtn:function(t,e,r,i,a){var n="";if(i!==OrgChart.action.exporting&&!e.isSplit){var o=r[e.lcn?e.lcn:"base"],l=0,s=0,h=OrgChart.t(e.templateName,e.min,a);if(e.childrenIds.length>0){if(e.hasPartners){for(var d=!1,c=0;c0&&(g=s.mixedHierarchyNodesSeparation/2);var p=0,u=OrgChart.getRootOf(t).id,f=i[u][t.sl],m=void 0;if(t.hasPartners){m={ids:[],indexes:{},ppnodes:{},lastLeft:null,firstRight:null,maxSidePartnersWithChildren:0,rightIds:[],leftIds:[],partnerChildrenSplitSeparation:e.config.partnerChildrenSplitSeparation};for(var C=0;C1)&&O.rightNeighbor&&O.rightNeighbor.isSplit)switch(s.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:y=OrgChart.ui._linkRightToLeft(O.rightNeighbor,O,h,g);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:y=OrgChart.ui._linkBottomToTop(O.rightNeighbor,O,h,g)}else if((k||O.layout>1)&&O.leftNeighbor&&O.leftNeighbor.isSplit)switch(s.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:y=OrgChart.ui._linkLeftToRight(O.leftNeighbor,O,h,g);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:y=OrgChart.ui._linkTopToBottom(O.leftNeighbor,O,h,g)}else switch(s.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:if(1==O.isPartner)y=OrgChart.ui._linkLeftToRight(t,O,h,p);else if(2==O.isPartner)y=OrgChart.ui._linkRightToLeft(t,O,h,p);else{_=1==O.layout?void 0:v.minY-(v.minY-f.maxY)/2;y=OrgChart.ui._linkTopToBottom(t,O,h,g,_)}break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:if(1==O.isPartner)y=OrgChart.ui._linkLeftToRight(t,O,h,p);else if(2==O.isPartner)y=OrgChart.ui._linkRightToLeft(t,O,h,p);else{_=1==O.layout?void 0:v.maxY-(v.maxY-f.minY)/2;y=OrgChart.ui._linkBottomToTop(t,O,h,g,_)}break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:if(1==O.isPartner)y=OrgChart.ui._linkTopToBottom(t,O,h,p);else if(2==O.isPartner)y=OrgChart.ui._linkBottomToTop(t,O,h,p);else{_=1==O.layout?void 0:v.maxX-(v.maxX-f.minX)/2;y=OrgChart.ui._linkRightToLeft(t,O,h,g,_)}break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:if(1==O.isPartner)y=OrgChart.ui._linkTopToBottom(t,O,h,p);else if(2==O.isPartner)y=OrgChart.ui._linkBottomToTop(t,O,h,p);else{_=1==O.layout?void 0:v.minX-(v.minX-f.maxX)/2;y=OrgChart.ui._linkLeftToRight(t,O,h,g,_)}}}var S=OrgChart.ui._draggableLinkPath(e,t,O,y,g,s.orientation);if(S)b=S,x=x.replaceAll("{rounded}",S).replaceAll("{edge}",S).replaceAll("{curve}",b);else if(-1!=x.indexOf("{rounded}"))if(y.xa==y.xb&&y.xa==y.xc&&y.xa==y.xd||y.ya==y.yb&&y.ya==y.yc&&y.ya==y.yd)b="M"+y.xa+","+y.ya+" L"+y.xd+","+y.yd,x=x.replaceAll("{rounded}",b);else if(Math.abs(y.xa-y.xd)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(y.xa-y.xc)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(y.xa-y.xb)<=OrgChart.LINK_ROUNDED_CORNERS)b="M"+y.xa+","+y.ya+" L"+y.xa+","+y.yd,x=x.replaceAll("{rounded}",b);else if(Math.abs(y.ya-y.yd)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(y.ya-y.yc)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(y.ya-y.yb)<=OrgChart.LINK_ROUNDED_CORNERS)b="M"+y.xa+","+y.ya+" L"+y.xd+","+y.ya,x=x.replaceAll("{rounded}",b);else{var I=OrgChart.ui._roundedEdge(y.xa,y.ya,y.xb,y.yb,y.xc,y.yc),A=OrgChart.ui._roundedEdge(y.xb,y.yb,y.xc,y.yc,y.xd,y.yd);b="M"+I.x1+","+I.y1+" "+I.x2+","+I.y2+" Q"+I.qx1+","+I.qy1+" "+I.qx2+","+I.qy2+" L"+A.x2+","+A.y2+" Q"+A.qx1+","+A.qy1+" "+A.qx2+","+A.qy2+" L"+A.x3+","+A.y3,x=x.replaceAll("{rounded}",b)}else-1!=x.indexOf("{edge}")?(b="M"+y.xa+","+y.ya+" "+y.xb+","+y.yb+" "+y.xc+","+y.yc+" L"+y.xd+","+y.yd,x=x.replaceAll("{edge}",b)):-1!=x.indexOf("{curve}")?(b="M"+y.xa+","+y.ya+" C"+y.xb+","+y.yb+" "+y.xc+","+y.yc+" "+y.xd+","+y.yd,x=x.replaceAll("{curve}",b)):(b=x.replaceAll("{xa}",y.xa).replaceAll("{ya}",y.ya).replaceAll("{xb}",y.xb).replaceAll("{yb}",y.yb).replaceAll("{xc}",y.xc).replaceAll("{yc}",y.yc).replaceAll("{xd}",y.xd).replaceAll("{yd}",y.yd),x=b);d.push(OrgChart.linkOpenTag.replaceAll("{id}",t.id).replaceAll("{class}","link "+O.tags.join(" ")).replaceAll("{child-id}",O.id));var L={node:t,cnode:O,p:y,html:x,action:n};OrgChart.events.publish("render-link",[e,L]),d.push(L.html),o&&c.push({id:t.id,childId:O.id,html:L.html});var N="";for(var E in e.config.linkBinding){var M=e.config.linkBinding[E],T=e._get(O.id);if(T){var B=T[M];L.value=B,L.element=h[E],L.name=M,!1!==OrgChart.events.publish("label",[e,L])&&(OrgChart.isNEU(L.value)||OrgChart.isNEU(L.element)||(N+=L.element.replace("{val}",L.value)))}}if(""!=N){var U=y.x,R=y.y;null!=O.movey&&(R+=O.movey),N=OrgChart.linkFieldsOpenTag.replace("{x}",U).replace("{y}",R).replace("{rotate}",0)+N+OrgChart.grCloseTag,d.push(N)}d.push(OrgChart.grCloseTag)}return o?c:d.join("")},svg:function(t,e,r,i,a,n){return OrgChart.t(i.template,!1,n).svg.replace("{w}",t).replace("{h}",e).replace("{viewBox}",r).replace("{randId}",OrgChart.ui._defsIds[i.template]).replace("{mode}",i.mode).replace("{template}",i.template).replace("{content}",(function(){return a}))},menuButton:function(t){return null==t.menu?"":OrgChart.t(t.template,!1).menuButton.replaceAll("{p}",t.padding)},_roundedEdge:function(t,e,r,i,a,n){var o,l,s,h=OrgChart.LINK_ROUNDED_CORNERS,d=0;return t==r&&t==a||e==i&&e==n?(o=s=r,l=d=i):(t!=a&&r==a&&(o=s=r,l=i,en&&(d=i-h)),ta&&r==a&&(r+=h),e!=n&&i==n&&(o=r,l=d=i,ta&&(s=r-h)),en&&i==n&&(i+=h)),{x1:t,y1:e,x2:r,y2:i,x3:a,y3:n,qx1:o,qy1:l,qx2:s,qy2:d}},_linkTopToBottom:function(t,e,r,i,a){var n,o,l,s,h,d=0;return n=t.x+t.w/2+r.linkAdjuster.toX,o=t.y+t.h+r.linkAdjuster.toY,s=l=e.x+e.w/2+r.linkAdjuster.fromX,h=e.y+r.linkAdjuster.fromY,{xa:n,ya:o,xb:n,yb:d=t.rightNeighbor&&t.rightNeighbor.isAssistant&&"split"==e.templateName?t.rightNeighbor.y+t.rightNeighbor.h+i:"split"==t.templateName&&(e.isAssistant||e.layout>1)?h:"split"==e.templateName?o+i:null!=a?a:h-i,xc:l,yc:d,xd:s,yd:h,x:l,y:OrgChart.isNEU(e.parentPartner)?d+16:d,rotate:0}},_linkBottomToTop:function(t,e,r,i,a){var n,o,l,s,h,d=0;return n=t.x+t.w/2+r.linkAdjuster.toX,o=t.y+r.linkAdjuster.toY,s=l=e.x+e.w/2+r.linkAdjuster.fromX,h=e.y+e.h+r.linkAdjuster.fromY,{xa:n,ya:o,xb:n,yb:d=t.rightNeighbor&&t.rightNeighbor.isAssistant&&"split"==e.templateName?t.rightNeighbor.y-i:"split"==t.templateName&&(e.isAssistant||e.layout>1)?h:"split"==e.templateName?o-i:null!=a?a:h+i,xc:l,yc:d,xd:s,yd:h,x:l,y:d-14,rotate:0}},_linkRightToLeft:function(t,e,r,i,a){var n,o,l,s,h,d,c=0;return n=t.x+r.linkAdjuster.toX,o=t.y+t.h/2+r.linkAdjuster.toY,h=e.x+e.w+r.linkAdjuster.fromX,d=s=e.y+e.h/2+r.linkAdjuster.fromY,l=o,90,{xa:n,ya:o,xb:c=t.rightNeighbor&&t.rightNeighbor.isAssistant&&"split"==e.templateName?t.rightNeighbor.x-i:"split"==t.templateName&&(e.isAssistant||e.layout>1)?h:"split"==e.templateName?n-i:null!=a?a:h+i,yb:l,xc:c,yc:s,xd:h,yd:d,x:c-16,y:s,rotate:90}},_linkLeftToRight:function(t,e,r,i,a){var n,o,l,s,h,d,c=0;return n=t.x+t.w+r.linkAdjuster.toX,o=t.y+t.h/2+r.linkAdjuster.toY,h=e.x+r.linkAdjuster.fromX,d=s=e.y+e.h/2+r.linkAdjuster.fromY,l=o,270,{xa:n,ya:o,xb:c=t.rightNeighbor&&t.rightNeighbor.isAssistant&&"split"==e.templateName?t.rightNeighbor.x+t.rightNeighbor.w+i:"split"==t.templateName&&(e.isAssistant||e.layout>1)?h:"split"==e.templateName?n+i:null!=a?a:h-i,yb:l,xc:c,yc:s,xd:h,yd:d,x:c+14,y:s,rotate:270}},_linkPpTop:function(t,e,r,i,a,n){var o=t.ppnodes[r.id],l=o.y+o.h/2,s=i.minY-(i.minY-a.maxY)/2,h=(i.minY-a.maxY)/t.maxSidePartnersWithChildren/4,d=OrgChart.ui.__linkPpBottomTop(t,e,r,s,h,o),c=d.x;return s=d.mid,OrgChart.ui._linkTopToBottom({x:c,y:l,w:0,h:0},r,n,0,s)},_linkPpBottom:function(t,e,r,i,a,n){var o=t.ppnodes[r.id],l=o.y+o.h/2,s=i.maxY-(i.maxY-a.minY)/2,h=(i.maxY-a.minY)/t.maxSidePartnersWithChildren/4,d=OrgChart.ui.__linkPpBottomTop(t,e,r,s,h,o),c=d.x;return s=d.mid,OrgChart.ui._linkBottomToTop({x:c,y:l,w:0,h:0},r,n,0,s)},_linkPpLeft:function(t,e,r,i,a,n){var o=t.ppnodes[r.id],l=i.minX-(i.minX-a.maxX)/2,s=(i.minX-a.maxX)/t.maxSidePartnersWithChildren/4,h=o.x+o.w/2,d=OrgChart.ui.__linkPpLeftRight(t,e,r,l,s,o),c=d.y;return l=d.mid,OrgChart.ui._linkLeftToRight({x:h,y:c,w:0,h:0},r,n,0,l)},_linkPpRight:function(t,e,r,i,a,n){var o=t.ppnodes[r.id],l=i.maxX-(i.maxX-a.minX)/2,s=(i.maxX-a.minX)/t.maxSidePartnersWithChildren/4,h=o.x+o.w/2,d=OrgChart.ui.__linkPpLeftRight(t,e,r,l,s,o),c=d.y;return l=d.mid,OrgChart.ui._linkRightToLeft({x:h,y:c,w:0,h:0},r,n,0,l)},__linkPpBottomTop:function(t,e,r,i,a,n){var o=0;return 1==n.isPartner?(o=n.x-e.partnerSeparation/2+t.indexes[r.id]*t.partnerChildrenSplitSeparation-(t.rightIds.length-1)*t.partnerChildrenSplitSeparation/2,t.lastLeft&&ot.firstRight.x+t.firstRight.w/2?ot.firstRight.y+t.firstRight.h/2?oi.yd)return null;s=i.xai.xd)return null;h=i.yai.yb)l=!0,s=i.xai.yd)return null;s=i.xai.xd)return null;h=i.yai.xb)l=!0,h=i.yai.yd){var s=i.xai.xd){h=i.ya(d=r/t[3])?d:h}else s=i;else s=r/l;else s=e/o;else s=(h=e/o)>(d=r/l)?d:h;return s&&s>a&&(s=a),s&&sr.right?r.right:r.left),e[0]>r.right&&e[0]>r.left&&(a[0]=r.left>r.right?r.left:r.right),e[1]r.bottom?r.bottom:r.top),e[1]>r.bottom&&e[1]>r.top&&(a[1]=r.top>r.bottom?r.top:r.bottom),e[0]!==a[0]||e[1]!==a[1]?OrgChart.animate(t,{viewBox:e},{viewBox:a},300,OrgChart.anim.outPow,(function(){i&&i()})):i&&i()},OrgChart.randomId=function(){return"_"+("0000"+(Math.random()*Math.pow(36,4)|0).toString(36)).slice(-4)},OrgChart._getClientXY=function(t){return-1==t.type.indexOf("touch")?{x:t.clientX,y:t.clientY}:t.changedTouches.length?{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY}:void 0},OrgChart._getClientTouchesXY=function(t,e){return-1!=t.type.indexOf("touch")?t.touches.length=0,e="undefined"!=typeof InstallTrigger,r=/constructor/i.test(window.HTMLElement)||"[object SafariRemoteNotification]"===(!window.safari||void 0!==window.safari&&safari.pushNotification).toString(),i=!!document.documentMode,a=!i&&!!window.StyleMedia,n=!(!window.chrome||!window.chrome.webstore&&!window.chrome.runtime);return{opera:t,firefox:e,safari:r,msie:i,edge:a,chrome:n,blink:(n||t)&&!!window.CSS}},OrgChart._menuPosition=function(t,e,r){var i=t.getBoundingClientRect(),a=r.getBoundingClientRect(),n=e.getBoundingClientRect(),o=i.left-a.left,l=i.top-a.top;return i.top+n.height>a.top+a.height&&(l-=n.height),i.left-n.width1===t.nodeType))},OrgChart._getTestDiv=function(){var t=document.getElementById("orgchart_js_test_div");return t||((t=document.createElement("div")).id="orgchart_js_test_div",t.style.position="fixed",t.style.top="-10000px",t.style.left="-10000px",document.body.appendChild(t)),t},OrgChart._getLabelSize=function(t){var e=OrgChart._getTestDiv();return e.innerHTML=""+t+"",e.querySelector("text").getBoundingClientRect()},OrgChart.wrapText=function(t,e){var r=e.toLowerCase();if(-1==r.indexOf(""+e+"";var a,n,o=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("text")[0],l=parseFloat(o.getAttribute("x")),s=parseFloat(o.getAttribute("y")),h=o.getAttribute("text-anchor"),d=o.getAttribute(OrgChart.attr.width),c=o.getAttribute(OrgChart.attr.text_overflow),g="http://www.w3.org/2000/svg",p=i.getElementsByTagName("svg")[0].getElementsByTagName("text")[0];c||(c="ellipsis");var u=c.split("-");if(u.length>1&&(a=parseInt(c.split("-")[1]),u.length>2&&"ellipsis"==u[2]&&(n=!0)),!d)return OrgChart._escapeHtml(t);if(d=parseFloat(d),l||(l=0),s||(s=0),l||(h="start"),"ellipsis"==c){p.removeChild(p.firstChild),p.textContent=t;for(var f=p.getComputedTextLength(),m=2;f>d;)p.textContent=t.substring(0,t.length-m),p.textContent+="...",f=p.getComputedTextLength(),m++;return m>2?`${OrgChart._escapeHtml(t)}${p.textContent}`:OrgChart._escapeHtml(t)}if(-1!=c.indexOf("multiline")){var C=t.split(" "),b=p.getBBox().height;p.textContent="";var O=document.createElementNS(g,"tspan"),v=document.createTextNode(C[0]);O.setAttributeNS(null,"x",l),O.setAttributeNS(null,"y",s),O.setAttributeNS(null,"text-anchor",h),O.appendChild(v),p.appendChild(O);m=1;for(var y=1,x=!1,_=1;_d){if(O.firstChild.data=O.firstChild.data.slice(0,w),y++,a&&y>a){if(n&&p.children.length==a){var k=p.children[a-1].textContent;p.children[a-1].textContent=k.substring(0,k.length-3)+"...",x=!0}break}(O=document.createElementNS(g,"tspan")).setAttributeNS(null,"x",l),O.setAttributeNS(null,"y",s+b*m),O.setAttributeNS(null,"text-anchor",h),v=document.createTextNode(C[_]),O.appendChild(v),p.appendChild(O),m++}}var S="";if(null!=p.innerHTML)S=p.innerHTML,p.innerHTML="";else{var I="";for(_=p.childNodes.length-1;_>=0;_--)I=XMLSerializer().serializeToString(p.childNodes[_])+I,p.removeChild(p.childNodes[_]);S=I}return x?`${OrgChart._escapeHtml(t)}${S}`:S}},OrgChart._downloadFile=function(t,e,r,i,a){var n=new Blob([e],{type:t});if(1==i){var o=URL.createObjectURL(n);window.open(o,"_blank").focus()}else if(navigator.msSaveBlob)navigator.msSaveBlob(n,r);else{var l=document.createElement("a");if(void 0!==l.download){o=URL.createObjectURL(n);l.setAttribute("href",o);var s=r;s.toLowerCase().endsWith(a.toLowerCase())||(s=s+"."+a),l.setAttribute("download",s),l.style.visibility="hidden",document.body.appendChild(l),l.click(),document.body.removeChild(l)}}},OrgChart._getPosition=function(t,e,r,i){var a={x:e.x,y:e.y};if(null!=r&&(a.x=r),null!=i&&(a.y=r),t&&3==t.length){var n=t[0].indexOf(e.id);-1!=n&&null!=t[1][n].transform&&(null==r&&(a.x=t[1][n].transform[4]),null==i&&(a.y=t[1][n].transform[5]))}return a},OrgChart._getOpacity=function(t,e){var r=1;if(t&&3==t.length){var i=t[0].indexOf(e.id);-1!=i&&null!=t[1][i].opacity&&(r=t[1][i].opacity)}return r},OrgChart.t=function(t,e,r){var i=OrgChart.templates[t];null==i&&console.error(`Template "${t}" does not exist!`);var a=null;if(null!=r&&i.scaleLessThen){var n=[];for(var o in i.scaleLessThen){var l=parseFloat(o);r0){n.sort((function(t,e){return t-e}));var s=i.scaleLessThen[n[0]];for(var h in s)null==a&&(a=Object.assign({},i)),a[h]=s[h]}}return e?null==a?i.min?i.min:i:a.min?a.min:a:null==a?i:a},OrgChart.setNodeSize=function(t){var e=OrgChart.t(t.templateName,t.min);t.w=e&&e.size?e.size[0]:0,t.h=e&&e.size?e.size[1]:0},OrgChart._imgs2base64=function(t,e,r,i){var a=t.getElementsByTagName(e),n=a.length;0==n&&i();for(var o=0;o'+(new XMLSerializer).serializeToString(e.documentElement)},OrgChart._xml2json=function(t){for(var e=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("node"),r=[],i=0;i=0&&(n='"'+n+'"'),i>0&&(r+=OrgChart.CSV_DELIMITER),r+=n}return r+"\n"},i="",a=0;ae.maxX)&&(e.maxX=t.x+t.w),(null==e.maxY||null!=t.y&&t.y+t.h>e.maxY)&&(e.maxY=t.y+t.h)},OrgChart.getStParentNodes=function(t,e){for(e||(e=[]);t.parent;)t=t.parent;return t.stParent&&(e.push(t.stParent),OrgChart.getStParentNodes(t.stParent,e)),e},OrgChart.getRootOf=function(t){for(;t&&t.parent;)t=t.parent;return t},OrgChart._getViewBox=function(t){var e=null;return t?(e=(e="["+(e=t.getAttribute("viewBox"))+"]").replace(/\ /g,","),e=JSON.parse(e)):null},OrgChart.isNEU=function(t){return null==t||""===t},OrgChart.gradientCircleForDefs=function(t,e,r,i){function a(t,e,r,i){var a=(i-90)*Math.PI/180;return{x:t+r*Math.cos(a),y:e+r*Math.sin(a)}}function n(t,e,r,i,n){var o=a(t,e,r,n),l=a(t,e,r,i),s=n-i<=180?"0":"1";return["M",o.x,o.y,"A",r,r,0,s,0,l.x,l.y].join(" ")}return Array.isArray(e)||(e=[e,e,e,e,e,e]),`\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 \n \n \n \n `},OrgChart._intersectionObserver=function(t,e){"function"==typeof IntersectionObserver?new IntersectionObserver((function(t,r){t.forEach((function(t){var r=t.intersectionRatio>0;0==t.intersectionRatio&&(r=t.isIntersecting),e(r)}))})).observe(t):e(!0)},OrgChart.convertCsvToNodes=function(t){for(var e=OrgChart._csvToArray(t),r=e[0],i=[],a=1;a/g,">").replace(/"/g,""").replace(/'/g,"'"):t},OrgChart._escapeDoubleQuotes=function(t){return"string"==typeof t?t.replace(/"/g,"""):t},OrgChart._escapeGreaterLessSign=function(t){return"string"==typeof t?t.replace(//g,">"):t},OrgChart.roundPathCorners=function(t,e,r){function i(t,e,r){var i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);return a(t,e,Math.min(1,r/o))}function a(t,e,r){return{x:t.x+(e.x-t.x)*r,y:t.y+(e.y-t.y)*r}}function n(t,e){t.length>2&&(t[t.length-2]=e.x,t[t.length-1]=e.y)}function o(t){return{x:parseFloat(t[t.length-2]),y:parseFloat(t[t.length-1])}}Array.isArray(t)||(t=(t=t.split(/[,\s]/).reduce((function(t,e){var r=e.match("([a-zA-Z])(.+)");return r?(t.push(r[1]),t.push(r[2])):t.push(e),t}),[])).reduce((function(t,e){return parseFloat(e)==e&&t.length?t[t.length-1].push(e):t.push([e]),t}),[]));var l=[];if(t.length>1){var s=o(t[0]),h=null;"Z"==t[t.length-1][0]&&t[0].length>2&&(h=["L",s.x,s.y],t[t.length-1]=h),l.push(t[0]);for(var d=1;d2&&"L"==g[0]&&p.length>2&&"L"==p[0]){var u,f,m=o(c),C=o(g),b=o(p);r?(u=a(C,c.origPoint||m,e),f=a(C,p.origPoint||b,e)):(u=i(C,m,e),f=i(C,b,e)),n(g,u),g.origPoint=C,l.push(g);var O=a(u,C,.5),v=a(C,f,.5),y=["C",O.x,O.y,v.x,v.y,f.x,f.y];y.origPoint=C,l.push(y)}else l.push(g)}if(h){var x=o(l[l.length-1]);l.push(["Z"]),n(l[0],x)}}else l=t;return l.reduce((function(t,e){return t+e.join(" ")+" "}),"")},OrgChart._isMoved=function(t){return null!=t.movex||null!=t.movey},OrgChart._getDynamicGridCoulumns=function(t){for(var e=1;e2&&e--,e},OrgChart.xScrollUI=function(t,e,r,i,a){this.element=t,this.requestParams=r,this.config=e,this.onSetViewBoxCallback=i,this.onDrawCallback=a,this.position=0,this.bar=null,this._event_id=OrgChart._guid()},OrgChart.xScrollUI.prototype.addListener=function(t){var e=this;if((this.config.mouseScrool==OrgChart.action.xScroll||this.config.mouseScrool==OrgChart.action.scroll)&&this.bar){var r=-1!==navigator.userAgent.indexOf("Mac OS"),i=OrgChart._getScrollSensitivity();!function(t,i,a){var n=!1;function o(){n=!0;var t=(e.position-e.bar.scrollLeft)/a;if(t>0)t++;else{if(0==t)return void(n=!1);t--}Math.ceil(e.bar.scrollLeft)==Math.ceil(e.position)?n=!1:(e.bar.scrollLeft+=t,l(o))}t.addEventListener("wheel",(function(t){if(t.ctrlKey)return;var a=0;if(e.config.mouseScrool==OrgChart.action.xScroll)(a=t.deltaX||t.wheelDeltaX)||(a=t.deltaY||t.wheelDeltaY);else if(e.config.mouseScrool==OrgChart.action.scroll&&!(a=r||!t.shiftKey?t.deltaX||t.wheelDeltaX:t.deltaY||t.wheelDeltaY))return;a=-a,a=Math.max(-1,Math.min(1,a)),e.position+=-a*i;var l=parseFloat(e.innerBar.clientWidth)-parseFloat(e.bar.clientWidth);e.position<0&&(e.position=0);e.position>l&&(e.position=l);n||o()}),{passive:!0});var l=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,20)}}(t,i.speed,i.smooth)}},OrgChart.xScrollUI.prototype.create=function(t){if(this.config.showXScroll===OrgChart.scroll.visible||this.config.mouseScrool===OrgChart.action.scroll||this.config.mouseScrool===OrgChart.action.xScroll){var e=this;this.bar&&this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),this.bar=document.createElement("div"),this.innerBar=document.createElement("div");this.requestParams();this.innerBar.innerHTML=" ",Object.assign(this.bar.style,{position:"absolute",left:0,bottom:0,width:t+"px","overflow-x":"scroll",height:"20px"}),this.element.appendChild(this.bar),this.bar.appendChild(this.innerBar),this.bar.addEventListener("scroll",(function(){if(this.ignore)this.ignore=!1;else{var t=e.requestParams(),r=(parseFloat(e.innerBar.clientWidth)-parseFloat(e.bar.clientWidth))/100,i=this.scrollLeft/r,a=(t.boundary.right-t.boundary.left)/100;t.viewBox[0]=i*a+t.boundary.left,e.onSetViewBoxCallback(t.viewBox),clearTimeout(this._timeout),this._timeout=setTimeout((function(){e.onDrawCallback()}),500)}}))}},OrgChart.xScrollUI.prototype.setPosition=function(){if(this.bar){var t=this.requestParams(),e=(Math.abs(t.boundary.maxX-t.boundary.minX)+2*this.config.padding)*t.scale;switch(this.config.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:e=Math.abs(t.boundary.minX*t.scale)}this.innerBar.style.width=e+"px";var r=(t.boundary.right-t.boundary.left)/100,i=(t.viewBox[0]-t.boundary.left)/r;i<0?i=0:i>100&&(i=100);var a=(parseFloat(this.innerBar.clientWidth)-parseFloat(this.bar.clientWidth))/100,n=i*a;this.bar.ignore=!0,this.bar.scrollLeft=n,this.position=this.bar.scrollLeft,this.bar.style.visibility=a<=0?"hidden":"",this.config.showXScroll!==OrgChart.scroll.visible&&(this.bar.style.visibility="hidden"),OrgChart.events.publish("change",[this,{isScrollBarVisible:"hidden"!=this.bar.style.visibility}])}},OrgChart.xScrollUI.prototype.on=function(t,e){return OrgChart.events.on(t,e,this._event_id),this},OrgChart.yScrollUI=function(t,e,r,i,a){this.element=t,this.requestParams=r,this.config=e,this.onSetViewBoxCallback=i,this.onDrawCallback=a,this.position=0,this.bar=null,this._event_id=OrgChart._guid()},OrgChart.yScrollUI.prototype.addListener=function(t){var e=this;if((this.config.mouseScrool==OrgChart.action.yScroll||this.config.mouseScrool==OrgChart.action.scroll)&&this.bar){var r=-1!==navigator.userAgent.indexOf("Mac OS"),i=OrgChart._getScrollSensitivity();!function(t,i,a){var n=!1;function o(){n=!0;var t=(e.position-e.bar.scrollTop)/a;if(t>0)t++;else{if(0==t)return void(n=!1);t--}Math.ceil(e.bar.scrollTop)==Math.ceil(e.position)?n=!1:(e.bar.scrollTop+=t,l(o))}t.addEventListener("wheel",(function(t){if(t.ctrlKey)return;var a=0;if(e.config.mouseScrool==OrgChart.action.yScroll)(a=t.deltaY||t.wheelDeltaY)||(a=t.deltaX||t.wheelDeltaX);else if(e.config.mouseScrool==OrgChart.action.scroll&&!(a=r||!t.shiftKey?t.deltaY||t.wheelDeltaY:t.deltaX||t.wheelDeltaX))return;a=-a,a=Math.max(-1,Math.min(1,a)),e.position+=-a*i;var l=parseFloat(e.innerBar.clientHeight)-parseFloat(e.bar.clientHeight);e.position<0&&(e.position=0);e.position>l&&(e.position=l);n||o()}),{passive:!0});var l=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,20)}}(t,i.speed,i.smooth)}},OrgChart.yScrollUI.prototype.create=function(t){if(this.config.showYScroll===OrgChart.scroll.visible||this.config.mouseScrool===OrgChart.action.scroll||this.config.mouseScrool===OrgChart.action.yScroll){var e=this;this.bar&&this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),this.bar=document.createElement("div"),this.innerBar=document.createElement("div"),this.innerBar.innerHTML=" ",Object.assign(this.bar.style,{position:"absolute",right:0,bottom:0,height:t+"px","overflow-y":"scroll",width:"20px"}),this.element.appendChild(this.bar),this.bar.appendChild(this.innerBar),this.bar.addEventListener("scroll",(function(){if(this.ignore)this.ignore=!1;else{var t=e.requestParams(),r=(parseFloat(e.innerBar.clientHeight)-parseFloat(e.bar.clientHeight))/100,i=this.scrollTop/r,a=(t.boundary.bottom-t.boundary.top)/100;t.viewBox[1]=i*a+t.boundary.top,e.onSetViewBoxCallback(t.viewBox),clearTimeout(this._timeout),this._timeout=setTimeout((function(){e.onDrawCallback()}),500)}}))}},OrgChart.yScrollUI.prototype.setPosition=function(){if(this.bar){var t=this.requestParams(),e=(Math.abs(t.boundary.maxY-t.boundary.minY)+2*this.config.padding)*t.scale;switch(this.config.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:e=Math.abs(t.boundary.minY*t.scale)}this.innerBar.style.height=e+"px";var r=(t.boundary.bottom-t.boundary.top)/100,i=(t.viewBox[1]-t.boundary.top)/Math.abs(r);i<0?i=0:i>100&&(i=100);var a=(parseFloat(this.innerBar.clientHeight)-parseFloat(this.bar.clientHeight))/100,n=i*a;this.bar.ignore=!0,this.bar.scrollTop=n,this.position=this.bar.scrollTop,this.bar.style.visibility=a<=0?"hidden":"",this.config.showYScroll!==OrgChart.scroll.visible&&(this.bar.style.visibility="hidden"),OrgChart.events.publish("change",[this,{isScrollBarVisible:"hidden"!=this.bar.style.visibility}])}},OrgChart.yScrollUI.prototype.on=function(t,e){return OrgChart.events.on(t,e,this._event_id),this},OrgChart.prototype.zoom=function(t,e,r,i){var a=this.getViewBox().slice(0),n=a,o=a[2],l=a[3];!0===t?(a[2]=a[2]/OrgChart.SCALE_FACTOR,a[3]=a[3]/OrgChart.SCALE_FACTOR):!1===t?(a[2]=a[2]*OrgChart.SCALE_FACTOR,a[3]=a[3]*OrgChart.SCALE_FACTOR):(a[2]=a[2]/t,a[3]=a[3]/t),e||(e=[50,50]),a[0]=n[0]-(a[2]-o)/(100/e[0]),a[1]=n[1]-(a[3]-l)/(100/e[1]);var s=this.getScale(a);if(a[2]=this.width()/s,a[3]=this.height()/s,!0===t&&sthis.config.scaleMin||0!=t&&1!=t&&sthis.config.scaleMin){this._hideBeforeAnimation();var h=this;r?(clearTimeout(h._timeout),OrgChart.animate(this.getSvg(),{viewbox:this.getViewBox()},{viewbox:a},this.config.anim.duration,this.config.anim.func,(function(){clearTimeout(h._timeout),h._timeout=setTimeout((function(){h._draw(!0,OrgChart.action.zoom,null,i)}),500)}))):(this.setViewBox(a),clearTimeout(h._timeout),h._timeout=setTimeout((function(){h._draw(!0,OrgChart.action.zoom,null,i)}),500))}},OrgChart.loading={},OrgChart.loading.show=function(t){var e=document.createElement("div");e.id="boc-loading",e.innerHTML='
',t.element.appendChild(e)},OrgChart.loading.hide=function(t){var e=t.element.querySelector("#boc-loading");e&&e.parentNode.removeChild(e)},OrgChart.pdfPrevUI={},OrgChart.loc||(OrgChart.loc={}),OrgChart.loc.ppdfCmdTitle="PDF Preview",OrgChart.loc.ppdfSave="Save",OrgChart.loc.ppdfCancel="Cancel",OrgChart.loc.ppdfFormat="Format",OrgChart.loc.ppdfFitToDrwaing="Fit",OrgChart.loc.ppdfA4="A4",OrgChart.loc.ppdfA3="A3",OrgChart.loc.ppdfA2="A2",OrgChart.loc.ppdfA1="A1",OrgChart.loc.ppdfLetter="Letter",OrgChart.loc.ppdfLegal="Legal",OrgChart.loc.ppdfLayout="Layout",OrgChart.loc.ppdfPortrait="Portrait",OrgChart.loc.ppdfLandscape="Landscape",OrgChart.loc.ppdfFittopagewidth="Fit to page width",OrgChart.loc.ppdfMargin="Margin",OrgChart.loc.ppdfHeader="Header",OrgChart.loc.ppdfFooter="Footer",OrgChart.loc.ppdfScale="Scale",OrgChart.pdfPrevUI.show=function(t,e){OrgChart.pdfPrevUI.hide(t),e=t._defaultExportOptions(e,"pdf");var r=document.createElement("div");r.classList.add(t.config.mode),r.id="boc-ppdf-btns",Object.assign(r.style,{position:"absolute",top:0,left:0,"background-color":"#fff","z-index":5,margin:"0 0 0 -265px","box-shadow":"0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)",width:"265px",height:"100%","font-family":"Roboto,Helvetica",color:"#757575","text-align":"right",padding:"10px"}),t.element.appendChild(r),r.innerHTML="

"+OrgChart.loc.ppdfCmdTitle+'

 
';var i=document.createElement("div");i.id="boc-ppdf-wrapper",Object.assign(i.style,{"overflow-y":"scroll","z-index":11,position:"absolute",top:0,left:"285px","background-color":"#eee",width:t.width()-270+"px",height:"100%"}),t.element.appendChild(i),i.innerHTML='
';var a,n,o,l=t.element.querySelector("#boc-ppdf-size"),s=t.element.querySelector("#boc-ppdf-layout"),h=t.element.querySelector("#boc-ppdf-scale"),d=t.element.querySelector("#boc-ppdf-margin"),c=t.element.querySelector("#boc-ppdf-header"),g=t.element.querySelector("#boc-ppdf-footer");l.value=e.format,s.value=e.landscape,h.value=e.scale,d.value=e.margin,c.value=e.header,g.value=e.footer,OrgChart.animate(t.element.querySelector("#boc-ppdf-btns"),{margin:[0,0,0,-250]},{margin:[0,0,0,0]},300,OrgChart.anim.outSin,(function(){t.exportPDF(e,OrgChart.pdfPrevUI._handler)})),t.element.querySelector("#boc-prev-cancel").addEventListener("click",(function(){OrgChart.pdfPrevUI.hide(t)})),t.element.querySelector("#boc-prev-save").addEventListener("click",(function(){t.exportPDF(e),OrgChart.pdfPrevUI.hide(t)})),OrgChart.pdfPrevUI._showHide(l,s,h),l.addEventListener("change",(function(){OrgChart.animate(t.element.querySelector("#boc-ppdf-content"),{opacity:1},{opacity:0},300,OrgChart.anim.inSin,(function(){t.element.querySelector("#boc-ppdf-content").innerHTML="",e.format=l.value,t.exportPDF(e,OrgChart.pdfPrevUI._handler),OrgChart.pdfPrevUI._showHide(l,s,h)}))})),s.addEventListener("change",(function(){OrgChart.animate(t.element.querySelector("#boc-ppdf-content"),{opacity:1},{opacity:0},300,OrgChart.anim.inSin,(function(){t.element.querySelector("#boc-ppdf-content").innerHTML="",e.landscape="true"==s.value,t.exportPDF(e,OrgChart.pdfPrevUI._handler),OrgChart.pdfPrevUI._showHide(l,s,h)}))})),h.addEventListener("change",(function(){OrgChart.animate(t.element.querySelector("#boc-ppdf-content"),{opacity:1},{opacity:0},300,OrgChart.anim.inSin,(function(){t.element.querySelector("#boc-ppdf-content").innerHTML="",e.scale=h.value,t.exportPDF(e,OrgChart.pdfPrevUI._handler),OrgChart.pdfPrevUI._showHide(l,s,h)}))})),d.addEventListener("keyup",(function(){clearTimeout(a),a=setTimeout((function(){OrgChart.animate(t.element.querySelector("#boc-ppdf-content"),{opacity:1},{opacity:0},300,OrgChart.anim.inSin,(function(){t.element.querySelector("#boc-ppdf-content").innerHTML="";var r=d.value.split(",");if(4==r.length){for(var i=0;i
';return n&&(d+='
'+n+"
"),d+=t,o&&(d+='"),d+="
",d+=""},OrgChart.pdfPrevUI.hide=function(t){var e=t.element.querySelector("#boc-ppdf-wrapper");if(e){e.parentNode.removeChild(e),e.style.opacity=0;var r=t.element.querySelector("#boc-ppdf-btns");r.parentNode.removeChild(r)}},void 0===OrgChart&&(OrgChart={}),OrgChart.events.on("renderdefs",(function(t,e){for(var r=0;rd?(c.y=s,g.y=d+o.h):(c.y=s+n.h,g.y=d);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:p<=u?(C=-1,c.x=p+n.w/10,g.x=u+o.w/10):(C=1,c.x=p-n.w/10,g.x=u+o.w/10),s==d?(C=-1,c.y=s+n.h,g.y=d+o.h):s>d?(c.y=s,g.y=d+o.h):(c.y=s+n.h,g.y=d);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:f<=m?(C=-1,c.y=f+n.h/5,g.y=m+o.h/5):(C=1,c.y=f-n.h/5,g.y=m+o.h/5),l==h?(C=-1,c.x=l,g.x=h):l>h?(c.x=l,g.x=h+o.w):(c.x=l+n.w,g.x=h);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:f<=m?(C=1,c.y=f+n.h/5,g.y=m+o.h/5):(C=-1,c.y=f-n.h/5,g.y=m+o.h/5),l==h?(C=1,c.x=l+n.w,g.x=h+o.w):l>h?(c.x=l,g.x=h+o.w):(c.x=l+n.w,g.x=h)}var b=_(c,g,C),O=a.template;O||(O="orange");var v=OrgChart.clinkTemplates[O];if(a.label){var y=OrgChart.clinkLabelPosition(a,c,g,b);r+=v.label.replace("{x}",y.x).replace("{y}",y.y).replace("{val}",a.label)}var x="M"+c.x+","+c.y+"C"+c.x+","+c.y+" "+b.x+","+b.y+" "+g.x+","+g.y;r+=("').replace("{from}",n.id).replace("{to}",o.id)+v.link.replaceAll("{d}",x)+'',r+=OrgChart.grCloseTag}function _(t,e,r){null==r&&(r=1);var i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))/3;return o=o/(Math.sqrt(i*i+n*n)*r)*OrgChart.clinkCurve(a),{x:t.x+i/2-n*o,y:t.y+n/2+i*o}}}e.content+=r},OrgChart.clinkLabelPosition=function(t,e,r,i){var a=(r.x-e.x)/2+e.x,n=(r.y-e.y)/2+e.y;return{x:(a-i.x)/2+i.x,y:(n-i.y)/2+i.y}},OrgChart.clinkCurve=function(t){return OrgChart.CLINK_CURVE},OrgChart.prototype.addClink=function(t,e,r,i){this._putInUndoStack(),this.clearRedo();for(var a=this.config.clinks.length-1;a>=0;a--){var n=this.config.clinks[a];n.from==t&&n.to==e&&this.config.clinks.splice(a,1)}return this.config.clinks.push({from:t,to:e,label:r,template:i}),OrgChart.events.publish("updated",[this]),this},OrgChart.prototype.removeClink=function(t,e){this._putInUndoStack(),this.clearRedo();for(var r=this.config.clinks.length-1;r>=0;r--){var i=this.config.clinks[r];i.from==t&&i.to==e&&this.config.clinks.splice(r,1)}return OrgChart.events.publish("updated",[this]),this},OrgChart.clinkTemplates={},OrgChart.clinkTemplates.orange={defs:' ',link:'',label:'{val}'},OrgChart.clinkTemplates.blue={defs:' ',link:'',label:'{val}'},OrgChart.clinkTemplates.yellow={defs:' ',link:'',label:'{val}'},void 0===OrgChart&&(OrgChart={}),OrgChart.events.on("renderdefs",(function(t,e){for(var r=0;re.x&&(d="right");break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:case OrgChart.orientation.right:case OrgChart.orientation.right_top:d="top",n.y>e.y&&(d="bottom")}var p=OrgChart.t(e.templateName,e.min,i),u=g.levelSeparation;e.parent&&e.parent.layout&&(u=g.mixedHierarchyNodesSeparation);var f={p:e.x+e.w/2+p.expandCollapseSize,q:e.y,r:e.x+e.w/2+p.expandCollapseSize,s:a.minY+u};if(e.sl==n.sl)switch(h=n,g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:s.push([f.p,f.q]),s.push([f.p,f.q-u/3]),p=OrgChart.t(h.templateName,h.min,i),s.push([h.x+h.w/2+p.expandCollapseSize,s[s.length-1][1]]),s.push([s[s.length-1][0],h.y]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:f.q=e.y+e.h,f.s=a.maxY-u,s.push([f.p,f.q]),s.push([f.r,e.y+e.h+u/3]),p=OrgChart.t(h.templateName,h.min,i),s.push([h.x+h.w/2+p.expandCollapseSize,s[s.length-1][1]]),s.push([s[s.length-1][0],h.y+h.h]);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:f.p=e.x,f.q=e.y+e.h/2+p.expandCollapseSize,f.r=a.minX-u,f.s=e.y+e.h/2+p.expandCollapseSize,s.push([f.p,f.q]),s.push([e.x-u/3,f.q]),p=OrgChart.t(h.templateName,h.min,i),s.push([s[s.length-1][0],h.y+h.h/2+p.expandCollapseSize]),s.push([h.x,s[s.length-1][1]]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:f.p=e.x+e.w,f.q=e.y+e.h/2+p.expandCollapseSize,f.r=a.maxX+u,f.s=e.y+e.h/2+p.expandCollapseSize,s.push([f.p,f.q]),s.push([e.x+e.w+u/3,f.q]),p=OrgChart.t(h.templateName,h.min,i),s.push([s[s.length-1][0],h.y+h.h/2+p.expandCollapseSize]),s.push([h.x+h.w,s[s.length-1][1]])}else{switch(g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:s.push([f.p,f.q]),s.push([f.r,e.y-u/3]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:f.q=e.y+e.h,f.s=a.maxY-u,s.push([f.p,f.q]),s.push([f.r,e.y+e.h+u/3]);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:f.p=e.x,f.q=e.y+e.h/2+p.expandCollapseSize,f.r=a.minX-u,f.s=e.y+e.h/2+p.expandCollapseSize,s.push([f.p,f.q]),s.push([e.x-u/3,f.q]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:f.p=e.x+e.w,f.q=e.y+e.h/2+p.expandCollapseSize,f.r=a.maxX+u,f.s=e.y+e.h/2+p.expandCollapseSize,s.push([f.p,f.q]),s.push([e.x+e.w+u/3,f.q])}for(var m=e,C=e;C.parent;)C=C.parent;for(;null==h;){var b=!1,O=m.parent,v=O.leftNeighbor,y=O.rightNeighbor;if(O.id==n.id?h=O:OrgChart._intersects(O,f,g)&&(f=OrgChart._addPoint(O,s,g,f,d),b=!0),O.id!=n.id){for(;v;){if(v.id==n.id){h=v;break}OrgChart._intersects(v,f,g)&&(f=OrgChart._addPoint(v,s,g,f,d),b=!0),v=v.leftNeighbor}for(;y;){if(y.id==n.id){h=y;break}OrgChart._intersects(y,f,g)&&(f=OrgChart._addPoint(y,s,g,f,d),b=!0),y=y.rightNeighbor}}if(!b){var x=s[s.length-1][0],_=0;if(O.parent){u=g.levelSeparation,O.parent.layout&&(u=g.mixedHierarchyNodesSeparation);var w=t.manager.bordersByRootIdAndLevel[C.id][O.parent.sl];switch(g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:_=w.maxY+u*(2/3);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:_=w.minY-u*(2/3);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:x=w.maxX+u*(2/3),_=s[s.length-1][1];break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:x=w.minX-u*(2/3),_=s[s.length-1][1]}}s.push([x,_])}m=O}switch(p=OrgChart.t(h.templateName,h.min,i),s.splice(s.length-1,1),g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:s.push([h.x+h.w/2+p.expandCollapseSize,s[s.length-1][1]]),s.push([s[s.length-1][0],h.y+h.h]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:s.push([h.x+h.w/2+p.expandCollapseSize,s[s.length-1][1]]),s.push([s[s.length-1][0],h.y]);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:s.push([s[s.length-1][0],h.y+h.h/2+p.expandCollapseSize]),s.push([h.x+h.w,s[s.length-1][1]]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:s.push([s[s.length-1][0],h.y+h.h/2+p.expandCollapseSize]),s.push([h.x,s[s.length-1][1]])}}var k=l.template;k||(k="orange");var S,I,A=null;switch((p=OrgChart.slinkTemplates[k]).labelPosition){case"start":A={x:s[1][0],y:s[1][1]};break;case"middle":var L=Math.ceil(s.length/2);S=s[L],I=s[L-1],A={x:(S[0]+I[0])/2,y:(S[1]+I[1])/2};break;case"end":A={x:s[s.length-2][0],y:s[s.length-2][1]}}o&&(s=s.reverse()),s[0].unshift("M");for(var N=1;N').replace("{from}",U).replace("{to}",R)+p.link.replaceAll("{d}",E)+'',r+=OrgChart.grCloseTag}for(var o=0;o=h.sl?n(s,h,!1):n(h,s,!0))}e.content+=r},OrgChart.prototype.addSlink=function(t,e,r,i){this._putInUndoStack(),this.clearRedo();for(var a=this.config.slinks.length-1;a>=0;a--){var n=this.config.slinks[a];n.from==t&&n.to==e&&this.config.slinks.splice(a,1)}return this.config.slinks.push({from:t,to:e,label:r,template:i}),OrgChart.events.publish("updated",[this]),this},OrgChart.prototype.removeSlink=function(t,e){this._putInUndoStack(),this.clearRedo();for(var r=this.config.slinks.length-1;r>=0;r--){var i=this.config.slinks[r];i.from==t&&i.to==e&&this.config.slinks.splice(r,1)}return OrgChart.events.publish("updated",[this]),this},OrgChart.slinkTemplates={},OrgChart.slinkTemplates.orange={defs:' ',link:'',label:'{val}',labelPosition:"middle"},OrgChart.slinkTemplates.blue={defs:' ',link:'',label:'{val}',labelPosition:"middle"},OrgChart.slinkTemplates.yellow={defs:' ',link:'',label:'{val}',labelPosition:"middle"},OrgChart.events.on("renderbuttons",(function(t,e){if(e.node&&e.node.tags&&e.node.tags.has("group-dotted-lines")){var r=t.getScale(),i=OrgChart.t(e.node.templateName,e.node.min,r),a="";e.node.min?(i.nodeGroupDottedOpenButton||console.error(`[${e.node.templateName}].nodeGroupDottedOpenButton is not defined`),a+=``,a+=i.nodeGroupDottedOpenButton):(i.nodeGroupDottedCloseButton||console.error(`[${e.node.templateName}].nodeGroupDottedCloseButton is not defined`),a+=``,a+=i.nodeGroupDottedCloseButton),a=(a+="").replaceAll("{cw}",e.node.w/2).replaceAll("{ch}",e.node.h/2).replaceAll("{ew}",e.node.w-(e.node.padding?e.node.padding[1]:0)).replaceAll("{eh}",e.node.h-(e.node.padding?e.node.padding[2]:0));var n=t.getNode(e.node.stChildrenIds[0]);if(-1!=a.indexOf("{collapsed-children-count}")){var o=OrgChart.collapsedChildrenCount(t,n);a=a.replace("{collapsed-children-count}",o)}if(-1!=a.indexOf("{collapsed-children-total-count}")){var l=OrgChart.collapsedChildrenTotalCount(t,n);a=a.replace("{collapsed-children-total-count}",l)}if(-1!=a.indexOf("{children-count}")){var s=OrgChart.childrenCount(t,n);a=a.replace("{children-count}",s)}if(-1!=a.indexOf("{children-total-count}")){var h=OrgChart.childrenTotalCount(t,n);a=a.replace("{children-total-count}",h)}e.html+=a}})),OrgChart.events.on("redraw",(function(t,e){if(t.config.groupDottedLines.length){for(var r=t.element.querySelectorAll("[data-ctrl-n-dotted-close]"),i=0;i${OrgChart.icon.undo(50,50,"")}\n ${OrgChart.icon.redo(50,50,"")}`,this.instance.element.appendChild(a),r=this.instance.element.querySelector("[data-undo]"),i=this.instance.element.querySelector("[data-redo]"),r.addEventListener("click",(function(){t.instance.undo()})),i.addEventListener("click",(function(){t.instance.redo()}))}e.undoStepsCount>0?(r.classList.add("boc-ur-clickable"),r.querySelector(".boc-undo-i").innerHTML=e.undoStepsCount,r.querySelector(".boc-undo-i").style.display="inline-block"):(r.classList.remove("boc-ur-clickable"),r.querySelector(".boc-undo-i").style.display="none"),e.redoStepsCount>0?(i.classList.add("boc-ur-clickable"),i.querySelector(".boc-redo-i").innerHTML=e.redoStepsCount,i.querySelector(".boc-redo-i").style.display="inline-block"):(i.classList.remove("boc-ur-clickable"),i.querySelector(".boc-redo-i").style.display="none")}}},OrgChart.undoRedoUI.prototype.on=function(t,e){return OrgChart.events.on(t,e,this._event_id),this},OrgChart.undoRedoUI.prototype.onChange=function(t){return this.on("change",(function(e,r){return t.call(e,r)}))},OrgChart.events.on("redraw",(function(t,e){if(t.config.miniMap){if(t.manager.action!=OrgChart.action.move){OrgChart.miniMap._settings._scale=Math.min(OrgChart.miniMap.width/(t.response.boundary.maxX-t.response.boundary.minX),OrgChart.miniMap.height/(t.response.boundary.maxY-t.response.boundary.minY)),OrgChart.miniMap._settings._translateX=-t.response.boundary.minX*OrgChart.miniMap._settings._scale+(OrgChart.miniMap.width-(t.response.boundary.maxX-t.response.boundary.minX)*OrgChart.miniMap._settings._scale)/2,OrgChart.miniMap._settings._translateY=-t.response.boundary.minY*OrgChart.miniMap._settings._scale+(OrgChart.miniMap.height-(t.response.boundary.maxY-t.response.boundary.minY)*OrgChart.miniMap._settings._scale)/2;var r=t.getViewBox();OrgChart.miniMap._init(t),OrgChart.miniMap._drawMainCanvas(t),OrgChart.miniMap._drawRectSelectorCanvas(t,r);var i,a,n,o,l=t.element.querySelector('[data-id="mini-map-focus"]'),s=!1,h=null;l.onmousedown=function(t){var e,n,o,h=l.getBoundingClientRect(),d=h.left,c=h.top;if(i=parseInt(t.clientX-d),a=parseInt(t.clientY-c),e=a,n=(i-OrgChart.miniMap._settings._translateX)/OrgChart.miniMap._settings._scale,o=(e-OrgChart.miniMap._settings._translateY)/OrgChart.miniMap._settings._scale,n>r[0]&&nr[1]&&o1){var d=h[0];o[d]&&(r=[o[d]],h=(s=s.replace(d,"").trim()).split(" "))}h=h.filter((function(t,e,r){return r.indexOf(t)===e}));for(var c={},g=0;g=0;b--)l[b].id==C&&l.splice(b,1);OrgChart._search.addNodeToResult(l,i,p,e,f,a)}}else c[C]=e.__score,OrgChart._search.addNodeToResult(l,i,p,e,f,a)}}}return l.sort((function(t,e){return t.__scoree.__score?-1:0})),l},OrgChart._search.addNodeToResult=function(t,e,r,i,a,n){var o={};o.id=r.id,OrgChart.isNEU(r[n])||(o[n]=r[n]);for(var l=0;l0?100:0,d=0,c=0;c=1&&n[p-1].start>n[p].start){h=0;break}}var f=0;0!=l&&(f=l/o);var m=l>0?100:0;0!=s&&(m=100-s/o);var C=0;i&&i[r]&&(C=i[r]),u&&(u=u/100*50),f>0&&(f=f/100*10),m>0&&(m=m/100*10),h>0&&(h=h/100*10),C>0&&(C=C/100*20);var b=Math.round(1e4*(u+f+m+h+C));n.sort((function(t,e){return t.starte.start?1:0}));var O=e;for(p=n.length-1;p>=0;p--)O=(O=O.insert(n[p].start+n[p].length,"")).insert(n[p].start,"");return{__searchMarks:O,__score:b}},OrgChart._search.searchIndexesOf=function(t,e){var r=[];if(!OrgChart.isNEU(t))for(var i=0;i-1;)r.push({length:a.length,start:n,searchPhrase:a}),n+=a.length}return r.sort((function(t,e){return t.lengthe.length||t.starte.start?1:0})),r=r.filter((function(t){for(var e=!1,i=0;i=o&&n<=l){e=!0;break}if(a<=o&&n>=l){e=!0;break}}return!e}))},OrgChart.events.on("redraw",(function(t,e){if(t.config.state){var r=[],i=[];!function t(e){if(Array.isArray(e))for(var a=0;a=0){l=s.childrenIds[o];this._keyNavigationActiveNodeId=l,this.center(l)}}}else if("ArrowUp"==e.code){var s;if(s=this.getNode(a.pid)){l=s.id;if(a.isAssistant||s.hasAssistants||a.isPartner||s.hasPartners){o=s.childrenIds.indexOf(a.id);--o>=0&&(l=s.childrenIds[o])}this._keyNavigationActiveNodeId=l,this.center(l)}}else if("ArrowDown"==e.code)a.childrenIds.length&&(this._keyNavigationActiveNodeId=a.childrenIds[0],this.center(a.childrenIds[0]));else if("Space"==e.code){var h=r.getAttribute(OrgChart.attr.node_id);return void this.toggleExpandCollapse(h,e)}}},OrgChart.events.on("redraw",(function(t,e){t.config.keyNavigation&&OrgChart._keyNavigation(t)})),OrgChart.events.on("click",(function(t,e){t.config&&t.config.keyNavigation&&(t._keyNavigationActiveNodeId=e.node.id,t.center(e.node.id))})),OrgChart._keyNavigation=function(t){var e=t.element.querySelector(":focus");if(e&&e.parentElement&&e.parentElement.hasAttribute(OrgChart.attr.node_id)){var r=e.parentElement;(a=(i=e).querySelector("title"))&&a.parentNode.removeChild(a),i.removeAttribute("tabindex")}if(!OrgChart.isNEU(t._keyNavigationActiveNodeId)&&((r=t.getNodeElement(t._keyNavigationActiveNodeId))&&r.children.length)){var i;(i=r.children[0]).setAttribute("tabindex",2);var a,n={text:"",id:t._keyNavigationActiveNodeId};if(OrgChart.events.publish("screen-reader-text",[t,n]),!OrgChart.isNEU(n.text))(a=document.createElementNS("http://www.w3.org/2000/svg","title")).innerHTML=n.text,i.appendChild(a);OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE&&t.searchUI.hide(),i.focus()}},OrgChart.elements={},OrgChart.elements.textbox=function(t,e,r,i){var a=OrgChart.elements._vidrf(t,e,i);if(a.doNotRender)return{html:""};var n="";return e.btn&&(n=`${e.btn}`),{html:`
\n
\n \n \n ${n}\n
\n
`,id:a.id,value:a.value}},OrgChart.elements.checkbox=function(t,e,r,i){var a=OrgChart.elements._vidrf(t,e,i);if(a.doNotRender)return{html:""};var n=a.value?"checked":"",o=i?'onclick="return false;"':"";return{html:`
\n \n
`,id:a.id,value:n}},OrgChart.elements.select=function(t,e,r,i){if(i)return OrgChart.elements.textbox(t,e,r,i);var a=OrgChart.elements._vidrf(t,e,i);return a.doNotRender?{html:""}:{html:`
\n
\n \n \n
\n
`,id:a.id,value:a.value}},OrgChart.elements.multiSelect=function(t,e,r,i){if(i)return OrgChart.elements.textbox(t,e,r,i);var a=OrgChart.elements._vidrf(t,e,i);return a.doNotRender?{html:""}:{html:`
\n
\n \n \n
\n
`,id:a.id,value:a.value}},OrgChart.elements.date=function(t,e,r,i){var a=OrgChart.elements._vidrf(t,e,i);return a.doNotRender?{html:""}:{html:`
\n
\n \n \n
\n
`,id:a.id,value:a.value}},OrgChart.elements._vidrf=function(t,e,r){var i={};if(e.binding||(e.binding=""),e.label||(e.label=""),"select"!=e.type||Array.isArray(e.options)?i.options=e.options:i.options=[],i.value=t&&!OrgChart.isNEU(t[e.binding])?t[e.binding]:"",r&&i.options)for(var a=0;a '+a+"",e.classList.add("boc-validation-error"),!1):n&&!OrgChart.input.validatePassword(e.value)?(r.innerHTML+=' '+n+"",e.classList.add("boc-validation-error"),!1):o&&!OrgChart.input.isValidEmail(e.value)?(r.innerHTML+=' '+o+"",e.classList.add("boc-validation-error"),!1):!(l&&!OrgChart.input.isValidEmails(e.value))||(r.innerHTML+=' '+l+"",e.classList.add("boc-validation-error"),!1)},OrgChart.input.validateAndGetData=function(t){for(var e=t.querySelectorAll("[data-boc-input]"),r=!0,i=0;it))}else o[s]=l.value}return o},OrgChart.input.validatePassword=function(t){return t&&(t=t.trim()),!(t.length<5)&&(!(t.length>18)&&-1==t.indexOf(" "))},OrgChart.input.isValidEmails=function(t){if(t)for(var e=t.split(","),r=0;r()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(t).toLowerCase())},OrgChart.ui.css=function(){return''},void 0===OrgChart&&(OrgChart={}),OrgChart.prototype.onField=function(t){return this.on("field",(function(e,r){return t.call(e,r)}))},OrgChart.prototype.onInit=function(t){return this.on("init",(function(e){return t.call(e)}))},OrgChart.prototype.onRedraw=function(t){return this.on("redraw",(function(e){return t.call(e)}))},OrgChart.prototype.onUpdateNode=function(t){return this.on("update",(function(e,r,i){var a={oldData:r,newData:i};return t.call(e,a)}))},OrgChart.prototype.onUpdated=function(t){return this.on("updated",(function(e){return t.call(e)}))},OrgChart.prototype.onRemoveNode=function(t){return this.on("remove",(function(e,r,i){var a={id:r,newPidsAndStpidsForIds:i};return t.call(e,a)}))},OrgChart.prototype.onAddNode=function(t){return this.on("add",(function(e,r){var i={data:r};return t.call(e,i)}))},OrgChart.prototype.onDrop=function(t){return this.on("drop",(function(e,r,i,a,n){var o={dragId:r,dropId:i,dragNodeElement:a,event:n};return t.call(e,o)}))},OrgChart.prototype.onDrag=function(t){return this.on("drag",(function(e,r,i,a){var n={dragId:r,event:i,nodeIds:a};return t.call(e,n)}))},OrgChart.prototype.onExpandCollpaseButtonClick=function(t){return this.on("expcollclick",(function(e,r,i,a){var n={collapsing:r,id:i,ids:a};return t.call(e,n)}))},OrgChart.prototype.onExportStart=function(t){return this.on("exportstart",(function(e,r){return t.call(e,r)}))},OrgChart.prototype.onExportEnd=function(t){return this.on("exportend",(function(e,r){return t.call(e,r)}))},OrgChart.prototype.onNodeClick=function(t){return this.on("click",(function(e,r){return t.call(e,r)}))},OrgChart.prototype.onNodeDoubleClick=function(t){return this.on("dbclick",(function(e,r){var i={data:r};return t.call(e,i)}))},OrgChart.filterUI=function(){},OrgChart.filterUI.prototype.init=function(t){this.instance=t,this.element=null,this.filterBy=null,this._event_id=OrgChart._guid()},OrgChart.filterUI.prototype.addFilterTag=function(t){if(!this.instance.config.filterBy)return!1;if(OrgChart.isNEU(t))return!1;if(null!==this.filterBy||"object"!=typeof this.instance.config.filterBy||Array.isArray(this.instance.config.filterBy)||(this.filterBy=JSON.parse(JSON.stringify(this.instance.config.filterBy))),null!=this.filterBy)for(var e in this.filterBy){var r=t[e];if(null!=r){var i=this.filterBy[e];if(null!=i){var a=i[r];if(null!=a&&!1===a.checked)return!0}}}return!1},OrgChart.filterUI.prototype.show=function(t){var e=this.element.querySelector('[data-filter-field="'+t+'"]');e&&e.click()},OrgChart.filterUI.prototype.hide=function(){var t=this.instance.element.querySelector("[data-filter-close]");t&&t.click()},OrgChart.filterUI.prototype.update=function(){if(this.instance.config.filterBy){var t={};if("all"==this.instance.config.filterBy)for(var e=OrgChart.manager.getAllFields(this.instance.config),r=0;r${s}`};OrgChart.events.publish("add-filter",[d,g]),c+=g.html}this.element.innerHTML=`
${c}
`,this.element.addEventListener("click",(function(t){if(t.target.hasAttribute("data-filter-close")||t.target.hasAttribute("data-filter-field")){for(var e=t.target.getAttribute("data-filter-field"),r=d.instance.element.querySelectorAll("[data-filter-menu]"),i=0;i\n \n \n `};OrgChart.events.publish("add-item",[d,l]);var s=l.html;for(var h in d.filterBy[e]){var c=d.filterBy[e][h],g=c.text;null==g&&(g=h),l={name:e,text:g,value:h,checked:c.checked,html:`
\n \n \n
`},OrgChart.events.publish("add-item",[d,l]),s+=l.html}o=document.createElement("div");var p=OrgChart.filterUI.textFilterBy;o.innerHTML=`
\n ${p} ${e}:\n ${s}\n
`,o.setAttribute("data-filter-menu",e),o.classList.add("boc-filter-menu"),t.target.parentNode.parentNode.appendChild(o);var u=o.querySelectorAll("input");for(i=0;i0&&(r.c=OrgChart.remote._convertToIdArray(t.children)),t.stChildren.length>0&&(r.v=OrgChart.remote._convertToIdArray(t.stChildren)),null!=t.layout&&0!=t.layout&&(r.l=t.layout),t.isAssistant&&(r.a=1),t.isSplit&&(r.s=t.isSplit),t.isMirror&&(r.im=t.isMirror),t.padding&&(r.q=t.padding),t.lcn&&(r.k=t.lcn),t.stContainerNodes&&(r.b=OrgChart.remote._convertToIdArray(t.stContainerNodes)),t.isPartner&&(r.i=t.isPartner),t.hasPartners&&(r.g=t.hasPartners),t.partnerSeparation&&(r.e=t.partnerSeparation),e.push(r);for(var i=0;i