@crystaldesign/diva-web-planner-react 25.1.0-beta.24 → 25.1.0-beta.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 2905.diva-web-planner-react.umd.min.js.LICENSE.txt */
2
- "use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[2905],{82905:(t,e,n)=>{n.r(e),n.d(e,{default:()=>T});var o=n(84658),i=n(13125),s=n(43860),l=n(80248),r=n(50747),a=n.n(r),h=n(37537),c=n(12952),u=h.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),m=function(){return(0,s.Z)((function BoxPlannerPartlistHelper(t,e,n,o,s,r,a){(0,i.Z)(this,BoxPlannerPartlistHelper),(0,l.Z)(this,"constructionRules",void 0),(0,l.Z)(this,"getOptionVal",void 0),(0,l.Z)(this,"setOptionValue",void 0),(0,l.Z)(this,"getElementHasBottomPlate",void 0),(0,l.Z)(this,"getElementIsCornerElement",void 0),(0,l.Z)(this,"getCornerType",void 0),(0,l.Z)(this,"getElementHasTopPlate",void 0),(0,l.Z)(this,"getElementIsGarderobeElement",void 0),this.getOptionVal=t,this.getElementHasBottomPlate=n,this.setOptionValue=e,this.getElementIsCornerElement=o,this.getCornerType=s,this.getElementHasTopPlate=r,this.getElementIsGarderobeElement=a}),[{key:"setConstructionRules",value:function setConstructionRules(t){this.constructionRules=t}},{key:"getGroundPlatesNumOfRightNeighbors",value:function getGroundPlatesNumOfRightNeighbors(t,e,n){var o=0;if(this.getElementHasBottomPlate(t,n)&&o++,e.getPlannerHasActiveBackside()){var i=e.getOppositeElement(t.getElementId());if(this.getElementHasBottomPlate(i,n)&&o++,e.getElementHasRightElement(t.getElementId())){var s=e.getRightElement(t.getElementId()),l=e.getOppositeElement(s.getElementId());return this.getElementHasBottomPlate(s,n)&&o++,this.getElementHasBottomPlate(l,n)&&o++,o}return o}if(e.getElementHasRightElement(t.getElementId())){var r=e.getRightElement(t.getElementId());return this.getElementHasBottomPlate(r,n)&&o++,o}return o}},{key:"getTopPlatesNumOfRightNeighbors",value:function getTopPlatesNumOfRightNeighbors(t,e,n){var o=0;if(this.getElementHasTopPlate(t,e,n)&&o++,e.getPlannerHasActiveBackside()){var i=e.getOppositeElement(t.getElementId());if(this.getElementHasTopPlate(i,e,n)&&o++,e.getElementHasRightElement(t.getElementId())){var s=e.getRightElement(t.getElementId()),l=e.getOppositeElement(s.getElementId());return this.getElementHasTopPlate(s,e,n)&&o++,this.getElementHasTopPlate(l,e,n)&&o++,o}return o}if(e.getElementHasRightElement(t.getElementId())){var r=e.getRightElement(t.getElementId());return this.getElementHasTopPlate(r,e,n)&&o++,o}return o}},{key:"getElementHeight",value:function getElementHeight(t,e){var n=this.getOptionVal(t.getElementId(),"OPTHOEHE",e);return"OPVH_6"==n?"6":"OPVH_11"==n?"11":"OPVH_18"==n?"18":"37"}},{key:"getElementDepth",value:function getElementDepth(t,e){var n=this.getOptionVal(t.getElementId(),"OPTTIEFE",e);return"OPVTIEFE_18"==n?"18":"37"}},{key:"getElementRahmenColor",value:function getElementRahmenColor(t,e){var n=this.getOptionVal(t.getElementId(),"OPTFARBE_RAHMEN",e);return"OPVCHROM"==n?"CHROM":"OPVSCHWARZ_MATT"==n?"BLACK":"CHROM"}},{key:"calculateRahmen",value:function calculateRahmen(t,e){for(var n=t.getAllElementsInGrid(),o=0;o<n.length;o++)this.constructionRules.VarticalRahmenInfo&&(this.correctRahmenVerticalLeftFront(n[o],t,e),this.correctRahmenVerticalLeftBack(n[o],t,e),this.correctRahmenVerticalRightFront(n[o],t,e),this.correctRahmenVerticalRightBack(n[o],t,e),u.debug("---------Correct Senkrechte Rahmen for element with ID: "+n[o].ElementId+"; posNr: "+n[o].PosNr+" ----------"),u.debug("Senkrechter Rahmen links vorne: "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_L_V",e)),u.debug("Senkrechter Rahmen links hinten: "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_L_H",e)),u.debug("Senkrechter Rahmen rechts vorne : "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_R_V",e)),u.debug("Senkrechter Rahmen rechts hinten : "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_R_H",e))),this.constructionRules.DepthRahmenInfo&&(this.correctRahmenDepthLeftBottom(n[o],t,e),this.correctRahmenDepthLeftTop(n[o],t,e),this.correctRahmenDepthRightBottom(n[o],t,e),this.correctRahmenDepthRightTop(n[o],t,e),u.debug("---------Correct Tiefenverbinder Rahmen for element with ID: "+n[o].ElementId+"; posNr: "+n[o].PosNr+" ----------"),u.debug("Tiefen Rahmen links unten: "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_L_U",e)),u.debug("Tiefen Rahmen links oben: "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_L_O",e)),u.debug("Tiefen Rahmen rechts unten : "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_R_U",e)),u.debug("Tiefen Rahmen rechts oben : "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_R_O",e)))}},{key:"correctRahmenDepthLeftBottom",value:function correctRahmenDepthLeftBottom(t,e,n){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,n),!(e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId()))&&!e.getElementHasBottomElement(t.getElementId()))if(e.getPlannerHasActiveBackside())switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(this.getElementHasBottomPlate(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,n);else switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,n)}}},{key:"correctRahmenDepthLeftTop",value:function correctRahmenDepthLeftTop(t,e,n){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,n),!(e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId())))if(e.getPlannerHasActiveBackside())switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(this.getElementIsCornerElement(t,n))switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else if(this.getElementHasTopPlate(t,e,n))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,n);else switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,n)}}},{key:"correctRahmenDepthRightBottom",value:function correctRahmenDepthRightBottom(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId()))if(e.getPlannerHasActiveBackside())switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(o){var i=e.getRightElement(t.getElementId());if(!this.getElementHasBottomPlate(t,n)||this.getElementIsCornerElement(t,n))switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else if(!this.getElementHasBottomPlate(i,n)||this.getElementIsCornerElement(i,n))switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,n)}else if(this.getElementHasBottomPlate(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,n);else switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}break;case"BLACK":o?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,n):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,n)}}},{key:"correctRahmenDepthRightTop",value:function correctRahmenDepthRightTop(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(e.getPlannerHasActiveBackside())switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(!this.getElementHasTopPlate(t,e,n)||this.getElementIsCornerElement(t,n)){switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}return}if(!i)return void this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,n);var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());if(!this.getElementHasTopPlate(s,e,n)||this.getElementIsCornerElement(s,n)){switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}return}this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,n);break;case"BLACK":i?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,n):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,n)}}},{key:"correctRahmenVerticalLeftFront",value:function correctRahmenVerticalLeftFront(t,e,n){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,n),!(e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,n)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,n);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,n);break;case"18":switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,n)}break;case"37":if(this.getElementIsGarderobeElement(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n);else switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,n)}}}},{key:"correctRahmenVerticalLeftBack",value:function correctRahmenVerticalLeftBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside;if(!o&&!(o?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,n)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,n);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,n);break;case"18":switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,n)}break;case"37":if(this.getElementIsGarderobeElement(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n);else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(e.getPlannerHasActiveBackside()){var i=e.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,n)}}}},{key:"correctRahmenVerticalRightFront",value:function correctRahmenVerticalRightFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,n)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,n);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,n);break;case"18":switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,n)}break;case"37":if(this.getElementIsGarderobeElement(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n);else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());this.getElementIsGarderobeElement(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,n)}}}},{key:"correctRahmenVerticalRightBack",value:function correctRahmenVerticalRightBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside;if(!o){var i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,n)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,n);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,n);break;case"18":switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,n)}break;case"37":if(this.getElementIsGarderobeElement(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n);else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());if(!s)return;if(e.getPlannerHasActiveBackside()){var l=e.getOppositeElement(t.getElementId());if(!l)return;var r=e.getOppositeElement(s.getElementId());if(!r)return;this.getElementIsGarderobeElement(s,n)||this.getElementIsGarderobeElement(l,n)||this.getElementIsGarderobeElement(r,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else this.getElementIsGarderobeElement(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else if(e.getPlannerHasActiveBackside()){var a=e.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(a,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,n)}}}}},{key:"calculateKnots",value:function calculateKnots(t,e){if(this.constructionRules.hasKNOTS)for(var n=t.getAllElementsInGrid(),o=0;o<n.length;o++)this.correctKnotLeftTopFront(n[o],t,e),this.correctKnotLeftTopBack(n[o],t,e),this.correctKnotLeftBottomFront(n[o],t,e),this.correctKnotLeftBottomBack(n[o],t,e),this.correctKnotRightTopFront(n[o],t,e),this.correctKnotRightTopBack(n[o],t,e),this.correctKnotRightBottomFront(n[o],t,e),this.correctKnotRightBottomBack(n[o],t,e),this.correctKnotRightMiddleBack(n[o],t,e),this.correctKnotLeftMiddleBack(n[o],t,e),u.debug("---------Correct Knots for element with ID: "+n[o].ElementId+"; posNr: "+n[o].PosNr+" ----------"),u.debug("Links oben vorne : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LTF",e)),u.debug("Links oben hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LTB",e)),u.debug("Links unten vorne : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LBF",e)),u.debug("Links unten hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LBB",e)),u.debug("Rechts oben vorne : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RTF",e)),u.debug("Rechts oben hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RTB",e)),u.debug("Rechts unten vorne : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RBF",e)),u.debug("Links mitte hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LMB",e)),u.debug("Rechts mitte hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RMB",e)),u.debug("Rechts unten hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RBB",e))}},{key:"correctKnotLeftBottomFront",value:function correctKnotLeftBottomFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId())&&(o||(e.getPlannerHasActiveBackside()&&this.getElementHasBottomPlate(t,n)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n),this.getElementHasBottomPlate(t,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n)),this.getElementIsCornerElement(t,n))){var i=e.getLeftElement(t.getElementId());if(this.getElementIsCornerElement(i,n))return;var s=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasBottomPlate(i,n)?this.getElementHasBottomPlate(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.getElementHasBottomPlate(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":this.getElementHasBottomPlate(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}},{key:"correctKnotLeftTopFront",value:function correctKnotLeftTopFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(o||(e.getPlannerHasActiveBackside()&&this.getElementHasTopPlate(t,e,n)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n),this.getElementHasTopPlate(t,e,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n)),this.getElementIsCornerElement(t,n)){var i=e.getElementHasLeftElement(t.getElementId());if(o&&this.getElementIsCornerElement(e.getLeftElement(t.getElementId()),n))return;var s=e.getElementHasRightElement(t.getElementId());if(i||s){if(s&&!i){var l=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasTopPlate(l,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}else if(!s&&i){var r=e.getLeftElement(t.getElementId());this.getElementHasTopPlate(r,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3erer_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}else if(s&&i){var a=e.getLeftElement(t.getElementId()),h=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasTopPlate(a,e,n)?this.getElementHasTopPlate(h,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.getElementHasTopPlate(h,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":this.getElementHasTopPlate(a,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}},{key:"correctKnotLeftBottomBack",value:function correctKnotLeftBottomBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId())){if(!o)if(e.getPlannerHasActiveBackside()&&!e.getIndexInGridByElementId(t.getElementId()).backside){var i=e.getOppositeElement(t.getElementId());i&&(this.getElementHasBottomPlate(t,n)?this.getElementHasBottomPlate(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.getElementHasBottomPlate(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n))}else e.getPlannerHasActiveBackside()||this.getElementHasBottomPlate(t,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);if(this.getElementIsCornerElement(t,n)){var s=e.getLeftElement(t.getElementId());if(this.getElementIsCornerElement(s,n))return;switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasBottomPlate(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":var l=e.getRightElement(t.getElementId());this.getElementHasBottomPlate(s,n)?this.getElementHasBottomPlate(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.getElementHasBottomPlate(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,n)}}}}},{key:"correctKnotLeftTopBack",value:function correctKnotLeftTopBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(!o)if(e.getPlannerHasActiveBackside()&&!e.getIndexInGridByElementId(t.getElementId()).backside){var i=e.getOppositeElement(t.getElementId());i&&(this.getElementHasTopPlate(t,e,n)?this.getElementHasTopPlate(i,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.getElementHasTopPlate(i,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n))}else e.getPlannerHasActiveBackside()||this.getElementHasTopPlate(t,e,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);if(this.getElementIsCornerElement(t,n)){var s=e.getElementHasLeftElement(t.getElementId());if(o&&this.getElementIsCornerElement(e.getLeftElement(t.getElementId()),n))return;var l=e.getElementHasRightElement(t.getElementId());if(s||l){if(l&&!s){var r=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":this.getElementHasTopPlate(r,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n)}}else if(!l&&s){var a=e.getLeftElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":case"OUTSIDE":this.getElementHasTopPlate(a,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n)}}else if(l&&s){var h=e.getLeftElement(t.getElementId()),c=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasTopPlate(h,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":this.getElementHasTopPlate(h,e,n)?this.getElementHasTopPlate(c,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.getElementHasTopPlate(c,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,n)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}},{key:"correctKnotRightMiddleBack",value:function correctKnotRightMiddleBack(t,e,n){if((this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n),this.getElementIsGarderobeElement(t,n))&&!e.getIndexInGridByElementId(t.getElementId()).backside)if(e.getElementHasRightElement(t.getElementId()))if(e.getPlannerHasActiveBackside()){var o=e.getOppositeElement(t.getElementId());if(!o)return;var i=e.getRightElement(t.getElementId());if(!i)return;var s=e.getOppositeElement(i.getElementId());if(!s)return;this.getElementIsGarderobeElement(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n):this.getElementIsGarderobeElement(o,n)?this.getElementIsGarderobeElement(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.getElementIsGarderobeElement(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else{var l=e.getRightElement(t.getElementId());if(!l)return;this.getElementIsGarderobeElement(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else if(e.getPlannerHasActiveBackside()){var r=e.getOppositeElement(t.getElementId());if(!r)return;this.getElementIsGarderobeElement(r,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}},{key:"correctKnotLeftMiddleBack",value:function correctKnotLeftMiddleBack(t,e,n){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n),this.getElementIsGarderobeElement(t,n)){var o=e.getIndexInGridByElementId(t.getElementId()).backside;if(!o){var i=o?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(i){var s=e.getLeftElement(t.getElementId());if(this.getElementIsGarderobeElement(s,n))return}if(i)if(e.getPlannerHasActiveBackside()){var l=e.getLeftElement(t.getElementId());if(!l)return;var r=e.getOppositeElement(t.getElementId());if(!r)return;var a=e.getOppositeElement(null==l?void 0:l.getElementId());if(!a)return;this.getElementIsGarderobeElement(a,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n):this.getElementIsGarderobeElement(r,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);else if(e.getPlannerHasActiveBackside()){var h=e.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(h,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}}}},{key:"correctKnotRightBottomFront",value:function correctKnotRightBottomFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId())){if(e.getPlannerHasActiveBackside())if(this.getElementHasBottomPlate(t,n))if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());s&&(this.getElementHasBottomPlate(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);else if(i){var l=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());l&&(this.getElementHasBottomPlate(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n);else if(this.getElementHasBottomPlate(t,n)){var r=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());r&&!this.getElementHasBottomPlate(r,n)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}else if(i){var a=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());a&&!this.getElementIsCornerElement(a,n)&&(this.getElementHasBottomPlate(a,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n);if(this.getElementIsCornerElement(t,n))switch(this.getCornerType(t,n)){case"INSIDE":var h=e.getRightElement(t.getElementId());if(h&&this.getElementIsCornerElement(h,n))if(e.getElementHasRightElement(h.getElementId())){var c=e.getRightElement(h.getElementId());this.getElementHasBottomPlate(c,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else h&&this.getElementHasBottomPlate(h,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}},{key:"correctKnotRightTopFront",value:function correctKnotRightTopFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(e.getPlannerHasActiveBackside())if(this.getElementHasTopPlate(t,e,n))if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());s&&(this.getElementHasTopPlate(s,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);else if(i){var l=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());l&&(this.getElementHasTopPlate(l,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n);else if(this.getElementHasTopPlate(t,e,n)){if(i){var r=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());r&&(this.getElementHasTopPlate(r,e,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n))}}else if(i){var a=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());a&&!this.getElementIsCornerElement(a,n)&&(this.getElementHasTopPlate(a,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n);if(this.getElementIsCornerElement(t,n)){var h=e.getElementHasLeftElement(t.getElementId()),c=e.getElementHasRightElement(t.getElementId());if(h||c){if(c&&!h){var u=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":if(this.getElementIsCornerElement(u,n))if(e.getElementHasRightElement(u.getElementId())){var m=e.getRightElement(u.getElementId());this.getElementHasTopPlate(m,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else this.getElementHasTopPlate(u,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}else if(!c&&h){e.getLeftElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}else if(c&&h){var d=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":if(this.getElementIsCornerElement(d,n))if(e.getElementHasRightElement(d.getElementId())){var g=e.getRightElement(d.getElementId());this.getElementHasTopPlate(g,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else this.getElementHasTopPlate(d,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}},{key:"correctKnotRightBottomBack",value:function correctKnotRightBottomBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId())&&!e.getIndexInGridByElementId(t.getElementId()).backside){if(e.getPlannerHasActiveBackside())switch(this.getGroundPlatesNumOfRightNeighbors(t,e,n)){case 0:i?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n);break;case 1:i?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case 2:i?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);break;case 3:i&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n);break;case 4:i&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,n)}else if(this.getElementHasBottomPlate(t,n)){if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());s&&(this.getElementHasBottomPlate(s,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n))}}else if(i){var l=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());l&&!this.getElementIsCornerElement(l,n)&&(this.getElementHasBottomPlate(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);if(this.getElementIsCornerElement(t,n))switch(this.getCornerType(t,n)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":var r=e.getRightElement(t.getElementId());if(this.getElementIsCornerElement(r,n)){var a=e.getRightElement(r.getElementId());this.getElementHasBottomPlate(a,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n)}else this.getElementHasBottomPlate(r,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}},{key:"correctKnotRightTopBack",value:function correctKnotRightTopBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(!e.getIndexInGridByElementId(t.getElementId()).backside){if(e.getPlannerHasActiveBackside())if(i)switch(this.getTopPlatesNumOfRightNeighbors(t,e,n)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,n);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n);break;case 3:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n);break;case 4:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,n)}else switch(this.getTopPlatesNumOfRightNeighbors(t,e,n)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n)}else if(this.getElementHasTopPlate(t,e,n)){if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());this.getElementIsCornerElement(s,n)||this.getElementHasTopPlate(s,e,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n)}}else if(i){var l=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());l&&!this.getElementIsCornerElement(l,n)&&(this.getElementHasTopPlate(l,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);if(this.getElementIsCornerElement(t,n)){var r=e.getElementHasLeftElement(t.getElementId()),a=e.getElementHasRightElement(t.getElementId());if(r||a){if(a&&!r){var h=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":if(this.getElementIsCornerElement(h,n))if(e.getElementHasRightElement(h.getElementId())){var c=e.getRightElement(h.getElementId());this.getElementHasTopPlate(c,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else this.getElementHasTopPlate(h,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}else if(!a&&r)this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);else if(a&&r){var u=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":if(this.getElementIsCornerElement(u,n))if(e.getElementHasRightElement(u.getElementId())){var m=e.getRightElement(u.getElementId());this.getElementHasTopPlate(m,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else this.getElementHasTopPlate(u,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}}])}(),d=h.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),g=function(){return(0,s.Z)((function ConstructionRulesHandler(t,e,n){var o=this;(0,i.Z)(this,ConstructionRulesHandler),(0,l.Z)(this,"getValueOfOptionOfArticle",void 0),(0,l.Z)(this,"checkArticleHasOption",void 0),(0,l.Z)(this,"updateCfgValuesByPlanner",void 0),(0,l.Z)(this,"constructionRules",void 0),(0,l.Z)(this,"constructionRulesLoaded",void 0),(0,l.Z)(this,"hideOptionsForConstruction",void 0),(0,l.Z)(this,"partlistHelper",void 0),(0,l.Z)(this,"getOptionVal",(function(t,e,n){if(n.has(t)&&n.get(t).has(e)){var i=n.get(t).get(e);return null!=i?i:""}var s=o.getValueOfOptionOfArticle(t,e);return null!=s?s:""})),(0,l.Z)(this,"hasOptionValue",(function(t,e,n){return!(!n.has(t)||!n.get(t).has(e))||!!o.getValueOfOptionOfArticle(t,e)})),(0,l.Z)(this,"setOptionValue",(function(t,e,n,i){var s;if(i.has(t)||i.set(t,new Map),null===(s=i.get(t))||void 0===s||s.set(e,n),o.hideOptionsForConstruction.has(t)){var l=o.hideOptionsForConstruction.get(t).indexOf(e);l>=0&&o.hideOptionsForConstruction.get(t).splice(l,1)}})),(0,l.Z)(this,"getElementHasBottomPlate",(function(t,e){if(o.constructionRules.knotInfo.elementsWithGroundPlate)for(var n=0;n<o.constructionRules.knotInfo.elementsWithGroundPlate.length;n++){var i=o.constructionRules.knotInfo.elementsWithGroundPlate[n].onOPT,s=o.constructionRules.knotInfo.elementsWithGroundPlate[n].onOPVs,l=o.getOptionVal(t.getElementId(),i,e);return o.arrayContainsValue(s,l)}return!1})),(0,l.Z)(this,"getElementIsCornerElement",(function(t,e){return o.constructionRules.hasCORNER&&o.arrayContainsValue(o.constructionRules.knotInfo.cornerElements.onOPVs,o.getOptionVal(t.getElementId(),o.constructionRules.knotInfo.cornerElements.onOPT,e))})),(0,l.Z)(this,"getElementIsGarderobeElement",(function(t,e){return o.constructionRules.hasGARDEROBE&&o.arrayContainsValue(o.constructionRules.knotInfo.garderobeElements.onOPVs,o.getOptionVal(t.getElementId(),o.constructionRules.knotInfo.garderobeElements.onOPT,e))})),(0,l.Z)(this,"getCornerType",(function(t,e){return"OPVECK_I"==o.getOptionVal(t.getElementId(),"OPTELEMENT",e)?"INSIDE":"OPVECK_A"==o.getOptionVal(t.getElementId(),"OPTELEMENT",e)?"OUTSIDE":"NOCORNER"})),(0,l.Z)(this,"getElementHasTopPlate",(function(t,e,n){return!e.getElementHasTopElement(t.getElementId())||o.getElementHasBottomPlate(e.getTopElement(t.getElementId()),n)})),this.constructionRulesLoaded=!1,this.getValueOfOptionOfArticle=t,this.checkArticleHasOption=e,this.hideOptionsForConstruction=new Map,this.updateCfgValuesByPlanner=n,this.partlistHelper=new m(this.getOptionVal,this.setOptionValue,this.getElementHasBottomPlate,this.getElementIsCornerElement,this.getCornerType,this.getElementHasTopPlate,this.getElementIsGarderobeElement)}),[{key:"arrayContainsValue",value:function arrayContainsValue(t,e){if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var o=t.split(";");for(n=0;n<o.length;n++)if(o[n]==e)return!0;return!1}},{key:"evalRule",value:function evalRule(t,e,n){for(var o=!0,i=e.split("&"),s=0;s<i.length;s++){var l=i[s].split("=")[0],r=i[s].split("=")[1],a=this.getOptionVal(t,l,n);a&&a!=r&&(o=!1)}return o}},{key:"setOptionDoShow",value:function setOptionDoShow(t,e,n){var o,i=this.constructionRules.optionsVisibilityInfo[e];null!=i.doShow&&(n.has(t)||n.set(t,new Map),null===(o=n.get(t))||void 0===o||o.set(e,i.doShow));if(this.hideOptionsForConstruction.has(t)){var s,l=this.hideOptionsForConstruction.get(t).indexOf(e);if(l>=0)null===(s=this.hideOptionsForConstruction.get(t))||void 0===s||s.splice(l,1)}}},{key:"setOptionDoHide",value:function setOptionDoHide(t,e,n){var o,i,s=this.constructionRules.optionsVisibilityInfo[e];n.has(t)||n.set(t,new Map),null===(o=n.get(t))||void 0===o||o.set(e,s.doHide),this.hideOptionsForConstruction.has(t)||this.hideOptionsForConstruction.set(t,[]),null===(i=this.hideOptionsForConstruction.get(t))||void 0===i||i.push(e)}},{key:"getCurOptionBasedConstructionRules",value:function getCurOptionBasedConstructionRules(t,e){for(var n=[],o=0;o<this.constructionRules.optionBasedConstructionRules.length;o++){var i=this.constructionRules.optionBasedConstructionRules[o];this.getOptionVal(t,i.masterOptionName,e)==i.masterOptionValue&&n.push(i)}return n}},{key:"setAllOptToDefault",value:function setAllOptToDefault(t,e,n,o){for(var i=[],s=void 0,l=0;l<this.constructionRules.optionsInfluenceRulesOfAllElements.length;l++){var r=this.constructionRules.optionsInfluenceRulesOfAllElements[l];for(var a in n)a==r.onOPT&&this.arrayContainsValue(r.onOPVs,n[a])&&i.push({opt:r.influenceOPT,opv:r.forceOPV,unvalidOPVs:r.unvalidOPVs,warning:r.warning,doShowWarning:!1})}for(var h=t.getAllElementIdsInGrid(),c=0;c<h.length;c++){var u;if(this.hideOptionsForConstruction.has(h[c])&&this.hideOptionsForConstruction.get(h[c]).length>0){for(;this.hideOptionsForConstruction.get(h[c]).length>0;){var m=this.hideOptionsForConstruction.get(h[c])[0];this.setOptionDoShow(h[c],m,e)}this.hideOptionsForConstruction.delete(h[c])}this.constructionRules.hasDMOD&&(t.getPlannerHasActiveBackside()?this.setOptionDoShow(h[c],"OPTDMOD",e):this.setOptionDoHide(h[c],"OPTDMOD",e));var d=t.getColumnCount();d>1?this.setOptionDoShow(h[c],"OPTMULTICOL",e):this.setOptionDoHide(h[c],"OPTMULTICOL",e),this.setOptionValue(h[c],"OPTCORNER_COL_L","OPVOHNE",e),this.setOptionValue(h[c],"OPTCORNER_COL_R","OPVOHNE",e);var g=t.getIndexInGridByElementId(h[c]);if(g.backside)this.setOptionValue(h[c],"OPTELEM_ON_BACK","OPVJA",e);else{if(this.setOptionValue(h[c],"OPTELEM_ON_BACK","OPVNEIN",e),g.col>0){var E=t.getPlannerElementAtGridPos(g.col-1,0,!1);if(E){var I=this.getOptionVal(E.getElementId(),"OPTELEMENT",e);"OPVECK_I"==I?this.setOptionValue(h[c],"OPTCORNER_COL_L","OPVECK_I",e):"OPVECK_A"==I?this.setOptionValue(h[c],"OPTCORNER_COL_L","OPVECK_A",e):this.setOptionValue(h[c],"OPTCORNER_COL_L","OPVOHNE",e)}}if(g.col<d-1){var O=t.getPlannerElementAtGridPos(g.col+1,0,!1);if(O){var k=this.getOptionVal(O.getElementId(),"OPTELEMENT",e);"OPVECK_I"==k?this.setOptionValue(h[c],"OPTCORNER_COL_R","OPVECK_I",e):"OPVECK_A"==k?this.setOptionValue(h[c],"OPTCORNER_COL_R","OPVECK_A",e):this.setOptionValue(h[c],"OPTCORNER_COL_R","OPVOHNE",e)}}}if(this.constructionRules.avoidOptionLastCol){var f=this.getOptionVal(h[c],this.constructionRules.avoidOptionLastCol.onOPT,e);this.arrayContainsValue(this.constructionRules.avoidOptionLastCol.onOPVs,f)&&g.col==d-1&&this.setOptionValue(h[c],this.constructionRules.avoidOptionLastCol.onOPT,this.constructionRules.avoidOptionLastCol.defaultOpv,e)}if(this.constructionRules.avoidOptionFirstCol){var R=this.getOptionVal(h[c],this.constructionRules.avoidOptionFirstCol.onOPT,e);this.arrayContainsValue(this.constructionRules.avoidOptionFirstCol.onOPVs,R)&&0==g.col&&this.setOptionValue(h[c],this.constructionRules.avoidOptionFirstCol.onOPT,this.constructionRules.avoidOptionFirstCol.defaultOpv,e)}var p=this.hasOptionValue(h[c],"OPTWW",e);if(t.getElementIsFirstInGrid(h[c])?(this.setOptionDoShow(h[c],"OPTWERKZEUGKASTEN",e),p&&(t.getSizeOfWholeSet().y>173&&!t.getPlannerHasActiveBackside()?this.setOptionDoShow(h[c],"OPTWW",e):this.setOptionDoHide(h[c],"OPTWW",e))):(this.setOptionDoHide(h[c],"OPTWERKZEUGKASTEN",e),p&&this.setOptionDoHide(h[c],"OPTWW",e)),e.has(h[c])||e.set(h[c],new Map),null===(u=e.get(h[c]))||void 0===u||u.set("DEBUG",t.getElementById(h[c]).getPosNr()+""),i.length>0)for(var P=0;P<i.length;P++){var T=this.getOptionVal(h[c],i[P].opt,e),V=!1;if(i[P].unvalidOPVs&&0!=i[P].unvalidOPVs.length){for(var _=i[P].unvalidOPVs.split(";"),B=0;B<_.length;B++)if(_[B]==T){V=!0;break}}else V=!0;V&&(T!=i[P].opv&&(this.setOptionValue(h[c],i[P].opt,i[P].opv,e),i[P].doShowWarning||(i[P].doShowWarning=!0,s=i[P].warning)))}if(n)for(var a in n)if(""!=a&&n[a]&&""!=n[a])for(l=0;l<this.constructionRules.optionsInfluenceRulesOfSingleElement.length;l++){r=this.constructionRules.optionsInfluenceRulesOfSingleElement[l];var v=!1;if(r.dir&&o&&o.length>0){if("TOP"==r.dir&&t.getElementHasBottomElement(h[c])&&o.indexOf(t.getBottomElement(h[c]).getElementId())>=0&&(v=!0),"DOWN"==r.dir&&t.getElementHasTopElement(h[c])&&o.indexOf(t.getTopElement(h[c]).getElementId())>=0&&(v=!0),"LEFT_RIGHT"==r.dir&&(t.getElementHasLeftElement(h[c])&&o.indexOf(t.getLeftElement(h[c]).getElementId())>=0||t.getElementHasRightElement(h[c])&&o.indexOf(t.getRightElement(h[c]).getElementId())>=0)&&(v=!0),"COL"==r.dir){var G=t.getIndexInGridByElementId(h[c]);t.getAllElementsInColumn(G.col,G.backside).forEach((function(t){return o.indexOf(t.ElementId)>=0?v=!0:void 0}))}if("BACK"==r.dir&&t.getPlannerHasActiveBackside()){var b=t.getOppositeElement(h[c]);b&&o.indexOf(b.getElementId())>=0&&(v=!0)}}else v=!0;if(v){T=this.getOptionVal(h[c],r.influenceOPT,e);a==r.onOPT&&T&&""!=T&&this.arrayContainsValue(r.unvalidOPVs,T)&&this.arrayContainsValue(r.onOPVs,n[a])&&(this.setOptionValue(h[c],r.influenceOPT,r.defaultOpv,e),r.warning&&(s=r.warning))}}var H=this.getCurOptionBasedConstructionRules(h[c],e);if(H)for(var C=0;C<H.length;C++)if(H[C].defaultOptions)for(var D=0;D<H[C].defaultOptions.length;D++){var A=H[C].defaultOptions[D];if(!A.rule||""==A.rule||this.evalRule(h[c],A.rule,e))for(var y=0;y<A.options.length;y++)"doShow"==A.value?this.setOptionDoShow(h[c],A.options[y],e):"doHide"==A.value&&this.setOptionDoHide(h[c],A.options[y],e),A.opv&&this.setOptionValue(h[c],A.options[y],A.opv,e)}this.setOptionValue(h[c],"OPTFAF_L_V","OPVOHNE_FAF",e),this.setOptionValue(h[c],"OPTFAF_L_H","OPVOHNE_FAF",e),this.setOptionValue(h[c],"OPTFAF_R_V","OPVOHNE_FAF",e),this.setOptionValue(h[c],"OPTFAF_R_H","OPVOHNE_FAF",e)}return s}},{key:"doCorrectAffectedElementsByOption",value:function doCorrectAffectedElementsByOption(t,e,n,o){if(null!=o&&1==o.length){var i=o[0];if(null!=n)for(var s in n){if(this.constructionRules.forceSameOptionInGrid&&this.arrayContainsValue(this.constructionRules.forceSameOptionInGrid,s)){var l=t.getIndexInGridByElementId(i).backside?t.getAllElementsInBackGrid():t.getAllElementsInFrontGrid();if(null!=l)for(var r=0;r<l.length;r++)this.setOptionValue(l[r].ElementId,s,n[s],e)}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInCol,s)){var a=t.getIndexInGridByElementId(i),h=t.getAllElementsInColumn(a.col,a.backside);if(null!=h){if(t.getPlannerHasActiveBackside()){var c,u=t.getAllElementsInColumn(a.col,!a.backside);u&&(h=null===(c=h)||void 0===c?void 0:c.concat(u))}for(r=0;r<h.length;r++)this.setOptionValue(h[r].ElementId,s,n[s],e)}}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInRow,s)){var m=t.getIndexInGridByElementId(i),d=t.getAllElementsInRow(m.row,m.backside);if(d&&t.getPlannerHasActiveBackside()){var g=t.getAllElementsInRow(m.row,!m.backside);g&&(d=d.concat(g))}for(r=0;r<d.length;r++)this.setOptionValue(d[r].ElementId,s,n[s],e)}}var E=t.getIndexInGridByElementId(i),I=t.getAllElementsInRow(E.row,E.backside);for(r=0;r<I.length;r++)if(I[r].getElementId()!=i)for(var O=0;O<this.constructionRules.forceSameOptionInRow.length;O++){var k=this.getOptionVal(I[r].getElementId(),this.constructionRules.forceSameOptionInRow[O],e);this.setOptionValue(i,this.constructionRules.forceSameOptionInRow[O],k,e);break}}}},{key:"handleVisibility_SHOW_HIDE",value:function handleVisibility_SHOW_HIDE(t,e,n,o){if(this.checkArticleHasOption(t,n.OPTCurrentElem)&&this.checkArticleHasOption(e,n.OPTNeighborElem)){var i=this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.get(t).indexOf(n.OPTCurrentElem)>=0;this.setOptionDoHide(e,n.OPTNeighborElem,o),i||this.setOptionDoShow(t,n.OPTCurrentElem,o)}}},{key:"handleBacksideVisibility_SHOW_HIDE",value:function handleBacksideVisibility_SHOW_HIDE(t,e,n,o){if(this.checkArticleHasOption(t,n.OPTCurrentElem)&&this.checkArticleHasOption(e,n.OPTNeighborElem)){var i=this.constructionRules.optionsVisibilityInfo[n.OPTCurrentElem],s=this.constructionRules.optionsVisibilityInfo[n.OPTNeighborElem];i&&s&&this.getOptionVal(t,n.OPTCurrentElem,o)==i.doShow&&this.getOptionVal(e,n.OPTNeighborElem,o)==s.doShow&&this.setOptionDoHide(t,n.OPTCurrentElem,o)}}},{key:"handleVisibiliy_HIDE_HIDE",value:function handleVisibiliy_HIDE_HIDE(t,e,n,o){var i=this.constructionRules.optionsVisibilityInfo[n.OPTCurrentElem];if(this.checkArticleHasOption(t,n.OPTCurrentElem)&&this.checkArticleHasOption(e,n.OPTNeighborElem)){var s=this.constructionRules.optionsVisibilityInfo[n.OPTNeighborElem],l=i.doShow==this.getOptionVal(t,n.OPTCurrentElem,o),r=this.getOptionVal(e,n.OPTNeighborElem,o)==s.doShow;l&&r&&(this.setOptionDoHide(t,n.OPTCurrentElem,o),this.setOptionDoHide(e,n.OPTNeighborElem,o))}}},{key:"correctSimpleOpt",value:function correctSimpleOpt(t,e,n,o,i){var s=n.getPlannerElementAtGridPos(t,e,i);if(this.constructionRules.defaultConstructionRules.TOP){var l=void 0;if(n.getElementHasTopElement(s.ElementId)){l=n.getPlannerElementAtGridPos(t,e+1,i);for(var r=0;r<this.constructionRules.defaultConstructionRules.TOP.length;r++){var a=this.constructionRules.defaultConstructionRules.TOP[r];"SHOW_HIDE"==a.OPTValueRule?this.handleVisibility_SHOW_HIDE(s.ElementId,l.ElementId,a,o):"HIDE_HIDE"==a.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(s.ElementId,l.ElementId,a,o)}}}if(this.constructionRules.defaultConstructionRules.RIGHT){var h=void 0;if(i?n.getElementHasLeftElement(s.ElementId):n.getElementHasRightElement(s.ElementId)){h=i?n.getPlannerElementAtGridPos(t-1,e,i):n.getPlannerElementAtGridPos(t+1,e,i);for(r=0;r<this.constructionRules.defaultConstructionRules.RIGHT.length;r++){var c=this.constructionRules.defaultConstructionRules.RIGHT[r];"SHOW_HIDE"==c.OPTValueRule?this.handleVisibility_SHOW_HIDE(s.ElementId,h.ElementId,c,o):"HIDE_HIDE"==c.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(s.ElementId,h.ElementId,c,o)}}}if(this.constructionRules.defaultConstructionRules.DOWN){var u=void 0;if(e>0){u=n.getPlannerElementAtGridPos(t,e-1,i);for(r=0;r<this.constructionRules.defaultConstructionRules.DOWN.length;r++){var m=this.constructionRules.defaultConstructionRules.DOWN[r];"SHOW_HIDE"==m.OPTValueRule?this.handleVisibility_SHOW_HIDE(s.ElementId,u.ElementId,m,o):"HIDE_HIDE"==m.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(s.ElementId,u.ElementId,m,o)}}}var d=i?n.getLeftElement(s.ElementId):n.getRightElement(s.ElementId),g=i?n.getRightElement(s.ElementId):n.getLeftElement(s.ElementId),E=n.getTopElement(s.ElementId),I=n.getBottomElement(s.ElementId),O=i?n.getTopLeftElement(s.ElementId):n.getTopRightElement(s.ElementId);d?this.setOptionValue(s.ElementId,"OPTNACHBAR_RECHTS",this.getOptionVal(d.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_RECHTS",o),g?this.setOptionValue(s.ElementId,"OPTNACHBAR_LINKS",this.getOptionVal(g.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_LINKS",o),E?this.setOptionValue(s.ElementId,"OPTNACHBAR_OBEN",this.getOptionVal(E.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_OBEN",o),O?this.setOptionValue(s.ElementId,"OPTNACHBAR_OBEN_RECHTS",this.getOptionVal(O.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_OBEN_RECHTS",o),this.constructionRules.hasNeighbors&&this.constructionRules.hasNeighbors.indexOf("OPTNACHBAR_UNTEN")>=0&&(I?this.setOptionValue(s.ElementId,"OPTNACHBAR_UNTEN",this.getOptionVal(I.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_UNTEN",o))}},{key:"correctBack",value:function correctBack(t,e,n){if(this.constructionRules.hasDMOD)if(t.getPlannerHasActiveBackside()){var o=void 0;if(o=t.getOppositeElement(n),this.constructionRules.defaultConstructionRules.BACK)for(var i=0;i<this.constructionRules.defaultConstructionRules.BACK.length;i++){var s,l,r=this.constructionRules.defaultConstructionRules.BACK[i],a=!1;if(r.hideOnElemAndOppositeOPT&&r.hideOnElemAndOppositeOPV)this.arrayContainsValue(r.hideOnElemAndOppositeOPV,this.getOptionVal(n,r.hideOnElemAndOppositeOPT,e))&&this.arrayContainsValue(r.hideOnElemAndOppositeOPV,this.getOptionVal(null===(s=o)||void 0===s?void 0:s.getElementId(),r.hideOnElemAndOppositeOPT,e))&&(a=!0);if(a)this.setOptionDoHide(n,r.OPTCurrentElem,e),this.setOptionDoHide(o.getElementId(),r.OPTCurrentElem,e);else if("FORCE_HIDE"==r.OPTValueRule&&this.setOptionDoHide(o.getElementId(),r.OPTCurrentElem,e),"SHOW_HIDE"==r.OPTValueRule)this.handleBacksideVisibility_SHOW_HIDE(null===(l=o)||void 0===l?void 0:l.getElementId(),n,r,e);else"HIDE_HIDE"==r.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(o.ElementId,n,r,e)}this.getElementHasBottomPlate(o,e)?this.setOptionDoShow(n,"OPTOPP_RAHMEN_U_V",e):this.setOptionDoHide(n,"OPTOPP_RAHMEN_U_V",e),this.getElementHasTopPlate(o,t,e)?this.setOptionDoShow(n,"OPTOPP_RAHMEN_O_V",e):this.setOptionDoHide(n,"OPTOPP_RAHMEN_O_V",e)}else this.setOptionDoHide(n,"OPTOPP_RAHMEN_U_V",e),this.setOptionDoHide(n,"OPTOPP_RAHMEN_O_V",e)}},{key:"correctBottom",value:function correctBottom(t,e,n){var o="";if(this.constructionRules.correctLeftRight&&null!=this.constructionRules.correctLeftRight.rowIndex)for(var i=t.getAllElementsInRow(this.constructionRules.correctLeftRight.rowIndex,n),s=0;s<i.length;s++){var l=i[s];if(0==s){if(null==(o=this.getOptionVal(l.ElementId,this.constructionRules.correctLeftRight.optWithOptVal,e)))return;n?this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optRight,o,e):(this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optLeft,o,e),this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optLeftBack,o,e))}n?this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optLeft,o,e):(this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optRight,o,e),this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optRightBack,o,e))}}},{key:"getValidLadder",value:function getValidLadder(t,e,n){for(var o=e.getAllElementsInColumn(t,!1),i=0;i<this.constructionRules.correctLadder.validLadder.length;i++){var s=this.constructionRules.correctLadder.validLadder[i];if(o.length==s.colCount){for(var l=!0,r=0;r<o.length;r++){var a=o[r];if(this.getOptionVal(a.ElementId,s.heightOption,n)!=s.heightPerRow[r]&&(l=!1),!l)break}if(l)return s}}}},{key:"correctLadder",value:function correctLadder(t,e){if(this.constructionRules.correctLadder){for(var n=t.getAllElementsInRow(this.constructionRules.correctLadder.rowIndex,!1),o=0;o<n.length;o++){var i=t.getRowCount(o);if(this.constructionRules.correctLadder.onElementHighestRowCount&&-1==this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(i))for(var s=t.getAllElementsInColumn(o,!1),l=0;l<s.length;l++)this.setOptionValue(s[l].ElementId,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,e);if(i<t.getSizeOfHighesRow(!1)){var r,a=null===(r=t.getPlannerElementAtGridPos(o,i-1,!1))||void 0===r?void 0:r.getElementId();a&&this.getOptionVal(a,this.constructionRules.correctLadder.optHeight,e)==this.constructionRules.correctLadder.opvProblematicHeight&&this.setOptionValue(a,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,e)}}for(o=0;o<n.length;o++){var h=n[o],c=this.getValidLadder(o,t,e);0==o&&this.setOptionValue(h.ElementId,this.constructionRules.correctLadder.optLadderLeft,c.optLadder,e);var u=c;if(t.getElementHasRightElement(h.getElementId())){var m=this.getValidLadder(o+1,t,e);m.colCount>c.colCount&&(u=m)}this.setOptionValue(h.getElementId(),this.constructionRules.correctLadder.optLadderRight,u.optLadder,e)}var d=t.getSizeOfHighesRow(!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(d)>=0){var g=t.getAllElementsInRow(d-1,!1);for(o=0;o<g.length;o++){var E=g[o];this.setOptionDoShow(E.getElementId(),this.constructionRules.correctLadder.optHasHeight,e)}}}}},{key:"correctSeries",value:function correctSeries(t,e){for(var n=!1,o=t.getAllElementIdsInGrid(),i=!1,s=!1,l=0;l<o.length;l++){var r=o[l];this.getElementIsCornerElement(t.getElementById(r),e)&&(i=!0),this.checkArticleHasOption(r,"OPTBR_ABDECKPLATTE")&&this.setOptionDoHide(r,"OPTBR_ABDECKPLATTE",e);var a=this.getOptionVal(r,"OPTABDECKPLATTE",e);this.checkArticleHasOption(r,"OPTABDECKPLATTE")&&"OPVMIT_PLATTE"==a&&(n=!0),"OPVBR_18"==this.getOptionVal(r,"OPTBR",e)&&(s=!0)}if(!t.getPlannerHasActiveBackside()&&t.getPlannerElementAtGridPos(0,0,!1)){for(var h=t.getSizeOfHighesRow(!1),c=[],u=[],m=[],d=0,g=0,E=t.getAllElementsInColumn(g,!1);null!=E;){if(E.length==h){var I=E[h-1];m.push(I),"OPVBR_75"==(a=this.getOptionVal(I.ElementId,"OPTBR",e))?d+=75:"OPVBR_18"==a?d+=18.75:"OPVBR_37"==a&&(d+=37.5),this.setOptionDoHide(I.ElementId,"OPTOBEN",e)}else m.length>0&&(c.push(m),u.push(d)),m=[],d=0;g++,E=t.getAllElementsInColumn(g,!1)}for(m.length>0&&(c.push(m),u.push(d)),l=0;l<c.length;l++){var O=c[l][0],k="";if(this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_40")>=0&&Math.abs(u[l]-40.4)<3?k="OPVABDECKPLATTE_40":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_77")>=0&&Math.abs(u[l]-77.8)<3?k="OPVABDECKPLATTE_77":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_115")>=0&&Math.abs(u[l]-115.3)<3?k="OPVABDECKPLATTE_115":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_152")>=0&&Math.abs(u[l]-152.8)<3?k="OPVABDECKPLATTE_152":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_190")>=0&&Math.abs(u[l]-190.3)<3?k="OPVABDECKPLATTE_190":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_227")>=0&&Math.abs(u[l]-227.8)<3&&(k="OPVABDECKPLATTE_227"),""==k||i)for(var f=t.getAllElementsInGrid(),R=0;R<f.length;R++)this.checkArticleHasOption(f[R].getElementId(),"OPTABD_HIDE")&&this.setOptionDoShow(f[R].getElementId(),"OPTABD_HIDE",e);else for(var p=t.getAllElementsInGrid(),P=0;P<p.length;P++)this.checkArticleHasOption(p[P].getElementId(),"OPTABD_HIDE")&&this.setOptionDoHide(p[P].getElementId(),"OPTABD_HIDE",e);if(""==k||!n||i||s)for(var T=0;T<c[l].length;T++)this.setOptionDoShow(c[l][T].ElementId,"OPTOBEN",e);else this.setOptionValue(O.ElementId,"OPTBR_ABDECKPLATTE",k,e)}}}},{key:"correctForceOptOfElement",value:function correctForceOptOfElement(t,e,n,o){var i=e.getIndexInGridByElementId(t);if(i)for(var s=this.getCurOptionBasedConstructionRules(t,n),l=0;l<s.length;l++){if(s[l].forceOptions)for(var r=0;r<s[l].forceOptions.length;r++){var a=s[l].forceOptions[r];if(!a.rule||""==a.rule||this.evalRule(t,a.rule,n))for(var h=a.options,c=a.value,u=0;u<h.length;u++){var m=h[u],d=this.constructionRules.optionsVisibilityInfo[m];if(d.complementDir){var g=d.complementDir;o&&("LEFT"==g?g="RIGHT":"RIGHT"==g&&(g="LEFT"));var E=e.getNeighborElement(i.col,i.row,g,i.backside);if(null!=E){for(var I=this.getCurOptionBasedConstructionRules(E.ElementId,n),O=d.complementOPT,k=!1,f=0;f<I.length;f++)if(I[f].forceOptions)for(var R=0;R<I[f].forceOptions.length;R++){var p=I[f].forceOptions[R];if((!p.rule||""==p.rule||this.evalRule(E.ElementId,p.rule,n))&&(this.arrayContainsValue(p.options,O)&&(k=!0,"doShow"==c&&"doShow"==p.value&&("OPVFUELLUNG"==this.getOptionVal(t,"OPTELEMENT",n)&&"OPVFUELLUNG"==this.getOptionVal(E.ElementId,"OPTELEMENT",n)?(this.setOptionDoHide(E.ElementId,O,n),this.setOptionDoHide(E.ElementId,O,n)):this.setOptionDoShow(E.ElementId,O,n)),"doHide"==c&&"doHide"==p.value&&(this.setOptionDoHide(t,m,n),this.setOptionDoHide(E.ElementId,O,n)),"doShow"==c&&"doHide"==p.value||"doHide"==c&&"doShow"==p.value))){var P=!0;a.prio&&p.prio?P=a.prio<=p.prio:a.prio?P=!0:p.prio&&(P=!1),P?"doHide"==c?(this.setOptionDoHide(t,m,n),this.setOptionDoHide(E.ElementId,O,n)):"doShow"==c&&(this.setOptionDoShow(t,m,n),this.setOptionDoHide(E.ElementId,O,n)):"doHide"==p.value?(this.setOptionDoHide(t,m,n),this.setOptionDoHide(E.ElementId,O,n)):"doShow"==p.value&&(this.setOptionDoHide(t,m,n),this.setOptionDoShow(E.ElementId,O,n))}}k||("doShow"==c&&(this.setOptionDoShow(t,m,n),this.setOptionDoHide(E.ElementId,O,n)),"doHide"==c&&(this.setOptionDoHide(t,m,n),this.setOptionDoHide(E.ElementId,O,n)))}else"doShow"==c&&this.setOptionDoShow(t,m,n),"doHide"==c&&this.setOptionDoHide(t,m,n)}}}if(s[l].changeOptions)for(var T=0;T<s[l].changeOptions.length;T++){for(var V=!0,_=s[l].changeOptions[T].rule.split("&"),B=0;B<_.length;B++)if(_[B].indexOf("!=")>0){var v=_[B].split("!=")[0],G=_[B].split("!=")[1];this.getOptionVal(t,v,n)==G&&(V=!1)}else{v=_[B].split("=")[0],G=_[B].split("=")[1];this.getOptionVal(t,v,n)!=G&&(V=!1)}V&&(s[l].changeOptions[T].doShow&&this.setOptionDoShow(t,s[l].changeOptions[T].doShow,n),s[l].changeOptions[T].doHide&&this.setOptionDoHide(t,s[l].changeOptions[T].doHide,n),s[l].changeOptions[T].opt&&s[l].changeOptions[T].opv&&this.setOptionValue(t,s[l].changeOptions[T].opt,s[l].changeOptions[T].opv,n))}}}},{key:"correctNeighborCustomOLTs",value:function correctNeighborCustomOLTs(t,e,n){if(this.constructionRules.correctNeighborOPT&&0!=this.constructionRules.correctNeighborOPT.length)for(var o=0;o<this.constructionRules.correctNeighborOPT.length;o++){var i=e.getIndexInGridByElementId(t);if(this.setOptionValue(t,this.constructionRules.correctNeighborOPT[o].opt,"OPVOHNE",n),!i)return;var s=e.getNeighborElement(i.col,i.row,this.constructionRules.correctNeighborOPT[o].dir,i.backside);if(null!=s){var l=this.getOptionVal(s.ElementId,this.constructionRules.correctNeighborOPT[o].neighborOPT,n);""!=l&&this.setOptionValue(t,this.constructionRules.correctNeighborOPT[o].opt,l,n)}}}},{key:"doChangeRetailArticleNumbers",value:function doChangeRetailArticleNumbers(t,e){var n=t.getAllElementsInGrid();if(this.constructionRules.correctRetailArticleNumberByRule&&this.constructionRules.correctRetailArticleNumberByRule.length>0)for(var o=!0,i=0;i<this.constructionRules.correctRetailArticleNumberByRule.length;i++){var s=this.constructionRules.correctRetailArticleNumberByRule[i];if("global"==s.range){for(var l=0;l<n.length&&o;l++){this.evalRule(n[l].getElementId(),s.rule,e)||(o=!1)}if(o)return{doChange:!0,retailArticleRules:s.retailArticleRules}}}return{doChange:!1}}},{key:"setConstructionRules",value:function setConstructionRules(t){t&&t.constructionRules&&(this.constructionRules=t.constructionRules,this.partlistHelper.setConstructionRules(t.constructionRules),this.constructionRulesLoaded=!0)}},{key:"getConstructionRulesLoaded",value:function getConstructionRulesLoaded(){return this.constructionRulesLoaded}},{key:"updateOptionLogicBoxPlanner",value:(t=(0,o.Z)(a().mark((function _callee(t,e,n,o){var i,s,l,r,c,u,m;return a().wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(null!=this.constructionRules&&this.constructionRulesLoaded){a.next=3;break}return d.error(new h.GE("Error construction rules are not set for boxPlanner",{code:"WC_0012"})),a.abrupt("return");case 3:if(i=(new Date).getTime(),s=void 0,d.debug("BoxPlanner - updateOptionLogicInGrid start updateOptionLogicInGrid"),l=new Map,o)for(r=t.getAllElementIdsInGrid(),e=void 0,n=void 0,c=0;c<r.length;c++)this.getElementIsCornerElement(t.getElementById(r[c]),l)&&this.setOptionValue(r[c],"OPTELEMENT","OPVOFFENES_FACH",l);for(s=this.setAllOptToDefault(t,l,e,n),this.doCorrectAffectedElementsByOption(t,l,e,n),this.correctBottom(t,l,!1),t.getPlannerHasActiveBackside()&&this.correctBottom(t,l,!0),this.correctSeries(t,l),c=0;c<t.getColumnCount();c++)for(u=0;u<t.getRowCount(c);u++)this.correctSimpleOpt(c,u,t,l,!1);if(t.getPlannerHasActiveBackside())for(c=t.getColumnCount()-1;c>=0;c--)for(u=0;u<t.getRowCount(c);u++)this.correctSimpleOpt(c,u,t,l,!0);for(c=0;c<t.getColumnCount();c++)for(u=0;u<t.getRowCount(c);u++)this.correctForceOptOfElement(t.getPlannerElementAtGridPos(c,u,!1).ElementId,t,l,!1),this.correctNeighborCustomOLTs(t.getPlannerElementAtGridPos(c,u,!1).ElementId,t,l);if(t.getPlannerHasActiveBackside())for(c=t.getColumnCount()-1;c>=0;c--)for(u=0;u<t.getRowCount(c);u++)this.correctForceOptOfElement(t.getPlannerElementAtGridPos(c,u,!0).ElementId,t,l,!0),this.correctNeighborCustomOLTs(t.getPlannerElementAtGridPos(c,u,!0).ElementId,t,l);for(this.correctLadder(t,l),this.partlistHelper.calculateKnots(t,l),this.partlistHelper.calculateRahmen(t,l),c=0;c<t.getColumnCount();c++)for(u=0;u<t.getRowCount(c);u++)this.correctBack(t,l,t.getPlannerElementAtGridPos(c,u,!1).getElementId());return m=this.doChangeRetailArticleNumbers(t,l),a.next=25,this.updateCfgValuesByPlanner(l,void 0,this.constructionRules.partlistRules.bundleRules,m);case 25:return d.debug("BoxPlanner updateOptionLogic - Duration after setting Option Values of all Articles: "+((new Date).getTime()-i)),d.debug("BoxPlanner updateOptionLogic - Duration after setting updating configurator: "+((new Date).getTime()-i)),a.abrupt("return",s);case 28:case"end":return a.stop()}}),_callee,this)}))),function updateOptionLogicBoxPlanner(e,n,o,i){return t.apply(this,arguments)})},{key:"onElemDeleted",value:function onElemDeleted(t){this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.delete(t)}},{key:"onElementCopy",value:function onElementCopy(t,e){if(this.hideOptionsForConstruction.has(t)){var n=this.hideOptionsForConstruction.get(t);this.hideOptionsForConstruction.set(e,(0,c.Z)(n))}}},{key:"getHasMaxElemCountPerColumn",value:function getHasMaxElemCountPerColumn(){return null!=this.constructionRules.maxElemCountPerCol}},{key:"getMaxElemCountPerColumn",value:function getMaxElemCountPerColumn(){return this.constructionRules.maxElemCountPerCol}},{key:"getForceWholePlanningSameHeight",value:function getForceWholePlanningSameHeight(){return this.constructionRules.forceWholePlanningSameHeight}}]);var t}(),E=n(64357),I=n(25036),O=h.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),k=function(){return(0,s.Z)((function BoxPlannerGrid(t){(0,i.Z)(this,BoxPlannerGrid),(0,l.Z)(this,"plannedElementGrid",void 0),(0,l.Z)(this,"backModulPlannedElementGrid",void 0),(0,l.Z)(this,"hasActiveBackside",void 0),(0,l.Z)(this,"getValueOfOptionOfArticle",void 0),this.plannedElementGrid=new Array(new Array),this.backModulPlannedElementGrid=new Array(new Array),this.hasActiveBackside=!1,this.getValueOfOptionOfArticle=t}),[{key:"getGridColumnWidth",value:function getGridColumnWidth(t,e){for(var n=-1,o=e?this.backModulPlannedElementGrid:this.plannedElementGrid,i=0;i<o[t].length;i++){var s=o[t][i]?null==o[t][i].Width?0:o[t][i].Width:0;s>n&&(n=s)}return n}},{key:"getGridColumnHeight",value:function getGridColumnHeight(t){var e=0;if(this.plannedElementGrid.length>t)for(var n=this.plannedElementGrid[t],o=0;o<n.length;o++){var i;e+=null===(i=n[o])||void 0===i?void 0:i.Height}return e}},{key:"deleteGridPos",value:function deleteGridPos(t){var e=new Array,n=t.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(1==n[t.col].length)for(var o=0;o<n.length;o++)o!=t.col&&(o<t.col?e[o]=n[o]:e[o-1]=n[o]);else for(o=0;o<n.length;o++)if(o!=t.col)e[o]=n[o];else{e[o]=new Array;for(var i=0;i<n[o].length;i++)i!=t.row&&(e[o][i]=n[o][i])}t.backside?this.backModulPlannedElementGrid=e:this.plannedElementGrid=e}},{key:"getPlannerElementAtGridPos",value:function getPlannerElementAtGridPos(t,e,n){var o=n?this.backModulPlannedElementGrid:this.plannedElementGrid;if(o[t]&&o[t][e])return o[t][e]}},{key:"getIndexInGridByElementId",value:function getIndexInGridByElementId(t){for(var e=0;e<this.plannedElementGrid.length;e++)for(var n=0;n<this.plannedElementGrid[e].length;n++)if(this.plannedElementGrid[e][n]&&this.plannedElementGrid[e][n].ElementId==t)return{col:e,row:n,backside:!1};for(e=0;e<this.backModulPlannedElementGrid.length;e++)for(n=0;n<this.backModulPlannedElementGrid[e].length;n++)if(this.backModulPlannedElementGrid[e][n]&&this.backModulPlannedElementGrid[e][n].ElementId==t)return{col:e,row:n,backside:!0};return{col:-1,row:-1,backside:!1}}},{key:"getAllElementIdsInGrid",value:function getAllElementIdsInGrid(){for(var t=[],e=0;e<this.plannedElementGrid.length;e++)for(var n=0;n<this.plannedElementGrid[e].length;n++)this.plannedElementGrid[e][n]&&t.push(this.plannedElementGrid[e][n].ElementId);for(e=0;e<this.backModulPlannedElementGrid.length;e++)for(n=0;n<this.backModulPlannedElementGrid[e].length;n++)this.backModulPlannedElementGrid[e][n]&&t.push(this.backModulPlannedElementGrid[e][n].ElementId);return t}},{key:"getAllElementsInFrontGrid",value:function getAllElementsInFrontGrid(){for(var t=[],e=0;e<this.plannedElementGrid.length;e++)for(var n=0;n<this.plannedElementGrid[e].length;n++)t.push(this.plannedElementGrid[e][n]);return t}},{key:"getAllElementsInBackGrid",value:function getAllElementsInBackGrid(){for(var t=[],e=0;e<this.backModulPlannedElementGrid.length;e++)for(var n=0;n<this.backModulPlannedElementGrid[e].length;n++)t.push(this.backModulPlannedElementGrid[e][n]);return t}},{key:"getAllElementsInGrid",value:function getAllElementsInGrid(){for(var t=[],e=0;e<this.plannedElementGrid.length;e++)for(var n=0;n<this.plannedElementGrid[e].length;n++)t.push(this.plannedElementGrid[e][n]);for(e=0;e<this.backModulPlannedElementGrid.length;e++)for(n=0;n<this.backModulPlannedElementGrid[e].length;n++)this.backModulPlannedElementGrid[e][n]&&t.push(this.backModulPlannedElementGrid[e][n]);return t}},{key:"getElementById",value:function getElementById(t){var e=this.getIndexInGridByElementId(t);return(e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid)[e.col][e.row]}},{key:"getElementIsFirstInGrid",value:function getElementIsFirstInGrid(t){var e=this.getIndexInGridByElementId(t);return 0==e.col&&0==e.row&&!e.backside}},{key:"getElementIsInLastCol",value:function getElementIsInLastCol(t,e){var n=e?this.backModulPlannedElementGrid:this.plannedElementGrid;return this.getIndexInGridByElementId(t).col+1==n.length}},{key:"getElementHasTopElement",value:function getElementHasTopElement(t){var e=this.getIndexInGridByElementId(t);return(e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid)[e.col].length>e.row+1}},{key:"getTopElement",value:function getTopElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(n[e.col].length>e.row+1)return n[e.col][e.row+1]}},{key:"getTopRightElement",value:function getTopRightElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(n.length>e.col+1&&null!=n[e.col+1][e.row+1])return n[e.col+1][e.row+1]}},{key:"getTopLeftElement",value:function getTopLeftElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(e.col>0&&null!=n[e.col-1][e.row-1])return n[e.col-1][e.row-1]}},{key:"getElementHasBottomElement",value:function getElementHasBottomElement(t){return this.getIndexInGridByElementId(t).row-1>=0}},{key:"getBottomElement",value:function getBottomElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(e.row-1>=0)return n[e.col][e.row-1]}},{key:"getElementHasRightElement",value:function getElementHasRightElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;return n.length>e.col+1&&null!=n[e.col+1][e.row]}},{key:"getRightElement",value:function getRightElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(n.length>e.col+1&&null!=n[e.col+1][e.row])return n[e.col+1][e.row]}},{key:"getElementHasLeftElement",value:function getElementHasLeftElement(t){var e=this.getIndexInGridByElementId(t);return e.col>0&&null!=this.getPlannerElementAtGridPos(e.col-1,e.row,e.backside)}},{key:"getLeftElement",value:function getLeftElement(t){var e=this.getIndexInGridByElementId(t);if(e.col>0&&null!=this.getPlannerElementAtGridPos(e.col-1,e.row,e.backside))return this.getPlannerElementAtGridPos(e.col-1,e.row,e.backside)}},{key:"getAllElementsInColumn",value:function getAllElementsInColumn(t,e){var n=e?this.backModulPlannedElementGrid:this.plannedElementGrid,o=new Array;if(!(t>=n.length)){for(var i=0;i<n[t].length;i++)n[t][i]&&o.push(n[t][i]);return n.length>t?o:void 0}}},{key:"getColumnCount",value:function getColumnCount(){return this.plannedElementGrid.length}},{key:"getRowCount",value:function getRowCount(t){return this.plannedElementGrid[t].length}},{key:"getAllElementsInRow",value:function getAllElementsInRow(t,e){for(var n=e?this.backModulPlannedElementGrid:this.plannedElementGrid,o=[],i=0;i<n.length;i++)n[i].length>t&&o.push(n[i][t]);return o}},{key:"getSizeOfHighesRow",value:function getSizeOfHighesRow(t){for(var e=t?this.backModulPlannedElementGrid:this.plannedElementGrid,n=0,o=0;o<e.length;o++)n<e[o].length&&(n=e[o].length);return n}},{key:"getNeighborElement",value:function getNeighborElement(t,e,n,o){var i=t,s=e;switch(n){case"TOP":s++;break;case"DOWN":s--;break;case"LEFT":i--;break;case"RIGHT":i++;break;case"BACK":this.hasActiveBackside&&(o=!o)}return this.getPlannerElementAtGridPos(i,s,o)}},{key:"getOppositeElement",value:function getOppositeElement(t){if(this.hasActiveBackside){var e=this.getIndexInGridByElementId(t);return e.backside?this.plannedElementGrid[e.col][e.row]:this.backModulPlannedElementGrid[e.col][e.row]}}},{key:"getAllOppositeElements",value:function getAllOppositeElements(t){var e=[];if(this.hasActiveBackside)for(var n=0;n<t.length;n++){var o=this.getIndexInGridByElementId(t[n]);o.backside?e.push(this.plannedElementGrid[o.col][o.row].getElementId()):this.backModulPlannedElementGrid[o.col][o.row]&&e.push(this.backModulPlannedElementGrid[o.col][o.row].getElementId())}return e}},{key:"getSizeOfWholeSet",value:function getSizeOfWholeSet(){for(var t=0,e=0,n=0,o=0;o<this.plannedElementGrid.length;o++){for(var i=0,s=0;s<this.plannedElementGrid[o].length;s++){var l=this.plannedElementGrid[o][s];i+=l.getHeight(),0==o&&0==s&&(e=l.getDepth())}i>n&&(n=i);var r=this.getGridColumnWidth(o,!1);o>0&&(77.9==r?r=75:40.4==r?r=37.5:21.7==r&&(r=18.75)),t+=r}return this.hasActiveBackside&&(e*=2),new E.P(t,n,e)}},{key:"getAllElementsInSameRowByElementId",value:function getAllElementsInSameRowByElementId(t){var e=this.getIndexInGridByElementId(t),n=this.getAllElementsInRow(e.row,!1);return this.hasActiveBackside&&(n=n.concat(this.getAllElementsInRow(e.row,!0))),{elementIds:n.map((function(t){return t.ElementId})),plannerElements:n,backside:e.backside}}},{key:"getAllElementsDown",value:function getAllElementsDown(t){var e=this.getIndexInGridByElementId(t);if(0==e.row)return{elements:[],backside:!1};for(var n=[],o=0;o<e.row;o++){var i=this.getPlannerElementAtGridPos(e.col,o,e.backside);null!=i&&n.push(i.ElementId)}return{elements:n,backside:e.backside}}},{key:"getAllElementsInSameCol",value:function getAllElementsInSameCol(t){var e=this.getIndexInGridByElementId(t),n=this.getAllElementsInColumn(e.col,e.backside);return null==n&&(n=[]),{elements:n.map((function(t){return t.ElementId})),backside:e.backside}}},{key:"prepareGridForCopy",value:function prepareGridForCopy(t,e){var n=this.getIndexInGridByElementId(t),o=0;switch(e){case"AVL":o=n.col;break;case"AVR":o=n.col+1}for(var i=new Array,s=0;s<this.plannedElementGrid.length+1;s++)i[s]=new Array;for(s=0;s<this.plannedElementGrid.length;s++)for(var l=0;l<this.plannedElementGrid[s].length;l++)s<o?i[s][l]=this.plannedElementGrid[s][l]:i[s+1][l]=this.plannedElementGrid[s][l];if(this.plannedElementGrid=i,this.hasActiveBackside){i=new Array;for(s=0;s<this.backModulPlannedElementGrid.length+1;s++)i[s]=new Array;for(s=0;s<this.backModulPlannedElementGrid.length;s++)for(l=0;l<this.backModulPlannedElementGrid[s].length;l++)s<o?i[s][l]=this.backModulPlannedElementGrid[s][l]:i[s+1][l]=this.backModulPlannedElementGrid[s][l];this.backModulPlannedElementGrid=i}}},{key:"prepareGridForBackSideCopy",value:function prepareGridForBackSideCopy(){this.backModulPlannedElementGrid=new Array;for(var t=0;t<this.plannedElementGrid.length;t++)this.backModulPlannedElementGrid.push(new Array);this.hasActiveBackside=!0}},{key:"addElementAtGridPos",value:function addElementAtGridPos(t,e,n,o){var i=o?this.backModulPlannedElementGrid:this.plannedElementGrid;i&&0!=i.length||(i=new Array),i[e]&&0!=i[e].length||(i[e]=new Array),i[e][n]=t,o?(this.hasActiveBackside=!0,this.backModulPlannedElementGrid=i):this.plannedElementGrid=i}},{key:"addElementAsCopy",value:function addElementAsCopy(t,e,n){var o=this.getIndexInGridByElementId(t),i=o.backside?this.backModulPlannedElementGrid:this.plannedElementGrid,s=!0;switch(n){case"AVR":i[o.col+1][o.row]=e;break;case"AVL":i[o.col-1][o.row]=e;break;case"AVO":i[o.col][o.row+1]=e;break;case"BACKSIDE":this.backModulPlannedElementGrid[o.col][o.row]=e,s=!1}s&&(o.backside?this.backModulPlannedElementGrid=i:this.plannedElementGrid=i)}},{key:"deleteElement",value:function deleteElement(t,e){var n=this.getIndexInGridByElementId(t),o=[];!this.hasActiveBackside||e&&"BoxPlanner_backside"==e||o.push(this.backModulPlannedElementGrid[n.col][n.row]),o.push(this.plannedElementGrid[n.col][n.row]);for(var i=[],s=0;s<o.length;s++)I.Z.removeDockingPointRelations(o[s]),e&&"BoxPlanner_backside"==e?e&&"BoxPlanner_backside"==e&&(this.backModulPlannedElementGrid[n.col][n.row]=void 0):this.deleteGridPos(this.getIndexInGridByElementId(o[s].ElementId)),i.push(o[s].getElementId());return i}},{key:"updateWorldPosOfElements",value:function updateWorldPosOfElements(){for(var t=0;t<this.plannedElementGrid.length;t++)for(var e=0;e<this.plannedElementGrid[t].length;e++){var n=this.plannedElementGrid[t][e];I.Z.removeDockingPointRelations(n)}if(this.hasActiveBackside)for(t=0;t<this.backModulPlannedElementGrid.length;t++)for(e=0;e<this.backModulPlannedElementGrid[t].length;e++){var o=this.backModulPlannedElementGrid[t][e];o&&I.Z.removeDockingPointRelations(o)}var i=1;for(t=0;t<this.plannedElementGrid.length;t++){for(e=0;e<this.plannedElementGrid[t].length;e++){var s=this.plannedElementGrid[t][e];this.plannedElementGrid[t]&&this.plannedElementGrid[t][e+1]&&I.Z.tryDockElement(s,"AVO",[this.plannedElementGrid[t][e+1]]),s.PosNr=i,i++}this.plannedElementGrid[t+1]&&this.plannedElementGrid[t+1][0]&&I.Z.tryDockElement(this.plannedElementGrid[t][0],"AVR",[this.plannedElementGrid[t+1][0]])}if(this.hasActiveBackside)for(t=0;t<this.backModulPlannedElementGrid.length;t++){for(e=0;e<this.backModulPlannedElementGrid[t].length;e++){var l=this.backModulPlannedElementGrid[t][e],r=this.plannedElementGrid[t][e].getDockingPointById("AVO_AVO_2_IL");r?l&&I.Z.tryDockElementToDP(l,this.plannedElementGrid[t][e],r):O.error(new h.GE("Error Loading DockingPoint AVO_2 for plannerElement")),this.backModulPlannedElementGrid[t]&&this.backModulPlannedElementGrid[t][e+1]&&l&&this.backModulPlannedElementGrid[t][e+1]&&I.Z.tryDockElement(l,"AVO",[this.backModulPlannedElementGrid[t][e+1]]),l&&(l.PosNr=i),i++}this.backModulPlannedElementGrid[t+1]&&this.backModulPlannedElementGrid[t+1][0]&&this.backModulPlannedElementGrid[t][0]&&I.Z.tryDockElement(this.backModulPlannedElementGrid[t][0],"AVL",[this.backModulPlannedElementGrid[t+1][0]])}}},{key:"destroyBoxPlannerGrid",value:function destroyBoxPlannerGrid(){for(var t=0;t<this.plannedElementGrid.length;t++){for(var e=0;e<this.plannedElementGrid[t].length;e++){this.plannedElementGrid[t][e].destroy()}this.plannedElementGrid[t]=[]}if(this.plannedElementGrid=[],this.hasActiveBackside){this.hasActiveBackside=!1;for(t=0;t<this.backModulPlannedElementGrid.length;t++){for(e=0;e<this.backModulPlannedElementGrid[t].length;e++){var n=this.backModulPlannedElementGrid[t][e];n&&n.destroy()}this.backModulPlannedElementGrid[t]=[]}this.backModulPlannedElementGrid=[]}}},{key:"getAllElementsInBacksideModuleGrid",value:function getAllElementsInBacksideModuleGrid(){for(var t=[],e=0;e<this.backModulPlannedElementGrid.length;e++)for(var n=0;n<this.backModulPlannedElementGrid[e].length;n++)this.backModulPlannedElementGrid[e][n]&&t.push(this.backModulPlannedElementGrid[e][n].ElementId);return t}},{key:"destroyBacksideModuleGrid",value:function destroyBacksideModuleGrid(){this.hasActiveBackside=!1;for(var t=[],e=0;e<this.backModulPlannedElementGrid.length;e++){for(var n=0;n<this.backModulPlannedElementGrid[e].length;n++){var o=this.backModulPlannedElementGrid[e][n];o&&(t.push(o.ElementId),o.destroy())}this.backModulPlannedElementGrid[e]=[]}this.backModulPlannedElementGrid=[]}},{key:"getPlannerHasActiveBackside",value:function getPlannerHasActiveBackside(){return this.hasActiveBackside}},{key:"getBoundingBox",value:function getBoundingBox(){var t,e=0,n=0,o=0,i=0,s=0,l=this.plannedElementGrid[0][0].getDepth(),r=0;t="RIGHT";for(var a=0;a<this.plannedElementGrid.length;a++){var h=this.plannedElementGrid[a][0],c=this.getValueOfOptionOfArticle(h.getElementId(),"OPTELEMENT");"RIGHT"==t?i+=this.plannedElementGrid[a][0].getWidth():"FRONT"==t?l+=this.plannedElementGrid[a][0].getWidth():"LEFT"==t?i-=this.plannedElementGrid[a][0].getWidth():"BACK"==t&&(l-=this.plannedElementGrid[a][0].getWidth()),"OPVECK_I"==c?"RIGHT"==t?t="FRONT":"FRONT"==t?t="LEFT":"LEFT"==t?t="BACK":"BACK"==t&&(t="RIGHT"):"OPVECK_A"==c&&("RIGHT"==t?t="BACK":"FRONT"==t?t="RIGHT":"LEFT"==t?t="FRONT":"BACK"==t&&(t="LEFT")),i<n&&(n=i),i>o&&(o=i),l<s&&(s=l),l>r&&(r=l);var u=this.getGridColumnHeight(a);e=e<u?u:e}var m=r-s,d=o-n;return this.hasActiveBackside&&(m=2*this.plannedElementGrid[0][0].getDepth()),{width:Math.round(1e3*d)/1e3,height:Math.round(1e3*e)/1e3,depth:Math.round(1e3*m)/1e3}}}])}(),f=n(86829),R=n(57312),p=n(58178),P=h.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),T=function(){function DivaBoxPlanner(t,e){(0,i.Z)(this,DivaBoxPlanner),(0,l.Z)(this,"set",void 0),(0,l.Z)(this,"plannerID",void 0),(0,l.Z)(this,"constructionRulesHandler",void 0),(0,l.Z)(this,"boxPlannerGrid",void 0),(0,l.Z)(this,"nextElementId",1),this.set=t,this.plannerID=e,this.constructionRulesHandler=new g(this.set.getValueOfOptionOfArticle,this.set.checkArticleHasOption,this.set.updateCfgValuesByPlanner),this.boxPlannerGrid=new k(this.set.getValueOfOptionOfArticle)}return(0,s.Z)(DivaBoxPlanner,[{key:"initPlanner",value:(u=(0,o.Z)(a().mark((function _callee(t){var e,n,o,i,s,l,r,c,u,m;return a().wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(null==(e=JSON.parse(h.ZP.decodeBase64(t))).v||2!=e.v){a.next=26;break}if(e.set&&e.set.elements&&0!=e.set.elements.length){a.next=4;break}return a.abrupt("return");case 4:n=e.set.elements,o=0;case 6:if(!(o<n.length)){a.next=21;break}return i=n[o],s=parseInt(i.elementID),l=new R.Z(this.set.getSetId(),i.basketID,s,DivaBoxPlanner.plannerType),this.nextElementId<s+1&&(this.nextElementId=s+1),this.set.setElementId(i.basketID,l.ElementId),this.constructionRulesHandler.getConstructionRulesLoaded()||this.constructionRulesHandler.setConstructionRules(this.set.getConstructionRuleOfElementId(l.ElementId)),(r=this.set.getPlannerData(l.ElementId))&&l.updatePlannerData(r),a.next=17,f.Z.loadSVG(l,this.set);case 17:this.boxPlannerGrid.addElementAtGridPos(l,i.boxPlannerInfo.gridPosCol,i.boxPlannerInfo.gridPosRow,i.boxPlannerInfo.isOnBackside);case 18:o++,a.next=6;break;case 21:return this.boxPlannerGrid.updateWorldPosOfElements(),a.next=24,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 24:a.next=42;break;case 26:c=1,o=0;case 28:if(!(o<e.Elements.length)){a.next=38;break}return u=e.Elements[o],(s=parseInt(u.ID))>c&&(c=s),m={boxElementID:u.ID,boxCol:u.col,boxRow:u.row,boxUpdateWholePlanning:!1},a.next=35,this.addPlannerElement(u.BasketID,m);case 35:o++,a.next=28;break;case 38:return this.nextElementId=c+1,this.boxPlannerGrid.updateWorldPosOfElements(),a.next=42,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 42:return a.abrupt("return",e);case 43:case"end":return a.stop()}}),_callee,this)}))),function initPlanner(t){return u.apply(this,arguments)})},{key:"saveSetPlanner",value:function saveSetPlanner(){for(var t=[],e=this.boxPlannerGrid.getAllElementIdsInGrid(),n=0;n<e.length;n++){var o=this.boxPlannerGrid.getElementById(e[n]);if(o){for(var i=this.boxPlannerGrid.getIndexInGridByElementId(e[n]),s=o.getDockingDockingPoints(),l=[],r=0;r<s.length;r++){var a,h={id:s[r].DpId,onID:s[r].OnElementId,onDPID:null===(a=s[r].OnDP)||void 0===a?void 0:a.DpId};l.push(h)}var c={elementID:o.getElementId(),basketID:this.set.getBasketId(o.getElementId()),CatalogCodex:this.set.getCatalogCodex(),Codex:this.set.getArticleCodex(o.getElementId()),posNr:o.PosNr,x:o.WorldPosCenter.x,y:o.WorldPosCenter.y,z:o.WorldPosCenter.z,rot:o.RotDeg,width:o.Width?o.Width:-1,height:o.Height?o.Height:-1,depth:o.Depth?o.Depth:-1,DP:l,boxPlannerInfo:{gridPosCol:i.col,gridPosRow:i.row,isOnBackside:i.backside}};t.push(c)}}var u=this.boxPlannerGrid.getBoundingBox();return{setId:this.set.getSetId(),x:0,y:0,z:0,width:u.width,height:u.height,depth:u.depth,rot:0,elements:t}}},{key:"addPlannerElement",value:(c=(0,o.Z)(a().mark((function _callee2(t,e){var n,o;return a().wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:if(null!=e&&null!=e.boxElementID&&null!=e.boxCol&&null!=e.boxRow){i.next=2;break}return i.abrupt("return");case 2:return n=new R.Z(this.set.getSetId(),t,e.boxElementID,DivaBoxPlanner.plannerType),this.nextElementId=isNaN(e.boxElementID)?this.nextElementId:e.boxElementID+1,this.set.setElementId(t,n.ElementId),o=this.set.getPlannerData(n.ElementId),n.updatePlannerData(o),i.next=9,f.Z.loadSVG(n,this.set);case 9:if(this.constructionRulesHandler.getConstructionRulesLoaded()||this.constructionRulesHandler.setConstructionRules(this.set.getConstructionRuleOfElementId(n.ElementId)),this.boxPlannerGrid.addElementAtGridPos(n,e.boxCol,e.boxRow,null!=e.backside&&e.backside),!e.boxUpdateWholePlanning){i.next=15;break}return this.boxPlannerGrid.updateWorldPosOfElements(),i.next=15,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 15:case"end":return i.stop()}}),_callee2,this)}))),function addPlannerElement(t,e){return c.apply(this,arguments)})},{key:"extendPlanner",value:(r=(0,o.Z)(a().mark((function _callee3(t,e){return a().wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return");case 1:case"end":return t.stop()}}),_callee3)}))),function extendPlanner(t,e){return r.apply(this,arguments)})},{key:"copyPlannerElement",value:(n=(0,o.Z)(a().mark((function _callee4(t,e){var n,o,i,s,l,r,h=this;return a().wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:if(n=!1,e){a.next=3;break}return a.abrupt("return");case 3:"STD"==e.copyType&&(e.targetElements=[]),o=[],i=this,s="AVR","BoxPlanner_backside"==e.copyType?s="BACKSIDE":"STD"!=e.copyType&&"BoxPlanner_COL"!=e.copyType||("AVR"==e.dpType?s="AVR":"AVO"==e.dpType?s="AVO":"AVL"==e.dpType&&(s="AVL")),t.forEach((function(t,i){var l;n||(!e||"AVL"!=e.dpType&&"AVR"!=e.dpType?e&&e.copyType&&"BoxPlanner_backside"==e.copyType&&(h.boxPlannerGrid.getPlannerHasActiveBackside()||h.boxPlannerGrid.prepareGridForBackSideCopy()):h.boxPlannerGrid.prepareGridForCopy(i,e.dpType)),n=!0;var r=new R.Z(h.set.getSetId(),t,h.nextElementId,DivaBoxPlanner.plannerType);h.nextElementId++,h.set.setElementId(t,r.ElementId);var a=h.set.getPlannerData(r.ElementId);r.updatePlannerData(a),h.boxPlannerGrid.addElementAsCopy(i,r,s),h.constructionRulesHandler.onElementCopy(i,r.getElementId()),o.push(r),"STD"==e.copyType&&(null===(l=e.targetElements)||void 0===l||l.push(r.getElementId()))})),l=0;case 10:if(!(l<o.length)){a.next=17;break}return a.next=13,f.Z.loadSVG(o[l],this.set);case 13:if("AVO"==s&&this.constructionRulesHandler.getHasMaxElemCountPerColumn()&&i.boxPlannerGrid.getIndexInGridByElementId(o[l].ElementId).row+1==i.constructionRulesHandler.getMaxElemCountPerColumn())for(r=o[l].getFreeDockingPointsByType("AVO"),l=0;l<r.length;l++)r[l].disableDP(!0);case 14:l++,a.next=10;break;case 17:return this.boxPlannerGrid.updateWorldPosOfElements(),a.next=20,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,e.changedOPT,e.targetElements);case 20:case"end":return a.stop()}}),_callee4,this)}))),function copyPlannerElement(t,e){return n.apply(this,arguments)})},{key:"initIDM3DMeta",value:function initIDM3DMeta(t){P.debug("No IDM3D Planner for BoxPlanner")}},{key:"getPlannerElementsInfluencedByDeletion",value:function getPlannerElementsInfluencedByDeletion(t){return this.constructionRulesHandler.getForceWholePlanningSameHeight()?0==this.boxPlannerGrid.getIndexInGridByElementId(t).row?[]:this.boxPlannerGrid.getAllElementsInSameRowByElementId(t).elementIds.filter((function(e){return e!=t})):[]}},{key:"getPlannerElementsInfluencedByCopy",value:function getPlannerElementsInfluencedByCopy(t,e){var n=[];if(e&&"NO"==(null==e?void 0:e.dpType)&&"BoxPlanner_backside"==e.copyType)return this.boxPlannerGrid.getAllElementIdsInGrid();if(e&&"BoxPlanner_COL"==e.copyType){for(var o=this.boxPlannerGrid.getIndexInGridByElementId(t),i=this.boxPlannerGrid.getAllElementsInColumn(o.col,o.backside),s=0;s<i.length;s++)n.push(i[s].getElementId());return n}if(n.push(t),e){switch(e.dpType){case"AVL":case"AVR":if(this.constructionRulesHandler.getForceWholePlanningSameHeight()){var l=this.boxPlannerGrid.getAllElementsInSameCol(t);n=l.elements,l.backside}else{var r=this.boxPlannerGrid.getAllElementsDown(t);n=n.concat(r.elements),r.backside}break;case"AVO":if(this.constructionRulesHandler.getForceWholePlanningSameHeight()){var a=this.boxPlannerGrid.getAllElementsInSameRowByElementId(t);n=a.elementIds,a.backside}}this.boxPlannerGrid.getPlannerHasActiveBackside()&&(n=n.concat(this.boxPlannerGrid.getAllOppositeElements(n)))}return n}},{key:"deletePlannerElement",value:(e=(0,o.Z)(a().mark((function _callee5(t,e,n){var o,i,s,l,r,h,c,u;return a().wrap((function _callee5$(e){for(;;)switch(e.prev=e.next){case 0:for(o=this.boxPlannerGrid.getIndexInGridByElementId(t),i={row:o.row,col:o.col,backside:o.backside},n&&"BoxPlanner_backside"==n?i={row:0,col:0,backside:!1}:o.row>0?i.row--:(s=0==o.col?0:o.col-1,(l=this.boxPlannerGrid.getAllElementsInColumn(s,o.backside))&&l.length>0&&(i.col=s,i.row=l.length-1)),r=this.boxPlannerGrid.deleteElement(t,n),h=0;h<r.length;h++)this.constructionRulesHandler.onElemDeleted(r[h]);if(c=!0,n&&"BoxPlanner_backside"==n&&(0==this.boxPlannerGrid.getAllElementsInBacksideModuleGrid().length?(this.boxPlannerGrid.destroyBacksideModuleGrid(),c=!0):c=!1),!c){e.next=11;break}return this.boxPlannerGrid.updateWorldPosOfElements(),e.next=11,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 11:if(!this.boxPlannerGrid.getPlannerElementAtGridPos(i.col,i.row,i.backside)){e.next=13;break}return e.abrupt("return",{newElementToSelect:null===(u=this.boxPlannerGrid.getPlannerElementAtGridPos(i.col,i.row,i.backside))||void 0===u?void 0:u.getElementId()});case 13:return e.abrupt("return",{});case 14:case"end":return e.stop()}}),_callee5,this)}))),function deletePlannerElement(t,n,o){return e.apply(this,arguments)})},{key:"getAllViewPlannerElements",value:function getAllViewPlannerElements(){return this.boxPlannerGrid.getAllElementsInGrid()}},{key:"getNeighborElements",value:function getNeighborElements(t,e){var n=this.boxPlannerGrid.getElementById(t);if(!n)return[];var o=null==n?void 0:n.getDockingDockingPointsByType(e);if(!o)return[];for(var i=[],s=0;s<(null==o?void 0:o.length);s++)null!=o[s]&&i.push(o[s].OnElementId);return i}},{key:"getFreeDockingPointsByElementId",value:function getFreeDockingPointsByElementId(t,e){return{dockingPoints:[],filter:[]}}},{key:"getDockedDockingPointsByElementId",value:function getDockedDockingPointsByElementId(t,e){return[]}},{key:"getDockedGroups",value:function getDockedGroups(){return[this.boxPlannerGrid.getAllElementIdsInGrid()]}},{key:"getBoundingBox",value:function getBoundingBox(){return P.warn("BoxPlanner - get2DViewPlannerBoundingBox not implemented yet","WC_0012"),new p.Z}},{key:"updatePlannerTrans",value:function updatePlannerTrans(t,e,n,o,i,s){return P.error(new h.GE("BoxPlanner - updatePlannerTrans not implemented yet",{code:"WC_0012"})),!1}},{key:"updatePlanner",value:(t=(0,o.Z)(a().mark((function _callee6(t,e){var n,o,i,s,l,r,h,c,u;return a().wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:if(P.debug("BoxPlanner - configurationHasChanged "+t),!(t&&e&&e.length>0&&t.OPTELEMENT)||"OPVECK_I"!=t.OPTELEMENT&&"OPVECK_A"!=t.OPTELEMENT){a.next=18;break}if(!(e.length>1)){a.next=9;break}return a.next=5,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,e,!0);case 5:if(!(n=a.sent)){a.next=8;break}return a.abrupt("return",{elemIdsToDelete:[],viewMessageCodex:n});case 8:case 44:case 45:return a.abrupt("return",{elemIdsToDelete:[]});case 9:if(o=this.boxPlannerGrid.getIndexInGridByElementId(e[0]),i=e[0],o.row>0&&(i=this.boxPlannerGrid.getPlannerElementAtGridPos(o.col,0,!1).getElementId()),this.boxPlannerGrid.getElementHasLeftElement(i)&&this.boxPlannerGrid.getElementHasRightElement(i)){a.next=18;break}return s="NO",this.boxPlannerGrid.getElementHasLeftElement(i)||(s="AVL"),this.boxPlannerGrid.getElementHasRightElement(i)||(s="AVR"),l=this.getPlannerElementsInfluencedByCopy(i,{dpType:s,copyType:"BoxPlanner_COL"}),a.abrupt("return",{elemIdsToDelete:[],elementIdToCopy:l,copyDPType:s,copyType:"BoxPlanner_COL",ignoreOptionsToCopy:["OPTELEMENT"],changedOPT:t,targetElements:e});case 18:if(!t||!t.OPTDMOD){a.next=32;break}a.t0=t.OPTDMOD,a.next="OPVD_EIN"===a.t0?22:"OPVD_AUS"===a.t0?26:30;break;case 22:if(this.boxPlannerGrid.getPlannerHasActiveBackside()){a.next=25;break}return r=this.getPlannerElementsInfluencedByCopy(-1,{dpType:"NO",copyType:"BoxPlanner_backside"}),a.abrupt("return",{elemIdsToDelete:[],elementIdToCopy:r,copyType:"BoxPlanner_backside",changedOPT:t});case 25:case 29:return a.abrupt("break",30);case 26:if(!this.boxPlannerGrid.getPlannerHasActiveBackside()){a.next=29;break}return h=this.boxPlannerGrid.getAllElementsInBacksideModuleGrid(),a.abrupt("return",{elemIdsToDelete:h,deletionType:"BoxPlanner_backside",changedOPT:t});case 30:a.next=45;break;case 32:if(!(t&&t.OPTFARBE_RAHMEN&&"OPVSCHWARZ_MATT"==t.OPTFARBE_RAHMEN&&this.boxPlannerGrid.getPlannerHasActiveBackside())){a.next=37;break}return c=this.boxPlannerGrid.getAllElementsInBacksideModuleGrid(),a.abrupt("return",{elemIdsToDelete:c,deletionType:"BoxPlanner_backside",changedOPT:t,targetElements:e,viewMessageCodex:"BOXPLAN_BLACKFRAME_INCOMPATIBLE_ELEMENT_WARNING"});case 37:return a.next=39,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,e);case 39:if(!(u=a.sent)){a.next=44;break}return a.abrupt("return",{elemIdsToDelete:[],viewMessageCodex:u});case 46:case"end":return a.stop()}}),_callee6,this)}))),function updatePlanner(e,n){return t.apply(this,arguments)})},{key:"getSetData",value:function getSetData(t,e,n,o){for(var i={ID:"S1",H:"",x:0,y:0,z:0,w:0,ELE:[],Blob:this.set.CatalogData.supplierILN,Cat:this.set.getCatalogCodex(),ShowDim:n},s=this.boxPlannerGrid.getAllElementsInGrid(),l=0;l<s.length;l++){var r=s[l],a=r.ElementId,c=this.set.getPlannerConfigData(a).config,u={ID:"E"+a,N:c.N,Model:c.Model,x:-r.WorldPosCenter.x,y:r.WorldPosCenter.y,z:r.WorldPosCenter.z,PosPivot:"Center",w:r.getRotDeg(),RotPivot:"Center",DP:r.getDockingPointJS3D(),MAT:c.MAT,CFG:c.CFG,H:""},m=(0,h.FB)(JSON.stringify(u));u.H=m,i.ELE.push(u)}m=(0,h.FB)(JSON.stringify(i));return i.H=m,{constructionSet:i}}},{key:"getPlannerId",value:function getPlannerId(){return this.plannerID}},{key:"getElementPosInfo",value:function getElementPosInfo(){P.error(new h.GE("BoxPlanner - getElementPosInfo not implemented yet",{code:"WC_0012"}))}},{key:"destroyPlanner",value:function destroyPlanner(){this.boxPlannerGrid.destroyBoxPlannerGrid()}},{key:"getCatalogData",value:function getCatalogData(){return this.set.CatalogData}},{key:"getPlannerBoundingBox",value:function getPlannerBoundingBox(){return this.boxPlannerGrid.getBoundingBox()}},{key:"updatePlannerBoundingBox",value:function updatePlannerBoundingBox(){}},{key:"getPlanningIsComplete",value:function getPlanningIsComplete(){return null!=this.boxPlannerGrid.getPlannerElementAtGridPos(0,0,!1)}},{key:"updateSetPosNr",value:function updateSetPosNr(t){for(var e=this.boxPlannerGrid.getAllElementIdsInGrid(),n=0;n<e.length;n++){var o=e[n],i=this.boxPlannerGrid.getElementById(o);i&&(i.SetPosNr=t+i.PosNr-1,this.set.setPosNr(i.ElementId,i.getPosNr()))}return e.length}},{key:"clonePlanner",value:function clonePlanner(t,e,n){var o=new DivaBoxPlanner(t,e);return o.initPlanner(n),o}}]);var t,e,n,r,c,u}();(0,l.Z)(T,"plannerType","BOX")}}]);
2
+ "use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[2905],{82905:(t,e,n)=>{n.r(e),n.d(e,{default:()=>T});var o=n(84658),i=n(13125),s=n(43860),l=n(80248),r=n(50747),a=n.n(r),h=n(37537),c=n(12952),u=h.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),m=function(){return(0,s.Z)((function BoxPlannerPartlistHelper(t,e,n,o,s,r,a){(0,i.Z)(this,BoxPlannerPartlistHelper),(0,l.Z)(this,"constructionRules",void 0),(0,l.Z)(this,"getOptionVal",void 0),(0,l.Z)(this,"setOptionValue",void 0),(0,l.Z)(this,"getElementHasBottomPlate",void 0),(0,l.Z)(this,"getElementIsCornerElement",void 0),(0,l.Z)(this,"getCornerType",void 0),(0,l.Z)(this,"getElementHasTopPlate",void 0),(0,l.Z)(this,"getElementIsGarderobeElement",void 0),this.getOptionVal=t,this.getElementHasBottomPlate=n,this.setOptionValue=e,this.getElementIsCornerElement=o,this.getCornerType=s,this.getElementHasTopPlate=r,this.getElementIsGarderobeElement=a}),[{key:"setConstructionRules",value:function setConstructionRules(t){this.constructionRules=t}},{key:"getGroundPlatesNumOfRightNeighbors",value:function getGroundPlatesNumOfRightNeighbors(t,e,n){var o=0;if(this.getElementHasBottomPlate(t,n)&&o++,e.getPlannerHasActiveBackside()){var i=e.getOppositeElement(t.getElementId());if(this.getElementHasBottomPlate(i,n)&&o++,e.getElementHasRightElement(t.getElementId())){var s=e.getRightElement(t.getElementId()),l=e.getOppositeElement(s.getElementId());return this.getElementHasBottomPlate(s,n)&&o++,this.getElementHasBottomPlate(l,n)&&o++,o}return o}if(e.getElementHasRightElement(t.getElementId())){var r=e.getRightElement(t.getElementId());return this.getElementHasBottomPlate(r,n)&&o++,o}return o}},{key:"getTopPlatesNumOfRightNeighbors",value:function getTopPlatesNumOfRightNeighbors(t,e,n){var o=0;if(this.getElementHasTopPlate(t,e,n)&&o++,e.getPlannerHasActiveBackside()){var i=e.getOppositeElement(t.getElementId());if(this.getElementHasTopPlate(i,e,n)&&o++,e.getElementHasRightElement(t.getElementId())){var s=e.getRightElement(t.getElementId()),l=e.getOppositeElement(s.getElementId());return this.getElementHasTopPlate(s,e,n)&&o++,this.getElementHasTopPlate(l,e,n)&&o++,o}return o}if(e.getElementHasRightElement(t.getElementId())){var r=e.getRightElement(t.getElementId());return this.getElementHasTopPlate(r,e,n)&&o++,o}return o}},{key:"getElementHeight",value:function getElementHeight(t,e){var n=this.getOptionVal(t.getElementId(),"OPTHOEHE",e);return"OPVH_6"==n?"6":"OPVH_11"==n?"11":"OPVH_18"==n?"18":"37"}},{key:"getElementDepth",value:function getElementDepth(t,e){var n=this.getOptionVal(t.getElementId(),"OPTTIEFE",e);return"OPVTIEFE_18"==n?"18":"37"}},{key:"getElementRahmenColor",value:function getElementRahmenColor(t,e){var n=this.getOptionVal(t.getElementId(),"OPTFARBE_RAHMEN",e);return"OPVCHROM"==n?"CHROM":"OPVSCHWARZ_MATT"==n?"BLACK":"CHROM"}},{key:"calculateRahmen",value:function calculateRahmen(t,e){for(var n=t.getAllElementsInGrid(),o=0;o<n.length;o++)this.constructionRules.VarticalRahmenInfo&&(this.correctRahmenVerticalLeftFront(n[o],t,e),this.correctRahmenVerticalLeftBack(n[o],t,e),this.correctRahmenVerticalRightFront(n[o],t,e),this.correctRahmenVerticalRightBack(n[o],t,e),u.debug("---------Correct Senkrechte Rahmen for element with ID: "+n[o].ElementId+"; posNr: "+n[o].PosNr+" ----------"),u.debug("Senkrechter Rahmen links vorne: "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_L_V",e)),u.debug("Senkrechter Rahmen links hinten: "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_L_H",e)),u.debug("Senkrechter Rahmen rechts vorne : "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_R_V",e)),u.debug("Senkrechter Rahmen rechts hinten : "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_R_H",e))),this.constructionRules.DepthRahmenInfo&&(this.correctRahmenDepthLeftBottom(n[o],t,e),this.correctRahmenDepthLeftTop(n[o],t,e),this.correctRahmenDepthRightBottom(n[o],t,e),this.correctRahmenDepthRightTop(n[o],t,e),u.debug("---------Correct Tiefenverbinder Rahmen for element with ID: "+n[o].ElementId+"; posNr: "+n[o].PosNr+" ----------"),u.debug("Tiefen Rahmen links unten: "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_L_U",e)),u.debug("Tiefen Rahmen links oben: "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_L_O",e)),u.debug("Tiefen Rahmen rechts unten : "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_R_U",e)),u.debug("Tiefen Rahmen rechts oben : "+this.getOptionVal(n[o].ElementId,"OPTRAHMEN_R_O",e)))}},{key:"correctRahmenDepthLeftBottom",value:function correctRahmenDepthLeftBottom(t,e,n){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,n),!(e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId()))&&!e.getElementHasBottomElement(t.getElementId()))if(e.getPlannerHasActiveBackside())switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(this.getElementHasBottomPlate(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,n);else switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,n)}}},{key:"correctRahmenDepthLeftTop",value:function correctRahmenDepthLeftTop(t,e,n){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,n),!(e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId())))if(e.getPlannerHasActiveBackside())switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(this.getElementIsCornerElement(t,n))switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else if(this.getElementHasTopPlate(t,e,n))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,n);else switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,n)}}},{key:"correctRahmenDepthRightBottom",value:function correctRahmenDepthRightBottom(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId()))if(e.getPlannerHasActiveBackside())switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(o){var i=e.getRightElement(t.getElementId());if(!this.getElementHasBottomPlate(t,n)||this.getElementIsCornerElement(t,n))switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else if(!this.getElementHasBottomPlate(i,n)||this.getElementIsCornerElement(i,n))switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,n)}else if(this.getElementHasBottomPlate(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,n);else switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}break;case"BLACK":o?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,n):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,n)}}},{key:"correctRahmenDepthRightTop",value:function correctRahmenDepthRightTop(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(e.getPlannerHasActiveBackside())switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(!this.getElementHasTopPlate(t,e,n)||this.getElementIsCornerElement(t,n)){switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}return}if(!i)return void this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,n);var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());if(!this.getElementHasTopPlate(s,e,n)||this.getElementIsCornerElement(s,n)){switch(this.getElementDepth(t,n)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,n);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,n)}return}this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,n);break;case"BLACK":i?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,n):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,n)}}},{key:"correctRahmenVerticalLeftFront",value:function correctRahmenVerticalLeftFront(t,e,n){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,n),!(e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,n)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,n);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,n);break;case"18":switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,n)}break;case"37":if(this.getElementIsGarderobeElement(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n);else switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,n)}}}},{key:"correctRahmenVerticalLeftBack",value:function correctRahmenVerticalLeftBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside;if(!o&&!(o?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,n)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,n);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,n);break;case"18":switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,n)}break;case"37":if(this.getElementIsGarderobeElement(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n);else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(e.getPlannerHasActiveBackside()){var i=e.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,n)}}}},{key:"correctRahmenVerticalRightFront",value:function correctRahmenVerticalRightFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,n)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,n);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,n);break;case"18":switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,n)}break;case"37":if(this.getElementIsGarderobeElement(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n);else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());this.getElementIsGarderobeElement(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,n)}}}},{key:"correctRahmenVerticalRightBack",value:function correctRahmenVerticalRightBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside;if(!o){var i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,n)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,n);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,n);break;case"18":switch(this.getElementRahmenColor(t,n)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,n)}break;case"37":if(this.getElementIsGarderobeElement(t,n))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n);else switch(this.getElementRahmenColor(t,n)){case"CHROM":if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());if(!s)return;if(e.getPlannerHasActiveBackside()){var l=e.getOppositeElement(t.getElementId());if(!l)return;var r=e.getOppositeElement(s.getElementId());if(!r)return;this.getElementIsGarderobeElement(s,n)||this.getElementIsGarderobeElement(l,n)||this.getElementIsGarderobeElement(r,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else this.getElementIsGarderobeElement(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else if(e.getPlannerHasActiveBackside()){var a=e.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(a,n)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,n):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,n);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,n)}}}}},{key:"calculateKnots",value:function calculateKnots(t,e){if(this.constructionRules.hasKNOTS)for(var n=t.getAllElementsInGrid(),o=0;o<n.length;o++)this.correctKnotLeftTopFront(n[o],t,e),this.correctKnotLeftTopBack(n[o],t,e),this.correctKnotLeftBottomFront(n[o],t,e),this.correctKnotLeftBottomBack(n[o],t,e),this.correctKnotRightTopFront(n[o],t,e),this.correctKnotRightTopBack(n[o],t,e),this.correctKnotRightBottomFront(n[o],t,e),this.correctKnotRightBottomBack(n[o],t,e),this.correctKnotRightMiddleBack(n[o],t,e),this.correctKnotLeftMiddleBack(n[o],t,e),u.debug("---------Correct Knots for element with ID: "+n[o].ElementId+"; posNr: "+n[o].PosNr+" ----------"),u.debug("Links oben vorne : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LTF",e)),u.debug("Links oben hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LTB",e)),u.debug("Links unten vorne : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LBF",e)),u.debug("Links unten hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LBB",e)),u.debug("Rechts oben vorne : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RTF",e)),u.debug("Rechts oben hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RTB",e)),u.debug("Rechts unten vorne : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RBF",e)),u.debug("Links mitte hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_LMB",e)),u.debug("Rechts mitte hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RMB",e)),u.debug("Rechts unten hinten : "+this.getOptionVal(n[o].ElementId,"OPTKNOTEN_RBB",e))}},{key:"correctKnotLeftBottomFront",value:function correctKnotLeftBottomFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId())&&(o||(e.getPlannerHasActiveBackside()&&this.getElementHasBottomPlate(t,n)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n),this.getElementHasBottomPlate(t,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n)),this.getElementIsCornerElement(t,n))){var i=e.getLeftElement(t.getElementId());if(this.getElementIsCornerElement(i,n))return;var s=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasBottomPlate(i,n)?this.getElementHasBottomPlate(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.getElementHasBottomPlate(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":this.getElementHasBottomPlate(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}},{key:"correctKnotLeftTopFront",value:function correctKnotLeftTopFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(o||(e.getPlannerHasActiveBackside()&&this.getElementHasTopPlate(t,e,n)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n),this.getElementHasTopPlate(t,e,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n)),this.getElementIsCornerElement(t,n)){var i=e.getElementHasLeftElement(t.getElementId());if(o&&this.getElementIsCornerElement(e.getLeftElement(t.getElementId()),n))return;var s=e.getElementHasRightElement(t.getElementId());if(i||s){if(s&&!i){var l=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasTopPlate(l,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}else if(!s&&i){var r=e.getLeftElement(t.getElementId());this.getElementHasTopPlate(r,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3erer_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}else if(s&&i){var a=e.getLeftElement(t.getElementId()),h=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasTopPlate(a,e,n)?this.getElementHasTopPlate(h,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.getElementHasTopPlate(h,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":this.getElementHasTopPlate(a,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}},{key:"correctKnotLeftBottomBack",value:function correctKnotLeftBottomBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId())){if(!o)if(e.getPlannerHasActiveBackside()&&!e.getIndexInGridByElementId(t.getElementId()).backside){var i=e.getOppositeElement(t.getElementId());i&&(this.getElementHasBottomPlate(t,n)?this.getElementHasBottomPlate(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.getElementHasBottomPlate(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n))}else e.getPlannerHasActiveBackside()||this.getElementHasBottomPlate(t,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);if(this.getElementIsCornerElement(t,n)){var s=e.getLeftElement(t.getElementId());if(this.getElementIsCornerElement(s,n))return;switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasBottomPlate(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":var l=e.getRightElement(t.getElementId());this.getElementHasBottomPlate(s,n)?this.getElementHasBottomPlate(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.getElementHasBottomPlate(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,n)}}}}},{key:"correctKnotLeftTopBack",value:function correctKnotLeftTopBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(!o)if(e.getPlannerHasActiveBackside()&&!e.getIndexInGridByElementId(t.getElementId()).backside){var i=e.getOppositeElement(t.getElementId());i&&(this.getElementHasTopPlate(t,e,n)?this.getElementHasTopPlate(i,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.getElementHasTopPlate(i,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n))}else e.getPlannerHasActiveBackside()||this.getElementHasTopPlate(t,e,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);if(this.getElementIsCornerElement(t,n)){var s=e.getElementHasLeftElement(t.getElementId());if(o&&this.getElementIsCornerElement(e.getLeftElement(t.getElementId()),n))return;var l=e.getElementHasRightElement(t.getElementId());if(s||l){if(l&&!s){var r=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":this.getElementHasTopPlate(r,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n)}}else if(!l&&s){var a=e.getLeftElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":case"OUTSIDE":this.getElementHasTopPlate(a,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n)}}else if(l&&s){var h=e.getLeftElement(t.getElementId()),c=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.getElementHasTopPlate(h,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":this.getElementHasTopPlate(h,e,n)?this.getElementHasTopPlate(c,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.getElementHasTopPlate(c,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,n)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}},{key:"correctKnotRightMiddleBack",value:function correctKnotRightMiddleBack(t,e,n){if((this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n),this.getElementIsGarderobeElement(t,n))&&!e.getIndexInGridByElementId(t.getElementId()).backside)if(e.getElementHasRightElement(t.getElementId()))if(e.getPlannerHasActiveBackside()){var o=e.getOppositeElement(t.getElementId());if(!o)return;var i=e.getRightElement(t.getElementId());if(!i)return;var s=e.getOppositeElement(i.getElementId());if(!s)return;this.getElementIsGarderobeElement(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n):this.getElementIsGarderobeElement(o,n)?this.getElementIsGarderobeElement(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.getElementIsGarderobeElement(i,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else{var l=e.getRightElement(t.getElementId());if(!l)return;this.getElementIsGarderobeElement(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else if(e.getPlannerHasActiveBackside()){var r=e.getOppositeElement(t.getElementId());if(!r)return;this.getElementIsGarderobeElement(r,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}},{key:"correctKnotLeftMiddleBack",value:function correctKnotLeftMiddleBack(t,e,n){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n),this.getElementIsGarderobeElement(t,n)){var o=e.getIndexInGridByElementId(t.getElementId()).backside;if(!o){var i=o?e.getElementHasRightElement(t.getElementId()):e.getElementHasLeftElement(t.getElementId());if(i){var s=e.getLeftElement(t.getElementId());if(this.getElementIsGarderobeElement(s,n))return}if(i)if(e.getPlannerHasActiveBackside()){var l=e.getLeftElement(t.getElementId());if(!l)return;var r=e.getOppositeElement(t.getElementId());if(!r)return;var a=e.getOppositeElement(null==l?void 0:l.getElementId());if(!a)return;this.getElementIsGarderobeElement(a,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n):this.getElementIsGarderobeElement(r,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);else if(e.getPlannerHasActiveBackside()){var h=e.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(h,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n)}}}},{key:"correctKnotRightBottomFront",value:function correctKnotRightBottomFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId())){if(e.getPlannerHasActiveBackside())if(this.getElementHasBottomPlate(t,n))if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());s&&(this.getElementHasBottomPlate(s,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);else if(i){var l=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());l&&(this.getElementHasBottomPlate(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n);else if(this.getElementHasBottomPlate(t,n)){var r=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());r&&!this.getElementHasBottomPlate(r,n)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}else if(i){var a=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());a&&!this.getElementIsCornerElement(a,n)&&(this.getElementHasBottomPlate(a,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n);if(this.getElementIsCornerElement(t,n))switch(this.getCornerType(t,n)){case"INSIDE":var h=e.getRightElement(t.getElementId());if(h&&this.getElementIsCornerElement(h,n))if(e.getElementHasRightElement(h.getElementId())){var c=e.getRightElement(h.getElementId());this.getElementHasBottomPlate(c,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else h&&this.getElementHasBottomPlate(h,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}},{key:"correctKnotRightTopFront",value:function correctKnotRightTopFront(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(e.getPlannerHasActiveBackside())if(this.getElementHasTopPlate(t,e,n))if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());s&&(this.getElementHasTopPlate(s,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);else if(i){var l=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());l&&(this.getElementHasTopPlate(l,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n);else if(this.getElementHasTopPlate(t,e,n)){if(i){var r=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());r&&(this.getElementHasTopPlate(r,e,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n))}}else if(i){var a=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());a&&!this.getElementIsCornerElement(a,n)&&(this.getElementHasTopPlate(a,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,n);if(this.getElementIsCornerElement(t,n)){var h=e.getElementHasLeftElement(t.getElementId()),c=e.getElementHasRightElement(t.getElementId());if(h||c){if(c&&!h){var u=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":if(this.getElementIsCornerElement(u,n))if(e.getElementHasRightElement(u.getElementId())){var m=e.getRightElement(u.getElementId());this.getElementHasTopPlate(m,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else this.getElementHasTopPlate(u,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}else if(!c&&h){e.getLeftElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}else if(c&&h){var d=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":if(this.getElementIsCornerElement(d,n))if(e.getElementHasRightElement(d.getElementId())){var g=e.getRightElement(d.getElementId());this.getElementHasTopPlate(g,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else this.getElementHasTopPlate(d,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}},{key:"correctKnotRightBottomBack",value:function correctKnotRightBottomBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(!e.getElementHasBottomElement(t.getElementId())&&!e.getIndexInGridByElementId(t.getElementId()).backside){if(e.getPlannerHasActiveBackside())switch(this.getGroundPlatesNumOfRightNeighbors(t,e,n)){case 0:i?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n);break;case 1:i?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case 2:i?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);break;case 3:i&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n);break;case 4:i&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,n)}else if(this.getElementHasBottomPlate(t,n)){if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());s&&(this.getElementHasBottomPlate(s,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n))}}else if(i){var l=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());l&&!this.getElementIsCornerElement(l,n)&&(this.getElementHasBottomPlate(l,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);if(this.getElementIsCornerElement(t,n))switch(this.getCornerType(t,n)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":var r=e.getRightElement(t.getElementId());if(this.getElementIsCornerElement(r,n)){var a=e.getRightElement(r.getElementId());this.getElementHasBottomPlate(a,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n)}else this.getElementHasBottomPlate(r,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}},{key:"correctKnotRightTopBack",value:function correctKnotRightTopBack(t,e,n){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,n);var o=e.getIndexInGridByElementId(t.getElementId()).backside,i=o?e.getElementHasLeftElement(t.getElementId()):e.getElementHasRightElement(t.getElementId());if(!e.getIndexInGridByElementId(t.getElementId()).backside){if(e.getPlannerHasActiveBackside())if(i)switch(this.getTopPlatesNumOfRightNeighbors(t,e,n)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,n);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,n);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,n);break;case 3:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n);break;case 4:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,n)}else switch(this.getTopPlatesNumOfRightNeighbors(t,e,n)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n)}else if(this.getElementHasTopPlate(t,e,n)){if(i){var s=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());this.getElementIsCornerElement(s,n)||this.getElementHasTopPlate(s,e,n)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n)}}else if(i){var l=o?e.getLeftElement(t.getElementId()):e.getRightElement(t.getElementId());l&&!this.getElementIsCornerElement(l,n)&&(this.getElementHasTopPlate(l,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,n))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,n);if(this.getElementIsCornerElement(t,n)){var r=e.getElementHasLeftElement(t.getElementId()),a=e.getElementHasRightElement(t.getElementId());if(r||a){if(a&&!r){var h=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":if(this.getElementIsCornerElement(h,n))if(e.getElementHasRightElement(h.getElementId())){var c=e.getRightElement(h.getElementId());this.getElementHasTopPlate(c,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else this.getElementHasTopPlate(h,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}else if(!a&&r)this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);else if(a&&r){var u=e.getRightElement(t.getElementId());switch(this.getCornerType(t,n)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n);break;case"OUTSIDE":if(this.getElementIsCornerElement(u,n))if(e.getElementHasRightElement(u.getElementId())){var m=e.getRightElement(u.getElementId());this.getElementHasTopPlate(m,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n);else this.getElementHasTopPlate(u,e,n)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,n):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,n)}}}}])}(),d=h.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),g=function(){return(0,s.Z)((function ConstructionRulesHandler(t,e,n){var o=this;(0,i.Z)(this,ConstructionRulesHandler),(0,l.Z)(this,"getValueOfOptionOfArticle",void 0),(0,l.Z)(this,"checkArticleHasOption",void 0),(0,l.Z)(this,"updateCfgValuesByPlanner",void 0),(0,l.Z)(this,"constructionRules",void 0),(0,l.Z)(this,"constructionRulesLoaded",void 0),(0,l.Z)(this,"hideOptionsForConstruction",void 0),(0,l.Z)(this,"partlistHelper",void 0),(0,l.Z)(this,"getOptionVal",(function(t,e,n){if(n.has(t)&&n.get(t).has(e)){var i=n.get(t).get(e);return null!=i?i:""}var s=o.getValueOfOptionOfArticle(t,e);return null!=s?s:""})),(0,l.Z)(this,"hasOptionValue",(function(t,e,n){return!(!n.has(t)||!n.get(t).has(e))||!!o.getValueOfOptionOfArticle(t,e)})),(0,l.Z)(this,"setOptionValue",(function(t,e,n,i){var s;if(i.has(t)||i.set(t,new Map),null===(s=i.get(t))||void 0===s||s.set(e,n),o.hideOptionsForConstruction.has(t)){var l=o.hideOptionsForConstruction.get(t).indexOf(e);l>=0&&o.hideOptionsForConstruction.get(t).splice(l,1)}})),(0,l.Z)(this,"getElementHasBottomPlate",(function(t,e){if(o.constructionRules.knotInfo.elementsWithGroundPlate)for(var n=0;n<o.constructionRules.knotInfo.elementsWithGroundPlate.length;n++){var i=o.constructionRules.knotInfo.elementsWithGroundPlate[n].onOPT,s=o.constructionRules.knotInfo.elementsWithGroundPlate[n].onOPVs,l=o.getOptionVal(t.getElementId(),i,e);return o.arrayContainsValue(s,l)}return!1})),(0,l.Z)(this,"getElementIsCornerElement",(function(t,e){return o.constructionRules.hasCORNER&&o.arrayContainsValue(o.constructionRules.knotInfo.cornerElements.onOPVs,o.getOptionVal(t.getElementId(),o.constructionRules.knotInfo.cornerElements.onOPT,e))})),(0,l.Z)(this,"getElementIsGarderobeElement",(function(t,e){return o.constructionRules.hasGARDEROBE&&o.arrayContainsValue(o.constructionRules.knotInfo.garderobeElements.onOPVs,o.getOptionVal(t.getElementId(),o.constructionRules.knotInfo.garderobeElements.onOPT,e))})),(0,l.Z)(this,"getCornerType",(function(t,e){return"OPVECK_I"==o.getOptionVal(t.getElementId(),"OPTELEMENT",e)?"INSIDE":"OPVECK_A"==o.getOptionVal(t.getElementId(),"OPTELEMENT",e)?"OUTSIDE":"NOCORNER"})),(0,l.Z)(this,"getElementHasTopPlate",(function(t,e,n){return!e.getElementHasTopElement(t.getElementId())||o.getElementHasBottomPlate(e.getTopElement(t.getElementId()),n)})),this.constructionRulesLoaded=!1,this.getValueOfOptionOfArticle=t,this.checkArticleHasOption=e,this.hideOptionsForConstruction=new Map,this.updateCfgValuesByPlanner=n,this.partlistHelper=new m(this.getOptionVal,this.setOptionValue,this.getElementHasBottomPlate,this.getElementIsCornerElement,this.getCornerType,this.getElementHasTopPlate,this.getElementIsGarderobeElement)}),[{key:"arrayContainsValue",value:function arrayContainsValue(t,e){if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var o=t.split(";");for(n=0;n<o.length;n++)if(o[n]==e)return!0;return!1}},{key:"evalRule",value:function evalRule(t,e,n){for(var o=!0,i=e.split("&"),s=0;s<i.length;s++){var l=i[s].split("=")[0],r=i[s].split("=")[1],a=this.getOptionVal(t,l,n);a&&a!=r&&(o=!1)}return o}},{key:"setOptionDoShow",value:function setOptionDoShow(t,e,n){var o,i=this.constructionRules.optionsVisibilityInfo[e];null!=i.doShow&&(n.has(t)||n.set(t,new Map),null===(o=n.get(t))||void 0===o||o.set(e,i.doShow));if(this.hideOptionsForConstruction.has(t)){var s,l=this.hideOptionsForConstruction.get(t).indexOf(e);if(l>=0)null===(s=this.hideOptionsForConstruction.get(t))||void 0===s||s.splice(l,1)}}},{key:"setOptionDoHide",value:function setOptionDoHide(t,e,n){var o,i,s=this.constructionRules.optionsVisibilityInfo[e];n.has(t)||n.set(t,new Map),null===(o=n.get(t))||void 0===o||o.set(e,s.doHide),this.hideOptionsForConstruction.has(t)||this.hideOptionsForConstruction.set(t,[]),null===(i=this.hideOptionsForConstruction.get(t))||void 0===i||i.push(e)}},{key:"getCurOptionBasedConstructionRules",value:function getCurOptionBasedConstructionRules(t,e){for(var n=[],o=0;o<this.constructionRules.optionBasedConstructionRules.length;o++){var i=this.constructionRules.optionBasedConstructionRules[o];this.getOptionVal(t,i.masterOptionName,e)==i.masterOptionValue&&n.push(i)}return n}},{key:"setAllOptToDefault",value:function setAllOptToDefault(t,e,n,o){for(var i=[],s=void 0,l=0;l<this.constructionRules.optionsInfluenceRulesOfAllElements.length;l++){var r=this.constructionRules.optionsInfluenceRulesOfAllElements[l];for(var a in n)a==r.onOPT&&this.arrayContainsValue(r.onOPVs,n[a])&&i.push({opt:r.influenceOPT,opv:r.forceOPV,unvalidOPVs:r.unvalidOPVs,warning:r.warning,doShowWarning:!1})}for(var h=t.getAllElementIdsInGrid(),c=0;c<h.length;c++){var u;if(this.hideOptionsForConstruction.has(h[c])&&this.hideOptionsForConstruction.get(h[c]).length>0){for(;this.hideOptionsForConstruction.get(h[c]).length>0;){var m=this.hideOptionsForConstruction.get(h[c])[0];this.setOptionDoShow(h[c],m,e)}this.hideOptionsForConstruction.delete(h[c])}this.constructionRules.hasDMOD&&(t.getPlannerHasActiveBackside()?this.setOptionDoShow(h[c],"OPTDMOD",e):this.setOptionDoHide(h[c],"OPTDMOD",e));var d=t.getColumnCount();d>1?this.setOptionDoShow(h[c],"OPTMULTICOL",e):this.setOptionDoHide(h[c],"OPTMULTICOL",e),this.setOptionValue(h[c],"OPTCORNER_COL_L","OPVOHNE",e),this.setOptionValue(h[c],"OPTCORNER_COL_R","OPVOHNE",e);var g=t.getIndexInGridByElementId(h[c]);if(g.backside)this.setOptionValue(h[c],"OPTELEM_ON_BACK","OPVJA",e);else{if(this.setOptionValue(h[c],"OPTELEM_ON_BACK","OPVNEIN",e),g.col>0){var E=t.getPlannerElementAtGridPos(g.col-1,0,!1);if(E){var I=this.getOptionVal(E.getElementId(),"OPTELEMENT",e);"OPVECK_I"==I?this.setOptionValue(h[c],"OPTCORNER_COL_L","OPVECK_I",e):"OPVECK_A"==I?this.setOptionValue(h[c],"OPTCORNER_COL_L","OPVECK_A",e):this.setOptionValue(h[c],"OPTCORNER_COL_L","OPVOHNE",e)}}if(g.col<d-1){var O=t.getPlannerElementAtGridPos(g.col+1,0,!1);if(O){var k=this.getOptionVal(O.getElementId(),"OPTELEMENT",e);"OPVECK_I"==k?this.setOptionValue(h[c],"OPTCORNER_COL_R","OPVECK_I",e):"OPVECK_A"==k?this.setOptionValue(h[c],"OPTCORNER_COL_R","OPVECK_A",e):this.setOptionValue(h[c],"OPTCORNER_COL_R","OPVOHNE",e)}}}if(this.constructionRules.avoidOptionLastCol){var f=this.getOptionVal(h[c],this.constructionRules.avoidOptionLastCol.onOPT,e);this.arrayContainsValue(this.constructionRules.avoidOptionLastCol.onOPVs,f)&&g.col==d-1&&this.setOptionValue(h[c],this.constructionRules.avoidOptionLastCol.onOPT,this.constructionRules.avoidOptionLastCol.defaultOpv,e)}if(this.constructionRules.avoidOptionFirstCol){var R=this.getOptionVal(h[c],this.constructionRules.avoidOptionFirstCol.onOPT,e);this.arrayContainsValue(this.constructionRules.avoidOptionFirstCol.onOPVs,R)&&0==g.col&&this.setOptionValue(h[c],this.constructionRules.avoidOptionFirstCol.onOPT,this.constructionRules.avoidOptionFirstCol.defaultOpv,e)}var p=this.hasOptionValue(h[c],"OPTWW",e);if(t.getElementIsFirstInGrid(h[c])?(this.setOptionDoShow(h[c],"OPTWERKZEUGKASTEN",e),p&&(t.getSizeOfWholeSet().y>173&&!t.getPlannerHasActiveBackside()?this.setOptionDoShow(h[c],"OPTWW",e):this.setOptionDoHide(h[c],"OPTWW",e))):(this.setOptionDoHide(h[c],"OPTWERKZEUGKASTEN",e),p&&this.setOptionDoHide(h[c],"OPTWW",e)),e.has(h[c])||e.set(h[c],new Map),null===(u=e.get(h[c]))||void 0===u||u.set("DEBUG",t.getElementById(h[c]).getPosNr()+""),i.length>0)for(var P=0;P<i.length;P++){var T=this.getOptionVal(h[c],i[P].opt,e),V=!1;if(i[P].unvalidOPVs&&0!=i[P].unvalidOPVs.length){for(var _=i[P].unvalidOPVs.split(";"),B=0;B<_.length;B++)if(_[B]==T){V=!0;break}}else V=!0;V&&(T!=i[P].opv&&(this.setOptionValue(h[c],i[P].opt,i[P].opv,e),i[P].doShowWarning||(i[P].doShowWarning=!0,s=i[P].warning)))}if(n)for(var a in n)if(""!=a&&n[a]&&""!=n[a])for(l=0;l<this.constructionRules.optionsInfluenceRulesOfSingleElement.length;l++){r=this.constructionRules.optionsInfluenceRulesOfSingleElement[l];var v=!1;if(r.dir&&o&&o.length>0){if("TOP"==r.dir&&t.getElementHasBottomElement(h[c])&&o.indexOf(t.getBottomElement(h[c]).getElementId())>=0&&(v=!0),"DOWN"==r.dir&&t.getElementHasTopElement(h[c])&&o.indexOf(t.getTopElement(h[c]).getElementId())>=0&&(v=!0),"LEFT_RIGHT"==r.dir&&(t.getElementHasLeftElement(h[c])&&o.indexOf(t.getLeftElement(h[c]).getElementId())>=0||t.getElementHasRightElement(h[c])&&o.indexOf(t.getRightElement(h[c]).getElementId())>=0)&&(v=!0),"COL"==r.dir){var G=t.getIndexInGridByElementId(h[c]);t.getAllElementsInColumn(G.col,G.backside).forEach((function(t){return o.indexOf(t.ElementId)>=0?v=!0:void 0}))}if("BACK"==r.dir&&t.getPlannerHasActiveBackside()){var b=t.getOppositeElement(h[c]);b&&o.indexOf(b.getElementId())>=0&&(v=!0)}}else v=!0;if(v){T=this.getOptionVal(h[c],r.influenceOPT,e);a==r.onOPT&&T&&""!=T&&this.arrayContainsValue(r.unvalidOPVs,T)&&this.arrayContainsValue(r.onOPVs,n[a])&&(this.setOptionValue(h[c],r.influenceOPT,r.defaultOpv,e),r.warning&&(s=r.warning))}}var H=this.getCurOptionBasedConstructionRules(h[c],e);if(H)for(var C=0;C<H.length;C++)if(H[C].defaultOptions)for(var D=0;D<H[C].defaultOptions.length;D++){var A=H[C].defaultOptions[D];if(!A.rule||""==A.rule||this.evalRule(h[c],A.rule,e))for(var y=0;y<A.options.length;y++)"doShow"==A.value?this.setOptionDoShow(h[c],A.options[y],e):"doHide"==A.value&&this.setOptionDoHide(h[c],A.options[y],e),A.opv&&this.setOptionValue(h[c],A.options[y],A.opv,e)}this.setOptionValue(h[c],"OPTFAF_L_V","OPVOHNE_FAF",e),this.setOptionValue(h[c],"OPTFAF_L_H","OPVOHNE_FAF",e),this.setOptionValue(h[c],"OPTFAF_R_V","OPVOHNE_FAF",e),this.setOptionValue(h[c],"OPTFAF_R_H","OPVOHNE_FAF",e)}return s}},{key:"doCorrectAffectedElementsByOption",value:function doCorrectAffectedElementsByOption(t,e,n,o){if(null!=o&&1==o.length){var i=o[0];if(null!=n)for(var s in n){if(this.constructionRules.forceSameOptionInGrid&&this.arrayContainsValue(this.constructionRules.forceSameOptionInGrid,s)){var l=t.getIndexInGridByElementId(i).backside?t.getAllElementsInBackGrid():t.getAllElementsInFrontGrid();if(null!=l)for(var r=0;r<l.length;r++)this.setOptionValue(l[r].ElementId,s,n[s],e)}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInCol,s)){var a=t.getIndexInGridByElementId(i),h=t.getAllElementsInColumn(a.col,a.backside);if(null!=h){if(t.getPlannerHasActiveBackside()){var c,u=t.getAllElementsInColumn(a.col,!a.backside);u&&(h=null===(c=h)||void 0===c?void 0:c.concat(u))}for(r=0;r<h.length;r++)this.setOptionValue(h[r].ElementId,s,n[s],e)}}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInRow,s)){var m=t.getIndexInGridByElementId(i),d=t.getAllElementsInRow(m.row,m.backside);if(d&&t.getPlannerHasActiveBackside()){var g=t.getAllElementsInRow(m.row,!m.backside);g&&(d=d.concat(g))}for(r=0;r<d.length;r++)this.setOptionValue(d[r].ElementId,s,n[s],e)}}var E=t.getIndexInGridByElementId(i),I=t.getAllElementsInRow(E.row,E.backside);for(r=0;r<I.length;r++)if(I[r].getElementId()!=i)for(var O=0;O<this.constructionRules.forceSameOptionInRow.length;O++){var k=this.getOptionVal(I[r].getElementId(),this.constructionRules.forceSameOptionInRow[O],e);this.setOptionValue(i,this.constructionRules.forceSameOptionInRow[O],k,e);break}}}},{key:"handleVisibility_SHOW_HIDE",value:function handleVisibility_SHOW_HIDE(t,e,n,o){if(this.checkArticleHasOption(t,n.OPTCurrentElem)&&this.checkArticleHasOption(e,n.OPTNeighborElem)){var i=this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.get(t).indexOf(n.OPTCurrentElem)>=0;this.setOptionDoHide(e,n.OPTNeighborElem,o),i||this.setOptionDoShow(t,n.OPTCurrentElem,o)}}},{key:"handleBacksideVisibility_SHOW_HIDE",value:function handleBacksideVisibility_SHOW_HIDE(t,e,n,o){if(this.checkArticleHasOption(t,n.OPTCurrentElem)&&this.checkArticleHasOption(e,n.OPTNeighborElem)){var i=this.constructionRules.optionsVisibilityInfo[n.OPTCurrentElem],s=this.constructionRules.optionsVisibilityInfo[n.OPTNeighborElem];i&&s&&this.getOptionVal(t,n.OPTCurrentElem,o)==i.doShow&&this.getOptionVal(e,n.OPTNeighborElem,o)==s.doShow&&this.setOptionDoHide(t,n.OPTCurrentElem,o)}}},{key:"handleVisibiliy_HIDE_HIDE",value:function handleVisibiliy_HIDE_HIDE(t,e,n,o){var i=this.constructionRules.optionsVisibilityInfo[n.OPTCurrentElem];if(this.checkArticleHasOption(t,n.OPTCurrentElem)&&this.checkArticleHasOption(e,n.OPTNeighborElem)){var s=this.constructionRules.optionsVisibilityInfo[n.OPTNeighborElem],l=i.doShow==this.getOptionVal(t,n.OPTCurrentElem,o),r=this.getOptionVal(e,n.OPTNeighborElem,o)==s.doShow;l&&r&&(this.setOptionDoHide(t,n.OPTCurrentElem,o),this.setOptionDoHide(e,n.OPTNeighborElem,o))}}},{key:"correctSimpleOpt",value:function correctSimpleOpt(t,e,n,o,i){var s=n.getPlannerElementAtGridPos(t,e,i);if(this.constructionRules.defaultConstructionRules.TOP){var l=void 0;if(n.getElementHasTopElement(s.ElementId)){l=n.getPlannerElementAtGridPos(t,e+1,i);for(var r=0;r<this.constructionRules.defaultConstructionRules.TOP.length;r++){var a=this.constructionRules.defaultConstructionRules.TOP[r];"SHOW_HIDE"==a.OPTValueRule?this.handleVisibility_SHOW_HIDE(s.ElementId,l.ElementId,a,o):"HIDE_HIDE"==a.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(s.ElementId,l.ElementId,a,o)}}}if(this.constructionRules.defaultConstructionRules.RIGHT){var h=void 0;if(i?n.getElementHasLeftElement(s.ElementId):n.getElementHasRightElement(s.ElementId)){h=i?n.getPlannerElementAtGridPos(t-1,e,i):n.getPlannerElementAtGridPos(t+1,e,i);for(r=0;r<this.constructionRules.defaultConstructionRules.RIGHT.length;r++){var c=this.constructionRules.defaultConstructionRules.RIGHT[r];"SHOW_HIDE"==c.OPTValueRule?this.handleVisibility_SHOW_HIDE(s.ElementId,h.ElementId,c,o):"HIDE_HIDE"==c.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(s.ElementId,h.ElementId,c,o)}}}if(this.constructionRules.defaultConstructionRules.DOWN){var u=void 0;if(e>0){u=n.getPlannerElementAtGridPos(t,e-1,i);for(r=0;r<this.constructionRules.defaultConstructionRules.DOWN.length;r++){var m=this.constructionRules.defaultConstructionRules.DOWN[r];"SHOW_HIDE"==m.OPTValueRule?this.handleVisibility_SHOW_HIDE(s.ElementId,u.ElementId,m,o):"HIDE_HIDE"==m.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(s.ElementId,u.ElementId,m,o)}}}var d=i?n.getLeftElement(s.ElementId):n.getRightElement(s.ElementId),g=i?n.getRightElement(s.ElementId):n.getLeftElement(s.ElementId),E=n.getTopElement(s.ElementId),I=n.getBottomElement(s.ElementId),O=i?n.getTopLeftElement(s.ElementId):n.getTopRightElement(s.ElementId);d?this.setOptionValue(s.ElementId,"OPTNACHBAR_RECHTS",this.getOptionVal(d.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_RECHTS",o),g?this.setOptionValue(s.ElementId,"OPTNACHBAR_LINKS",this.getOptionVal(g.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_LINKS",o),E?this.setOptionValue(s.ElementId,"OPTNACHBAR_OBEN",this.getOptionVal(E.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_OBEN",o),O?this.setOptionValue(s.ElementId,"OPTNACHBAR_OBEN_RECHTS",this.getOptionVal(O.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_OBEN_RECHTS",o),this.constructionRules.hasNeighbors&&this.constructionRules.hasNeighbors.indexOf("OPTNACHBAR_UNTEN")>=0&&(I?this.setOptionValue(s.ElementId,"OPTNACHBAR_UNTEN",this.getOptionVal(I.ElementId,"OPTELEMENT",o),o):this.setOptionDoHide(s.ElementId,"OPTNACHBAR_UNTEN",o))}},{key:"correctBack",value:function correctBack(t,e,n){if(this.constructionRules.hasDMOD)if(t.getPlannerHasActiveBackside()){var o=void 0;if(o=t.getOppositeElement(n),this.constructionRules.defaultConstructionRules.BACK)for(var i=0;i<this.constructionRules.defaultConstructionRules.BACK.length;i++){var s,l,r=this.constructionRules.defaultConstructionRules.BACK[i],a=!1;if(r.hideOnElemAndOppositeOPT&&r.hideOnElemAndOppositeOPV)this.arrayContainsValue(r.hideOnElemAndOppositeOPV,this.getOptionVal(n,r.hideOnElemAndOppositeOPT,e))&&this.arrayContainsValue(r.hideOnElemAndOppositeOPV,this.getOptionVal(null===(s=o)||void 0===s?void 0:s.getElementId(),r.hideOnElemAndOppositeOPT,e))&&(a=!0);if(a)this.setOptionDoHide(n,r.OPTCurrentElem,e),this.setOptionDoHide(o.getElementId(),r.OPTCurrentElem,e);else if("FORCE_HIDE"==r.OPTValueRule&&this.setOptionDoHide(o.getElementId(),r.OPTCurrentElem,e),"SHOW_HIDE"==r.OPTValueRule)this.handleBacksideVisibility_SHOW_HIDE(null===(l=o)||void 0===l?void 0:l.getElementId(),n,r,e);else"HIDE_HIDE"==r.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(o.ElementId,n,r,e)}this.getElementHasBottomPlate(o,e)?this.setOptionDoShow(n,"OPTOPP_RAHMEN_U_V",e):this.setOptionDoHide(n,"OPTOPP_RAHMEN_U_V",e),this.getElementHasTopPlate(o,t,e)?this.setOptionDoShow(n,"OPTOPP_RAHMEN_O_V",e):this.setOptionDoHide(n,"OPTOPP_RAHMEN_O_V",e)}else this.setOptionDoHide(n,"OPTOPP_RAHMEN_U_V",e),this.setOptionDoHide(n,"OPTOPP_RAHMEN_O_V",e)}},{key:"correctBottom",value:function correctBottom(t,e,n){var o="";if(this.constructionRules.correctLeftRight&&null!=this.constructionRules.correctLeftRight.rowIndex)for(var i=t.getAllElementsInRow(this.constructionRules.correctLeftRight.rowIndex,n),s=0;s<i.length;s++){var l=i[s];if(0==s){if(null==(o=this.getOptionVal(l.ElementId,this.constructionRules.correctLeftRight.optWithOptVal,e)))return;n?this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optRight,o,e):(this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optLeft,o,e),this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optLeftBack,o,e))}n?this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optLeft,o,e):(this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optRight,o,e),this.setOptionValue(l.ElementId,this.constructionRules.correctLeftRight.optRightBack,o,e))}}},{key:"getValidLadder",value:function getValidLadder(t,e,n){for(var o=e.getAllElementsInColumn(t,!1),i=0;i<this.constructionRules.correctLadder.validLadder.length;i++){var s=this.constructionRules.correctLadder.validLadder[i];if(o.length==s.colCount){for(var l=!0,r=0;r<o.length;r++){var a=o[r];if(this.getOptionVal(a.ElementId,s.heightOption,n)!=s.heightPerRow[r]&&(l=!1),!l)break}if(l)return s}}}},{key:"correctLadder",value:function correctLadder(t,e){if(this.constructionRules.correctLadder){for(var n=t.getAllElementsInRow(this.constructionRules.correctLadder.rowIndex,!1),o=0;o<n.length;o++){var i=t.getRowCount(o);if(this.constructionRules.correctLadder.onElementHighestRowCount&&-1==this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(i))for(var s=t.getAllElementsInColumn(o,!1),l=0;l<s.length;l++)this.setOptionValue(s[l].ElementId,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,e);if(i<t.getSizeOfHighesRow(!1)){var r,a=null===(r=t.getPlannerElementAtGridPos(o,i-1,!1))||void 0===r?void 0:r.getElementId();a&&this.getOptionVal(a,this.constructionRules.correctLadder.optHeight,e)==this.constructionRules.correctLadder.opvProblematicHeight&&this.setOptionValue(a,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,e)}}for(o=0;o<n.length;o++){var h=n[o],c=this.getValidLadder(o,t,e);0==o&&this.setOptionValue(h.ElementId,this.constructionRules.correctLadder.optLadderLeft,c.optLadder,e);var u=c;if(t.getElementHasRightElement(h.getElementId())){var m=this.getValidLadder(o+1,t,e);m.colCount>c.colCount&&(u=m)}this.setOptionValue(h.getElementId(),this.constructionRules.correctLadder.optLadderRight,u.optLadder,e)}var d=t.getSizeOfHighesRow(!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(d)>=0){var g=t.getAllElementsInRow(d-1,!1);for(o=0;o<g.length;o++){var E=g[o];this.setOptionDoShow(E.getElementId(),this.constructionRules.correctLadder.optHasHeight,e)}}}}},{key:"correctSeries",value:function correctSeries(t,e){for(var n=!1,o=t.getAllElementIdsInGrid(),i=!1,s=!1,l=0;l<o.length;l++){var r=o[l];this.getElementIsCornerElement(t.getElementById(r),e)&&(i=!0),this.checkArticleHasOption(r,"OPTBR_ABDECKPLATTE")&&this.setOptionDoHide(r,"OPTBR_ABDECKPLATTE",e);var a=this.getOptionVal(r,"OPTABDECKPLATTE",e);this.checkArticleHasOption(r,"OPTABDECKPLATTE")&&"OPVMIT_PLATTE"==a&&(n=!0),"OPVBR_18"==this.getOptionVal(r,"OPTBR",e)&&(s=!0)}if(!t.getPlannerHasActiveBackside()&&t.getPlannerElementAtGridPos(0,0,!1)){for(var h=t.getSizeOfHighesRow(!1),c=[],u=[],m=[],d=0,g=0,E=t.getAllElementsInColumn(g,!1);null!=E;){if(E.length==h){var I=E[h-1];m.push(I),"OPVBR_75"==(a=this.getOptionVal(I.ElementId,"OPTBR",e))?d+=75:"OPVBR_18"==a?d+=18.75:"OPVBR_37"==a&&(d+=37.5),this.setOptionDoHide(I.ElementId,"OPTOBEN",e)}else m.length>0&&(c.push(m),u.push(d)),m=[],d=0;g++,E=t.getAllElementsInColumn(g,!1)}for(m.length>0&&(c.push(m),u.push(d)),l=0;l<c.length;l++){var O=c[l][0],k="";if(this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_40")>=0&&Math.abs(u[l]-40.4)<3?k="OPVABDECKPLATTE_40":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_77")>=0&&Math.abs(u[l]-77.8)<3?k="OPVABDECKPLATTE_77":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_115")>=0&&Math.abs(u[l]-115.3)<3?k="OPVABDECKPLATTE_115":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_152")>=0&&Math.abs(u[l]-152.8)<3?k="OPVABDECKPLATTE_152":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_190")>=0&&Math.abs(u[l]-190.3)<3?k="OPVABDECKPLATTE_190":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_227")>=0&&Math.abs(u[l]-227.8)<3&&(k="OPVABDECKPLATTE_227"),""==k||i)for(var f=t.getAllElementsInGrid(),R=0;R<f.length;R++)this.checkArticleHasOption(f[R].getElementId(),"OPTABD_HIDE")&&this.setOptionDoShow(f[R].getElementId(),"OPTABD_HIDE",e);else for(var p=t.getAllElementsInGrid(),P=0;P<p.length;P++)this.checkArticleHasOption(p[P].getElementId(),"OPTABD_HIDE")&&this.setOptionDoHide(p[P].getElementId(),"OPTABD_HIDE",e);if(""==k||!n||i||s)for(var T=0;T<c[l].length;T++)this.setOptionDoShow(c[l][T].ElementId,"OPTOBEN",e);else this.setOptionValue(O.ElementId,"OPTBR_ABDECKPLATTE",k,e)}}}},{key:"correctForceOptOfElement",value:function correctForceOptOfElement(t,e,n,o){var i=e.getIndexInGridByElementId(t);if(i)for(var s=this.getCurOptionBasedConstructionRules(t,n),l=0;l<s.length;l++){if(s[l].forceOptions)for(var r=0;r<s[l].forceOptions.length;r++){var a=s[l].forceOptions[r];if(!a.rule||""==a.rule||this.evalRule(t,a.rule,n))for(var h=a.options,c=a.value,u=0;u<h.length;u++){var m=h[u],d=this.constructionRules.optionsVisibilityInfo[m];if(d.complementDir){var g=d.complementDir;o&&("LEFT"==g?g="RIGHT":"RIGHT"==g&&(g="LEFT"));var E=e.getNeighborElement(i.col,i.row,g,i.backside);if(null!=E){for(var I=this.getCurOptionBasedConstructionRules(E.ElementId,n),O=d.complementOPT,k=!1,f=0;f<I.length;f++)if(I[f].forceOptions)for(var R=0;R<I[f].forceOptions.length;R++){var p=I[f].forceOptions[R];if((!p.rule||""==p.rule||this.evalRule(E.ElementId,p.rule,n))&&(this.arrayContainsValue(p.options,O)&&(k=!0,"doShow"==c&&"doShow"==p.value&&("OPVFUELLUNG"==this.getOptionVal(t,"OPTELEMENT",n)&&"OPVFUELLUNG"==this.getOptionVal(E.ElementId,"OPTELEMENT",n)?(this.setOptionDoHide(E.ElementId,O,n),this.setOptionDoHide(E.ElementId,O,n)):this.setOptionDoShow(E.ElementId,O,n)),"doHide"==c&&"doHide"==p.value&&(this.setOptionDoHide(t,m,n),this.setOptionDoHide(E.ElementId,O,n)),"doShow"==c&&"doHide"==p.value||"doHide"==c&&"doShow"==p.value))){var P=!0;a.prio&&p.prio?P=a.prio<=p.prio:a.prio?P=!0:p.prio&&(P=!1),P?"doHide"==c?(this.setOptionDoHide(t,m,n),this.setOptionDoHide(E.ElementId,O,n)):"doShow"==c&&(this.setOptionDoShow(t,m,n),this.setOptionDoHide(E.ElementId,O,n)):"doHide"==p.value?(this.setOptionDoHide(t,m,n),this.setOptionDoHide(E.ElementId,O,n)):"doShow"==p.value&&(this.setOptionDoHide(t,m,n),this.setOptionDoShow(E.ElementId,O,n))}}k||("doShow"==c&&(this.setOptionDoShow(t,m,n),this.setOptionDoHide(E.ElementId,O,n)),"doHide"==c&&(this.setOptionDoHide(t,m,n),this.setOptionDoHide(E.ElementId,O,n)))}else"doShow"==c&&this.setOptionDoShow(t,m,n),"doHide"==c&&this.setOptionDoHide(t,m,n)}}}if(s[l].changeOptions)for(var T=0;T<s[l].changeOptions.length;T++){for(var V=!0,_=s[l].changeOptions[T].rule.split("&"),B=0;B<_.length;B++)if(_[B].indexOf("!=")>0){var v=_[B].split("!=")[0],G=_[B].split("!=")[1];this.getOptionVal(t,v,n)==G&&(V=!1)}else{v=_[B].split("=")[0],G=_[B].split("=")[1];this.getOptionVal(t,v,n)!=G&&(V=!1)}V&&(s[l].changeOptions[T].doShow&&this.setOptionDoShow(t,s[l].changeOptions[T].doShow,n),s[l].changeOptions[T].doHide&&this.setOptionDoHide(t,s[l].changeOptions[T].doHide,n),s[l].changeOptions[T].opt&&s[l].changeOptions[T].opv&&this.setOptionValue(t,s[l].changeOptions[T].opt,s[l].changeOptions[T].opv,n))}}}},{key:"correctNeighborCustomOLTs",value:function correctNeighborCustomOLTs(t,e,n){if(this.constructionRules.correctNeighborOPT&&0!=this.constructionRules.correctNeighborOPT.length)for(var o=0;o<this.constructionRules.correctNeighborOPT.length;o++){var i=e.getIndexInGridByElementId(t);if(this.setOptionValue(t,this.constructionRules.correctNeighborOPT[o].opt,"OPVOHNE",n),!i)return;var s=e.getNeighborElement(i.col,i.row,this.constructionRules.correctNeighborOPT[o].dir,i.backside);if(null!=s){var l=this.getOptionVal(s.ElementId,this.constructionRules.correctNeighborOPT[o].neighborOPT,n);""!=l&&this.setOptionValue(t,this.constructionRules.correctNeighborOPT[o].opt,l,n)}}}},{key:"doChangeRetailArticleNumbers",value:function doChangeRetailArticleNumbers(t,e){var n=t.getAllElementsInGrid();if(this.constructionRules.correctRetailArticleNumberByRule&&this.constructionRules.correctRetailArticleNumberByRule.length>0)for(var o=!0,i=0;i<this.constructionRules.correctRetailArticleNumberByRule.length;i++){var s=this.constructionRules.correctRetailArticleNumberByRule[i];if("global"==s.range){for(var l=0;l<n.length&&o;l++){this.evalRule(n[l].getElementId(),s.rule,e)||(o=!1)}if(o)return{doChange:!0,retailArticleRules:s.retailArticleRules}}}return{doChange:!1}}},{key:"setConstructionRules",value:function setConstructionRules(t){t&&t.constructionRules&&(this.constructionRules=t.constructionRules,this.partlistHelper.setConstructionRules(t.constructionRules),this.constructionRulesLoaded=!0)}},{key:"getConstructionRulesLoaded",value:function getConstructionRulesLoaded(){return this.constructionRulesLoaded}},{key:"updateOptionLogicBoxPlanner",value:(t=(0,o.Z)(a().mark((function _callee(t,e,n,o){var i,s,l,r,c,u,m;return a().wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(null!=this.constructionRules&&this.constructionRulesLoaded){a.next=3;break}return d.error(new h.GE("Error construction rules are not set for boxPlanner",{code:"WC_0012"})),a.abrupt("return");case 3:if(i=(new Date).getTime(),s=void 0,d.debug("BoxPlanner - updateOptionLogicInGrid start updateOptionLogicInGrid"),l=new Map,o)for(r=t.getAllElementIdsInGrid(),e=void 0,n=void 0,c=0;c<r.length;c++)this.getElementIsCornerElement(t.getElementById(r[c]),l)&&this.setOptionValue(r[c],"OPTELEMENT","OPVOFFENES_FACH",l);for(s=this.setAllOptToDefault(t,l,e,n),this.doCorrectAffectedElementsByOption(t,l,e,n),this.correctBottom(t,l,!1),t.getPlannerHasActiveBackside()&&this.correctBottom(t,l,!0),this.correctSeries(t,l),c=0;c<t.getColumnCount();c++)for(u=0;u<t.getRowCount(c);u++)this.correctSimpleOpt(c,u,t,l,!1);if(t.getPlannerHasActiveBackside())for(c=t.getColumnCount()-1;c>=0;c--)for(u=0;u<t.getRowCount(c);u++)this.correctSimpleOpt(c,u,t,l,!0);for(c=0;c<t.getColumnCount();c++)for(u=0;u<t.getRowCount(c);u++)this.correctForceOptOfElement(t.getPlannerElementAtGridPos(c,u,!1).ElementId,t,l,!1),this.correctNeighborCustomOLTs(t.getPlannerElementAtGridPos(c,u,!1).ElementId,t,l);if(t.getPlannerHasActiveBackside())for(c=t.getColumnCount()-1;c>=0;c--)for(u=0;u<t.getRowCount(c);u++)this.correctForceOptOfElement(t.getPlannerElementAtGridPos(c,u,!0).ElementId,t,l,!0),this.correctNeighborCustomOLTs(t.getPlannerElementAtGridPos(c,u,!0).ElementId,t,l);for(this.correctLadder(t,l),this.partlistHelper.calculateKnots(t,l),this.partlistHelper.calculateRahmen(t,l),c=0;c<t.getColumnCount();c++)for(u=0;u<t.getRowCount(c);u++)this.correctBack(t,l,t.getPlannerElementAtGridPos(c,u,!1).getElementId());return m=this.doChangeRetailArticleNumbers(t,l),a.next=25,this.updateCfgValuesByPlanner(l,void 0,this.constructionRules.partlistRules.bundleRules,m);case 25:return d.debug("BoxPlanner updateOptionLogic - Duration after setting Option Values of all Articles: "+((new Date).getTime()-i)),d.debug("BoxPlanner updateOptionLogic - Duration after setting updating configurator: "+((new Date).getTime()-i)),a.abrupt("return",s);case 28:case"end":return a.stop()}}),_callee,this)}))),function updateOptionLogicBoxPlanner(e,n,o,i){return t.apply(this,arguments)})},{key:"onElemDeleted",value:function onElemDeleted(t){this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.delete(t)}},{key:"onElementCopy",value:function onElementCopy(t,e){if(this.hideOptionsForConstruction.has(t)){var n=this.hideOptionsForConstruction.get(t);this.hideOptionsForConstruction.set(e,(0,c.Z)(n))}}},{key:"getHasMaxElemCountPerColumn",value:function getHasMaxElemCountPerColumn(){return null!=this.constructionRules.maxElemCountPerCol}},{key:"getMaxElemCountPerColumn",value:function getMaxElemCountPerColumn(){return this.constructionRules.maxElemCountPerCol}},{key:"getForceWholePlanningSameHeight",value:function getForceWholePlanningSameHeight(){return this.constructionRules.forceWholePlanningSameHeight}}]);var t}(),E=n(64357),I=n(25036),O=h.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),k=function(){return(0,s.Z)((function BoxPlannerGrid(t){(0,i.Z)(this,BoxPlannerGrid),(0,l.Z)(this,"plannedElementGrid",void 0),(0,l.Z)(this,"backModulPlannedElementGrid",void 0),(0,l.Z)(this,"hasActiveBackside",void 0),(0,l.Z)(this,"getValueOfOptionOfArticle",void 0),this.plannedElementGrid=new Array(new Array),this.backModulPlannedElementGrid=new Array(new Array),this.hasActiveBackside=!1,this.getValueOfOptionOfArticle=t}),[{key:"getGridColumnWidth",value:function getGridColumnWidth(t,e){for(var n=-1,o=e?this.backModulPlannedElementGrid:this.plannedElementGrid,i=0;i<o[t].length;i++){var s=o[t][i]?null==o[t][i].Width?0:o[t][i].Width:0;s>n&&(n=s)}return n}},{key:"getGridColumnHeight",value:function getGridColumnHeight(t){var e=0;if(this.plannedElementGrid.length>t)for(var n=this.plannedElementGrid[t],o=0;o<n.length;o++){var i;e+=null===(i=n[o])||void 0===i?void 0:i.Height}return e}},{key:"deleteGridPos",value:function deleteGridPos(t){var e=new Array,n=t.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(1==n[t.col].length)for(var o=0;o<n.length;o++)o!=t.col&&(o<t.col?e[o]=n[o]:e[o-1]=n[o]);else for(o=0;o<n.length;o++)if(o!=t.col)e[o]=n[o];else{e[o]=new Array;for(var i=0;i<n[o].length;i++)i!=t.row&&(e[o][i]=n[o][i])}t.backside?this.backModulPlannedElementGrid=e:this.plannedElementGrid=e}},{key:"getPlannerElementAtGridPos",value:function getPlannerElementAtGridPos(t,e,n){var o=n?this.backModulPlannedElementGrid:this.plannedElementGrid;if(o[t]&&o[t][e])return o[t][e]}},{key:"getIndexInGridByElementId",value:function getIndexInGridByElementId(t){for(var e=0;e<this.plannedElementGrid.length;e++)for(var n=0;n<this.plannedElementGrid[e].length;n++)if(this.plannedElementGrid[e][n]&&this.plannedElementGrid[e][n].ElementId==t)return{col:e,row:n,backside:!1};for(e=0;e<this.backModulPlannedElementGrid.length;e++)for(n=0;n<this.backModulPlannedElementGrid[e].length;n++)if(this.backModulPlannedElementGrid[e][n]&&this.backModulPlannedElementGrid[e][n].ElementId==t)return{col:e,row:n,backside:!0};return{col:-1,row:-1,backside:!1}}},{key:"getAllElementIdsInGrid",value:function getAllElementIdsInGrid(){for(var t=[],e=0;e<this.plannedElementGrid.length;e++)for(var n=0;n<this.plannedElementGrid[e].length;n++)this.plannedElementGrid[e][n]&&t.push(this.plannedElementGrid[e][n].ElementId);for(e=0;e<this.backModulPlannedElementGrid.length;e++)for(n=0;n<this.backModulPlannedElementGrid[e].length;n++)this.backModulPlannedElementGrid[e][n]&&t.push(this.backModulPlannedElementGrid[e][n].ElementId);return t}},{key:"getAllElementsInFrontGrid",value:function getAllElementsInFrontGrid(){for(var t=[],e=0;e<this.plannedElementGrid.length;e++)for(var n=0;n<this.plannedElementGrid[e].length;n++)t.push(this.plannedElementGrid[e][n]);return t}},{key:"getAllElementsInBackGrid",value:function getAllElementsInBackGrid(){for(var t=[],e=0;e<this.backModulPlannedElementGrid.length;e++)for(var n=0;n<this.backModulPlannedElementGrid[e].length;n++)t.push(this.backModulPlannedElementGrid[e][n]);return t}},{key:"getAllElementsInGrid",value:function getAllElementsInGrid(){for(var t=[],e=0;e<this.plannedElementGrid.length;e++)for(var n=0;n<this.plannedElementGrid[e].length;n++)t.push(this.plannedElementGrid[e][n]);for(e=0;e<this.backModulPlannedElementGrid.length;e++)for(n=0;n<this.backModulPlannedElementGrid[e].length;n++)this.backModulPlannedElementGrid[e][n]&&t.push(this.backModulPlannedElementGrid[e][n]);return t}},{key:"getElementById",value:function getElementById(t){var e=this.getIndexInGridByElementId(t);return(e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid)[e.col][e.row]}},{key:"getElementIsFirstInGrid",value:function getElementIsFirstInGrid(t){var e=this.getIndexInGridByElementId(t);return 0==e.col&&0==e.row&&!e.backside}},{key:"getElementIsInLastCol",value:function getElementIsInLastCol(t,e){var n=e?this.backModulPlannedElementGrid:this.plannedElementGrid;return this.getIndexInGridByElementId(t).col+1==n.length}},{key:"getElementHasTopElement",value:function getElementHasTopElement(t){var e=this.getIndexInGridByElementId(t);return(e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid)[e.col].length>e.row+1}},{key:"getTopElement",value:function getTopElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(n[e.col].length>e.row+1)return n[e.col][e.row+1]}},{key:"getTopRightElement",value:function getTopRightElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(n.length>e.col+1&&null!=n[e.col+1][e.row+1])return n[e.col+1][e.row+1]}},{key:"getTopLeftElement",value:function getTopLeftElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(e.col>0&&null!=n[e.col-1][e.row-1])return n[e.col-1][e.row-1]}},{key:"getElementHasBottomElement",value:function getElementHasBottomElement(t){return this.getIndexInGridByElementId(t).row-1>=0}},{key:"getBottomElement",value:function getBottomElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(e.row-1>=0)return n[e.col][e.row-1]}},{key:"getElementHasRightElement",value:function getElementHasRightElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;return n.length>e.col+1&&null!=n[e.col+1][e.row]}},{key:"getRightElement",value:function getRightElement(t){var e=this.getIndexInGridByElementId(t),n=e.backside?this.backModulPlannedElementGrid:this.plannedElementGrid;if(n.length>e.col+1&&null!=n[e.col+1][e.row])return n[e.col+1][e.row]}},{key:"getElementHasLeftElement",value:function getElementHasLeftElement(t){var e=this.getIndexInGridByElementId(t);return e.col>0&&null!=this.getPlannerElementAtGridPos(e.col-1,e.row,e.backside)}},{key:"getLeftElement",value:function getLeftElement(t){var e=this.getIndexInGridByElementId(t);if(e.col>0&&null!=this.getPlannerElementAtGridPos(e.col-1,e.row,e.backside))return this.getPlannerElementAtGridPos(e.col-1,e.row,e.backside)}},{key:"getAllElementsInColumn",value:function getAllElementsInColumn(t,e){var n=e?this.backModulPlannedElementGrid:this.plannedElementGrid,o=new Array;if(!(t>=n.length)){for(var i=0;i<n[t].length;i++)n[t][i]&&o.push(n[t][i]);return n.length>t?o:void 0}}},{key:"getColumnCount",value:function getColumnCount(){return this.plannedElementGrid.length}},{key:"getRowCount",value:function getRowCount(t){return this.plannedElementGrid[t].length}},{key:"getAllElementsInRow",value:function getAllElementsInRow(t,e){for(var n=e?this.backModulPlannedElementGrid:this.plannedElementGrid,o=[],i=0;i<n.length;i++)n[i].length>t&&o.push(n[i][t]);return o}},{key:"getSizeOfHighesRow",value:function getSizeOfHighesRow(t){for(var e=t?this.backModulPlannedElementGrid:this.plannedElementGrid,n=0,o=0;o<e.length;o++)n<e[o].length&&(n=e[o].length);return n}},{key:"getNeighborElement",value:function getNeighborElement(t,e,n,o){var i=t,s=e;switch(n){case"TOP":s++;break;case"DOWN":s--;break;case"LEFT":i--;break;case"RIGHT":i++;break;case"BACK":this.hasActiveBackside&&(o=!o)}return this.getPlannerElementAtGridPos(i,s,o)}},{key:"getOppositeElement",value:function getOppositeElement(t){if(this.hasActiveBackside){var e=this.getIndexInGridByElementId(t);return e.backside?this.plannedElementGrid[e.col][e.row]:this.backModulPlannedElementGrid[e.col][e.row]}}},{key:"getAllOppositeElements",value:function getAllOppositeElements(t){var e=[];if(this.hasActiveBackside)for(var n=0;n<t.length;n++){var o=this.getIndexInGridByElementId(t[n]);o.backside?e.push(this.plannedElementGrid[o.col][o.row].getElementId()):this.backModulPlannedElementGrid[o.col][o.row]&&e.push(this.backModulPlannedElementGrid[o.col][o.row].getElementId())}return e}},{key:"getSizeOfWholeSet",value:function getSizeOfWholeSet(){for(var t=0,e=0,n=0,o=0;o<this.plannedElementGrid.length;o++){for(var i=0,s=0;s<this.plannedElementGrid[o].length;s++){var l=this.plannedElementGrid[o][s];i+=l.getHeight(),0==o&&0==s&&(e=l.getDepth())}i>n&&(n=i);var r=this.getGridColumnWidth(o,!1);o>0&&(77.9==r?r=75:40.4==r?r=37.5:21.7==r&&(r=18.75)),t+=r}return this.hasActiveBackside&&(e*=2),new E.P(t,n,e)}},{key:"getAllElementsInSameRowByElementId",value:function getAllElementsInSameRowByElementId(t){var e=this.getIndexInGridByElementId(t),n=this.getAllElementsInRow(e.row,!1);return this.hasActiveBackside&&(n=n.concat(this.getAllElementsInRow(e.row,!0))),{elementIds:n.map((function(t){return t.ElementId})),plannerElements:n,backside:e.backside}}},{key:"getAllElementsDown",value:function getAllElementsDown(t){var e=this.getIndexInGridByElementId(t);if(0==e.row)return{elements:[],backside:!1};for(var n=[],o=0;o<e.row;o++){var i=this.getPlannerElementAtGridPos(e.col,o,e.backside);null!=i&&n.push(i.ElementId)}return{elements:n,backside:e.backside}}},{key:"getAllElementsInSameCol",value:function getAllElementsInSameCol(t){var e=this.getIndexInGridByElementId(t),n=this.getAllElementsInColumn(e.col,e.backside);return null==n&&(n=[]),{elements:n.map((function(t){return t.ElementId})),backside:e.backside}}},{key:"prepareGridForCopy",value:function prepareGridForCopy(t,e){var n=this.getIndexInGridByElementId(t),o=0;switch(e){case"AVL":o=n.col;break;case"AVR":o=n.col+1}for(var i=new Array,s=0;s<this.plannedElementGrid.length+1;s++)i[s]=new Array;for(s=0;s<this.plannedElementGrid.length;s++)for(var l=0;l<this.plannedElementGrid[s].length;l++)s<o?i[s][l]=this.plannedElementGrid[s][l]:i[s+1][l]=this.plannedElementGrid[s][l];if(this.plannedElementGrid=i,this.hasActiveBackside){i=new Array;for(s=0;s<this.backModulPlannedElementGrid.length+1;s++)i[s]=new Array;for(s=0;s<this.backModulPlannedElementGrid.length;s++)for(l=0;l<this.backModulPlannedElementGrid[s].length;l++)s<o?i[s][l]=this.backModulPlannedElementGrid[s][l]:i[s+1][l]=this.backModulPlannedElementGrid[s][l];this.backModulPlannedElementGrid=i}}},{key:"prepareGridForBackSideCopy",value:function prepareGridForBackSideCopy(){this.backModulPlannedElementGrid=new Array;for(var t=0;t<this.plannedElementGrid.length;t++)this.backModulPlannedElementGrid.push(new Array);this.hasActiveBackside=!0}},{key:"addElementAtGridPos",value:function addElementAtGridPos(t,e,n,o){var i=o?this.backModulPlannedElementGrid:this.plannedElementGrid;i&&0!=i.length||(i=new Array),i[e]&&0!=i[e].length||(i[e]=new Array),i[e][n]=t,o?(this.hasActiveBackside=!0,this.backModulPlannedElementGrid=i):this.plannedElementGrid=i}},{key:"addElementAsCopy",value:function addElementAsCopy(t,e,n){var o=this.getIndexInGridByElementId(t),i=o.backside?this.backModulPlannedElementGrid:this.plannedElementGrid,s=!0;switch(n){case"AVR":i[o.col+1][o.row]=e;break;case"AVL":i[o.col-1][o.row]=e;break;case"AVO":i[o.col][o.row+1]=e;break;case"BACKSIDE":this.backModulPlannedElementGrid[o.col][o.row]=e,s=!1}s&&(o.backside?this.backModulPlannedElementGrid=i:this.plannedElementGrid=i)}},{key:"deleteElement",value:function deleteElement(t,e){var n=this.getIndexInGridByElementId(t),o=[];!this.hasActiveBackside||e&&"BoxPlanner_backside"==e||o.push(this.backModulPlannedElementGrid[n.col][n.row]),o.push(this.plannedElementGrid[n.col][n.row]);for(var i=[],s=0;s<o.length;s++)I.Z.removeDockingPointRelations(o[s]),e&&"BoxPlanner_backside"==e?e&&"BoxPlanner_backside"==e&&(this.backModulPlannedElementGrid[n.col][n.row]=void 0):this.deleteGridPos(this.getIndexInGridByElementId(o[s].ElementId)),i.push(o[s].getElementId());return i}},{key:"updateWorldPosOfElements",value:function updateWorldPosOfElements(){for(var t=0;t<this.plannedElementGrid.length;t++)for(var e=0;e<this.plannedElementGrid[t].length;e++){var n=this.plannedElementGrid[t][e];I.Z.removeDockingPointRelations(n)}if(this.hasActiveBackside)for(t=0;t<this.backModulPlannedElementGrid.length;t++)for(e=0;e<this.backModulPlannedElementGrid[t].length;e++){var o=this.backModulPlannedElementGrid[t][e];o&&I.Z.removeDockingPointRelations(o)}var i=1;for(t=0;t<this.plannedElementGrid.length;t++){for(e=0;e<this.plannedElementGrid[t].length;e++){var s=this.plannedElementGrid[t][e];this.plannedElementGrid[t]&&this.plannedElementGrid[t][e+1]&&I.Z.tryDockElement(s,"AVO",[this.plannedElementGrid[t][e+1]]),s.PosNr=i,i++}this.plannedElementGrid[t+1]&&this.plannedElementGrid[t+1][0]&&I.Z.tryDockElement(this.plannedElementGrid[t][0],"AVR",[this.plannedElementGrid[t+1][0]])}if(this.hasActiveBackside)for(t=0;t<this.backModulPlannedElementGrid.length;t++){for(e=0;e<this.backModulPlannedElementGrid[t].length;e++){var l=this.backModulPlannedElementGrid[t][e],r=this.plannedElementGrid[t][e].getDockingPointById("AVO_AVO_2_IL");r?l&&I.Z.tryDockElementToDP(l,this.plannedElementGrid[t][e],r):O.error(new h.GE("Error Loading DockingPoint AVO_2 for plannerElement")),this.backModulPlannedElementGrid[t]&&this.backModulPlannedElementGrid[t][e+1]&&l&&this.backModulPlannedElementGrid[t][e+1]&&I.Z.tryDockElement(l,"AVO",[this.backModulPlannedElementGrid[t][e+1]]),l&&(l.PosNr=i),i++}this.backModulPlannedElementGrid[t+1]&&this.backModulPlannedElementGrid[t+1][0]&&this.backModulPlannedElementGrid[t][0]&&I.Z.tryDockElement(this.backModulPlannedElementGrid[t][0],"AVL",[this.backModulPlannedElementGrid[t+1][0]])}}},{key:"destroyBoxPlannerGrid",value:function destroyBoxPlannerGrid(){for(var t=0;t<this.plannedElementGrid.length;t++){for(var e=0;e<this.plannedElementGrid[t].length;e++){this.plannedElementGrid[t][e].destroy()}this.plannedElementGrid[t]=[]}if(this.plannedElementGrid=[],this.hasActiveBackside){this.hasActiveBackside=!1;for(t=0;t<this.backModulPlannedElementGrid.length;t++){for(e=0;e<this.backModulPlannedElementGrid[t].length;e++){var n=this.backModulPlannedElementGrid[t][e];n&&n.destroy()}this.backModulPlannedElementGrid[t]=[]}this.backModulPlannedElementGrid=[]}}},{key:"getAllElementsInBacksideModuleGrid",value:function getAllElementsInBacksideModuleGrid(){for(var t=[],e=0;e<this.backModulPlannedElementGrid.length;e++)for(var n=0;n<this.backModulPlannedElementGrid[e].length;n++)this.backModulPlannedElementGrid[e][n]&&t.push(this.backModulPlannedElementGrid[e][n].ElementId);return t}},{key:"destroyBacksideModuleGrid",value:function destroyBacksideModuleGrid(){this.hasActiveBackside=!1;for(var t=[],e=0;e<this.backModulPlannedElementGrid.length;e++){for(var n=0;n<this.backModulPlannedElementGrid[e].length;n++){var o=this.backModulPlannedElementGrid[e][n];o&&(t.push(o.ElementId),o.destroy())}this.backModulPlannedElementGrid[e]=[]}this.backModulPlannedElementGrid=[]}},{key:"getPlannerHasActiveBackside",value:function getPlannerHasActiveBackside(){return this.hasActiveBackside}},{key:"getBoundingBox",value:function getBoundingBox(){var t,e=0,n=0,o=0,i=0,s=0,l=this.plannedElementGrid[0][0].getDepth(),r=0;t="RIGHT";for(var a=0;a<this.plannedElementGrid.length;a++){var h=this.plannedElementGrid[a][0],c=this.getValueOfOptionOfArticle(h.getElementId(),"OPTELEMENT");"RIGHT"==t?i+=this.plannedElementGrid[a][0].getWidth():"FRONT"==t?l+=this.plannedElementGrid[a][0].getWidth():"LEFT"==t?i-=this.plannedElementGrid[a][0].getWidth():"BACK"==t&&(l-=this.plannedElementGrid[a][0].getWidth()),"OPVECK_I"==c?"RIGHT"==t?t="FRONT":"FRONT"==t?t="LEFT":"LEFT"==t?t="BACK":"BACK"==t&&(t="RIGHT"):"OPVECK_A"==c&&("RIGHT"==t?t="BACK":"FRONT"==t?t="RIGHT":"LEFT"==t?t="FRONT":"BACK"==t&&(t="LEFT")),i<n&&(n=i),i>o&&(o=i),l<s&&(s=l),l>r&&(r=l);var u=this.getGridColumnHeight(a);e=e<u?u:e}var m=r-s,d=o-n;return this.hasActiveBackside&&(m=2*this.plannedElementGrid[0][0].getDepth()),{width:Math.round(1e3*d)/1e3,height:Math.round(1e3*e)/1e3,depth:Math.round(1e3*m)/1e3}}}])}(),f=n(86829),R=n(57312),p=n(58178),P=h.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),T=function(){function DivaBoxPlanner(t,e){(0,i.Z)(this,DivaBoxPlanner),(0,l.Z)(this,"set",void 0),(0,l.Z)(this,"plannerID",void 0),(0,l.Z)(this,"constructionRulesHandler",void 0),(0,l.Z)(this,"boxPlannerGrid",void 0),(0,l.Z)(this,"nextElementId",1),this.set=t,this.plannerID=e,this.constructionRulesHandler=new g(this.set.getValueOfOptionOfArticle,this.set.checkArticleHasOption,this.set.updateCfgValuesByPlanner),this.boxPlannerGrid=new k(this.set.getValueOfOptionOfArticle)}return(0,s.Z)(DivaBoxPlanner,[{key:"initPlanner",value:(u=(0,o.Z)(a().mark((function _callee(t){var e,n,o,i,s,l,r,c,u,m;return a().wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(null==(e=JSON.parse(h.ZP.decodeBase64(t))).v||2!=e.v){a.next=26;break}if(e.set&&e.set.elements&&0!=e.set.elements.length){a.next=4;break}return a.abrupt("return");case 4:n=e.set.elements,o=0;case 6:if(!(o<n.length)){a.next=21;break}return i=n[o],s=parseInt(i.elementID),l=new R.Z(this.set.getSetId(),i.basketID,s,DivaBoxPlanner.plannerType),this.nextElementId<s+1&&(this.nextElementId=s+1),this.set.setElementId(i.basketID,l.ElementId),this.constructionRulesHandler.getConstructionRulesLoaded()||this.constructionRulesHandler.setConstructionRules(this.set.getConstructionRuleOfElementId(l.ElementId)),(r=this.set.getPlannerData(l.ElementId))&&l.updatePlannerData(r),a.next=17,f.Z.loadSVG(l,this.set);case 17:this.boxPlannerGrid.addElementAtGridPos(l,i.boxPlannerInfo.gridPosCol,i.boxPlannerInfo.gridPosRow,i.boxPlannerInfo.isOnBackside);case 18:o++,a.next=6;break;case 21:return this.boxPlannerGrid.updateWorldPosOfElements(),a.next=24,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 24:a.next=42;break;case 26:c=1,o=0;case 28:if(!(o<e.Elements.length)){a.next=38;break}return u=e.Elements[o],(s=parseInt(u.ID))>c&&(c=s),m={boxElementID:u.ID,boxCol:u.col,boxRow:u.row,boxUpdateWholePlanning:!1},a.next=35,this.addPlannerElement(u.BasketID,m);case 35:o++,a.next=28;break;case 38:return this.nextElementId=c+1,this.boxPlannerGrid.updateWorldPosOfElements(),a.next=42,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 42:return a.abrupt("return",e);case 43:case"end":return a.stop()}}),_callee,this)}))),function initPlanner(t){return u.apply(this,arguments)})},{key:"saveSetPlanner",value:function saveSetPlanner(){for(var t=[],e=this.boxPlannerGrid.getAllElementIdsInGrid(),n=0;n<e.length;n++){var o=this.boxPlannerGrid.getElementById(e[n]);if(o){for(var i=this.boxPlannerGrid.getIndexInGridByElementId(e[n]),s=o.getDockingDockingPoints(),l=[],r=0;r<s.length;r++){var a,h={id:s[r].DpId,onID:s[r].OnElementId,onDPID:null===(a=s[r].OnDP)||void 0===a?void 0:a.DpId};l.push(h)}var c={elementID:o.getElementId(),basketID:this.set.getBasketId(o.getElementId()),CatalogCodex:this.set.getCatalogCodex(),Codex:this.set.getArticleCodex(o.getElementId()),posNr:o.PosNr,x:o.WorldPosCenter.x,y:o.WorldPosCenter.y,z:o.WorldPosCenter.z,rot:o.RotDeg,width:o.Width?o.Width:-1,height:o.Height?o.Height:-1,depth:o.Depth?o.Depth:-1,DP:l,boxPlannerInfo:{gridPosCol:i.col,gridPosRow:i.row,isOnBackside:i.backside}};t.push(c)}}var u=this.boxPlannerGrid.getBoundingBox();return{setId:this.set.getSetId(),x:0,y:0,z:0,width:u.width,height:u.height,depth:u.depth,rot:0,elements:t}}},{key:"addPlannerElement",value:(c=(0,o.Z)(a().mark((function _callee2(t,e){var n,o;return a().wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:if(null!=e&&null!=e.boxElementID&&null!=e.boxCol&&null!=e.boxRow){i.next=2;break}return i.abrupt("return");case 2:return n=new R.Z(this.set.getSetId(),t,e.boxElementID,DivaBoxPlanner.plannerType),this.nextElementId=isNaN(e.boxElementID)?this.nextElementId:e.boxElementID+1,this.set.setElementId(t,n.ElementId),o=this.set.getPlannerData(n.ElementId),n.updatePlannerData(o),i.next=9,f.Z.loadSVG(n,this.set);case 9:if(this.constructionRulesHandler.getConstructionRulesLoaded()||this.constructionRulesHandler.setConstructionRules(this.set.getConstructionRuleOfElementId(n.ElementId)),this.boxPlannerGrid.addElementAtGridPos(n,e.boxCol,e.boxRow,null!=e.backside&&e.backside),!e.boxUpdateWholePlanning){i.next=15;break}return this.boxPlannerGrid.updateWorldPosOfElements(),i.next=15,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 15:case"end":return i.stop()}}),_callee2,this)}))),function addPlannerElement(t,e){return c.apply(this,arguments)})},{key:"extendPlanner",value:(r=(0,o.Z)(a().mark((function _callee3(t,e){return a().wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return");case 1:case"end":return t.stop()}}),_callee3)}))),function extendPlanner(t,e){return r.apply(this,arguments)})},{key:"copyPlannerElement",value:(n=(0,o.Z)(a().mark((function _callee4(t,e){var n,o,i,s,l,r,h,c=this;return a().wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:if(n=!1,e){a.next=3;break}return a.abrupt("return");case 3:"STD"==e.copyType&&(e.targetElements=[]),o=[],i=this,s="AVR","BoxPlanner_backside"==e.copyType?s="BACKSIDE":"STD"!=e.copyType&&"BoxPlanner_COL"!=e.copyType||("AVR"==e.dpType?s="AVR":"AVO"==e.dpType?s="AVO":"AVL"==e.dpType&&(s="AVL")),t.forEach((function(t,i){var l;n||(!e||"AVL"!=e.dpType&&"AVR"!=e.dpType?e&&e.copyType&&"BoxPlanner_backside"==e.copyType&&(c.boxPlannerGrid.getPlannerHasActiveBackside()||c.boxPlannerGrid.prepareGridForBackSideCopy()):c.boxPlannerGrid.prepareGridForCopy(i,e.dpType)),n=!0;var r=new R.Z(c.set.getSetId(),t,c.nextElementId,DivaBoxPlanner.plannerType);c.nextElementId++,c.set.setElementId(t,r.ElementId);var a=c.set.getPlannerData(r.ElementId);r.updatePlannerData(a),c.boxPlannerGrid.addElementAsCopy(i,r,s),c.constructionRulesHandler.onElementCopy(i,r.getElementId()),o.push(r),"STD"==e.copyType&&(null===(l=e.targetElements)||void 0===l||l.push(r.getElementId()))})),l=0;case 10:if(!(l<o.length)){a.next=17;break}return a.next=13,f.Z.loadSVG(o[l],this.set);case 13:if("AVO"==s&&this.constructionRulesHandler.getHasMaxElemCountPerColumn()&&i.boxPlannerGrid.getIndexInGridByElementId(o[l].ElementId).row+1==i.constructionRulesHandler.getMaxElemCountPerColumn())for(r=o[l].getFreeDockingPointsByType("AVO"),h=0;h<r.length;h++)r[h].disableDP(!0);case 14:l++,a.next=10;break;case 17:return this.boxPlannerGrid.updateWorldPosOfElements(),a.next=20,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,e.changedOPT,e.targetElements);case 20:case"end":return a.stop()}}),_callee4,this)}))),function copyPlannerElement(t,e){return n.apply(this,arguments)})},{key:"initIDM3DMeta",value:function initIDM3DMeta(t){P.debug("No IDM3D Planner for BoxPlanner")}},{key:"getPlannerElementsInfluencedByDeletion",value:function getPlannerElementsInfluencedByDeletion(t){return this.constructionRulesHandler.getForceWholePlanningSameHeight()?0==this.boxPlannerGrid.getIndexInGridByElementId(t).row?[]:this.boxPlannerGrid.getAllElementsInSameRowByElementId(t).elementIds.filter((function(e){return e!=t})):[]}},{key:"getPlannerElementsInfluencedByCopy",value:function getPlannerElementsInfluencedByCopy(t,e){var n=[];if(e&&"NO"==(null==e?void 0:e.dpType)&&"BoxPlanner_backside"==e.copyType)return this.boxPlannerGrid.getAllElementIdsInGrid();if(e&&"BoxPlanner_COL"==e.copyType){for(var o=this.boxPlannerGrid.getIndexInGridByElementId(t),i=this.boxPlannerGrid.getAllElementsInColumn(o.col,o.backside),s=0;s<i.length;s++)n.push(i[s].getElementId());return n}if(n.push(t),e){switch(e.dpType){case"AVL":case"AVR":if(this.constructionRulesHandler.getForceWholePlanningSameHeight()){var l=this.boxPlannerGrid.getAllElementsInSameCol(t);n=l.elements,l.backside}else{var r=this.boxPlannerGrid.getAllElementsDown(t);n=n.concat(r.elements),r.backside}break;case"AVO":if(this.constructionRulesHandler.getForceWholePlanningSameHeight()){var a=this.boxPlannerGrid.getAllElementsInSameRowByElementId(t);n=a.elementIds,a.backside}}this.boxPlannerGrid.getPlannerHasActiveBackside()&&(n=n.concat(this.boxPlannerGrid.getAllOppositeElements(n)))}return n}},{key:"deletePlannerElement",value:(e=(0,o.Z)(a().mark((function _callee5(t,e,n){var o,i,s,l,r,h,c,u;return a().wrap((function _callee5$(e){for(;;)switch(e.prev=e.next){case 0:for(o=this.boxPlannerGrid.getIndexInGridByElementId(t),i={row:o.row,col:o.col,backside:o.backside},n&&"BoxPlanner_backside"==n?i={row:0,col:0,backside:!1}:o.row>0?i.row--:(s=0==o.col?0:o.col-1,(l=this.boxPlannerGrid.getAllElementsInColumn(s,o.backside))&&l.length>0&&(i.col=s,i.row=l.length-1)),r=this.boxPlannerGrid.deleteElement(t,n),h=0;h<r.length;h++)this.constructionRulesHandler.onElemDeleted(r[h]);if(c=!0,n&&"BoxPlanner_backside"==n&&(0==this.boxPlannerGrid.getAllElementsInBacksideModuleGrid().length?(this.boxPlannerGrid.destroyBacksideModuleGrid(),c=!0):c=!1),!c){e.next=11;break}return this.boxPlannerGrid.updateWorldPosOfElements(),e.next=11,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 11:if(!this.boxPlannerGrid.getPlannerElementAtGridPos(i.col,i.row,i.backside)){e.next=13;break}return e.abrupt("return",{newElementToSelect:null===(u=this.boxPlannerGrid.getPlannerElementAtGridPos(i.col,i.row,i.backside))||void 0===u?void 0:u.getElementId()});case 13:return e.abrupt("return",{});case 14:case"end":return e.stop()}}),_callee5,this)}))),function deletePlannerElement(t,n,o){return e.apply(this,arguments)})},{key:"getAllViewPlannerElements",value:function getAllViewPlannerElements(){return this.boxPlannerGrid.getAllElementsInGrid()}},{key:"getNeighborElements",value:function getNeighborElements(t,e){var n=this.boxPlannerGrid.getElementById(t);if(!n)return[];var o=null==n?void 0:n.getDockingDockingPointsByType(e);if(!o)return[];for(var i=[],s=0;s<(null==o?void 0:o.length);s++)null!=o[s]&&i.push(o[s].OnElementId);return i}},{key:"getFreeDockingPointsByElementId",value:function getFreeDockingPointsByElementId(t,e){return{dockingPoints:[],filter:[]}}},{key:"getDockedDockingPointsByElementId",value:function getDockedDockingPointsByElementId(t,e){return[]}},{key:"getDockedGroups",value:function getDockedGroups(){return[this.boxPlannerGrid.getAllElementIdsInGrid()]}},{key:"getBoundingBox",value:function getBoundingBox(){return P.warn("BoxPlanner - get2DViewPlannerBoundingBox not implemented yet","WC_0012"),new p.Z}},{key:"updatePlannerTrans",value:function updatePlannerTrans(t,e,n,o,i,s){return P.error(new h.GE("BoxPlanner - updatePlannerTrans not implemented yet",{code:"WC_0012"})),!1}},{key:"updatePlanner",value:(t=(0,o.Z)(a().mark((function _callee6(t,e){var n,o,i,s,l,r,h,c,u;return a().wrap((function _callee6$(a){for(;;)switch(a.prev=a.next){case 0:if(P.debug("BoxPlanner - configurationHasChanged "+t),!(t&&e&&e.length>0&&t.OPTELEMENT)||"OPVECK_I"!=t.OPTELEMENT&&"OPVECK_A"!=t.OPTELEMENT){a.next=18;break}if(!(e.length>1)){a.next=9;break}return a.next=5,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,e,!0);case 5:if(!(n=a.sent)){a.next=8;break}return a.abrupt("return",{elemIdsToDelete:[],viewMessageCodex:n});case 8:case 44:case 45:return a.abrupt("return",{elemIdsToDelete:[]});case 9:if(o=this.boxPlannerGrid.getIndexInGridByElementId(e[0]),i=e[0],o.row>0&&(i=this.boxPlannerGrid.getPlannerElementAtGridPos(o.col,0,!1).getElementId()),this.boxPlannerGrid.getElementHasLeftElement(i)&&this.boxPlannerGrid.getElementHasRightElement(i)){a.next=18;break}return s="NO",this.boxPlannerGrid.getElementHasLeftElement(i)||(s="AVL"),this.boxPlannerGrid.getElementHasRightElement(i)||(s="AVR"),l=this.getPlannerElementsInfluencedByCopy(i,{dpType:s,copyType:"BoxPlanner_COL"}),a.abrupt("return",{elemIdsToDelete:[],elementIdToCopy:l,copyDPType:s,copyType:"BoxPlanner_COL",ignoreOptionsToCopy:["OPTELEMENT"],changedOPT:t,targetElements:e});case 18:if(!t||!t.OPTDMOD){a.next=32;break}a.t0=t.OPTDMOD,a.next="OPVD_EIN"===a.t0?22:"OPVD_AUS"===a.t0?26:30;break;case 22:if(this.boxPlannerGrid.getPlannerHasActiveBackside()){a.next=25;break}return r=this.getPlannerElementsInfluencedByCopy(-1,{dpType:"NO",copyType:"BoxPlanner_backside"}),a.abrupt("return",{elemIdsToDelete:[],elementIdToCopy:r,copyType:"BoxPlanner_backside",changedOPT:t});case 25:case 29:return a.abrupt("break",30);case 26:if(!this.boxPlannerGrid.getPlannerHasActiveBackside()){a.next=29;break}return h=this.boxPlannerGrid.getAllElementsInBacksideModuleGrid(),a.abrupt("return",{elemIdsToDelete:h,deletionType:"BoxPlanner_backside",changedOPT:t});case 30:a.next=45;break;case 32:if(!(t&&t.OPTFARBE_RAHMEN&&"OPVSCHWARZ_MATT"==t.OPTFARBE_RAHMEN&&this.boxPlannerGrid.getPlannerHasActiveBackside())){a.next=37;break}return c=this.boxPlannerGrid.getAllElementsInBacksideModuleGrid(),a.abrupt("return",{elemIdsToDelete:c,deletionType:"BoxPlanner_backside",changedOPT:t,targetElements:e,viewMessageCodex:"BOXPLAN_BLACKFRAME_INCOMPATIBLE_ELEMENT_WARNING"});case 37:return a.next=39,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,e);case 39:if(!(u=a.sent)){a.next=44;break}return a.abrupt("return",{elemIdsToDelete:[],viewMessageCodex:u});case 46:case"end":return a.stop()}}),_callee6,this)}))),function updatePlanner(e,n){return t.apply(this,arguments)})},{key:"getSetData",value:function getSetData(t,e,n,o){for(var i={ID:"S1",H:"",x:0,y:0,z:0,w:0,ELE:[],Blob:this.set.CatalogData.supplierILN,Cat:this.set.getCatalogCodex(),ShowDim:n},s=this.boxPlannerGrid.getAllElementsInGrid(),l=0;l<s.length;l++){var r=s[l],a=r.ElementId,c=this.set.getPlannerConfigData(a).config,u={ID:"E"+a,N:c.N,Model:c.Model,x:-r.WorldPosCenter.x,y:r.WorldPosCenter.y,z:r.WorldPosCenter.z,PosPivot:"Center",w:r.getRotDeg(),RotPivot:"Center",DP:r.getDockingPointJS3D(),MAT:c.MAT,CFG:c.CFG,H:""},m=(0,h.FB)(JSON.stringify(u));u.H=m,i.ELE.push(u)}m=(0,h.FB)(JSON.stringify(i));return i.H=m,{constructionSet:i}}},{key:"getPlannerId",value:function getPlannerId(){return this.plannerID}},{key:"getElementPosInfo",value:function getElementPosInfo(){P.error(new h.GE("BoxPlanner - getElementPosInfo not implemented yet",{code:"WC_0012"}))}},{key:"destroyPlanner",value:function destroyPlanner(){this.boxPlannerGrid.destroyBoxPlannerGrid()}},{key:"getCatalogData",value:function getCatalogData(){return this.set.CatalogData}},{key:"getPlannerBoundingBox",value:function getPlannerBoundingBox(){return this.boxPlannerGrid.getBoundingBox()}},{key:"updatePlannerBoundingBox",value:function updatePlannerBoundingBox(){}},{key:"getPlanningIsComplete",value:function getPlanningIsComplete(){return null!=this.boxPlannerGrid.getPlannerElementAtGridPos(0,0,!1)}},{key:"updateSetPosNr",value:function updateSetPosNr(t){for(var e=this.boxPlannerGrid.getAllElementIdsInGrid(),n=0;n<e.length;n++){var o=e[n],i=this.boxPlannerGrid.getElementById(o);i&&(i.SetPosNr=t+i.PosNr-1,this.set.setPosNr(i.ElementId,i.getPosNr()))}return e.length}},{key:"clonePlanner",value:function clonePlanner(t,e,n){var o=new DivaBoxPlanner(t,e);return o.initPlanner(n),o}}]);var t,e,n,r,c,u}();(0,l.Z)(T,"plannerType","BOX")}}]);