function wallViewModel(n,t,i){var r=this;r.auth=i,r.AuthenticateForAutoOutline=function(){return r.auth==Authentication.FullVersion},r.EnableToolTips=function(n){EnableToolTip("#wall",n.Wall_Mode),EnableToolTip("#wall_draw",n.Draw_Wall),EnableToolTip("#wall_auto_outline",n.Auto_Wall)},r.DisableToolTips=function(){DisableToolTip("#wall"),DisableToolTip("#wall_draw"),DisableToolTip("#wall_auto_outline")},r.context=ko.observable(n).subscribeTo("context"),r.wallProducts=ko.observableArray(t.wallProducts),r.guiObservables={wallTopHt:ko.observable(t.wallTopHt),wallFramingWidth:ko.observable(t.wallFramingWidth),wallProduct:ko.observable(t.wallProducts[t.wallProductIndex]),viewables:["wallTopHt","wallFramingWidth","wallProduct","name","vendorName","vendorId","id","height","width"],equals:function(n){return decimalEq(this.wallTopHt,n.wallTopHt)&&decimalEq(this.wallFramingWidth,n.wallFramingWidth)&&this.wallProduct.vendorId==n.wallProduct.vendorId&&this.wallProduct.id==n.wallProduct.id}},r.applyEdits=new ko.dirtyFlag(r.guiObservables,!1),r.needsUpdate=function(){return r.applyEdits.isDirty()},r.toString=function(){return"wallViewModel\n"+ko.toJSON(r)},r.DisplayToolIcon=function(n){(r.auth==Authentication.FreeVersion||r.auth==Authentication.FullVersion)&&(n==MODE_WALL?$("#wall > img").attr("src","images/wallsactive.png"):$("#wall > img").attr("src","images/walls.png"))},r.isValidInput=function(){return r.guiObservables.wallTopHt()>0&&r.guiObservables.wallFramingWidth()>0},r.isSameProduct=function(n,t){return n.vendorId==t.vendorId&&n.id==t.id},r.isBEDefault=function(n){return n.vendorId=="BuildEdge"&&n.id=="BEDefault"},r.isWidthEnabled=ko.computed(function(){return r.isSameProduct(r.guiObservables.wallProduct(),t.defaultWallProduct)}),r.isHeightEnabled=ko.computed(function(){return r.isSameProduct(r.guiObservables.wallProduct(),t.defaultWallProduct)}),r.ProcessContext=function(n){n==MODE_WALL&&($("#wall").toggleClass("downlarge"),r.requestDrawWall())},r.guiObservables.wallProductSubscription=r.guiObservables.wallProduct.subscribe(function(n){r.isBEDefault(n)||(r.guiObservables.wallTopHt(n.height),r.guiObservables.wallFramingWidth(n.width))}),r.hasExternalWallProducts=ko.computed(function(){return r.context()==CONTEXT_INPUT?t.wallProducts.length>1:r.context()==CONTEXT_EDIT?t.wallProducts.length>1||!r.isSameProduct(t.wallProduct,t.defaultWallProduct):void 0}),r.activeGizmo=ko.observable(WALL_GIZMO_NONE),r.isInDrawWallGizmo=ko.computed(function(){return r.activeGizmo()==WALL_GIZMO_DRAW}),r.isInAutoOutlineGizmo=ko.computed(function(){return r.activeGizmo()==WALL_GIZMO_AUTOOUTLINE}),r.requestDrawWall=function(){r.isInDrawWallGizmo()&&r.activeGizmo()!=WALL_GIZMO_NONE||RunCallback("skp:OnWallDraw",!1)},r.requestAutoOutlineWall=function(){if(!r.AuthenticateForAutoOutline())return!1;r.isInAutoOutlineGizmo()&&r.activeGizmo()!=WALL_GIZMO_NONE||RunCallback("skp:OnWallAutoOutline",!0)},r.wallGizmoDrawImage=ko.computed(function(){switch(r.activeGizmo()){case WALL_GIZMO_NONE:return"images/drawoutlinedisabled24.png";case WALL_GIZMO_DRAW:return"images/drawoutlineactive24.png";default:return"images/drawoutlineenabled24.png"}}),r.wallGizmoAutoOutlineImage=ko.computed(function(){if(r.AuthenticateForAutoOutline())switch(r.activeGizmo()){case WALL_GIZMO_NONE:return"images/AutoOutline24Disabled.png";case WALL_GIZMO_AUTOOUTLINE:return"images/AutoOutline24Active.png";default:return"images/AutoOutline24.png"}else return"images/AutoOutline24Disabled.png"}),ko.postbox.subscribe(WALL_GIZMO_CHANGED,function(n){r.activeGizmo(n)},r)}function OnDrawWallStarted(){AppendLog("OnDrawWallStarted"),ko.postbox.publish(WALL_GIZMO_CHANGED,WALL_GIZMO_DRAW)}function OnWallAutoOutlineStarted(){AppendLog("OnWallAutoOutlineStarted"),ko.postbox.publish(WALL_GIZMO_CHANGED,WALL_GIZMO_AUTOOUTLINE)}function OnNewWallOpeningStarted(){ko.postbox.publish(WALL_OPENING_GIZMO_CHANGED,WALL_OPENING_GIZMO_NEW)}function OnSelectWallOpeningStarted(){ko.postbox.publish(WALL_OPENING_GIZMO_CHANGED,WALL_OPENING_GIZMO_SELECT)}function OnMoveWallOpeningStarted(){ko.postbox.publish(WALL_OPENING_GIZMO_CHANGED,WALL_OPENING_GIZMO_MOVE)}function OnWallOpeningSelected(n){var t=function(n){var t=JSON.parse(n);ko.postbox.publish(WALL_OPENING_SELECTED,t)};_RunFunctionUnderSynchronousCallbackMode(t,n)}function OnWallOpeningTypeOptionsChanged(n){var t=function(n){var t=JSON.parse(n);ko.postbox.publish(WALL_OPENING_TYPE_OPTIONS_CHANGED,t)};_RunFunctionUnderSynchronousCallbackMode(t,n)}function OnWallOpeningSelectionCleared(){ko.postbox.publish(WALL_OPENING_SELECTION_CLEARED)}