From 32f1d81d75901ffc53f2569a9780570d121a6f7f Mon Sep 17 00:00:00 2001 From: Ronald Abu Saleh Date: Thu, 13 Nov 2025 10:36:31 -0400 Subject: [PATCH] fix: prevent slice error on first OrgChart load --- OrgChart.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OrgChart.js b/OrgChart.js index a6adafb..818ee2c 100644 --- a/OrgChart.js +++ b/OrgChart.js @@ -1 +1,2 @@ -/* eslint-disable */ var OrgChart=function(t,e){("string"==typeof t||t instanceof String)&&(t=document.querySelector(t));var r=this;Object.defineProperty(this,"element",{get:()=>t.querySelector("[data-boc-content]"),set(t){r.mainElement=t}}),Object.defineProperty(this,"mainElement",{get:()=>t,set(i){(t=i)&&(t.innerHTML="\n \n
\n
\n
\n
",r._constructor(e))}}),Object.defineProperty(this,"leftElement",{get:()=>t.querySelector("[data-boc-left]")}),this.element=t};OrgChart.prototype._constructor=function(t){var e=this;if(this.config=OrgChart.mergeDeep(OrgChart._defaultConfig(t),t),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 r in this.config.tags){var i=this.config.tags[r];null!=i.subTreeConfig&&(this._layoutConfigs[r]={orientation:null!=i.subTreeConfig.orientation?i.subTreeConfig.orientation:this.config.orientation,levelSeparation:null!=i.subTreeConfig.levelSeparation?i.subTreeConfig.levelSeparation:this.config.levelSeparation,mixedHierarchyNodesSeparation:null!=i.subTreeConfig.mixedHierarchyNodesSeparation?i.subTreeConfig.mixedHierarchyNodesSeparation:this.config.mixedHierarchyNodesSeparation,assistantSeparation:null!=i.subTreeConfig.assistantSeparation?i.subTreeConfig.assistantSeparation:this.config.assistantSeparation,subtreeSeparation:null!=i.subTreeConfig.subtreeSeparation?i.subTreeConfig.subtreeSeparation:this.config.subtreeSeparation,siblingSeparation:null!=i.subTreeConfig.siblingSeparation?i.subTreeConfig.siblingSeparation:this.config.siblingSeparation,layout:null!=i.subTreeConfig.layout?i.subTreeConfig.layout:this.config.layout,columns:null!=i.subTreeConfig.columns?i.subTreeConfig.columns:this.config.columns,collapse:null!=i.subTreeConfig.collapse?i.subTreeConfig.collapse:this.config.collapse,partnerNodeSeparation:null!=i.subTreeConfig.partnerNodeSeparation?i.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._ai=new OrgChart._ai(this),this.config.searchUI?this.searchUI=this.config.searchUI:this.searchUI=new OrgChart.searchUI,this.config.aiUI?this.aiUI=this.config.aiUI:this.aiUI=new OrgChart.aiUI,this.config.orgScribeUI?this.orgScribeUI=this.config.orgScribeUI:this.orgScribeUI=new OrgChart.orgScribeUI,this.config.powerPointPreviewUI?this.powerPointPreviewUI=this.config.powerPointPreviewUI:this.powerPointPreviewUI=new OrgChart.exportUI("pptx"),this.config.pdfPreviewUI?this.pdfPreviewUI=this.config.pdfPreviewUI:this.pdfPreviewUI=new OrgChart.exportUI("pdf"),this.config.svgPreviewUI?this.svgPreviewUI=this.config.svgPreviewUI:this.svgPreviewUI=new OrgChart.exportUI("svg"),this.config.pngPreviewUI?this.pngPreviewUI=this.config.pngPreviewUI:this.pngPreviewUI=new OrgChart.exportUI("png"),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.controlsUI?this.controlsUI=this.config.controlsUI:this.controlsUI=new OrgChart.controlsUI,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:e.response.boundary,scale:e.getScale(),viewBox:e.getViewBox(),padding:e.config.padding}},function(t){e.setViewBox(t)},function(){e._draw(!0,OrgChart.action.xScroll)})),this.config.yScrollUI||(this.yScrollUI=new OrgChart.yScrollUI(this.element,this.config,function(){return{boundary:e.response.boundary,scale:e.getScale(),viewBox:e.getViewBox(),padding:e.config.padding}},function(t){e.setViewBox(t)},function(){e._draw(!0,OrgChart.action.xScroll)})),this.config.undoRedoUI?this.undoRedoUI=this.config.undoRedoUI:this.undoRedoUI=new OrgChart.undoRedoUI,this.mainElement.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){e.isVisible=t,!1!==OrgChart.events.publish("visibility-change",[e])&&OrgChart.LAZY_LOADING&&e.isVisible&&(e._loaded?e._draw(!1,OrgChart.action.update):(e._setInitialSizeIfNotSet(),e._draw(!1,OrgChart.action.init)))}),this._resizeObserver=new ResizeObserver(t=>{for(let r of t){const{width:t,height:i}=r.contentRect;e._resizeHandler(t,i)}}),this._resizeObserver.observe(this.element))},OrgChart._defaultConfig=function(t){return{interactive:!0,mode:"light",lazyLoading:"auto",enableDragDrop:!1,enableSearch:!0,enableAI:!1,enablePan:!0,keyNavigation:!1,miniMap:!1,controls:null,nodeMenu:null,nodeCircleMenu:null,nodeContextMenu:null,menu:null,toolbar:!1,sticky:!0,nodeMouseClick:OrgChart.action.details,nodeMouseDbClick:OrgChart.none,mouseScrool:OrgChart.action.zoom,showXScroll:!1,showYScroll:!1,template:"ana",tags:{},min:!1,nodeBinding:{},linkBinding:{},searchFields:null,searchDisplayField:null,searchFieldsWeight:null,searchFieldsAbbreviation:null,nodes:[],clinks:[],slinks:[],backdrops:[],groupDottedLines:[],dottedLines:[],undoRedoStorageName:null,levelSeparation:60,siblingSeparation:20,subtreeSeparation:40,backdropSeparation:15,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,aiUI:null,orgScribeUI:null,powerPointPreviewUI:null,pdfPreviewUI:null,svgPreviewUI:null,pngPreviewUI:null,filterUI:null,searchUI:null,xScrollUI:null,yScrollUI:null,nodeMenuUI:null,controlsUI:null,nodeCircleMenuUI:null,nodeContextMenuUI:null,toolbarUI:null,notifierUI:null,menuUI:null,undoRedoUI:null,exportUrl:"https://balkan.app/export",serverUrl:"https://serverjs.balkan.app",aiChatTools:[],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",saveOnHide:!0,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 n=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 a=e==OrgChart.action.init?null:this.getViewBox();this.manager.read(t,this.width(),this.height(),a,e,r,function(t){if(!n.notifierUI.show(t.notif)){e!=OrgChart.action.exporting&&(n.nodes=t.nodes,n.visibleNodeIds=t.visibleNodeIds,n.roots=t.roots),n.editUI.fields=t.allFields;var a={defs:""};OrgChart.events.publish("renderdefs",[n,a]);var o=n.ui.defs(a.defs),s=n.getScale(t.viewBox);o+=n.ui.pointer(n.config,e,s);var l=n.getViewBox(),h=t.viewBox;a={content:o,res:t};OrgChart.events.publish("prerender",[n,a]),o=a.content;var c=[];if(OrgChart.RENDER_LINKS_BEFORE_NODES)for(var d=0;d0){n._hideBeforeAnimation(C[0].length);for(d=0;dthis.config.scaleMax&&(t=this.config.scaleMax),ta?a:n,s=e,l=e[2],h=e[3];return e[2]=e[2]/(t/o),e[3]=e[3]/(t/o),e[0]=s[0]-(e[2]-l)/2,e[1]=s[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 n=this.getNodeElement(t);if(null!=n){var a=this.getScale(),o=i.w/2,s=i.h/2;if(void 0!==e&&void 0!==r){var l=n.getBoundingClientRect();o=e/a-l.left/a,s=r/a-l.top/a}var h=i.w,c=i.h,d=h-o>o?h-o:o,g=c-s>s?c-s:s,p=d>g?d: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 v={ripple:OrgChart.t(i.templateName,i.min,this.getScale()).ripple,node:i};OrgChart.events.publish("ripple",[this,v]),m.setAttribute("x",v.ripple.rect?v.ripple.rect.x:0),m.setAttribute("y",v.ripple.rect?v.ripple.rect.y:0),m.setAttribute("width",v.ripple.rect?v.ripple.rect.width:i.w),m.setAttribute("height",v.ripple.rect?v.ripple.rect.height:i.h),m.setAttribute("rx",v.ripple.radius),m.setAttribute("ry",v.ripple.radius),C.setAttribute("clip-path","url(#"+b+")"),C.setAttribute("cx",o),C.setAttribute("cy",s),C.setAttribute("r",0),C.setAttribute("fill",v.ripple.color),C.setAttribute("class","boc-ripple"),f.appendChild(m),u.appendChild(f),u.appendChild(C),n.appendChild(u),OrgChart.animate(C,{r:0,opacity:1},{r:p,opacity:0},500,OrgChart.anim.outPow,function(){n.removeChild(u)})}}},OrgChart.prototype.centerOutNodes=function(t){if(this._centerInNodes){var e=JSON.parse(this._centerInNodes);this._centerInNodes=null;var r=this;this._centerInNodesTimeout=OrgChart.animate(this.getSvg(),{viewBox:this.getViewBox()},{viewBox:e},300,this.config.anim.func,function(){r.draw(OrgChart.action.update,null,function(){t&&t.call(r)})})}},OrgChart.prototype.centerInNodes=function(t,e){var r=this.getViewBox();this._centerInNodes||(this._centerInNodes=JSON.stringify(r));var i=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;for(var s of t)s.yn&&(n=s.y+s.h),s.xo&&(o=s.x+s.w);var l=o-a,h=n-i,c=(d=l/(l+2*this.config.padding))>(g=h/(h+2*this.config.padding))?g:d;c>this.config.scaleMax&&(c=this.config.scaleMax),c(g=f/r[3])?g:d,C=r,b=r[2],v=r[3];r[2]=r[2]/(c/m),r[3]=r[3]/(c/m),r[0]=C[0]-(r[2]-b)/(100/p[0]),r[1]=C[1]-(r[3]-v)/(100/p[1]),r[0]=a-(u/c-l)/2,r[1]=i-(f/c-h)/2;var x=this;this._centerInNodesTimeout&&(clearTimeout(this._centerInNodesTimeout),this._centerInNodesTimeout=null),this._centerInNodesTimeout=OrgChart.animate(this.getSvg(),{viewBox:this.getViewBox()},{viewBox:r},300,this.config.anim.func,function(){x.draw(OrgChart.action.update,null,function(){e&&e.call(x)})})},OrgChart.prototype.center=function(t,e,r){var i,n,a=t,o=!0,s=!0;e&&null!=e.parentState&&(i=e.parentState),e&&null!=e.childrenState&&(n=e.childrenState),e&&null!=e.rippleId&&(a=e.rippleId),e&&null!=e.vertical&&(o=e.vertical),e&&null!=e.horizontal&&(s=e.horizontal);var l={parentState:i,childrenState:n,rippleId:a,vertical:o,horizontal:s};this._draw(!1,OrgChart.action.centerNode,{id:t,options:l},r)},OrgChart.prototype.fit=function(t){this.config.scaleInitial=OrgChart.match.boundary,this._draw(!0,OrgChart.action.init,{method:"fit"},t)},OrgChart.prototype.fitIfOutside=function(t){this.config.scaleInitial=OrgChart.match.boundaryIfOutside,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(){i.getScale();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===h||h>d.y)&&(h=d.y))}if(null!=o&&null!=s&&null!=l&&null!=h){var g=this.width(),p=this.height(),u=g/(v=o-l+2*this.config.padding),f=p/(x=s-h+2*this.config.padding),m=u>f?f:u,C=Math.ceil(g/m),b=Math.ceil(p/m),v=0,x=0;if(C-2*this.config.padding>=o-l)v=(o+l)/2-C/2;else switch(v=i.x-C/2+OrgChart.manager._getNodeWidth(i,this.config)/2,this.config.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:(v=-(C/2-(l-o)/2))-this.config.padding&&(v=-this.config.padding)}if(b-2*this.config.padding>=s-h)x=(s+h)/2-b/2;else switch((x=-(b/2-(s-h)/2))>-this.config.padding&&(x=-this.config.padding),this.config.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:(x=-(b/2-(h-s)/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 n=this.config.nodes.length-1;n>=0;n--)this.config.nodes[n].pid==t?r[this.config.nodes[n].id]=e.pid:this.config.nodes[n].stpid==t&&(i[this.config.nodes[n].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),this._ai.setContext(),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;rc+1&&(clearInterval(s),a&&a(t))},l)},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._attachEventHandlers=function(t){if(this.config.interactive){t=this.getSvg();var e=this;t.addEventListener("touchstart",function(t){t.preventDefault(),e._globalMouseDownHandler.apply(e,[this,t])},{passive:!1}),t.addEventListener("mousedown",function(t){e._globalMouseDownHandler.apply(e,[this,t])},{passive:!0}),t.addEventListener("contextmenu",function(t){e._globalContextHandler.apply(e,[this,t])},{passive:!1}),t.addEventListener("dblclick",function(t){e._globalDbClickHandler.apply(e,[this,t])},{passive:!0}),this.config.mouseScrool!=OrgChart.action.none&&t.addEventListener("wheel",function(t){e._mouseScrollHandler.apply(e,[this,t])},{passive:!1});var r=this.getMenuButton();r&&r.addEventListener("click",function(t){e._menuClickHandler.apply(e,[this,t])})}},void 0===OrgChart&&(OrgChart={}),OrgChart.VERSION="8.21.26",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.match.boundaryIfOutside=100004,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.A5={width:420,height:595},OrgChart.A4={width:595,height:842},OrgChart.A3={width:842,height:1191},OrgChart.A2={width:1191,height:1684},OrgChart.A1={width:1684,height:2384},OrgChart.Letter={width:612,height:791},OrgChart.Legal={width:612,height:1009},OrgChart.Legal={width:612,height:1009},OrgChart.Widescreen={width:720,height:1280},OrgChart.Standard={width:720,height:960},OrgChart.COLLAPSE_PARENT_NEIGHBORS=1,OrgChart.COLLAPSE_SUB_CHILDRENS=2,OrgChart.COLLAPSE_PARENT_SUB_CHILDREN_EXCEPT_CLICKED=3,OrgChart.TEXT_THRESHOLD=4e3,OrgChart.IMAGES_THRESHOLD=1e3,OrgChart.LINKS_THRESHOLD=2e3,OrgChart.BUTTONS_THRESHOLD=700,OrgChart.ANIM_THRESHOLD=500,OrgChart.IT_IS_LONELY_HERE='{link}',OrgChart.RES={},OrgChart.IT_IS_LONELY_HERE_LINK=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="auto",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,OrgChart.FILTER_ALPHABETICALLY=!0,OrgChart.SERVER_PREFIX=".azurewebsites.net/api/OrgChartJS",OrgChart.FUNC_URL_NAME="func-url-orgchartjs",OrgChart.MINIMUM_SYMBOLS_IN_SEARCH_INPUT=1,OrgChart.AI_SYSTEM_MESSAGES=[],OrgChart.ORGSCRIBE_OFFSET=" ","undefined"!=typeof module&&(module.exports=OrgChart),OrgChart._intersects=function(t,e,r){var i=t.x-r.siblingSeparation/4,n=t.y,a=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,n=t.y-r.siblingSeparation/4,a=t.x,o=t.y+t.h+r.siblingSeparation/4}var s,l,h,c=e.p,d=e.q,g=e.r,p=e.s;return 0!==(s=(a-i)*(p-d)-(g-c)*(o-n))&&(l=((n-o)*(g-i)+(a-i)*(p-n))/s,0<(h=((p-d)*(g-i)+(c-g)*(p-n))/s)&&h<1&&0`),this._drawCurrentNodeElement())},OrgChart.editUI.prototype.save=function(){var t=this.obj.element.querySelector("[data-boc-edit-form]"),e=OrgChart.input.validateAndGetData(t);if(!1!==e){var r=this.obj.get(this.nodeId),i={data:OrgChart.mergeDeep(r,e)};if(!1===OrgChart.events.publish("save",[this,i]))return;return this.obj.updateNode(i.data,null,!0,this.obj.config.editForm.saveOnHide),!0}return!1},OrgChart.editUI.prototype._focusElement=function(t){var e=null;OrgChart.isNEU(this.obj.config.editForm.focusBinding)?OrgChart.isNEU(t)||(e=document.getElementById(t)):e=this.obj.element.querySelector('[data-binding="'+this.obj.config.editForm.focusBinding+'"]'),e&&(e.value&&e.value.length&&e.setSelectionRange(e.value.length,e.value.length),e.focus())},OrgChart.editUI.prototype.content=function(t,e,r,i,n){var a,o=this.obj.config.editForm.readOnly,s=JSON.parse(JSON.stringify(this.obj.config.editForm.elements)),l=this.obj.config.editForm.addMore,h=this.obj.config.editForm.saveOnHide,c=this.obj.config.editForm.saveAndCloseBtn,d=this.obj.config.editForm.cancelBtn,g=this.obj.config.editForm.buttons,p=this.obj.config.editForm.titleBinding,u=this.obj.config.editForm.photoBinding,f=this.obj.getNode(t),m=this.obj._get(t),C=OrgChart.t(f.templateName,f.min,this.obj.getScale()),b=m[p],v=m[u];if(this.obj.config.editForm.generateElementsFromFields)for(var x=0;x`;var k=!e,S=h?"display:none;":"",I=e?"display:none;":"",L=e||!l?"display:none;":"",A=C.editFormHeaderColor?`style="background-color:${C.editFormHeaderColor};"`:"",E=document.createElement("form");if(E.setAttribute("data-boc-edit-form",""),E.classList.add("boc-edit-form"),E.classList.add(this.obj.config.mode),E.classList.add(f.templateName.replaceAll(" ","")),E.classList.add(OrgChart.ui._defsIds[f.templateName]),Array.isArray(f.tags)&&f.tags.length)for(x=0;x\n
\n ${M}\n ${OrgChart.editUI.renderHeaderContent(b,v,f,m)}\n
\n
\n ${function(){if(n)return"";var t="";for(var r in g){var i=g[r];OrgChart.isNEU(i)||(k&&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 n=0;n"}else{l=OrgChart.elements[i.type](m,i,"280px",e);!OrgChart.isNEU(l.id)&&OrgChart.isNEU(a)&&OrgChart.isNEU(l.value)&&(a=l.id),OrgChart.isNEU(l.value)||N.push(`${i.label}: ${l.value}`),t+=l.html}}return t}()}\n\n
\n ${l}\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
`,{element:E,focusId:a,title:b,shareText:N.join("\n")}},OrgChart.editUI.prototype.hide=function(){var t=this.obj.element.querySelector("[data-boc-edit-form]");if(t){if(!this.detailsMode&&this.obj.config.editForm.saveOnHide){if(!this.save())return}else{var e=this.obj.get(this.nodeId),r=this.obj.getNode(this.nodeId),i=this.obj.ui.node(r,e,[],this.obj.config,void 0,void 0,void 0,void 0,this.obj.getScale(),this.obj);this._replaceNodeWith(i)}if(!1===OrgChart.events.publish("hide",[this]))return!1;OrgChart.isNEU(this.interval)&&(clearInterval(this.interval),this.interval=null),t.parentNode.removeChild(t),this.nodeId=null,this.detailsMode=null}return!0},OrgChart.editUI.renderHeaderContent=function(t,e,r,i){return`

${OrgChart._escapeGreaterLessSign(t)}

\n
${e}
`},OrgChart.prototype.getSvg=function(){return this.element.querySelector("svg")},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,n){this._show(t,e,r,i,n)},OrgChart.menuUI.prototype._show=function(t,e,r,i,n){var a=this;this.hide();var o="";n||(n=this.menu);var s={firstNodeId:r,secondNodeId:i,menu:n};if(!1===OrgChart.events.publish("show",[this,s]))return!1;for(var l in n=s.menu){var h=n[l].icon,c=n[l].text;void 0===h&&(h=OrgChart.icon[l]?OrgChart.icon[l](24,24,"#7A7A7A"):""),"function"==typeof c&&(c=c()),"function"==typeof h&&(h=h()),o+="
'+h+"  "+c+"
"}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 d=OrgChart._menuPosition(t,this.wrapper,this.obj.getSvg());t=d.x,e=d.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\n ${n}\n `}this.instance.element.appendChild(this.element),this.element.addEventListener("click",function(e){for(var r=e.target;r&&r.hasAttribute&&!r.hasAttribute("data-control-id");)r=r.parentNode;if(r.hasAttribute&&r.hasAttribute("data-control-id")){var i=r.getAttribute("data-control-id"),n=t.instance.config.controls[i].onClick;OrgChart._onClickHandler(t.instance,i,n,void 0,void 0)}})}},OrgChart.controlsUI.prototype.hide=function(){null!=this.element&&this.element.parentElement.removeChild(this.element)},OrgChart.circleMenuUI=function(){},OrgChart.circleMenuUI.prototype.init=function(t,e){this.obj=t,this.menu=e,this._menu=null,this._buttonsInterval=[],this._linesInterval=[],this._event_id=OrgChart._guid()},OrgChart.circleMenuUI.prototype.show=function(t,e){this._show(t,e)},OrgChart.circleMenuUI.prototype.isVisible=function(){return null!==this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_wrraper_id+"]")},OrgChart.circleMenuUI.prototype._show=function(t,e){var r=this,i=this.obj.getNode(t),n=OrgChart.t(i.templateName,i.min,this.obj.getScale());if(!OrgChart.isNEU(n.nodeCircleMenuButton)){var a=this.obj.getSvg(),o=this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_id+'="'+t+'"]'),s=this.obj.getNodeElement(t),l=OrgChart._getTransform(o),h=OrgChart._getTransform(s),c=l[4]+h[4],d=l[5]+h[5],g=o.querySelectorAll("line"),p=this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_wrraper_id+"]");if(OrgChart.isNEU(p)||p.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id)!=t){this.hide(),e||(e=this.menu);var u={nodeId:t,menu:e},f=OrgChart.events.publish("show",[this,u]);if(this._menu=e,!1===f)return!1;for(var m=0,C=Object.keys(u.menu).length,b=2*n.nodeCircleMenuButton.radius+4,v=2*Math.PI*b,x=v/C-(2*n.nodeCircleMenuButton.radius+2);x<0;)b+=8,x=(v=2*Math.PI*b)/C-(2*n.nodeCircleMenuButton.radius+2);for(var O in(p=document.createElementNS("http://www.w3.org/2000/svg","g")).setAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id,t),p.setAttribute("transform","matrix(1,0,0,1,"+c+","+d+")"),a.appendChild(p),u.menu){var y=u.menu[O].icon,_=u.menu[O].color,w=u.menu[O].text;"function"==typeof y&&(y=y()),"function"==typeof _&&(_=_()),"function"==typeof w&&(w=w());var k=document.createElementNS("http://www.w3.org/2000/svg","g");k.setAttribute("transform","matrix(1,0,0,1,0,0)"),k.setAttribute(OrgChart.attr.control_node_circle_menu_name,O),k.style.cursor="pointer";var S=document.createElementNS("http://www.w3.org/2000/svg","title");OrgChart.isNEU(w)||(S.innerHTML=w);var I=document.createElementNS("http://www.w3.org/2000/svg","circle");I.setAttribute("cx",0),I.setAttribute("cy",0),I.setAttribute("r",n.nodeCircleMenuButton.radius),I.setAttribute("fill",_),I.setAttribute("stroke-width","1"),I.setAttribute("stroke",n.nodeCircleMenuButton.stroke),k.appendChild(I),k.appendChild(S),k.innerHTML+=y,p.appendChild(k);var L=k.getElementsByTagName("svg")[0];if(L.setAttribute("pointer-events","none"),L){var A=parseInt(L.getAttribute("width")),E=parseInt(L.getAttribute("height"));L.setAttribute("x",-A/2),L.setAttribute("y",-E/2)}var N=m*Math.PI/(C/2);m++;var M=Math.cos(N)*b,T=Math.sin(N)*b;this._buttonsInterval.push(OrgChart.animate(k,{transform:[1,0,0,1,0,0]},{transform:[1,0,0,1,M,T]},250,OrgChart.anim.outBack,function(t){var e=t[0].getAttribute(OrgChart.attr.control_node_circle_menu_name),i=t[0].parentNode.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id);t[0].addEventListener("mouseenter",function(t){OrgChart.events.publish("mouseenter",[r,{from:i,menuItem:u.menu[e],menuItemName:e,event:t}])}),t[0].addEventListener("mouseout",function(t){OrgChart.events.publish("mouseout",[r,{from:i,menuItem:u.menu[e],menuItemName:e,event:t}])})}))}this._linesInterval.push(OrgChart.animate(g[0],{x1:-n.nodeCircleMenuButton.radius/2,y1:-6,x2:n.nodeCircleMenuButton.radius/2,y2:-6},{x1:-7,y1:-7,x2:7,y2:7},500,OrgChart.anim.inOutSin)),this._linesInterval.push(OrgChart.animate(g[1],{x1:-n.nodeCircleMenuButton.radius/2,y1:0,x2:n.nodeCircleMenuButton.radius/2,y2:0},{x1:0,y1:0,x2:0,y2:0},500,OrgChart.anim.inOutSin)),this._linesInterval.push(OrgChart.animate(g[2],{x1:-n.nodeCircleMenuButton.radius/2,y1:6,x2:n.nodeCircleMenuButton.radius/2,y2:6},{x1:-7,y1:7,x2:7,y2:-7},500,OrgChart.anim.inOutSin))}else this.hide()}},OrgChart.circleMenuUI.prototype.hide=function(){for(var t=this._buttonsInterval.length-1;t>=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),n=OrgChart.t(i.templateName,i.min,this.obj.getScale()),a=this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_id+'="'+r+'"]').querySelectorAll("line");a[0].setAttribute("x1",-n.nodeCircleMenuButton.radius/2),a[0].setAttribute("x2",n.nodeCircleMenuButton.radius/2),a[0].setAttribute("y1",-6),a[0].setAttribute("y2",-6),a[1].setAttribute("x1",-n.nodeCircleMenuButton.radius/2),a[1].setAttribute("x2",n.nodeCircleMenuButton.radius/2),a[1].setAttribute("y1",0),a[1].setAttribute("y2",0),a[2].setAttribute("x1",-n.nodeCircleMenuButton.radius/2),a[2].setAttribute("x2",n.nodeCircleMenuButton.radius/2),a[2].setAttribute("y1",6),a[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"]'),n=this.div.querySelector("["+OrgChart.attr.tlbr+'="fit"]'),a=this.div.querySelector("["+OrgChart.attr.tlbr+'="fullScreen"]'),o=this.div.querySelector("["+OrgChart.attr.tlbr+'="expand"]'),s=this;r&&r.addEventListener("click",function(){s.obj.zoom(!0,null,!0)}),i&&i.addEventListener("click",function(){s.obj.zoom(!1,null,!0)}),n&&n.addEventListener("click",function(){s.obj.fit()}),a&&a.addEventListener("click",function(){s.obj.toggleFullScreen()}),o&&o.addEventListener("click",function(){s.obj.expand(null,"all")}),this.layoutBtn&&this.layoutBtn.addEventListener("click",function(){s._visible?s.hideLayout():s.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),s.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,n=this.obj.height()/2-r.offsetHeight/2;r.style.left=i+"px",r.style.top=n+"px";var a=r.offsetWidth;return r.style.width="20px",OrgChart.animate(r,{opacity:0,width:10},{opacity:1,width:a},this.obj.config.anim.duration,this.obj.config.anim.func),!0},void 0===OrgChart&&(OrgChart={}),OrgChart.icon={},OrgChart.icon.png_export=OrgChart.icon.png_preview=OrgChart.icon.pngpreview=OrgChart.icon.png=function(t,e,r){return''},OrgChart.icon.pdf_export=OrgChart.icon.pdf_preview=OrgChart.icon.pdfpreview=OrgChart.icon.pdf=function(t,e,r){return''},OrgChart.icon.svg_export=OrgChart.icon.svg_preview=OrgChart.icon.svg=function(t,e,r){return''},OrgChart.icon.csv_export=OrgChart.icon.csv=function(t,e,r){return''},OrgChart.icon.json_export=OrgChart.icon.json=function(t,e,r){return''},OrgChart.icon.excel=function(t,e,r){return`\n \n`},OrgChart.icon.pp_export=OrgChart.icon.pp_preview=OrgChart.icon.pppreview=OrgChart.icon.powerpoint=function(t,e,r){return`\n\n`},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_export=OrgChart.icon.xml=function(t,e,r){return''},OrgChart.icon.visio_export=OrgChart.icon.visio=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n `},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,n){return null==i&&(i=0),null==n&&(n=0),`\n \n `},OrgChart.icon.user=function(t,e,r,i,n){return OrgChart.isNEU(i)&&(i=0),OrgChart.isNEU(n)&&(n=0),`\n \n \n `},OrgChart.icon.close=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n `},OrgChart.icon.undo=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n `},OrgChart.icon.redo=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n `},OrgChart.icon.send=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n `},OrgChart.icon.x=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n `},OrgChart.icon.x=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n `},OrgChart.icon.fit=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n`},OrgChart.icon.expand_all=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n`},OrgChart.icon.full_screen=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n\n\n\n`},OrgChart.icon.zoom_in=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n `},OrgChart.icon.zoom_out=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n `},OrgChart.icon.layout_normal=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n `},OrgChart.icon.layout_right_offset=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n \n `},OrgChart.icon.layout_left_offset=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n \n `},OrgChart.icon.layout_mixed=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n `},OrgChart.icon.layout_tree=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n `},OrgChart.icon.layout_grid=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n \n \n \n \n \n `},OrgChart.icon.layout_grid=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n \n \n \n \n \n `},OrgChart.icon.cursor=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n `},OrgChart.prototype.exportPDFProfile=function(t,e){console.warn('The "exportPDFProfile" is depricated. Use "exportToPDFProfile" instead.'),t=this._defaultExportProfileOptions(t,"pdf"),this._exportProfile(t,e)},OrgChart.prototype.exportPDFPreview=function(t){console.warn('The "chart.exportPDFPreview" is depricated. Use "chart.pdfPreviewUI.show" instead.'),OrgChart.pdfPrevUI.show(this,t)},OrgChart.prototype.exportPNGProfile=function(t,e){console.warn('The "exportPNGProfile" is depricated. Use "exportToPDFProfile" instead.'),t=this._defaultExportProfileOptions(t,"png"),this._exportProfile(t,e)},OrgChart.prototype.exportPDF=function(t,e){console.warn('The "exportPDF" is depricated. Use "exportToPDF" instead.'),t=this._defaultExportOptions(t,"pdf"),this._export(t,e)},OrgChart.exportPDFFromCharts=function(t,e,r,i){console.warn('The "exportPDFFromCharts" is depricated. Use "chart1.exportToPDF" with pages instead.'),OrgChart._exportPDFFromChartsFetchSequentially(0,t,[],e,r,i)},OrgChart.prototype.exportPNG=function(t,e){console.warn('The "exportPNG" is depricated. Use "exportToPNG" instead.'),t=this._defaultExportOptions(t,"png"),this._export(t,e)},OrgChart.prototype.exportSVG=function(t,e){console.warn('The "exportSVG" is depricated. Use "exportToSVG" instead.'),t=this._defaultExportOptions(t,"svg"),this._export(t,e)},OrgChart.prototype.exportVisio=function(t,e){console.warn('The "exportVisio" is depricated. Use "exportToVisio" instead.'),this.exportToVisio(t,e)},OrgChart._exportPDFFromChartsFetchWithCallback=function(t,e){t.type&&"profile"==t.type.toLowerCase()?t.chartInstance.exportPDFProfile(t,function(t,r){e(r)}):t.chartInstance.exportPDF(t,function(t,r){e(r)})},OrgChart._exportPDFFromChartsFetchSequentially=function(t,e,r,i,n,a){if(t>=e.length){var o=[];for(var s of e)-1==o.indexOf(s.chartInstance)&&o.push(s.chartInstance),delete s.chartInstance;for(var l of(r=JSON.stringify(r),o))OrgChart.loading.show(l);return null==i&&(i="OrgChart.pdf"),null==n&&(n=!1),void OrgChart._ajax(l.config.exportUrl+"/v4","POST",r,"arraybuffer",function(t){for(var e of o)OrgChart.loading.hide(e);a?a(t):OrgChart._downloadFile("application/pdf",t,i,n,"pdf")})}OrgChart._exportPDFFromChartsFetchWithCallback(e[t],function(o){r.push(o),OrgChart._exportPDFFromChartsFetchSequentially(t+1,e,r,i,n,a)})},OrgChart.prototype._defaultExportOptions=function(t,e){return null==t&&(t={}),"svg"==e?(t.ext="svg",t.mime="image/svg+xml"):"visio"==e?(t.ext="vsdx",t.mime="application/vnd.visio"):"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="visio"==e?25: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,parentLevels:t.parentLevels,childLevels:t.childLevels,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,n){var a=document.createElement("div");if(a.innerHTML=i,t.padding>0){var o=a.querySelector("svg"),s=OrgChart._getViewBox(o);s[0]-=t.padding,s[1]-=t.padding,s[2]+=2*t.padding,s[3]+=2*t.padding,o.setAttribute("viewBox",s.join()),o.setAttribute("width",s[2]),o.setAttribute("height",s[3])}if("svg"==t.ext||"vsdx"==t.ext){(o=a.querySelector("svg")).classList.add("boc-"+r.config.mode);var l={content:a.innerHTML,options:t,styles:""};if(!e){var h=OrgChart.events.publish("exportstart",[r,l]);if(!1===h)return!1}var c=r.element.querySelector("[data-boc-styles]");if(c&&(l.styles+=c.outerHTML),l.styles&&(a.childNodes[0].insertAdjacentHTML("afterbegin",l.styles),l.content=a.innerHTML),"svg"==t.ext)if(e)e(l);else{if(!1===(h=OrgChart.events.publish("exportend",[r,l])))return!1;OrgChart._downloadFile(t.mime,l.content,l.options.filename,l.options.openInNewTab,l.options.ext)}else if("vsdx"==t.ext){OrgChart.loading.show(r);var d=JSON.stringify({svg:l.content,fileName:l.options.filename});OrgChart._ajax(r.config.serverUrl+"/Export/Visio","POST",d,"arraybuffer",function(i){if(OrgChart.loading.hide(r),e)e(l,i);else{if(!1===OrgChart.events.publish("exportend",[r,i]))return!1;OrgChart._downloadFile(t.mime,i,l.options.filename,l.options.openInNewTab,l.options.ext)}})}}else r._pages(t,a.querySelector("svg"),n,function(i){var n={content:a.innerHTML,options:t,pages:i,styles:""},o=OrgChart.events.publish("exportstart",[r,n]),s=r.element.querySelector("[data-boc-styles]");if(s&&(n.styles+=s.outerHTML),!1===o)return!1;e||OrgChart.loading.show(r),e?e(r,n,a.querySelector("svg")):(n=JSON.stringify(n),OrgChart._ajax(r.config.exportUrl+"/v4","POST",n,"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.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.exportToCSV=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 n={ext:"csv",filename:t,options:e,nodes:i};if(!1===OrgChart.events.publish("exportstart",[this,n]))return!1;var a=OrgChart._json2csv(n.nodes),o={ext:n.ext,filename:n.filename,options:e,nodes:n.nodes,content:a};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.exportToXML=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 n={ext:"xml",filename:t,options:e,nodes:i};if(!1===OrgChart.events.publish("exportstart",[this,n]))return!1;var a=OrgChart._json2xml(n.nodes),o={ext:n.ext,filename:n.filename,options:e,nodes:n.nodes,content:a};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.exportToJSON=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 n={ext:"json",filename:e.filename,options:e,nodes:i};if(!1===OrgChart.events.publish("exportstart",[this,n]))return!1;var a={ext:n.ext,filename:n.filename,options:e,nodes:n.nodes,content:JSON.stringify(n.nodes)};if(!1===OrgChart.events.publish("exportend",[this,a]))return!1;OrgChart._downloadFile("application/json",a.content,a.options.filename,a.options.openInNewTab,a.ext)},OrgChart._exportIterateForJSON_XML_CSV=function(t,e,r,i){if(Array.isArray(e))for(var n=0;nd.h){b=!1;break}var k=(x[_].minY-x[w].minY)/(100/r);if(_==O-1&&(k=(x[_].maxY-x[w].minY)/(100/r)),k>d.h)break;_++}if(!b)break;var S=(_==O?x[_-1].maxY:x[_-1].minY)-x[w].minY;if(0==S){b=!1;break}if(I=(I=[f,x[w].minY,p,S]).join(),C.push({vb:I,innerSize:{w:d.x,h:S/(100/r)-1},size:g}),_==O)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=[];fPage {current-page} of {total-pages}':"png"==e||"svg"==e?t.footer="":"pptx"==e?t.footer='Slide {current-page} of {total-pages}':"vstx"==e&&(t.footer="")),null==t.expandChildren&&(t.expandChildren=!1),null==t.childLevels&&(t.childLevels=null),null==t.parentLevels&&(t.parentLevels=null),null==t.min&&(t.min=!0),null==t.format&&("pdf"==e?t.format="A4":"pptx"==e&&(t.format="Widescreen")),null==t.fileName&&(t.fileName="OrgChart."+e),null==t.openInNewTab&&(t.openInNewTab=!1),null==t.width&&null==t.height&&("png"==e||"svg"==e||"vstx"==e||"pdf"==e&&"auto"==t.format?(t.width="auto",t.height="auto"):(OrgChart.Screen={width:screen.height/2,height:screen.width/2},t.landscape?(t.width=OrgChart[t.format].height,t.height=OrgChart[t.format].width):(t.width=OrgChart[t.format].width,t.height=OrgChart[t.format].height))),null==t.margin&&(t.margin=[30,20,30,20]),null==t.padding&&(t.padding=0),t.pages||(t.pages=[{}]),t},OrgChart.prototype._requestToExportPDF=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/PDF",e.fileName,t,r)},OrgChart.prototype._requestToExportPNG=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/PNG",e.fileName,t,r)},OrgChart.prototype._requestToExportVisio=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/VSTX",e.fileName,t,r)},OrgChart.prototype._requestToExportSVG=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/SVG",e.fileName,t,r)},OrgChart.prototype._requestToExportPowerPoint=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/PowerPoint",e.fileName,t,r)},OrgChart.__requestExport=function(t,e,r,i){var n={filename:e,pages:r};OrgChart._ajax(t,"POST",JSON.stringify(n),"arraybuffer",function(t){i(t)})},OrgChart.prototype._createExportPages=function(t,e,r){var i=[];if(e.pages.length)for(var n=0;n');var o=i.pages[r],s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),document.body.appendChild(s);var l=OrgChart._getSvgAttributes(e);a?"auto"==i.width?o.width=1e3:o.width=i.width:"auto"==i.width?o.width=l.width+o.margin[3]+o.margin[1]:o.width=i.width;var h=document.createElementNS("http://www.w3.org/2000/svg","g");h.innerHTML=`${o.header.replaceAll("{current-page}",r+1).replaceAll("{total-pages}",i.pages.length)}`,s.appendChild(h),OrgChart._setYAttrToTextElements(o,i,h);var c=h.getBoundingClientRect();h.setAttribute("transform",`matrix(1,0,0,1,${o.margin[3]},${o.margin[0]})`);var d=document.createElementNS("http://www.w3.org/2000/svg","g");d.innerHTML=`${o.footer.replaceAll("{current-page}",r+1).replaceAll("{total-pages}",i.pages.length)}`,s.appendChild(d),OrgChart._setYAttrToTextElements(o,i,d);var g,p=d.getBoundingClientRect();if(a?"auto"==i.height?o.height=1e3:o.height=i.height:"auto"==i.height?o.height=l.height+o.margin[0]+o.margin[2]+c.height+p.height:o.height=i.height,d.setAttribute("transform",`matrix(1,0,0,1,${o.margin[3]},${o.height-o.margin[2]-p.height})`),s.classList.add("boc-"+this.config.mode),document.body.removeChild(s),!o.isProfile){var u=(o.width-o.margin[3]-o.margin[1])/l.width,f=(o.height-o.margin[0]-o.margin[2]-c.height-p.height)/l.height,m=Math.min(u,f,1);l.width*=m,l.height*=m,l.viewBox[0]-=o.padding,l.viewBox[1]-=o.padding,l.viewBox[2]+=2*o.padding,l.viewBox[3]+=2*o.padding,l.x=(o.width-l.width)/2,l.y=o.margin[0]+c.height+(o.height-o.margin[0]-c.height-o.margin[2]-p.height-l.height)/2}g=n?OrgChart._isSVG(e)?e:`${e}`:OrgChart._setSvgAttributes(e,l);var C=o.width,b=o.height;return"pdf"!=t||o.isProfile||(C+=2,b+=2),s.setAttribute("width",C),s.setAttribute("height",b),s.innerHTML=g+s.innerHTML,s},OrgChart.prototype._createProfileSvg=function(t,e){var r=this.editUI.content(e.nodeId,!0,!0,"100%",!0).element;return OrgChart.input.init(r),` \n \n ${r.outerHTML}\n `},OrgChart.prototype.___createExportPages=function(t,e,r,i,n){if(e>=i.pages.length-1){var a={pages:r,options:i,styles:""};if(!1===OrgChart.events.publish("exportstart",[this,a]))return!1;var o=this.mainElement.querySelector("[data-boc-styles]");if(o&&(a.styles+=o.outerHTML),a.styles)for(var s=0;s${this.options.landscape?this.locPortrait:this.locLandscape} `),this.element.innerHTML=`
\n
\n \n
\n
\n \n ${r} \n \n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
`,this.instance.leftElement.appendChild(this.element),this.instance.leftElement.style.display="block",this.instance.leftElement.querySelector("[data-boc-export-btnnewpage]").addEventListener("click",function(t){e._addPage()});var i=this.instance.leftElement.querySelector("[data-boc-export-landcapeportrait]");i&&i.addEventListener("click",function(t){e._toggleLanscape(this)}),this.instance.leftElement.querySelector("[data-boc-export-pages]").addEventListener("click",function(t){for(var r,i=t.target;i&&i.hasAttribute&&!i.hasAttribute("data-boc-export-page");)i=i.parentNode;i&&i.hasAttribute&&i.hasAttribute("data-boc-export-page")&&(r=i.getAttribute("data-boc-export-page")),t.target.hasAttribute&&(t.target.hasAttribute("data-export-remove")?e._removePage(r):t.target.hasAttribute("data-export-child-plus")?e._incrementDecrementChildLevel(r,!0):t.target.hasAttribute("data-export-child-minus")?e._incrementDecrementChildLevel(r,!1):t.target.hasAttribute("data-export-parent-plus")?e._incrementDecrementParentLevel(r,!0):t.target.hasAttribute("data-export-parent-minus")?e._incrementDecrementParentLevel(r,!1):t.target.hasAttribute("data-export-profiletree")?e._toggelePrintTreeOrProfile(r,!1):e._selectPage(r))});var n=this.instance.leftElement.querySelector("[data-boc-export-cancel]");n&&n.addEventListener("click",function(t){e.hide()});var a=this.instance.leftElement.querySelector("[data-boc-export-export]");a&&a.addEventListener("click",function(t){e.instance.powerPointPreviewUI.isVisible()?e.instance.exportToPowerPoint(e.options):e.instance.pdfPreviewUI.isVisible()?e.instance.exportToPDF(e.options):e.instance.pngPreviewUI.isVisible()?e.instance.exportToPNG(e.options):e.instance.svgPreviewUI.isVisible()&&e.instance.exportToSVG(e.options)}),this.interval&&(clearTimeout(this.interval),this.interval=null),this.interval=OrgChart.animate(this.element,{opacity:0},{opacity:1},300,OrgChart.anim.outSin,function(){e._draw(t)})},OrgChart.exportUI.prototype._draw=function(t){var e=this.instance.leftElement.querySelector("[data-boc-export-pages]");e.innerHTML="";for(var r=0;r \n \n `;"pdf"==this.type&&!OrgChart.isNEU(this.options.pages[r].nodeId)&&(!this.options.pages[r].content||this.options.pages[r].isProfile&&this.options.pages[r].content)&&(l+=`
\n \n
`),this.options.pages[r].isProfile||OrgChart.isNEU(this.options.pages[r].nodeId)||(l=`
\n \n ${null==this.options.pages[r].parentLevels?"all":this.options.pages[r].parentLevels} ${this.locParentLevels}\n
\n
\n \n ${null==this.options.pages[r].childLevels?"all":this.options.pages[r].childLevels} ${this.locChildLevels}\n
`+l),e.innerHTML+=`
\n ${o}\n ${l} \n
`}this._selectPage(this.selectedIndex)},OrgChart.exportUI.prototype._toggleLanscape=function(t){var e=this;this.options.landscape=!this.options.landscape,this.options.width=void 0,this.options.height=void 0,this.options=OrgChart._setDefaultOptions(this.options,this.type),t.innerHTML=this.options.landscape?this.locPortrait:this.locLandscape,this.instance._createExportPages(this.type,this.options,function(t){e._draw(t),e._selectPage(e.options.pages.length-1)})},OrgChart.exportUI.prototype._addPage=function(t){var e=this;this.options.pages.push({content:""}),this.instance._createExportPages(this.type,this.options,function(t){e._draw(t),e._selectPage(e.options.pages.length-1);var r=e.element.querySelector(".boc-export-middle");OrgChart.animate(r,{scrollTop:r.scrollTop},{scrollTop:r.scrollHeight},600,OrgChart.anim.outSin)})},OrgChart.exportUI.prototype._removePage=function(t){t=parseInt(t);var e=this;t<=e.selectedIndex&&(e.selectedIndex--,e.selectedIndex<0&&(e.selectedIndex=0)),this.options.pages.splice(t,1),this.instance._createExportPages(this.type,this.options,function(t){e._draw(t),e._selectPage(e.selectedIndex)})},OrgChart.exportUI.prototype._incrementDecrementChildLevel=function(t,e){var r=this;t${this.locClickToAdd}`),n.classList.add("boc-export-selected"),this.selectedIndex=t}},void 0===OrgChart&&(OrgChart={}),OrgChart.events=function(){var t={};return{on:function(e,r,i){Array.isArray(t[e])||(t[e]=[]),t[e].push({listener:r,event_id:i})},removeAll:function(e){Array.isArray(t[e])||(t[e]=[]),t[e]=[]},remove:function(e,r,i){var n=!1;if(t[e]&&Array.isArray(t[e])&&t[e].length>0)for(var a=t[e].length-1;a>=0;a--)(!OrgChart.isNEU(i)&&!OrgChart.isNEU(r)&&t[e][a].event_id==i&&t[e][a].listener==r||!OrgChart.isNEU(i)&&OrgChart.isNEU(r)&&t[e][a].event_id==i||OrgChart.isNEU(i)&&!OrgChart.isNEU(r)&&t[e][a].listener==r||OrgChart.isNEU(i)&&OrgChart.isNEU(r))&&(t[e].splice(a,1),n=!0);return n},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=[],n=0;n0){var o=!0;for(n=0;n0?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;e0)){for(var r=e.target;r!=t;){if(r.hasAttribute(OrgChart.attr.control_expcoll_id)){var i=r.getAttribute(OrgChart.attr.control_expcoll_id),n=this.getNode(i);return void this._expCollHandler(n.id)}if(r.hasAttribute(OrgChart.attr.node_id)){i=r.getAttribute(OrgChart.attr.node_id),n=this.getNode(i);return void this._nodeClickHandler(n.id,e)}if(r.hasAttribute(OrgChart.attr.control_node_menu_id)){e.stopPropagation(),e.preventDefault();i=r.getAttribute(OrgChart.attr.control_node_menu_id),n=this.getNode(i);return void this._nodeMenuClickHandler(n.id,r,e)}if(r.hasAttribute(OrgChart.attr.control_node_circle_menu_id)){e.stopPropagation(),e.preventDefault();i=r.getAttribute(OrgChart.attr.control_node_circle_menu_id);return void this._nodeCircleMenuClickHandler(i)}if(r.hasAttribute(OrgChart.attr.control_node_circle_menu_name))return e.stopPropagation(),void this._nodeCircleMenuItemClickHandler(r,e);if(r.hasAttribute(OrgChart.attr.control_add))return void this._lonelyButtonHandler();if(r.hasAttribute(OrgChart.attr.control_up_id)){i=r.getAttribute(OrgChart.attr.control_up_id);return e.stopPropagation(),e.preventDefault(),void this._upHandler(i)}if(r.hasAttribute(OrgChart.attr.c_link_from))return void OrgChart.events.publish("clink-click",[this,{from:r.getAttribute(OrgChart.attr.c_link_from),to:r.getAttribute(OrgChart.attr.c_link_to),event:e}]);if(r.hasAttribute(OrgChart.attr.s_link_from))return void OrgChart.events.publish("slink-click",[this,{from:r.getAttribute(OrgChart.attr.s_link_from),to:r.getAttribute(OrgChart.attr.s_link_to),event:e}]);if(r.hasAttribute("data-ctrl-n-dotted-close")){i=r.getAttribute("data-ctrl-n-dotted-close");return void this.minimize(i)}if(r.hasAttribute("data-ctrl-n-dotted-open")){i=r.getAttribute("data-ctrl-n-dotted-open");return void this.maximize(i)}r=r.parentNode}OrgChart.events.publish("canvas-click",[this,{event:e}])}},OrgChart.prototype._mouseDownHandler=function(t,e,r){var i=this;OrgChart.HIDE_EDIT_FORM_ON_PAN&&this.editUI.hide(),OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE&&this.searchUI.hide(),this.nodeMenuUI.hide(),this.nodeContextMenuUI.hide(),this.menuUI.hide();var n=this.getViewBox(),a=this.getScale(),o=OrgChart._getClientTouchesXY(e,0),s=OrgChart._getClientTouchesXY(e,1),l={diffX:0,diffY:0,x0:o.x,y0:o.y,type:this.config.enablePan?"pan":"pan-not-enabled",viewBoxLeft:n[0],viewBoxTop:n[1]};e.touches&&e.touches.length>1&&(l.type="pinch",l.dist=Math.sqrt((o.x-s.x)*(o.x-s.x)+(o.y-s.y)*(o.y-s.y)));var h=0,c=function(t){var e=OrgChart._getClientTouchesXY(t,0);if(l&&"pan"==l.type){i._hideBeforeAnimation(),l.diffX=e.x-l.x0,l.diffY=e.y-l.y0,h=Math.max(Math.abs(l.diffY),Math.abs(l.diffX));var r=-l.diffY/a+l.viewBoxTop,o=-l.diffX/a+l.viewBoxLeft;h>3&&(i._hideBeforeAnimation(),i._changeCursorOnPanStart(n,a,t),i._move(r,o,n))}else if(l&&"pinch"==l.type){var s=OrgChart._getClientTouchesXY(t,1),c=Math.sqrt((e.x-s.x)*(e.x-s.x)+(e.y-s.y)*(e.y-s.y)),d=1+(c-l.dist)/(l.dist/100)/100;l.dist=c;var g=OrgChart._pinchMiddlePointInPercent(i.element,i.width(),i.height(),t);i.zoom(d,g)}},d=function(e){if(h<3&&"pinch"!=l.type&&(null==e.touches||e.touches.length<=1))i._clickHandler(t,e);else if(h>10)if("pan"==l.type&&i.config.sticky){i.getScale();setTimeout(function(){OrgChart._moveToBoundaryArea(t,i.getViewBox(),i.response.boundary,function(){i._draw(!0,OrgChart.action.pan)})},0)}else"pan"!=l.type||i.config.sticky||setTimeout(function(){i._draw(!0,OrgChart.action.pan)},0);"pan"==l.type&&i._changeCursorOnPanEnd(),l=null,t.removeEventListener(r.move,c),t.removeEventListener(r.up,d),r.leave&&t.removeEventListener(r.leave,d),r.touchstart&&t.removeEventListener(r.touchstart,d)};t.addEventListener(r.move,c,{passive:!0}),t.addEventListener(r.up,d),r.leave&&t.addEventListener(r.leave,d),r.touchstart&&t.addEventListener(r.touchstart,d,{passive:!0})},OrgChart.prototype._changeCursorOnPanStart=function(t,e,r){var i=this.getPointerElement();if(i){var n=OrgChart._getOffsetXY(this.element,r),a=n.x/e+t[0]-16/e,o=n.y/e+t[1]-16/e;i.style.display="inherit",i.setAttribute("transform","matrix(0,0,0,0,"+a+","+o+")"),OrgChart.animate(i,{transform:[0,0,0,0,a,o],opacity:0},{transform:[1/e,0,0,1/e,a,o],opacity:1},300,OrgChart.anim.outBack)}else this.element.style.cursor="move"},OrgChart.prototype._changeCursorOnPanEnd=function(){var t=this.getPointerElement();t?t.style.display="none":this.element.style.cursor="initial"},OrgChart.prototype._globalMouseDownHandler=function(t,e){var r={move:"mousemove",up:"mouseup",leave:"mouseleave"};-1!=e.type.indexOf("touch")&&(1==e.touches.length?this._touch={x:e.touches[0].clientX,y:e.touches[0].clientY}:this._touch=null,r={move:"touchmove",up:"touchend",touchstart:"touchstart"});for(var i=e.target;i!=t&&!i.hasAttribute(OrgChart.attr.control_node_menu_id)&&!i.hasAttribute(OrgChart.attr.control_node_circle_menu_id);){if(i.hasAttribute(OrgChart.attr.node_id)&&(this.config.enableDragDrop||this.config.movable)){if(null==e.touches||e.touches.length<=1)return void this._nodeMouseDownHandler(i,e,r)}else if(i.hasAttribute(OrgChart.attr.control_node_circle_menu_name)&&(e.stopPropagation(),null==e.touches||e.touches.length<=1))return void this._nodeCircleNodeMenuItemMouseDownHandler(t,i,e,r);i=i.parentNode}e.stopPropagation(),this._mouseDownHandler(t,e,r)},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),n=this.getNode(i);return void this._nodeContextHandler(n.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 n=0;n0?e++:e--,l+=e,i.zoom(1-e/12/50,r),parseInt(l)==parseInt(s)?n=!1:h(t)}()}},OrgChart.prototype._nodeCircleNodeMenuItemMouseDownHandler=function(t,e,r,i){var n=e.parentNode.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id),a=e.getAttribute(OrgChart.attr.control_node_circle_menu_name),o=this.nodeCircleMenuUI._menu[a];if(o.draggable){var s=this,l=OrgChart._getClientXY(r),h=this.getNode(n);e._dragEventFired=!1;var c=s.getScale(),d=null,g=null;document.body.style.mozUserSelect=document.body.style.webkitUserSelect=document.body.style.userSelect="none";var p=this.getSvg(),u={x:l.x,y:l.y},f=e.cloneNode(!0);p.insertBefore(f,p.firstChild);var m=OrgChart._getTransform(f),C=m[4],b=m[5],v=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)}(e);f.setAttribute("transform","matrix(1,0,0,1,"+(C+v.x)+","+(b+v.y)+")"),f.style.opacity=.7;var x=function(t,e){if(null!=t){e.classList.remove("boc-drag-over");for(var r=OrgChart.getStParentNodes(s.getNode(d)),i=0;iOrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE||Math.abs(r.y-u.y)>OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE))s._gragStartedId=e.parentNode.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id),!1===OrgChart.events.publish("drag",[s.nodeCircleMenuUI,{from:I,menuItem:o,menuItemName:a}])&&y(),e._dragEventFired=!0;f.setAttribute("transform","matrix("+m.toString()+")")}}},y=function(t){if(s.moveEnd(),p.classList&&(p.classList.remove("boc-cursor-grab"),p.classList.remove("boc-cursor-move"),p.classList.remove("boc-cursor-nodrop"),p.classList.remove("boc-cursor-copy")),p.removeEventListener(i.move,O),p.removeEventListener(i.up,y),i.leave&&p.removeEventListener(i.leave,y),h.id==d||null==d)return p.removeChild(f),s._gragStartedId=null,void(e._dragEventFired&&OrgChart.events.publish("drop",[s.nodeCircleMenuUI,{from:h.id,menuItemName:a,menuItem:o,event:t}]));var r=s.getNode(d);OrgChart.events.publish("drop",[s.nodeCircleMenuUI,{from:h.id,to:r.id,menuItem:o,menuItemName:a,event:t}]),x(d,g),p.removeChild(f),s._gragStartedId=null};p.addEventListener(i.move,O),p.addEventListener(i.up,y),i.leave&&p.addEventListener(i.leave,y)}else this._clickHandler(t,r)},OrgChart.prototype._nodeMouseDownHandler=function(t,e,r){var i=t.getAttribute(OrgChart.attr.node_id),n=this.getNode(i);this.config.movable&&!OrgChart.getRootOf(n).stParent?this._movableHandler(t,e,r):this.config.enableDragDrop&&this._dragDropHandler(t,e,r)},OrgChart.prototype._movableHandler=function(t,e,r){var i=this,n=t.getAttribute(OrgChart.attr.node_id),a=[],o=function(t,e){if(Array.isArray(t))for(var r=0;r1)N(e);else if(I){var r=OrgChart._getClientXY(e),o=e.target;OrgChart.isMobile()&&(o=document.elementFromPoint(r.x,r.y));var s=OrgChart._getOffsetXY(i.element,e),c={left:i.width()-(s.x+i.config.padding)<0,right:s.x-i.config.padding<0,up:i.height()-(s.y+i.config.padding)<0,down:s.y-i.config.padding<0};if(c.left||c.right||c.up||c.down){h.classList&&(h.classList.remove("boc-cursor-grab"),h.classList.add("boc-cursor-move"),h.classList.remove("boc-cursor-nodrop"),h.classList.remove("boc-cursor-copy"));for(var v=[],x=[],O=[],y=[],_=0;_OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE||Math.abs(r.y-I.y)>OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE)){if(i._gragStartedId=a[0],!1===OrgChart.events.publish("drag",[i,n,e,a])&&N(),i.config.enableDragDrop)for(_=0;_1)b(e);else if(c){var r=OrgChart._getClientXY(e),i=e.target;OrgChart.isMobile()&&(i=document.elementFromPoint(r.x,r.y));var n=OrgChart._getOffsetXY(l.element,e),C={left:l.width()-(n.x+l.config.padding)<0,right:n.x-l.config.padding<0,up:l.height()-(n.y+l.config.padding)<0,down:n.y-l.config.padding<0};if(C.left||C.right||C.up||C.down){h.classList&&(h.classList.remove("boc-cursor-grab"),h.classList.add("boc-cursor-move"),h.classList.remove("boc-cursor-nodrop"),h.classList.remove("boc-cursor-copy"));var v=d[4],x=d[5],O=c.x,y=c.y,_=r.x,w=r.y;l.moveStart(C,function(t){d[4]=v+t.x,d[5]=x+t.y,c.x=O-t.xWithoutScale,c.y=y-t.yWithoutScale,r.x=_-t.xWithoutScale,r.y=w-t.yWithoutScale,f.setAttribute("transform","matrix("+d.toString()+")")})}else{if(l.moveEnd(),h.classList&&(h.classList.add("boc-cursor-grab"),h.classList.remove("boc-cursor-move"),h.classList.remove("boc-cursor-nodrop"),h.classList.remove("boc-cursor-copy")),m(o,s),o=null,s=null,l.config.enableDragDrop)for(;null!=i&&i!=h;){if(i.hasAttribute&&i.hasAttribute(OrgChart.attr.node_id)){var k=i.getAttribute(OrgChart.attr.node_id);if(l._gragStartedId&&k!=l._gragStartedId){o=k,s=i;break}}i=i.parentNode}if("draging"==o&&(o=null,s=null),null!=o){s.classList.add("boc-drag-over");for(var S=l.getNode(o),I=OrgChart.getStParentNodes(S),L=0;LOrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE||Math.abs(r.y-c.y)>OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE))l._gragStartedId=k,!1===OrgChart.events.publish("drag",[l,k,e])&&b(),t._dragEventFired=!0;f.setAttribute("transform","matrix("+d.toString()+")")}}},b=function(i){if(!t._dragEventFired&&(null==i.touches||i.touches.length<=1)&&l._clickHandler(l.getSvg(),e),l.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),a.id==o||null==o)return t._dragEventFired&&OrgChart.events.publish("drop",[l,a.id,void 0,f,i]),h.removeChild(f),void(l._gragStartedId=null);var n=l.getNode(o);if(!1===OrgChart.events.publish("drop",[l,a.id,n.id,f,i]))return m(o,s),h.removeChild(f),void(l._gragStartedId=null);if(l.canUpdateLink(a.id,o)){var c=l.get(a.id);c.pid=o,c.stpid=null,null!=c.movex&&(c.movex=void 0),null!=c.movey&&(c.movey=void 0),l.updateNode(c,null,!0)}else h.removeChild(f),m(o,s);l._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&&0!=t&&0!=e){var r=this.getViewBox().slice(0),i=t/r[2],n=e/r[3];Math.abs(this._lastSize.width-t)>Math.abs(this._lastSize.height-e)?r[3]=e/i:r[2]=t/n,this.nodeMenuUI.hide(),this.nodeContextMenuUI.hide(),this.menuUI.hide(),this.nodeCircleMenuUI.hide(),this.setViewBox(r),this.xScrollUI.create(t),this.yScrollUI.create(e),this._draw(!0,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){if(this.powerPointPreviewUI.isVisible())this.powerPointPreviewUI._updateSlectedPage(t),this.ripple(t,e.clientX,e.clientY);else if(this.pdfPreviewUI.isVisible())this.pdfPreviewUI._updateSlectedPage(t),this.ripple(t,e.clientX,e.clientY);else if(this.svgPreviewUI.isVisible())this.svgPreviewUI._updateSlectedPage(t),this.ripple(t,e.clientX,e.clientY);else if(this.pngPreviewUI.isVisible())this.pngPreviewUI._updateSlectedPage(t),this.ripple(t,e.clientX,e.clientY);else{var r=this.getNodeElement(t);if(r&&r._dragEventFired)return void(r._dragEventFired=!1);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),n=this.nodeCircleMenuUI._menu[i];OrgChart.events.publish("click",[this.nodeCircleMenuUI,{nodeId:r,menuItemName:i,menuItem:n,event:e}])},OrgChart.prototype._nodeCircleMenuClickHandler=function(t){if(OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE&&this.searchUI.hide(),this.nodeMenuUI.hide(),this.menuUI.hide(),this.nodeContextMenuUI.isVisible())this.nodeContextMenuUI.hide();else{var e=this.getNode(t),r=null;if(Array.isArray(e.tags))for(var i=0;i=OrgChart.MINIMUM_SYMBOLS_IN_SEARCH_INPUT&&e._search()});var 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[0].setAttribute("data-selected","yes"):t.length>0&&r.nextSibling&&r.nextSibling.setAttribute&&(r.removeAttribute("data-selected"),r.nextSibling.setAttribute("data-selected","yes"))},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[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 n=e.lastSearch[i],a="";if(r){var o=e.instance._get(n.id);"function"==typeof r?a=r(e.instance,e.instance.getNode(n.id),o):o[r]&&(a=o[r])}var s="",l="";e.instance.config.searchDisplayField==n.__searchField?s=n.__searchMarks:e.instance.config.searchDisplayField?(s=n[e.instance.config.searchDisplayField],OrgChart.isNEU(s)&&(s=""),l=n.__searchMarks):s=n.__searchMarks;var h={img:a,nodeId:n.id,first:s,second:l,searchItem:n,html:OrgChart.searchUI.createItem(a,n.id,s,l)};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]"),n=0;n${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,n,a,o,s){var l=this;OrgChart.state._get(this.config.state,e,r,function(h){l.state=h,l.action=n,l.actionParams=a,n!=OrgChart.action.init||!l.state||a&&a.method&&"fit"==a.method?(l.viewBox=i,l.vbIsInitializedFromState=!1):(l.viewBox=l.state.vb,l.vbIsInitializedFromState=!0,Array.isArray(l.state.roots)&&(l.config.roots=l.state.roots));var c=l.maxX,d=l.maxY,g=l.minX,p=l.minY,u=l.bordersByRootIdAndLevel,f=l.roots,m=l.nodes;if(t){var C=OrgChart.manager._getResponse(e,r,l.visibleNodeIds,l.config,c,d,g,p,l.viewBox,f,l.action,l.actionParams,m,l.oldNodes,l.vbIsInitializedFromState);n!=OrgChart.action.exporting&&(l.maxX=c,l.maxY=d,l.minX=g,l.minY=p,l.roots=f,l.nodes=m,l.visibleNodeIds=C.visibleNodeIds),C.bordersByRootIdAndLevel=u,C.roots=f,C.adjustify={x:0,y:0},l.state&&(C.adjustify=l.state.adjustify),o(C)}else l.oldNodes=m||null,l._read(function(t){c=t.maxX,d=t.maxY,g=t.minX,p=t.minY,u=t.bordersByRootIdAndLevel,f=t.roots,m=t.nodes;var i=OrgChart.manager._getResponse(e,r,l.visibleNodeIds,l.config,c,d,g,p,l.viewBox,f,l.action,l.actionParams,m,l.oldNodes,l.vbIsInitializedFromState);i.notif=t.limit,i.roots=f,i.bordersByRootIdAndLevel=u,i.adjustify=t.adjustify,n!=OrgChart.action.exporting&&(l.maxX=c,l.maxY=d,l.minX=g,l.minY=p,l.roots=f,l.nodes=m,l.visibleNodeIds=i.visibleNodeIds,l.bordersByRootIdAndLevel=u,l.rootList=t.rootList),o(i)},s)})},OrgChart.manager.prototype._read=function(t,e){var r=this,i=OrgChart.manager._createNodes(this.instance);e(i);var n=i.nodes,a=i.roots,o=OrgChart.remote;null==o&&(o=OrgChart.local),o._setPositions(a,r.layoutConfigs,function(e){var o=OrgChart.manager._doNotChangePositionOfClickedNodeIfAny(a,n,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 s={minX:null,minY:null,maxX:null,maxY:null},l={},h=[],c=0;c=e.collapse.level&&-1==i.indexOf(t.id):t.collapsed=e.collapse&&a>=e.collapse.level-1&&-1==i.indexOf(t.id):n==OrgChart.action.centerNode||n==OrgChart.action.insert||n==OrgChart.action.expand||n==OrgChart.action.collapse?i.has(t.id)&&(t.collapsed=!1):n==OrgChart.action.update&&r&&r.changeRoots&&r.changeRoots.has(t.id)&&(t.collapsed=!1)},OrgChart.manager._initNode=function(t,e,r,i,n,a,o){var s=o.manager.config,l=o.manager.layoutConfigs,h=o.manager.action,c=o.manager.actionParams,d=o.manager.state,g=l[r||"base"];null==t.parent&&OrgChart.manager._setCollpasedProperty(t,g,c,n,h,i-1,d,e);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.manager._iterate=function(t,e,r,i,n,a,o,s,l,h,c,d){var g=d.manager.layoutConfigs;if(OrgChart.manager._initNode(e,r,l,i,h,c,d),e.isAssistant&&(a[e.pid]||(a[e.pid]=[]),a[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)&&(s[e.pid]=p)}}else if(!e.isAssistant&&0==e.childrenIds.length&&e.parent&&!s[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)&&(s[e.pid]=p)}e.stChildren.length&&(t.stContainerNodes||(t.stContainerNodes=[]),t.stContainerNodes.push(e));for(var b=0;bs?1:0;if(m[a].desc&&(d*=-1),0!==d)return d}}})}for(c=0;c-1&&m.childrenIds.splice(mt,1);l.push(d)}}}e.roots=[];for(c=0;c=0;c--)l[c].collapsed&&l.splice(c,1);for(c=0;c=0;O--)if(N[E[O]])for(f=0;f-1&&(m.children.splice(mt,1),m.children.splice(mt,0,z)),z.children.push(v),z.parent=m,v.parent=z,s[z.id]=z}}for(var j in w){(m=s[j]).hasAssistants=!0;z=new OrgChart.node(m.id+"_split_assitant_0",m.id,["assistant"],"split");null!=m.movex&&(z.movex=m.movex),null!=m.movey&&(z.movey=m.movey),OrgChart.manager._initDinamicNode(z,m.lcn,!0),s[z.id]=z;var q=[];for(O=m.children.length-1;O>=0;O--){(H=m.children[O]).isAssistant?(H.parent=null,m.children.splice(O,1),q.splice(0,0,H.id)):H.isPartner||(H.parent&&S[H.parent.id]&&z&&H.parent.id!=z.id&&(Object.defineProperty(S,z.id,Object.getOwnPropertyDescriptor(S,H.parent.id)),delete S[H.parent.id]),H.parent=z,z.children.unshift(H),m.children.splice(O,1))}if(q.length%2){var Y=s[q[q.length-1]],V=new OrgChart.node(Y.id+"_mirror",m.pid,[],"mirror");OrgChart.manager._initDinamicNode(V,Y.lcn,!0),V.isAssistant=!0,V.w=Y.w,V.h=Y.h,s[V.id]=V,q.splice(q.length-1,0,V.id)}var X=1;for(O=q.length-1;O>=0;O--)if(O%2&&O!=q.length-1){var G=new OrgChart.node(m.id+"_split_assitant_"+X,m.pid,[],"split");OrgChart.manager._initDinamicNode(G,m.lcn,!0),null!=m.movex&&(G.movex=m.movex),null!=m.movey&&(G.movey=m.movey),s[G.id]=G,q.splice(O,0,G.id),X++}else O%2&&q.splice(O,0,z.id);for(O=0;O0)),at[ht]||(at[ht]=[]),at[ht].push(ct),lt&&(st[ht]=j,ot[ht]||(ot[ht]=[]),ot[ht].push(ct))}}for(var j in S={},ot)if(ot[j].length>OrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN){var dt=st[j];for(c=s[dt].children.length-1;c>=0;c--){H=s[dt].children[c];ot[j].has(H.id)&&s[dt].children.splice(c,1)}}for(var j in at)at[j].length>OrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN&&(S[j]=at[j])}}for(var j in S){for(var gt=m=s[j];gt.isSplit;)gt=s[gt.pid];for(;gt.isSubLevel;)gt=s[gt.pid];if(0!=(D=r[m.lcn?m.lcn:"base"]).layout||et){rt.pnode=m,rt.layout=D.layout,rt.layoutGridColumns=e.layoutGridColumns,rt.childrenIds=S[j],rt.lastChildrenPidIds=S,rt.subLevels=0,rt.layouts=[],OrgChart.events.publish("node-layout",[t,rt]),OrgChart.events.publish("layout",[rt]),rt.layouts.length||rt.layouts.push({layout:rt.layout,childrenIds:rt.childrenIds,subLevels:rt.subLevels,layoutGridColumns:rt.layoutGridColumns});for(var pt=0;pt2){"dynamic"==ut.layoutGridColumns&&(ut.layoutGridColumns=OrgChart._getDynamicGridCoulumns(ut.childrenIds.length));var Ct=m.id;for(c=m.children.length-1;c>=0;c--)for(O=0;O2&&bt--;for(c=0;c=ut.childrenIds.length;if(ut.childrenIds.length-1=0;c--){m=(H=s[Ot[c]]).parent,H.layout=OrgChart.layout.mixed;for(O=m.children.length-1;O>=0;O--)if(H.id==m.children[O].id){m.children.splice(O,1);break}if(c>0){var yt=s[Ot[c-1]];H.parent=yt,H.layout=OrgChart.layout.mixed,yt.children.push(H)}else m.children.push(H)}}else if(ut.layout>1){z=new OrgChart.node(pt+"_"+m.id+"_split_0",gt.id,[],"split");null!=m.movex&&(z.movex=m.movex),null!=m.movey&&(z.movey=m.movey),OrgChart.manager._initDinamicNode(z,m.lcn),s[z.id]=z,z.layout=ut.layout;var _t=[];for(c=ut.childrenIds.length-1;c>=0;c--){for(H=s[ut.childrenIds[c]],O=0;O2){var wt=new OrgChart.node(pt+"_"+H.id+"_mirror",gt.id,[],"mirror");OrgChart.manager._initDinamicNode(wt,H.lcn),wt.layout=ut.layout,s[wt.id]=wt,_t.splice(0,0,wt.id)}ut.layout!=OrgChart.layout.treeRightOffset&&ut.layout!=OrgChart.layout.treeRight&&_t.splice(0,0,H.id)}for(X=1,O=_t.length-1;O>=0;O--)if(O%2&&O!=_t.length-1){G=new OrgChart.node(pt+"_"+m.id+"_split_"+X,gt.id,[],"split");OrgChart.manager._initDinamicNode(G,m.lcn),null!=m.movex&&(G.movex=m.movex),null!=m.movey&&(G.movey=m.movey),G.layout=ut.layout,s[G.id]=G,_t.splice(O,0,G.id),X++}else O%2&&_t.splice(O,0,z.id);for(O=0;O<_t.length;O+=3){W=null;0==O&&(W=m);J=s[_t[O]],Z=s[_t[O+1]],K=s[_t[O+2]];0!=O&&(W=s[_t[O-3]]),0==O||Z||(W=s[_t[O-2]]),J.parent=W,W.children.push(J),Z&&(0!=O&&(W=s[_t[O-2]]),Z.parent=W,W.children.push(Z)),K&&(0!=O&&(W=s[_t[O-1]]),K.parent=W,W.children.push(K))}}}}}}if(OrgChart.VERTICAL_CHILDREN_ASSISTANT)for(c=0;ch?Math.ceil(l):Math.ceil(h)}else s=OrgChart.LAZY_LOADING_FACTOR/n;if(null!=t.x&&null!=t.y){if(OrgChart._getLazyLoading(e)&&i!==OrgChart.action.exporting){function c(t,e){var r=t.x,i=t.y,n=t.w,a=t.h,o=e[0]-s,l=e[2]+s+e[0],h=e[1]-s,c=e[3]+s+e[1],d=r+n>o&&l>r;return d&&(d=i+a>h&&c>i),d}if(c(t,r))return!0;for(var d=0;de.sl&&(e=r);for(var i=0;i=n-o)switch(w=(n+o)/2-y/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:w=(o-n)/2-y/2}else switch(w=f.x-y/2+OrgChart.manager._getNodeWidth(f,i)/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:(w=-(y/2-(o-n)/2))-i.padding&&(w=-i.padding)}if(_-2*i.padding>=a-s)switch(k=(a+s)/2-_/2,i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:k=(s-a)/2-_/2}else switch((k=-(_/2-(a-s)/2))>-i.padding&&(k=-i.padding),i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:(k=-(_/2-(s-a)/2))C.right?C.right:C.left),l[0]>C.right&&l[0]>C.left&&(l[0]=C.left>C.right?C.left:C.right),l[1]C.bottom?C.bottom:C.top),l[1]>C.bottom&&l[1]>C.top&&(l[1]=C.top>C.bottom?C.top:C.bottom))}if(c==OrgChart.action.centerNode||c==OrgChart.action.maximize){var S=g[d.id];1==d.options.horizontal&&(l[0]=S.x+S.w/2-l[2]/2),1==d.options.vertical&&(l[1]=S.y+S.h/2-l[3]/2),i.sticky&&(l[0]C.right?C.right:C.left),l[0]>C.right&&l[0]>C.left&&(l[0]=C.left>C.right?C.left:C.right),l[1]C.bottom?C.bottom:C.top),l[1]>C.bottom&&l[1]>C.top&&(l[1]=C.top>C.bottom?C.top:C.bottom))}if(i.sticky&&(c==OrgChart.action.insert||c==OrgChart.action.expand||c==OrgChart.action.collapse||c==OrgChart.action.update||c==OrgChart.action.centerNode)){var I=null;if(c==OrgChart.action.insert&&d&&null!=d.insertedNodeId&&null!=d.insertedNodeId)I=g[d.insertedNodeId];else if(c==OrgChart.action.update&&d&&null!=d.visId&&null!=d.visId)I=g[d.visId];else if(c!=OrgChart.action.expand&&c!=OrgChart.action.collapse||!d||null==d.id||null==d.id){if(c==OrgChart.action.centerNode){switch(i.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:d.options.vertical||(I=g[d.id]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:d.options.horizontal||(I=g[d.id])}I&&(I=OrgChart.manager._getMostDeepChild(I,g))}}else I=g[d.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 L=I.y+I.h-l[3]+i.padding;l[1]L&&(l[1]=L);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:L=I.x-i.padding;l[0]>L&&(l[0]=L);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:L=I.x+I.w-l[2]+i.padding;l[0]0&&(h[r-1].children.push(c),c.parent=h[r-1]),e[c.id]=c,h.push(c)}if(h.length){for(var d=h[h.length-1],g=h[0],p=t.children.length-1;p>=0;p--){var u=t.children[p];d.children.unshift(u),u.parent=d,t.children.splice(p,1)}t.children.push(g),g.parent=t}}},OrgChart.manager._verticalAssistantLevelCountIterate=function(t,e,r){r.max',svg:'{content}',link:'',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:'',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){if(e===OrgChart.action.exporting)return"";var i=OrgChart.t(t.template,!1,r).pointer;return i||(i=""),i},aiButton:function(t){return t.enableAI?'
AI
':""},node:function(t,e,r,i,n,a,o,s,l,h){var c=OrgChart.t(t.templateName,t.min,l),d=c.node.replaceAll("{w}",t.w).replaceAll("{h}",t.h);c.defs&&(d=d.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=c[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);d+=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 v=OrgChart._getPosition(r,t,n,a),x="node";Array.isArray(t.tags)&&t.tags.length&&(x+=" "+t.tags.join(" ")),t.layout&&(x+=" tree-layout");var O="";t.lcn&&(O='lcn="'+t.lcn+'"');var y=OrgChart.nodeOpenTag.replace("{lcn}",O).replace("{id}",t.id).replace("{class}",x).replace("{sl}",t.sl).replace("{level}",t.level).replace("{x}",v.x).replace("{y}",v.y),_=OrgChart._getOpacity(r,t);return d=(y=y.replace("{opacity}",_))+(d+=OrgChart.ui.nodeBtns(i,t,s,c,h))+OrgChart.grCloseTag},nodeBtns:function(t,e,r,i,n){var a="";return null==t.nodeMenu||e.isSplit||r===OrgChart.action.exporting||(a+=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)||(a+=''),a},expandCollapseBtn:function(t,e,r,i,n){var a="";if(i!==OrgChart.action.exporting&&!e.isSplit){var o=r[e.lcn?e.lcn:"base"],s=0,l=0,h=OrgChart.t(e.templateName,e.min,n);if(e.childrenIds.length>0){if(e.hasPartners){for(var c=!1,d=0;d0&&(g=l.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)&&v.rightNeighbor&&v.rightNeighbor.isSplit)switch(l.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:O=OrgChart.ui._linkRightToLeft(v.rightNeighbor,v,h,g);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:O=OrgChart.ui._linkBottomToTop(v.rightNeighbor,v,h,g)}else if((k||v.layout>1)&&v.leftNeighbor&&v.leftNeighbor.isSplit)switch(l.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:O=OrgChart.ui._linkLeftToRight(v.leftNeighbor,v,h,g);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:O=OrgChart.ui._linkTopToBottom(v.leftNeighbor,v,h,g)}else switch(l.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:if(1==v.isPartner)O=OrgChart.ui._linkLeftToRight(t,v,h,p);else if(2==v.isPartner)O=OrgChart.ui._linkRightToLeft(t,v,h,p);else{_=1==v.layout?void 0:x.minY-(x.minY-f.maxY)/2;O=OrgChart.ui._linkTopToBottom(t,v,h,g,_)}break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:if(1==v.isPartner)O=OrgChart.ui._linkLeftToRight(t,v,h,p);else if(2==v.isPartner)O=OrgChart.ui._linkRightToLeft(t,v,h,p);else{_=1==v.layout?void 0:x.maxY-(x.maxY-f.minY)/2;O=OrgChart.ui._linkBottomToTop(t,v,h,g,_)}break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:if(1==v.isPartner)O=OrgChart.ui._linkTopToBottom(t,v,h,p);else if(2==v.isPartner)O=OrgChart.ui._linkBottomToTop(t,v,h,p);else{_=1==v.layout?void 0:x.maxX-(x.maxX-f.minX)/2;O=OrgChart.ui._linkRightToLeft(t,v,h,g,_)}break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:if(1==v.isPartner)O=OrgChart.ui._linkTopToBottom(t,v,h,p);else if(2==v.isPartner)O=OrgChart.ui._linkBottomToTop(t,v,h,p);else{_=1==v.layout?void 0:x.minX-(x.minX-f.maxX)/2;O=OrgChart.ui._linkLeftToRight(t,v,h,g,_)}}}var S=OrgChart.ui._draggableLinkPath(e,t,v,O,g,l.orientation);if(S)b=S,y=y.replaceAll("{rounded}",S).replaceAll("{edge}",S).replaceAll("{curve}",b);else if(-1!=y.indexOf("{rounded}"))if(O.xa==O.xb&&O.xa==O.xc&&O.xa==O.xd||O.ya==O.yb&&O.ya==O.yc&&O.ya==O.yd)b="M"+O.xa+","+O.ya+" L"+O.xd+","+O.yd,y=y.replaceAll("{rounded}",b);else if(Math.abs(O.xa-O.xd)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(O.xa-O.xc)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(O.xa-O.xb)<=OrgChart.LINK_ROUNDED_CORNERS)b="M"+O.xa+","+O.ya+" L"+O.xa+","+O.yd,y=y.replaceAll("{rounded}",b);else if(Math.abs(O.ya-O.yd)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(O.ya-O.yc)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(O.ya-O.yb)<=OrgChart.LINK_ROUNDED_CORNERS)b="M"+O.xa+","+O.ya+" L"+O.xd+","+O.ya,y=y.replaceAll("{rounded}",b);else{var I=OrgChart.ui._roundedEdge(O.xa,O.ya,O.xb,O.yb,O.xc,O.yc),L=OrgChart.ui._roundedEdge(O.xb,O.yb,O.xc,O.yc,O.xd,O.yd);b="M"+I.x1+","+I.y1+" "+I.x2+","+I.y2+" Q"+I.qx1+","+I.qy1+" "+I.qx2+","+I.qy2+" L"+L.x2+","+L.y2+" Q"+L.qx1+","+L.qy1+" "+L.qx2+","+L.qy2+" L"+L.x3+","+L.y3,y=y.replaceAll("{rounded}",b)}else-1!=y.indexOf("{edge}")?(b="M"+O.xa+","+O.ya+" "+O.xb+","+O.yb+" "+O.xc+","+O.yc+" L"+O.xd+","+O.yd,y=y.replaceAll("{edge}",b)):-1!=y.indexOf("{curve}")?(b="M"+O.xa+","+O.ya+" C"+O.xb+","+O.yb+" "+O.xc+","+O.yc+" "+O.xd+","+O.yd,y=y.replaceAll("{curve}",b)):(b=y.replaceAll("{xa}",O.xa).replaceAll("{ya}",O.ya).replaceAll("{xb}",O.xb).replaceAll("{yb}",O.yb).replaceAll("{xc}",O.xc).replaceAll("{yc}",O.yc).replaceAll("{xd}",O.xd).replaceAll("{yd}",O.yd),y=b);c.push(OrgChart.linkOpenTag.replaceAll("{id}",t.id).replaceAll("{class}","link "+v.tags.join(" ")).replaceAll("{child-id}",v.id));var A={node:t,cnode:v,p:O,html:y,action:a};OrgChart.events.publish("render-link",[e,A]),c.push(A.html),o&&d.push({id:t.id,childId:v.id,html:A.html});var E="";for(var N in e.config.linkBinding){var M=e.config.linkBinding[N],T=e._get(v.id);if(T){var P=T[M];A.value=P,A.element=h[N],A.name=M,!1!==OrgChart.events.publish("label",[e,A])&&(OrgChart.isNEU(A.value)||OrgChart.isNEU(A.element)||(E+=A.element.replace("{val}",A.value)))}}if(""!=E){var U=O.x,B=O.y;null!=v.movey&&(B+=v.movey),E=OrgChart.linkFieldsOpenTag.replace("{x}",U).replace("{y}",B).replace("{rotate}",0)+E+OrgChart.grCloseTag,c.push(E)}c.push(OrgChart.grCloseTag)}return o?d:c.join("")},svg:function(t,e,r,i,n,a){return OrgChart.t(i.template,!1,a).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 n})},menuButton:function(t){return null==t.menu?"":OrgChart.t(t.template,!1).menuButton.replaceAll("{p}",t.padding)},_roundedEdge:function(t,e,r,i,n,a){var o,s,l,h=OrgChart.LINK_ROUNDED_CORNERS,c=0;return t==r&&t==n||e==i&&e==a?(o=l=r,s=c=i):(t!=n&&r==n&&(o=l=r,s=i,ea&&(c=i-h)),tn&&r==n&&(r+=h),e!=a&&i==a&&(o=r,s=c=i,tn&&(l=r-h)),ea&&i==a&&(i+=h)),{x1:t,y1:e,x2:r,y2:i,x3:n,y3:a,qx1:o,qy1:s,qx2:l,qy2:c}},_linkTopToBottom:function(t,e,r,i,n){var a,o,s,l,h,c=0;return a=t.x+t.w/2+r.linkAdjuster.toX,o=t.y+t.h+r.linkAdjuster.toY,l=s=e.x+e.w/2+r.linkAdjuster.fromX,h=e.y+r.linkAdjuster.fromY,{xa:a,ya:o,xb:a,yb:c=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!=n?n:h-i,xc:s,yc:c,xd:l,yd:h,x:s,y:OrgChart.isNEU(e.parentPartner)?c+16:c,rotate:0}},_linkBottomToTop:function(t,e,r,i,n){var a,o,s,l,h,c=0;return a=t.x+t.w/2+r.linkAdjuster.toX,o=t.y+r.linkAdjuster.toY,l=s=e.x+e.w/2+r.linkAdjuster.fromX,h=e.y+e.h+r.linkAdjuster.fromY,{xa:a,ya:o,xb:a,yb:c=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!=n?n:h+i,xc:s,yc:c,xd:l,yd:h,x:s,y:c-14,rotate:0}},_linkRightToLeft:function(t,e,r,i,n){var a,o,s,l,h,c,d=0;return a=t.x+r.linkAdjuster.toX,o=t.y+t.h/2+r.linkAdjuster.toY,h=e.x+e.w+r.linkAdjuster.fromX,c=l=e.y+e.h/2+r.linkAdjuster.fromY,s=o,{xa:a,ya:o,xb:d=t.rightNeighbor&&t.rightNeighbor.isAssistant&&"split"==e.templateName?t.rightNeighbor.x-i:"split"==t.templateName&&(e.isAssistant||e.layout>1)?h:"split"==e.templateName?a-i:null!=n?n:h+i,yb:s,xc:d,yc:l,xd:h,yd:c,x:d-16,y:l,rotate:90}},_linkLeftToRight:function(t,e,r,i,n){var a,o,s,l,h,c,d=0;return a=t.x+t.w+r.linkAdjuster.toX,o=t.y+t.h/2+r.linkAdjuster.toY,h=e.x+r.linkAdjuster.fromX,c=l=e.y+e.h/2+r.linkAdjuster.fromY,s=o,{xa:a,ya:o,xb:d=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?a+i:null!=n?n:h-i,yb:s,xc:d,yc:l,xd:h,yd:c,x:d+14,y:l,rotate:270}},_linkPpTop:function(t,e,r,i,n,a){var o=t.ppnodes[r.id],s=o.y+o.h/2,l=i.minY-(i.minY-n.maxY)/2,h=(i.minY-n.maxY)/t.maxSidePartnersWithChildren/4,c=OrgChart.ui.__linkPpBottomTop(t,e,r,l,h,o),d=c.x;return l=c.mid,OrgChart.ui._linkTopToBottom({x:d,y:s,w:0,h:0},r,a,0,l)},_linkPpBottom:function(t,e,r,i,n,a){var o=t.ppnodes[r.id],s=o.y+o.h/2,l=i.maxY-(i.maxY-n.minY)/2,h=(i.maxY-n.minY)/t.maxSidePartnersWithChildren/4,c=OrgChart.ui.__linkPpBottomTop(t,e,r,l,h,o),d=c.x;return l=c.mid,OrgChart.ui._linkBottomToTop({x:d,y:s,w:0,h:0},r,a,0,l)},_linkPpLeft:function(t,e,r,i,n,a){var o=t.ppnodes[r.id],s=i.minX-(i.minX-n.maxX)/2,l=(i.minX-n.maxX)/t.maxSidePartnersWithChildren/4,h=o.x+o.w/2,c=OrgChart.ui.__linkPpLeftRight(t,e,r,s,l,o),d=c.y;return s=c.mid,OrgChart.ui._linkLeftToRight({x:h,y:d,w:0,h:0},r,a,0,s)},_linkPpRight:function(t,e,r,i,n,a){var o=t.ppnodes[r.id],s=i.maxX-(i.maxX-n.minX)/2,l=(i.maxX-n.minX)/t.maxSidePartnersWithChildren/4,h=o.x+o.w/2,c=OrgChart.ui.__linkPpLeftRight(t,e,r,s,l,o),d=c.y;return s=c.mid,OrgChart.ui._linkRightToLeft({x:h,y:d,w:0,h:0},r,a,0,s)},__linkPpBottomTop:function(t,e,r,i,n,a){var o=0;return 1==a.isPartner?(o=a.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;l=i.xai.xd)return null;h=i.yai.yb)s=!0,l=i.xai.yd)return null;l=i.xai.xd)return null;h=i.yai.xb)s=!0,h=i.yai.yd){var l=i.xai.xd){h=i.ya(c=r/t[3])?c:h}else l=i;else l=r/s;else l=e/o;else l=(h=e/o)>(c=r/s)?c:h,i===OrgChart.match.boundaryIfOutside&&l>1&&(l=1);return l&&l>n&&(l=n),l&&lr.right?r.right:r.left),e[0]>r.right&&e[0]>r.left&&(n[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&&(n[1]=r.top>r.bottom?r.top:r.bottom),e[0]!==n[0]||e[1]!==n[1]?OrgChart.animate(t,{viewBox:e},{viewBox:n},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,n=!i&&!!window.StyleMedia,a=!(!window.chrome||!window.chrome.webstore&&!window.chrome.runtime);return{opera:t,firefox:e,safari:r,msie:i,edge:n,chrome:a,blink:(a||t)&&!!window.CSS}},OrgChart._menuPosition=function(t,e,r){var i=t.getBoundingClientRect(),n=r.getBoundingClientRect(),a=e.getBoundingClientRect(),o=i.left-n.left,s=i.top-n.top;return i.top+a.height>n.top+n.height&&(s-=a.height),i.left-a.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 n,a,o=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("text")[0],s=parseFloat(o.getAttribute("x")),l=parseFloat(o.getAttribute("y")),h=o.getAttribute("text-anchor"),c=o.getAttribute(OrgChart.attr.width),d=o.getAttribute(OrgChart.attr.text_overflow),g="http://www.w3.org/2000/svg",p=i.getElementsByTagName("svg")[0].getElementsByTagName("text")[0];d||(d="ellipsis");var u=d.split("-");if(u.length>1&&(n=parseInt(d.split("-")[1]),u.length>2&&"ellipsis"==u[2]&&(a=!0)),!c)return OrgChart._escapeHtml(t);if(c=parseFloat(c),s||(s=0),l||(l=0),s||(h="start"),"ellipsis"==d){p.removeChild(p.firstChild),p.textContent=t;for(var f=p.getComputedTextLength(),m=2;f>c;)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!=d.indexOf("multiline")){var C=t.split(" "),b=p.getBBox().height;p.textContent="";var v=document.createElementNS(g,"tspan"),x=document.createTextNode(C[0]);v.setAttributeNS(null,"x",s),v.setAttributeNS(null,"y",l),v.setAttributeNS(null,"text-anchor",h),v.appendChild(x),p.appendChild(v);m=1;for(var O=1,y=!1,_=1;_c){if(v.firstChild.data=v.firstChild.data.slice(0,w),O++,n&&O>n){if(a&&p.children.length==n){var k=p.children[n-1].textContent;p.children[n-1].textContent=k.substring(0,k.length-3)+"...",y=!0}break}(v=document.createElementNS(g,"tspan")).setAttributeNS(null,"x",s),v.setAttributeNS(null,"y",l+b*m),v.setAttributeNS(null,"text-anchor",h),x=document.createTextNode(C[_]),v.appendChild(x),p.appendChild(v),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 y?`${OrgChart._escapeHtml(t)}${S}`:S}},OrgChart._downloadFile=function(t,e,r,i,n){var a=new Blob([e],{type:t});if(1==i){var o=URL.createObjectURL(a);window.open(o,"_blank").focus()}else if(navigator.msSaveBlob)navigator.msSaveBlob(a,r);else{var s=document.createElement("a");if(void 0!==s.download){o=URL.createObjectURL(a);s.setAttribute("href",o);var l=r;l.toLowerCase().endsWith(n.toLowerCase())||(l=l+"."+n),s.setAttribute("download",l),s.style.visibility="hidden",document.body.appendChild(s),s.click(),document.body.removeChild(s)}}},OrgChart._getPosition=function(t,e,r,i){var n={x:e.x,y:e.y};if(null!=r&&(n.x=r),null!=i&&(n.y=r),t&&3==t.length){var a=t[0].indexOf(e.id);-1!=a&&null!=t[1][a].transform&&(null==r&&(n.x=t[1][a].transform[4]),null==i&&(n.y=t[1][a].transform[5]))}return n},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 n=null;if(null!=r&&i.scaleLessThen){var a=[];for(var o in i.scaleLessThen){var s=parseFloat(o);r0){a.sort(function(t,e){return t-e});var l=i.scaleLessThen[a[0]];for(var h in l)null==n&&(n=Object.assign({},i)),n[h]=l[h]}}return e?null==n?i.min?i.min:i:n.min?n.min:n:null==n?i:n},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 n=t.getElementsByTagName(e),a=n.length;0==a&&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&&(a='"'+a+'"'),i>0&&(r+=OrgChart.CSV_DELIMITER),r+=a}return r+"\n"},i="",n=0;ne.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 n(t,e,r,i){var n=(i-90)*Math.PI/180;return{x:t+r*Math.cos(n),y:e+r*Math.sin(n)}}function a(t,e,r,i,a){var o=n(t,e,r,a),s=n(t,e,r,i),l=a-i<=180?"0":"1";return["M",o.x,o.y,"A",r,r,0,l,0,s.x,s.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=[],n=1;n/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,a=e.y-t.y,o=Math.sqrt(i*i+a*a);return n(t,e,Math.min(1,r/o))}function n(t,e,r){return{x:t.x+(e.x-t.x)*r,y:t.y+(e.y-t.y)*r}}function a(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 s=[];if(t.length>1){var l=o(t[0]),h=null;"Z"==t[t.length-1][0]&&t[0].length>2&&(h=["L",l.x,l.y],t[t.length-1]=h),s.push(t[0]);for(var c=1;c2&&"L"==g[0]&&p.length>2&&"L"==p[0]){var u,f,m=o(d),C=o(g),b=o(p);r?(u=n(C,d.origPoint||m,e),f=n(C,p.origPoint||b,e)):(u=i(C,m,e),f=i(C,b,e)),a(g,u),g.origPoint=C,s.push(g);var v=n(u,C,.5),x=n(C,f,.5),O=["C",v.x,v.y,x.x,x.y,f.x,f.y];O.origPoint=C,s.push(O)}else s.push(g)}if(h){var y=o(s[s.length-1]);s.push(["Z"]),a(s[0],y)}}else s=t;return s.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._getLazyLoading=function(t){var e=t.lazyLoading;return"auto"==e&&(e=!!(t&&t.nodes&&t.nodes.length>700)),e},OrgChart._getSvgAttributes=function(t){const e=t.match(/width="([\d.]+)"/),r=t.match(/height="([\d.]+)"/),i=t.match(/x="([\d.]+)"/),n=t.match(/y="([\d.]+)"/),a=t.match(/viewBox="([^"]+)"/),o=e?parseFloat(e[1]):0,s=r?parseFloat(r[1]):0,l=i?parseFloat(i[1]):0,h=n?parseFloat(n[1]):0;let c=[0,0,0,0];return a&&(c=a[1],c=JSON.parse(`[${c}]`)),{width:o,height:s,viewBox:c,x:l,y:h}},OrgChart._setSvgAttributes=function(t,e){var r=e.x,i=e.y,n=e.width,a=e.height,o=e.viewBox.join(",");const s=t.match(/]*?)>/);if(!s)return t;let l=s[0],h=s[1];const c=(t,e,r)=>{if(null==r)return t;const i=new RegExp(`\\s*${e}="[^"]*"`,"i"),n=` ${e}="${r}"`;return t.match(i)?t.replace(i,n):t+n};h=c(h,"x",r),h=c(h,"y",i),h=c(h,"width",n),h=c(h,"height",a),h=c(h,"viewBox",o);const d=``;return t.replace(l,d)},OrgChart._convertTextToNodes=function(t,e){const r=t.split(/\r?\n/).filter(t=>""!==t.trim()),i=[];let n=1;const a=[];for(let t of r){let r=0;for(;t.startsWith(e);)t=t.slice(e.length),r++;if(t=t.trim(),!t)continue;const o=t.match(/^\[([^\]]+)](.*)$/);if(o){const t=o[1].trim(),e=o[2].trim();a.length>0&&(a[a.length-1][t]=e);continue}const s=t.match(/^([^\(]+)\(([^)]+)\)$/);let l,h=[];s?(l=s[1].trim(),h=s[2].split(",").map(t=>t.trim())):l=t;const c={id:n++,pid:0===r?null:a[r-1].id,name:l,tags:h};a[r]=c,a.length=r+1,i.push(c)}return i},OrgChart._convertFromNodesToText=function(t,e){const r={},i=[];function n(t,r){const i=e.repeat(r);let a=i+t.name;Array.isArray(t.tags)&&t.tags.length>0&&(a+="("+t.tags.join(",")+")"),a+="\n";for(const e of Object.keys(t))["id","pid","name","children","tags"].includes(e)||(a+=i+"["+e+"]"+t[e]+"\n");for(const e of t.children)a+=n(e,r+1);return a}return t.forEach(t=>{r[t.id]={...t,children:[]}}),t.forEach(t=>{t.pid&&r[t.pid]?r[t.pid].children.push(r[t.id]):i.push(r[t.id])}),i.map(t=>n(t,0)).join("").trim()},OrgChart._onClickHandler=function(t,e,r,i,n){var a;if(void 0===r)if("add"===e){var o={id:t.generateId(),pid:i};t.addNode(o,null,!0)}else if("edit"===e){var s=t.getNode(i);t.editUI.show(s.id)}else if("details"===e){s=t.getNode(i);t.editUI.show(s.id,!0)}else if("remove"===e)t.removeNode(i,null,!0);else if("svg"===e)console.warn('The "svg" as menu key is depricated. Use "svg_export" instead.'),t.exportSVG({filename:"OrgChart.svg",expandChildren:!1,nodeId:i});else if("pdf"===e)console.warn('The "pdf" as menu key is depricated. Use "pdf_export" instead.'),t.exportPDF({filename:"OrgChart.pdf",expandChildren:!1,nodeId:i});else if("png"===e)console.warn('The "png" as menu key is depricated. Use "png_export" instead.'),t.exportPNG({filename:"OrgChart.png",expandChildren:!1,nodeId:i});else if("svg_export"===e){var l={};OrgChart.isNEU(i)||(l.pages=[{nodeId:i}]),t.exportToSVG(l)}else if("pdf_export"===e){l={};OrgChart.isNEU(i)||(l.pages=[{nodeId:i}]),t.exportToPDF(l)}else if("png_export"===e){l={};OrgChart.isNEU(i)||(l.pages=[{nodeId:i}]),t.exportToPNG(l)}else if("visio_export"===e||"visio"===e)t.exportToVisio({nodeId:i});else if("pp_export"===e||"powerpoint"===e)t.exportToPowerPoint();else if("pp_preview"===e||"pppreview"===e){l={parentLevels:0,childLevels:1,expandChildren:!1,pages:[{parentLevels:null,childLevels:null,expandChildren:!0,nodeId:t.roots[0].id}]};null!=i&&(l.expandChildren=!1,l.pages[0].nodeId=i),t.powerPointPreviewUI.show(l)}else if("pdf_preview"===e||"pdfpreview"===e){l={parentLevels:0,childLevels:1,expandChildren:!1,pages:[{parentLevels:null,childLevels:null,expandChildren:!0,nodeId:t.roots[0].id}]};null!=i&&(l.expandChildren=!1,l.pages[0].nodeId=i),t.pdfPreviewUI.show(l)}else if("svg_preview"===e||"svgpreview"===e){l={parentLevels:0,childLevels:1,expandChildren:!1,pages:[{parentLevels:null,childLevels:null,expandChildren:!0,nodeId:t.roots[0].id}]};null!=i&&(l.expandChildren=!1,l.pages[0].nodeId=i),t.svgPreviewUI.show(l)}else if("png_preview"===e||"pngpreview"===e){l={parentLevels:0,childLevels:1,expandChildren:!1,pages:[{parentLevels:null,childLevels:null,expandChildren:!0,nodeId:t.roots[0].id}]};null!=i&&(l.expandChildren=!1,l.pages[0].nodeId=i),t.pngPreviewUI.show(l)}else"csv_export"===e||"csv"===e?t.exportToCSV({nodeId:i}):"xml_export"===e||"xml"===e?t.exportToXML({nodeId:i}):"json_export"===e||"json"===e?t.exportToJSON({nodeId:i}):"fit"===e?t.fit():"expand_all"===e?t.expand(null,"all"):"full_screen"===e?t.toggleFullScreen():"zoom_in"===e?t.zoom(!0,null,!0):"zoom_out"===e||"zoom_out"===e?t.zoom(!1,null,!0):"layout_mixed"===e?t.setLayout(OrgChart.layout.mixed):"layout_normal"===e?t.setLayout(OrgChart.layout.normal):"layout_right_offset"===e?t.setLayout(OrgChart.layout.treeRightOffset):"layout_left_offset"===e?t.setLayout(OrgChart.layout.treeLeftOffset):"layout_tree"===e?t.setLayout(OrgChart.layout.tree):"layout_grid"===e&&t.setLayout(OrgChart.layout.grid);else a=r.call(t,i,n);return a},OrgChart._isSVG=function(t){if("string"!=typeof t)return!1;const e=t.trim();if(!e.startsWith(""))return!1;try{const t=(new DOMParser).parseFromString(e,"image/svg+xml");return!t.querySelector("parsererror")&&"svg"===t.documentElement.nodeName.toLowerCase()}catch{return!1}},OrgChart.xScrollUI=function(t,e,r,i,n){this.element=t,this.requestParams=r,this.config=e,this.onSetViewBoxCallback=i,this.onDrawCallback=n,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,n){var a=!1;function o(){a=!0;var t=(e.position-e.bar.scrollLeft)/n;if(t>0)t++;else{if(0==t)return void(a=!1);t--}Math.ceil(e.bar.scrollLeft)==Math.ceil(e.position)?a=!1:(e.bar.scrollLeft+=t,s(o))}t.addEventListener("wheel",function(t){if(t.ctrlKey)return;var n=0;if(e.config.mouseScrool==OrgChart.action.xScroll)(n=t.deltaX||t.wheelDeltaX)||(n=t.deltaY||t.wheelDeltaY);else if(e.config.mouseScrool==OrgChart.action.scroll&&!(n=r||!t.shiftKey?t.deltaX||t.wheelDeltaX:t.deltaY||t.wheelDeltaY))return;n=-n,n=Math.max(-1,Math.min(1,n)),e.position+=-n*i;var s=parseFloat(e.innerBar.clientWidth)-parseFloat(e.bar.clientWidth);e.position<0&&(e.position=0);e.position>s&&(e.position=s);a||o()},{passive:!0});var s=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(!0===this.config.showXScroll||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,n=(t.boundary.right-t.boundary.left)/100;t.viewBox[0]=i*n+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 n=(parseFloat(this.innerBar.clientWidth)-parseFloat(this.bar.clientWidth))/100,a=i*n;this.bar.ignore=!0,this.bar.scrollLeft=a,this.position=this.bar.scrollLeft,this.bar.style.visibility=n<=0?"hidden":"",!0!==this.config.showXScroll&&(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,n){this.element=t,this.requestParams=r,this.config=e,this.onSetViewBoxCallback=i,this.onDrawCallback=n,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,n){var a=!1;function o(){a=!0;var t=(e.position-e.bar.scrollTop)/n;if(t>0)t++;else{if(0==t)return void(a=!1);t--}Math.ceil(e.bar.scrollTop)==Math.ceil(e.position)?a=!1:(e.bar.scrollTop+=t,s(o))}t.addEventListener("wheel",function(t){if(t.ctrlKey)return;var n=0;if(e.config.mouseScrool==OrgChart.action.yScroll)(n=t.deltaY||t.wheelDeltaY)||(n=t.deltaX||t.wheelDeltaX);else if(e.config.mouseScrool==OrgChart.action.scroll&&!(n=r||!t.shiftKey?t.deltaY||t.wheelDeltaY:t.deltaX||t.wheelDeltaX))return;n=-n,n=Math.max(-1,Math.min(1,n)),e.position+=-n*i;var s=parseFloat(e.innerBar.clientHeight)-parseFloat(e.bar.clientHeight);e.position<0&&(e.position=0);e.position>s&&(e.position=s);a||o()},{passive:!0});var s=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(!0===this.config.showYScroll||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,n=(t.boundary.bottom-t.boundary.top)/100;t.viewBox[1]=i*n+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 n=(parseFloat(this.innerBar.clientHeight)-parseFloat(this.bar.clientHeight))/100,a=i*n;this.bar.ignore=!0,this.bar.scrollTop=a,this.position=this.bar.scrollTop,this.bar.style.visibility=n<=0?"hidden":"",!0!==this.config.showYScroll&&(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 n=this.getViewBox().slice(0),a=n,o=n[2],s=n[3];!0===t?(n[2]=n[2]/OrgChart.SCALE_FACTOR,n[3]=n[3]/OrgChart.SCALE_FACTOR):!1===t?(n[2]=n[2]*OrgChart.SCALE_FACTOR,n[3]=n[3]*OrgChart.SCALE_FACTOR):(n[2]=n[2]/t,n[3]=n[3]/t),e||(e=[50,50]),n[0]=a[0]-(n[2]-o)/(100/e[0]),n[1]=a[1]-(n[3]-s)/(100/e[1]);var l=this.getScale(n);if(n[2]=this.width()/l,n[3]=this.height()/l,!0===t&&lthis.config.scaleMin||0!=t&&1!=t&&lthis.config.scaleMin){this._hideBeforeAnimation();var h=this;r?(clearTimeout(h._timeout),OrgChart.animate(this.getSvg(),{viewbox:this.getViewBox()},{viewbox:n},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(n),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 n,a,o,s=t.element.querySelector("#boc-ppdf-size"),l=t.element.querySelector("#boc-ppdf-layout"),h=t.element.querySelector("#boc-ppdf-scale"),c=t.element.querySelector("#boc-ppdf-margin"),d=t.element.querySelector("#boc-ppdf-header"),g=t.element.querySelector("#boc-ppdf-footer");s.value=e.format,l.value=e.landscape,h.value=e.scale,c.value=e.margin,d.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(s,l,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.format=s.value,t.exportPDF(e,OrgChart.pdfPrevUI._handler),OrgChart.pdfPrevUI._showHide(s,l,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.landscape="true"==l.value,t.exportPDF(e,OrgChart.pdfPrevUI._handler),OrgChart.pdfPrevUI._showHide(s,l,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(s,l,h)})}),c.addEventListener("keyup",function(){clearTimeout(n),n=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=c.value.split(",");if(4==r.length){for(var i=0;i
';return a&&(c+='
'+a+"
"),c+=t,o&&(c+='"),c+="
",c+=""},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;rc?(d.y=l,g.y=c+o.h):(d.y=l+a.h,g.y=c);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:p<=u?(C=-1,d.x=p+a.w/10,g.x=u+o.w/10):(C=1,d.x=p-a.w/10,g.x=u+o.w/10),l==c?(C=-1,d.y=l+a.h,g.y=c+o.h):l>c?(d.y=l,g.y=c+o.h):(d.y=l+a.h,g.y=c);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:f<=m?(C=-1,d.y=f+a.h/5,g.y=m+o.h/5):(C=1,d.y=f-a.h/5,g.y=m+o.h/5),s==h?(C=-1,d.x=s,g.x=h):s>h?(d.x=s,g.x=h+o.w):(d.x=s+a.w,g.x=h);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:f<=m?(C=1,d.y=f+a.h/5,g.y=m+o.h/5):(C=-1,d.y=f-a.h/5,g.y=m+o.h/5),s==h?(C=1,d.x=s+a.w,g.x=h+o.w):s>h?(d.x=s,g.x=h+o.w):(d.x=s+a.w,g.x=h)}var b=_(d,g,C),v=n.template;v||(v="orange");var x=OrgChart.clinkTemplates[v];if(n.label){var O=OrgChart.clinkLabelPosition(n,d,g,b);r+=x.label.replace("{x}",O.x).replace("{y}",O.y).replace("{val}",n.label)}var y="M"+d.x+","+d.y+"C"+d.x+","+d.y+" "+b.x+","+b.y+" "+g.x+","+g.y;r+=("').replace("{from}",a.id).replace("{to}",o.id)+x.link.replaceAll("{d}",y)+'',r+=OrgChart.grCloseTag}function _(t,e,r){null==r&&(r=1);var i=e.x-t.x,a=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+a*a)*r)*OrgChart.clinkCurve(n),{x:t.x+i/2-a*o,y:t.y+a/2+i*o}}}e.content+=r},OrgChart.clinkLabelPosition=function(t,e,r,i){var n=(r.x-e.x)/2+e.x,a=(r.y-e.y)/2+e.y;return{x:(n-i.x)/2+i.x,y:(a-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 n=this.config.clinks.length-1;n>=0;n--){var a=this.config.clinks[n];a.from==t&&a.to==e&&this.config.clinks.splice(n,1)}return this.config.clinks.push({from:t,to:e,label:r,template:i}),this._ai.setContext(),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 this._ai.setContext(),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&&(c="right");break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:case OrgChart.orientation.right:case OrgChart.orientation.right_top:c="top",a.y>e.y&&(c="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:n.minY+u};if(e.sl==a.sl)switch(h=a,g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([f.p,f.q]),l.push([f.p,f.q-u/3]),p=OrgChart.t(h.templateName,h.min,i),l.push([h.x+h.w/2+p.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:f.q=e.y+e.h,f.s=n.maxY-u,l.push([f.p,f.q]),l.push([f.r,e.y+e.h+u/3]),p=OrgChart.t(h.templateName,h.min,i),l.push([h.x+h.w/2+p.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.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=n.minX-u,f.s=e.y+e.h/2+p.expandCollapseSize,l.push([f.p,f.q]),l.push([e.x-u/3,f.q]),p=OrgChart.t(h.templateName,h.min,i),l.push([l[l.length-1][0],h.y+h.h/2+p.expandCollapseSize]),l.push([h.x,l[l.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=n.maxX+u,f.s=e.y+e.h/2+p.expandCollapseSize,l.push([f.p,f.q]),l.push([e.x+e.w+u/3,f.q]),p=OrgChart.t(h.templateName,h.min,i),l.push([l[l.length-1][0],h.y+h.h/2+p.expandCollapseSize]),l.push([h.x+h.w,l[l.length-1][1]])}else{switch(g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([f.p,f.q]),l.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=n.maxY-u,l.push([f.p,f.q]),l.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=n.minX-u,f.s=e.y+e.h/2+p.expandCollapseSize,l.push([f.p,f.q]),l.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=n.maxX+u,f.s=e.y+e.h/2+p.expandCollapseSize,l.push([f.p,f.q]),l.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,v=m.parent,x=v.leftNeighbor,O=v.rightNeighbor;if(v.id==a.id?h=v:OrgChart._intersects(v,f,g)&&(f=OrgChart._addPoint(v,l,g,f,c),b=!0),v.id!=a.id){for(;x;){if(x.id==a.id){h=x;break}OrgChart._intersects(x,f,g)&&(f=OrgChart._addPoint(x,l,g,f,c),b=!0),x=x.leftNeighbor}for(;O;){if(O.id==a.id){h=O;break}OrgChart._intersects(O,f,g)&&(f=OrgChart._addPoint(O,l,g,f,c),b=!0),O=O.rightNeighbor}}if(!b){var y=l[l.length-1][0],_=0;if(v.parent){u=g.levelSeparation,v.parent.layout&&(u=g.mixedHierarchyNodesSeparation);var w=t.manager.bordersByRootIdAndLevel[C.id][v.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:y=w.maxX+u*(2/3),_=l[l.length-1][1];break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:y=w.minX-u*(2/3),_=l[l.length-1][1]}}l.push([y,_])}m=v}switch(p=OrgChart.t(h.templateName,h.min,i),l.splice(l.length-1,1),g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([h.x+h.w/2+p.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y+h.h]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:l.push([h.x+h.w/2+p.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y]);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:l.push([l[l.length-1][0],h.y+h.h/2+p.expandCollapseSize]),l.push([h.x+h.w,l[l.length-1][1]]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:l.push([l[l.length-1][0],h.y+h.h/2+p.expandCollapseSize]),l.push([h.x,l[l.length-1][1]])}}var k=s.template;k||(k="orange");var S,I,L=null;switch((p=OrgChart.slinkTemplates[k]).labelPosition){case"start":L={x:l[1][0],y:l[1][1]};break;case"middle":var A=Math.ceil(l.length/2);S=l[A],I=l[A-1],L={x:(S[0]+I[0])/2,y:(S[1]+I[1])/2};break;case"end":L={x:l[l.length-2][0],y:l[l.length-2][1]}}o&&(l=l.reverse()),l[0].unshift("M");for(var E=1;E').replace("{from}",U).replace("{to}",B)+p.link.replaceAll("{d}",N)+'',r+=OrgChart.grCloseTag}for(var o=0;o=h.sl?a(l,h,!1):a(h,l,!0))}e.content+=r},OrgChart.prototype.addSlink=function(t,e,r,i){this._putInUndoStack(),this.clearRedo();for(var n=this.config.slinks.length-1;n>=0;n--){var a=this.config.slinks[n];a.from==t&&a.to==e&&this.config.slinks.splice(n,1)}return this.config.slinks.push({from:t,to:e,label:r,template:i}),this._ai.setContext(),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 this._ai.setContext(),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._ai=function(t){this.instance=t,this.sessionId=null},OrgChart._ai.prototype.prompt=function(t,e){var r=this;(t=t.trim())&&(this.sessionId?r._prompt([{Role:"user",Text:t}],e):this.setContext(function(){r._prompt([{Role:"user",Text:t}],e)}))},OrgChart._ai.prototype._prompt=function(t,e){var r=this,i=[];for(var n of OrgChart.AI_SYSTEM_MESSAGES)i.push({Role:"system",Text:n});var a=this.instance.config.serverUrl+`/OrgChartJSAI/Prompt?client_messages=${encodeURIComponent(JSON.stringify(t))}&system_messages=${encodeURIComponent(JSON.stringify(i))}&sessionId=${this.sessionId}`;const o=new EventSource(a);o.onmessage=function(t){var i=JSON.parse(t.data);"end"==i.kind&&o.close(),"text"==i.kind&&(i.text,e&&e(i.text)),"assistant-message-with-tools"==i.kind?r.toolCalls(i.message,e):"error"==i.kind&&console.error(i.text)},o.onerror=function(t){console.error(t),o.close()}},OrgChart._ai.prototype.setContext=function(t){if(this.instance&&this.instance.config.enableAI&&this.instance.aiUI.canSetContext){this.sessionId=this.instance._event_id;var e=this.instance.config.serverUrl+"/OrgChartJSAI/SetContext",r=this.instance.config.aiChatTools.slice();for(var i of r)i.functionParameters=JSON.stringify(i.functionParameters);fetch(e,{method:"post",headers:{"Content-Type":"application/json","x-request-type":"ajax"},body:JSON.stringify({context:this.instance.config.nodes,sessionId:this.sessionId,chatTools:r})}).then(function(){t&&t()}).catch(function(t){console.error(t)})}},OrgChart._ai.prototype.toolCalls=function(t,e){var r=this,i={toolCalls:t.ToolCalls};OrgChart.events.publish("ai-tool-calls",[this.instance,i]);var n=[],a=[],o=[],s=[],l=[],h=null,c=null,d=null,g=null,p=null;for(var u of i.toolCalls)null==u.FunctionResult&&("removeNode"==u.FunctionName?n.push(u):"addNode"==u.FunctionName?a.push(u):"updateNode"==u.FunctionName?o.push(u):"select"==u.FunctionName?s.push(u):"deselect"==u.FunctionName?l.push(u):"exportPDF"==u.FunctionName?h=u:"changeTemplate"==u.FunctionName?c=u:"addSlink"==u.FunctionName?d=u:"removeSlink"==u.FunctionName?g=u:"fit"==u.FunctionName&&(p=u));var f=!1;if(c&&(f=!0,u.FunctionResult="ok",this.instance.config.template=u.FunctionArguments.templateName),d){var m=this.instance.getNode(u.FunctionArguments.employeeId1),C=this.instance.getNode(u.FunctionArguments.employeeId2);m&&C&&m!=C?(f=!0,this.instance.addSlink(m.id,C.id),u.FunctionResult="ok"):u.FunctionResult=`Cannot add link between ${u.FunctionArguments.employeeId1} and ${u.FunctionArguments.employeeId2}`}if(g){m=this.instance.getNode(u.FunctionArguments.employeeId1),C=this.instance.getNode(u.FunctionArguments.employeeId2);m&&C&&m!=C?(f=!0,this.instance.removeSlink(m.id,C.id),u.FunctionResult="ok"):u.FunctionResult=`Cannot remove link between ${u.FunctionArguments.employeeId1} and ${u.FunctionArguments.employeeId2}`}for(var u of(p&&(this.instance.fit(),f=!1),n))f=!0,u.FunctionResult="ok",this.instance.remove(u.FunctionArguments.id);for(var u of a){f=!0,u.FunctionResult="ok",(b=JSON.parse(JSON.stringify(u.FunctionArguments))).isAssistant&&(b.tags=["assistant"]),delete b.isAssistant,OrgChart.isNEU(b.id)&&(b.id=this.instance.generateId()),this.instance.add(b)}for(var u of o){f=!0,u.FunctionResult="ok";var b=this.instance.get(u.FunctionArguments.id);for(var v in u.FunctionArguments)"id"!=v&&null!=u.FunctionArguments[v]&&(b[v]=u.FunctionArguments[v]);this.instance.update(b)}for(var u of s)for(var x of(u.FunctionResult="ok",u.FunctionArguments.ids)){var O=u.FunctionArguments.color;O||(O="#FFCA28");var y=this.instance.getNodeElement(x).firstChild;y&&(y.style.stroke=u.FunctionArguments.color,y.style.strokeWidth=5)}var _=function(){for(var t of l)if(t.FunctionResult="ok",t.FunctionArguments.ids)for(var e of t.FunctionArguments.ids){var i=r.instance.getNodeElement(e).firstChild;i&&(i.style.stroke="#aeaeae",i.style.strokeWidth=1)}else f=!0};f?(this.setContext(),this.instance.draw(OrgChart.action.update,void 0,_)):_();var w=function(){var t=[];for(var n of i.toolCalls)t.push({Role:"tool",Text:n.FunctionResult,Id:n.Id});r._prompt(t,e)};h?OrgChart.exportPDFFromCharts([{format:"A4",chartInstance:this.instance}],void 0,void 0,function(t){u.FunctionResult="ok",OrgChart._downloadFile("application/pdf",t,"OrgChart.pdf",!1,"pdf"),w()}):w()},OrgChart.aiUI=function(){this.instance=null,this.interval=null,this.canSetContext=!1,this.element=null,this.inputElement=null,this.btnSendElement=null,this.messagesElement=null,Object.defineProperty(this,"width",{get(){return this.isVisible()?this.element.offsetWidth:0}})},OrgChart.aiUI.title="AI for OrgChart JS",OrgChart.aiUI.prototype.init=function(t){this.instance=t;var e=this,r=this.instance.element.querySelector("[data-boc-ai-button]");r&&r.addEventListener("click",function(t){e.show()})},OrgChart.aiUI.prototype.isVisible=function(){return!(!this.element||"none"==this.element.style.display)},OrgChart.aiUI.prototype.show=function(t,e){this.instance.pdfPreviewUI.hide(),this.instance.svgPreviewUI.hide(),this.instance.pngPreviewUI.hide(),this.instance.powerPointPreviewUI.hide(),this.instance.aiUI.hide(),this.instance.orgScribeUI.hide(),this._create(),this.element.style.display="",this.canSetContext||(this.canSetContext=!0,this.instance._ai.setContext());var r=this;e||(this.timeout&&clearInterval(this.interval),this.interval=OrgChart.animate(this.element,{opacity:0},{opacity:1},300,OrgChart.anim.outSin,function(){t||r.inputElement.focus()}))},OrgChart.aiUI.prototype._create=function(){if(!this.element){var t=this,e="inp_"+this.instance.generateId();this.element=document.createElement("div"),this.element.setAttribute("data-boc-ai-form",""),this.element.style.opacity=0,this.element.classList.add("boc-ai-form"),this.element.classList.add(this.instance.config.mode),this.element.innerHTML=`
\n
${OrgChart.icon.x(20,20,"#aeaeae")}
\n
\n
\n  \n \n ${OrgChart.aiUI.title}\n \n
\n
\n
\n
\n \n \n
\n ${OrgChart.icon.send(20,20,"#aeaeae")}\n
\n
\n \n
\n
`,this.instance.leftElement.appendChild(this.element),this.instance.leftElement.style.display="block",OrgChart.input.init(this.element);var r=this.instance.leftElement.querySelector("[data-boc-ai-close] svg");r&&r.addEventListener("click",function(e){t.hide()}),this.inputElement=this.element.querySelector("#"+e),this.btnSendElement=this.inputElement.parentNode.querySelector("[data-boc-ai-send]"),this.messagesElement=this.element.querySelector("[data-boc-ai-messages]"),this.inputElement.addEventListener("input",function(t){this.value?this.parentNode.querySelector(".boc-ai-send").classList.add("boc-ai-send-cansend"):this.parentNode.querySelector(".boc-ai-send").classList.remove("boc-ai-send-cansend")}),this.element.querySelector("[data-boc-ai-send]").addEventListener("click",function(e){t.sendUserInput()}),this.inputElement.addEventListener("keyup",function(e){var r=window.event?window.event:e;switch(t.canSetContext||(t.canSetContext=!0,t.instance._ai.setContext()),r.key){case"Enter":t.sendUserInput();break;case"ArrowUp":if((i=OrgChart.aiUI._getSuggestions()).length)-1==(n=i.indexOf(t.inputElement.value))?n=i.length-1:n--,-1==n&&(n=i.length-1),t.inputElement.value=i[n];break;case"ArrowDown":var i,n;if((i=OrgChart.aiUI._getSuggestions()).length)-1==(n=i.indexOf(t.inputElement.value))?n=0:n++,n==i.length&&(n=0),t.inputElement.value=i[n]}})}},OrgChart.aiUI.prototype.addUserMessage=function(t){this.btnSendElement.classList.remove("boc-ai-send-cansend");var e=this.element.querySelector(".boc-ai-start");e&&(e.classList.remove("boc-ai-start"),this.messagesElement.innerHTML="");var r=document.createElement("div");r.classList.add("boc-ai-user-message"),r.innerHTML=`${t}`,this.messagesElement.appendChild(r)},OrgChart.aiUI.prototype.hide=function(){this.instance.leftElement.style.display="none",this.element&&(this.element.parentNode.removeChild(this.element),this.element=null)},OrgChart.aiUI.prototype.sendUserInput=function(){var t=this;OrgChart.aiUI._addSuggestion(this.inputElement.value),this.addUserMessage(this.inputElement.value);var e=document.createElement("div");e.classList.add("boc-ai-assistant-message");var r=document.createElement("span");r.classList.add("boc-inner-assistant-message"),e.appendChild(r),this.messagesElement.appendChild(e);var i="";this.instance._ai.prompt(this.inputElement.value,function(e){i+=e;var n=marked.parse(i);r.innerHTML=n;var a=t.element.querySelector(".boc-ai-middle");a.scrollTo(0,a.scrollHeight)}),this.inputElement.value=""},OrgChart.aiUI._addSuggestion=function(t){t=t.trim();var e=OrgChart.aiUI._getSuggestions(),r=e.indexOf(t);-1!=r&&e.splice(r,1),e.push(t),localStorage.setItem("suggestions",JSON.stringify(e))},OrgChart.aiUI._getSuggestions=function(){var t=localStorage.getItem("suggestions");return t=t?JSON.parse(t):[]},OrgChart.orgScribeUI=function(){this.instance=null,this.element=null,this.textAreaElement=null,this._timeout=null,Object.defineProperty(this,"width",{get(){return this.isVisible()?this.element.offsetWidth:0}})},OrgChart.orgScribeUI.prototype.init=function(t){this.instance=t},OrgChart.events.on("updated",function(t,e){if(t.orgScribeUI.isVisible()){var r=OrgChart._convertFromNodesToText(t.config.nodes,OrgChart.ORGSCRIBE_OFFSET);t.orgScribeUI.textAreaElement.value=r}}),OrgChart.orgScribeUI.prototype.isVisible=function(){return!(!this.element||"none"==this.element.style.display)},OrgChart.orgScribeUI.prototype.show=function(t,e){this.instance.pdfPreviewUI.hide(),this.instance.svgPreviewUI.hide(),this.instance.pngPreviewUI.hide(),this.instance.powerPointPreviewUI.hide(),this.instance.aiUI.hide(),this.instance.orgScribeUI.hide(),this._create(),this.element.style.display="";var r=this;e||(this.timeout&&clearInterval(this.interval),this.interval=OrgChart.animate(this.element,{opacity:0},{opacity:1},300,OrgChart.anim.outSin,function(){if(!t){var e=r.textAreaElement.value.length;r.textAreaElement.focus(),r.textAreaElement.setSelectionRange(e,e)}}))},OrgChart.orgScribeUI.prototype._create=function(){if(!this.element){var t=this;this.element=document.createElement("div"),this.element.setAttribute("data-boc-orgscribe-form",""),this.element.style.opacity=0,this.element.classList.add("boc-orgscribe-form"),this.element.classList.add(this.instance.config.mode);var e=OrgChart._convertFromNodesToText(this.instance.config.nodes,OrgChart.ORGSCRIBE_OFFSET);this.element.innerHTML=`
\n
${OrgChart.icon.x(20,20,"#aeaeae")}
\n
\n \n
\n
`,this.instance.leftElement.appendChild(this.element),this.instance.leftElement.style.display="block";var r=this.instance.leftElement.querySelector("[data-boc-orgscribe-close] svg");r&&r.addEventListener("click",function(e){t.hide()}),this.textAreaElement=this.element.querySelector('[data-id="boc_orgscribe_txt"]'),this.textAreaElement.addEventListener("input",function(){t._timeout&&(clearTimeout(t._timeout),t._timeout=null);var e=this.value;t._timeout=setTimeout(function(){var r=OrgChart._convertTextToNodes(e,OrgChart.ORGSCRIBE_OFFSET);t.instance.load(r)},500)})}},OrgChart.orgScribeUI.prototype.hide=function(){this.element&&(this.element.parentNode.removeChild(this.element),this.element=null)},function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).marked={})}(this,function(t){"use strict";function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function r(e){t.defaults=e}t.defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};const i={exec:()=>null};function n(t,e=""){let r="string"==typeof t?t:t.source;const i={replace:(t,e)=>{let n="string"==typeof e?e:e.source;return n=n.replace(a.caret,"$1"),r=r.replace(t,n),i},getRegex:()=>new RegExp(r,e)};return i}const a={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},o=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,s=/(?:[*+-]|\d{1,9}[.)])/,l=n(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,s).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),h=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,c=/(?!\s*\])(?:\\.|[^\[\]\\])+/,d=n(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",c).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),g=n(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,s).getRegex(),p="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",u=/|$))/,f=n("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",u).replace("tag",p).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),m=n(h).replace("hr",o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",p).getRegex(),C={blockquote:n(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",m).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:d,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:o,html:f,lheading:l,list:g,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:m,table:i,text:/^[^\n]+/},b=n("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",p).getRegex(),v={...C,table:b,paragraph:n(h).replace("hr",o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",b).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",p).getRegex()},x={...C,html:n("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",u).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:i,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:n(h).replace("hr",o).replace("heading"," *#{1,6} *[^\n]").replace("lheading",l).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},O=/^( {2,}|\\)\n(?!\s*$)/,y=/[\p{P}\p{S}]/u,_=/[\s\p{P}\p{S}]/u,w=/[^\s\p{P}\p{S}]/u,k=n(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,_).getRegex(),S=/(?!~)[\p{P}\p{S}]/u,I=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,L=n(I,"u").replace(/punct/g,y).getRegex(),A=n(I,"u").replace(/punct/g,S).getRegex(),E="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",N=n(E,"gu").replace(/notPunctSpace/g,w).replace(/punctSpace/g,_).replace(/punct/g,y).getRegex(),M=n(E,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,S).getRegex(),T=n("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,w).replace(/punctSpace/g,_).replace(/punct/g,y).getRegex(),P=n(/\\(punct)/,"gu").replace(/punct/g,y).getRegex(),U=n(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),B=n(u).replace("(?:--\x3e|$)","--\x3e").getRegex(),R=n("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",B).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,F=n(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",$).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),H=n(/^!?\[(label)\]\[(ref)\]/).replace("label",$).replace("ref",c).getRegex(),D=n(/^!?\[(ref)\](?:\[\])?/).replace("ref",c).getRegex(),z={_backpedal:i,anyPunctuation:P,autolink:U,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:O,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:i,emStrongLDelim:L,emStrongRDelimAst:N,emStrongRDelimUnd:T,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:F,nolink:D,punctuation:k,reflink:H,reflinkSearch:n("reflink|nolink(?!\\()","g").replace("reflink",H).replace("nolink",D).getRegex(),tag:R,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},W=t=>G[t];function J(t,e){if(e){if(a.escapeTest.test(t))return t.replace(a.escapeReplace,W)}else if(a.escapeTestNoEncode.test(t))return t.replace(a.escapeReplaceNoEncode,W);return t}function Z(t){try{t=encodeURI(t).replace(a.percentDecode,"%")}catch{return null}return t}function K(t,e){const r=t.replace(a.findPipe,(t,e,r)=>{let i=!1,n=e;for(;--n>=0&&"\\"===r[n];)i=!i;return i?"|":" |"}).split(a.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Q(t,"\n")}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const t=e[0],r=function(t,e,r){const i=t.match(r.other.indentCodeCompensation);if(null===i)return e;const n=i[1];return e.split("\n").map(t=>{const e=t.match(r.other.beginningSpace);if(null===e)return t;const[i]=e;return i.length>=n.length?t.slice(n.length):t}).join("\n")}(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const e=Q(t,"#");this.options.pedantic?t=e.trim():e&&!this.rules.other.endingSpaceChar.test(e)||(t=e.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Q(e[0],"\n")}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let t=Q(e[0],"\n").split("\n"),r="",i="";const n=[];for(;t.length>0;){let e=!1;const a=[];let o;for(o=0;o1,n={type:"list",raw:"",ordered:i,start:i?+r.slice(0,-1):"",loose:!1,items:[]};r=i?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=i?r:"[*+-]");const a=this.rules.other.listItemRegex(r);let o=!1;for(;t;){let r=!1,i="",s="";if(!(e=a.exec(t)))break;if(this.rules.block.hr.test(t))break;i=e[0],t=t.substring(i.length);let l=e[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,t=>" ".repeat(3*t.length)),h=t.split("\n",1)[0],c=!l.trim(),d=0;if(this.options.pedantic?(d=2,s=l.trimStart()):c?d=e[1].length+1:(d=e[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=l.slice(d),d+=e[1].length),c&&this.rules.other.blankLine.test(h)&&(i+=h+"\n",t=t.substring(h.length+1),r=!0),!r){const e=this.rules.other.nextBulletRegex(d),r=this.rules.other.hrRegex(d),n=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;t;){const g=t.split("\n",1)[0];let p;if(h=g,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),p=h):p=h.replace(this.rules.other.tabCharGlobal," "),n.test(h))break;if(a.test(h))break;if(o.test(h))break;if(e.test(h))break;if(r.test(h))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!h.trim())s+="\n"+p.slice(d);else{if(c)break;if(l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(n.test(l))break;if(a.test(l))break;if(r.test(l))break;s+="\n"+h}c||h.trim()||(c=!0),i+=g+"\n",t=t.substring(g.length+1),l=p.slice(d)}}n.loose||(o?n.loose=!0:this.rules.other.doubleBlankLine.test(i)&&(o=!0));let g,p=null;this.options.gfm&&(p=this.rules.other.listIsTask.exec(s),p&&(g="[ ] "!==p[0],s=s.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:i,task:!!p,checked:g,loose:!1,text:s,tokens:[]}),n.raw+=i}const s=n.items.at(-1);if(!s)return;s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd(),n.raw=n.raw.trimEnd();for(let t=0;t"space"===t.type),r=e.length>0&&e.some(t=>this.rules.other.anyLine.test(t.raw));n.loose=r}if(n.loose)for(let t=0;t({text:t,tokens:this.lexer.inline(t),header:!1,align:a.align[e]})));return a}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const t="\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const e=Q(t.slice(0,-1),"\\");if((t.length-e.length)%2==0)return}else{const t=function(t,e){if(-1===t.indexOf(e[1]))return-1;let r=0;for(let i=0;i-1){const r=(0===e[0].indexOf("!")?5:4)+e[1].length+t;e[2]=e[2].substring(0,t),e[0]=e[0].substring(0,r).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){const t=this.rules.other.pedanticHrefTitle.exec(r);t&&(r=t[1],i=t[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(r=this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r.slice(1):r.slice(1,-1)),tt(e,{href:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r,title:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const t=e[(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!t){const t=r[0].charAt(0);return{type:"text",raw:t,text:t}}return tt(r,t,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(i&&(!i[3]||!r.match(this.rules.other.unicodeAlphaNumeric))&&(!i[1]&&!i[2]||!r||this.rules.inline.punctuation.exec(r))){const r=[...i[0]].length-1;let n,a,o=r,s=0;const l="*"===i[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,e=e.slice(-1*t.length+r);null!=(i=l.exec(e));){if(n=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!n)continue;if(a=[...n].length,i[3]||i[4]){o+=a;continue}if((i[5]||i[6])&&r%3&&!((r+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);const e=[...i[0]][0].length,l=t.slice(0,r+i.index+e+a);if(Math.min(r,a)%2){const t=l.slice(1,-1);return{type:"em",raw:l,text:t,tokens:this.lexer.inlineTokens(t)}}const h=l.slice(2,-2);return{type:"strong",raw:l,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let t,r;return"@"===e[2]?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let t,r;if("@"===e[2])t=e[0],r="mailto:"+t;else{let i;do{i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??""}while(i!==e[0]);t=e[0],r="www."===e[1]?"http://"+e[0]:e[0]}return{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}}class rt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t.defaults,this.options.tokenizer=this.options.tokenizer||new et,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:a,block:V.normal,inline:X.normal};this.options.pedantic?(r.block=V.pedantic,r.inline=X.pedantic):this.options.gfm&&(r.block=V.gfm,this.options.breaks?r.inline=X.breaks:r.inline=X.gfm),this.tokenizer.rules=r}static get rules(){return{block:V,inline:X}}static lex(t,e){return new rt(e).lex(t)}static lexInline(t,e){return new rt(e).inlineTokens(t)}lex(t){t=t.replace(a.carriageReturn,"\n"),this.blockTokens(t,this.tokens);for(let t=0;t!!(i=r.call({lexer:this},t,e))&&(t=t.substring(i.raw.length),e.push(i),!0)))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);const r=e.at(-1);1===i.raw.length&&void 0!==r?r.raw+="\n":e.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);const r=e.at(-1);"paragraph"===r?.type||"text"===r?.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue.at(-1).src=r.text):e.push(i);continue}if(i=this.tokenizer.fences(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.heading(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.hr(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.blockquote(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.list(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.html(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.def(t)){t=t.substring(i.raw.length);const r=e.at(-1);"paragraph"===r?.type||"text"===r?.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),e.push(i);continue}let n=t;if(this.options.extensions?.startBlock){let e=1/0;const r=t.slice(1);let i;this.options.extensions.startBlock.forEach(t=>{i=t.call({lexer:this},r),"number"==typeof i&&i>=0&&(e=Math.min(e,i))}),e<1/0&&e>=0&&(n=t.substring(0,e+1))}if(this.state.top&&(i=this.tokenizer.paragraph(n))){const a=e.at(-1);r&&"paragraph"===a?.type?(a.raw+="\n"+i.raw,a.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):e.push(i),r=n.length!==t.length,t=t.substring(i.raw.length)}else if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);const r=e.at(-1);"text"===r?.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):e.push(i)}else if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}throw new Error(e)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){let r=t,i=null;if(this.tokens.links){const t=Object.keys(this.tokens.links);if(t.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(r));)t.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(r));)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(r));)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n=!1,a="";for(;t;){let i;if(n||(a=""),n=!1,this.options.extensions?.inline?.some(r=>!!(i=r.call({lexer:this},t,e))&&(t=t.substring(i.raw.length),e.push(i),!0)))continue;if(i=this.tokenizer.escape(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.tag(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.link(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(i.raw.length);const r=e.at(-1);"text"===i.type&&"text"===r?.type?(r.raw+=i.raw,r.text+=i.text):e.push(i);continue}if(i=this.tokenizer.emStrong(t,r,a)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.codespan(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.br(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.del(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.autolink(t)){t=t.substring(i.raw.length),e.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(t))){t=t.substring(i.raw.length),e.push(i);continue}let o=t;if(this.options.extensions?.startInline){let e=1/0;const r=t.slice(1);let i;this.options.extensions.startInline.forEach(t=>{i=t.call({lexer:this},r),"number"==typeof i&&i>=0&&(e=Math.min(e,i))}),e<1/0&&e>=0&&(o=t.substring(0,e+1))}if(i=this.tokenizer.inlineText(o)){t=t.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(a=i.raw.slice(-1)),n=!0;const r=e.at(-1);"text"===r?.type?(r.raw+=i.raw,r.text+=i.text):e.push(i)}else if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}throw new Error(e)}}return e}}class it{options;parser;constructor(e){this.options=e||t.defaults}space(t){return""}code({text:t,lang:e,escaped:r}){const i=(e||"").match(a.notSpaceStart)?.[0],n=t.replace(a.endingNewline,"")+"\n";return i?'
'+(r?n:J(n,!0))+"
\n":"
"+(r?n:J(n,!0))+"
\n"}blockquote({tokens:t}){return`
\n${this.parser.parse(t)}
\n`}html({text:t}){return t}heading({tokens:t,depth:e}){return`${this.parser.parseInline(t)}\n`}hr(t){return"
\n"}list(t){const e=t.ordered,r=t.start;let i="";for(let e=0;e\n"+i+"\n"}listitem(t){let e="";if(t.task){const r=this.checkbox({checked:!!t.checked});t.loose?"paragraph"===t.tokens[0]?.type?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=r+" "+J(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`
  • ${e}
  • \n`}checkbox({checked:t}){return"'}paragraph({tokens:t}){return`

    ${this.parser.parseInline(t)}

    \n`}table(t){let e="",r="";for(let e=0;e${i}`),"\n\n"+e+"\n"+i+"
    \n"}tablerow({text:t}){return`\n${t}\n`}tablecell(t){const e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`\n`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${J(t,!0)}`}br(t){return"
    "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:e,tokens:r}){const i=this.parser.parseInline(r),n=Z(t);if(null===n)return i;let a='
    ",a}image({href:t,title:e,text:r}){const i=Z(t);if(null===i)return J(r);let n=`${r}{const n=t[i].flat(1/0);r=r.concat(this.walkTokens(n,e))}):t.tokens&&(r=r.concat(this.walkTokens(t.tokens,e)))}}return r}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(t=>{const r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(t=>{if(!t.name)throw new Error("extension name required");if("renderer"in t){const r=e.renderers[t.name];e.renderers[t.name]=r?function(...e){let i=t.renderer.apply(this,e);return!1===i&&(i=r.apply(this,e)),i}:t.renderer}if("tokenizer"in t){if(!t.level||"block"!==t.level&&"inline"!==t.level)throw new Error("extension level must be 'block' or 'inline'");const r=e[t.level];r?r.unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&("block"===t.level?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:"inline"===t.level&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}"childTokens"in t&&t.childTokens&&(e.childTokens[t.name]=t.childTokens)}),r.extensions=e),t.renderer){const e=this.defaults.renderer||new it(this.defaults);for(const r in t.renderer){if(!(r in e))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const i=r,n=t.renderer[i],a=e[i];e[i]=(...t)=>{let r=n.apply(e,t);return!1===r&&(r=a.apply(e,t)),r||""}}r.renderer=e}if(t.tokenizer){const e=this.defaults.tokenizer||new et(this.defaults);for(const r in t.tokenizer){if(!(r in e))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const i=r,n=t.tokenizer[i],a=e[i];e[i]=(...t)=>{let r=n.apply(e,t);return!1===r&&(r=a.apply(e,t)),r}}r.tokenizer=e}if(t.hooks){const e=this.defaults.hooks||new ot;for(const r in t.hooks){if(!(r in e))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const i=r,n=t.hooks[i],a=e[i];ot.passThroughHooks.has(r)?e[i]=t=>{if(this.defaults.async)return Promise.resolve(n.call(e,t)).then(t=>a.call(e,t));const r=n.call(e,t);return a.call(e,r)}:e[i]=(...t)=>{let r=n.apply(e,t);return!1===r&&(r=a.apply(e,t)),r}}r.hooks=e}if(t.walkTokens){const e=this.defaults.walkTokens,i=t.walkTokens;r.walkTokens=function(t){let r=[];return r.push(i.call(this,t)),e&&(r=r.concat(e.call(this,t))),r}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return rt.lex(t,e??this.defaults)}parser(t,e){return at.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{const i={...r},n={...this.defaults,...i},a=this.onError(!!n.silent,!!n.async);if(!0===this.defaults.async&&!1===i.async)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==e)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof e)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));n.hooks&&(n.hooks.options=n,n.hooks.block=t);const o=n.hooks?n.hooks.provideLexer():t?rt.lex:rt.lexInline,s=n.hooks?n.hooks.provideParser():t?at.parse:at.parseInline;if(n.async)return Promise.resolve(n.hooks?n.hooks.preprocess(e):e).then(t=>o(t,n)).then(t=>n.hooks?n.hooks.processAllTokens(t):t).then(t=>n.walkTokens?Promise.all(this.walkTokens(t,n.walkTokens)).then(()=>t):t).then(t=>s(t,n)).then(t=>n.hooks?n.hooks.postprocess(t):t).catch(a);try{n.hooks&&(e=n.hooks.preprocess(e));let t=o(e,n);n.hooks&&(t=n.hooks.processAllTokens(t)),n.walkTokens&&this.walkTokens(t,n.walkTokens);let r=s(t,n);return n.hooks&&(r=n.hooks.postprocess(r)),r}catch(t){return a(t)}}}onError(t,e){return r=>{if(r.message+="\nPlease report this to https://github.com/markedjs/marked.",t){const t="

    An error occurred:

    "+J(r.message+"",!0)+"
    ";return e?Promise.resolve(t):t}if(e)return Promise.reject(r);throw r}}}const lt=new st;function ht(t,e){return lt.parse(t,e)}ht.options=ht.setOptions=function(t){return lt.setOptions(t),ht.defaults=lt.defaults,r(ht.defaults),ht},ht.getDefaults=e,ht.defaults=t.defaults,ht.use=function(...t){return lt.use(...t),ht.defaults=lt.defaults,r(ht.defaults),ht},ht.walkTokens=function(t,e){return lt.walkTokens(t,e)},ht.parseInline=lt.parseInline,ht.Parser=at,ht.parser=at.parse,ht.Renderer=it,ht.TextRenderer=nt,ht.Lexer=rt,ht.lexer=rt.lex,ht.Tokenizer=et,ht.Hooks=ot,ht.parse=ht;const ct=ht.options,dt=ht.setOptions,gt=ht.use,pt=ht.walkTokens,ut=ht.parseInline,ft=ht,mt=at.parse,Ct=rt.lex;t.Hooks=ot,t.Lexer=rt,t.Marked=st,t.Parser=at,t.Renderer=it,t.TextRenderer=nt,t.Tokenizer=et,t.getDefaults=e,t.lexer=Ct,t.marked=ht,t.options=ct,t.parse=ft,t.parseInline=ut,t.parser=mt,t.setOptions=dt,t.use=gt,t.walkTokens=pt}),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),n="";e.node.min?(i.nodeGroupDottedOpenButton||console.error(`[${e.node.templateName}].nodeGroupDottedOpenButton is not defined`),n+=``,n+=i.nodeGroupDottedOpenButton):(i.nodeGroupDottedCloseButton||console.error(`[${e.node.templateName}].nodeGroupDottedCloseButton is not defined`),n+=``,n+=i.nodeGroupDottedCloseButton),n=(n+="").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 a=t.getNode(e.node.stChildrenIds[0]);if(-1!=n.indexOf("{collapsed-children-count}")){var o=OrgChart.collapsedChildrenCount(t,a);n=n.replace("{collapsed-children-count}",o)}if(-1!=n.indexOf("{collapsed-children-total-count}")){var s=OrgChart.collapsedChildrenTotalCount(t,a);n=n.replace("{collapsed-children-total-count}",s)}if(-1!=n.indexOf("{children-count}")){var l=OrgChart.childrenCount(t,a);n=n.replace("{children-count}",l)}if(-1!=n.indexOf("{children-total-count}")){var h=OrgChart.childrenTotalCount(t,a);n=n.replace("{children-total-count}",h)}e.html+=n}}),void 0===OrgChart&&(OrgChart={}),OrgChart.prototype.undo=function(t){if(this.config.undoRedoStorageName){var e=this.undoStepsCount();if(0!=e){this._putInRedoStack();var r=`${this.config.undoRedoStorageName}_undo_`+(e-1),i=sessionStorage.getItem(r);sessionStorage.removeItem(r);var n=JSON.parse(i);this.config.nodes=n.nodes,this.config.clinks=n.clinks,this.config.slinks=n.slinks,this.config.groupDottedLines=n.groupDottedLines,this.config.dottedLines=n.dottedLines,this._ai.setContext(),OrgChart.events.publish("updated",[this]),this.filterUI.update(),this.draw(OrgChart.action.update,void 0,t),this.undoRedoUI.refresh()}}};OrgChart.prototype.redo=function(t){if(this.config.undoRedoStorageName){var e=this.redoStepsCount();if(0!=e){this._putInUndoStack();var r=`${this.config.undoRedoStorageName}_redo_`+(e-1),i=sessionStorage.getItem(r);sessionStorage.removeItem(r);var n=JSON.parse(i);this.config.nodes=n.nodes,this.config.clinks=n.clinks,this.config.slinks=n.slinks,this.config.groupDottedLines=n.groupDottedLines,this.config.dottedLines=n.dottedLines,this._ai.setContext(),OrgChart.events.publish("updated",[this]),this.filterUI.update(),this.draw(OrgChart.action.update,void 0,t),this.undoRedoUI.refresh()}}},OrgChart.prototype.clearRedo=function(){if(this.config.undoRedoStorageName){for(var t=`${this.config.undoRedoStorageName}_redo_`,e=Object.keys(sessionStorage),r=0;-1!=e.indexOf(t+r);)sessionStorage.removeItem(t+r),r++;this.undoRedoUI.refresh()}},OrgChart.prototype.clearUndo=function(){if(this.config.undoRedoStorageName){for(var t=`${this.config.undoRedoStorageName}_undo_`,e=Object.keys(sessionStorage),r=0;-1!=e.indexOf(t+r);)sessionStorage.removeItem(t+r),r++;this.undoRedoUI.refresh()}},OrgChart.prototype.undoStepsCount=function(){for(var t=`${this.config.undoRedoStorageName}_undo_`,e=Object.keys(sessionStorage),r=0;-1!=e.indexOf(t+r);)r++;return r},OrgChart.prototype.redoStepsCount=function(){for(var t=`${this.config.undoRedoStorageName}_redo_`,e=Object.keys(sessionStorage),r=0;-1!=e.indexOf(t+r);)r++;return r},OrgChart.prototype._putInUndoStack=function(){if(this.config.undoRedoStorageName){var t=`${this.config.undoRedoStorageName}_undo_`+this.undoStepsCount();sessionStorage.setItem(t,JSON.stringify({nodes:this.config.nodes,clinks:this.config.clinks,slinks:this.config.slinks,groupDottedLines:this.config.groupDottedLines,dottedLines:this.config.dottedLines}))}},OrgChart.prototype._putInRedoStack=function(){if(this.config.undoRedoStorageName){var t=`${this.config.undoRedoStorageName}_redo_`+this.redoStepsCount();sessionStorage.setItem(t,JSON.stringify({nodes:this.config.nodes,clinks:this.config.clinks,slinks:this.config.slinks,groupDottedLines:this.config.groupDottedLines,dottedLines:this.config.dottedLines}))}},void 0===OrgChart&&(OrgChart={}),OrgChart.undoRedoUI=function(){this.instance=null,this._event_id=OrgChart._guid()},OrgChart.undoRedoUI.prototype.init=function(t){t.config.undoRedoStorageName&&(this.instance=t,this.refresh())},OrgChart.undoRedoUI.prototype.refresh=function(){var t=this;if(this.instance.config.undoRedoStorageName){var e={undoStepsCount:this.instance.undoStepsCount(),redoStepsCount:this.instance.redoStepsCount()};if(!1!==OrgChart.events.publish("change",[this,e])){var r=this.instance.element.querySelector("[data-undo]"),i=this.instance.element.querySelector("[data-redo]");if(!r||!i){var n=document.createElement("div");n.classList.add("boc-undo-redo"),n.innerHTML=`${OrgChart.icon.undo(50,50,"")}\n ${OrgChart.icon.redo(50,50,"")}`,this.instance.element.appendChild(n),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,n,a,o,s=t.element.querySelector('[data-id="mini-map-focus"]'),l=!1,h=null;s.onmousedown=function(t){var e,a,o,h=s.getBoundingClientRect(),c=h.left,d=h.top;if(i=parseInt(t.clientX-c),n=parseInt(t.clientY-d),e=n,a=(i-OrgChart.miniMap._settings._translateX)/OrgChart.miniMap._settings._scale,o=(e-OrgChart.miniMap._settings._translateY)/OrgChart.miniMap._settings._scale,a>r[0]&&ar[1]&&o1){var c=h[0];o[c]&&(r=[o[c]],h=(l=l.replace(c,"").trim()).split(" "))}h=h.filter(function(t,e,r){return r.indexOf(t)===e});for(var d={},g=0;g=0;b--)s[b].id==C&&s.splice(b,1);OrgChart._search.addNodeToResult(s,i,p,e,f,n)}}else d[C]=e.__score,OrgChart._search.addNodeToResult(s,i,p,e,f,n)}}}return s.sort(function(t,e){return t.__scoree.__score?-1:0}),s},OrgChart._search.addNodeToResult=function(t,e,r,i,n,a){var o={};o.id=r.id,OrgChart.isNEU(r[a])||(o[a]=r[a]);for(var s=0;s0?100:0,c=0,d=0;d=1&&a[p-1].start>a[p].start){h=0;break}}var f=0;0!=s&&(f=s/o);var m=s>0?100:0;0!=l&&(m=100-l/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));a.sort(function(t,e){return t.starte.start?1:0});for(p=a.length-1;p>=0;p--)for(d=0;da[p].start&&a.splice(p,1);var v=e;for(p=a.length-1;p>=0;p--)v=(v=v.insert(a[p].start+a[p].length,"")).insert(a[p].start,"");return{__searchMarks:v,__score:b}},OrgChart._search.searchIndexesOf=function(t,e){var r=[];if(!OrgChart.isNEU(t))for(var i=0;i-1;)r.push({length:n.length,start:a,searchPhrase:n}),a+=n.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&&a<=s){e=!0;break}if(n<=o&&a>=s){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 n=0;n=0){s=l.childrenIds[o];this._keyNavigationActiveNodeId=s,this.center(s)}}}else if("ArrowUp"==e.code){var l;if(l=this.getNode(n.pid)){s=l.id;if(n.isAssistant||l.hasAssistants||n.isPartner||l.hasPartners){o=l.childrenIds.indexOf(n.id);--o>=0&&(s=l.childrenIds[o])}this._keyNavigationActiveNodeId=s,this.center(s)}}else if("ArrowDown"==e.code)n.childrenIds.length&&(this._keyNavigationActiveNodeId=n.childrenIds[0],this.center(n.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;(n=(i=e).querySelector("title"))&&n.parentNode.removeChild(n),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 n,a={text:"",id:t._keyNavigationActiveNodeId};if(OrgChart.events.publish("screen-reader-text",[t,a]),!OrgChart.isNEU(a.text))(n=document.createElementNS("http://www.w3.org/2000/svg","title")).innerHTML=a.text,i.appendChild(n);OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE&&t.searchUI.hide(),i.focus()}},OrgChart.elements={},OrgChart.elements.textbox=function(t,e,r,i){var n=OrgChart.elements._vidrf(t,e,i);if(n.doNotRender)return{html:""};var a="";return e.btn&&(a=`
    ${e.btn}`),{html:`
    \n
    \n \n \n ${a}\n
    \n
    `,id:n.id,value:n.value}},OrgChart.elements.checkbox=function(t,e,r,i){var n=OrgChart.elements._vidrf(t,e,i);if(n.doNotRender)return{html:""};var a=n.value?"checked":"",o=i?'onclick="return false;"':"";return{html:`
    \n \n
    `,id:n.id,value:a}},OrgChart.elements.select=function(t,e,r,i){if(i)return OrgChart.elements.textbox(t,e,r,i);var n=OrgChart.elements._vidrf(t,e,i);return n.doNotRender?{html:""}:{html:`
    \n
    \n \n \n
    \n
    `,id:n.id,value:n.value}},OrgChart.elements.multiSelect=function(t,e,r,i){if(i)return OrgChart.elements.textbox(t,e,r,i);var n=OrgChart.elements._vidrf(t,e,i);return n.doNotRender?{html:""}:{html:`
    \n
    \n \n \n
    \n
    `,id:n.id,value:n.value}},OrgChart.elements.date=function(t,e,r,i){var n=OrgChart.elements._vidrf(t,e,i);return n.doNotRender?{html:""}:{html:`
    \n
    \n \n \n
    \n
    `,id:n.id,value:n.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 n=0;n '+n+"",e.classList.add("boc-validation-error"),!1):a&&!OrgChart.input.validatePassword(e.value)?(r.innerHTML+=' '+a+"",e.classList.add("boc-validation-error"),!1):o&&!OrgChart.input.isValidEmail(e.value)?(r.innerHTML+=' '+o+"",e.classList.add("boc-validation-error"),!1):!(s&&!OrgChart.input.isValidEmails(e.value))||(r.innerHTML+=' '+s+"",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 r[a]=n.value}return r},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 n={oldData:r,newData:i};return t.call(e,n)})},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 n={id:r,newPidsAndStpidsForIds:i};return t.call(e,n)})},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,n,a){var o={dragId:r,dropId:i,dragNodeElement:n,event:a};return t.call(e,o)})},OrgChart.prototype.onDrag=function(t){return this.on("drag",function(e,r,i,n){var a={dragId:r,event:i,nodeIds:n};return t.call(e,a)})},OrgChart.prototype.onExpandCollapseButtonClick=OrgChart.prototype.onExpandCollpaseButtonClick=function(t){return this.on("expcollclick",function(e,r,i,n){var a={collapsing:r,id:i,ids:n};return t.call(e,a)})},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.onCanvasClick=function(t){return this.on("canvas-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.prototype.onAIToolCalls=function(t){return this.on("ai-tool-calls",function(e,r){return t.call(e,r)})},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 n=i[r];if(null!=n&&!1===n.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._removeFilter=function(t){var e=this.instance.get(t);for(var r in this.filterBy){var i=this.filterBy[r];for(var n in e){var a=e[n];i[a]&&(i[a].checked=!0)}}this.update()},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${l}`};OrgChart.events.publish("add-filter",[p,f]),u+=f.html}this.element.innerHTML=`
    ${u}
    `,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=p.instance.element.querySelectorAll("[data-filter-menu]"),i=0;i\n \n \n `};OrgChart.events.publish("add-item",[p,h]);var c=h.html;for(var d in p.filterBy[e]){var g=p.filterBy[e][d],u=g.text;null==u&&(u=d),h={name:e,text:u,value:d,checked:g.checked,html:`
    \n \n \n
    `},OrgChart.events.publish("add-item",[p,h]),c+=h.html}o=document.createElement("div");var f=OrgChart.filterUI.textFilterBy;o.innerHTML=`
    \n ${f} ${e}:\n ${c}\n
    `,o.setAttribute("data-filter-menu",e),o.classList.add("boc-filter-menu"),t.target.parentNode.parentNode.appendChild(o);var m=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;it.querySelector("[data-boc-content]"),set(t){r.mainElement=t}}),Object.defineProperty(this,"mainElement",{get:()=>t,set(i){(t=i)&&(t.innerHTML="\n \n
    \n
    \n
    \n
    ",r._constructor(e))}}),Object.defineProperty(this,"leftElement",{get:()=>t.querySelector("[data-boc-left]")}),this.element=t};OrgChart.prototype._constructor=function(t){var e=this;if(this.config=OrgChart.mergeDeep(OrgChart._defaultConfig(t),t),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 r in this.config.tags){var i=this.config.tags[r];null!=i.subTreeConfig&&(this._layoutConfigs[r]={orientation:null!=i.subTreeConfig.orientation?i.subTreeConfig.orientation:this.config.orientation,levelSeparation:null!=i.subTreeConfig.levelSeparation?i.subTreeConfig.levelSeparation:this.config.levelSeparation,mixedHierarchyNodesSeparation:null!=i.subTreeConfig.mixedHierarchyNodesSeparation?i.subTreeConfig.mixedHierarchyNodesSeparation:this.config.mixedHierarchyNodesSeparation,assistantSeparation:null!=i.subTreeConfig.assistantSeparation?i.subTreeConfig.assistantSeparation:this.config.assistantSeparation,subtreeSeparation:null!=i.subTreeConfig.subtreeSeparation?i.subTreeConfig.subtreeSeparation:this.config.subtreeSeparation,siblingSeparation:null!=i.subTreeConfig.siblingSeparation?i.subTreeConfig.siblingSeparation:this.config.siblingSeparation,layout:null!=i.subTreeConfig.layout?i.subTreeConfig.layout:this.config.layout,columns:null!=i.subTreeConfig.columns?i.subTreeConfig.columns:this.config.columns,collapse:null!=i.subTreeConfig.collapse?i.subTreeConfig.collapse:this.config.collapse,partnerNodeSeparation:null!=i.subTreeConfig.partnerNodeSeparation?i.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._ai=new OrgChart._ai(this),this.config.searchUI?this.searchUI=this.config.searchUI:this.searchUI=new OrgChart.searchUI,this.config.aiUI?this.aiUI=this.config.aiUI:this.aiUI=new OrgChart.aiUI,this.config.orgScribeUI?this.orgScribeUI=this.config.orgScribeUI:this.orgScribeUI=new OrgChart.orgScribeUI,this.config.powerPointPreviewUI?this.powerPointPreviewUI=this.config.powerPointPreviewUI:this.powerPointPreviewUI=new OrgChart.exportUI("pptx"),this.config.pdfPreviewUI?this.pdfPreviewUI=this.config.pdfPreviewUI:this.pdfPreviewUI=new OrgChart.exportUI("pdf"),this.config.svgPreviewUI?this.svgPreviewUI=this.config.svgPreviewUI:this.svgPreviewUI=new OrgChart.exportUI("svg"),this.config.pngPreviewUI?this.pngPreviewUI=this.config.pngPreviewUI:this.pngPreviewUI=new OrgChart.exportUI("png"),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.controlsUI?this.controlsUI=this.config.controlsUI:this.controlsUI=new OrgChart.controlsUI,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:e.response.boundary,scale:e.getScale(),viewBox:e.getViewBox(),padding:e.config.padding}},function(t){e.setViewBox(t)},function(){e._draw(!0,OrgChart.action.xScroll)})),this.config.yScrollUI||(this.yScrollUI=new OrgChart.yScrollUI(this.element,this.config,function(){return{boundary:e.response.boundary,scale:e.getScale(),viewBox:e.getViewBox(),padding:e.config.padding}},function(t){e.setViewBox(t)},function(){e._draw(!0,OrgChart.action.xScroll)})),this.config.undoRedoUI?this.undoRedoUI=this.config.undoRedoUI:this.undoRedoUI=new OrgChart.undoRedoUI,this.mainElement.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){e.isVisible=t,!1!==OrgChart.events.publish("visibility-change",[e])&&OrgChart.LAZY_LOADING&&e.isVisible&&(e._loaded?e._draw(!1,OrgChart.action.update):(e._setInitialSizeIfNotSet(),e._draw(!1,OrgChart.action.init)))}),this._resizeObserver=new ResizeObserver(t=>{for(let r of t){const{width:t,height:i}=r.contentRect;e._resizeHandler(t,i)}}),this._resizeObserver.observe(this.element))},OrgChart._defaultConfig=function(t){return{interactive:!0,mode:"light",lazyLoading:"auto",enableDragDrop:!1,enableSearch:!0,enableAI:!1,enablePan:!0,keyNavigation:!1,miniMap:!1,controls:null,nodeMenu:null,nodeCircleMenu:null,nodeContextMenu:null,menu:null,toolbar:!1,sticky:!0,nodeMouseClick:OrgChart.action.details,nodeMouseDbClick:OrgChart.none,mouseScrool:OrgChart.action.zoom,showXScroll:!1,showYScroll:!1,template:"ana",tags:{},min:!1,nodeBinding:{},linkBinding:{},searchFields:null,searchDisplayField:null,searchFieldsWeight:null,searchFieldsAbbreviation:null,nodes:[],clinks:[],slinks:[],backdrops:[],groupDottedLines:[],dottedLines:[],undoRedoStorageName:null,levelSeparation:60,siblingSeparation:20,subtreeSeparation:40,backdropSeparation:15,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,aiUI:null,orgScribeUI:null,powerPointPreviewUI:null,pdfPreviewUI:null,svgPreviewUI:null,pngPreviewUI:null,filterUI:null,searchUI:null,xScrollUI:null,yScrollUI:null,nodeMenuUI:null,controlsUI:null,nodeCircleMenuUI:null,nodeContextMenuUI:null,toolbarUI:null,notifierUI:null,menuUI:null,undoRedoUI:null,exportUrl:"https://balkan.app/export",serverUrl:"https://serverjs.balkan.app",aiChatTools:[],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",saveOnHide:!0,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 n=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 a=e==OrgChart.action.init?null:this.getViewBox();this.manager.read(t,this.width(),this.height(),a,e,r,function(t){if(!n.notifierUI.show(t.notif)){e!=OrgChart.action.exporting&&(n.nodes=t.nodes,n.visibleNodeIds=t.visibleNodeIds,n.roots=t.roots),n.editUI.fields=t.allFields;var a={defs:""};OrgChart.events.publish("renderdefs",[n,a]);var o=n.ui.defs(a.defs),s=n.getScale(t.viewBox);o+=n.ui.pointer(n.config,e,s);var l=n.getViewBox(),h=t.viewBox;a={content:o,res:t};OrgChart.events.publish("prerender",[n,a]),o=a.content;var c=[];if(OrgChart.RENDER_LINKS_BEFORE_NODES)for(var d=0;d0){n._hideBeforeAnimation(C[0].length);for(d=0;dthis.config.scaleMax&&(t=this.config.scaleMax),ta?a:n,s=e,l=e[2],h=e[3];return e[2]=e[2]/(t/o),e[3]=e[3]/(t/o),e[0]=s[0]-(e[2]-l)/2,e[1]=s[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 n=this.getNodeElement(t);if(null!=n){var a=this.getScale(),o=i.w/2,s=i.h/2;if(void 0!==e&&void 0!==r){var l=n.getBoundingClientRect();o=e/a-l.left/a,s=r/a-l.top/a}var h=i.w,c=i.h,d=h-o>o?h-o:o,g=c-s>s?c-s:s,p=d>g?d: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 v={ripple:OrgChart.t(i.templateName,i.min,this.getScale()).ripple,node:i};OrgChart.events.publish("ripple",[this,v]),m.setAttribute("x",v.ripple.rect?v.ripple.rect.x:0),m.setAttribute("y",v.ripple.rect?v.ripple.rect.y:0),m.setAttribute("width",v.ripple.rect?v.ripple.rect.width:i.w),m.setAttribute("height",v.ripple.rect?v.ripple.rect.height:i.h),m.setAttribute("rx",v.ripple.radius),m.setAttribute("ry",v.ripple.radius),C.setAttribute("clip-path","url(#"+b+")"),C.setAttribute("cx",o),C.setAttribute("cy",s),C.setAttribute("r",0),C.setAttribute("fill",v.ripple.color),C.setAttribute("class","boc-ripple"),f.appendChild(m),u.appendChild(f),u.appendChild(C),n.appendChild(u),OrgChart.animate(C,{r:0,opacity:1},{r:p,opacity:0},500,OrgChart.anim.outPow,function(){n.removeChild(u)})}}},OrgChart.prototype.centerOutNodes=function(t){if(this._centerInNodes){var e=JSON.parse(this._centerInNodes);this._centerInNodes=null;var r=this;this._centerInNodesTimeout=OrgChart.animate(this.getSvg(),{viewBox:this.getViewBox()},{viewBox:e},300,this.config.anim.func,function(){r.draw(OrgChart.action.update,null,function(){t&&t.call(r)})})}},OrgChart.prototype.centerInNodes=function(t,e){var r=this.getViewBox();this._centerInNodes||(this._centerInNodes=JSON.stringify(r));var i=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;for(var s of t)s.yn&&(n=s.y+s.h),s.xo&&(o=s.x+s.w);var l=o-a,h=n-i,c=(d=l/(l+2*this.config.padding))>(g=h/(h+2*this.config.padding))?g:d;c>this.config.scaleMax&&(c=this.config.scaleMax),c(g=f/r[3])?g:d,C=r,b=r[2],v=r[3];r[2]=r[2]/(c/m),r[3]=r[3]/(c/m),r[0]=C[0]-(r[2]-b)/(100/p[0]),r[1]=C[1]-(r[3]-v)/(100/p[1]),r[0]=a-(u/c-l)/2,r[1]=i-(f/c-h)/2;var x=this;this._centerInNodesTimeout&&(clearTimeout(this._centerInNodesTimeout),this._centerInNodesTimeout=null),this._centerInNodesTimeout=OrgChart.animate(this.getSvg(),{viewBox:this.getViewBox()},{viewBox:r},300,this.config.anim.func,function(){x.draw(OrgChart.action.update,null,function(){e&&e.call(x)})})},OrgChart.prototype.center=function(t,e,r){var i,n,a=t,o=!0,s=!0;e&&null!=e.parentState&&(i=e.parentState),e&&null!=e.childrenState&&(n=e.childrenState),e&&null!=e.rippleId&&(a=e.rippleId),e&&null!=e.vertical&&(o=e.vertical),e&&null!=e.horizontal&&(s=e.horizontal);var l={parentState:i,childrenState:n,rippleId:a,vertical:o,horizontal:s};this._draw(!1,OrgChart.action.centerNode,{id:t,options:l},r)},OrgChart.prototype.fit=function(t){this.config.scaleInitial=OrgChart.match.boundary,this._draw(!0,OrgChart.action.init,{method:"fit"},t)},OrgChart.prototype.fitIfOutside=function(t){this.config.scaleInitial=OrgChart.match.boundaryIfOutside,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(){i.getScale();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===h||h>d.y)&&(h=d.y))}if(null!=o&&null!=s&&null!=l&&null!=h){var g=this.width(),p=this.height(),u=g/(v=o-l+2*this.config.padding),f=p/(x=s-h+2*this.config.padding),m=u>f?f:u,C=Math.ceil(g/m),b=Math.ceil(p/m),v=0,x=0;if(C-2*this.config.padding>=o-l)v=(o+l)/2-C/2;else switch(v=i.x-C/2+OrgChart.manager._getNodeWidth(i,this.config)/2,this.config.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:(v=-(C/2-(l-o)/2))-this.config.padding&&(v=-this.config.padding)}if(b-2*this.config.padding>=s-h)x=(s+h)/2-b/2;else switch((x=-(b/2-(s-h)/2))>-this.config.padding&&(x=-this.config.padding),this.config.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:(x=-(b/2-(h-s)/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 n=this.config.nodes.length-1;n>=0;n--)this.config.nodes[n].pid==t?r[this.config.nodes[n].id]=e.pid:this.config.nodes[n].stpid==t&&(i[this.config.nodes[n].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),this._ai.setContext(),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;rc+1&&(clearInterval(s),a&&a(t))},l)},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._attachEventHandlers=function(t){if(this.config.interactive){t=this.getSvg();var e=this;t.addEventListener("touchstart",function(t){t.preventDefault(),e._globalMouseDownHandler.apply(e,[this,t])},{passive:!1}),t.addEventListener("mousedown",function(t){e._globalMouseDownHandler.apply(e,[this,t])},{passive:!0}),t.addEventListener("contextmenu",function(t){e._globalContextHandler.apply(e,[this,t])},{passive:!1}),t.addEventListener("dblclick",function(t){e._globalDbClickHandler.apply(e,[this,t])},{passive:!0}),this.config.mouseScrool!=OrgChart.action.none&&t.addEventListener("wheel",function(t){e._mouseScrollHandler.apply(e,[this,t])},{passive:!1});var r=this.getMenuButton();r&&r.addEventListener("click",function(t){e._menuClickHandler.apply(e,[this,t])})}},void 0===OrgChart&&(OrgChart={}),OrgChart.VERSION="8.21.26",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.match.boundaryIfOutside=100004,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.A5={width:420,height:595},OrgChart.A4={width:595,height:842},OrgChart.A3={width:842,height:1191},OrgChart.A2={width:1191,height:1684},OrgChart.A1={width:1684,height:2384},OrgChart.Letter={width:612,height:791},OrgChart.Legal={width:612,height:1009},OrgChart.Legal={width:612,height:1009},OrgChart.Widescreen={width:720,height:1280},OrgChart.Standard={width:720,height:960},OrgChart.COLLAPSE_PARENT_NEIGHBORS=1,OrgChart.COLLAPSE_SUB_CHILDRENS=2,OrgChart.COLLAPSE_PARENT_SUB_CHILDREN_EXCEPT_CLICKED=3,OrgChart.TEXT_THRESHOLD=4e3,OrgChart.IMAGES_THRESHOLD=1e3,OrgChart.LINKS_THRESHOLD=2e3,OrgChart.BUTTONS_THRESHOLD=700,OrgChart.ANIM_THRESHOLD=500,OrgChart.IT_IS_LONELY_HERE='{link}',OrgChart.RES={},OrgChart.IT_IS_LONELY_HERE_LINK=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="auto",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,OrgChart.FILTER_ALPHABETICALLY=!0,OrgChart.SERVER_PREFIX=".azurewebsites.net/api/OrgChartJS",OrgChart.FUNC_URL_NAME="func-url-orgchartjs",OrgChart.MINIMUM_SYMBOLS_IN_SEARCH_INPUT=1,OrgChart.AI_SYSTEM_MESSAGES=[],OrgChart.ORGSCRIBE_OFFSET=" ","undefined"!=typeof module&&(module.exports=OrgChart),OrgChart._intersects=function(t,e,r){var i=t.x-r.siblingSeparation/4,n=t.y,a=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,n=t.y-r.siblingSeparation/4,a=t.x,o=t.y+t.h+r.siblingSeparation/4}var s,l,h,c=e.p,d=e.q,g=e.r,p=e.s;return 0!==(s=(a-i)*(p-d)-(g-c)*(o-n))&&(l=((n-o)*(g-i)+(a-i)*(p-n))/s,0<(h=((p-d)*(g-i)+(c-g)*(p-n))/s)&&h<1&&0`),this._drawCurrentNodeElement())},OrgChart.editUI.prototype.save=function(){var t=this.obj.element.querySelector("[data-boc-edit-form]"),e=OrgChart.input.validateAndGetData(t);if(!1!==e){var r=this.obj.get(this.nodeId),i={data:OrgChart.mergeDeep(r,e)};if(!1===OrgChart.events.publish("save",[this,i]))return;return this.obj.updateNode(i.data,null,!0,this.obj.config.editForm.saveOnHide),!0}return!1},OrgChart.editUI.prototype._focusElement=function(t){var e=null;OrgChart.isNEU(this.obj.config.editForm.focusBinding)?OrgChart.isNEU(t)||(e=document.getElementById(t)):e=this.obj.element.querySelector('[data-binding="'+this.obj.config.editForm.focusBinding+'"]'),e&&(e.value&&e.value.length&&e.setSelectionRange(e.value.length,e.value.length),e.focus())},OrgChart.editUI.prototype.content=function(t,e,r,i,n){var a,o=this.obj.config.editForm.readOnly,s=JSON.parse(JSON.stringify(this.obj.config.editForm.elements)),l=this.obj.config.editForm.addMore,h=this.obj.config.editForm.saveOnHide,c=this.obj.config.editForm.saveAndCloseBtn,d=this.obj.config.editForm.cancelBtn,g=this.obj.config.editForm.buttons,p=this.obj.config.editForm.titleBinding,u=this.obj.config.editForm.photoBinding,f=this.obj.getNode(t),m=this.obj._get(t),C=OrgChart.t(f.templateName,f.min,this.obj.getScale()),b=m[p],v=m[u];if(this.obj.config.editForm.generateElementsFromFields)for(var x=0;x`;var k=!e,S=h?"display:none;":"",I=e?"display:none;":"",L=e||!l?"display:none;":"",A=C.editFormHeaderColor?`style="background-color:${C.editFormHeaderColor};"`:"",E=document.createElement("form");if(E.setAttribute("data-boc-edit-form",""),E.classList.add("boc-edit-form"),E.classList.add(this.obj.config.mode),E.classList.add(f.templateName.replaceAll(" ","")),E.classList.add(OrgChart.ui._defsIds[f.templateName]),Array.isArray(f.tags)&&f.tags.length)for(x=0;x\n
    \n ${M}\n ${OrgChart.editUI.renderHeaderContent(b,v,f,m)}\n
    \n
    \n ${function(){if(n)return"";var t="";for(var r in g){var i=g[r];OrgChart.isNEU(i)||(k&&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 n=0;n"}else{l=OrgChart.elements[i.type](m,i,"280px",e);!OrgChart.isNEU(l.id)&&OrgChart.isNEU(a)&&OrgChart.isNEU(l.value)&&(a=l.id),OrgChart.isNEU(l.value)||N.push(`${i.label}: ${l.value}`),t+=l.html}}return t}()}\n\n
    \n ${l}\n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    `,{element:E,focusId:a,title:b,shareText:N.join("\n")}},OrgChart.editUI.prototype.hide=function(){var t=this.obj.element.querySelector("[data-boc-edit-form]");if(t){if(!this.detailsMode&&this.obj.config.editForm.saveOnHide){if(!this.save())return}else{var e=this.obj.get(this.nodeId),r=this.obj.getNode(this.nodeId),i=this.obj.ui.node(r,e,[],this.obj.config,void 0,void 0,void 0,void 0,this.obj.getScale(),this.obj);this._replaceNodeWith(i)}if(!1===OrgChart.events.publish("hide",[this]))return!1;OrgChart.isNEU(this.interval)&&(clearInterval(this.interval),this.interval=null),t.parentNode.removeChild(t),this.nodeId=null,this.detailsMode=null}return!0},OrgChart.editUI.renderHeaderContent=function(t,e,r,i){return`

    ${OrgChart._escapeGreaterLessSign(t)}

    \n
    ${e}
    `},OrgChart.prototype.getSvg=function(){return this.element.querySelector("svg")},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,n){this._show(t,e,r,i,n)},OrgChart.menuUI.prototype._show=function(t,e,r,i,n){var a=this;this.hide();var o="";n||(n=this.menu);var s={firstNodeId:r,secondNodeId:i,menu:n};if(!1===OrgChart.events.publish("show",[this,s]))return!1;for(var l in n=s.menu){var h=n[l].icon,c=n[l].text;void 0===h&&(h=OrgChart.icon[l]?OrgChart.icon[l](24,24,"#7A7A7A"):""),"function"==typeof c&&(c=c()),"function"==typeof h&&(h=h()),o+="
    '+h+"  "+c+"
    "}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 d=OrgChart._menuPosition(t,this.wrapper,this.obj.getSvg());t=d.x,e=d.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\n ${n}\n `}this.instance.element.appendChild(this.element),this.element.addEventListener("click",function(e){for(var r=e.target;r&&r.hasAttribute&&!r.hasAttribute("data-control-id");)r=r.parentNode;if(r.hasAttribute&&r.hasAttribute("data-control-id")){var i=r.getAttribute("data-control-id"),n=t.instance.config.controls[i].onClick;OrgChart._onClickHandler(t.instance,i,n,void 0,void 0)}})}},OrgChart.controlsUI.prototype.hide=function(){null!=this.element&&this.element.parentElement.removeChild(this.element)},OrgChart.circleMenuUI=function(){},OrgChart.circleMenuUI.prototype.init=function(t,e){this.obj=t,this.menu=e,this._menu=null,this._buttonsInterval=[],this._linesInterval=[],this._event_id=OrgChart._guid()},OrgChart.circleMenuUI.prototype.show=function(t,e){this._show(t,e)},OrgChart.circleMenuUI.prototype.isVisible=function(){return null!==this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_wrraper_id+"]")},OrgChart.circleMenuUI.prototype._show=function(t,e){var r=this,i=this.obj.getNode(t),n=OrgChart.t(i.templateName,i.min,this.obj.getScale());if(!OrgChart.isNEU(n.nodeCircleMenuButton)){var a=this.obj.getSvg(),o=this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_id+'="'+t+'"]'),s=this.obj.getNodeElement(t),l=OrgChart._getTransform(o),h=OrgChart._getTransform(s),c=l[4]+h[4],d=l[5]+h[5],g=o.querySelectorAll("line"),p=this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_wrraper_id+"]");if(OrgChart.isNEU(p)||p.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id)!=t){this.hide(),e||(e=this.menu);var u={nodeId:t,menu:e},f=OrgChart.events.publish("show",[this,u]);if(this._menu=e,!1===f)return!1;for(var m=0,C=Object.keys(u.menu).length,b=2*n.nodeCircleMenuButton.radius+4,v=2*Math.PI*b,x=v/C-(2*n.nodeCircleMenuButton.radius+2);x<0;)b+=8,x=(v=2*Math.PI*b)/C-(2*n.nodeCircleMenuButton.radius+2);for(var O in(p=document.createElementNS("http://www.w3.org/2000/svg","g")).setAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id,t),p.setAttribute("transform","matrix(1,0,0,1,"+c+","+d+")"),a.appendChild(p),u.menu){var y=u.menu[O].icon,_=u.menu[O].color,w=u.menu[O].text;"function"==typeof y&&(y=y()),"function"==typeof _&&(_=_()),"function"==typeof w&&(w=w());var k=document.createElementNS("http://www.w3.org/2000/svg","g");k.setAttribute("transform","matrix(1,0,0,1,0,0)"),k.setAttribute(OrgChart.attr.control_node_circle_menu_name,O),k.style.cursor="pointer";var S=document.createElementNS("http://www.w3.org/2000/svg","title");OrgChart.isNEU(w)||(S.innerHTML=w);var I=document.createElementNS("http://www.w3.org/2000/svg","circle");I.setAttribute("cx",0),I.setAttribute("cy",0),I.setAttribute("r",n.nodeCircleMenuButton.radius),I.setAttribute("fill",_),I.setAttribute("stroke-width","1"),I.setAttribute("stroke",n.nodeCircleMenuButton.stroke),k.appendChild(I),k.appendChild(S),k.innerHTML+=y,p.appendChild(k);var L=k.getElementsByTagName("svg")[0];if(L.setAttribute("pointer-events","none"),L){var A=parseInt(L.getAttribute("width")),E=parseInt(L.getAttribute("height"));L.setAttribute("x",-A/2),L.setAttribute("y",-E/2)}var N=m*Math.PI/(C/2);m++;var M=Math.cos(N)*b,T=Math.sin(N)*b;this._buttonsInterval.push(OrgChart.animate(k,{transform:[1,0,0,1,0,0]},{transform:[1,0,0,1,M,T]},250,OrgChart.anim.outBack,function(t){var e=t[0].getAttribute(OrgChart.attr.control_node_circle_menu_name),i=t[0].parentNode.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id);t[0].addEventListener("mouseenter",function(t){OrgChart.events.publish("mouseenter",[r,{from:i,menuItem:u.menu[e],menuItemName:e,event:t}])}),t[0].addEventListener("mouseout",function(t){OrgChart.events.publish("mouseout",[r,{from:i,menuItem:u.menu[e],menuItemName:e,event:t}])})}))}this._linesInterval.push(OrgChart.animate(g[0],{x1:-n.nodeCircleMenuButton.radius/2,y1:-6,x2:n.nodeCircleMenuButton.radius/2,y2:-6},{x1:-7,y1:-7,x2:7,y2:7},500,OrgChart.anim.inOutSin)),this._linesInterval.push(OrgChart.animate(g[1],{x1:-n.nodeCircleMenuButton.radius/2,y1:0,x2:n.nodeCircleMenuButton.radius/2,y2:0},{x1:0,y1:0,x2:0,y2:0},500,OrgChart.anim.inOutSin)),this._linesInterval.push(OrgChart.animate(g[2],{x1:-n.nodeCircleMenuButton.radius/2,y1:6,x2:n.nodeCircleMenuButton.radius/2,y2:6},{x1:-7,y1:7,x2:7,y2:-7},500,OrgChart.anim.inOutSin))}else this.hide()}},OrgChart.circleMenuUI.prototype.hide=function(){for(var t=this._buttonsInterval.length-1;t>=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),n=OrgChart.t(i.templateName,i.min,this.obj.getScale()),a=this.obj.element.querySelector("["+OrgChart.attr.control_node_circle_menu_id+'="'+r+'"]').querySelectorAll("line");a[0].setAttribute("x1",-n.nodeCircleMenuButton.radius/2),a[0].setAttribute("x2",n.nodeCircleMenuButton.radius/2),a[0].setAttribute("y1",-6),a[0].setAttribute("y2",-6),a[1].setAttribute("x1",-n.nodeCircleMenuButton.radius/2),a[1].setAttribute("x2",n.nodeCircleMenuButton.radius/2),a[1].setAttribute("y1",0),a[1].setAttribute("y2",0),a[2].setAttribute("x1",-n.nodeCircleMenuButton.radius/2),a[2].setAttribute("x2",n.nodeCircleMenuButton.radius/2),a[2].setAttribute("y1",6),a[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"]'),n=this.div.querySelector("["+OrgChart.attr.tlbr+'="fit"]'),a=this.div.querySelector("["+OrgChart.attr.tlbr+'="fullScreen"]'),o=this.div.querySelector("["+OrgChart.attr.tlbr+'="expand"]'),s=this;r&&r.addEventListener("click",function(){s.obj.zoom(!0,null,!0)}),i&&i.addEventListener("click",function(){s.obj.zoom(!1,null,!0)}),n&&n.addEventListener("click",function(){s.obj.fit()}),a&&a.addEventListener("click",function(){s.obj.toggleFullScreen()}),o&&o.addEventListener("click",function(){s.obj.expand(null,"all")}),this.layoutBtn&&this.layoutBtn.addEventListener("click",function(){s._visible?s.hideLayout():s.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),s.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,n=this.obj.height()/2-r.offsetHeight/2;r.style.left=i+"px",r.style.top=n+"px";var a=r.offsetWidth;return r.style.width="20px",OrgChart.animate(r,{opacity:0,width:10},{opacity:1,width:a},this.obj.config.anim.duration,this.obj.config.anim.func),!0},void 0===OrgChart&&(OrgChart={}),OrgChart.icon={},OrgChart.icon.png_export=OrgChart.icon.png_preview=OrgChart.icon.pngpreview=OrgChart.icon.png=function(t,e,r){return''},OrgChart.icon.pdf_export=OrgChart.icon.pdf_preview=OrgChart.icon.pdfpreview=OrgChart.icon.pdf=function(t,e,r){return''},OrgChart.icon.svg_export=OrgChart.icon.svg_preview=OrgChart.icon.svg=function(t,e,r){return''},OrgChart.icon.csv_export=OrgChart.icon.csv=function(t,e,r){return''},OrgChart.icon.json_export=OrgChart.icon.json=function(t,e,r){return''},OrgChart.icon.excel=function(t,e,r){return`\n \n`},OrgChart.icon.pp_export=OrgChart.icon.pp_preview=OrgChart.icon.pppreview=OrgChart.icon.powerpoint=function(t,e,r){return`\n\n`},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_export=OrgChart.icon.xml=function(t,e,r){return''},OrgChart.icon.visio_export=OrgChart.icon.visio=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n `},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,n){return null==i&&(i=0),null==n&&(n=0),`\n \n `},OrgChart.icon.user=function(t,e,r,i,n){return OrgChart.isNEU(i)&&(i=0),OrgChart.isNEU(n)&&(n=0),`\n \n \n `},OrgChart.icon.close=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n `},OrgChart.icon.undo=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n `},OrgChart.icon.redo=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n `},OrgChart.icon.send=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n `},OrgChart.icon.x=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n `},OrgChart.icon.x=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n `},OrgChart.icon.fit=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n`},OrgChart.icon.expand_all=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n`},OrgChart.icon.full_screen=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n\n\n\n`},OrgChart.icon.zoom_in=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n `},OrgChart.icon.zoom_out=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n `},OrgChart.icon.layout_normal=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n `},OrgChart.icon.layout_right_offset=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n \n `},OrgChart.icon.layout_left_offset=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n \n `},OrgChart.icon.layout_mixed=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n `},OrgChart.icon.layout_tree=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n `},OrgChart.icon.layout_grid=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n \n \n \n \n \n `},OrgChart.icon.layout_grid=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n \n \n \n \n \n \n \n \n `},OrgChart.icon.cursor=function(t,e,r,i,n){return null==i&&(i=0),null==n&&(n=0),`\n \n \n \n \n `},OrgChart.prototype.exportPDFProfile=function(t,e){console.warn('The "exportPDFProfile" is depricated. Use "exportToPDFProfile" instead.'),t=this._defaultExportProfileOptions(t,"pdf"),this._exportProfile(t,e)},OrgChart.prototype.exportPDFPreview=function(t){console.warn('The "chart.exportPDFPreview" is depricated. Use "chart.pdfPreviewUI.show" instead.'),OrgChart.pdfPrevUI.show(this,t)},OrgChart.prototype.exportPNGProfile=function(t,e){console.warn('The "exportPNGProfile" is depricated. Use "exportToPDFProfile" instead.'),t=this._defaultExportProfileOptions(t,"png"),this._exportProfile(t,e)},OrgChart.prototype.exportPDF=function(t,e){console.warn('The "exportPDF" is depricated. Use "exportToPDF" instead.'),t=this._defaultExportOptions(t,"pdf"),this._export(t,e)},OrgChart.exportPDFFromCharts=function(t,e,r,i){console.warn('The "exportPDFFromCharts" is depricated. Use "chart1.exportToPDF" with pages instead.'),OrgChart._exportPDFFromChartsFetchSequentially(0,t,[],e,r,i)},OrgChart.prototype.exportPNG=function(t,e){console.warn('The "exportPNG" is depricated. Use "exportToPNG" instead.'),t=this._defaultExportOptions(t,"png"),this._export(t,e)},OrgChart.prototype.exportSVG=function(t,e){console.warn('The "exportSVG" is depricated. Use "exportToSVG" instead.'),t=this._defaultExportOptions(t,"svg"),this._export(t,e)},OrgChart.prototype.exportVisio=function(t,e){console.warn('The "exportVisio" is depricated. Use "exportToVisio" instead.'),this.exportToVisio(t,e)},OrgChart._exportPDFFromChartsFetchWithCallback=function(t,e){t.type&&"profile"==t.type.toLowerCase()?t.chartInstance.exportPDFProfile(t,function(t,r){e(r)}):t.chartInstance.exportPDF(t,function(t,r){e(r)})},OrgChart._exportPDFFromChartsFetchSequentially=function(t,e,r,i,n,a){if(t>=e.length){var o=[];for(var s of e)-1==o.indexOf(s.chartInstance)&&o.push(s.chartInstance),delete s.chartInstance;for(var l of(r=JSON.stringify(r),o))OrgChart.loading.show(l);return null==i&&(i="OrgChart.pdf"),null==n&&(n=!1),void OrgChart._ajax(l.config.exportUrl+"/v4","POST",r,"arraybuffer",function(t){for(var e of o)OrgChart.loading.hide(e);a?a(t):OrgChart._downloadFile("application/pdf",t,i,n,"pdf")})}OrgChart._exportPDFFromChartsFetchWithCallback(e[t],function(o){r.push(o),OrgChart._exportPDFFromChartsFetchSequentially(t+1,e,r,i,n,a)})},OrgChart.prototype._defaultExportOptions=function(t,e){return null==t&&(t={}),"svg"==e?(t.ext="svg",t.mime="image/svg+xml"):"visio"==e?(t.ext="vsdx",t.mime="application/vnd.visio"):"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="visio"==e?25: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,parentLevels:t.parentLevels,childLevels:t.childLevels,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,n){var a=document.createElement("div");if(a.innerHTML=i,t.padding>0){var o=a.querySelector("svg"),s=OrgChart._getViewBox(o);s[0]-=t.padding,s[1]-=t.padding,s[2]+=2*t.padding,s[3]+=2*t.padding,o.setAttribute("viewBox",s.join()),o.setAttribute("width",s[2]),o.setAttribute("height",s[3])}if("svg"==t.ext||"vsdx"==t.ext){(o=a.querySelector("svg")).classList.add("boc-"+r.config.mode);var l={content:a.innerHTML,options:t,styles:""};if(!e){var h=OrgChart.events.publish("exportstart",[r,l]);if(!1===h)return!1}var c=r.element.querySelector("[data-boc-styles]");if(c&&(l.styles+=c.outerHTML),l.styles&&(a.childNodes[0].insertAdjacentHTML("afterbegin",l.styles),l.content=a.innerHTML),"svg"==t.ext)if(e)e(l);else{if(!1===(h=OrgChart.events.publish("exportend",[r,l])))return!1;OrgChart._downloadFile(t.mime,l.content,l.options.filename,l.options.openInNewTab,l.options.ext)}else if("vsdx"==t.ext){OrgChart.loading.show(r);var d=JSON.stringify({svg:l.content,fileName:l.options.filename});OrgChart._ajax(r.config.serverUrl+"/Export/Visio","POST",d,"arraybuffer",function(i){if(OrgChart.loading.hide(r),e)e(l,i);else{if(!1===OrgChart.events.publish("exportend",[r,i]))return!1;OrgChart._downloadFile(t.mime,i,l.options.filename,l.options.openInNewTab,l.options.ext)}})}}else r._pages(t,a.querySelector("svg"),n,function(i){var n={content:a.innerHTML,options:t,pages:i,styles:""},o=OrgChart.events.publish("exportstart",[r,n]),s=r.element.querySelector("[data-boc-styles]");if(s&&(n.styles+=s.outerHTML),!1===o)return!1;e||OrgChart.loading.show(r),e?e(r,n,a.querySelector("svg")):(n=JSON.stringify(n),OrgChart._ajax(r.config.exportUrl+"/v4","POST",n,"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.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.exportToCSV=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 n={ext:"csv",filename:t,options:e,nodes:i};if(!1===OrgChart.events.publish("exportstart",[this,n]))return!1;var a=OrgChart._json2csv(n.nodes),o={ext:n.ext,filename:n.filename,options:e,nodes:n.nodes,content:a};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.exportToXML=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 n={ext:"xml",filename:t,options:e,nodes:i};if(!1===OrgChart.events.publish("exportstart",[this,n]))return!1;var a=OrgChart._json2xml(n.nodes),o={ext:n.ext,filename:n.filename,options:e,nodes:n.nodes,content:a};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.exportToJSON=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 n={ext:"json",filename:e.filename,options:e,nodes:i};if(!1===OrgChart.events.publish("exportstart",[this,n]))return!1;var a={ext:n.ext,filename:n.filename,options:e,nodes:n.nodes,content:JSON.stringify(n.nodes)};if(!1===OrgChart.events.publish("exportend",[this,a]))return!1;OrgChart._downloadFile("application/json",a.content,a.options.filename,a.options.openInNewTab,a.ext)},OrgChart._exportIterateForJSON_XML_CSV=function(t,e,r,i){if(Array.isArray(e))for(var n=0;nd.h){b=!1;break}var k=(x[_].minY-x[w].minY)/(100/r);if(_==O-1&&(k=(x[_].maxY-x[w].minY)/(100/r)),k>d.h)break;_++}if(!b)break;var S=(_==O?x[_-1].maxY:x[_-1].minY)-x[w].minY;if(0==S){b=!1;break}if(I=(I=[f,x[w].minY,p,S]).join(),C.push({vb:I,innerSize:{w:d.x,h:S/(100/r)-1},size:g}),_==O)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=[];fPage {current-page} of {total-pages}':"png"==e||"svg"==e?t.footer="":"pptx"==e?t.footer='Slide {current-page} of {total-pages}':"vstx"==e&&(t.footer="")),null==t.expandChildren&&(t.expandChildren=!1),null==t.childLevels&&(t.childLevels=null),null==t.parentLevels&&(t.parentLevels=null),null==t.min&&(t.min=!0),null==t.format&&("pdf"==e?t.format="A4":"pptx"==e&&(t.format="Widescreen")),null==t.fileName&&(t.fileName="OrgChart."+e),null==t.openInNewTab&&(t.openInNewTab=!1),null==t.width&&null==t.height&&("png"==e||"svg"==e||"vstx"==e||"pdf"==e&&"auto"==t.format?(t.width="auto",t.height="auto"):(OrgChart.Screen={width:screen.height/2,height:screen.width/2},t.landscape?(t.width=OrgChart[t.format].height,t.height=OrgChart[t.format].width):(t.width=OrgChart[t.format].width,t.height=OrgChart[t.format].height))),null==t.margin&&(t.margin=[30,20,30,20]),null==t.padding&&(t.padding=0),t.pages||(t.pages=[{}]),t},OrgChart.prototype._requestToExportPDF=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/PDF",e.fileName,t,r)},OrgChart.prototype._requestToExportPNG=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/PNG",e.fileName,t,r)},OrgChart.prototype._requestToExportVisio=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/VSTX",e.fileName,t,r)},OrgChart.prototype._requestToExportSVG=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/SVG",e.fileName,t,r)},OrgChart.prototype._requestToExportPowerPoint=function(t,e,r){OrgChart.__requestExport(this.config.serverUrl+"/Export/PowerPoint",e.fileName,t,r)},OrgChart.__requestExport=function(t,e,r,i){var n={filename:e,pages:r};OrgChart._ajax(t,"POST",JSON.stringify(n),"arraybuffer",function(t){i(t)})},OrgChart.prototype._createExportPages=function(t,e,r){var i=[];if(e.pages.length)for(var n=0;n');var o=i.pages[r],s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),document.body.appendChild(s);var l=OrgChart._getSvgAttributes(e);a?"auto"==i.width?o.width=1e3:o.width=i.width:"auto"==i.width?o.width=l.width+o.margin[3]+o.margin[1]:o.width=i.width;var h=document.createElementNS("http://www.w3.org/2000/svg","g");h.innerHTML=`${o.header.replaceAll("{current-page}",r+1).replaceAll("{total-pages}",i.pages.length)}`,s.appendChild(h),OrgChart._setYAttrToTextElements(o,i,h);var c=h.getBoundingClientRect();h.setAttribute("transform",`matrix(1,0,0,1,${o.margin[3]},${o.margin[0]})`);var d=document.createElementNS("http://www.w3.org/2000/svg","g");d.innerHTML=`${o.footer.replaceAll("{current-page}",r+1).replaceAll("{total-pages}",i.pages.length)}`,s.appendChild(d),OrgChart._setYAttrToTextElements(o,i,d);var g,p=d.getBoundingClientRect();if(a?"auto"==i.height?o.height=1e3:o.height=i.height:"auto"==i.height?o.height=l.height+o.margin[0]+o.margin[2]+c.height+p.height:o.height=i.height,d.setAttribute("transform",`matrix(1,0,0,1,${o.margin[3]},${o.height-o.margin[2]-p.height})`),s.classList.add("boc-"+this.config.mode),document.body.removeChild(s),!o.isProfile){var u=(o.width-o.margin[3]-o.margin[1])/l.width,f=(o.height-o.margin[0]-o.margin[2]-c.height-p.height)/l.height,m=Math.min(u,f,1);l.width*=m,l.height*=m,l.viewBox[0]-=o.padding,l.viewBox[1]-=o.padding,l.viewBox[2]+=2*o.padding,l.viewBox[3]+=2*o.padding,l.x=(o.width-l.width)/2,l.y=o.margin[0]+c.height+(o.height-o.margin[0]-c.height-o.margin[2]-p.height-l.height)/2}g=n?OrgChart._isSVG(e)?e:`${e}`:OrgChart._setSvgAttributes(e,l);var C=o.width,b=o.height;return"pdf"!=t||o.isProfile||(C+=2,b+=2),s.setAttribute("width",C),s.setAttribute("height",b),s.innerHTML=g+s.innerHTML,s},OrgChart.prototype._createProfileSvg=function(t,e){var r=this.editUI.content(e.nodeId,!0,!0,"100%",!0).element;return OrgChart.input.init(r),` \n \n ${r.outerHTML}\n `},OrgChart.prototype.___createExportPages=function(t,e,r,i,n){if(e>=i.pages.length-1){var a={pages:r,options:i,styles:""};if(!1===OrgChart.events.publish("exportstart",[this,a]))return!1;var o=this.mainElement.querySelector("[data-boc-styles]");if(o&&(a.styles+=o.outerHTML),a.styles)for(var s=0;s${this.options.landscape?this.locPortrait:this.locLandscape} `),this.element.innerHTML=`
    \n
    \n \n
    \n
    \n \n ${r} \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    `,this.instance.leftElement.appendChild(this.element),this.instance.leftElement.style.display="block",this.instance.leftElement.querySelector("[data-boc-export-btnnewpage]").addEventListener("click",function(t){e._addPage()});var i=this.instance.leftElement.querySelector("[data-boc-export-landcapeportrait]");i&&i.addEventListener("click",function(t){e._toggleLanscape(this)}),this.instance.leftElement.querySelector("[data-boc-export-pages]").addEventListener("click",function(t){for(var r,i=t.target;i&&i.hasAttribute&&!i.hasAttribute("data-boc-export-page");)i=i.parentNode;i&&i.hasAttribute&&i.hasAttribute("data-boc-export-page")&&(r=i.getAttribute("data-boc-export-page")),t.target.hasAttribute&&(t.target.hasAttribute("data-export-remove")?e._removePage(r):t.target.hasAttribute("data-export-child-plus")?e._incrementDecrementChildLevel(r,!0):t.target.hasAttribute("data-export-child-minus")?e._incrementDecrementChildLevel(r,!1):t.target.hasAttribute("data-export-parent-plus")?e._incrementDecrementParentLevel(r,!0):t.target.hasAttribute("data-export-parent-minus")?e._incrementDecrementParentLevel(r,!1):t.target.hasAttribute("data-export-profiletree")?e._toggelePrintTreeOrProfile(r,!1):e._selectPage(r))});var n=this.instance.leftElement.querySelector("[data-boc-export-cancel]");n&&n.addEventListener("click",function(t){e.hide()});var a=this.instance.leftElement.querySelector("[data-boc-export-export]");a&&a.addEventListener("click",function(t){e.instance.powerPointPreviewUI.isVisible()?e.instance.exportToPowerPoint(e.options):e.instance.pdfPreviewUI.isVisible()?e.instance.exportToPDF(e.options):e.instance.pngPreviewUI.isVisible()?e.instance.exportToPNG(e.options):e.instance.svgPreviewUI.isVisible()&&e.instance.exportToSVG(e.options)}),this.interval&&(clearTimeout(this.interval),this.interval=null),this.interval=OrgChart.animate(this.element,{opacity:0},{opacity:1},300,OrgChart.anim.outSin,function(){e._draw(t)})},OrgChart.exportUI.prototype._draw=function(t){var e=this.instance.leftElement.querySelector("[data-boc-export-pages]");e.innerHTML="";for(var r=0;r \n \n `;"pdf"==this.type&&!OrgChart.isNEU(this.options.pages[r].nodeId)&&(!this.options.pages[r].content||this.options.pages[r].isProfile&&this.options.pages[r].content)&&(l+=`
    \n \n
    `),this.options.pages[r].isProfile||OrgChart.isNEU(this.options.pages[r].nodeId)||(l=`
    \n \n ${null==this.options.pages[r].parentLevels?"all":this.options.pages[r].parentLevels} ${this.locParentLevels}\n
    \n
    \n \n ${null==this.options.pages[r].childLevels?"all":this.options.pages[r].childLevels} ${this.locChildLevels}\n
    `+l),e.innerHTML+=`
    \n ${o}\n ${l} \n
    `}this._selectPage(this.selectedIndex)},OrgChart.exportUI.prototype._toggleLanscape=function(t){var e=this;this.options.landscape=!this.options.landscape,this.options.width=void 0,this.options.height=void 0,this.options=OrgChart._setDefaultOptions(this.options,this.type),t.innerHTML=this.options.landscape?this.locPortrait:this.locLandscape,this.instance._createExportPages(this.type,this.options,function(t){e._draw(t),e._selectPage(e.options.pages.length-1)})},OrgChart.exportUI.prototype._addPage=function(t){var e=this;this.options.pages.push({content:""}),this.instance._createExportPages(this.type,this.options,function(t){e._draw(t),e._selectPage(e.options.pages.length-1);var r=e.element.querySelector(".boc-export-middle");OrgChart.animate(r,{scrollTop:r.scrollTop},{scrollTop:r.scrollHeight},600,OrgChart.anim.outSin)})},OrgChart.exportUI.prototype._removePage=function(t){t=parseInt(t);var e=this;t<=e.selectedIndex&&(e.selectedIndex--,e.selectedIndex<0&&(e.selectedIndex=0)),this.options.pages.splice(t,1),this.instance._createExportPages(this.type,this.options,function(t){e._draw(t),e._selectPage(e.selectedIndex)})},OrgChart.exportUI.prototype._incrementDecrementChildLevel=function(t,e){var r=this;t${this.locClickToAdd}`),n.classList.add("boc-export-selected"),this.selectedIndex=t}},void 0===OrgChart&&(OrgChart={}),OrgChart.events=function(){var t={};return{on:function(e,r,i){Array.isArray(t[e])||(t[e]=[]),t[e].push({listener:r,event_id:i})},removeAll:function(e){Array.isArray(t[e])||(t[e]=[]),t[e]=[]},remove:function(e,r,i){var n=!1;if(t[e]&&Array.isArray(t[e])&&t[e].length>0)for(var a=t[e].length-1;a>=0;a--)(!OrgChart.isNEU(i)&&!OrgChart.isNEU(r)&&t[e][a].event_id==i&&t[e][a].listener==r||!OrgChart.isNEU(i)&&OrgChart.isNEU(r)&&t[e][a].event_id==i||OrgChart.isNEU(i)&&!OrgChart.isNEU(r)&&t[e][a].listener==r||OrgChart.isNEU(i)&&OrgChart.isNEU(r))&&(t[e].splice(a,1),n=!0);return n},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=[],n=0;n0){var o=!0;for(n=0;n0?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;e0)){for(var r=e.target;r!=t;){if(r.hasAttribute(OrgChart.attr.control_expcoll_id)){var i=r.getAttribute(OrgChart.attr.control_expcoll_id),n=this.getNode(i);return void this._expCollHandler(n.id)}if(r.hasAttribute(OrgChart.attr.node_id)){i=r.getAttribute(OrgChart.attr.node_id),n=this.getNode(i);return void this._nodeClickHandler(n.id,e)}if(r.hasAttribute(OrgChart.attr.control_node_menu_id)){e.stopPropagation(),e.preventDefault();i=r.getAttribute(OrgChart.attr.control_node_menu_id),n=this.getNode(i);return void this._nodeMenuClickHandler(n.id,r,e)}if(r.hasAttribute(OrgChart.attr.control_node_circle_menu_id)){e.stopPropagation(),e.preventDefault();i=r.getAttribute(OrgChart.attr.control_node_circle_menu_id);return void this._nodeCircleMenuClickHandler(i)}if(r.hasAttribute(OrgChart.attr.control_node_circle_menu_name))return e.stopPropagation(),void this._nodeCircleMenuItemClickHandler(r,e);if(r.hasAttribute(OrgChart.attr.control_add))return void this._lonelyButtonHandler();if(r.hasAttribute(OrgChart.attr.control_up_id)){i=r.getAttribute(OrgChart.attr.control_up_id);return e.stopPropagation(),e.preventDefault(),void this._upHandler(i)}if(r.hasAttribute(OrgChart.attr.c_link_from))return void OrgChart.events.publish("clink-click",[this,{from:r.getAttribute(OrgChart.attr.c_link_from),to:r.getAttribute(OrgChart.attr.c_link_to),event:e}]);if(r.hasAttribute(OrgChart.attr.s_link_from))return void OrgChart.events.publish("slink-click",[this,{from:r.getAttribute(OrgChart.attr.s_link_from),to:r.getAttribute(OrgChart.attr.s_link_to),event:e}]);if(r.hasAttribute("data-ctrl-n-dotted-close")){i=r.getAttribute("data-ctrl-n-dotted-close");return void this.minimize(i)}if(r.hasAttribute("data-ctrl-n-dotted-open")){i=r.getAttribute("data-ctrl-n-dotted-open");return void this.maximize(i)}r=r.parentNode}OrgChart.events.publish("canvas-click",[this,{event:e}])}},OrgChart.prototype._mouseDownHandler=function(t,e,r){var i=this;OrgChart.HIDE_EDIT_FORM_ON_PAN&&this.editUI.hide(),OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE&&this.searchUI.hide(),this.nodeMenuUI.hide(),this.nodeContextMenuUI.hide(),this.menuUI.hide();var n=this.getViewBox(),a=this.getScale(),o=OrgChart._getClientTouchesXY(e,0),s=OrgChart._getClientTouchesXY(e,1),l={diffX:0,diffY:0,x0:o.x,y0:o.y,type:this.config.enablePan?"pan":"pan-not-enabled",viewBoxLeft:n[0],viewBoxTop:n[1]};e.touches&&e.touches.length>1&&(l.type="pinch",l.dist=Math.sqrt((o.x-s.x)*(o.x-s.x)+(o.y-s.y)*(o.y-s.y)));var h=0,c=function(t){var e=OrgChart._getClientTouchesXY(t,0);if(l&&"pan"==l.type){i._hideBeforeAnimation(),l.diffX=e.x-l.x0,l.diffY=e.y-l.y0,h=Math.max(Math.abs(l.diffY),Math.abs(l.diffX));var r=-l.diffY/a+l.viewBoxTop,o=-l.diffX/a+l.viewBoxLeft;h>3&&(i._hideBeforeAnimation(),i._changeCursorOnPanStart(n,a,t),i._move(r,o,n))}else if(l&&"pinch"==l.type){var s=OrgChart._getClientTouchesXY(t,1),c=Math.sqrt((e.x-s.x)*(e.x-s.x)+(e.y-s.y)*(e.y-s.y)),d=1+(c-l.dist)/(l.dist/100)/100;l.dist=c;var g=OrgChart._pinchMiddlePointInPercent(i.element,i.width(),i.height(),t);i.zoom(d,g)}},d=function(e){if(h<3&&"pinch"!=l.type&&(null==e.touches||e.touches.length<=1))i._clickHandler(t,e);else if(h>10)if("pan"==l.type&&i.config.sticky){i.getScale();setTimeout(function(){OrgChart._moveToBoundaryArea(t,i.getViewBox(),i.response.boundary,function(){i._draw(!0,OrgChart.action.pan)})},0)}else"pan"!=l.type||i.config.sticky||setTimeout(function(){i._draw(!0,OrgChart.action.pan)},0);"pan"==l.type&&i._changeCursorOnPanEnd(),l=null,t.removeEventListener(r.move,c),t.removeEventListener(r.up,d),r.leave&&t.removeEventListener(r.leave,d),r.touchstart&&t.removeEventListener(r.touchstart,d)};t.addEventListener(r.move,c,{passive:!0}),t.addEventListener(r.up,d),r.leave&&t.addEventListener(r.leave,d),r.touchstart&&t.addEventListener(r.touchstart,d,{passive:!0})},OrgChart.prototype._changeCursorOnPanStart=function(t,e,r){var i=this.getPointerElement();if(i){var n=OrgChart._getOffsetXY(this.element,r),a=n.x/e+t[0]-16/e,o=n.y/e+t[1]-16/e;i.style.display="inherit",i.setAttribute("transform","matrix(0,0,0,0,"+a+","+o+")"),OrgChart.animate(i,{transform:[0,0,0,0,a,o],opacity:0},{transform:[1/e,0,0,1/e,a,o],opacity:1},300,OrgChart.anim.outBack)}else this.element.style.cursor="move"},OrgChart.prototype._changeCursorOnPanEnd=function(){var t=this.getPointerElement();t?t.style.display="none":this.element.style.cursor="initial"},OrgChart.prototype._globalMouseDownHandler=function(t,e){var r={move:"mousemove",up:"mouseup",leave:"mouseleave"};-1!=e.type.indexOf("touch")&&(1==e.touches.length?this._touch={x:e.touches[0].clientX,y:e.touches[0].clientY}:this._touch=null,r={move:"touchmove",up:"touchend",touchstart:"touchstart"});for(var i=e.target;i!=t&&!i.hasAttribute(OrgChart.attr.control_node_menu_id)&&!i.hasAttribute(OrgChart.attr.control_node_circle_menu_id);){if(i.hasAttribute(OrgChart.attr.node_id)&&(this.config.enableDragDrop||this.config.movable)){if(null==e.touches||e.touches.length<=1)return void this._nodeMouseDownHandler(i,e,r)}else if(i.hasAttribute(OrgChart.attr.control_node_circle_menu_name)&&(e.stopPropagation(),null==e.touches||e.touches.length<=1))return void this._nodeCircleNodeMenuItemMouseDownHandler(t,i,e,r);i=i.parentNode}e.stopPropagation(),this._mouseDownHandler(t,e,r)},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),n=this.getNode(i);return void this._nodeContextHandler(n.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 n=0;n0?e++:e--,l+=e,i.zoom(1-e/12/50,r),parseInt(l)==parseInt(s)?n=!1:h(t)}()}},OrgChart.prototype._nodeCircleNodeMenuItemMouseDownHandler=function(t,e,r,i){var n=e.parentNode.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id),a=e.getAttribute(OrgChart.attr.control_node_circle_menu_name),o=this.nodeCircleMenuUI._menu[a];if(o.draggable){var s=this,l=OrgChart._getClientXY(r),h=this.getNode(n);e._dragEventFired=!1;var c=s.getScale(),d=null,g=null;document.body.style.mozUserSelect=document.body.style.webkitUserSelect=document.body.style.userSelect="none";var p=this.getSvg(),u={x:l.x,y:l.y},f=e.cloneNode(!0);p.insertBefore(f,p.firstChild);var m=OrgChart._getTransform(f),C=m[4],b=m[5],v=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)}(e);f.setAttribute("transform","matrix(1,0,0,1,"+(C+v.x)+","+(b+v.y)+")"),f.style.opacity=.7;var x=function(t,e){if(null!=t){e.classList.remove("boc-drag-over");for(var r=OrgChart.getStParentNodes(s.getNode(d)),i=0;iOrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE||Math.abs(r.y-u.y)>OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE))s._gragStartedId=e.parentNode.getAttribute(OrgChart.attr.control_node_circle_menu_wrraper_id),!1===OrgChart.events.publish("drag",[s.nodeCircleMenuUI,{from:I,menuItem:o,menuItemName:a}])&&y(),e._dragEventFired=!0;f.setAttribute("transform","matrix("+m.toString()+")")}}},y=function(t){if(s.moveEnd(),p.classList&&(p.classList.remove("boc-cursor-grab"),p.classList.remove("boc-cursor-move"),p.classList.remove("boc-cursor-nodrop"),p.classList.remove("boc-cursor-copy")),p.removeEventListener(i.move,O),p.removeEventListener(i.up,y),i.leave&&p.removeEventListener(i.leave,y),h.id==d||null==d)return p.removeChild(f),s._gragStartedId=null,void(e._dragEventFired&&OrgChart.events.publish("drop",[s.nodeCircleMenuUI,{from:h.id,menuItemName:a,menuItem:o,event:t}]));var r=s.getNode(d);OrgChart.events.publish("drop",[s.nodeCircleMenuUI,{from:h.id,to:r.id,menuItem:o,menuItemName:a,event:t}]),x(d,g),p.removeChild(f),s._gragStartedId=null};p.addEventListener(i.move,O),p.addEventListener(i.up,y),i.leave&&p.addEventListener(i.leave,y)}else this._clickHandler(t,r)},OrgChart.prototype._nodeMouseDownHandler=function(t,e,r){var i=t.getAttribute(OrgChart.attr.node_id),n=this.getNode(i);this.config.movable&&!OrgChart.getRootOf(n).stParent?this._movableHandler(t,e,r):this.config.enableDragDrop&&this._dragDropHandler(t,e,r)},OrgChart.prototype._movableHandler=function(t,e,r){var i=this,n=t.getAttribute(OrgChart.attr.node_id),a=[],o=function(t,e){if(Array.isArray(t))for(var r=0;r1)N(e);else if(I){var r=OrgChart._getClientXY(e),o=e.target;OrgChart.isMobile()&&(o=document.elementFromPoint(r.x,r.y));var s=OrgChart._getOffsetXY(i.element,e),c={left:i.width()-(s.x+i.config.padding)<0,right:s.x-i.config.padding<0,up:i.height()-(s.y+i.config.padding)<0,down:s.y-i.config.padding<0};if(c.left||c.right||c.up||c.down){h.classList&&(h.classList.remove("boc-cursor-grab"),h.classList.add("boc-cursor-move"),h.classList.remove("boc-cursor-nodrop"),h.classList.remove("boc-cursor-copy"));for(var v=[],x=[],O=[],y=[],_=0;_OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE||Math.abs(r.y-I.y)>OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE)){if(i._gragStartedId=a[0],!1===OrgChart.events.publish("drag",[i,n,e,a])&&N(),i.config.enableDragDrop)for(_=0;_1)b(e);else if(c){var r=OrgChart._getClientXY(e),i=e.target;OrgChart.isMobile()&&(i=document.elementFromPoint(r.x,r.y));var n=OrgChart._getOffsetXY(l.element,e),C={left:l.width()-(n.x+l.config.padding)<0,right:n.x-l.config.padding<0,up:l.height()-(n.y+l.config.padding)<0,down:n.y-l.config.padding<0};if(C.left||C.right||C.up||C.down){h.classList&&(h.classList.remove("boc-cursor-grab"),h.classList.add("boc-cursor-move"),h.classList.remove("boc-cursor-nodrop"),h.classList.remove("boc-cursor-copy"));var v=d[4],x=d[5],O=c.x,y=c.y,_=r.x,w=r.y;l.moveStart(C,function(t){d[4]=v+t.x,d[5]=x+t.y,c.x=O-t.xWithoutScale,c.y=y-t.yWithoutScale,r.x=_-t.xWithoutScale,r.y=w-t.yWithoutScale,f.setAttribute("transform","matrix("+d.toString()+")")})}else{if(l.moveEnd(),h.classList&&(h.classList.add("boc-cursor-grab"),h.classList.remove("boc-cursor-move"),h.classList.remove("boc-cursor-nodrop"),h.classList.remove("boc-cursor-copy")),m(o,s),o=null,s=null,l.config.enableDragDrop)for(;null!=i&&i!=h;){if(i.hasAttribute&&i.hasAttribute(OrgChart.attr.node_id)){var k=i.getAttribute(OrgChart.attr.node_id);if(l._gragStartedId&&k!=l._gragStartedId){o=k,s=i;break}}i=i.parentNode}if("draging"==o&&(o=null,s=null),null!=o){s.classList.add("boc-drag-over");for(var S=l.getNode(o),I=OrgChart.getStParentNodes(S),L=0;LOrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE||Math.abs(r.y-c.y)>OrgChart.FIRE_DRAG_NOT_CLICK_IF_MOVE))l._gragStartedId=k,!1===OrgChart.events.publish("drag",[l,k,e])&&b(),t._dragEventFired=!0;f.setAttribute("transform","matrix("+d.toString()+")")}}},b=function(i){if(!t._dragEventFired&&(null==i.touches||i.touches.length<=1)&&l._clickHandler(l.getSvg(),e),l.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),a.id==o||null==o)return t._dragEventFired&&OrgChart.events.publish("drop",[l,a.id,void 0,f,i]),h.removeChild(f),void(l._gragStartedId=null);var n=l.getNode(o);if(!1===OrgChart.events.publish("drop",[l,a.id,n.id,f,i]))return m(o,s),h.removeChild(f),void(l._gragStartedId=null);if(l.canUpdateLink(a.id,o)){var c=l.get(a.id);c.pid=o,c.stpid=null,null!=c.movex&&(c.movex=void 0),null!=c.movey&&(c.movey=void 0),l.updateNode(c,null,!0)}else h.removeChild(f),m(o,s);l._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(Array.isArray(this.getViewBox())&&this.isVisible&&0!=t&&0!=e){var r=this.getViewBox().slice(0),i=t/r[2],n=e/r[3];Math.abs(this._lastSize.width-t)>Math.abs(this._lastSize.height-e)?r[3]=e/i:r[2]=t/n,this.nodeMenuUI.hide(),this.nodeContextMenuUI.hide(),this.menuUI.hide(),this.nodeCircleMenuUI.hide(),this.setViewBox(r),this.xScrollUI.create(t),this.yScrollUI.create(e),this._draw(!0,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){if(this.powerPointPreviewUI.isVisible())this.powerPointPreviewUI._updateSlectedPage(t),this.ripple(t,e.clientX,e.clientY);else if(this.pdfPreviewUI.isVisible())this.pdfPreviewUI._updateSlectedPage(t),this.ripple(t,e.clientX,e.clientY);else if(this.svgPreviewUI.isVisible())this.svgPreviewUI._updateSlectedPage(t),this.ripple(t,e.clientX,e.clientY);else if(this.pngPreviewUI.isVisible())this.pngPreviewUI._updateSlectedPage(t),this.ripple(t,e.clientX,e.clientY);else{var r=this.getNodeElement(t);if(r&&r._dragEventFired)return void(r._dragEventFired=!1);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),n=this.nodeCircleMenuUI._menu[i];OrgChart.events.publish("click",[this.nodeCircleMenuUI,{nodeId:r,menuItemName:i,menuItem:n,event:e}])},OrgChart.prototype._nodeCircleMenuClickHandler=function(t){if(OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE&&this.searchUI.hide(),this.nodeMenuUI.hide(),this.menuUI.hide(),this.nodeContextMenuUI.isVisible())this.nodeContextMenuUI.hide();else{var e=this.getNode(t),r=null;if(Array.isArray(e.tags))for(var i=0;i=OrgChart.MINIMUM_SYMBOLS_IN_SEARCH_INPUT&&e._search()});var 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[0].setAttribute("data-selected","yes"):t.length>0&&r.nextSibling&&r.nextSibling.setAttribute&&(r.removeAttribute("data-selected"),r.nextSibling.setAttribute("data-selected","yes"))},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[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 n=e.lastSearch[i],a="";if(r){var o=e.instance._get(n.id);"function"==typeof r?a=r(e.instance,e.instance.getNode(n.id),o):o[r]&&(a=o[r])}var s="",l="";e.instance.config.searchDisplayField==n.__searchField?s=n.__searchMarks:e.instance.config.searchDisplayField?(s=n[e.instance.config.searchDisplayField],OrgChart.isNEU(s)&&(s=""),l=n.__searchMarks):s=n.__searchMarks;var h={img:a,nodeId:n.id,first:s,second:l,searchItem:n,html:OrgChart.searchUI.createItem(a,n.id,s,l)};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]"),n=0;n${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,n,a,o,s){var l=this;OrgChart.state._get(this.config.state,e,r,function(h){l.state=h,l.action=n,l.actionParams=a,n!=OrgChart.action.init||!l.state||a&&a.method&&"fit"==a.method?(l.viewBox=i,l.vbIsInitializedFromState=!1):(l.viewBox=l.state.vb,l.vbIsInitializedFromState=!0,Array.isArray(l.state.roots)&&(l.config.roots=l.state.roots));var c=l.maxX,d=l.maxY,g=l.minX,p=l.minY,u=l.bordersByRootIdAndLevel,f=l.roots,m=l.nodes;if(t){var C=OrgChart.manager._getResponse(e,r,l.visibleNodeIds,l.config,c,d,g,p,l.viewBox,f,l.action,l.actionParams,m,l.oldNodes,l.vbIsInitializedFromState);n!=OrgChart.action.exporting&&(l.maxX=c,l.maxY=d,l.minX=g,l.minY=p,l.roots=f,l.nodes=m,l.visibleNodeIds=C.visibleNodeIds),C.bordersByRootIdAndLevel=u,C.roots=f,C.adjustify={x:0,y:0},l.state&&(C.adjustify=l.state.adjustify),o(C)}else l.oldNodes=m||null,l._read(function(t){c=t.maxX,d=t.maxY,g=t.minX,p=t.minY,u=t.bordersByRootIdAndLevel,f=t.roots,m=t.nodes;var i=OrgChart.manager._getResponse(e,r,l.visibleNodeIds,l.config,c,d,g,p,l.viewBox,f,l.action,l.actionParams,m,l.oldNodes,l.vbIsInitializedFromState);i.notif=t.limit,i.roots=f,i.bordersByRootIdAndLevel=u,i.adjustify=t.adjustify,n!=OrgChart.action.exporting&&(l.maxX=c,l.maxY=d,l.minX=g,l.minY=p,l.roots=f,l.nodes=m,l.visibleNodeIds=i.visibleNodeIds,l.bordersByRootIdAndLevel=u,l.rootList=t.rootList),o(i)},s)})},OrgChart.manager.prototype._read=function(t,e){var r=this,i=OrgChart.manager._createNodes(this.instance);e(i);var n=i.nodes,a=i.roots,o=OrgChart.remote;null==o&&(o=OrgChart.local),o._setPositions(a,r.layoutConfigs,function(e){var o=OrgChart.manager._doNotChangePositionOfClickedNodeIfAny(a,n,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 s={minX:null,minY:null,maxX:null,maxY:null},l={},h=[],c=0;c=e.collapse.level&&-1==i.indexOf(t.id):t.collapsed=e.collapse&&a>=e.collapse.level-1&&-1==i.indexOf(t.id):n==OrgChart.action.centerNode||n==OrgChart.action.insert||n==OrgChart.action.expand||n==OrgChart.action.collapse?i.has(t.id)&&(t.collapsed=!1):n==OrgChart.action.update&&r&&r.changeRoots&&r.changeRoots.has(t.id)&&(t.collapsed=!1)},OrgChart.manager._initNode=function(t,e,r,i,n,a,o){var s=o.manager.config,l=o.manager.layoutConfigs,h=o.manager.action,c=o.manager.actionParams,d=o.manager.state,g=l[r||"base"];null==t.parent&&OrgChart.manager._setCollpasedProperty(t,g,c,n,h,i-1,d,e);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.manager._iterate=function(t,e,r,i,n,a,o,s,l,h,c,d){var g=d.manager.layoutConfigs;if(OrgChart.manager._initNode(e,r,l,i,h,c,d),e.isAssistant&&(a[e.pid]||(a[e.pid]=[]),a[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)&&(s[e.pid]=p)}}else if(!e.isAssistant&&0==e.childrenIds.length&&e.parent&&!s[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)&&(s[e.pid]=p)}e.stChildren.length&&(t.stContainerNodes||(t.stContainerNodes=[]),t.stContainerNodes.push(e));for(var b=0;bs?1:0;if(m[a].desc&&(d*=-1),0!==d)return d}}})}for(c=0;c-1&&m.childrenIds.splice(mt,1);l.push(d)}}}e.roots=[];for(c=0;c=0;c--)l[c].collapsed&&l.splice(c,1);for(c=0;c=0;O--)if(N[E[O]])for(f=0;f-1&&(m.children.splice(mt,1),m.children.splice(mt,0,z)),z.children.push(v),z.parent=m,v.parent=z,s[z.id]=z}}for(var j in w){(m=s[j]).hasAssistants=!0;z=new OrgChart.node(m.id+"_split_assitant_0",m.id,["assistant"],"split");null!=m.movex&&(z.movex=m.movex),null!=m.movey&&(z.movey=m.movey),OrgChart.manager._initDinamicNode(z,m.lcn,!0),s[z.id]=z;var q=[];for(O=m.children.length-1;O>=0;O--){(H=m.children[O]).isAssistant?(H.parent=null,m.children.splice(O,1),q.splice(0,0,H.id)):H.isPartner||(H.parent&&S[H.parent.id]&&z&&H.parent.id!=z.id&&(Object.defineProperty(S,z.id,Object.getOwnPropertyDescriptor(S,H.parent.id)),delete S[H.parent.id]),H.parent=z,z.children.unshift(H),m.children.splice(O,1))}if(q.length%2){var Y=s[q[q.length-1]],V=new OrgChart.node(Y.id+"_mirror",m.pid,[],"mirror");OrgChart.manager._initDinamicNode(V,Y.lcn,!0),V.isAssistant=!0,V.w=Y.w,V.h=Y.h,s[V.id]=V,q.splice(q.length-1,0,V.id)}var X=1;for(O=q.length-1;O>=0;O--)if(O%2&&O!=q.length-1){var G=new OrgChart.node(m.id+"_split_assitant_"+X,m.pid,[],"split");OrgChart.manager._initDinamicNode(G,m.lcn,!0),null!=m.movex&&(G.movex=m.movex),null!=m.movey&&(G.movey=m.movey),s[G.id]=G,q.splice(O,0,G.id),X++}else O%2&&q.splice(O,0,z.id);for(O=0;O0)),at[ht]||(at[ht]=[]),at[ht].push(ct),lt&&(st[ht]=j,ot[ht]||(ot[ht]=[]),ot[ht].push(ct))}}for(var j in S={},ot)if(ot[j].length>OrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN){var dt=st[j];for(c=s[dt].children.length-1;c>=0;c--){H=s[dt].children[c];ot[j].has(H.id)&&s[dt].children.splice(c,1)}}for(var j in at)at[j].length>OrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN&&(S[j]=at[j])}}for(var j in S){for(var gt=m=s[j];gt.isSplit;)gt=s[gt.pid];for(;gt.isSubLevel;)gt=s[gt.pid];if(0!=(D=r[m.lcn?m.lcn:"base"]).layout||et){rt.pnode=m,rt.layout=D.layout,rt.layoutGridColumns=e.layoutGridColumns,rt.childrenIds=S[j],rt.lastChildrenPidIds=S,rt.subLevels=0,rt.layouts=[],OrgChart.events.publish("node-layout",[t,rt]),OrgChart.events.publish("layout",[rt]),rt.layouts.length||rt.layouts.push({layout:rt.layout,childrenIds:rt.childrenIds,subLevels:rt.subLevels,layoutGridColumns:rt.layoutGridColumns});for(var pt=0;pt2){"dynamic"==ut.layoutGridColumns&&(ut.layoutGridColumns=OrgChart._getDynamicGridCoulumns(ut.childrenIds.length));var Ct=m.id;for(c=m.children.length-1;c>=0;c--)for(O=0;O2&&bt--;for(c=0;c=ut.childrenIds.length;if(ut.childrenIds.length-1=0;c--){m=(H=s[Ot[c]]).parent,H.layout=OrgChart.layout.mixed;for(O=m.children.length-1;O>=0;O--)if(H.id==m.children[O].id){m.children.splice(O,1);break}if(c>0){var yt=s[Ot[c-1]];H.parent=yt,H.layout=OrgChart.layout.mixed,yt.children.push(H)}else m.children.push(H)}}else if(ut.layout>1){z=new OrgChart.node(pt+"_"+m.id+"_split_0",gt.id,[],"split");null!=m.movex&&(z.movex=m.movex),null!=m.movey&&(z.movey=m.movey),OrgChart.manager._initDinamicNode(z,m.lcn),s[z.id]=z,z.layout=ut.layout;var _t=[];for(c=ut.childrenIds.length-1;c>=0;c--){for(H=s[ut.childrenIds[c]],O=0;O2){var wt=new OrgChart.node(pt+"_"+H.id+"_mirror",gt.id,[],"mirror");OrgChart.manager._initDinamicNode(wt,H.lcn),wt.layout=ut.layout,s[wt.id]=wt,_t.splice(0,0,wt.id)}ut.layout!=OrgChart.layout.treeRightOffset&&ut.layout!=OrgChart.layout.treeRight&&_t.splice(0,0,H.id)}for(X=1,O=_t.length-1;O>=0;O--)if(O%2&&O!=_t.length-1){G=new OrgChart.node(pt+"_"+m.id+"_split_"+X,gt.id,[],"split");OrgChart.manager._initDinamicNode(G,m.lcn),null!=m.movex&&(G.movex=m.movex),null!=m.movey&&(G.movey=m.movey),G.layout=ut.layout,s[G.id]=G,_t.splice(O,0,G.id),X++}else O%2&&_t.splice(O,0,z.id);for(O=0;O<_t.length;O+=3){W=null;0==O&&(W=m);J=s[_t[O]],Z=s[_t[O+1]],K=s[_t[O+2]];0!=O&&(W=s[_t[O-3]]),0==O||Z||(W=s[_t[O-2]]),J.parent=W,W.children.push(J),Z&&(0!=O&&(W=s[_t[O-2]]),Z.parent=W,W.children.push(Z)),K&&(0!=O&&(W=s[_t[O-1]]),K.parent=W,W.children.push(K))}}}}}}if(OrgChart.VERTICAL_CHILDREN_ASSISTANT)for(c=0;ch?Math.ceil(l):Math.ceil(h)}else s=OrgChart.LAZY_LOADING_FACTOR/n;if(null!=t.x&&null!=t.y){if(OrgChart._getLazyLoading(e)&&i!==OrgChart.action.exporting){function c(t,e){var r=t.x,i=t.y,n=t.w,a=t.h,o=e[0]-s,l=e[2]+s+e[0],h=e[1]-s,c=e[3]+s+e[1],d=r+n>o&&l>r;return d&&(d=i+a>h&&c>i),d}if(c(t,r))return!0;for(var d=0;de.sl&&(e=r);for(var i=0;i=n-o)switch(w=(n+o)/2-y/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:w=(o-n)/2-y/2}else switch(w=f.x-y/2+OrgChart.manager._getNodeWidth(f,i)/2,i.orientation){case OrgChart.orientation.right:case OrgChart.orientation.right_top:(w=-(y/2-(o-n)/2))-i.padding&&(w=-i.padding)}if(_-2*i.padding>=a-s)switch(k=(a+s)/2-_/2,i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:k=(s-a)/2-_/2}else switch((k=-(_/2-(a-s)/2))>-i.padding&&(k=-i.padding),i.orientation){case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:(k=-(_/2-(s-a)/2))C.right?C.right:C.left),l[0]>C.right&&l[0]>C.left&&(l[0]=C.left>C.right?C.left:C.right),l[1]C.bottom?C.bottom:C.top),l[1]>C.bottom&&l[1]>C.top&&(l[1]=C.top>C.bottom?C.top:C.bottom))}if(c==OrgChart.action.centerNode||c==OrgChart.action.maximize){var S=g[d.id];1==d.options.horizontal&&(l[0]=S.x+S.w/2-l[2]/2),1==d.options.vertical&&(l[1]=S.y+S.h/2-l[3]/2),i.sticky&&(l[0]C.right?C.right:C.left),l[0]>C.right&&l[0]>C.left&&(l[0]=C.left>C.right?C.left:C.right),l[1]C.bottom?C.bottom:C.top),l[1]>C.bottom&&l[1]>C.top&&(l[1]=C.top>C.bottom?C.top:C.bottom))}if(i.sticky&&(c==OrgChart.action.insert||c==OrgChart.action.expand||c==OrgChart.action.collapse||c==OrgChart.action.update||c==OrgChart.action.centerNode)){var I=null;if(c==OrgChart.action.insert&&d&&null!=d.insertedNodeId&&null!=d.insertedNodeId)I=g[d.insertedNodeId];else if(c==OrgChart.action.update&&d&&null!=d.visId&&null!=d.visId)I=g[d.visId];else if(c!=OrgChart.action.expand&&c!=OrgChart.action.collapse||!d||null==d.id||null==d.id){if(c==OrgChart.action.centerNode){switch(i.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:d.options.vertical||(I=g[d.id]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:d.options.horizontal||(I=g[d.id])}I&&(I=OrgChart.manager._getMostDeepChild(I,g))}}else I=g[d.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 L=I.y+I.h-l[3]+i.padding;l[1]L&&(l[1]=L);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:L=I.x-i.padding;l[0]>L&&(l[0]=L);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:L=I.x+I.w-l[2]+i.padding;l[0]0&&(h[r-1].children.push(c),c.parent=h[r-1]),e[c.id]=c,h.push(c)}if(h.length){for(var d=h[h.length-1],g=h[0],p=t.children.length-1;p>=0;p--){var u=t.children[p];d.children.unshift(u),u.parent=d,t.children.splice(p,1)}t.children.push(g),g.parent=t}}},OrgChart.manager._verticalAssistantLevelCountIterate=function(t,e,r){r.max',svg:'{content}',link:'',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:'',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){if(e===OrgChart.action.exporting)return"";var i=OrgChart.t(t.template,!1,r).pointer;return i||(i=""),i},aiButton:function(t){return t.enableAI?'
    AI
    ':""},node:function(t,e,r,i,n,a,o,s,l,h){var c=OrgChart.t(t.templateName,t.min,l),d=c.node.replaceAll("{w}",t.w).replaceAll("{h}",t.h);c.defs&&(d=d.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=c[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);d+=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 v=OrgChart._getPosition(r,t,n,a),x="node";Array.isArray(t.tags)&&t.tags.length&&(x+=" "+t.tags.join(" ")),t.layout&&(x+=" tree-layout");var O="";t.lcn&&(O='lcn="'+t.lcn+'"');var y=OrgChart.nodeOpenTag.replace("{lcn}",O).replace("{id}",t.id).replace("{class}",x).replace("{sl}",t.sl).replace("{level}",t.level).replace("{x}",v.x).replace("{y}",v.y),_=OrgChart._getOpacity(r,t);return d=(y=y.replace("{opacity}",_))+(d+=OrgChart.ui.nodeBtns(i,t,s,c,h))+OrgChart.grCloseTag},nodeBtns:function(t,e,r,i,n){var a="";return null==t.nodeMenu||e.isSplit||r===OrgChart.action.exporting||(a+=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)||(a+=''),a},expandCollapseBtn:function(t,e,r,i,n){var a="";if(i!==OrgChart.action.exporting&&!e.isSplit){var o=r[e.lcn?e.lcn:"base"],s=0,l=0,h=OrgChart.t(e.templateName,e.min,n);if(e.childrenIds.length>0){if(e.hasPartners){for(var c=!1,d=0;d0&&(g=l.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)&&v.rightNeighbor&&v.rightNeighbor.isSplit)switch(l.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:O=OrgChart.ui._linkRightToLeft(v.rightNeighbor,v,h,g);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:O=OrgChart.ui._linkBottomToTop(v.rightNeighbor,v,h,g)}else if((k||v.layout>1)&&v.leftNeighbor&&v.leftNeighbor.isSplit)switch(l.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:O=OrgChart.ui._linkLeftToRight(v.leftNeighbor,v,h,g);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:case OrgChart.orientation.left:case OrgChart.orientation.left_top:O=OrgChart.ui._linkTopToBottom(v.leftNeighbor,v,h,g)}else switch(l.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:if(1==v.isPartner)O=OrgChart.ui._linkLeftToRight(t,v,h,p);else if(2==v.isPartner)O=OrgChart.ui._linkRightToLeft(t,v,h,p);else{_=1==v.layout?void 0:x.minY-(x.minY-f.maxY)/2;O=OrgChart.ui._linkTopToBottom(t,v,h,g,_)}break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:if(1==v.isPartner)O=OrgChart.ui._linkLeftToRight(t,v,h,p);else if(2==v.isPartner)O=OrgChart.ui._linkRightToLeft(t,v,h,p);else{_=1==v.layout?void 0:x.maxY-(x.maxY-f.minY)/2;O=OrgChart.ui._linkBottomToTop(t,v,h,g,_)}break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:if(1==v.isPartner)O=OrgChart.ui._linkTopToBottom(t,v,h,p);else if(2==v.isPartner)O=OrgChart.ui._linkBottomToTop(t,v,h,p);else{_=1==v.layout?void 0:x.maxX-(x.maxX-f.minX)/2;O=OrgChart.ui._linkRightToLeft(t,v,h,g,_)}break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:if(1==v.isPartner)O=OrgChart.ui._linkTopToBottom(t,v,h,p);else if(2==v.isPartner)O=OrgChart.ui._linkBottomToTop(t,v,h,p);else{_=1==v.layout?void 0:x.minX-(x.minX-f.maxX)/2;O=OrgChart.ui._linkLeftToRight(t,v,h,g,_)}}}var S=OrgChart.ui._draggableLinkPath(e,t,v,O,g,l.orientation);if(S)b=S,y=y.replaceAll("{rounded}",S).replaceAll("{edge}",S).replaceAll("{curve}",b);else if(-1!=y.indexOf("{rounded}"))if(O.xa==O.xb&&O.xa==O.xc&&O.xa==O.xd||O.ya==O.yb&&O.ya==O.yc&&O.ya==O.yd)b="M"+O.xa+","+O.ya+" L"+O.xd+","+O.yd,y=y.replaceAll("{rounded}",b);else if(Math.abs(O.xa-O.xd)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(O.xa-O.xc)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(O.xa-O.xb)<=OrgChart.LINK_ROUNDED_CORNERS)b="M"+O.xa+","+O.ya+" L"+O.xa+","+O.yd,y=y.replaceAll("{rounded}",b);else if(Math.abs(O.ya-O.yd)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(O.ya-O.yc)<=OrgChart.LINK_ROUNDED_CORNERS&&Math.abs(O.ya-O.yb)<=OrgChart.LINK_ROUNDED_CORNERS)b="M"+O.xa+","+O.ya+" L"+O.xd+","+O.ya,y=y.replaceAll("{rounded}",b);else{var I=OrgChart.ui._roundedEdge(O.xa,O.ya,O.xb,O.yb,O.xc,O.yc),L=OrgChart.ui._roundedEdge(O.xb,O.yb,O.xc,O.yc,O.xd,O.yd);b="M"+I.x1+","+I.y1+" "+I.x2+","+I.y2+" Q"+I.qx1+","+I.qy1+" "+I.qx2+","+I.qy2+" L"+L.x2+","+L.y2+" Q"+L.qx1+","+L.qy1+" "+L.qx2+","+L.qy2+" L"+L.x3+","+L.y3,y=y.replaceAll("{rounded}",b)}else-1!=y.indexOf("{edge}")?(b="M"+O.xa+","+O.ya+" "+O.xb+","+O.yb+" "+O.xc+","+O.yc+" L"+O.xd+","+O.yd,y=y.replaceAll("{edge}",b)):-1!=y.indexOf("{curve}")?(b="M"+O.xa+","+O.ya+" C"+O.xb+","+O.yb+" "+O.xc+","+O.yc+" "+O.xd+","+O.yd,y=y.replaceAll("{curve}",b)):(b=y.replaceAll("{xa}",O.xa).replaceAll("{ya}",O.ya).replaceAll("{xb}",O.xb).replaceAll("{yb}",O.yb).replaceAll("{xc}",O.xc).replaceAll("{yc}",O.yc).replaceAll("{xd}",O.xd).replaceAll("{yd}",O.yd),y=b);c.push(OrgChart.linkOpenTag.replaceAll("{id}",t.id).replaceAll("{class}","link "+v.tags.join(" ")).replaceAll("{child-id}",v.id));var A={node:t,cnode:v,p:O,html:y,action:a};OrgChart.events.publish("render-link",[e,A]),c.push(A.html),o&&d.push({id:t.id,childId:v.id,html:A.html});var E="";for(var N in e.config.linkBinding){var M=e.config.linkBinding[N],T=e._get(v.id);if(T){var P=T[M];A.value=P,A.element=h[N],A.name=M,!1!==OrgChart.events.publish("label",[e,A])&&(OrgChart.isNEU(A.value)||OrgChart.isNEU(A.element)||(E+=A.element.replace("{val}",A.value)))}}if(""!=E){var U=O.x,B=O.y;null!=v.movey&&(B+=v.movey),E=OrgChart.linkFieldsOpenTag.replace("{x}",U).replace("{y}",B).replace("{rotate}",0)+E+OrgChart.grCloseTag,c.push(E)}c.push(OrgChart.grCloseTag)}return o?d:c.join("")},svg:function(t,e,r,i,n,a){return OrgChart.t(i.template,!1,a).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 n})},menuButton:function(t){return null==t.menu?"":OrgChart.t(t.template,!1).menuButton.replaceAll("{p}",t.padding)},_roundedEdge:function(t,e,r,i,n,a){var o,s,l,h=OrgChart.LINK_ROUNDED_CORNERS,c=0;return t==r&&t==n||e==i&&e==a?(o=l=r,s=c=i):(t!=n&&r==n&&(o=l=r,s=i,ea&&(c=i-h)),tn&&r==n&&(r+=h),e!=a&&i==a&&(o=r,s=c=i,tn&&(l=r-h)),ea&&i==a&&(i+=h)),{x1:t,y1:e,x2:r,y2:i,x3:n,y3:a,qx1:o,qy1:s,qx2:l,qy2:c}},_linkTopToBottom:function(t,e,r,i,n){var a,o,s,l,h,c=0;return a=t.x+t.w/2+r.linkAdjuster.toX,o=t.y+t.h+r.linkAdjuster.toY,l=s=e.x+e.w/2+r.linkAdjuster.fromX,h=e.y+r.linkAdjuster.fromY,{xa:a,ya:o,xb:a,yb:c=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!=n?n:h-i,xc:s,yc:c,xd:l,yd:h,x:s,y:OrgChart.isNEU(e.parentPartner)?c+16:c,rotate:0}},_linkBottomToTop:function(t,e,r,i,n){var a,o,s,l,h,c=0;return a=t.x+t.w/2+r.linkAdjuster.toX,o=t.y+r.linkAdjuster.toY,l=s=e.x+e.w/2+r.linkAdjuster.fromX,h=e.y+e.h+r.linkAdjuster.fromY,{xa:a,ya:o,xb:a,yb:c=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!=n?n:h+i,xc:s,yc:c,xd:l,yd:h,x:s,y:c-14,rotate:0}},_linkRightToLeft:function(t,e,r,i,n){var a,o,s,l,h,c,d=0;return a=t.x+r.linkAdjuster.toX,o=t.y+t.h/2+r.linkAdjuster.toY,h=e.x+e.w+r.linkAdjuster.fromX,c=l=e.y+e.h/2+r.linkAdjuster.fromY,s=o,{xa:a,ya:o,xb:d=t.rightNeighbor&&t.rightNeighbor.isAssistant&&"split"==e.templateName?t.rightNeighbor.x-i:"split"==t.templateName&&(e.isAssistant||e.layout>1)?h:"split"==e.templateName?a-i:null!=n?n:h+i,yb:s,xc:d,yc:l,xd:h,yd:c,x:d-16,y:l,rotate:90}},_linkLeftToRight:function(t,e,r,i,n){var a,o,s,l,h,c,d=0;return a=t.x+t.w+r.linkAdjuster.toX,o=t.y+t.h/2+r.linkAdjuster.toY,h=e.x+r.linkAdjuster.fromX,c=l=e.y+e.h/2+r.linkAdjuster.fromY,s=o,{xa:a,ya:o,xb:d=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?a+i:null!=n?n:h-i,yb:s,xc:d,yc:l,xd:h,yd:c,x:d+14,y:l,rotate:270}},_linkPpTop:function(t,e,r,i,n,a){var o=t.ppnodes[r.id],s=o.y+o.h/2,l=i.minY-(i.minY-n.maxY)/2,h=(i.minY-n.maxY)/t.maxSidePartnersWithChildren/4,c=OrgChart.ui.__linkPpBottomTop(t,e,r,l,h,o),d=c.x;return l=c.mid,OrgChart.ui._linkTopToBottom({x:d,y:s,w:0,h:0},r,a,0,l)},_linkPpBottom:function(t,e,r,i,n,a){var o=t.ppnodes[r.id],s=o.y+o.h/2,l=i.maxY-(i.maxY-n.minY)/2,h=(i.maxY-n.minY)/t.maxSidePartnersWithChildren/4,c=OrgChart.ui.__linkPpBottomTop(t,e,r,l,h,o),d=c.x;return l=c.mid,OrgChart.ui._linkBottomToTop({x:d,y:s,w:0,h:0},r,a,0,l)},_linkPpLeft:function(t,e,r,i,n,a){var o=t.ppnodes[r.id],s=i.minX-(i.minX-n.maxX)/2,l=(i.minX-n.maxX)/t.maxSidePartnersWithChildren/4,h=o.x+o.w/2,c=OrgChart.ui.__linkPpLeftRight(t,e,r,s,l,o),d=c.y;return s=c.mid,OrgChart.ui._linkLeftToRight({x:h,y:d,w:0,h:0},r,a,0,s)},_linkPpRight:function(t,e,r,i,n,a){var o=t.ppnodes[r.id],s=i.maxX-(i.maxX-n.minX)/2,l=(i.maxX-n.minX)/t.maxSidePartnersWithChildren/4,h=o.x+o.w/2,c=OrgChart.ui.__linkPpLeftRight(t,e,r,s,l,o),d=c.y;return s=c.mid,OrgChart.ui._linkRightToLeft({x:h,y:d,w:0,h:0},r,a,0,s)},__linkPpBottomTop:function(t,e,r,i,n,a){var o=0;return 1==a.isPartner?(o=a.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;l=i.xai.xd)return null;h=i.yai.yb)s=!0,l=i.xai.yd)return null;l=i.xai.xd)return null;h=i.yai.xb)s=!0,h=i.yai.yd){var l=i.xai.xd){h=i.ya(c=r/t[3])?c:h}else l=i;else l=r/s;else l=e/o;else l=(h=e/o)>(c=r/s)?c:h,i===OrgChart.match.boundaryIfOutside&&l>1&&(l=1);return l&&l>n&&(l=n),l&&lr.right?r.right:r.left),e[0]>r.right&&e[0]>r.left&&(n[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&&(n[1]=r.top>r.bottom?r.top:r.bottom),e[0]!==n[0]||e[1]!==n[1]?OrgChart.animate(t,{viewBox:e},{viewBox:n},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,n=!i&&!!window.StyleMedia,a=!(!window.chrome||!window.chrome.webstore&&!window.chrome.runtime);return{opera:t,firefox:e,safari:r,msie:i,edge:n,chrome:a,blink:(a||t)&&!!window.CSS}},OrgChart._menuPosition=function(t,e,r){var i=t.getBoundingClientRect(),n=r.getBoundingClientRect(),a=e.getBoundingClientRect(),o=i.left-n.left,s=i.top-n.top;return i.top+a.height>n.top+n.height&&(s-=a.height),i.left-a.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 n,a,o=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("text")[0],s=parseFloat(o.getAttribute("x")),l=parseFloat(o.getAttribute("y")),h=o.getAttribute("text-anchor"),c=o.getAttribute(OrgChart.attr.width),d=o.getAttribute(OrgChart.attr.text_overflow),g="http://www.w3.org/2000/svg",p=i.getElementsByTagName("svg")[0].getElementsByTagName("text")[0];d||(d="ellipsis");var u=d.split("-");if(u.length>1&&(n=parseInt(d.split("-")[1]),u.length>2&&"ellipsis"==u[2]&&(a=!0)),!c)return OrgChart._escapeHtml(t);if(c=parseFloat(c),s||(s=0),l||(l=0),s||(h="start"),"ellipsis"==d){p.removeChild(p.firstChild),p.textContent=t;for(var f=p.getComputedTextLength(),m=2;f>c;)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!=d.indexOf("multiline")){var C=t.split(" "),b=p.getBBox().height;p.textContent="";var v=document.createElementNS(g,"tspan"),x=document.createTextNode(C[0]);v.setAttributeNS(null,"x",s),v.setAttributeNS(null,"y",l),v.setAttributeNS(null,"text-anchor",h),v.appendChild(x),p.appendChild(v);m=1;for(var O=1,y=!1,_=1;_c){if(v.firstChild.data=v.firstChild.data.slice(0,w),O++,n&&O>n){if(a&&p.children.length==n){var k=p.children[n-1].textContent;p.children[n-1].textContent=k.substring(0,k.length-3)+"...",y=!0}break}(v=document.createElementNS(g,"tspan")).setAttributeNS(null,"x",s),v.setAttributeNS(null,"y",l+b*m),v.setAttributeNS(null,"text-anchor",h),x=document.createTextNode(C[_]),v.appendChild(x),p.appendChild(v),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 y?`${OrgChart._escapeHtml(t)}${S}`:S}},OrgChart._downloadFile=function(t,e,r,i,n){var a=new Blob([e],{type:t});if(1==i){var o=URL.createObjectURL(a);window.open(o,"_blank").focus()}else if(navigator.msSaveBlob)navigator.msSaveBlob(a,r);else{var s=document.createElement("a");if(void 0!==s.download){o=URL.createObjectURL(a);s.setAttribute("href",o);var l=r;l.toLowerCase().endsWith(n.toLowerCase())||(l=l+"."+n),s.setAttribute("download",l),s.style.visibility="hidden",document.body.appendChild(s),s.click(),document.body.removeChild(s)}}},OrgChart._getPosition=function(t,e,r,i){var n={x:e.x,y:e.y};if(null!=r&&(n.x=r),null!=i&&(n.y=r),t&&3==t.length){var a=t[0].indexOf(e.id);-1!=a&&null!=t[1][a].transform&&(null==r&&(n.x=t[1][a].transform[4]),null==i&&(n.y=t[1][a].transform[5]))}return n},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 n=null;if(null!=r&&i.scaleLessThen){var a=[];for(var o in i.scaleLessThen){var s=parseFloat(o);r0){a.sort(function(t,e){return t-e});var l=i.scaleLessThen[a[0]];for(var h in l)null==n&&(n=Object.assign({},i)),n[h]=l[h]}}return e?null==n?i.min?i.min:i:n.min?n.min:n:null==n?i:n},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 n=t.getElementsByTagName(e),a=n.length;0==a&&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&&(a='"'+a+'"'),i>0&&(r+=OrgChart.CSV_DELIMITER),r+=a}return r+"\n"},i="",n=0;ne.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 n(t,e,r,i){var n=(i-90)*Math.PI/180;return{x:t+r*Math.cos(n),y:e+r*Math.sin(n)}}function a(t,e,r,i,a){var o=n(t,e,r,a),s=n(t,e,r,i),l=a-i<=180?"0":"1";return["M",o.x,o.y,"A",r,r,0,l,0,s.x,s.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=[],n=1;n/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,a=e.y-t.y,o=Math.sqrt(i*i+a*a);return n(t,e,Math.min(1,r/o))}function n(t,e,r){return{x:t.x+(e.x-t.x)*r,y:t.y+(e.y-t.y)*r}}function a(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 s=[];if(t.length>1){var l=o(t[0]),h=null;"Z"==t[t.length-1][0]&&t[0].length>2&&(h=["L",l.x,l.y],t[t.length-1]=h),s.push(t[0]);for(var c=1;c2&&"L"==g[0]&&p.length>2&&"L"==p[0]){var u,f,m=o(d),C=o(g),b=o(p);r?(u=n(C,d.origPoint||m,e),f=n(C,p.origPoint||b,e)):(u=i(C,m,e),f=i(C,b,e)),a(g,u),g.origPoint=C,s.push(g);var v=n(u,C,.5),x=n(C,f,.5),O=["C",v.x,v.y,x.x,x.y,f.x,f.y];O.origPoint=C,s.push(O)}else s.push(g)}if(h){var y=o(s[s.length-1]);s.push(["Z"]),a(s[0],y)}}else s=t;return s.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._getLazyLoading=function(t){var e=t.lazyLoading;return"auto"==e&&(e=!!(t&&t.nodes&&t.nodes.length>700)),e},OrgChart._getSvgAttributes=function(t){const e=t.match(/width="([\d.]+)"/),r=t.match(/height="([\d.]+)"/),i=t.match(/x="([\d.]+)"/),n=t.match(/y="([\d.]+)"/),a=t.match(/viewBox="([^"]+)"/),o=e?parseFloat(e[1]):0,s=r?parseFloat(r[1]):0,l=i?parseFloat(i[1]):0,h=n?parseFloat(n[1]):0;let c=[0,0,0,0];return a&&(c=a[1],c=JSON.parse(`[${c}]`)),{width:o,height:s,viewBox:c,x:l,y:h}},OrgChart._setSvgAttributes=function(t,e){var r=e.x,i=e.y,n=e.width,a=e.height,o=e.viewBox.join(",");const s=t.match(/]*?)>/);if(!s)return t;let l=s[0],h=s[1];const c=(t,e,r)=>{if(null==r)return t;const i=new RegExp(`\\s*${e}="[^"]*"`,"i"),n=` ${e}="${r}"`;return t.match(i)?t.replace(i,n):t+n};h=c(h,"x",r),h=c(h,"y",i),h=c(h,"width",n),h=c(h,"height",a),h=c(h,"viewBox",o);const d=``;return t.replace(l,d)},OrgChart._convertTextToNodes=function(t,e){const r=t.split(/\r?\n/).filter(t=>""!==t.trim()),i=[];let n=1;const a=[];for(let t of r){let r=0;for(;t.startsWith(e);)t=t.slice(e.length),r++;if(t=t.trim(),!t)continue;const o=t.match(/^\[([^\]]+)](.*)$/);if(o){const t=o[1].trim(),e=o[2].trim();a.length>0&&(a[a.length-1][t]=e);continue}const s=t.match(/^([^\(]+)\(([^)]+)\)$/);let l,h=[];s?(l=s[1].trim(),h=s[2].split(",").map(t=>t.trim())):l=t;const c={id:n++,pid:0===r?null:a[r-1].id,name:l,tags:h};a[r]=c,a.length=r+1,i.push(c)}return i},OrgChart._convertFromNodesToText=function(t,e){const r={},i=[];function n(t,r){const i=e.repeat(r);let a=i+t.name;Array.isArray(t.tags)&&t.tags.length>0&&(a+="("+t.tags.join(",")+")"),a+="\n";for(const e of Object.keys(t))["id","pid","name","children","tags"].includes(e)||(a+=i+"["+e+"]"+t[e]+"\n");for(const e of t.children)a+=n(e,r+1);return a}return t.forEach(t=>{r[t.id]={...t,children:[]}}),t.forEach(t=>{t.pid&&r[t.pid]?r[t.pid].children.push(r[t.id]):i.push(r[t.id])}),i.map(t=>n(t,0)).join("").trim()},OrgChart._onClickHandler=function(t,e,r,i,n){var a;if(void 0===r)if("add"===e){var o={id:t.generateId(),pid:i};t.addNode(o,null,!0)}else if("edit"===e){var s=t.getNode(i);t.editUI.show(s.id)}else if("details"===e){s=t.getNode(i);t.editUI.show(s.id,!0)}else if("remove"===e)t.removeNode(i,null,!0);else if("svg"===e)console.warn('The "svg" as menu key is depricated. Use "svg_export" instead.'),t.exportSVG({filename:"OrgChart.svg",expandChildren:!1,nodeId:i});else if("pdf"===e)console.warn('The "pdf" as menu key is depricated. Use "pdf_export" instead.'),t.exportPDF({filename:"OrgChart.pdf",expandChildren:!1,nodeId:i});else if("png"===e)console.warn('The "png" as menu key is depricated. Use "png_export" instead.'),t.exportPNG({filename:"OrgChart.png",expandChildren:!1,nodeId:i});else if("svg_export"===e){var l={};OrgChart.isNEU(i)||(l.pages=[{nodeId:i}]),t.exportToSVG(l)}else if("pdf_export"===e){l={};OrgChart.isNEU(i)||(l.pages=[{nodeId:i}]),t.exportToPDF(l)}else if("png_export"===e){l={};OrgChart.isNEU(i)||(l.pages=[{nodeId:i}]),t.exportToPNG(l)}else if("visio_export"===e||"visio"===e)t.exportToVisio({nodeId:i});else if("pp_export"===e||"powerpoint"===e)t.exportToPowerPoint();else if("pp_preview"===e||"pppreview"===e){l={parentLevels:0,childLevels:1,expandChildren:!1,pages:[{parentLevels:null,childLevels:null,expandChildren:!0,nodeId:t.roots[0].id}]};null!=i&&(l.expandChildren=!1,l.pages[0].nodeId=i),t.powerPointPreviewUI.show(l)}else if("pdf_preview"===e||"pdfpreview"===e){l={parentLevels:0,childLevels:1,expandChildren:!1,pages:[{parentLevels:null,childLevels:null,expandChildren:!0,nodeId:t.roots[0].id}]};null!=i&&(l.expandChildren=!1,l.pages[0].nodeId=i),t.pdfPreviewUI.show(l)}else if("svg_preview"===e||"svgpreview"===e){l={parentLevels:0,childLevels:1,expandChildren:!1,pages:[{parentLevels:null,childLevels:null,expandChildren:!0,nodeId:t.roots[0].id}]};null!=i&&(l.expandChildren=!1,l.pages[0].nodeId=i),t.svgPreviewUI.show(l)}else if("png_preview"===e||"pngpreview"===e){l={parentLevels:0,childLevels:1,expandChildren:!1,pages:[{parentLevels:null,childLevels:null,expandChildren:!0,nodeId:t.roots[0].id}]};null!=i&&(l.expandChildren=!1,l.pages[0].nodeId=i),t.pngPreviewUI.show(l)}else"csv_export"===e||"csv"===e?t.exportToCSV({nodeId:i}):"xml_export"===e||"xml"===e?t.exportToXML({nodeId:i}):"json_export"===e||"json"===e?t.exportToJSON({nodeId:i}):"fit"===e?t.fit():"expand_all"===e?t.expand(null,"all"):"full_screen"===e?t.toggleFullScreen():"zoom_in"===e?t.zoom(!0,null,!0):"zoom_out"===e||"zoom_out"===e?t.zoom(!1,null,!0):"layout_mixed"===e?t.setLayout(OrgChart.layout.mixed):"layout_normal"===e?t.setLayout(OrgChart.layout.normal):"layout_right_offset"===e?t.setLayout(OrgChart.layout.treeRightOffset):"layout_left_offset"===e?t.setLayout(OrgChart.layout.treeLeftOffset):"layout_tree"===e?t.setLayout(OrgChart.layout.tree):"layout_grid"===e&&t.setLayout(OrgChart.layout.grid);else a=r.call(t,i,n);return a},OrgChart._isSVG=function(t){if("string"!=typeof t)return!1;const e=t.trim();if(!e.startsWith(""))return!1;try{const t=(new DOMParser).parseFromString(e,"image/svg+xml");return!t.querySelector("parsererror")&&"svg"===t.documentElement.nodeName.toLowerCase()}catch{return!1}},OrgChart.xScrollUI=function(t,e,r,i,n){this.element=t,this.requestParams=r,this.config=e,this.onSetViewBoxCallback=i,this.onDrawCallback=n,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,n){var a=!1;function o(){a=!0;var t=(e.position-e.bar.scrollLeft)/n;if(t>0)t++;else{if(0==t)return void(a=!1);t--}Math.ceil(e.bar.scrollLeft)==Math.ceil(e.position)?a=!1:(e.bar.scrollLeft+=t,s(o))}t.addEventListener("wheel",function(t){if(t.ctrlKey)return;var n=0;if(e.config.mouseScrool==OrgChart.action.xScroll)(n=t.deltaX||t.wheelDeltaX)||(n=t.deltaY||t.wheelDeltaY);else if(e.config.mouseScrool==OrgChart.action.scroll&&!(n=r||!t.shiftKey?t.deltaX||t.wheelDeltaX:t.deltaY||t.wheelDeltaY))return;n=-n,n=Math.max(-1,Math.min(1,n)),e.position+=-n*i;var s=parseFloat(e.innerBar.clientWidth)-parseFloat(e.bar.clientWidth);e.position<0&&(e.position=0);e.position>s&&(e.position=s);a||o()},{passive:!0});var s=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(!0===this.config.showXScroll||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,n=(t.boundary.right-t.boundary.left)/100;t.viewBox[0]=i*n+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 n=(parseFloat(this.innerBar.clientWidth)-parseFloat(this.bar.clientWidth))/100,a=i*n;this.bar.ignore=!0,this.bar.scrollLeft=a,this.position=this.bar.scrollLeft,this.bar.style.visibility=n<=0?"hidden":"",!0!==this.config.showXScroll&&(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,n){this.element=t,this.requestParams=r,this.config=e,this.onSetViewBoxCallback=i,this.onDrawCallback=n,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,n){var a=!1;function o(){a=!0;var t=(e.position-e.bar.scrollTop)/n;if(t>0)t++;else{if(0==t)return void(a=!1);t--}Math.ceil(e.bar.scrollTop)==Math.ceil(e.position)?a=!1:(e.bar.scrollTop+=t,s(o))}t.addEventListener("wheel",function(t){if(t.ctrlKey)return;var n=0;if(e.config.mouseScrool==OrgChart.action.yScroll)(n=t.deltaY||t.wheelDeltaY)||(n=t.deltaX||t.wheelDeltaX);else if(e.config.mouseScrool==OrgChart.action.scroll&&!(n=r||!t.shiftKey?t.deltaY||t.wheelDeltaY:t.deltaX||t.wheelDeltaX))return;n=-n,n=Math.max(-1,Math.min(1,n)),e.position+=-n*i;var s=parseFloat(e.innerBar.clientHeight)-parseFloat(e.bar.clientHeight);e.position<0&&(e.position=0);e.position>s&&(e.position=s);a||o()},{passive:!0});var s=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(!0===this.config.showYScroll||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,n=(t.boundary.bottom-t.boundary.top)/100;t.viewBox[1]=i*n+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 n=(parseFloat(this.innerBar.clientHeight)-parseFloat(this.bar.clientHeight))/100,a=i*n;this.bar.ignore=!0,this.bar.scrollTop=a,this.position=this.bar.scrollTop,this.bar.style.visibility=n<=0?"hidden":"",!0!==this.config.showYScroll&&(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 n=this.getViewBox().slice(0),a=n,o=n[2],s=n[3];!0===t?(n[2]=n[2]/OrgChart.SCALE_FACTOR,n[3]=n[3]/OrgChart.SCALE_FACTOR):!1===t?(n[2]=n[2]*OrgChart.SCALE_FACTOR,n[3]=n[3]*OrgChart.SCALE_FACTOR):(n[2]=n[2]/t,n[3]=n[3]/t),e||(e=[50,50]),n[0]=a[0]-(n[2]-o)/(100/e[0]),n[1]=a[1]-(n[3]-s)/(100/e[1]);var l=this.getScale(n);if(n[2]=this.width()/l,n[3]=this.height()/l,!0===t&&lthis.config.scaleMin||0!=t&&1!=t&&lthis.config.scaleMin){this._hideBeforeAnimation();var h=this;r?(clearTimeout(h._timeout),OrgChart.animate(this.getSvg(),{viewbox:this.getViewBox()},{viewbox:n},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(n),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 n,a,o,s=t.element.querySelector("#boc-ppdf-size"),l=t.element.querySelector("#boc-ppdf-layout"),h=t.element.querySelector("#boc-ppdf-scale"),c=t.element.querySelector("#boc-ppdf-margin"),d=t.element.querySelector("#boc-ppdf-header"),g=t.element.querySelector("#boc-ppdf-footer");s.value=e.format,l.value=e.landscape,h.value=e.scale,c.value=e.margin,d.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(s,l,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.format=s.value,t.exportPDF(e,OrgChart.pdfPrevUI._handler),OrgChart.pdfPrevUI._showHide(s,l,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.landscape="true"==l.value,t.exportPDF(e,OrgChart.pdfPrevUI._handler),OrgChart.pdfPrevUI._showHide(s,l,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(s,l,h)})}),c.addEventListener("keyup",function(){clearTimeout(n),n=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=c.value.split(",");if(4==r.length){for(var i=0;i
    ';return a&&(c+='
    '+a+"
    "),c+=t,o&&(c+='"),c+="
    ",c+=""},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;rc?(d.y=l,g.y=c+o.h):(d.y=l+a.h,g.y=c);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:p<=u?(C=-1,d.x=p+a.w/10,g.x=u+o.w/10):(C=1,d.x=p-a.w/10,g.x=u+o.w/10),l==c?(C=-1,d.y=l+a.h,g.y=c+o.h):l>c?(d.y=l,g.y=c+o.h):(d.y=l+a.h,g.y=c);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:f<=m?(C=-1,d.y=f+a.h/5,g.y=m+o.h/5):(C=1,d.y=f-a.h/5,g.y=m+o.h/5),s==h?(C=-1,d.x=s,g.x=h):s>h?(d.x=s,g.x=h+o.w):(d.x=s+a.w,g.x=h);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:f<=m?(C=1,d.y=f+a.h/5,g.y=m+o.h/5):(C=-1,d.y=f-a.h/5,g.y=m+o.h/5),s==h?(C=1,d.x=s+a.w,g.x=h+o.w):s>h?(d.x=s,g.x=h+o.w):(d.x=s+a.w,g.x=h)}var b=_(d,g,C),v=n.template;v||(v="orange");var x=OrgChart.clinkTemplates[v];if(n.label){var O=OrgChart.clinkLabelPosition(n,d,g,b);r+=x.label.replace("{x}",O.x).replace("{y}",O.y).replace("{val}",n.label)}var y="M"+d.x+","+d.y+"C"+d.x+","+d.y+" "+b.x+","+b.y+" "+g.x+","+g.y;r+=("').replace("{from}",a.id).replace("{to}",o.id)+x.link.replaceAll("{d}",y)+'',r+=OrgChart.grCloseTag}function _(t,e,r){null==r&&(r=1);var i=e.x-t.x,a=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+a*a)*r)*OrgChart.clinkCurve(n),{x:t.x+i/2-a*o,y:t.y+a/2+i*o}}}e.content+=r},OrgChart.clinkLabelPosition=function(t,e,r,i){var n=(r.x-e.x)/2+e.x,a=(r.y-e.y)/2+e.y;return{x:(n-i.x)/2+i.x,y:(a-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 n=this.config.clinks.length-1;n>=0;n--){var a=this.config.clinks[n];a.from==t&&a.to==e&&this.config.clinks.splice(n,1)}return this.config.clinks.push({from:t,to:e,label:r,template:i}),this._ai.setContext(),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 this._ai.setContext(),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&&(c="right");break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:case OrgChart.orientation.right:case OrgChart.orientation.right_top:c="top",a.y>e.y&&(c="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:n.minY+u};if(e.sl==a.sl)switch(h=a,g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([f.p,f.q]),l.push([f.p,f.q-u/3]),p=OrgChart.t(h.templateName,h.min,i),l.push([h.x+h.w/2+p.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:f.q=e.y+e.h,f.s=n.maxY-u,l.push([f.p,f.q]),l.push([f.r,e.y+e.h+u/3]),p=OrgChart.t(h.templateName,h.min,i),l.push([h.x+h.w/2+p.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.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=n.minX-u,f.s=e.y+e.h/2+p.expandCollapseSize,l.push([f.p,f.q]),l.push([e.x-u/3,f.q]),p=OrgChart.t(h.templateName,h.min,i),l.push([l[l.length-1][0],h.y+h.h/2+p.expandCollapseSize]),l.push([h.x,l[l.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=n.maxX+u,f.s=e.y+e.h/2+p.expandCollapseSize,l.push([f.p,f.q]),l.push([e.x+e.w+u/3,f.q]),p=OrgChart.t(h.templateName,h.min,i),l.push([l[l.length-1][0],h.y+h.h/2+p.expandCollapseSize]),l.push([h.x+h.w,l[l.length-1][1]])}else{switch(g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([f.p,f.q]),l.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=n.maxY-u,l.push([f.p,f.q]),l.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=n.minX-u,f.s=e.y+e.h/2+p.expandCollapseSize,l.push([f.p,f.q]),l.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=n.maxX+u,f.s=e.y+e.h/2+p.expandCollapseSize,l.push([f.p,f.q]),l.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,v=m.parent,x=v.leftNeighbor,O=v.rightNeighbor;if(v.id==a.id?h=v:OrgChart._intersects(v,f,g)&&(f=OrgChart._addPoint(v,l,g,f,c),b=!0),v.id!=a.id){for(;x;){if(x.id==a.id){h=x;break}OrgChart._intersects(x,f,g)&&(f=OrgChart._addPoint(x,l,g,f,c),b=!0),x=x.leftNeighbor}for(;O;){if(O.id==a.id){h=O;break}OrgChart._intersects(O,f,g)&&(f=OrgChart._addPoint(O,l,g,f,c),b=!0),O=O.rightNeighbor}}if(!b){var y=l[l.length-1][0],_=0;if(v.parent){u=g.levelSeparation,v.parent.layout&&(u=g.mixedHierarchyNodesSeparation);var w=t.manager.bordersByRootIdAndLevel[C.id][v.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:y=w.maxX+u*(2/3),_=l[l.length-1][1];break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:y=w.minX-u*(2/3),_=l[l.length-1][1]}}l.push([y,_])}m=v}switch(p=OrgChart.t(h.templateName,h.min,i),l.splice(l.length-1,1),g.orientation){case OrgChart.orientation.top:case OrgChart.orientation.top_left:l.push([h.x+h.w/2+p.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y+h.h]);break;case OrgChart.orientation.bottom:case OrgChart.orientation.bottom_left:l.push([h.x+h.w/2+p.expandCollapseSize,l[l.length-1][1]]),l.push([l[l.length-1][0],h.y]);break;case OrgChart.orientation.left:case OrgChart.orientation.left_top:l.push([l[l.length-1][0],h.y+h.h/2+p.expandCollapseSize]),l.push([h.x+h.w,l[l.length-1][1]]);break;case OrgChart.orientation.right:case OrgChart.orientation.right_top:l.push([l[l.length-1][0],h.y+h.h/2+p.expandCollapseSize]),l.push([h.x,l[l.length-1][1]])}}var k=s.template;k||(k="orange");var S,I,L=null;switch((p=OrgChart.slinkTemplates[k]).labelPosition){case"start":L={x:l[1][0],y:l[1][1]};break;case"middle":var A=Math.ceil(l.length/2);S=l[A],I=l[A-1],L={x:(S[0]+I[0])/2,y:(S[1]+I[1])/2};break;case"end":L={x:l[l.length-2][0],y:l[l.length-2][1]}}o&&(l=l.reverse()),l[0].unshift("M");for(var E=1;E').replace("{from}",U).replace("{to}",B)+p.link.replaceAll("{d}",N)+'',r+=OrgChart.grCloseTag}for(var o=0;o=h.sl?a(l,h,!1):a(h,l,!0))}e.content+=r},OrgChart.prototype.addSlink=function(t,e,r,i){this._putInUndoStack(),this.clearRedo();for(var n=this.config.slinks.length-1;n>=0;n--){var a=this.config.slinks[n];a.from==t&&a.to==e&&this.config.slinks.splice(n,1)}return this.config.slinks.push({from:t,to:e,label:r,template:i}),this._ai.setContext(),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 this._ai.setContext(),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._ai=function(t){this.instance=t,this.sessionId=null},OrgChart._ai.prototype.prompt=function(t,e){var r=this;(t=t.trim())&&(this.sessionId?r._prompt([{Role:"user",Text:t}],e):this.setContext(function(){r._prompt([{Role:"user",Text:t}],e)}))},OrgChart._ai.prototype._prompt=function(t,e){var r=this,i=[];for(var n of OrgChart.AI_SYSTEM_MESSAGES)i.push({Role:"system",Text:n});var a=this.instance.config.serverUrl+`/OrgChartJSAI/Prompt?client_messages=${encodeURIComponent(JSON.stringify(t))}&system_messages=${encodeURIComponent(JSON.stringify(i))}&sessionId=${this.sessionId}`;const o=new EventSource(a);o.onmessage=function(t){var i=JSON.parse(t.data);"end"==i.kind&&o.close(),"text"==i.kind&&(i.text,e&&e(i.text)),"assistant-message-with-tools"==i.kind?r.toolCalls(i.message,e):"error"==i.kind&&console.error(i.text)},o.onerror=function(t){console.error(t),o.close()}},OrgChart._ai.prototype.setContext=function(t){if(this.instance&&this.instance.config.enableAI&&this.instance.aiUI.canSetContext){this.sessionId=this.instance._event_id;var e=this.instance.config.serverUrl+"/OrgChartJSAI/SetContext",r=this.instance.config.aiChatTools.slice();for(var i of r)i.functionParameters=JSON.stringify(i.functionParameters);fetch(e,{method:"post",headers:{"Content-Type":"application/json","x-request-type":"ajax"},body:JSON.stringify({context:this.instance.config.nodes,sessionId:this.sessionId,chatTools:r})}).then(function(){t&&t()}).catch(function(t){console.error(t)})}},OrgChart._ai.prototype.toolCalls=function(t,e){var r=this,i={toolCalls:t.ToolCalls};OrgChart.events.publish("ai-tool-calls",[this.instance,i]);var n=[],a=[],o=[],s=[],l=[],h=null,c=null,d=null,g=null,p=null;for(var u of i.toolCalls)null==u.FunctionResult&&("removeNode"==u.FunctionName?n.push(u):"addNode"==u.FunctionName?a.push(u):"updateNode"==u.FunctionName?o.push(u):"select"==u.FunctionName?s.push(u):"deselect"==u.FunctionName?l.push(u):"exportPDF"==u.FunctionName?h=u:"changeTemplate"==u.FunctionName?c=u:"addSlink"==u.FunctionName?d=u:"removeSlink"==u.FunctionName?g=u:"fit"==u.FunctionName&&(p=u));var f=!1;if(c&&(f=!0,u.FunctionResult="ok",this.instance.config.template=u.FunctionArguments.templateName),d){var m=this.instance.getNode(u.FunctionArguments.employeeId1),C=this.instance.getNode(u.FunctionArguments.employeeId2);m&&C&&m!=C?(f=!0,this.instance.addSlink(m.id,C.id),u.FunctionResult="ok"):u.FunctionResult=`Cannot add link between ${u.FunctionArguments.employeeId1} and ${u.FunctionArguments.employeeId2}`}if(g){m=this.instance.getNode(u.FunctionArguments.employeeId1),C=this.instance.getNode(u.FunctionArguments.employeeId2);m&&C&&m!=C?(f=!0,this.instance.removeSlink(m.id,C.id),u.FunctionResult="ok"):u.FunctionResult=`Cannot remove link between ${u.FunctionArguments.employeeId1} and ${u.FunctionArguments.employeeId2}`}for(var u of(p&&(this.instance.fit(),f=!1),n))f=!0,u.FunctionResult="ok",this.instance.remove(u.FunctionArguments.id);for(var u of a){f=!0,u.FunctionResult="ok",(b=JSON.parse(JSON.stringify(u.FunctionArguments))).isAssistant&&(b.tags=["assistant"]),delete b.isAssistant,OrgChart.isNEU(b.id)&&(b.id=this.instance.generateId()),this.instance.add(b)}for(var u of o){f=!0,u.FunctionResult="ok";var b=this.instance.get(u.FunctionArguments.id);for(var v in u.FunctionArguments)"id"!=v&&null!=u.FunctionArguments[v]&&(b[v]=u.FunctionArguments[v]);this.instance.update(b)}for(var u of s)for(var x of(u.FunctionResult="ok",u.FunctionArguments.ids)){var O=u.FunctionArguments.color;O||(O="#FFCA28");var y=this.instance.getNodeElement(x).firstChild;y&&(y.style.stroke=u.FunctionArguments.color,y.style.strokeWidth=5)}var _=function(){for(var t of l)if(t.FunctionResult="ok",t.FunctionArguments.ids)for(var e of t.FunctionArguments.ids){var i=r.instance.getNodeElement(e).firstChild;i&&(i.style.stroke="#aeaeae",i.style.strokeWidth=1)}else f=!0};f?(this.setContext(),this.instance.draw(OrgChart.action.update,void 0,_)):_();var w=function(){var t=[];for(var n of i.toolCalls)t.push({Role:"tool",Text:n.FunctionResult,Id:n.Id});r._prompt(t,e)};h?OrgChart.exportPDFFromCharts([{format:"A4",chartInstance:this.instance}],void 0,void 0,function(t){u.FunctionResult="ok",OrgChart._downloadFile("application/pdf",t,"OrgChart.pdf",!1,"pdf"),w()}):w()},OrgChart.aiUI=function(){this.instance=null,this.interval=null,this.canSetContext=!1,this.element=null,this.inputElement=null,this.btnSendElement=null,this.messagesElement=null,Object.defineProperty(this,"width",{get(){return this.isVisible()?this.element.offsetWidth:0}})},OrgChart.aiUI.title="AI for OrgChart JS",OrgChart.aiUI.prototype.init=function(t){this.instance=t;var e=this,r=this.instance.element.querySelector("[data-boc-ai-button]");r&&r.addEventListener("click",function(t){e.show()})},OrgChart.aiUI.prototype.isVisible=function(){return!(!this.element||"none"==this.element.style.display)},OrgChart.aiUI.prototype.show=function(t,e){this.instance.pdfPreviewUI.hide(),this.instance.svgPreviewUI.hide(),this.instance.pngPreviewUI.hide(),this.instance.powerPointPreviewUI.hide(),this.instance.aiUI.hide(),this.instance.orgScribeUI.hide(),this._create(),this.element.style.display="",this.canSetContext||(this.canSetContext=!0,this.instance._ai.setContext());var r=this;e||(this.timeout&&clearInterval(this.interval),this.interval=OrgChart.animate(this.element,{opacity:0},{opacity:1},300,OrgChart.anim.outSin,function(){t||r.inputElement.focus()}))},OrgChart.aiUI.prototype._create=function(){if(!this.element){var t=this,e="inp_"+this.instance.generateId();this.element=document.createElement("div"),this.element.setAttribute("data-boc-ai-form",""),this.element.style.opacity=0,this.element.classList.add("boc-ai-form"),this.element.classList.add(this.instance.config.mode),this.element.innerHTML=`
    \n
    ${OrgChart.icon.x(20,20,"#aeaeae")}
    \n
    \n
    \n  \n \n ${OrgChart.aiUI.title}\n \n
    \n
    \n
    \n
    \n \n \n
    \n ${OrgChart.icon.send(20,20,"#aeaeae")}\n
    \n
    \n \n
    \n
    `,this.instance.leftElement.appendChild(this.element),this.instance.leftElement.style.display="block",OrgChart.input.init(this.element);var r=this.instance.leftElement.querySelector("[data-boc-ai-close] svg");r&&r.addEventListener("click",function(e){t.hide()}),this.inputElement=this.element.querySelector("#"+e),this.btnSendElement=this.inputElement.parentNode.querySelector("[data-boc-ai-send]"),this.messagesElement=this.element.querySelector("[data-boc-ai-messages]"),this.inputElement.addEventListener("input",function(t){this.value?this.parentNode.querySelector(".boc-ai-send").classList.add("boc-ai-send-cansend"):this.parentNode.querySelector(".boc-ai-send").classList.remove("boc-ai-send-cansend")}),this.element.querySelector("[data-boc-ai-send]").addEventListener("click",function(e){t.sendUserInput()}),this.inputElement.addEventListener("keyup",function(e){var r=window.event?window.event:e;switch(t.canSetContext||(t.canSetContext=!0,t.instance._ai.setContext()),r.key){case"Enter":t.sendUserInput();break;case"ArrowUp":if((i=OrgChart.aiUI._getSuggestions()).length)-1==(n=i.indexOf(t.inputElement.value))?n=i.length-1:n--,-1==n&&(n=i.length-1),t.inputElement.value=i[n];break;case"ArrowDown":var i,n;if((i=OrgChart.aiUI._getSuggestions()).length)-1==(n=i.indexOf(t.inputElement.value))?n=0:n++,n==i.length&&(n=0),t.inputElement.value=i[n]}})}},OrgChart.aiUI.prototype.addUserMessage=function(t){this.btnSendElement.classList.remove("boc-ai-send-cansend");var e=this.element.querySelector(".boc-ai-start");e&&(e.classList.remove("boc-ai-start"),this.messagesElement.innerHTML="");var r=document.createElement("div");r.classList.add("boc-ai-user-message"),r.innerHTML=`${t}`,this.messagesElement.appendChild(r)},OrgChart.aiUI.prototype.hide=function(){this.instance.leftElement.style.display="none",this.element&&(this.element.parentNode.removeChild(this.element),this.element=null)},OrgChart.aiUI.prototype.sendUserInput=function(){var t=this;OrgChart.aiUI._addSuggestion(this.inputElement.value),this.addUserMessage(this.inputElement.value);var e=document.createElement("div");e.classList.add("boc-ai-assistant-message");var r=document.createElement("span");r.classList.add("boc-inner-assistant-message"),e.appendChild(r),this.messagesElement.appendChild(e);var i="";this.instance._ai.prompt(this.inputElement.value,function(e){i+=e;var n=marked.parse(i);r.innerHTML=n;var a=t.element.querySelector(".boc-ai-middle");a.scrollTo(0,a.scrollHeight)}),this.inputElement.value=""},OrgChart.aiUI._addSuggestion=function(t){t=t.trim();var e=OrgChart.aiUI._getSuggestions(),r=e.indexOf(t);-1!=r&&e.splice(r,1),e.push(t),localStorage.setItem("suggestions",JSON.stringify(e))},OrgChart.aiUI._getSuggestions=function(){var t=localStorage.getItem("suggestions");return t=t?JSON.parse(t):[]},OrgChart.orgScribeUI=function(){this.instance=null,this.element=null,this.textAreaElement=null,this._timeout=null,Object.defineProperty(this,"width",{get(){return this.isVisible()?this.element.offsetWidth:0}})},OrgChart.orgScribeUI.prototype.init=function(t){this.instance=t},OrgChart.events.on("updated",function(t,e){if(t.orgScribeUI.isVisible()){var r=OrgChart._convertFromNodesToText(t.config.nodes,OrgChart.ORGSCRIBE_OFFSET);t.orgScribeUI.textAreaElement.value=r}}),OrgChart.orgScribeUI.prototype.isVisible=function(){return!(!this.element||"none"==this.element.style.display)},OrgChart.orgScribeUI.prototype.show=function(t,e){this.instance.pdfPreviewUI.hide(),this.instance.svgPreviewUI.hide(),this.instance.pngPreviewUI.hide(),this.instance.powerPointPreviewUI.hide(),this.instance.aiUI.hide(),this.instance.orgScribeUI.hide(),this._create(),this.element.style.display="";var r=this;e||(this.timeout&&clearInterval(this.interval),this.interval=OrgChart.animate(this.element,{opacity:0},{opacity:1},300,OrgChart.anim.outSin,function(){if(!t){var e=r.textAreaElement.value.length;r.textAreaElement.focus(),r.textAreaElement.setSelectionRange(e,e)}}))},OrgChart.orgScribeUI.prototype._create=function(){if(!this.element){var t=this;this.element=document.createElement("div"),this.element.setAttribute("data-boc-orgscribe-form",""),this.element.style.opacity=0,this.element.classList.add("boc-orgscribe-form"),this.element.classList.add(this.instance.config.mode);var e=OrgChart._convertFromNodesToText(this.instance.config.nodes,OrgChart.ORGSCRIBE_OFFSET);this.element.innerHTML=`
    \n
    ${OrgChart.icon.x(20,20,"#aeaeae")}
    \n
    \n \n
    \n
    `,this.instance.leftElement.appendChild(this.element),this.instance.leftElement.style.display="block";var r=this.instance.leftElement.querySelector("[data-boc-orgscribe-close] svg");r&&r.addEventListener("click",function(e){t.hide()}),this.textAreaElement=this.element.querySelector('[data-id="boc_orgscribe_txt"]'),this.textAreaElement.addEventListener("input",function(){t._timeout&&(clearTimeout(t._timeout),t._timeout=null);var e=this.value;t._timeout=setTimeout(function(){var r=OrgChart._convertTextToNodes(e,OrgChart.ORGSCRIBE_OFFSET);t.instance.load(r)},500)})}},OrgChart.orgScribeUI.prototype.hide=function(){this.element&&(this.element.parentNode.removeChild(this.element),this.element=null)},function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).marked={})}(this,function(t){"use strict";function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function r(e){t.defaults=e}t.defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};const i={exec:()=>null};function n(t,e=""){let r="string"==typeof t?t:t.source;const i={replace:(t,e)=>{let n="string"==typeof e?e:e.source;return n=n.replace(a.caret,"$1"),r=r.replace(t,n),i},getRegex:()=>new RegExp(r,e)};return i}const a={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},o=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,s=/(?:[*+-]|\d{1,9}[.)])/,l=n(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,s).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),h=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,c=/(?!\s*\])(?:\\.|[^\[\]\\])+/,d=n(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",c).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),g=n(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,s).getRegex(),p="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",u=/|$))/,f=n("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",u).replace("tag",p).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),m=n(h).replace("hr",o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",p).getRegex(),C={blockquote:n(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",m).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:d,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:o,html:f,lheading:l,list:g,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:m,table:i,text:/^[^\n]+/},b=n("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",p).getRegex(),v={...C,table:b,paragraph:n(h).replace("hr",o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",b).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",p).getRegex()},x={...C,html:n("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",u).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:i,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:n(h).replace("hr",o).replace("heading"," *#{1,6} *[^\n]").replace("lheading",l).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},O=/^( {2,}|\\)\n(?!\s*$)/,y=/[\p{P}\p{S}]/u,_=/[\s\p{P}\p{S}]/u,w=/[^\s\p{P}\p{S}]/u,k=n(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,_).getRegex(),S=/(?!~)[\p{P}\p{S}]/u,I=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,L=n(I,"u").replace(/punct/g,y).getRegex(),A=n(I,"u").replace(/punct/g,S).getRegex(),E="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",N=n(E,"gu").replace(/notPunctSpace/g,w).replace(/punctSpace/g,_).replace(/punct/g,y).getRegex(),M=n(E,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,S).getRegex(),T=n("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,w).replace(/punctSpace/g,_).replace(/punct/g,y).getRegex(),P=n(/\\(punct)/,"gu").replace(/punct/g,y).getRegex(),U=n(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),B=n(u).replace("(?:--\x3e|$)","--\x3e").getRegex(),R=n("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",B).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,F=n(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",$).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),H=n(/^!?\[(label)\]\[(ref)\]/).replace("label",$).replace("ref",c).getRegex(),D=n(/^!?\[(ref)\](?:\[\])?/).replace("ref",c).getRegex(),z={_backpedal:i,anyPunctuation:P,autolink:U,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:O,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:i,emStrongLDelim:L,emStrongRDelimAst:N,emStrongRDelimUnd:T,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:F,nolink:D,punctuation:k,reflink:H,reflinkSearch:n("reflink|nolink(?!\\()","g").replace("reflink",H).replace("nolink",D).getRegex(),tag:R,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},W=t=>G[t];function J(t,e){if(e){if(a.escapeTest.test(t))return t.replace(a.escapeReplace,W)}else if(a.escapeTestNoEncode.test(t))return t.replace(a.escapeReplaceNoEncode,W);return t}function Z(t){try{t=encodeURI(t).replace(a.percentDecode,"%")}catch{return null}return t}function K(t,e){const r=t.replace(a.findPipe,(t,e,r)=>{let i=!1,n=e;for(;--n>=0&&"\\"===r[n];)i=!i;return i?"|":" |"}).split(a.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Q(t,"\n")}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const t=e[0],r=function(t,e,r){const i=t.match(r.other.indentCodeCompensation);if(null===i)return e;const n=i[1];return e.split("\n").map(t=>{const e=t.match(r.other.beginningSpace);if(null===e)return t;const[i]=e;return i.length>=n.length?t.slice(n.length):t}).join("\n")}(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const e=Q(t,"#");this.options.pedantic?t=e.trim():e&&!this.rules.other.endingSpaceChar.test(e)||(t=e.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Q(e[0],"\n")}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let t=Q(e[0],"\n").split("\n"),r="",i="";const n=[];for(;t.length>0;){let e=!1;const a=[];let o;for(o=0;o1,n={type:"list",raw:"",ordered:i,start:i?+r.slice(0,-1):"",loose:!1,items:[]};r=i?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=i?r:"[*+-]");const a=this.rules.other.listItemRegex(r);let o=!1;for(;t;){let r=!1,i="",s="";if(!(e=a.exec(t)))break;if(this.rules.block.hr.test(t))break;i=e[0],t=t.substring(i.length);let l=e[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,t=>" ".repeat(3*t.length)),h=t.split("\n",1)[0],c=!l.trim(),d=0;if(this.options.pedantic?(d=2,s=l.trimStart()):c?d=e[1].length+1:(d=e[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=l.slice(d),d+=e[1].length),c&&this.rules.other.blankLine.test(h)&&(i+=h+"\n",t=t.substring(h.length+1),r=!0),!r){const e=this.rules.other.nextBulletRegex(d),r=this.rules.other.hrRegex(d),n=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;t;){const g=t.split("\n",1)[0];let p;if(h=g,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),p=h):p=h.replace(this.rules.other.tabCharGlobal," "),n.test(h))break;if(a.test(h))break;if(o.test(h))break;if(e.test(h))break;if(r.test(h))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!h.trim())s+="\n"+p.slice(d);else{if(c)break;if(l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(n.test(l))break;if(a.test(l))break;if(r.test(l))break;s+="\n"+h}c||h.trim()||(c=!0),i+=g+"\n",t=t.substring(g.length+1),l=p.slice(d)}}n.loose||(o?n.loose=!0:this.rules.other.doubleBlankLine.test(i)&&(o=!0));let g,p=null;this.options.gfm&&(p=this.rules.other.listIsTask.exec(s),p&&(g="[ ] "!==p[0],s=s.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:i,task:!!p,checked:g,loose:!1,text:s,tokens:[]}),n.raw+=i}const s=n.items.at(-1);if(!s)return;s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd(),n.raw=n.raw.trimEnd();for(let t=0;t"space"===t.type),r=e.length>0&&e.some(t=>this.rules.other.anyLine.test(t.raw));n.loose=r}if(n.loose)for(let t=0;t({text:t,tokens:this.lexer.inline(t),header:!1,align:a.align[e]})));return a}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const t="\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const e=Q(t.slice(0,-1),"\\");if((t.length-e.length)%2==0)return}else{const t=function(t,e){if(-1===t.indexOf(e[1]))return-1;let r=0;for(let i=0;i-1){const r=(0===e[0].indexOf("!")?5:4)+e[1].length+t;e[2]=e[2].substring(0,t),e[0]=e[0].substring(0,r).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){const t=this.rules.other.pedanticHrefTitle.exec(r);t&&(r=t[1],i=t[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(r=this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r.slice(1):r.slice(1,-1)),tt(e,{href:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r,title:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const t=e[(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!t){const t=r[0].charAt(0);return{type:"text",raw:t,text:t}}return tt(r,t,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(i&&(!i[3]||!r.match(this.rules.other.unicodeAlphaNumeric))&&(!i[1]&&!i[2]||!r||this.rules.inline.punctuation.exec(r))){const r=[...i[0]].length-1;let n,a,o=r,s=0;const l="*"===i[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,e=e.slice(-1*t.length+r);null!=(i=l.exec(e));){if(n=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!n)continue;if(a=[...n].length,i[3]||i[4]){o+=a;continue}if((i[5]||i[6])&&r%3&&!((r+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);const e=[...i[0]][0].length,l=t.slice(0,r+i.index+e+a);if(Math.min(r,a)%2){const t=l.slice(1,-1);return{type:"em",raw:l,text:t,tokens:this.lexer.inlineTokens(t)}}const h=l.slice(2,-2);return{type:"strong",raw:l,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let t,r;return"@"===e[2]?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let t,r;if("@"===e[2])t=e[0],r="mailto:"+t;else{let i;do{i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??""}while(i!==e[0]);t=e[0],r="www."===e[1]?"http://"+e[0]:e[0]}return{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}}class rt{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t.defaults,this.options.tokenizer=this.options.tokenizer||new et,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:a,block:V.normal,inline:X.normal};this.options.pedantic?(r.block=V.pedantic,r.inline=X.pedantic):this.options.gfm&&(r.block=V.gfm,this.options.breaks?r.inline=X.breaks:r.inline=X.gfm),this.tokenizer.rules=r}static get rules(){return{block:V,inline:X}}static lex(t,e){return new rt(e).lex(t)}static lexInline(t,e){return new rt(e).inlineTokens(t)}lex(t){t=t.replace(a.carriageReturn,"\n"),this.blockTokens(t,this.tokens);for(let t=0;t!!(i=r.call({lexer:this},t,e))&&(t=t.substring(i.raw.length),e.push(i),!0)))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);const r=e.at(-1);1===i.raw.length&&void 0!==r?r.raw+="\n":e.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);const r=e.at(-1);"paragraph"===r?.type||"text"===r?.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue.at(-1).src=r.text):e.push(i);continue}if(i=this.tokenizer.fences(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.heading(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.hr(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.blockquote(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.list(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.html(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.def(t)){t=t.substring(i.raw.length);const r=e.at(-1);"paragraph"===r?.type||"text"===r?.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),e.push(i);continue}let n=t;if(this.options.extensions?.startBlock){let e=1/0;const r=t.slice(1);let i;this.options.extensions.startBlock.forEach(t=>{i=t.call({lexer:this},r),"number"==typeof i&&i>=0&&(e=Math.min(e,i))}),e<1/0&&e>=0&&(n=t.substring(0,e+1))}if(this.state.top&&(i=this.tokenizer.paragraph(n))){const a=e.at(-1);r&&"paragraph"===a?.type?(a.raw+="\n"+i.raw,a.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):e.push(i),r=n.length!==t.length,t=t.substring(i.raw.length)}else if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);const r=e.at(-1);"text"===r?.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):e.push(i)}else if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}throw new Error(e)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){let r=t,i=null;if(this.tokens.links){const t=Object.keys(this.tokens.links);if(t.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(r));)t.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(r));)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(r));)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n=!1,a="";for(;t;){let i;if(n||(a=""),n=!1,this.options.extensions?.inline?.some(r=>!!(i=r.call({lexer:this},t,e))&&(t=t.substring(i.raw.length),e.push(i),!0)))continue;if(i=this.tokenizer.escape(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.tag(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.link(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(i.raw.length);const r=e.at(-1);"text"===i.type&&"text"===r?.type?(r.raw+=i.raw,r.text+=i.text):e.push(i);continue}if(i=this.tokenizer.emStrong(t,r,a)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.codespan(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.br(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.del(t)){t=t.substring(i.raw.length),e.push(i);continue}if(i=this.tokenizer.autolink(t)){t=t.substring(i.raw.length),e.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(t))){t=t.substring(i.raw.length),e.push(i);continue}let o=t;if(this.options.extensions?.startInline){let e=1/0;const r=t.slice(1);let i;this.options.extensions.startInline.forEach(t=>{i=t.call({lexer:this},r),"number"==typeof i&&i>=0&&(e=Math.min(e,i))}),e<1/0&&e>=0&&(o=t.substring(0,e+1))}if(i=this.tokenizer.inlineText(o)){t=t.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(a=i.raw.slice(-1)),n=!0;const r=e.at(-1);"text"===r?.type?(r.raw+=i.raw,r.text+=i.text):e.push(i)}else if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}throw new Error(e)}}return e}}class it{options;parser;constructor(e){this.options=e||t.defaults}space(t){return""}code({text:t,lang:e,escaped:r}){const i=(e||"").match(a.notSpaceStart)?.[0],n=t.replace(a.endingNewline,"")+"\n";return i?'
    '+(r?n:J(n,!0))+"
    \n":"
    "+(r?n:J(n,!0))+"
    \n"}blockquote({tokens:t}){return`
    \n${this.parser.parse(t)}
    \n`}html({text:t}){return t}heading({tokens:t,depth:e}){return`${this.parser.parseInline(t)}\n`}hr(t){return"
    \n"}list(t){const e=t.ordered,r=t.start;let i="";for(let e=0;e\n"+i+"\n"}listitem(t){let e="";if(t.task){const r=this.checkbox({checked:!!t.checked});t.loose?"paragraph"===t.tokens[0]?.type?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=r+" "+J(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`
  • ${e}
  • \n`}checkbox({checked:t}){return"'}paragraph({tokens:t}){return`

    ${this.parser.parseInline(t)}

    \n`}table(t){let e="",r="";for(let e=0;e${i}`),"\n\n"+e+"\n"+i+"
    \n"}tablerow({text:t}){return`\n${t}\n`}tablecell(t){const e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`\n`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${J(t,!0)}`}br(t){return"
    "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:e,tokens:r}){const i=this.parser.parseInline(r),n=Z(t);if(null===n)return i;let a='
    ",a}image({href:t,title:e,text:r}){const i=Z(t);if(null===i)return J(r);let n=`${r}{const n=t[i].flat(1/0);r=r.concat(this.walkTokens(n,e))}):t.tokens&&(r=r.concat(this.walkTokens(t.tokens,e)))}}return r}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(t=>{const r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(t=>{if(!t.name)throw new Error("extension name required");if("renderer"in t){const r=e.renderers[t.name];e.renderers[t.name]=r?function(...e){let i=t.renderer.apply(this,e);return!1===i&&(i=r.apply(this,e)),i}:t.renderer}if("tokenizer"in t){if(!t.level||"block"!==t.level&&"inline"!==t.level)throw new Error("extension level must be 'block' or 'inline'");const r=e[t.level];r?r.unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&("block"===t.level?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:"inline"===t.level&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}"childTokens"in t&&t.childTokens&&(e.childTokens[t.name]=t.childTokens)}),r.extensions=e),t.renderer){const e=this.defaults.renderer||new it(this.defaults);for(const r in t.renderer){if(!(r in e))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const i=r,n=t.renderer[i],a=e[i];e[i]=(...t)=>{let r=n.apply(e,t);return!1===r&&(r=a.apply(e,t)),r||""}}r.renderer=e}if(t.tokenizer){const e=this.defaults.tokenizer||new et(this.defaults);for(const r in t.tokenizer){if(!(r in e))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const i=r,n=t.tokenizer[i],a=e[i];e[i]=(...t)=>{let r=n.apply(e,t);return!1===r&&(r=a.apply(e,t)),r}}r.tokenizer=e}if(t.hooks){const e=this.defaults.hooks||new ot;for(const r in t.hooks){if(!(r in e))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const i=r,n=t.hooks[i],a=e[i];ot.passThroughHooks.has(r)?e[i]=t=>{if(this.defaults.async)return Promise.resolve(n.call(e,t)).then(t=>a.call(e,t));const r=n.call(e,t);return a.call(e,r)}:e[i]=(...t)=>{let r=n.apply(e,t);return!1===r&&(r=a.apply(e,t)),r}}r.hooks=e}if(t.walkTokens){const e=this.defaults.walkTokens,i=t.walkTokens;r.walkTokens=function(t){let r=[];return r.push(i.call(this,t)),e&&(r=r.concat(e.call(this,t))),r}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return rt.lex(t,e??this.defaults)}parser(t,e){return at.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{const i={...r},n={...this.defaults,...i},a=this.onError(!!n.silent,!!n.async);if(!0===this.defaults.async&&!1===i.async)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==e)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof e)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));n.hooks&&(n.hooks.options=n,n.hooks.block=t);const o=n.hooks?n.hooks.provideLexer():t?rt.lex:rt.lexInline,s=n.hooks?n.hooks.provideParser():t?at.parse:at.parseInline;if(n.async)return Promise.resolve(n.hooks?n.hooks.preprocess(e):e).then(t=>o(t,n)).then(t=>n.hooks?n.hooks.processAllTokens(t):t).then(t=>n.walkTokens?Promise.all(this.walkTokens(t,n.walkTokens)).then(()=>t):t).then(t=>s(t,n)).then(t=>n.hooks?n.hooks.postprocess(t):t).catch(a);try{n.hooks&&(e=n.hooks.preprocess(e));let t=o(e,n);n.hooks&&(t=n.hooks.processAllTokens(t)),n.walkTokens&&this.walkTokens(t,n.walkTokens);let r=s(t,n);return n.hooks&&(r=n.hooks.postprocess(r)),r}catch(t){return a(t)}}}onError(t,e){return r=>{if(r.message+="\nPlease report this to https://github.com/markedjs/marked.",t){const t="

    An error occurred:

    "+J(r.message+"",!0)+"
    ";return e?Promise.resolve(t):t}if(e)return Promise.reject(r);throw r}}}const lt=new st;function ht(t,e){return lt.parse(t,e)}ht.options=ht.setOptions=function(t){return lt.setOptions(t),ht.defaults=lt.defaults,r(ht.defaults),ht},ht.getDefaults=e,ht.defaults=t.defaults,ht.use=function(...t){return lt.use(...t),ht.defaults=lt.defaults,r(ht.defaults),ht},ht.walkTokens=function(t,e){return lt.walkTokens(t,e)},ht.parseInline=lt.parseInline,ht.Parser=at,ht.parser=at.parse,ht.Renderer=it,ht.TextRenderer=nt,ht.Lexer=rt,ht.lexer=rt.lex,ht.Tokenizer=et,ht.Hooks=ot,ht.parse=ht;const ct=ht.options,dt=ht.setOptions,gt=ht.use,pt=ht.walkTokens,ut=ht.parseInline,ft=ht,mt=at.parse,Ct=rt.lex;t.Hooks=ot,t.Lexer=rt,t.Marked=st,t.Parser=at,t.Renderer=it,t.TextRenderer=nt,t.Tokenizer=et,t.getDefaults=e,t.lexer=Ct,t.marked=ht,t.options=ct,t.parse=ft,t.parseInline=ut,t.parser=mt,t.setOptions=dt,t.use=gt,t.walkTokens=pt}),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),n="";e.node.min?(i.nodeGroupDottedOpenButton||console.error(`[${e.node.templateName}].nodeGroupDottedOpenButton is not defined`),n+=``,n+=i.nodeGroupDottedOpenButton):(i.nodeGroupDottedCloseButton||console.error(`[${e.node.templateName}].nodeGroupDottedCloseButton is not defined`),n+=``,n+=i.nodeGroupDottedCloseButton),n=(n+="").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 a=t.getNode(e.node.stChildrenIds[0]);if(-1!=n.indexOf("{collapsed-children-count}")){var o=OrgChart.collapsedChildrenCount(t,a);n=n.replace("{collapsed-children-count}",o)}if(-1!=n.indexOf("{collapsed-children-total-count}")){var s=OrgChart.collapsedChildrenTotalCount(t,a);n=n.replace("{collapsed-children-total-count}",s)}if(-1!=n.indexOf("{children-count}")){var l=OrgChart.childrenCount(t,a);n=n.replace("{children-count}",l)}if(-1!=n.indexOf("{children-total-count}")){var h=OrgChart.childrenTotalCount(t,a);n=n.replace("{children-total-count}",h)}e.html+=n}}),void 0===OrgChart&&(OrgChart={}),OrgChart.prototype.undo=function(t){if(this.config.undoRedoStorageName){var e=this.undoStepsCount();if(0!=e){this._putInRedoStack();var r=`${this.config.undoRedoStorageName}_undo_`+(e-1),i=sessionStorage.getItem(r);sessionStorage.removeItem(r);var n=JSON.parse(i);this.config.nodes=n.nodes,this.config.clinks=n.clinks,this.config.slinks=n.slinks,this.config.groupDottedLines=n.groupDottedLines,this.config.dottedLines=n.dottedLines,this._ai.setContext(),OrgChart.events.publish("updated",[this]),this.filterUI.update(),this.draw(OrgChart.action.update,void 0,t),this.undoRedoUI.refresh()}}};OrgChart.prototype.redo=function(t){if(this.config.undoRedoStorageName){var e=this.redoStepsCount();if(0!=e){this._putInUndoStack();var r=`${this.config.undoRedoStorageName}_redo_`+(e-1),i=sessionStorage.getItem(r);sessionStorage.removeItem(r);var n=JSON.parse(i);this.config.nodes=n.nodes,this.config.clinks=n.clinks,this.config.slinks=n.slinks,this.config.groupDottedLines=n.groupDottedLines,this.config.dottedLines=n.dottedLines,this._ai.setContext(),OrgChart.events.publish("updated",[this]),this.filterUI.update(),this.draw(OrgChart.action.update,void 0,t),this.undoRedoUI.refresh()}}},OrgChart.prototype.clearRedo=function(){if(this.config.undoRedoStorageName){for(var t=`${this.config.undoRedoStorageName}_redo_`,e=Object.keys(sessionStorage),r=0;-1!=e.indexOf(t+r);)sessionStorage.removeItem(t+r),r++;this.undoRedoUI.refresh()}},OrgChart.prototype.clearUndo=function(){if(this.config.undoRedoStorageName){for(var t=`${this.config.undoRedoStorageName}_undo_`,e=Object.keys(sessionStorage),r=0;-1!=e.indexOf(t+r);)sessionStorage.removeItem(t+r),r++;this.undoRedoUI.refresh()}},OrgChart.prototype.undoStepsCount=function(){for(var t=`${this.config.undoRedoStorageName}_undo_`,e=Object.keys(sessionStorage),r=0;-1!=e.indexOf(t+r);)r++;return r},OrgChart.prototype.redoStepsCount=function(){for(var t=`${this.config.undoRedoStorageName}_redo_`,e=Object.keys(sessionStorage),r=0;-1!=e.indexOf(t+r);)r++;return r},OrgChart.prototype._putInUndoStack=function(){if(this.config.undoRedoStorageName){var t=`${this.config.undoRedoStorageName}_undo_`+this.undoStepsCount();sessionStorage.setItem(t,JSON.stringify({nodes:this.config.nodes,clinks:this.config.clinks,slinks:this.config.slinks,groupDottedLines:this.config.groupDottedLines,dottedLines:this.config.dottedLines}))}},OrgChart.prototype._putInRedoStack=function(){if(this.config.undoRedoStorageName){var t=`${this.config.undoRedoStorageName}_redo_`+this.redoStepsCount();sessionStorage.setItem(t,JSON.stringify({nodes:this.config.nodes,clinks:this.config.clinks,slinks:this.config.slinks,groupDottedLines:this.config.groupDottedLines,dottedLines:this.config.dottedLines}))}},void 0===OrgChart&&(OrgChart={}),OrgChart.undoRedoUI=function(){this.instance=null,this._event_id=OrgChart._guid()},OrgChart.undoRedoUI.prototype.init=function(t){t.config.undoRedoStorageName&&(this.instance=t,this.refresh())},OrgChart.undoRedoUI.prototype.refresh=function(){var t=this;if(this.instance.config.undoRedoStorageName){var e={undoStepsCount:this.instance.undoStepsCount(),redoStepsCount:this.instance.redoStepsCount()};if(!1!==OrgChart.events.publish("change",[this,e])){var r=this.instance.element.querySelector("[data-undo]"),i=this.instance.element.querySelector("[data-redo]");if(!r||!i){var n=document.createElement("div");n.classList.add("boc-undo-redo"),n.innerHTML=`${OrgChart.icon.undo(50,50,"")}\n ${OrgChart.icon.redo(50,50,"")}`,this.instance.element.appendChild(n),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,n,a,o,s=t.element.querySelector('[data-id="mini-map-focus"]'),l=!1,h=null;s.onmousedown=function(t){var e,a,o,h=s.getBoundingClientRect(),c=h.left,d=h.top;if(i=parseInt(t.clientX-c),n=parseInt(t.clientY-d),e=n,a=(i-OrgChart.miniMap._settings._translateX)/OrgChart.miniMap._settings._scale,o=(e-OrgChart.miniMap._settings._translateY)/OrgChart.miniMap._settings._scale,a>r[0]&&ar[1]&&o1){var c=h[0];o[c]&&(r=[o[c]],h=(l=l.replace(c,"").trim()).split(" "))}h=h.filter(function(t,e,r){return r.indexOf(t)===e});for(var d={},g=0;g=0;b--)s[b].id==C&&s.splice(b,1);OrgChart._search.addNodeToResult(s,i,p,e,f,n)}}else d[C]=e.__score,OrgChart._search.addNodeToResult(s,i,p,e,f,n)}}}return s.sort(function(t,e){return t.__scoree.__score?-1:0}),s},OrgChart._search.addNodeToResult=function(t,e,r,i,n,a){var o={};o.id=r.id,OrgChart.isNEU(r[a])||(o[a]=r[a]);for(var s=0;s0?100:0,c=0,d=0;d=1&&a[p-1].start>a[p].start){h=0;break}}var f=0;0!=s&&(f=s/o);var m=s>0?100:0;0!=l&&(m=100-l/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));a.sort(function(t,e){return t.starte.start?1:0});for(p=a.length-1;p>=0;p--)for(d=0;da[p].start&&a.splice(p,1);var v=e;for(p=a.length-1;p>=0;p--)v=(v=v.insert(a[p].start+a[p].length,"")).insert(a[p].start,"");return{__searchMarks:v,__score:b}},OrgChart._search.searchIndexesOf=function(t,e){var r=[];if(!OrgChart.isNEU(t))for(var i=0;i-1;)r.push({length:n.length,start:a,searchPhrase:n}),a+=n.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&&a<=s){e=!0;break}if(n<=o&&a>=s){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 n=0;n=0){s=l.childrenIds[o];this._keyNavigationActiveNodeId=s,this.center(s)}}}else if("ArrowUp"==e.code){var l;if(l=this.getNode(n.pid)){s=l.id;if(n.isAssistant||l.hasAssistants||n.isPartner||l.hasPartners){o=l.childrenIds.indexOf(n.id);--o>=0&&(s=l.childrenIds[o])}this._keyNavigationActiveNodeId=s,this.center(s)}}else if("ArrowDown"==e.code)n.childrenIds.length&&(this._keyNavigationActiveNodeId=n.childrenIds[0],this.center(n.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;(n=(i=e).querySelector("title"))&&n.parentNode.removeChild(n),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 n,a={text:"",id:t._keyNavigationActiveNodeId};if(OrgChart.events.publish("screen-reader-text",[t,a]),!OrgChart.isNEU(a.text))(n=document.createElementNS("http://www.w3.org/2000/svg","title")).innerHTML=a.text,i.appendChild(n);OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE&&t.searchUI.hide(),i.focus()}},OrgChart.elements={},OrgChart.elements.textbox=function(t,e,r,i){var n=OrgChart.elements._vidrf(t,e,i);if(n.doNotRender)return{html:""};var a="";return e.btn&&(a=`
    ${e.btn}`),{html:`
    \n
    \n \n \n ${a}\n
    \n
    `,id:n.id,value:n.value}},OrgChart.elements.checkbox=function(t,e,r,i){var n=OrgChart.elements._vidrf(t,e,i);if(n.doNotRender)return{html:""};var a=n.value?"checked":"",o=i?'onclick="return false;"':"";return{html:`
    \n \n
    `,id:n.id,value:a}},OrgChart.elements.select=function(t,e,r,i){if(i)return OrgChart.elements.textbox(t,e,r,i);var n=OrgChart.elements._vidrf(t,e,i);return n.doNotRender?{html:""}:{html:`
    \n
    \n \n \n
    \n
    `,id:n.id,value:n.value}},OrgChart.elements.multiSelect=function(t,e,r,i){if(i)return OrgChart.elements.textbox(t,e,r,i);var n=OrgChart.elements._vidrf(t,e,i);return n.doNotRender?{html:""}:{html:`
    \n
    \n \n \n
    \n
    `,id:n.id,value:n.value}},OrgChart.elements.date=function(t,e,r,i){var n=OrgChart.elements._vidrf(t,e,i);return n.doNotRender?{html:""}:{html:`
    \n
    \n \n \n
    \n
    `,id:n.id,value:n.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 n=0;n '+n+"",e.classList.add("boc-validation-error"),!1):a&&!OrgChart.input.validatePassword(e.value)?(r.innerHTML+=' '+a+"",e.classList.add("boc-validation-error"),!1):o&&!OrgChart.input.isValidEmail(e.value)?(r.innerHTML+=' '+o+"",e.classList.add("boc-validation-error"),!1):!(s&&!OrgChart.input.isValidEmails(e.value))||(r.innerHTML+=' '+s+"",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 r[a]=n.value}return r},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 n={oldData:r,newData:i};return t.call(e,n)})},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 n={id:r,newPidsAndStpidsForIds:i};return t.call(e,n)})},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,n,a){var o={dragId:r,dropId:i,dragNodeElement:n,event:a};return t.call(e,o)})},OrgChart.prototype.onDrag=function(t){return this.on("drag",function(e,r,i,n){var a={dragId:r,event:i,nodeIds:n};return t.call(e,a)})},OrgChart.prototype.onExpandCollapseButtonClick=OrgChart.prototype.onExpandCollpaseButtonClick=function(t){return this.on("expcollclick",function(e,r,i,n){var a={collapsing:r,id:i,ids:n};return t.call(e,a)})},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.onCanvasClick=function(t){return this.on("canvas-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.prototype.onAIToolCalls=function(t){return this.on("ai-tool-calls",function(e,r){return t.call(e,r)})},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 n=i[r];if(null!=n&&!1===n.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._removeFilter=function(t){var e=this.instance.get(t);for(var r in this.filterBy){var i=this.filterBy[r];for(var n in e){var a=e[n];i[a]&&(i[a].checked=!0)}}this.update()},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${l}`};OrgChart.events.publish("add-filter",[p,f]),u+=f.html}this.element.innerHTML=`
    ${u}
    `,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=p.instance.element.querySelectorAll("[data-filter-menu]"),i=0;i\n \n \n `};OrgChart.events.publish("add-item",[p,h]);var c=h.html;for(var d in p.filterBy[e]){var g=p.filterBy[e][d],u=g.text;null==u&&(u=d),h={name:e,text:u,value:d,checked:g.checked,html:`
    \n \n \n
    `},OrgChart.events.publish("add-item",[p,h]),c+=h.html}o=document.createElement("div");var f=OrgChart.filterUI.textFilterBy;o.innerHTML=`
    \n ${f} ${e}:\n ${c}\n
    `,o.setAttribute("data-filter-menu",e),o.classList.add("boc-filter-menu"),t.target.parentNode.parentNode.appendChild(o);var m=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