function MainViewModel(n){function i(){return"MainViewModel"}var t=this;t.auth=n.auth,t.context=ko.observable(n.context).publishOn("context"),t.isInInputContext=ko.computed(function(){return t.context()==CONTEXT_INPUT}),t.isInEditContext=ko.computed(function(){return t.context()==CONTEXT_EDIT}),t.mode=ko.observable(n.mode),t.isInWallMode=ko.computed(function(){return t.mode()==MODE_WALL}),t.isInRoofMode=ko.computed(function(){return t.mode()==MODE_ROOF}),t.isInWallOpeningsMode=ko.computed(function(){return t.mode()==MODE_WALL_OPENING}),t.isInFloorMode=ko.computed(function(){return t.mode()==MODE_FLOOR}),t.isHibernating=ko.computed(function(){return t.mode()==MODE_NONE}),t.wallVM=new wallViewModel(t.context(),n.wallSettings,t.auth),t.roofSideVM=new roofSideViewModel(t.context(),n.roofSettings,t.auth),t.wallOpeningVM=new wallOpeningViewModel(t.context(),n.wallOpeningSettings,t.auth),t.floorVM=new floorViewModel(t.context(),n.floorSettings,t.auth),t.EnableToolTips=function(n){EnableToolTip("#help",n.Help),t.wallVM.EnableToolTips(n),t.roofSideVM.EnableToolTips(n),t.floorVM.EnableToolTips(n),t.wallOpeningVM.EnableToolTips(n)},t.DisableToolTips=function(){t.wallVM.DisableToolTips(),t.roofSideVM.DisableToolTips(),t.floorVM.DisableToolTips(),t.wallOpeningVM.DisableToolTips()},t.DisplayToolBar=function(n){t.wallVM.DisplayToolIcon(n),t.roofSideVM.DisplayToolIcon(n),t.floorVM.DisplayToolIcon(n),t.wallOpeningVM.DisplayToolIcon(n)},t.ProcessContext=function(n,i){t.wallVM.ProcessContext(n,i),t.roofSideVM.ProcessContext(n,i),t.floorVM.ProcessContext(n,i),t.wallOpeningVM.ProcessContext(n,i)},t.toString=function(){var n=i()+" = ";return n+ko.toJSON(t)},t.numberOfRoofSolutions=ko.observable(0),t.modelHasBuildEdgeEntities=ko.observable(!1),t.IsFreeVersion=ko.computed(function(){return t.auth==Authentication.FreeVersion}),t.EnterAuthCode=function(){RunCallback("skp:OnSetAuthorizationCode")},ko.postbox.subscribe(ROOF_SOLUTION_CHANGED,function(n){t.numberOfRoofSolutions(n)}),t.roofSaveChangesImage=ko.computed(function(){return t.numberOfRoofSolutions()>0?"images/savechangesenabled24.png":"images/savechangesdisabled24.png"}),t.commitToSketchUp=function(){ko.postbox.publish(COMMIT_TO_SU)},t.openHelp=function(){window.open("http://help.buildedge.com/buildedgeplanhelp/buildedgeplanhelp.htm")},t.setInvisibleEdges=function(){$("html").addClass("wait"),setTimeout(function(){RunCallback("skp:OnSetInvisibleEdges")},100)},t.requestDone=function(){t.roofSideVM.isReadyForEdit(!1),t.floorVM.isReadyForEdit(!1),(t.numberOfRoofSolutions()>0||t.haveFloorSolution()==!0)&&(ko.postbox.publish(EXITING_MODE_CLEAR_TOOLTIP),RunCallback("skp:OnDone"))},t.requestCancel=function(){t.roofSideVM.isReadyForEdit(!1),t.floorVM.isReadyForEdit(!1),ko.postbox.publish(EXITING_MODE_CLEAR_TOOLTIP),RunCallback("skp:OnCancel")},t.haveFloorSolution=ko.observable(0),ko.postbox.subscribe(FLOOR_SOLUTION_CHANGED,function(n){t.haveFloorSolution(n)}),t.floorSaveChangesImage=ko.computed(function(){return t.haveFloorSolution()?"images/savechangesenabled24.png":"images/savechangesdisabled24.png"}),ko.postbox.subscribe(VIEW_HIBERNATED,function(n){mainVM.DisplayToolBar("foo"),$("#roofEditToolbar").hide(),$("#floorEditToolbar").hide(),t.mode(n.mode),t.modelHasBuildEdgeEntities(n.hasBEEntities)}),ko.postbox.subscribe(BE_OBJECTS_IN_MODEL_CHANGED,function(n){t.modelHasBuildEdgeEntities(n)})}