@zklogic/draw.io
Version:
Draw.IO - Graph Editor integration in Angular-cli
1 lines • 86.8 kB
JavaScript
Bridge.assembly("OrgChart.Layout",(function(t){"use strict";Bridge.define("OrgChart.Annotations.CanBeNullAttribute",{inherits:[System.Attribute]}),Bridge.define("OrgChart.Annotations.ContractAnnotationAttribute",{inherits:[System.Attribute],config:{properties:{Contract:null,ForceFullStates:!1}},ctor:function(t){OrgChart.Annotations.ContractAnnotationAttribute.$ctor1.call(this,t,!1)},$ctor1:function(t,e){this.$initialize(),System.Attribute.ctor.call(this),this.setContract(t),this.setForceFullStates(e)}}),Bridge.define("OrgChart.Annotations.NotNullAttribute",{inherits:[System.Attribute]}),Bridge.define("OrgChart.Annotations.PureAttribute",{inherits:[System.Attribute]}),Bridge.define("OrgChart.Layout.Boundary",{Left:null,Right:null,m_spacerMerger:null,config:{properties:{BoundingRect:null},init:function(){this.BoundingRect=new OrgChart.Layout.Rect}},ctor:function(){OrgChart.Layout.Boundary.$ctor1.call(this,!0)},$ctor1:function(t){this.$initialize(),this.Left=new(System.Collections.Generic.List$1(OrgChart.Layout.Boundary.Step)),this.Right=new(System.Collections.Generic.List$1(OrgChart.Layout.Boundary.Step)),t&&(this.m_spacerMerger=new OrgChart.Layout.Boundary.$ctor1(!1))},PrepareForHorizontalLayout:function(t){if(this.Prepare(t),!t.getElement().DisableCollisionDetection){var e=t.getState();this.Left.add(new OrgChart.Layout.Boundary.Step.$ctor1(t,e.getLeft(),e.getTop(),e.getBottom())),this.Right.add(new OrgChart.Layout.Boundary.Step.$ctor1(t,e.getRight(),e.getTop(),e.getBottom()))}},Prepare:function(t){this.Left.clear(),this.Right.clear(),this.setBoundingRect(new OrgChart.Layout.Rect.$ctor1(t.getState().TopLeft,t.getState().Size))},VerticalMergeFrom:function(t){this.setBoundingRect(OrgChart.Layout.Rect.op_Addition(this.getBoundingRect(),t.getBoundingRect()))},MergeFrom:function(t){var e,r,o,a;if(t.getBoundingRect().getTop()>=t.getBoundingRect().getBottom())throw new System.ArgumentException("Cannot merge boundary of height "+System.Double.format(t.getBoundingRect().getBottom()-t.getBoundingRect().getTop(),"G"));for(e=114;0!==e;){for(var n=114===e?this.Right:this.Left,i=114===e?t.Right:t.Left,g=0,s=0;s<i.getCount()&&g<n.getCount();)r=n.getItem(g),o=i.getItem(s),r.Bottom<=o.Top?g=g+1|0:o.Bottom<=r.Top?(n.insert(g,o),s=s+1|0,this.ValidateState()):(a=114===e?r.X<=o.X:r.X>=o.X,OrgChart.Layout.LayoutAlgorithm.IsEqual(r.Top,o.Top)?OrgChart.Layout.LayoutAlgorithm.IsEqual(r.Bottom,o.Bottom)?(a&&n.setItem(g,o),g=g+1|0,s=s+1|0,this.ValidateState()):r.Bottom<o.Bottom?(a&&n.setItem(g,r.ChangeOwner(o.Node,o.X)),i.setItem(s,o.ChangeTop(r.Bottom)),g=g+1|0,this.ValidateState()):(a&&(n.setItem(g,r.ChangeTop(o.Bottom)),n.insert(g,o),g=g+1|0),s=s+1|0,this.ValidateState()):OrgChart.Layout.LayoutAlgorithm.IsEqual(r.Bottom,o.Bottom)?r.Top<o.Top?(a&&(n.setItem(g,r.ChangeBottom(o.Top)),n.insert(g+1|0,o),g=g+1|0),g=g+1|0,s=s+1|0,this.ValidateState()):(a?n.setItem(g,o):(n.insert(g,o.ChangeBottom(r.Top)),g=g+1|0),g=g+1|0,s=s+1|0,this.ValidateState()):r.Top<o.Top&&r.Bottom<o.Bottom?(a&&(n.setItem(g,r.ChangeBottom(o.Top)),n.insert(g+1|0,new OrgChart.Layout.Boundary.Step.$ctor1(o.Node,o.X,o.Top,r.Bottom)),g=g+1|0),i.setItem(s,o.ChangeTop(r.Bottom)),g=g+1|0,this.ValidateState()):r.Top<o.Top&&r.Bottom>o.Bottom?(a&&(n.setItem(g,r.ChangeBottom(o.Top)),n.insert(g+1|0,o),n.insert(g+2|0,r.ChangeTop(o.Bottom)),g=g+2|0),s=s+1|0,this.ValidateState()):r.Bottom>o.Bottom?(a?(n.setItem(g,r.ChangeTop(o.Bottom)),n.insert(g,o)):n.insert(g,o.ChangeBottom(r.Top)),g=g+1|0,s=s+1|0,this.ValidateState()):(a?n.setItem(g,o.ChangeBottom(r.Bottom)):(n.insert(g,o.ChangeBottom(r.Top)),g=g+1|0),i.setItem(s,o.ChangeTop(r.Bottom)),g=g+1|0,this.ValidateState()));if(g===n.getCount())for(;s<i.getCount();)n.add(i.getItem(s)),s=s+1|0,this.ValidateState();e=114===e?108:0}this.setBoundingRect(OrgChart.Layout.Rect.op_Addition(this.getBoundingRect(),t.getBoundingRect()))},MergeFrom$1:function(t){t.getElement().DisableCollisionDetection||OrgChart.Layout.LayoutAlgorithm.IsZero(t.getState().Size.Height)||(this.m_spacerMerger.PrepareForHorizontalLayout(t),this.MergeFrom(this.m_spacerMerger))},ValidateState:function(){for(var t,e=1;e<this.Left.getCount();e=e+1|0)if(OrgChart.Layout.LayoutAlgorithm.IsEqual(this.Left.getItem(e).Top,this.Left.getItem(e).Bottom)||this.Left.getItem(e).Top<this.Left.getItem(e-1|0).Bottom||this.Left.getItem(e).Top<=this.Left.getItem(e-1|0).Top||this.Left.getItem(e).Bottom<=this.Left.getItem(e).Top||this.Left.getItem(e).Bottom<=this.Left.getItem(e-1|0).Bottom)throw new System.Exception("State error at Left index "+e);for(t=1;t<this.Right.getCount();t=t+1|0)if(OrgChart.Layout.LayoutAlgorithm.IsEqual(this.Right.getItem(t).Top,this.Right.getItem(t).Bottom)||this.Right.getItem(t).Top<this.Right.getItem(t-1|0).Bottom||this.Right.getItem(t).Top<=this.Right.getItem(t-1|0).Top||this.Right.getItem(t).Bottom<=this.Right.getItem(t).Top||this.Right.getItem(t).Bottom<=this.Right.getItem(t-1|0).Bottom)throw new System.Exception("State error at Right index "+t)},ComputeOverlap:function(t,e,r){for(var o,a,n,i,g=0,s=0,u=0;g<this.Right.getCount()&&s<t.Left.getCount();)o=this.Right.getItem(g),a=t.Left.getItem(s),o.Bottom<=a.Top?g=g+1|0:a.Bottom<=o.Top?s=s+1|0:(o.Node.getElement().DisableCollisionDetection||a.Node.getElement().DisableCollisionDetection||(n=o.Node.getElement().IsSpecial||a.Node.getElement().IsSpecial?0:o.Node.getElement().ParentId===a.Node.getElement().ParentId?e:r,(i=o.X+n-a.X)>u&&(u=i)),o.Bottom>=a.Bottom&&(s=s+1|0),a.Bottom>=o.Bottom&&(g=g+1|0));return u},ReloadFromBranch:function(t){for(var e,r,o,a,n,i=System.Double.max,g=System.Double.min,s=0;s<this.Left.getCount();s=s+1|0)r=(e=this.Left.getItem(s)).Node.getState().getLeft(),this.Left.setItem(s,e.ChangeX(r)),i=Math.min(i,r);for(o=0;o<this.Right.getCount();o=o+1|0)n=(a=this.Right.getItem(o)).Node.getState().getRight(),this.Right.setItem(o,a.ChangeX(n)),g=Math.max(g,n);i=Math.min(t.getState().getLeft(),i),g=Math.max(t.getState().getRight(),g),this.setBoundingRect(new OrgChart.Layout.Rect.$ctor1(new OrgChart.Layout.Point.$ctor1(i,this.getBoundingRect().getTop()),new OrgChart.Layout.Size.$ctor1(g-i,this.getBoundingRect().Size.Height)))}}),Bridge.define("OrgChart.Layout.Boundary.Step",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Boundary.Step}},Node:null,X:0,Top:0,Bottom:0,$ctor1:function(t,e,r,o){this.$initialize(),this.Node=t,this.X=e,this.Top=r,this.Bottom=o},ctor:function(){this.$initialize()},ChangeTop:function(t){return new OrgChart.Layout.Boundary.Step.$ctor1(this.Node,this.X,t,this.Bottom)},ChangeBottom:function(t){return new OrgChart.Layout.Boundary.Step.$ctor1(this.Node,this.X,this.Top,t)},ChangeOwner:function(t,e){return new OrgChart.Layout.Boundary.Step.$ctor1(t,e,this.Top,this.Bottom)},ChangeX:function(t){return new OrgChart.Layout.Boundary.Step.$ctor1(this.Node,t,this.Top,this.Bottom)},getHashCode:function(){return Bridge.addHash([1885697107,this.Node,this.X,this.Top,this.Bottom])},equals:function(t){return!!Bridge.is(t,OrgChart.Layout.Boundary.Step)&&Bridge.equals(this.Node,t.Node)&&Bridge.equals(this.X,t.X)&&Bridge.equals(this.Top,t.Top)&&Bridge.equals(this.Bottom,t.Bottom)},$clone:function(t){var e=t||new OrgChart.Layout.Boundary.Step;return e.Node=this.Node,e.X=this.X,e.Top=this.Top,e.Bottom=this.Bottom,e}}),Bridge.define("OrgChart.Layout.BoundaryChangedEventArgs",{State:null,LayoutLevel:null,Boundary:null,ctor:function(t,e,r){this.$initialize(),this.Boundary=t,this.LayoutLevel=e,this.State=r}}),Bridge.define("OrgChart.Layout.Box",{statics:{None:-1,Special:function(t,e,r){return new OrgChart.Layout.Box.$ctor1(null,t,e,!0,r,!1)}},Id:0,ParentId:0,DataId:null,IsSpecial:!1,IsAssistant:!1,DisableCollisionDetection:!1,LayoutStrategyId:null,AssistantLayoutStrategyId:null,IsCollapsed:!1,config:{init:function(){this.Size=new OrgChart.Layout.Size}},ctor:function(t,e,r,o){OrgChart.Layout.Box.$ctor1.call(this,t,e,r,!1,!1,o)},$ctor1:function(t,e,r,o,a,n){if(this.$initialize(),0===e)throw new System.ArgumentOutOfRangeException("id");this.Id=e,this.ParentId=r,this.DataId=t,this.IsSpecial=o,this.IsAssistant=n,this.DisableCollisionDetection=a},getIsDataBound:function(){return!System.String.isNullOrEmpty(this.DataId)}}),Bridge.define("OrgChart.Layout.BoxContainer",{m_lastBoxId:0,m_boxesById:null,m_boxesByDataId:null,config:{properties:{SystemRoot:null},init:function(){this.m_boxesById=new(System.Collections.Generic.Dictionary$2(System.Int32,OrgChart.Layout.Box)),this.m_boxesByDataId=new(System.Collections.Generic.Dictionary$2(String,OrgChart.Layout.Box))}},ctor:function(){this.$initialize()},$ctor1:function(t){this.$initialize(),this.ReloadBoxes(t)},getBoxesById:function(){return this.m_boxesById},getBoxesByDataId:function(){return this.m_boxesByDataId},ReloadBoxes:function(t){var e,r,o,a,n;for(this.m_boxesByDataId.clear(),this.m_boxesById.clear(),this.m_lastBoxId=0,this.setSystemRoot(OrgChart.Layout.Box.Special(this.m_lastBoxId=this.m_lastBoxId+1|0,OrgChart.Layout.Box.None,!0)),this.m_boxesById.add(this.getSystemRoot().Id,this.getSystemRoot()),o=new(System.Collections.Generic.Dictionary$2(String,System.Int32)),e=Bridge.getEnumerator(t.OrgChart$Layout$IChartDataSource$getAllDataItemIds(),String);e.moveNext();)a=e.getCurrent(),o.add(a,this.NextBoxId());for(n=t.OrgChart$Layout$IChartDataSource$getGetDataItemFunc(),r=Bridge.getEnumerator(t.OrgChart$Layout$IChartDataSource$getAllDataItemIds(),String);r.moveNext();){var i=r.getCurrent(),g=System.String.isNullOrEmpty(i)?null:t.OrgChart$Layout$IChartDataSource$getGetParentKeyFunc()(i),s=System.String.isNullOrEmpty(g)?this.getSystemRoot().Id:o.get(g);this.AddBox$1(i,o.get(i),s,n(i).OrgChart$Layout$IChartDataItem$getIsAssistant())}},AddBox:function(t,e,r){return this.AddBox$1(t,this.NextBoxId(),e,r)},AddBox$1:function(t,e,r,o){var a=new OrgChart.Layout.Box.ctor(t,e,r,o);return this.m_boxesById.add(a.Id,a),System.String.isNullOrEmpty(t)||this.m_boxesByDataId.add(a.DataId,a),a},NextBoxId:function(){return this.m_lastBoxId=this.m_lastBoxId+1|0,this.m_lastBoxId}}),Bridge.define("OrgChart.Layout.BoxTree",{statics:{Build:function(t){for(var e,r,o,a=new OrgChart.Layout.BoxTree,n=Bridge.getEnumerator(t.getDiagram().getBoxes().getBoxesById().System$Collections$Generic$IDictionary$2$System$Int32$OrgChart$Layout$Box$getValues(),OrgChart.Layout.Box);n.moveNext();)r=n.getCurrent(),o=new OrgChart.Layout.BoxTree.Node(r),a.getNodes().add(r.Id,o);for(e=Bridge.getEnumerator(a.getNodes().getValues(),OrgChart.Layout.BoxTree.Node);e.moveNext();){var i=e.getCurrent(),g=i.getElement().ParentId,s={};if(a.getNodes().tryGetValue(g,s))i.getElement().IsAssistant&&s.v.getElement().ParentId!==OrgChart.Layout.Box.None?s.v.AddAssistantChild(i):s.v.AddRegularChild$1(i);else{if(null!=a.getRoot())throw new System.InvalidOperationException("More then one root found: "+i.getElement().Id);a.setRoot(i)}}return a}},config:{properties:{Root:null,Nodes:null,Depth:0}},ctor:function(){this.$initialize(),this.setNodes(new(System.Collections.Generic.Dictionary$2(System.Int32,OrgChart.Layout.BoxTree.Node)))},IterateChildFirst:function(t){return this.getRoot().IterateChildFirst(t)},IterateParentFirst:function(t,e){void 0===e&&(e=null),this.getRoot().IterateParentFirst(t,e)},UpdateHierarchyStats:function(){this.setDepth(0),this.IterateParentFirst(Bridge.fn.bind(this,t.$.OrgChart.Layout.BoxTree.f1))}}),Bridge.ns("OrgChart.Layout.BoxTree",t.$),Bridge.apply(t.$.OrgChart.Layout.BoxTree,{f1:function(t){return null!=t.getParentNode()?(t.setLevel(t.getParentNode().getLevel()),t.getParentNode().getIsAssistantRoot()||t.setLevel(t.getLevel()+1|0),this.setDepth(Math.max(1+t.getLevel()|0,this.getDepth()))):(t.setLevel(0),this.setDepth(1)),!0}}),Bridge.define("OrgChart.Layout.BoxTree.Node",{config:{properties:{Level:0,Element:null,State:null,ParentNode:null,Children:null,AssistantsRoot:null}},ctor:function(t){this.$initialize(),this.setElement(t),this.setState(new OrgChart.Layout.NodeLayoutInfo)},getChildCount:function(){return null==this.getChildren()?0:System.Array.getCount(this.getChildren(),OrgChart.Layout.BoxTree.Node)},getIsAssistantRoot:function(){var t;return Bridge.referenceEquals(null!=(t=this.getParentNode())?t.getAssistantsRoot():null,this)},AddAssistantChild:function(t){return null==this.getAssistantsRoot()&&this.setAssistantsRoot(Bridge.merge(new OrgChart.Layout.BoxTree.Node(OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,this.getElement().Id,!0)),{setParentNode:this,setLevel:this.getLevel()+1|0})),this.getAssistantsRoot().AddRegularChild$1(t),this},AddRegularChild$1:function(t){return this.InsertRegularChild$1(this.getChildCount(),t)},AddRegularChild:function(t){return this.InsertRegularChild(this.getChildCount(),t)},InsertRegularChild:function(t,e){return this.InsertRegularChild$1(t,new OrgChart.Layout.BoxTree.Node(e))},InsertRegularChild$1:function(t,e){return null==this.getChildren()&&this.setChildren(new(System.Collections.Generic.List$1(OrgChart.Layout.BoxTree.Node))),System.Array.insert(this.getChildren(),t,e,OrgChart.Layout.BoxTree.Node),e.setParentNode(this),e.setLevel(this.getLevel()+1|0),this},IterateChildFirst:function(t){var e;if(null!=this.getAssistantsRoot()&&!this.getAssistantsRoot().IterateChildFirst(t))return!1;if(null!=this.getChildren())for(e=Bridge.getEnumerator(this.getChildren(),OrgChart.Layout.BoxTree.Node);e.moveNext();)if(!e.getCurrent().IterateChildFirst(t))return!1;return t(this)},IterateParentFirst:function(t,e){var r,o;if(void 0===e&&(e=null),!t(this))return Bridge.staticEquals(e,null)||e(this),!1;if(null!=(r=this.getAssistantsRoot())&&r.IterateParentFirst(t,e),null!=this.getChildren())for(o=Bridge.getEnumerator(this.getChildren(),OrgChart.Layout.BoxTree.Node);o.moveNext();)o.getCurrent().IterateParentFirst(t,e);return Bridge.staticEquals(e,null)||e(this),!0},SuppressAssistants:function(){var t,e;if(null!=this.getAssistantsRoot()){for(t=Bridge.getEnumerator(this.getAssistantsRoot().getChildren(),OrgChart.Layout.BoxTree.Node);t.moveNext();)e=t.getCurrent(),this.AddRegularChild$1(e);this.setAssistantsRoot(null)}}}),Bridge.define("OrgChart.Layout.BranchParentAlignment",{$kind:"enum",statics:{InvalidValue:0,Left:1,Center:2,Right:3}}),Bridge.define("OrgChart.Layout.Connector",{config:{properties:{Segments:null}},ctor:function(t){if(this.$initialize(),0===t.length)throw new System.ArgumentException("Need at least one segment","segments");this.setSegments(t)}}),Bridge.define("OrgChart.Layout.Diagram",{m_visualTree:null,m_boxes:null,config:{properties:{LayoutSettings:null}},ctor:function(){this.$initialize(),this.setLayoutSettings(new OrgChart.Layout.DiagramLayoutSettings)},getBoxes:function(){return this.m_boxes},setBoxes:function(t){this.m_visualTree=null,this.m_boxes=t},getVisualTree:function(){return this.m_visualTree},setVisualTree:function(t){this.m_visualTree=t}}),Bridge.define("OrgChart.Layout.DiagramLayoutSettings",{m_branchSpacing:0,config:{properties:{LayoutStrategies:null,DefaultAssistantLayoutStrategyId:null,DefaultLayoutStrategyId:null}},ctor:function(){this.$initialize(),this.setBranchSpacing(50),this.setLayoutStrategies(new(System.Collections.Generic.Dictionary$2(String,OrgChart.Layout.LayoutStrategyBase)))},getBranchSpacing:function(){return this.m_branchSpacing},setBranchSpacing:function(t){if(t<0)throw new System.ArgumentOutOfRangeException("value","Cannot be negative",null,t);this.m_branchSpacing=t},RequireDefaultLayoutStrategy:function(){var t={};if(System.String.isNullOrEmpty(this.getDefaultLayoutStrategyId())||!this.getLayoutStrategies().tryGetValue(this.getDefaultLayoutStrategyId(),t))throw new System.InvalidOperationException("defaultLayoutStrategyId is null or not valid");return t.v},RequireDefaultAssistantLayoutStrategy:function(){var t={};if(System.String.isNullOrEmpty(this.getDefaultAssistantLayoutStrategyId())||!this.getLayoutStrategies().tryGetValue(this.getDefaultAssistantLayoutStrategyId(),t))throw new System.InvalidOperationException("defaultAssistantLayoutStrategyId is null or not valid");return t.v}}),Bridge.define("OrgChart.Layout.DiagramLayoutTemplates"),Bridge.define("OrgChart.Layout.Dimensions",{$kind:"struct",statics:{MinMax:function(){return new OrgChart.Layout.Dimensions.$ctor1(System.Double.max,System.Double.min)},op_Addition:function(t,e){return new OrgChart.Layout.Dimensions.$ctor1(Math.min(t.From,e.From),Math.max(t.To,e.To))},getDefaultValue:function(){return new OrgChart.Layout.Dimensions}},From:0,To:0,$ctor1:function(t,e){this.$initialize(),this.From=t,this.To=e},ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([3570880544,this.From,this.To])},equals:function(t){return!!Bridge.is(t,OrgChart.Layout.Dimensions)&&Bridge.equals(this.From,t.From)&&Bridge.equals(this.To,t.To)},$clone:function(t){var e=t||new OrgChart.Layout.Dimensions;return e.From=this.From,e.To=this.To,e}}),Bridge.define("OrgChart.Layout.Edge",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Edge}},config:{init:function(){this.From=new OrgChart.Layout.Point,this.To=new OrgChart.Layout.Point}},$ctor1:function(t,e){this.$initialize(),this.From=t,this.To=e},ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([1701274693,this.From,this.To])},equals:function(t){return!!Bridge.is(t,OrgChart.Layout.Edge)&&Bridge.equals(this.From,t.From)&&Bridge.equals(this.To,t.To)},$clone:function(t){var e=t||new OrgChart.Layout.Edge;return e.From=this.From,e.To=this.To,e}}),Bridge.define("OrgChart.Layout.LayoutStrategyBase",{ParentAlignment:0,ParentChildSpacing:20,ParentConnectorShield:50,SiblingSpacing:20,ChildConnectorHookLength:5}),Bridge.define("OrgChart.Layout.Frame1",{Connector:null,config:{init:function(){this.Exterior=new OrgChart.Layout.Rect,this.BranchExterior=new OrgChart.Layout.Rect,this.SiblingsRowV=new OrgChart.Layout.Dimensions}}}),Bridge.define("OrgChart.Layout.IChartDataItem",{$kind:"interface"}),Bridge.define("OrgChart.Layout.IChartDataSource",{$kind:"interface"}),Bridge.define("OrgChart.Layout.LayoutAlgorithm",{statics:{ComputeBranchVisualBoundingRect:function(t){var e=new OrgChart.Layout.Rect.ctor,r=!1;return t.getRoot().IterateParentFirst((function(t){var o=t.getElement();return t.getState().IsHidden||o.IsSpecial||(r?e=OrgChart.Layout.Rect.op_Addition(e,new OrgChart.Layout.Rect.$ctor1(t.getState().TopLeft,t.getState().Size)):(r=!0,e=new OrgChart.Layout.Rect.$ctor1(t.getState().TopLeft,t.getState().Size))),!o.IsCollapsed})),e},Apply:function(e){var r,o,a,n,i;if(null==e.getDiagram().getBoxes().getSystemRoot())throw new System.InvalidOperationException("SystemRoot is not initialized on the box container");if(e.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.Preparing),a=OrgChart.Layout.BoxTree.Build(e),e.getDiagram().setVisualTree(a),null==a.getRoot()||a.getRoot().getElement().Id!==e.getDiagram().getBoxes().getSystemRoot().Id)throw new System.Exception("SystemRoot is not on the top of the visual tree");if(a.UpdateHierarchyStats(),e.AttachVisualTree(a),a.IterateParentFirst(t.$.OrgChart.Layout.LayoutAlgorithm.f1),e.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.PreprocessVisualTree),!Bridge.staticEquals(e.getBoxSizeFunc(),null))for(r=Bridge.getEnumerator(System.Linq.Enumerable.from(e.getDiagram().getBoxes().getBoxesById().System$Collections$Generic$IDictionary$2$System$Int32$OrgChart$Layout$Box$getValues()).where(t.$.OrgChart.Layout.LayoutAlgorithm.f2));r.moveNext();)(n=r.getCurrent()).Size=e.getBoxSizeFunc()(n.DataId);for(o=Bridge.getEnumerator(e.getDiagram().getBoxes().getBoxesById().System$Collections$Generic$IDictionary$2$System$Int32$OrgChart$Layout$Box$getValues(),OrgChart.Layout.Box);o.moveNext();)i=o.getCurrent(),OrgChart.Layout.LayoutAlgorithm.AssertBoxSize(i);a.IterateParentFirst(t.$.OrgChart.Layout.LayoutAlgorithm.f3),OrgChart.Layout.LayoutAlgorithm.PreprocessVisualTree(e,a),a.UpdateHierarchyStats(),e.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.VerticalLayout),OrgChart.Layout.LayoutAlgorithm.VerticalLayout(e,a.getRoot()),e.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.HorizontalLayout),OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(e,a.getRoot()),e.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.ConnectorsLayout),OrgChart.Layout.LayoutAlgorithm.RouteConnectors(e,a),e.setCurrentOperation(OrgChart.Layout.LayoutState.Operation.Completed)},AssertBoxSize:function(t){if(!(t.Size.Width>=0&&t.Size.Width<=1e9&&t.Size.Height>=0&&t.Size.Width<=1e9))throw new System.InvalidOperationException(System.String.format("Box {0} has invalid size: {1}x{2}",t.Id,t.Size.Width,t.Size.Height))},PreprocessVisualTree:function(t,e){var r,o=t.getDiagram().getLayoutSettings().RequireDefaultLayoutStrategy(),a=t.getDiagram().getLayoutSettings().RequireDefaultAssistantLayoutStrategy(),n=new(System.Collections.Generic.Stack$1(OrgChart.Layout.LayoutStrategyBase).ctor);n.push(o),(r=new(System.Collections.Generic.Stack$1(OrgChart.Layout.LayoutStrategyBase).ctor)).push(a),e.IterateParentFirst((function(e){var o,a;return!e.getState().IsHidden&&(o=null,Bridge.staticEquals(t.getLayoutOptimizerFunc(),null)||(a=t.getLayoutOptimizerFunc()(e),System.String.isNullOrEmpty(a)||(o=t.getDiagram().getLayoutSettings().getLayoutStrategies().get(a))),e.getIsAssistantRoot()?(null==o&&(o=null!=e.getParentNode().getElement().AssistantLayoutStrategyId?t.getDiagram().getLayoutSettings().getLayoutStrategies().get(e.getParentNode().getElement().AssistantLayoutStrategyId):r.peek()),r.push(o)):(null==o&&(o=null!=e.getElement().LayoutStrategyId?t.getDiagram().getLayoutSettings().getLayoutStrategies().get(e.getElement().LayoutStrategyId):n.peek()),n.push(o),o.getSupportsAssistants()||e.SuppressAssistants()),e.getState().setEffectiveLayoutStrategy(o),e.getState().RequireLayoutStrategy().PreProcessThisNode(t,e),!e.getElement().IsCollapsed&&e.getChildCount()>0||null!=e.getAssistantsRoot())}),(function(t){t.getState().IsHidden||(t.getIsAssistantRoot()?r.pop():n.pop())}))},HorizontalLayout:function(t,e){if(e.getState().IsHidden)throw new System.InvalidOperationException(System.String.format("Branch root {0} does not affect layout",e.getElement().Id));var r=t.PushLayoutLevel(e);try{(0===e.getLevel()||(e.getState().NumberOfSiblings>0||null!=e.getAssistantsRoot())&&!e.getElement().IsCollapsed)&&e.getState().RequireLayoutStrategy().ApplyHorizontalLayout(t,r)}finally{t.PopLayoutLevel()}},VerticalLayout:function(t,e){if(e.getState().IsHidden)throw new System.InvalidOperationException(System.String.format("Branch root {0} does not affect layout",e.getElement().Id));var r=t.PushLayoutLevel(e);try{(0===e.getLevel()||(e.getState().NumberOfSiblings>0||null!=e.getAssistantsRoot())&&!e.getElement().IsCollapsed)&&e.getState().RequireLayoutStrategy().ApplyVerticalLayout(t,r)}finally{t.PopLayoutLevel()}},RouteConnectors:function(t,e){e.IterateParentFirst((function(e){return!(e.getElement().IsCollapsed||0===e.getState().NumberOfSiblings&&null==e.getAssistantsRoot()||0!==e.getLevel()&&(e.getElement().IsSpecial&&!e.getIsAssistantRoot()||(e.getState().RequireLayoutStrategy().RouteConnectors(t,e),0)))}))},MoveChildrenOnly:function(t,e,r){var o,a,n=e.BranchRoot.getChildren();if(null==n||0===System.Array.getCount(n,OrgChart.Layout.BoxTree.Node))throw new System.InvalidOperationException("Should never be invoked when children not set");for(a=function(t){return t.getState().IsHidden||(t.getState().TopLeft=t.getState().TopLeft.MoveH(r),t.getState().BranchExterior=t.getState().BranchExterior.MoveH(r)),!0},o=Bridge.getEnumerator(n,OrgChart.Layout.BoxTree.Node);o.moveNext();)o.getCurrent().IterateChildFirst(a);e.Boundary.ReloadFromBranch(e.BranchRoot),e.BranchRoot.getState().BranchExterior=e.Boundary.getBoundingRect()},MoveOneChild:function(t,e,r){e.IterateChildFirst((function(t){return t.getState().IsHidden||(t.getState().TopLeft=t.getState().TopLeft.MoveH(r),t.getState().BranchExterior=t.getState().BranchExterior.MoveH(r)),!0}))},MoveBranch:function(t,e,r){OrgChart.Layout.LayoutAlgorithm.MoveOneChild(t,e.BranchRoot,r),e.Boundary.ReloadFromBranch(e.BranchRoot),e.BranchRoot.getState().BranchExterior=e.Boundary.getBoundingRect()},AlignHorizontalCenters:function(t,e,r){for(var o,a,n,i,g,s=System.Double.min,u=Bridge.getEnumerator(r,OrgChart.Layout.BoxTree.Node);u.moveNext();)(a=u.getCurrent().getState().getCenterH())>s&&(s=a);for(n=System.Double.max,i=System.Double.min,o=Bridge.getEnumerator(r,OrgChart.Layout.BoxTree.Node);o.moveNext();){var h=o.getCurrent(),l=h.getState().getCenterH();OrgChart.Layout.LayoutAlgorithm.IsEqual(l,s)||(g=s-l,OrgChart.Layout.LayoutAlgorithm.MoveOneChild(t,h,g)),n=Math.min(n,h.getState().BranchExterior.getLeft()),i=Math.max(i,h.getState().BranchExterior.getRight())}return e.Boundary.ReloadFromBranch(e.BranchRoot),new OrgChart.Layout.Dimensions.$ctor1(n,i)},CopyExteriorFrom:function(t,e){t.TopLeft=e.TopLeft,t.Size=e.Size,t.BranchExterior=e.BranchExterior,t.SiblingsRowV=e.SiblingsRowV},IsMinValue:function(t){return t<=System.Double.min+5e-324},IsMaxValue:function(t){return t>=System.Double.max-5e-324},IsZero:function(t){return t<=5e-324&&t>=-5e-324},IsEqual:function(t,e){return Math.abs(t-e)<=5e-324},MoveTo:function(t,e,r){t.TopLeft=new OrgChart.Layout.Point.$ctor1(e,r)},AdjustSpacer:function(t,e,r,o,a){t.TopLeft=new OrgChart.Layout.Point.$ctor1(e,r),t.Size=new OrgChart.Layout.Size.$ctor1(o,a),t.BranchExterior=new OrgChart.Layout.Rect.$ctor3(e,r,o,a)}}}),Bridge.ns("OrgChart.Layout.LayoutAlgorithm",t.$),Bridge.apply(t.$.OrgChart.Layout.LayoutAlgorithm,{f1:function(t){return t.getState().IsHidden=null!=t.getParentNode()&&(t.getParentNode().getState().IsHidden||t.getParentNode().getElement().IsCollapsed),!0},f2:function(t){return t.getIsDataBound()},f3:function(t){return OrgChart.Layout.LayoutAlgorithm.MoveTo(t.getState(),0,0),t.getState().Size=t.getElement().Size,t.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor1(new OrgChart.Layout.Point.$ctor1(0,0),t.getElement().Size),!0}}),Bridge.define("OrgChart.Layout.LayoutState",{m_layoutStack:null,m_pooledBoundaries:null,m_currentOperation:0,config:{events:{BoundaryChanged:null,OperationChanged:null},properties:{Diagram:null,BoxSizeFunc:null,LayoutOptimizerFunc:null},init:function(){this.m_layoutStack=new(System.Collections.Generic.Stack$1(OrgChart.Layout.LayoutState.LayoutLevel).ctor),this.m_pooledBoundaries=new(System.Collections.Generic.Stack$1(OrgChart.Layout.Boundary).ctor)}},ctor:function(t){this.$initialize(),this.setDiagram(t)},getCurrentOperation:function(){return this.m_currentOperation},setCurrentOperation:function(t){this.m_currentOperation=t,!Bridge.staticEquals(this.OperationChanged,null)&&this.OperationChanged(this,new OrgChart.Layout.LayoutStateOperationChangedEventArgs(this))},AttachVisualTree:function(t){for(;this.m_pooledBoundaries.getCount()<t.getDepth();)this.m_pooledBoundaries.push(new OrgChart.Layout.Boundary.ctor)},PushLayoutLevel:function(t){var e,r;switch(0===this.m_pooledBoundaries.getCount()&&this.m_pooledBoundaries.push(new OrgChart.Layout.Boundary.ctor),e=this.m_pooledBoundaries.pop(),this.getCurrentOperation()){case OrgChart.Layout.LayoutState.Operation.VerticalLayout:e.Prepare(t);break;case OrgChart.Layout.LayoutState.Operation.HorizontalLayout:e.PrepareForHorizontalLayout(t);break;default:throw new System.InvalidOperationException("This operation can only be invoked when performing vertical or horizontal layouts")}return r=new OrgChart.Layout.LayoutState.LayoutLevel(t,e),this.m_layoutStack.push(r),Bridge.staticEquals(this.BoundaryChanged,null)||this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(e,r,this)),r},MergeSpacer:function(t){if(this.getCurrentOperation()!==OrgChart.Layout.LayoutState.Operation.HorizontalLayout)throw new System.InvalidOperationException("Spacers can only be merged during horizontal layout");if(0===this.m_layoutStack.getCount())throw new System.InvalidOperationException("Cannot merge spacers at top nesting level");var e=this.m_layoutStack.peek();e.Boundary.MergeFrom$1(t),!Bridge.staticEquals(this.BoundaryChanged,null)&&this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(e.Boundary,e,this))},PopLayoutLevel:function(){var t,e,r,o=this.m_layoutStack.pop();if(Bridge.staticEquals(this.BoundaryChanged,null)||this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(o.Boundary,o,this)),this.m_layoutStack.getCount()>0){switch(t=this.m_layoutStack.peek(),this.getCurrentOperation()){case OrgChart.Layout.LayoutState.Operation.VerticalLayout:t.Boundary.VerticalMergeFrom(o.Boundary),t.BranchRoot.getState().BranchExterior=t.Boundary.getBoundingRect();break;case OrgChart.Layout.LayoutState.Operation.HorizontalLayout:Bridge.referenceEquals(t.BranchRoot.getAssistantsRoot(),o.BranchRoot)||(e=t.BranchRoot.getState().RequireLayoutStrategy(),(r=t.Boundary.ComputeOverlap(o.Boundary,e.SiblingSpacing,this.getDiagram().getLayoutSettings().getBranchSpacing()))>0&&(OrgChart.Layout.LayoutAlgorithm.MoveBranch(this,o,r),!Bridge.staticEquals(this.BoundaryChanged,null)&&this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(o.Boundary,o,this)))),t.Boundary.MergeFrom(o.Boundary),t.BranchRoot.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor3(t.Boundary.getBoundingRect().getLeft(),t.BranchRoot.getState().BranchExterior.getTop(),t.Boundary.getBoundingRect().Size.Width,t.BranchRoot.getState().BranchExterior.Size.Height);break;default:throw new System.InvalidOperationException("This operation can only be invoked when performing vertical or horizontal layouts")}!Bridge.staticEquals(this.BoundaryChanged,null)&&this.BoundaryChanged(this,new OrgChart.Layout.BoundaryChangedEventArgs(t.Boundary,t,this))}this.m_pooledBoundaries.push(o.Boundary)}}),Bridge.define("OrgChart.Layout.LayoutState.LayoutLevel",{BranchRoot:null,Boundary:null,ctor:function(t,e){this.$initialize(),this.BranchRoot=t,this.Boundary=e}}),Bridge.define("OrgChart.Layout.LayoutState.Operation",{$kind:"enum",statics:{Idle:0,Preparing:1,PreprocessVisualTree:2,VerticalLayout:3,HorizontalLayout:4,ConnectorsLayout:5,Completed:6}}),Bridge.define("OrgChart.Layout.LayoutStateOperationChangedEventArgs",{State:null,ctor:function(t){this.$initialize(),this.State=t}}),Bridge.define("OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.GroupIterator",{m_numberOfSiblings:0,m_numberOfGroups:0,Group:0,FromIndex:0,Count:0,MaxOnLeft:0,ctor:function(t,e){this.$initialize(),this.m_numberOfSiblings=t,this.m_numberOfGroups=e},CountInGroup:function(){for(var t,e=2*this.m_numberOfGroups|0,r=0,o=2+(2*this.Group|0)|0,a=0;;){if(!((t=a>=(this.m_numberOfSiblings-e|0)?this.m_numberOfSiblings-a|0:e)>=o)){t>=(o=o-1|0)&&(r=r+1|0);break}r=r+2|0,a=a+e|0}return r},NextGroup:function(){return this.FromIndex=this.FromIndex+this.Count|0,this.FromIndex>0&&(this.Group=this.Group+1|0),this.Count=this.CountInGroup(),this.MaxOnLeft=(0|Bridge.Int.div(this.Count,2))+this.Count%2|0,0!==this.Count}}),Bridge.define("OrgChart.Layout.NodeLayoutInfo",{IsHidden:!1,NumberOfSiblings:0,NumberOfSiblingRows:0,NumberOfSiblingColumns:0,Connector:null,m_effectiveLayoutStrategy:null,config:{init:function(){this.TopLeft=new OrgChart.Layout.Point,this.Size=new OrgChart.Layout.Size,this.BranchExterior=new OrgChart.Layout.Rect,this.SiblingsRowV=new OrgChart.Layout.Dimensions}},setEffectiveLayoutStrategy:function(t){this.m_effectiveLayoutStrategy=t},getLeft:function(){return this.TopLeft.X},getRight:function(){return this.TopLeft.X+this.Size.Width},getTop:function(){return this.TopLeft.Y},getBottom:function(){return this.TopLeft.Y+this.Size.Height},getCenterH:function(){return this.TopLeft.X+this.Size.Width/2},getCenterV:function(){return this.TopLeft.Y+this.Size.Height/2},RequireLayoutStrategy:function(){if(null==this.m_effectiveLayoutStrategy)throw new System.Exception("effectiveLayoutStrategy is not set");return this.m_effectiveLayoutStrategy}}),Bridge.define("OrgChart.Layout.Point",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Point}},X:0,Y:0,$ctor1:function(t,e){this.$initialize(),this.X=t,this.Y=e},ctor:function(){this.$initialize()},MoveH:function(t){return new OrgChart.Layout.Point.$ctor1(this.X+t,this.Y)},getHashCode:function(){return Bridge.addHash([1852403652,this.X,this.Y])},equals:function(t){return!!Bridge.is(t,OrgChart.Layout.Point)&&Bridge.equals(this.X,t.X)&&Bridge.equals(this.Y,t.Y)},$clone:function(t){var e=t||new OrgChart.Layout.Point;return e.X=this.X,e.Y=this.Y,e}}),Bridge.define("OrgChart.Layout.Rect",{$kind:"struct",statics:{op_Addition:function(t,e){var r=Math.min(t.getLeft(),e.getLeft()),o=Math.min(t.getTop(),e.getTop()),a=Math.max(t.getRight(),e.getRight()),n=Math.max(t.getBottom(),e.getBottom());return new OrgChart.Layout.Rect.$ctor3(r,o,a-r,n-o)},getDefaultValue:function(){return new OrgChart.Layout.Rect}},config:{init:function(){this.TopLeft=new OrgChart.Layout.Point,this.Size=new OrgChart.Layout.Size}},$ctor3:function(t,e,r,o){if(this.$initialize(),r<0)throw new System.ArgumentOutOfRangeException("w");if(o<0)throw new System.ArgumentOutOfRangeException("h");this.TopLeft=new OrgChart.Layout.Point.$ctor1(t,e),this.Size=new OrgChart.Layout.Size.$ctor1(r,o)},$ctor1:function(t,e){this.$initialize(),this.TopLeft=t,this.Size=e},$ctor2:function(t){this.$initialize(),this.TopLeft=new OrgChart.Layout.Point.$ctor1(0,0),this.Size=t},ctor:function(){this.$initialize()},getBottomRight:function(){return new OrgChart.Layout.Point.$ctor1(this.TopLeft.X+this.Size.Width,this.TopLeft.Y+this.Size.Height)},getLeft:function(){return this.TopLeft.X},getRight:function(){return this.TopLeft.X+this.Size.Width},getCenterH:function(){return this.TopLeft.X+this.Size.Width/2},getCenterV:function(){return this.TopLeft.Y+this.Size.Height/2},getTop:function(){return this.TopLeft.Y},getBottom:function(){return this.TopLeft.Y+this.Size.Height},MoveH:function(t){return new OrgChart.Layout.Rect.$ctor1(new OrgChart.Layout.Point.$ctor1(this.getLeft()+t,this.getTop()),this.Size)},getHashCode:function(){return Bridge.addHash([1952671058,this.TopLeft,this.Size])},equals:function(t){return!!Bridge.is(t,OrgChart.Layout.Rect)&&Bridge.equals(this.TopLeft,t.TopLeft)&&Bridge.equals(this.Size,t.Size)},$clone:function(t){var e=t||new OrgChart.Layout.Rect;return e.TopLeft=this.TopLeft,e.Size=this.Size,e}}),Bridge.define("OrgChart.Layout.Size",{$kind:"struct",statics:{getDefaultValue:function(){return new OrgChart.Layout.Size}},Width:0,Height:0,$ctor1:function(t,e){this.$initialize(),this.Width=t,this.Height=e},ctor:function(){this.$initialize()},getHashCode:function(){return Bridge.addHash([1702521171,this.Width,this.Height])},equals:function(t){return!!Bridge.is(t,OrgChart.Layout.Size)&&Bridge.equals(this.Width,t.Width)&&Bridge.equals(this.Height,t.Height)},$clone:function(t){var e=t||new OrgChart.Layout.Size;return e.Width=this.Width,e.Height=this.Height,e}}),Bridge.define("OrgChart.Layout.StackOrientation",{$kind:"enum",statics:{InvalidValue:0,SingleRowHorizontal:1,SingleColumnVertical:2}}),Bridge.define("OrgChart.Test.TestDataGen",{statics:{GenerateBoxSizes:function(t){var e,r,o;for(System.Diagnostics.Debug.writeln((0).toString()),r=new System.Random.$ctor1(0),e=Bridge.getEnumerator(t.getBoxesById().System$Collections$Generic$IDictionary$2$System$Int32$OrgChart$Layout$Box$getValues(),OrgChart.Layout.Box);e.moveNext();)(o=e.getCurrent()).IsSpecial||(o.Size=new OrgChart.Layout.Size.$ctor1(50+r.next$1(50)|0,50+r.next$1(50)|0))}},GenerateDataItems:function(t,e,r){for(var o,a=Bridge.getEnumerator(this.GenerateRandomDataItems(e,r));a.moveNext();)o=a.getCurrent(),t.Items.add(o.getId(),o)},GenerateRandomDataItems:function(t,e){var r,o,a,n,i,g,s,u,h,l,y;if(t<0)throw new System.ArgumentOutOfRangeException("itemCount","Count must be zero or positive",null,t);for(r=new System.Random.$ctor1(0),o=new(System.Collections.Generic.List$1(OrgChart.Test.TestDataItem))(t),a=0;a<t;a=a+1|0)o.add(Bridge.merge(new OrgChart.Test.TestDataItem,{setId:a.toString()}));for(n=1,i=1;n<t;){for(g=(15+i|0)+r.next$1(2*i|0)|0,s=n;s<(n+g|0)&&s<t;s=s+1|0)u=(n-1|0)-r.next$1(i)|0,o.getItem(s).setParentId(o.getItem(u).getId());n=n+g|0,i=g}for(h=0;h<(0|Bridge.Int.div(o.getCount(),2));h=h+1|0){var S=r.next$1(o.getCount()),m=r.next$1(o.getCount()),C=o.getItem(S);o.setItem(S,o.getItem(m)),o.setItem(m,C)}if(e>0)for(l=Math.min(o.getCount(),Bridge.Int.clip32(Math.ceil((o.getCount()*e|0)/100))),y=0;y<l;y=y+1|0)o.getItem(r.next$1(o.getCount())).setIsAssistant(!0);return o}}),Bridge.define("System.Diagnostics.DebuggerDisplayAttribute",{inherits:[System.Attribute],ctor:function(){this.$initialize(),System.Attribute.ctor.call(this)}}),Bridge.define("OrgChart.Layout.FishboneAssistantsLayoutStrategy",{inherits:[OrgChart.Layout.LayoutStrategyBase],getSupportsAssistants:function(){return!1},PreProcessThisNode:function(t,e){if(e.getState().NumberOfSiblings=e.getChildCount(),e.getState().NumberOfSiblings>0){e.getState().NumberOfSiblingColumns=1,e.getState().NumberOfSiblingRows=0|Bridge.Int.div(e.getState().NumberOfSiblings,2),e.getState().NumberOfSiblings%2!=0&&(e.getState().NumberOfSiblingRows=e.getState().NumberOfSiblingRows+1|0);var r=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,e.getElement().Id,!1);e.AddRegularChild(r)}},ApplyVerticalLayout:function(t,e){var r,o,a,n,i,g,s,u=e.BranchRoot;if(0===u.getLevel())throw new System.InvalidOperationException("Should never be invoked on root node");for(r=u.getState().SiblingsRowV.To,o=this.MaxOnLeft(u),a=0;a<o;a=a+1|0){var h=0===a?this.ParentChildSpacing:this.SiblingSpacing,l=System.Array.getItem(u.getChildren(),a,OrgChart.Layout.BoxTree.Node),y=l.getState();OrgChart.Layout.LayoutAlgorithm.MoveTo(y,y.getLeft(),r+h),n=new OrgChart.Layout.Dimensions.$ctor1(y.getTop(),y.getBottom()),(i=a+o|0)<u.getState().NumberOfSiblings&&(s=(g=System.Array.getItem(u.getChildren(),i,OrgChart.Layout.BoxTree.Node)).getState(),OrgChart.Layout.LayoutAlgorithm.MoveTo(s,s.getLeft(),r+h),s.getBottom()>y.getBottom()?OrgChart.Layout.LayoutAlgorithm.MoveTo(y,y.getLeft(),s.getCenterV()-y.Size.Height/2):s.getBottom()<y.getBottom()&&OrgChart.Layout.LayoutAlgorithm.MoveTo(s,s.getLeft(),y.getCenterV()-s.Size.Height/2),s.BranchExterior=new OrgChart.Layout.Rect.$ctor1(s.TopLeft,s.Size),n=OrgChart.Layout.Dimensions.op_Addition(n,new OrgChart.Layout.Dimensions.$ctor1(s.getTop(),s.getBottom())),s.SiblingsRowV=n,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(t,g),r=s.BranchExterior.getBottom()),y.BranchExterior=new OrgChart.Layout.Rect.$ctor1(y.TopLeft,y.Size),y.SiblingsRowV=n,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(t,l),r=Math.max(r,y.BranchExterior.getBottom())}},ApplyHorizontalLayout:function(t,e){var r,o,a,n,i,g,s,u,h=e.BranchRoot;0===h.getLevel()&&(h.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(h.getState().getTop(),h.getState().getBottom()));var l=!0,y=0,S=this.MaxOnLeft(h);for(r=0;r<h.getState().NumberOfSiblings;r=r+1|0)if(o=System.Array.getItem(h.getChildren(),r,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(t,o),(y=y+1|0)===S&&l){for(OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(t,e,this.EnumerateSiblings(h,0,S)),l=!1,y=0,a=System.Double.min,n=0;n<=r;n=n+1|0)a=Math.max(a,System.Array.getItem(h.getChildren(),n,OrgChart.Layout.BoxTree.Node).getState().BranchExterior.getRight());a=h.getState().NumberOfSiblings%2!=0||(i=System.Array.getItem(h.getChildren(),h.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node)).getElement().IsCollapsed||0===i.getChildCount()?Math.max(a,o.getState().getRight()):Math.max(a,o.getState().BranchExterior.getRight()),g=System.Array.getItem(h.getChildren(),h.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(g.getState(),a,h.getState().getBottom(),this.ParentConnectorShield,h.getState().BranchExterior.getBottom()-h.getState().getBottom()),e.Boundary.MergeFrom$1(g)}OrgChart.Layout.LayoutAlgorithm.AlignHorizontalCenters(t,e,this.EnumerateSiblings(h,S,h.getState().NumberOfSiblings)),h.getLevel()>0&&h.getState().NumberOfSiblings>0&&(u=System.Array.getItem(h.getChildren(),h.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),s=h.getState().getCenterH()-u,OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(t,e,s))},RouteConnectors:function(t,e){var r,o,a,n=e.getState().NumberOfSiblings;if(0!==n){this.NeedCarrierProtector(e)&&(n=n+1|0);var i=System.Array.init(n,(function(){return new OrgChart.Layout.Edge})),g=0,s=this.MaxOnLeft(e),u=System.Array.getItem(e.getChildren(),e.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node).getState(),h=u.getCenterH(),l=!0,y=0,S=System.Double.min;for(r=0;r<e.getState().NumberOfSiblings;r=r+1|0)o=l?System.Array.getItem(e.getChildren(),r,OrgChart.Layout.BoxTree.Node).getState().getRight():System.Array.getItem(e.getChildren(),r,OrgChart.Layout.BoxTree.Node).getState().getLeft(),a=System.Array.getItem(e.getChildren(),r,OrgChart.Layout.BoxTree.Node).getState().getCenterV(),S=Math.max(S,a),i[Bridge.identity(g,g=g+1|0)]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(h,a),new OrgChart.Layout.Point.$ctor1(o,a)),(y=y+1|0)===s&&(y=0,l=!l);this.NeedCarrierProtector(e)&&(i[e.getState().NumberOfSiblings]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(u.getCenterH(),u.getTop()),new OrgChart.Layout.Point.$ctor1(u.getCenterH(),S))),e.getState().Connector=new OrgChart.Layout.Connector(i)}},MaxOnLeft:function(t){return(0|Bridge.Int.div(t.getState().NumberOfSiblings,2))+t.getState().NumberOfSiblings%2|0},NeedCarrierProtector:function(t){return 0===t.getParentNode().getChildCount()},EnumerateSiblings:function(t,e,r){for(var o=[],a=e;a<r;a=a+1|0)o.push(System.Array.getItem(t.getChildren(),a,OrgChart.Layout.BoxTree.Node));return System.Array.toEnumerable(o)}}),Bridge.define("OrgChart.Layout.LinearLayoutStrategy",{inherits:[OrgChart.Layout.LayoutStrategyBase],getSupportsAssistants:function(){return!0},PreProcessThisNode:function(t,e){var r,o;e.getChildCount()>0&&(e.getState().NumberOfSiblings=e.getElement().IsCollapsed?0:e.getChildCount(),e.getElement().IsCollapsed||(r=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,e.getElement().Id,!1),e.AddRegularChild(r),o=OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,e.getElement().Id,!1),e.AddRegularChild(o)))},ApplyVerticalLayout:function(t,e){var r,o,a,n,i,g,s,u=e.BranchRoot;if(0===u.getLevel()&&(u.getState().SiblingsRowV=new OrgChart.Layout.Dimensions.$ctor1(u.getState().getTop(),u.getState().getBottom())),null!=u.getAssistantsRoot()&&(OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(u.getAssistantsRoot().getState(),u.getState()),OrgChart.Layout.LayoutAlgorithm.VerticalLayout(t,u.getAssistantsRoot())),0!==u.getState().NumberOfSiblings){for(r=OrgChart.Layout.Dimensions.MinMax(),o=null==u.getAssistantsRoot()?u.getState().SiblingsRowV.To+this.ParentChildSpacing:u.getState().BranchExterior.getBottom()+this.ParentChildSpacing,a=0;a<u.getState().NumberOfSiblings;a=a+1|0)i=(n=System.Array.getItem(u.getChildren(),a,OrgChart.Layout.BoxTree.Node)).getState(),OrgChart.Layout.LayoutAlgorithm.MoveTo(n.getState(),0,o),n.getState().BranchExterior=new OrgChart.Layout.Rect.$ctor1(n.getState().TopLeft,n.getState().Size),r=OrgChart.Layout.Dimensions.op_Addition(r,new OrgChart.Layout.Dimensions.$ctor1(o,o+i.Size.Height));for(r=new OrgChart.Layout.Dimensions.$ctor1(r.From,r.To),g=0;g<u.getState().NumberOfSiblings;g=g+1|0)(s=System.Array.getItem(u.getChildren(),g,OrgChart.Layout.BoxTree.Node)).getState().SiblingsRowV=r,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(t,s)}},ApplyHorizontalLayout:function(t,e){var r,o,a,n,i,g=e.BranchRoot;for(null!=g.getAssistantsRoot()&&OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(t,g.getAssistantsRoot()),r=0;r<g.getState().NumberOfSiblings;r=r+1|0)o=System.Array.getItem(g.getChildren(),r,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.HorizontalLayout(t,o);if(g.getLevel()>0&&g.getChildCount()>0){var s=g.getState(),u=System.Array.getItem(g.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),h=System.Array.getItem(g.getChildren(),g.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().getCenterH(),l=1===g.getState().NumberOfSiblings||this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Center?u+(h-u)/2:this.ParentAlignment===OrgChart.Layout.BranchParentAlignment.Left?u+this.ChildConnectorHookLength:h-this.ChildConnectorHookLength,y=s.getCenterH(),S=y-l;OrgChart.Layout.LayoutAlgorithm.MoveChildrenOnly(t,e,S),a=System.Array.getItem(g.getChildren(),g.getState().NumberOfSiblings,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(a.getState(),y-this.ParentConnectorShield/2,s.getBottom(),this.ParentConnectorShield,System.Array.getItem(g.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-s.getBottom()),t.MergeSpacer(a),n=System.Array.getItem(g.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState(),i=System.Array.getItem(g.getChildren(),g.getState().NumberOfSiblings+1|0,OrgChart.Layout.BoxTree.Node),OrgChart.Layout.LayoutAlgorithm.AdjustSpacer(i.getState(),n.getLeft(),n.SiblingsRowV.From-this.ParentChildSpacing,System.Array.getItem(g.getChildren(),g.getState().NumberOfSiblings-1|0,OrgChart.Layout.BoxTree.Node).getState().getRight()-n.getLeft(),this.ParentChildSpacing),t.MergeSpacer(i)}},RouteConnectors:function(t,e){var r,o,a,n,i=e.getState().NumberOfSiblings,g=0===i?0:1===i?1:2+i|0;if(0!==g){var s=System.Array.init(g,(function(){return new OrgChart.Layout.Edge})),u=e.getState(),h=u.getCenterH();if(null==e.getChildren())throw new System.Exception("State is present, but children not set");if(1===g)s[0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(h,u.getBottom()),new OrgChart.Layout.Point.$ctor1(h,System.Array.getItem(e.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().getTop()));else{for(r=System.Array.getItem(e.getChildren(),0,OrgChart.Layout.BoxTree.Node).getState().SiblingsRowV.From-u.getBottom(),s[0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(h,u.getBottom()),new OrgChart.Layout.Point.$ctor1(h,u.getBottom()+r-this.ChildConnectorHookLength)),o=0;o<i;o=o+1|0)n=(a=System.Array.getItem(e.getChildren(),o,OrgChart.Layout.BoxTree.Node).getState()).getCenterH(),s[1+o|0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(n,a.getTop()),new OrgChart.Layout.Point.$ctor1(n,a.getTop()-this.ChildConnectorHookLength));s[g-1|0]=new OrgChart.Layout.Edge.$ctor1(new OrgChart.Layout.Point.$ctor1(s[1].To.X,s[1].To.Y),new OrgChart.Layout.Point.$ctor1(s[g-2|0].To.X,s[1].To.Y))}e.getState().Connector=new OrgChart.Layout.Connector(s)}else e.getState().Connector=null}}),Bridge.define("OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter",{inherits:[OrgChart.Layout.LayoutStrategyBase],RealRoot:null,SpecialRoot:null,Iterator:null,ctor:function(t){this.$initialize(),OrgChart.Layout.LayoutStrategyBase.ctor.call(this),this.Iterator=new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.GroupIterator(t.getState().NumberOfSiblings,t.getState().NumberOfSiblingColumns),this.RealRoot=t,this.SpecialRoot=Bridge.merge(new OrgChart.Layout.MultiLineFishboneLayoutStrategy.SingleFishboneLayoutAdapter.TreeNodeView(OrgChart.Layout.Box.Special(OrgChart.Layout.Box.None,t.getElement().Id,!0)),{setLevel:this.RealRoot.getLevel(),setParentNode:this.RealRoot}),this.SpecialRoot.getState().setEffectiveLayoutStrategy(this);var e=Bridge.cast(t.getState().RequireLayoutStrategy(),OrgChart.Layout.MultiLineFishboneLayoutStrategy);this.SiblingSpacing=e.SiblingSpacing,this.ParentConnectorShield=e.ParentConnectorShield,this.ParentChildSpacing=e.ParentChildSpacing,this.ParentAlignment=e.ParentAlignment,this.ChildConnectorHookLength=e.ChildConnectorHookLength},getSupportsAssistants:function(){return!1},NextGroup:function(){var t,e;if(!this.Iterator.NextGroup())return!1;for(this.SpecialRoot.getState().NumberOfSiblings=this.Iterator.Count,this.SpecialRoot.Prepare(2*this.RealRoot.getState().NumberOfSiblingRows|0),t=0;t<this.Iterator.Count;t=t+1|0)this.SpecialRoot.AddChildView(System.Array.getItem(this.RealRoot.getChildren(),this.Iterator.FromIndex+t|0,OrgChart.Layout.BoxTree.Node));return e=System.Array.getItem(this.RealRoot.getChildren(),(this.RealRoot.getState().NumberOfSiblings+1|0)+this.Iterator.Group|0,OrgChart.Layout.BoxTree.Node),this.SpecialRoot.AddChildView(e),OrgChart.Layout.LayoutAlgorithm.CopyExteriorFrom(this.SpecialRoot.getState(),this.RealRoot.getState()),!0},PreProcessThisNode:function(){throw new System.NotSupportedException},ApplyVerticalLayout:function(t){for(var e,r,o,a,n,i=null!=(n=this.RealRoot.getAssistantsRoot())?n.getState().BranchExterior.getBottom():this.SpecialRoot.getState().SiblingsRowV.To,g=0;g<this.Iterator.MaxOnLeft;g=g+1|0){var s=0===g?this.ParentChildSpacing:this.SiblingSpacing,u=System.Array.getItem(this.SpecialRoot.getChildren(),g,OrgChart.Layout.BoxTree.Node),h=u.getState();OrgChart.Layout.LayoutAlgorithm.MoveTo(h,h.getLeft(),i+s),e=new OrgChart.Layout.Dimensions.$ctor1(h.getTop(),h.getBottom()),(r=g+this.Iterator.MaxOnLeft|0)<this.Iterator.Count&&(a=(o=System.Array.getItem(this.SpecialRoot.getChildren(),r,OrgChart.Layout.BoxTree.Node)).getState(),OrgChart.Layout.LayoutAlgorithm.MoveTo(a,a.getLeft(),i+s),a.getBottom()>h.getBottom()?OrgChart.Layout.LayoutAlgorithm.MoveTo(h,h.getLeft(),a.getCenterV()-h.Size.Height/2):a.getBottom()<h.getBottom()&&OrgChart.Layout.LayoutAlgorithm.MoveTo(a,a.getLeft(),h.getCenterV()-a.Size.Height/2),a.BranchExterior=new OrgChart.Layout.Rect.$ctor1(a.TopLeft,a.Size),e=OrgChart.Layout.Dimensions.op_Addition(e,new OrgChart.Layout.Dimensions.$ctor1(a.getTop(),a.getBottom())),a.SiblingsRowV=e,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(t,o),i=a.BranchExterior.getBottom()),h.BranchExterior=new OrgChart.Layout.Rect.$ctor1(h.TopLeft,h.Size),h.SiblingsRowV=e,OrgChart.Layout.LayoutAlgorithm.VerticalLayout(t,u),i=Math.max(i,h.BranchExterior.getBottom())}},ApplyHorizontalLayout: