@crystaldesign/diva-web-planner-react 25.15.0-beta.7 → 25.15.0-beta.9
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 304.diva-web-planner-react.umd.min.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[304],{60304:(t,o,i)=>{i.r(o),i.d(o,{default:()=>C});var l=i(84658),r=i(13125),a=i(43860),h=i(80248),c=i(50747),u=i.n(c),d=i(98457),m=i(12952),g=i(34988),E=d.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),I=function(){return(0,a.Z)((function BoxPlannerPartlistHelper(t,o,i,l,a,c,u){(0,r.Z)(this,BoxPlannerPartlistHelper),(0,h.Z)(this,"constructionRules",void 0),(0,h.Z)(this,"getOptionVal",void 0),(0,h.Z)(this,"setOptionValue",void 0),(0,h.Z)(this,"getElementHasBottomPlate",void 0),(0,h.Z)(this,"getElementIsCornerElement",void 0),(0,h.Z)(this,"getCornerType",void 0),(0,h.Z)(this,"getElementHasTopPlate",void 0),(0,h.Z)(this,"getElementIsGarderobeElement",void 0),this.getOptionVal=t,this.getElementHasBottomPlate=i,this.setOptionValue=o,this.getElementIsCornerElement=l,this.getCornerType=a,this.getElementHasTopPlate=c,this.getElementIsGarderobeElement=u}),[{key:"setConstructionRules",value:function setConstructionRules(t){this.constructionRules=t}},{key:"getGroundPlatesNumOfRightNeighbors",value:function getGroundPlatesNumOfRightNeighbors(t,o,i){if(o.getForceSingleCellPerElement()){var l=0;if(this.getElementHasBottomPlate(t,i)&&l++,o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());if(this.getElementHasBottomPlate(r,i)&&l++,o.getElementHasRightElement(t.getElementId())){var a=o.getRightElements(t.getElementId());if(a.length>0){var h=a[0],c=o.getOppositeElement(h.getElementId());this.getElementHasBottomPlate(h,i)&&l++,this.getElementHasBottomPlate(c,i)&&l++}return l}return l}if(o.getElementHasRightElement(t.getElementId())){var u=o.getRightElements(t.getElementId());if(u.length>0){var m=u[0];this.getElementHasBottomPlate(m,i)&&l++}return l}return l}E.error(new d.GE("BoxPlannerError - function getGroundPlatesNumOfRightNeighbors not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"getTopPlatesNumOfRightNeighbors",value:function getTopPlatesNumOfRightNeighbors(t,o,i){if(o.getForceSingleCellPerElement()){var l=0;if(this.getElementHasTopPlate(t,o,i)&&l++,o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());if(this.getElementHasTopPlate(r,o,i)&&l++,o.getElementHasRightElement(t.getElementId())){var a=o.getRightElements(t.getElementId());if(a.length>0){var h=a[0],c=o.getOppositeElement(h.getElementId());this.getElementHasTopPlate(h,o,i)&&l++,this.getElementHasTopPlate(c,o,i)&&l++}return l}return l}if(o.getElementHasRightElement(t.getElementId())){var u=o.getRightElements(t.getElementId());if(u.length>0){var m=u[0];this.getElementHasTopPlate(m,o,i)&&l++}return l}return l}E.error(new d.GE("BoxPlannerError - function getTopPlatesNumOfRightNeighbors not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"getElementHeight",value:function getElementHeight(t,o){var i=this.getOptionVal(t.getElementId(),"OPTHOEHE",o);return"OPVH_6"==i?"6":"OPVH_11"==i?"11":"OPVH_18"==i?"18":"37"}},{key:"getElementDepth",value:function getElementDepth(t,o){var i=this.getOptionVal(t.getElementId(),"OPTTIEFE",o);return"OPVTIEFE_18"==i?"18":"37"}},{key:"getElementRahmenColor",value:function getElementRahmenColor(t,o){var i=this.getOptionVal(t.getElementId(),"OPTFARBE_RAHMEN",o);return"OPVCHROM"==i?"CHROM":"OPVSCHWARZ_MATT"==i?"BLACK":"CHROM"}},{key:"calculateRahmen",value:function calculateRahmen(t,o){for(var i=t.getAllElementsInGridSortedbyGridPos(),l=0;l<i.length;l++)this.constructionRules.VarticalRahmenInfo&&(this.correctRahmenVerticalLeftFront(i[l],t,o),this.correctRahmenVerticalLeftBack(i[l],t,o),this.correctRahmenVerticalRightFront(i[l],t,o),this.correctRahmenVerticalRightBack(i[l],t,o),E.debug("---------Correct Senkrechte Rahmen for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),E.debug("Senkrechter Rahmen links vorne: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_V",o)),E.debug("Senkrechter Rahmen links hinten: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_H",o)),E.debug("Senkrechter Rahmen rechts vorne : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_V",o)),E.debug("Senkrechter Rahmen rechts hinten : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_H",o))),this.constructionRules.DepthRahmenInfo&&(this.correctRahmenDepthLeftBottom(i[l],t,o),this.correctRahmenDepthLeftTop(i[l],t,o),this.correctRahmenDepthRightBottom(i[l],t,o),this.correctRahmenDepthRightTop(i[l],t,o),E.debug("---------Correct Tiefenverbinder Rahmen for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),E.debug("Tiefen Rahmen links unten: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_U",o)),E.debug("Tiefen Rahmen links oben: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_O",o)),E.debug("Tiefen Rahmen rechts unten : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_U",o)),E.debug("Tiefen Rahmen rechts oben : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_O",o)))}},{key:"correctRahmenDepthLeftBottom",value:function correctRahmenDepthLeftBottom(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId()))&&!o.getElementHasBottomElement(t.getElementId()))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(this.getElementHasBottomPlate(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}},{key:"correctRahmenDepthLeftTop",value:function correctRahmenDepthLeftTop(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(this.getElementIsCornerElement(t,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else if(this.getElementHasTopPlate(t,o,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}},{key:"correctRahmenDepthRightBottom",value:function correctRahmenDepthRightBottom(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId()))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(l){var r=o.getRightElements(t.getElementId());if(r.length>0){var a=r[0];if(!this.getElementHasBottomPlate(t,i)||this.getElementIsCornerElement(t,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else if(!this.getElementHasBottomPlate(a,i)||this.getElementIsCornerElement(a,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,i)}}else if(this.getElementHasBottomPlate(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":l?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,i):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}else E.error(new d.GE("BoxPlannerError - function correctRahmenDepthRightBottom not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenDepthRightTop",value:function correctRahmenDepthRightTop(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(!this.getElementHasTopPlate(t,o,i)||this.getElementIsCornerElement(t,i)){switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}return}if(!r)return void this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(a.length>0){var h=a[0];if(!this.getElementHasTopPlate(h,o,i)||this.getElementIsCornerElement(h,i)){switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}return}}this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,i);break;case"BLACK":r?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,i):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}else E.error(new d.GE("BoxPlannerError - function correctRahmenDepthRightTop not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenVerticalLeftFront",value:function correctRahmenVerticalLeftFront(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}},{key:"correctRahmenVerticalLeftBack",value:function correctRahmenVerticalLeftBack(t,o,i){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l&&!(l?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}},{key:"correctRahmenVerticalRightFront",value:function correctRahmenVerticalRightFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(a.length>0){var h=a[0];this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}else E.error(new d.GE("BoxPlannerError - function correctRahmenVerticalRightFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenVerticalRightBack",value:function correctRahmenVerticalRightBack(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i),o.getForceSingleCellPerElement()){var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l){var r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(0==a.length)return;if(a.length>0){var h=a[0];if(o.getPlannerHasActiveBackside()){var c=o.getOppositeElement(t.getElementId());if(!c)return;var u=o.getOppositeElement(h.getElementId());if(!u)return;this.getElementIsGarderobeElement(h,i)||this.getElementIsGarderobeElement(c,i)||this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}}else if(o.getPlannerHasActiveBackside()){var m=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(m,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}}else E.error(new d.GE("BoxPlannerError - function correctRahmenVerticalRightBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"calculateKnots",value:function calculateKnots(t,o){if(this.constructionRules.hasKNOTS)for(var i=t.getAllElementsInGridSortedbyGridPos(),l=0;l<i.length;l++)this.correctKnotLeftTopFront(i[l],t,o),this.correctKnotLeftTopBack(i[l],t,o),this.correctKnotLeftBottomFront(i[l],t,o),this.correctKnotLeftBottomBack(i[l],t,o),this.correctKnotRightTopFront(i[l],t,o),this.correctKnotRightTopBack(i[l],t,o),this.correctKnotRightBottomFront(i[l],t,o),this.correctKnotRightBottomBack(i[l],t,o),this.correctKnotRightMiddleBack(i[l],t,o),this.correctKnotLeftMiddleBack(i[l],t,o),E.debug("---------Correct Knots for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),E.debug("Links oben vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LTF",o)),E.debug("Links oben hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LTB",o)),E.debug("Links unten vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LBF",o)),E.debug("Links unten hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LBB",o)),E.debug("Rechts oben vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RTF",o)),E.debug("Rechts oben hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RTB",o)),E.debug("Rechts unten vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RBF",o)),E.debug("Links mitte hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LMB",o)),E.debug("Rechts mitte hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RMB",o)),E.debug("Rechts unten hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RBB",o))}},{key:"correctKnotLeftBottomFront",value:function correctKnotLeftBottomFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())&&(l||(o.getPlannerHasActiveBackside()&&this.getElementHasBottomPlate(t,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i),this.getElementHasBottomPlate(t,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i)),this.getElementIsCornerElement(t,i))){var r=o.getLeftElements(t.getElementId());if(r.length>0){var a=r[0];if(this.getElementIsCornerElement(a,i))return;var h=o.getRightElements(t.getElementId());if(h.length>0){var c=h[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasBottomPlate(a,i)?this.getElementHasBottomPlate(c,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.getElementHasBottomPlate(c,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasBottomPlate(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftBottomFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftTopFront",value:function correctKnotLeftTopFront(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i),o.getForceSingleCellPerElement()){var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(l||(o.getPlannerHasActiveBackside()&&this.getElementHasTopPlate(t,o,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i),this.getElementHasTopPlate(t,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i)),this.getElementIsCornerElement(t,i)){var r=o.getElementHasLeftElement(t.getElementId());if(l&&this.getElementIsCornerElement(o.getLeftElements(t.getElementId())[0],i))return;var a=o.getElementHasRightElement(t.getElementId());if(r||a){if(a&&!r){var h=o.getRightElements(t.getElementId());if(h.length>0){var c=h[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(c,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else if(!a&&r){var u=o.getLeftElements(t.getElementId());if(u.length>0){var m=u[0];this.getElementHasTopPlate(m,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3erer_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(a&&r){var g=o.getLeftElements(t.getElementId())[0],I=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(g,o,i)?this.getElementHasTopPlate(I,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.getElementHasTopPlate(I,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftTopFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftBottomBack",value:function correctKnotLeftBottomBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())){if(!l)if(o.getPlannerHasActiveBackside()&&!o.getCellsInGridByElementId(t.getElementId()).backside){var r=o.getOppositeElement(t.getElementId());r&&(this.getElementHasBottomPlate(t,i)?this.getElementHasBottomPlate(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.getElementHasBottomPlate(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else o.getPlannerHasActiveBackside()||this.getElementHasBottomPlate(t,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var a=o.getLeftElements(t.getElementId())[0];if(this.getElementIsCornerElement(a,i))return;switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasBottomPlate(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":var h=o.getRightElements(t.getElementId())[0];this.getElementHasBottomPlate(a,i)?this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i)}}}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftBottomBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftTopBack",value:function correctKnotLeftTopBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!l)if(o.getPlannerHasActiveBackside()&&!o.getCellsInGridByElementId(t.getElementId()).backside){var r=o.getOppositeElement(t.getElementId());r&&(this.getElementHasTopPlate(t,o,i)?this.getElementHasTopPlate(r,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.getElementHasTopPlate(r,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else o.getPlannerHasActiveBackside()||this.getElementHasTopPlate(t,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var a=o.getElementHasLeftElement(t.getElementId());if(l&&this.getElementIsCornerElement(o.getLeftElements(t.getElementId())[0],i))return;var h=o.getElementHasRightElement(t.getElementId());if(a||h){if(h&&!a){var c=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(c,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(!h&&a){var u=o.getLeftElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":case"OUTSIDE":this.getElementHasTopPlate(u,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(h&&a){var m=o.getLeftElements(t.getElementId())[0],g=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(m,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(m,o,i)?this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftTopBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightMiddleBack",value:function correctKnotRightMiddleBack(t,o,i){if(o.getForceSingleCellPerElement()){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i),this.getElementIsGarderobeElement(t,i)&&!o.getCellsInGridByElementId(t.getElementId()).backside)if(o.getElementHasRightElement(t.getElementId()))if(o.getPlannerHasActiveBackside()){var l=o.getOppositeElement(t.getElementId());if(!l)return;var r=o.getRightElements(t.getElementId());if(0==r.length)return;var a=r[0],h=o.getOppositeElement(a.getElementId());if(!h)return;this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.getElementIsGarderobeElement(l,i)?this.getElementIsGarderobeElement(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.getElementIsGarderobeElement(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else{var c=o.getRightElements(t.getElementId());if(0==c.length)return;var u=c[0];this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else if(o.getPlannerHasActiveBackside()){var m=o.getOppositeElement(t.getElementId());if(!m)return;this.getElementIsGarderobeElement(m,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else E.error(new d.GE("BoxPlannerError - function correctKnotRightMiddleBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftMiddleBack",value:function correctKnotLeftMiddleBack(t,o,i){if(o.getForceSingleCellPerElement()){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i),this.getElementIsGarderobeElement(t,i)){var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l){var r=l?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(r){var a=o.getLeftElements(t.getElementId())[0];if(this.getElementIsGarderobeElement(a,i))return}if(r)if(o.getPlannerHasActiveBackside()){var h=o.getLeftElements(t.getElementId());if(0==h.length)return;var c=h[0],u=o.getOppositeElement(t.getElementId());if(!u)return;var m=o.getOppositeElement(null==c?void 0:c.getElementId());if(!m)return;this.getElementIsGarderobeElement(m,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);else if(o.getPlannerHasActiveBackside()){var g=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(g,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftMiddleBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightBottomFront",value:function correctKnotRightBottomFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())){if(o.getPlannerHasActiveBackside())if(this.getElementHasBottomPlate(t,i))if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&(this.getElementHasBottomPlate(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);else if(this.getElementHasBottomPlate(t,i)){var m=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),g=void 0;m.length>0&&(g=m[0]),g&&!this.getElementHasBottomPlate(g,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}else if(r){var I=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),p=void 0;I.length>0&&(p=I[0]),p&&!this.getElementIsCornerElement(p,i)&&(this.getElementHasBottomPlate(p,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);if(this.getElementIsCornerElement(t,i))switch(this.getCornerType(t,i)){case"INSIDE":var O=o.getRightElements(t.getElementId())[0];if(O&&this.getElementIsCornerElement(O,i))if(o.getElementHasRightElement(O.getElementId())){var R=o.getRightElements(O.getElementId())[0];this.getElementHasBottomPlate(R,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else O&&this.getElementHasBottomPlate(O,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else E.error(new d.GE("BoxPlannerError - function correctKnotRightBottomFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightTopFront",value:function correctKnotRightTopFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(o.getPlannerHasActiveBackside())if(this.getElementHasTopPlate(t,o,i))if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasTopPlate(h,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&(this.getElementHasTopPlate(u,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);else if(this.getElementHasTopPlate(t,o,i)){if(r){var m=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),g=void 0;m.length>0&&(g=m[0]),g&&(this.getElementHasTopPlate(g,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}}else if(r){var I=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),p=void 0;I.length>0&&(p=I[0]),p&&!this.getElementIsCornerElement(p,i)&&(this.getElementHasTopPlate(p,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);if(this.getElementIsCornerElement(t,i)){var O=o.getElementHasLeftElement(t.getElementId()),R=o.getElementHasRightElement(t.getElementId());if(O||R){if(R&&!O){var k=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":if(this.getElementIsCornerElement(k,i))if(o.getElementHasRightElement(k.getElementId())){var P=o.getRightElements(k.getElementId())[0];this.getElementHasTopPlate(P,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(k,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(!R&&O){o.getLeftElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(R&&O){var v=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":if(this.getElementIsCornerElement(v,i))if(o.getElementHasRightElement(v.getElementId())){var T=o.getRightElements(v.getElementId())[0];this.getElementHasTopPlate(T,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(v,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else E.error(new d.GE("BoxPlannerError - function correctKnotRightTopFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightBottomBack",value:function correctKnotRightBottomBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())&&!o.getCellsInGridByElementId(t.getElementId()).backside){if(o.getPlannerHasActiveBackside())switch(this.getGroundPlatesNumOfRightNeighbors(t,o,i)){case 0:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i);break;case 1:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case 2:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);break;case 3:r&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i);break;case 4:r&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,i)}else if(this.getElementHasBottomPlate(t,i)){if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasBottomPlate(h,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i))}}else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&!this.getElementIsCornerElement(u,i)&&(this.getElementHasBottomPlate(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i))switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":var m=o.getRightElements(t.getElementId())[0];if(this.getElementIsCornerElement(m,i)){var g=o.getRightElements(m.getElementId())[0];this.getElementHasBottomPlate(g,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.getElementHasBottomPlate(m,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else E.error(new d.GE("BoxPlannerError - function correctKnotRightBottomBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightTopBack",value:function correctKnotRightTopBack(t,o,i){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getCellsInGridByElementId(t.getElementId()).backside){if(o.getPlannerHasActiveBackside())if(r)switch(this.getTopPlatesNumOfRightNeighbors(t,o,i)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i);break;case 3:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i);break;case 4:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,i)}else switch(this.getTopPlatesNumOfRightNeighbors(t,o,i)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else if(this.getElementHasTopPlate(t,o,i)){if(r){var a=l?o.getLeftElements(t.getElementId())[0]:o.getRightElements(t.getElementId())[0];this.getElementIsCornerElement(a,i)||this.getElementHasTopPlate(a,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(r){var h=l?o.getLeftElements(t.getElementId())[0]:o.getRightElements(t.getElementId())[0];h&&!this.getElementIsCornerElement(h,i)&&(this.getElementHasTopPlate(h,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var c=o.getElementHasLeftElement(t.getElementId()),u=o.getElementHasRightElement(t.getElementId());if(c||u){if(u&&!c){var d=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":if(this.getElementIsCornerElement(d,i))if(o.getElementHasRightElement(d.getElementId())){var m=o.getRightElements(d.getElementId())[0];this.getElementHasTopPlate(m,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(d,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(!u&&c)this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(u&&c){var g=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":if(this.getElementIsCornerElement(g,i))if(o.getElementHasRightElement(g.getElementId())){var E=o.getRightElements(g.getElementId())[0];this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}}])}();function _createForOfIteratorHelper(t,o){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function _unsupportedIterableToArray(t,o){if(t){if("string"==typeof t)return _arrayLikeToArray(t,o);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(t,o):void 0}}(t))||o&&t&&"number"==typeof t.length){i&&(t=i);var l=0,r=function F(){};return{s:r,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,h=!0,c=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){c=!0,a=t},f:function f(){try{h||null==i.return||i.return()}finally{if(c)throw a}}}}function _arrayLikeToArray(t,o){(null==o||o>t.length)&&(o=t.length);for(var i=0,l=Array(o);i<o;i++)l[i]=t[i];return l}var p=d.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),O=function(){return(0,a.Z)((function ConstructionRulesHandler(t,o,i){var l=this;(0,r.Z)(this,ConstructionRulesHandler),(0,h.Z)(this,"getValueOfOptionOfArticle",void 0),(0,h.Z)(this,"checkArticleHasOption",void 0),(0,h.Z)(this,"updateCfgValuesByPlanner",void 0),(0,h.Z)(this,"constructionRules",void 0),(0,h.Z)(this,"constructionRulesLoaded",void 0),(0,h.Z)(this,"hideOptionsForConstruction",void 0),(0,h.Z)(this,"partlistHelper",void 0),(0,h.Z)(this,"getOptionVal",(function(t,o,i){if(i.has(t)&&i.get(t).has(o)){var r=i.get(t).get(o);return null!=r?r:""}var a=l.getValueOfOptionOfArticle(t,o);return null!=a?a:""})),(0,h.Z)(this,"hasOptionValue",(function(t,o,i){return!(!i.has(t)||!i.get(t).has(o))||!!l.getValueOfOptionOfArticle(t,o)})),(0,h.Z)(this,"setOptionValue",(function(t,o,i,r){var a;if(r.has(t)||r.set(t,new Map),null===(a=r.get(t))||void 0===a||a.set(o,i),l.hideOptionsForConstruction.has(t)){var h=l.hideOptionsForConstruction.get(t).indexOf(o);h>=0&&l.hideOptionsForConstruction.get(t).splice(h,1)}})),(0,h.Z)(this,"getElementHasBottomPlate",(function(t,o){if(!t)return!1;if(l.constructionRules.knotInfo.elementsWithGroundPlate)for(var i=0;i<l.constructionRules.knotInfo.elementsWithGroundPlate.length;i++){var r=l.constructionRules.knotInfo.elementsWithGroundPlate[i].onOPT,a=l.constructionRules.knotInfo.elementsWithGroundPlate[i].onOPVs,h=l.getOptionVal(t.getElementId(),r,o);return l.arrayContainsValue(a,h)}return!1})),(0,h.Z)(this,"getElementIsCornerElement",(function(t,o){return!!t&&(l.constructionRules.hasCORNER&&l.arrayContainsValue(l.constructionRules.knotInfo.cornerElements.onOPVs,l.getOptionVal(t.getElementId(),l.constructionRules.knotInfo.cornerElements.onOPT,o)))})),(0,h.Z)(this,"getElementIsGarderobeElement",(function(t,o){return l.constructionRules.hasGARDEROBE&&l.arrayContainsValue(l.constructionRules.knotInfo.garderobeElements.onOPVs,l.getOptionVal(t.getElementId(),l.constructionRules.knotInfo.garderobeElements.onOPT,o))})),(0,h.Z)(this,"getCornerType",(function(t,o){return"OPVECK_I"==l.getOptionVal(t.getElementId(),"OPTELEMENT",o)?"INSIDE":"OPVECK_A"==l.getOptionVal(t.getElementId(),"OPTELEMENT",o)?"OUTSIDE":"NOCORNER"})),(0,h.Z)(this,"getElementHasTopPlate",(function(t,o,i){if(o.getElementHasTopElement(t.getElementId())){var r=o.getTopElements(t.getElementId()),a=!1;return l.getElementHasBottomPlate(r[0],i)&&(a=!0),a}return!0})),this.constructionRulesLoaded=!1,this.getValueOfOptionOfArticle=t,this.checkArticleHasOption=o,this.hideOptionsForConstruction=new Map,this.updateCfgValuesByPlanner=i,this.partlistHelper=new I(this.getOptionVal,this.setOptionValue,this.getElementHasBottomPlate,this.getElementIsCornerElement,this.getCornerType,this.getElementHasTopPlate,this.getElementIsGarderobeElement)}),[{key:"arrayContainsValue",value:function arrayContainsValue(t,o){if(!t)return!1;if(Array.isArray(t)){for(var i=0;i<t.length;i++)if(t[i]==o)return!0;return!1}var l=t.split(";");for(i=0;i<l.length;i++)if(l[i]==o)return!0;return!1}},{key:"evalRule",value:function evalRule(t,o,i){for(var l=!0,r=o.split("&"),a=0;a<r.length;a++){var h=r[a].split("|");if(1!=h.length){for(var c=!1,u=0;u<h.length;u++){m=h[u].split("=")[0],g=h[u].split("=")[1];var d=this.getOptionVal(t,m,i);d&&d==g&&(c=!0)}l&&(l=c)}else{var m=r[a].split("=")[0],g=r[a].split("=")[1],E=this.getOptionVal(t,m,i);E&&E!=g&&(l=!1)}}return l}},{key:"setOptionDoShow",value:function setOptionDoShow(t,o,i){var l=this.constructionRules.optionsVisibilityInfo[o];if(l){var r;if(null!=l.doShow)i.has(t)||i.set(t,new Map),null===(r=i.get(t))||void 0===r||r.set(o,l.doShow);if(this.hideOptionsForConstruction.has(t)){var a,h=this.hideOptionsForConstruction.get(t).indexOf(o);if(h>=0)null===(a=this.hideOptionsForConstruction.get(t))||void 0===a||a.splice(h,1)}}}},{key:"setOptionDoHide",value:function setOptionDoHide(t,o,i){var l,r,a=this.constructionRules.optionsVisibilityInfo[o];a&&(i.has(t)||i.set(t,new Map),null===(l=i.get(t))||void 0===l||l.set(o,a.doHide),this.hideOptionsForConstruction.has(t)||this.hideOptionsForConstruction.set(t,[]),null===(r=this.hideOptionsForConstruction.get(t))||void 0===r||r.push(o))}},{key:"setOptionDoCustom",value:function setOptionDoCustom(t,o,i,l){var r,a,h=this.constructionRules.optionsVisibilityInfo[o];h&&(l.has(t)||l.set(t,new Map),null===(r=l.get(t))||void 0===r||r.set(o,h[i]),this.hideOptionsForConstruction.has(t)||this.hideOptionsForConstruction.set(t,[]),null===(a=this.hideOptionsForConstruction.get(t))||void 0===a||a.push(o))}},{key:"getCurOptionBasedConstructionRules",value:function getCurOptionBasedConstructionRules(t,o){for(var i=[],l=0;l<this.constructionRules.optionBasedConstructionRules.length;l++){var r=this.constructionRules.optionBasedConstructionRules[l];this.getOptionVal(t,r.masterOptionName,o)==r.masterOptionValue&&i.push(r)}return i}},{key:"setAllOptToDefault",value:function setAllOptToDefault(t,o,i,l){for(var r=[],a=void 0,h=0;h<this.constructionRules.optionsInfluenceRulesOfAllElements.length;h++){var c=this.constructionRules.optionsInfluenceRulesOfAllElements[h];for(var u in i)u==c.onOPT&&this.arrayContainsValue(c.onOPVs,i[u])&&r.push({opt:c.influenceOPT,opv:c.forceOPV,unvalidOPVs:c.unvalidOPVs,warning:c.warning,doShowWarning:!1})}for(var d=t.getAllElementIdsInGrid(),m=0;m<d.length;m++){var g;if(this.hideOptionsForConstruction.has(d[m])&&this.hideOptionsForConstruction.get(d[m]).length>0){for(;this.hideOptionsForConstruction.get(d[m]).length>0;){var E=this.hideOptionsForConstruction.get(d[m])[0];this.setOptionDoShow(d[m],E,o)}this.hideOptionsForConstruction.delete(d[m])}this.constructionRules.hasDMOD&&(t.getPlannerHasActiveBackside()?this.setOptionDoShow(d[m],"OPTDMOD",o):this.setOptionDoHide(d[m],"OPTDMOD",o));var I=t.getColumnCount();I>1?this.setOptionDoShow(d[m],"OPTMULTICOL",o):this.setOptionDoHide(d[m],"OPTMULTICOL",o),this.setOptionValue(d[m],"OPTCORNER_COL_L","OPVOHNE",o),this.setOptionValue(d[m],"OPTCORNER_COL_R","OPVOHNE",o);var p=t.getCellsInGridByElementId(d[m]);if(p.backside)this.setOptionValue(d[m],"OPTELEM_ON_BACK","OPVJA",o);else{if(this.setOptionValue(d[m],"OPTELEM_ON_BACK","OPVNEIN",o),p.startColIndex>0){var O=t.getPlannerElementAtGridPos(p.startColIndex-1,0,!1);if(O){var R=this.getOptionVal(O.getElementId(),"OPTELEMENT",o);"OPVECK_I"==R?this.setOptionValue(d[m],"OPTCORNER_COL_L","OPVECK_I",o):"OPVECK_A"==R?this.setOptionValue(d[m],"OPTCORNER_COL_L","OPVECK_A",o):this.setOptionValue(d[m],"OPTCORNER_COL_L","OPVOHNE",o)}}if(p.endColIndex<I-1){var k=t.getPlannerElementAtGridPos(p.endColIndex,0,!1);if(k){var P=this.getOptionVal(k.getElementId(),"OPTELEMENT",o);"OPVECK_I"==P?this.setOptionValue(d[m],"OPTCORNER_COL_R","OPVECK_I",o):"OPVECK_A"==P?this.setOptionValue(d[m],"OPTCORNER_COL_R","OPVECK_A",o):this.setOptionValue(d[m],"OPTCORNER_COL_R","OPVOHNE",o)}}}if(this.constructionRules.avoidOptionLastCol){var v=this.getOptionVal(d[m],this.constructionRules.avoidOptionLastCol.onOPT,o);this.arrayContainsValue(this.constructionRules.avoidOptionLastCol.onOPVs,v)&&p.endColIndex-1==I-1&&this.setOptionValue(d[m],this.constructionRules.avoidOptionLastCol.onOPT,this.constructionRules.avoidOptionLastCol.defaultOpv,o)}if(this.constructionRules.avoidOptionFirstCol){var T=this.getOptionVal(d[m],this.constructionRules.avoidOptionFirstCol.onOPT,o);this.arrayContainsValue(this.constructionRules.avoidOptionFirstCol.onOPVs,T)&&0==p.startColIndex&&this.setOptionValue(d[m],this.constructionRules.avoidOptionFirstCol.onOPT,this.constructionRules.avoidOptionFirstCol.defaultOpv,o)}var V=this.hasOptionValue(d[m],"OPTWW",o);if(t.getElementIsFirstInGrid(d[m])?(this.setOptionDoShow(d[m],"OPTWERKZEUGKASTEN",o),V&&(t.getSizeOfWholeSet(!0).y>173&&!t.getPlannerHasActiveBackside()?this.setOptionDoShow(d[m],"OPTWW",o):this.setOptionDoHide(d[m],"OPTWW",o))):(this.setOptionDoHide(d[m],"OPTWERKZEUGKASTEN",o),V&&this.setOptionDoHide(d[m],"OPTWW",o)),o.has(d[m])||o.set(d[m],new Map),null===(g=o.get(d[m]))||void 0===g||g.set("DEBUG",t.getElementById(d[m]).getPosNr()+""),r.length>0)for(var _=0;_<r.length;_++){var B=this.getOptionVal(d[m],r[_].opt,o),C=!1;if(r[_].unvalidOPVs&&0!=r[_].unvalidOPVs.length){for(var x=r[_].unvalidOPVs.split(";"),b=0;b<x.length;b++)if(x[b]==B){C=!0;break}}else C=!0;C&&(B!=r[_].opv&&(this.setOptionValue(d[m],r[_].opt,r[_].opv,o),r[_].doShowWarning||(r[_].doShowWarning=!0,a=r[_].warning)))}if(i)for(var u in i)if(""!=u&&i[u]&&""!=i[u])for(h=0;h<this.constructionRules.optionsInfluenceRulesOfSingleElement.length;h++){c=this.constructionRules.optionsInfluenceRulesOfSingleElement[h];var y=!1;if(c.dir&&l&&l.length>0){if("TOP"==c.dir&&t.getElementHasBottomElement(d[m]))for(var H=t.getBottomElements(d[m]),G=0;G<H.length;G++)l.indexOf(H[G].getElementId())>=0&&(y=!0);if("DOWN"==c.dir&&t.getElementHasTopElement(d[m]))for(var D=t.getTopElements(d[m]),L=0;L<D.length;L++)l.indexOf(D[L].getElementId())>=0&&(y=!0);if("LEFT_RIGHT"==c.dir){if(t.getElementHasLeftElement(d[m]))for(var A=t.getLeftElements(d[m]),S=0;S<A.length;S++)l.indexOf(A[S].getElementId())>=0&&(y=!0);if(t.getElementHasRightElement(d[m]))for(var w=t.getRightElements(d[m]),N=0;N<w.length;N++)l.indexOf(w[N].getElementId())>=0&&(y=!0)}if("COL"==c.dir){var M=t.getCellsInGridByElementId(d[m]);t.getAllElementsInColumn(M.startColIndex,M.backside).forEach((function(t){return l.indexOf(t.ElementId)>=0?y=!0:void 0}))}if("BACK"==c.dir&&t.getPlannerHasActiveBackside()){var W=t.getOppositeElement(d[m]);W&&l.indexOf(W.getElementId())>=0&&(y=!0)}}else y=!0;if(y){B=this.getOptionVal(d[m],c.influenceOPT,o);u==c.onOPT&&B&&""!=B&&this.arrayContainsValue(c.unvalidOPVs,B)&&this.arrayContainsValue(c.onOPVs,i[u])&&(this.setOptionValue(d[m],c.influenceOPT,c.defaultOpv,o),c.warning&&(a=c.warning))}}var K=this.getCurOptionBasedConstructionRules(d[m],o);if(K)for(var X=0;X<K.length;X++)if(K[X].defaultOptions)for(var z=0;z<K[X].defaultOptions.length;z++){var Z=K[X].defaultOptions[z];if(!Z.rule||""==Z.rule||this.evalRule(d[m],Z.rule,o))for(var Y=0;Y<Z.options.length;Y++)"doShow"==Z.value?this.setOptionDoShow(d[m],Z.options[Y],o):"doHide"==Z.value&&this.setOptionDoHide(d[m],Z.options[Y],o),Z.opv&&this.setOptionValue(d[m],Z.options[Y],Z.opv,o)}this.setOptionValue(d[m],"OPTFAF_L_V","OPVOHNE_FAF",o),this.setOptionValue(d[m],"OPTFAF_L_H","OPVOHNE_FAF",o),this.setOptionValue(d[m],"OPTFAF_R_V","OPVOHNE_FAF",o),this.setOptionValue(d[m],"OPTFAF_R_H","OPVOHNE_FAF",o)}return a}},{key:"doCorrectAffectedElementsByOption",value:function doCorrectAffectedElementsByOption(t,o,i,l){if(null!=l){var r=l[0];if(null!=i)for(var a in i){if(this.constructionRules.forceSameOptionInGrid&&this.arrayContainsValue(this.constructionRules.forceSameOptionInGrid,a)){var h=t.getCellsInGridByElementId(r).backside?t.getAllElementsInBackGrid():t.getAllElementsInFrontGrid();if(null!=h)for(var c=0;c<h.length;c++)this.setOptionValue(h[c].ElementId,a,i[a],o)}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInCol,a)){var u=t.getCellsInGridByElementId(r),d=t.getAllElementsInColumn(u.startColIndex,u.backside);if(null!=d){if(t.getPlannerHasActiveBackside()){var m,g=t.getAllElementsInColumn(u.startColIndex,!u.backside);g&&(d=null===(m=d)||void 0===m?void 0:m.concat(g))}for(c=0;c<d.length;c++)this.setOptionValue(d[c].ElementId,a,i[a],o)}}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInRow,a)){var E=t.getCellsInGridByElementId(r),I=t.getAllElementsInRow(E.startRowIndex,E.backside);if(I&&t.getPlannerHasActiveBackside()){var p=t.getAllElementsInRow(E.startRowIndex,!E.backside);p&&(I=I.concat(p))}for(c=0;c<I.length;c++)this.setOptionValue(I[c].ElementId,a,i[a],o)}}var O=t.getCellsInGridByElementId(r),R=t.getAllElementsInRow(O.startRowIndex,O.backside);for(c=0;c<R.length;c++)if(R[c].getElementId()!=r)for(var k=0;k<(null===(P=this.constructionRules.forceSameOptionInRow)||void 0===P?void 0:P.length);k++){var P,v=this.getOptionVal(R[c].getElementId(),this.constructionRules.forceSameOptionInRow[k],o);this.setOptionValue(r,this.constructionRules.forceSameOptionInRow[k],v,o);break}}}},{key:"handleVisibility_SHOW_HIDE",value:function handleVisibility_SHOW_HIDE(t,o,i,l){if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var r=this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.get(t).indexOf(i.OPTCurrentElem)>=0;this.setOptionDoHide(o,i.OPTNeighborElem,l),r||this.setOptionDoShow(t,i.OPTCurrentElem,l)}}},{key:"handleBacksideVisibility_SHOW_HIDE",value:function handleBacksideVisibility_SHOW_HIDE(t,o,i,l){if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var r=this.constructionRules.optionsVisibilityInfo[i.OPTCurrentElem],a=this.constructionRules.optionsVisibilityInfo[i.OPTNeighborElem];r&&a&&this.getOptionVal(t,i.OPTCurrentElem,l)==r.doShow&&this.getOptionVal(o,i.OPTNeighborElem,l)==a.doShow&&this.setOptionDoHide(t,i.OPTCurrentElem,l)}}},{key:"handleVisibiliy_HIDE_HIDE",value:function handleVisibiliy_HIDE_HIDE(t,o,i,l){var r=this.constructionRules.optionsVisibilityInfo[i.OPTCurrentElem];if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var a=this.constructionRules.optionsVisibilityInfo[i.OPTNeighborElem],h=r.doShow==this.getOptionVal(t,i.OPTCurrentElem,l),c=this.getOptionVal(o,i.OPTNeighborElem,l)==a.doShow;h&&c&&(this.setOptionDoHide(t,i.OPTCurrentElem,l),this.setOptionDoHide(o,i.OPTNeighborElem,l))}}},{key:"correctSimpleOpt",value:function correctSimpleOpt(t,o,i,l,r){var a=i.getPlannerElementAtGridPos(t,o,r);if(a){if(this.constructionRules.defaultConstructionRules.TOP){var h=void 0;if(i.getElementHasTopElement(a.ElementId)){h=i.getPlannerElementAtGridPos(t,o+1,r);for(var c=0;c<this.constructionRules.defaultConstructionRules.TOP.length;c++){var u=this.constructionRules.defaultConstructionRules.TOP[c];"SHOW_HIDE"==u.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,h.ElementId,u,l):"HIDE_HIDE"==u.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,h.ElementId,u,l)}}}if(this.constructionRules.defaultConstructionRules.RIGHT){var d=void 0;if(r?i.getElementHasLeftElement(a.ElementId):i.getElementHasRightElement(a.ElementId)){d=r?i.getPlannerElementAtGridPos(t-1,o,r):i.getPlannerElementAtGridPos(t+1,o,r);for(c=0;c<this.constructionRules.defaultConstructionRules.RIGHT.length;c++){var m=this.constructionRules.defaultConstructionRules.RIGHT[c];"SHOW_HIDE"==m.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,d.ElementId,m,l):"HIDE_HIDE"==m.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,d.ElementId,m,l)}}}if(this.constructionRules.defaultConstructionRules.DOWN){var g=void 0;if(o>0){g=i.getPlannerElementAtGridPos(t,o-1,r);for(c=0;c<this.constructionRules.defaultConstructionRules.DOWN.length;c++){var E=this.constructionRules.defaultConstructionRules.DOWN[c];"SHOW_HIDE"==E.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,g.ElementId,E,l):"HIDE_HIDE"==E.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,g.ElementId,E,l)}}}var I=r?i.getLeftElements(a.ElementId):i.getRightElements(a.ElementId),p=r?i.getRightElements(a.ElementId):i.getLeftElements(a.ElementId),O=i.getTopElements(a.ElementId),R=i.getBottomElements(a.ElementId),k=r?i.getTopLeftElement(a.ElementId):i.getTopRightElement(a.ElementId);I.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_RECHTS",this.getOptionVal(I[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_RECHTS",l),p.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_LINKS",this.getOptionVal(p[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_LINKS",l),O.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_OBEN",this.getOptionVal(O[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_OBEN",l),k?this.setOptionValue(a.ElementId,"OPTNACHBAR_OBEN_RECHTS",this.getOptionVal(k.ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_OBEN_RECHTS",l),this.constructionRules.hasNeighbors&&this.constructionRules.hasNeighbors.indexOf("OPTNACHBAR_UNTEN")>=0&&(R.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_UNTEN",this.getOptionVal(R[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_UNTEN",l))}}},{key:"correctBack",value:function correctBack(t,o,i){if(this.constructionRules.hasDMOD)if(t.getPlannerHasActiveBackside()){var l=void 0;if(l=t.getOppositeElement(i),this.constructionRules.defaultConstructionRules.BACK)for(var r=0;r<this.constructionRules.defaultConstructionRules.BACK.length;r++){var a,h,c=this.constructionRules.defaultConstructionRules.BACK[r],u=!1;if(c.hideOnElemAndOppositeOPT&&c.hideOnElemAndOppositeOPV)this.arrayContainsValue(c.hideOnElemAndOppositeOPV,this.getOptionVal(i,c.hideOnElemAndOppositeOPT,o))&&this.arrayContainsValue(c.hideOnElemAndOppositeOPV,this.getOptionVal(null===(a=l)||void 0===a?void 0:a.getElementId(),c.hideOnElemAndOppositeOPT,o))&&(u=!0);if(u)this.setOptionDoHide(i,c.OPTCurrentElem,o),this.setOptionDoHide(l.getElementId(),c.OPTCurrentElem,o);else if("FORCE_HIDE"==c.OPTValueRule&&this.setOptionDoHide(l.getElementId(),c.OPTCurrentElem,o),"SHOW_HIDE"==c.OPTValueRule)this.handleBacksideVisibility_SHOW_HIDE(null===(h=l)||void 0===h?void 0:h.getElementId(),i,c,o);else"HIDE_HIDE"==c.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(l.ElementId,i,c,o)}l&&this.getElementHasBottomPlate(l,o)?this.setOptionDoShow(i,"OPTOPP_RAHMEN_U_V",o):this.setOptionDoHide(i,"OPTOPP_RAHMEN_U_V",o),this.getElementHasTopPlate(l,t,o)?this.setOptionDoShow(i,"OPTOPP_RAHMEN_O_V",o):this.setOptionDoHide(i,"OPTOPP_RAHMEN_O_V",o)}else this.setOptionDoHide(i,"OPTOPP_RAHMEN_U_V",o),this.setOptionDoHide(i,"OPTOPP_RAHMEN_O_V",o)}},{key:"correctBottom",value:function correctBottom(t,o,i){var l="";if(this.constructionRules.correctLeftRight&&null!=this.constructionRules.correctLeftRight.rowIndex)for(var r=t.getAllElementsInRow(this.constructionRules.correctLeftRight.rowIndex,i),a=0;a<r.length;a++){var h=r[a];if(0==a){if(null==(l=this.getOptionVal(h.ElementId,this.constructionRules.correctLeftRight.optWithOptVal,o)))return;i?this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRight,l,o):(this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeft,l,o),this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeftBack,l,o))}i?this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeft,l,o):(this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRight,l,o),this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRightBack,l,o))}}},{key:"getValidLadder",value:function getValidLadder(t,o,i){for(var l=o.getAllElementsInColumn(t,!1),r=0;r<this.constructionRules.correctLadder.validLadder.length;r++){var a=this.constructionRules.correctLadder.validLadder[r];if(l.length==a.colCount){for(var h=!0,c=0;c<l.length;c++){var u=l[c];if(this.getOptionVal(u.ElementId,a.heightOption,i)!=a.heightPerRow[c]&&(h=!1),!h)break}if(h)return a}}}},{key:"validateDimensionRule",value:function validateDimensionRule(t,o,i,l,r){var a=!1,h=!1;return"height"==t.toLowerCase()&&i.y>o&&(a=!0),"height"==t.toLowerCase()&&i.y==o&&(h=!0),"width"==t.toLowerCase()&&i.x>o&&(a=!0),"width"==t.toLowerCase()&&i.x==o&&(h=!0),"depth"==t.toLowerCase()&&i.z>o&&(a=!0),"depth"==t.toLowerCase()&&i.z==o&&(h=!0),a||h?l:r}},{key:"correctOverHangingElement",value:function correctOverHangingElement(t,o,i,l){var r=this;if(l&&t){var a=o.getCellsInGridByElementId(t).startColIndex,h=o.getAllElementsInColumn(a,!1,!0),c=h.findIndex((function(o){return o.ElementId==t})),u=h[c];if(u){var d=Object.entries(l),m=d[0][0],g=d[0][1];h.forEach((function(t,l){if(l<c){var a=o.getNeighborElements(t.ElementId,"RIGHT",!1),h=t.Width;a.forEach((function(t){if(t.ElementId!=u.ElementId){var i=o.getNeighborElements(t.ElementId,"TOP",!1).filter((function(t){return t.ElementId!=u.ElementId})).reduce((function(t,o){return t+o.Width}),0);i<t.Width&&(h+=t.Width-i)}})),Math.round(u.Width)>Math.round(h)&&r.setOptionValue(t.ElementId,m,g,i)}else u.Width<t.Width&&r.setOptionValue(t.ElementId,m,g,i)}))}}}},{key:"correctFoot",value:function correctFoot(t,o){var i=this;t.getAllElementsInFrontGrid().forEach((function(l){t.getElementHasBottomElement(l.ElementId)&&(i.setOptionValue(l.ElementId,"OPTFUSS_SYS","OPVOHNE",o),i.setOptionValue(l.ElementId,"OPTPOSSIBILITY_FUSS_OHNE","OPVTRUE",o))}))}},{key:"correctOptionsInfluencedByDimensions",value:function correctOptionsInfluencedByDimensions(t,o,i){var l=this;if(this.constructionRules.optionsInfluencedByDimensions){var r=t.getSizeOfWholeSet(!1),a=t.getAllElementsInFrontGrid(),h=function setRule(t,r){if(i){var h=Object.entries(i).find((function(o){var i=(0,g.Z)(o,2),l=i[0];i[1];return l==t}));if(h)return void a.forEach((function(t){return l.setOptionValue(t.ElementId,h[0],h[1],o)}))}a.forEach((function(i){return l.setOptionDoCustom(i.ElementId,t,r,o)}))};this.constructionRules.optionsInfluencedByDimensions.forEach((function(t){if(Array.isArray(t)){var o=t.every((function(t){return"doshow"==l.validateDimensionRule(t.dimension,t.dimensionLimit,r,t.higherLimit,t.lowerLimit).toLowerCase()})),i=t[0];h(i.option,o?"doShow":"doHide")}else{var a=t,c=t;if(a.series){var u=a.series.findLast((function(t){return"1"==l.validateDimensionRule(t.dimension,t.dimensionLimit,r,"1","2")}));u&&h(a.option,u.value)}else h(c.option,l.validateDimensionRule(c.option,c.dimensionLimit,r,c.higherLimit,c.lowerLimit))}}))}}},{key:"correctLadder",value:function correctLadder(t,o){if(this.constructionRules.correctLadder){for(var i=t.getAllElementsInRow(this.constructionRules.correctLadder.rowIndex,!1),l=0;l<i.length;l++){var r=t.getRowCount(l,!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&-1==this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(r))for(var a=t.getAllElementsInColumn(l,!1),h=0;h<a.length;h++)this.setOptionValue(a[h].ElementId,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,o);if(r<t.getSizeOfHighesRow(!1)){var c,u=null===(c=t.getPlannerElementAtGridPos(l,r-1,!1))||void 0===c?void 0:c.getElementId();u&&this.getOptionVal(u,this.constructionRules.correctLadder.optHeight,o)==this.constructionRules.correctLadder.opvProblematicHeight&&this.setOptionValue(u,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,o)}}for(l=0;l<i.length;l++){var d=i[l],m=this.getValidLadder(l,t,o);0==l&&this.setOptionValue(d.ElementId,this.constructionRules.correctLadder.optLadderLeft,m.optLadder,o);var g=m;if(t.getElementHasRightElement(d.getElementId())){var E=this.getValidLadder(l+1,t,o);E.colCount>m.colCount&&(g=E)}this.setOptionValue(d.getElementId(),this.constructionRules.correctLadder.optLadderRight,g.optLadder,o)}var I=t.getSizeOfHighesRow(!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(I)>=0){var p=t.getAllElementsInRow(I-1,!1);for(l=0;l<p.length;l++){var O=p[l];this.setOptionDoShow(O.getElementId(),this.constructionRules.correctLadder.optHasHeight,o)}}}}},{key:"correctCoverPlate",value:function correctCoverPlate(t,o,i){var l=this;t.onHighestElementsOnly||o.getHighestElementsPerSeries(!!t.onBottom).forEach((function(r){var a=0,h=t.seriesWidthToPlateOpv;r.forEach((function(r){var h;a+=null!==(h=r.size.width)&&void 0!==h?h:0,o.getAllElementsDown(r.elementId).elements.forEach((function(o){return l.setOptionValue(o,t.optABD,"OPVOHNE",i)})),l.setOptionValue(r.elementId,t.optABD,"OPVOHNE",i)}));for(var c,u=r[0],d=function _loop(){var o=h.findLast((function(t){var o=0,i=!1;return r.forEach((function(l){var r;o+=null!==(r=l.size.width)&&void 0!==r?r:0,Math.abs(o-t.limit)<1&&(i=!0)})),!!(t.limit<=a&&i)}));if(!o)return{v:void 0};l.setOptionValue(u.elementId,t.optABD,o.plateOpv,i);var c=0;u=r.find((function(t){var i;return(c+=null!==(i=t.size.width)&&void 0!==i?i:0)>o.limit})),a-=o.limit,h[1].limit>a&&(a=0)};0!=a;)if(c=d())return c.v}))}},{key:"correctSeries",value:function correctSeries(t,o){for(var i=!1,l=t.getAllElementIdsInGrid(),r=!1,a=!1,h=0;h<l.length;h++){var c=l[h];this.getElementIsCornerElement(t.getElementById(c),o)&&(r=!0),this.checkArticleHasOption(c,"OPTBR_ABDECKPLATTE")&&this.setOptionDoHide(c,"OPTBR_ABDECKPLATTE",o);var u=this.getOptionVal(c,"OPTABDECKPLATTE",o);this.checkArticleHasOption(c,"OPTABDECKPLATTE")&&"OPVMIT_PLATTE"==u&&(i=!0),"OPVBR_18"==this.getOptionVal(c,"OPTBR",o)&&(a=!0)}if(!t.getPlannerHasActiveBackside()&&t.getPlannerElementAtGridPos(0,0,!1)){for(var d=t.getSizeOfHighesRow(!1),m=[],g=[],E=[],I=0,p=0,O=t.getAllElementsInColumn(p,!1);O.length>0;){if(O.length==d){var R=O[d-1];E.push(R),"OPVBR_75"==(u=this.getOptionVal(R.ElementId,"OPTBR",o))?I+=75:"OPVBR_18"==u?I+=18.75:"OPVBR_37"==u&&(I+=37.5),this.setOptionDoHide(R.ElementId,"OPTOBEN",o)}else E.length>0&&(m.push(E),g.push(I)),E=[],I=0;p++,O=t.getAllElementsInColumn(p,!1)}for(E.length>0&&(m.push(E),g.push(I)),h=0;h<m.length;h++){var k=m[h][0],P="";if(this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_40")>=0&&Math.abs(g[h]-40.4)<3?P="OPVABDECKPLATTE_40":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_77")>=0&&Math.abs(g[h]-77.8)<3?P="OPVABDECKPLATTE_77":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_115")>=0&&Math.abs(g[h]-115.3)<3?P="OPVABDECKPLATTE_115":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_152")>=0&&Math.abs(g[h]-152.8)<3?P="OPVABDECKPLATTE_152":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_190")>=0&&Math.abs(g[h]-190.3)<3?P="OPVABDECKPLATTE_190":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_227")>=0&&Math.abs(g[h]-227.8)<3&&(P="OPVABDECKPLATTE_227"),""==P||r)for(var v=t.getAllElementsInGridSortedbyGridPos(),T=0;T<v.length;T++)this.checkArticleHasOption(v[T].getElementId(),"OPTABD_HIDE")&&this.setOptionDoShow(v[T].getElementId(),"OPTABD_HIDE",o);else for(var V=t.getAllElementsInGridSortedbyGridPos(),_=0;_<V.length;_++)this.checkArticleHasOption(V[_].getElementId(),"OPTABD_HIDE")&&this.setOptionDoHide(V[_].getElementId(),"OPTABD_HIDE",o);if(""==P||!i||r||a)for(var B=0;B<m[h].length;B++)this.setOptionDoShow(m[h][B].ElementId,"OPTOBEN",o);else this.setOptionValue(k.ElementId,"OPTBR_ABDECKPLATTE",P,o)}}}},{key:"correctForceOptOfElement",value:function correctForceOptOfElement(t,o,i,l){if(0!=o.getCellsInGridByElementId(t).cells.length)for(var r=this.getCurOptionBasedConstructionRules(t,i),a=0;a<r.length;a++){if(r[a].forceOptions)for(var h=0;h<r[a].forceOptions.length;h++){var c=r[a].forceOptions[h];if(!c.rule||""==c.rule||this.evalRule(t,c.rule,i))for(var u=c.options,d=c.value,m=0;m<u.length;m++){var g=u[m],E=this.constructionRules.optionsVisibilityInfo[g];if(E.complementDir){var I=E.complementDir;l&&("LEFT"==I?I="RIGHT":"RIGHT"==I&&(I="LEFT"));var p=o.getNeighborElements(t,I);if(p.length>0)for(var O=0;O<p.length;O++){for(var R=p[O],k=this.getCurOptionBasedConstructionRules(R.ElementId,i),P=E.complementOPT,v=!1,T=0;T<k.length;T++)if(k[T].forceOptions)for(var V=0;V<k[T].forceOptions.length;V++){var _=k[T].forceOptions[V];if((!_.rule||""==_.rule||this.evalRule(R.ElementId,_.rule,i))&&(this.arrayContainsValue(_.options,P)&&(v=!0,"doShow"==d&&"doShow"==_.value&&("OPVFUELLUNG"==this.getOptionVal(t,"OPTELEMENT",i)&&"OPVFUELLUNG"==this.getOptionVal(R.ElementId,"OPTELEMENT",i)?(this.setOptionDoHide(R.ElementId,P,i),this.setOptionDoHide(R.ElementId,P,i)):this.setOptionDoShow(R.ElementId,P,i)),"doHide"==d&&"doHide"==_.value&&(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)),"doShow"==d&&"doHide"==_.value||"doHide"==d&&"doShow"==_.value))){var B=!0;c.prio&&_.prio?B=c.prio<=_.prio:c.prio?B=!0:_.prio&&(B=!1),B?"doHide"==d?(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doShow"==d&&(this.setOptionDoShow(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doHide"==_.value?(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doShow"==_.value&&(this.setOptionDoHide(t,g,i),this.setOptionDoShow(R.ElementId,P,i))}}v||("doShow"==d&&(this.setOptionDoShow(t,g,i),this.setOptionDoHide(R.ElementId,P,i)),"doHide"==d&&(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)))}else"doShow"==d&&this.setOptionDoShow(t,g,i),"doHide"==d&&this.setOptionDoHide(t,g,i)}}}if(r[a].changeOptions)for(var C=0;C<r[a].changeOptions.length;C++){for(var x=!0,b=r[a].changeOptions[C].rule.split("&"),y=0;y<b.length;y++)if(b[y].indexOf("!=")>0){var H=b[y].split("!=")[0],G=b[y].split("!=")[1];this.getOptionVal(t,H,i)==G&&(x=!1)}else{H=b[y].split("=")[0],G=b[y].split("=")[1];this.getOptionVal(t,H,i)!=G&&(x=!1)}x&&(r[a].changeOptions[C].doShow&&this.setOptionDoShow(t,r[a].changeOptions[C].doShow,i),r[a].changeOptions[C].doHide&&this.setOptionDoHide(t,r[a].changeOptions[C].doHide,i),r[a].changeOptions[C].opt&&r[a].changeOptions[C].opv&&this.setOptionValue(t,r[a].changeOptions[C].opt,r[a].changeOptions[C].opv,i))}}}},{key:"correctNeighborCustomOLTs",value:function correctNeighborCustomOLTs(t,o,i){if(this.constructionRules.correctNeighborOPT&&0!=this.constructionRules.correctNeighborOPT.length)for(var l=0;l<this.constructionRules.correctNeighborOPT.length;l++){var r=o.getCellsInGridByElementId(t);if(this.setOptionValue(t,this.constructionRules.correctNeighborOPT[l].opt,"OPVOHNE",i),0==r.cells.length)return;var a=o.getNeighborElements(t,this.constructionRules.correctNeighborOPT[l].dir);if(a.length>0){var h=this.getOptionVal(a[0].ElementId,this.constructionRules.correctNeighborOPT[l].neighborOPT,i);""!=h&&this.setOptionValue(t,this.constructionRules.correctNeighborOPT[l].opt,h,i)}}}},{key:"doChangeRetailArticleNumbers",value:function doChangeRetailArticleNumbers(t,o){var i=t.getAllElementsInGridSortedbyGridPos();if(this.constructionRules.correctRetailArticleNumberByRule&&this.constructionRules.correctRetailArticleNumberByRule.length>0)for(var l=0;l<this.constructionRules.correctRetailArticleNumberByRule.length;l++){var r=this.constructionRules.correctRetailArticleNumberByRule[l];if("global"==r.range){for(var a=!0,h=0;h<i.length&&a;h++){this.evalRule(i[h].getElementId(),r.rule,o)||(a=!1)}if(a)return{doChange:!0,retailArticleRules:r.retailArticleRules}}else if("singular"==r.range){var c=!1;for(h=0;h<i.length;h++){this.evalRule(i[h].getElementId(),r.rule,o)&&(c=!0)}if(c)return{doChange:!0,retailArticleRules:r.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,l.Z)(u().mark((function _callee(t,o,i,l){var r,a,h,c,m,g,E,I,O,R,k,P,v,T,V,_,B;return u().wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(null!=this.constructionRules&&this.constructionRulesLoaded){u.next=3;break}return p.error(new d.GE("Error construction rules are not set for boxPlanner",{code:"WC_0012"})),u.abrupt("return");case 3:if(a=(new Date).getTime(),h=void 0,p.debug("BoxPlanner - updateOptionLogicInGrid start updateOptionLogicInGrid"),c=new Map,l)for(m=t.getAllElementIdsInGrid(),o=void 0,i=void 0,g=0;g<m.length;g++)this.getElementIsCornerElement(t.getElementById(m[g]),c)&&this.setOptionValue(m[g],"OPTELEMENT","OPVOFFENES_FACH",c);for(h=this.setAllOptToDefault(t,c,o,i),this.doCorrectAffectedElementsByOption(t,c,o,i),this.correctBottom(t,c,!1),t.getPlannerHasActiveBackside()&&this.correctBottom(t,c,!0),this.correctSeries(t,c),g=0;g<t.getColumnCount();g++)for(E=0;E<t.getRowCount(g,!1);E++)this.correctSimpleOpt(g,E,t,c,!1);if(t.getPlannerHasActiveBackside())for(g=t.getColumnCount()-1;g>=0;g--)for(E=0;E<t.getRowCount(g,!1);E++)this.correctSimpleOpt(g,E,t,c,!0);g=0;case 17:if(!(g<t.getColumnCount())){u.next=31;break}E=0;case 19:if(!(E<t.getRowCount(g,!1))){u.next=28;break}if(O=null===(I=t.getPlannerElementAtGridPos(g,E,!1))||void 0===I?void 0:I.ElementId){u.next=23;break}return u.abrupt("continue",25);case 23:this.correctForceOptOfElement(O,t,c,!1),this.correctNeighborCustomOLTs(O,t,c);case 25:E++,u.next=19;break;case 28:g++,u.next=17;break;case 31:if(!t.getPlannerHasActiveBackside()){u.next=47;break}g=t.getColumnCount()-1;case 33:if(!(g>=0)){u.next=47;break}E=0;case 35:if(!(E<t.getRowCount(g,!1))){u.next=44;break}if(k=null===(R=t.getPlannerElementAtGridPos(g,E,!1))||void 0===R?void 0:R.ElementId){u.next=39;break}return u.abrupt("continue",41);case 39:this.correctForceOptOfElement(k,t,c,!0),this.correctNeighborCustomOLTs(k,t,c);case 41:E++,u.next=35;break;case 44:g--,u.next=33;break;case 47:if(this.correctFoot(t,c),this.correctLadder(t,c),this.correctOptionsInfluencedByDimensions(t,c,o),this.correctOverHangingElement(null===(r=i)||void 0===r?void 0:r[0],t,c,o),this.partlistHelper.calculateKnots(t,c),this.partlistHelper.calculateRahmen(t,c),this.constructionRules.coverPlateRule){P=_createForOfIteratorHelper(this.constructionRules.coverPlateRule);try{for(P.s();!(v=P.n()).done;)T=v.value,this.correctCoverPlate(T,t,c)}catch(t){P.e(t)}finally{P.f()}}g=0;case 55:if(!(g<t.getColumnCount())){u.next=68;break}E=0;case 57:if(!(E<t.getRowCount(g,!1))){u.next=65;break}if(_=null===(V=t.getPlannerElementAtGridPos(g,E,!1))||void 0===V?void 0:V.getElementId()){u.next=61;break}return u.abrupt("continue",62);case 61:this.correctBack(t,c,_);case 62:E++,u.next=57;break;case 65:g++,u.next=55;break;case 68:return B=this.doChangeRetailArticleNumbers(t,c),u.next=71,this.updateCfgValuesByPlanner(c,void 0,this.constructionRules.partlistRules.bundleRules,B);case 71:return p.debug("BoxPlanner updateOptionLogic - Duration after setting Option Values of all Articles: "+((new Date).getTime()-a)),p.debug("BoxPlanner updateOptionLogic - Duration after setting updating configurator: "+((new Date).getTime()-a)),u.abrupt("return",h);case 74:case"end":return u.stop()}}),_callee,this)}))),function updateOptionLogicBoxPlanner(o,i,l,r){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,o){if(this.hideOptionsForConstruction.has(t)){var i=this.hideOptionsForConstruction.get(t);this.hideOptionsForConstruction.set(o,(0,m.Z)(i))}}},{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}(),R=i(64357),k=i(33266);function BoxPlannerGrid_createForOfIteratorHelper(t,o){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function BoxPlannerGrid_unsupportedIterableToArray(t,o){if(t){if("string"==typeof t)return BoxPlannerGrid_arrayLikeToArray(t,o);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?BoxPlannerGrid_arrayLikeToArray(t,o):void 0}}(t))||o&&t&&"number"==typeof t.length){i&&(t=i);var l=0,r=function F(){};return{s:r,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,h=!0,c=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){c=!0,a=t},f:function f(){try{h||null==i.return||i.return()}finally{if(c)throw a}}}}function BoxPlannerGrid_arrayLikeToArray(t,o){(null==o||o>t.length)&&(o=t.length);for(var i=0,l=Array(o);i<o;i++)l[i]=t[i];return l}function ownKeys(t,o){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);o&&(l=l.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),i.push.apply(i,l)}return i}function _objectSpread(t){for(var o=1;o<arguments.length;o++){var i=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(i),!0).forEach((function(o){(0,h.Z)(t,o,i[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(i,o))}))}return t}var P=d.ZP.initLog("Planner","BOX-PLANNER_GRID"),v=function(){return(0,a.Z)((function BoxPlannerGrid(t,o){(0,r.Z)(this,BoxPlannerGrid),(0,h.Z)(this,"plannerElements",void 0),(0,h.Z)(this,"generalPlanningState",void 0),(0,h.Z)(this,"hasActiveBackside",void 0),(0,h.Z)(this,"getValueOfOptionOfArticle",void 0),(0,h.Z)(this,"gridSetupParams",void 0),this.plannerElements=new Map,this.generalPlanningState={grids:[{matrix:[[]]}]},this.gridSetupParams=t,this.getValueOfOptionOfArticle=o,this.hasActiveBackside=!1}),[{key:"createNewCells",value:function createNewCells(t,o,i,l){if(this.gridSetupParams.forceSingleCellPerElement)return[{plannedElement:{elementId:t.ElementId,basketId:t.getBasketId(),size:{width:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:t.getWidth(),height:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depth:t.getDepth()},articleCodex:t.ArticleCodex,area:{fromX:o,toX:o+1,fromY:i,toY:i+1}},index:new R.FM(o,i)}];this.gridSetupParams.forceFixCellRasterSize||P.error(new d.GE("Box planner with params forceSingleCellPerElement is false and forceFixCellRasterSize is false are not allowed"));for(var r=Math.round(t.getWidth()/this.gridSetupParams.fixCellRasterWidth),a=Math.round(t.getHeight()/this.gridSetupParams.fixCellRasterHeight),h=[],c=0;c<r;c++)for(var u=0;u<a;u++){var m={plannedElement:{basketId:t.getBasketId(),elementId:t.getElementId(),articleCodex:t.ArticleCodex,size:{width:t.getWidth(),depth:t.getDepth(),height:t.getHeight()},area:{fromX:o,toX:Math.round(o+t.getWidth()/this.gridSetupParams.fixCellRasterWidth),fromY:i,toY:Math.round(i+t.getHeight()/this.gridSetupParams.fixCellRasterHeight)}},index:new R.FM(o+c,i+u)};h.push(m)}return h}},{key:"createEmptyCells",value:function createEmptyCells(t,o,i,l,r,a){for(var h=[],c=t;c<=i;c++)for(var u=o;u<=l;u++){var d={plannerElementId:-1,width:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:r,height:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:a,index:new R.FM(c,u)};h.push(d)}return h}},{key:"getCellCount",value:function getCellCount(t){return this.gridSetupParams.forceSingleCellPerElement?{colCount:1,rowCount:1}:{colCount:Math.round(t.getWidth()/this.gridSetupParams.fixCellRasterWidth),rowCount:Math.round(t.getHeight()/this.gridSetupParams.fixCellRasterWidth)}}},{key:"getAllUsedCellsInGrid",value:function getAllUsedCellsInGrid(t){for(var o=new Array,i=t?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=0;l<i.length;l++)for(var r=0;r<i[l].length;r++)null!=i[l][r]&&o.push(i[l][r]);return o}},{key:"getGridColumnWidth",value:function getGridColumnWidth(t){for(var o=this.generalPlanningState.grids[0].matrix,i=0;i<o[i].length;i++){var l,r,a=o[t][i];if(a)return null!==(l=null===(r=a.plannedElement)||void 0===r?void 0:r.size.width)&&void 0!==l?l:0}return 0}},{key:"getGridColumnHeight",value:function getGridColumnHeight(t){var o=0,i=!1,l=this.generalPlanningState.grids[0].matrix;if(l.length>t)for(var r=l[t],a=r.length-1;a>=0;a--){var h,c,u=r[a];!i&&u&&(i=!0),i&&(o+=null!==(h=null===(c=u.plannedElement)||void 0===c?void 0:c.size.height)&&void 0!==h?h:0),a=u.plannedElement?u.plannedElement.area.fromY-1:a-1}return o}},{key:"deleteElementByIdFromGrid",value:function deleteElementByIdFromGrid(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=o.endRowIndex-o.startRowIndex+1;this.getRowCount(o.startColIndex,o.backside),o.cells.reverse().forEach((function(t){i[t.index.x].splice(t.index.y,1),0==i[t.index.x].length&&i.splice(t.index.x,1)}));var r=[];i.forEach((function(t,o){r[o]=[],t.forEach((function(t,i){var l=t.plannedElement.area;r[o][i]={index:{x:o,y:i},plannedElement:_objectSpread(_objectSpread({},t.plannedElement),{},{area:{fromX:o,fromY:i,toX:o+(l.toX-l.fromX),toY:i+(l.toY-l.fromY)}})}}))})),o.backside?this.generalPlanningState.grids[1].matrix=r:this.generalPlanningState.grids[0].matrix=r}},{key:"getPlannerElementAtGridPos",value:function getPlannerElementAtGridPos(t,o,i){var l=i?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(l[t]&&l[t][o]){var r,a=l[t][o];if(null==a)return;var h=null===(r=a.plannedElement)||void 0===r?void 0:r.elementId;if(!h)return;return this.plannerElements.get(h)}}},{key:"getCellsInGridByElementId",value:function getCellsInGridByElementId(t){var o,i,l,r,a,h,c=!1,u=this.generalPlanningState.grids[0].matrix,d=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix,m=[];if(u.forEach((function(o){return o.forEach((function(o){var i;(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==t&&m.push(o)}))})),null==d||d.forEach((function(o){return o.forEach((function(o){var i;(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==t&&(m.push(o),c=!0)}))})),0==m.length)return{cells:m,backside:c,startColIndex:0,endColIndex:0,startRowIndex:0,endRowIndex:0,colCount:0,rowCount:0};var g=null===(i=m[0].plannedElement)||void 0===i?void 0:i.area;return{cells:m,backside:c,startColIndex:null!==(l=null==g?void 0:g.fromX)&&void 0!==l?l:0,endColIndex:null!==(r=null==g?void 0:g.toX)&&void 0!==r?r:0,startRowIndex:null!==(a=null==g?void 0:g.fromY)&&void 0!==a?a:0,endRowIndex:null!==(h=null==g?void 0:g.toY)&&void 0!==h?h:0,colCount:g?g.toX-g.toX:0,rowCount:g?g.toY-g.fromY:0}}},{key:"GridSetupParams",set:function set(t){this.gridSetupParams=t}},{key:"getAllElementIdsInGrid",value:function getAllElementIdsInGrid(){return Array.from(this.plannerElements.keys())}},{key:"_getAllElementsInGrid",value:function _getAllElementsInGrid(t){for(var o=[],i=[],l=0;l<t.length;l++)for(var r=0;r<t[l].length;r++){var a,h=t[l][r];null!=h&&(null!==(a=h.plannedElement)&&void 0!==a&&a.elementId&&-1==o.indexOf(h.plannedElement.elementId)&&(o.push(h.plannedElement.elementId),i.push(this.plannerElements.get(h.plannedElement.elementId))))}return i}},{key:"getAllElementsInFrontGrid",value:function getAllElementsInFrontGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[0].matrix)}},{key:"getAllElementsInBackGrid",value:function getAllElementsInBackGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix)}},{key:"getAllElementsInBacksideModuleGrid",value:function getAllElementsInBacksideModuleGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix).map((function(t){return t.ElementId}))}},{key:"getAllElementsInGridSortedbyElementId",value:function getAllElementsInGridSortedbyElementId(){return Array.from(this.plannerElements.values())}},{key:"getAllElementsInGridSortedbyGridPos",value:function getAllElementsInGridSortedbyGridPos(){for(var t,o,i=[],l=[],r=this.generalPlanningState.grids[0].matrix,a=null!==(t=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix)&&void 0!==t?t:0,h=0;h<r.length;h++)for(var c=0;c<r[h].length;c++){var u,d=r[h][c],m=null===(u=d.plannedElement)||void 0===u?void 0:u.elementId;if(d&&m&&-1==l.indexOf(m)){var g=this.getElementById(m);l.push(m),i.push(g)}}for(h=0;h<a.length;h++)for(c=0;c<a[h].length;c++){var E,I=a[h][c],p=null===(E=I.plannedElement)||void 0===E?void 0:E.elementId;if(I&&p&&-1==l.indexOf(p)){var O=this.getElementById(p);l.push(p),i.push(O)}}return i}},{key:"getElementById",value:function getElementById(t){return this.plannerElements.get(t)}},{key:"getElementIsFirstInGrid",value:function getElementIsFirstInGrid(t){var o=this.getCellsInGridByElementId(t);return 0!=o.cells.length&&(0==o.cells[0].index.x&&0==o.cells[0].index.y&&!o.backside)}},{key:"getElementIsInLastCol",value:function getElementIsInLastCol(t,o){var i=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;return this.getCellsInGridByElementId(t).endColIndex==i.length}},{key:"getElementHasTopElement",value:function getElementHasTopElement(t){for(var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=o.startColIndex;l<o.endColIndex;l++)if(i[l].length>o.endRowIndex&&i[l][o.endRowIndex])return!0;return!1}},{key:"getTopElements",value:function getTopElements(t){var o,i=this.getCellsInGridByElementId(t),l=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=i.cells[0].plannedElement;if(!a)return r;for(var h=null===(o=l[a.area.fromX])||void 0===o?void 0:o[a.area.toY];h;){var c=h.plannedElement;if(!c)break;r.push(this.plannerElements.get(c.elementId)),h=l[c.area.fromX][c.area.toY]}return r}},{key:"getTopRightElement",value:function getTopRightElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(i.length>o.endColIndex&&i[o.endColIndex].length>o.endRowIndex&&i[o.endColIndex][o.endRowIndex]){var l=i[o.endColIndex][o.endRowIndex];return this.plannerElements.get(l.plannedElement.elementId)}}},{key:"getTopLeftElement",value:function getTopLeftElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(o.startColIndex>0&&i[o.startColIndex-1].length>0&&i[o.startColIndex-1][o.endRowIndex]){var l=i[o.startColIndex-1][o.endRowIndex];return this.plannerElements.get(l.plannedElement.elementId)}}},{key:"getElementHasBottomElement",value:function getElementHasBottomElement(t){return this.getCellsInGridByElementId(t).startRowIndex-1>=0}},{key:"getBottomElements",value:function getBottomElements(t){var o,i=this.getCellsInGridByElementId(t),l=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=i.cells[0].plannedElement;if(!a)return r;for(var h=null===(o=l[a.area.fromX])||void 0===o?void 0:o[a.area.fromY-1];h;){var c,u=h.plannedElement;if(!u)break;r.push(this.plannerElements.get(u.elementId)),h=null===(c=l[u.area.fromX])||void 0===c?void 0:c[u.area.fromY-1]}return r}},{key:"getElementHasRightElement",value:function getElementHasRightElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(i.length>o.endColIndex&&i[o.endColIndex].length>o.startRowIndex&&i[o.endColIndex][o.startRowIndex])return!0;return!1}},{key:"getRightElements",value:function getRightElements(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=o.cells[0].plannedElement;if(!a)return l;for(var h=a.area.fromY;h<a.area.toY;h++){var c,u,d=null===(c=i[a.area.toX])||void 0===c?void 0:c[h],m=null==d||null===(u=d.plannedElement)||void 0===u?void 0:u.elementId;d&&m&&-1==r.indexOf(m)&&(r.push(m),l.push(this.plannerElements.get(m)))}return l}},{key:"getElementHasLeftElement",value:function getElementHasLeftElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;return!!(o.startColIndex>0&&i[o.startColIndex-1][o.startRowIndex])}},{key:"getLeftElements",value:function getLeftElements(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=o.cells[0].plannedElement;if(!a)return l;for(var h=a.area.fromY;h<a.area.toY;h++){var c,u,d=null===(c=i[a.area.fromX-1])||void 0===c?void 0:c[h],m=null==d||null===(u=d.plannedElement)||void 0===u?void 0:u.elementId;d&&m&&-1==r.indexOf(m)&&(r.push(m),l.push(this.plannerElements.get(m)))}return l}},{key:"getAllElementsInColumn",value:function getAllElementsInColumn(t,o){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],l=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=[];if(!l[t])return r;if(i)for(var h=0;h<l[t].length;h++){var c,u=l[t][h],d=null==u||null===(c=u.plannedElement)||void 0===c?void 0:c.elementId;d&&u&&-1==a.indexOf(d)&&(a.push(d),r.push(this.plannerElements.get(d)))}else for(h=l[t].length-1;h>=0;h--){var m,g=l[t][h],E=null==g||null===(m=g.plannedElement)||void 0===m?void 0:m.elementId;g&&E&&-1==a.indexOf(E)&&(a.push(E),r.push(this.plannerElements.get(E)))}return r}},{key:"getColumnCount",value:function getColumnCount(){return this.generalPlanningState.grids[0].matrix.length}},{key:"getRowCount",value:function getRowCount(t,o){return o?this.generalPlanningState.grids[1].matrix[t].length:this.generalPlanningState.grids[0].matrix[t].length}},{key:"getAllElementsInRow",value:function getAllElementsInRow(t,o){for(var i=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=0;a<i.length;a++)if(i[a].length>t){var h,c=i[a][t],u=null==c||null===(h=c.plannedElement)||void 0===h?void 0:h.elementId;c&&u&&-1==r.indexOf(u)&&(r.push(u),l.push(this.plannerElements.get(u)))}return l}},{key:"getSizeOfHighesRow",value:function getSizeOfHighesRow(t){for(var o=t?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,i=0,l=0;l<o.length;l++)for(var r=o[l].length;r>=0;r--){if(o[l][r]){i<r&&(i=r);break}}return i+1}},{key:"getNeighborElements",value:function getNeighborElements(t,o){var i,l,r=this,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],h=this.getCellsInGridByElementId(t),c=h.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u=[],d=h.cells[0].plannedElement;if(!d)return u;for(var m=c[d.area.fromX],g=0,E=0,I=0;I<m.length;){var p=m[I];p.index.y<h.startRowIndex&&(g=Math.round(1e3*(g+p.plannedElement.size.height))/1e3),p.index.y<h.endRowIndex&&(E=Math.round(1e3*(E+p.plannedElement.size.height))/1e3),I=p.plannedElement.area.toY}var O=0,R=[];switch(o){case"RIGHT":for(var k=d.area.toX;k<c.length;){for(var P,v,T=c[k],V=0;V<T.length;){var _,B,C=T[V];R.includes(C)||((d.area.fromY==V&&this.gridSetupParams.forceSingleCellPerElement&&d.area.toX==k||a&&!this.gridSetupParams.forceSingleCellPerElement&&O==g||!a&&O>=g&&O<=E)&&R.push(C),O=Math.round(1e3*(O+C.plannedElement.size.height))/1e3,V=null!==(_=null===(B=C.plannedElement)||void 0===B?void 0:B.area.toY)&&void 0!==_?_:V+1)}O=0,k=null!==(P=null===(v=T[0].plannedElement)||void 0===v?void 0:v.area.toX)&&void 0!==P?P:k+1}R.forEach((function(t){return!u.find((function(o){return o.ElementId==t.plannedElement.elementId}))&&u.push(r.plannerElements.get(t.plannedElement.elementId))}));break;case"LEFT":for(var x=d.area.fromX-1;x>0;){for(var b=c[x],y=0;y<b.length;){var H,G,D=b[y];R.includes(D)||((d.area.fromY==y&&this.gridSetupParams.forceSingleCellPerElement&&d.area.toX==x||a&&!this.gridSetupParams.forceSingleCellPerElement&&O==g||!a&&O>=g&&O<=E)&&R.push(D),O=Math.round(1e3*(O+D.plannedElement.size.height))/1e3,y=null!==(H=null===(G=D.plannedElement)||void 0===G?void 0:G.area.toY)&&void 0!==H?H:y+1)}O=0,x=b[0].plannedElement?b[0].plannedElement.area.fromX-1:x+1}R.forEach((function(t){return!u.find((function(o){return o.ElementId==t.plannedElement.elementId}))&&u.push(r.plannerElements.get(t.plannedElement.elementId))}));break;case"TOP":for(var L=[],A=d.area.fromX;A<d.area.toX;){var S=c[A][d.area.toY];if(!S)break;if(L.push(S),a)break;A=S.plannedElement.area.toX}if(0==L.length)break;L.forEach((function(t){var o,i=null===(o=t.plannedElement)||void 0===o?void 0:o.elementId;i&&u.push(r.plannerElements.get(i))}));break;case"DOWN":var w=null===(i=c[d.area.fromX])||void 0===i?void 0:i[d.area.fromY-1],N=null==w||null===(l=w.plannedElement)||void 0===l?void 0:l.elementId;N&&u.push(this.plannerElements.get(N));break;case"BACK":if(this.hasActiveBackside){var M=this.getPlannerElementAtGridPos(h.startColIndex,h.startRowIndex,!0);null!=M&&(u=[M])}}return u}},{key:"getOppositeElement",value:function getOppositeElement(t){if(this.hasActiveBackside){var o=this.getCellsInGridByElementId(t);return o.backside?this.getPlannerElementAtGridPos(o.startColIndex,o.startRowIndex,!1):this.getPlannerElementAtGridPos(o.startColIndex,o.startRowIndex,!0)}}},{key:"getOppositeElements",value:function getOppositeElements(t){var o=[];if(this.hasActiveBackside)for(var i=0;i<t.length;i++){var l=this.getOppositeElement(t[i]);null!=l&&o.push(l)}return o}},{key:"getSizeOfWholeSet",value:function getSizeOfWholeSet(t){for(var o=0,i=0,l=0,r=[],a=this.generalPlanningState.grids[0].matrix,h=0;h<a.length;){for(var c,u,d=0,m=a[h],g=0;g<m.length;){var E,I,p,O=m[g],k=null===(E=O)||void 0===E||null===(E=E.plannedElement)||void 0===E?void 0:E.elementId;k&&O&&-1==r.indexOf(k)&&(d+=this.plannerElements.get(k).getHeight(),0==h&&0==g&&(i=O.plannedElement.size.depth)),g=null!==(I=null===(p=O.plannedElement)||void 0===p?void 0:p.area.toY)&&void 0!==I?I:g+1}d>l&&(l=d);var P=this.getGridColumnWidth(h);t&&h>0&&(77.9==P?P=75:40.4==P?P=37.5:21.7==P&&(P=18.75)),o+=P,h=null!==(c=null==m||null===(u=m[0])||void 0===u||null===(u=u.plannedElement)||void 0===u?void 0:u.area.toX)&&void 0!==c?c:h+1}return this.hasActiveBackside&&(i*=2),new R.P(o,l,i)}},{key:"getHighestElementsPerSeries",value:function getHighestElementsPerSeries(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.hasActiveBackside)throw new Error("this function is doesnt implement the backside logic (yet)");for(var o=[],i=this.generalPlanningState.grids[0].matrix,l=-1,r=0;r<i.length;){for(var a,h=i[r],c=0,u=0;u<h.length;){var d=h[u].plannedElement;c+=d.size.height,u=d.area.toY}Math.round(c)==Math.round(l)||t?(o[o.length-1]||o.push([]),o[o.length-1].push(i[r][t?0:h.length-1].plannedElement)):i[r][h.length-1].plannedElement.area.fromX==r&&o.push([i[r][t?0:h.length-1].plannedElement]),l=c;var m=h[h.length-1].plannedElement.area.toX,g=null===(a=i[m])||void 0===a?void 0:a.length;if(g&&g!=h.length){var E=i[m][g-1];E.index.x!=E.plannedElement.area.fromX&&(m=E.plannedElement.area.toX)}r=m}return o}},{key:"getAllElementsInSameRowByElementId",value:function getAllElementsInSameRowByElementId(t){var o=this.getCellsInGridByElementId(t),i=this.getAllElementsInRow(o.startRowIndex,!1);return this.hasActiveBackside&&(i=i.concat(this.getAllElementsInRow(o.startRowIndex,!0))),{elementIds:i.map((function(t){return t.ElementId})),plannerElements:i,backside:o.backside}}},{key:"getAllElementsToFillUp",value:function getAllElementsToFillUp(t,o){var i=this,l=this.getCellsInGridByElementId(t),r=l.cells[0].plannedElement,a="LEFT"==o?l.startColIndex:l.endColIndex-1,h=l.startRowIndex,c=l.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u=[],d=r.area.toX-r.area.fromX,m="RIGHT"==o?+d:-d;u.push(r.elementId);_objectSpread(_objectSpread({},r.area),{},{fromX:r.area.fromX+m,toX:r.area.toX+m});for(var g=function _loop(t){var l,h=null===(l=c[a][t])||void 0===l?void 0:l.plannedElement;if(!h)return E=t,0;var d=i.getNeighborElements(h.elementId,"TOP",!1),m=0;d.forEach((function(t){return m+=t.Width}));var g=0;if(h.size.width>m&&(g=h.size.width-m),i.getNeighborElements(h.elementId,o,!1).forEach((function(t){i.getNeighborElements(t.ElementId,"TOP").length>0||(g+=t.Width)})),g>=r.size.width)return E=t,0;for(var I=r.size.width-g;I>0;)u.push(h.elementId),I=Math.round(I-h.size.width);t=h.area.fromY-1,E=t},E=h-1;E>=0&&0!==g(E););return{elements:u.reverse(),backside:l.backside}}},{key:"getAllElementsDown",value:function getAllElementsDown(t){var o=this.getCellsInGridByElementId(t);if(0==o.startRowIndex)return{elements:[],backside:!1};for(var i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=o.startColIndex;r<o.endColIndex;r++)for(var a=o.startRowIndex--;a>=0;a--){var h,c=i[r][a],u=null==c||null===(h=c.plannedElement)||void 0===h?void 0:h.elementId;c&&u&&-1==l.indexOf(u)&&l.push(u)}return{elements:l,backside:o.backside}}},{key:"getAllElementsInSameCol",value:function getAllElementsInSameCol(t){var o=this.getCellsInGridByElementId(t),i=this.getAllElementsInColumn(o.startColIndex,o.backside);return null==i&&(i=[]),{elements:i.map((function(t){return t.ElementId})),backside:o.backside}}},{key:"prepareGridForColCopy",value:function prepareGridForColCopy(t,o){var i,l,r;if(!(o.y>0)){var a=this.getCellsInGridByElementId(t),h=o.x>0,c=a.cells[0].plannedElement,u={x:c.area.toX-1+o.x,y:c.area.fromY+o.y};o.x<0&&(u.x=a.cells[0].plannedElement.area.fromX-1);var d=this.generalPlanningState.grids[0].matrix,m=null!==(i=null===(l=this.generalPlanningState.grids[1])||void 0===l?void 0:l.matrix)&&void 0!==i?i:0,g=c.area.toX-c.area.fromX,E=null===(r=d[a.cells[0].index.x+o.x])||void 0===r?void 0:r[a.cells[0].index.y];(-1==u.x||E&&!h)&&(u.x-=o.x);var I=function moveGrid(t){for(var o=new Array,i=t.filter((function(t){return t.index.x==c.area.toX})),l=[],r=[],a=function _loop2(){var t=d[m][c.area.fromY],o=d[m][c.area.fromY-1];t&&!l.find((function(o){return o.plannedElement.elementId==t.plannedElement.elementId}))&&l.push(d[m][c.area.fromY]),o&&!r.find((function(t){return t.plannedElement.elementId==o.plannedElement.elementId}))&&r.push(d[m][c.area.fromY-1])},m=0;m<d.length;m++)a();var E=l.reduce((function(t,o){return t+o.plannedElement.size.width}),0),I=r?r.reduce((function(t,o){return t+o.plannedElement.size.width}),0):0,p=i.find((function(t){return t.index.y==u.y})),O=t.filter((function(t){return t.index.x==c.area.fromX-1})),R=O.find((function(t){return t.index.y==u.y}));return t.forEach((function(t){t.index.x>=u.x&&(h&&(p||0==i.length)&&(!(E<=I-c.size.width)||t.index.y>=c.area.fromY&&t.index.y<c.area.toY)||!h&&(R||0==O.length)||-1==u.x)&&(t.index.x+=g,t.plannedElement.area.fromX+=g,t.plannedElement.area.toX+=g),o[t.index.x]||(o[t.index.x]=[]),o[t.index.x][t.index.y]=t})),o};d=I(this.getAllUsedCellsInGrid(!1));for(var p=0;p<g;p++)d[u.x+p]||(d[u.x+p]=[]);if(this.generalPlanningState.grids[0].matrix=d,this.hasActiveBackside){m=I(this.getAllUsedCellsInGrid(!0));for(var O=0;O<g;O++)m[u.x+O]||(m[u.x+O]=[]);this.generalPlanningState.grids[1].matrix=m}}}},{key:"prepareGridForBackSideCopy",value:function prepareGridForBackSideCopy(){this.generalPlanningState.grids[1]={matrix:[[]]},this.hasActiveBackside=!0}},{key:"addElementAtGridPos",value:function addElementAtGridPos(t,o,i,l){for(var r=l?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,a=this.createNewCells(t,o,i,l),h=0;h<a.length;h++){var c=a[h];r[c.index.x]||(r[c.index.x]=[]),r[c.index.x][c.index.y]=c}this.plannerElements.set(t.getElementId(),t),l&&(this.hasActiveBackside=!0)}},{key:"moveElementAsCopy",value:function moveElementAsCopy(t,o){var i=this.plannerElements.get(t),l=this.getCellsInGridByElementId(t);if(i){this.deleteElement(t,"STD");var r=this.generalPlanningState.grids[0].matrix,a=void 0;if(o.x<0&&0==o.y){var h=l.endColIndex>=o.x;l.startColIndex<=o.x&&(o.x-=l.endColIndex-l.startColIndex),o.x<0&&(o.x=0),a=this.createNewCells(i,o.x,o.y,!1);var c=[],u=a[0].plannedElement;r.forEach((function(t,i){t.forEach((function(t,l){var a=i,d=0;l!=o.y&&0!=o.y||(a+=h?u.area.toX-u.area.fromX:0,d=h?u.area.toX-u.area.fromX:0),c[a]||(c[a]=[]);var m=r[i][l].plannedElement,g={plannedElement:_objectSpread(_objectSpread({},m),{},{area:{fromX:a,toX:m.area.toX+d,fromY:m.area.fromY,toY:m.area.toY}}),index:{x:a,y:l}};c[a][l]=g}))})),r=c}else o.x>l.startColIndex&&0==l.startRowIndex&&(o.x-=l.endColIndex-l.startColIndex),a=this.createNewCells(i,o.x,o.y,!1);for(var d=0;d<a.length;d++)r[a[d].index.x]||(r[a[d].index.x]=[]),r[a[d].index.x][a[d].index.y]=a[d];this.plannerElements.set(t,i),this.generalPlanningState.grids[0].matrix=r}}},{key:"addElementAsCopy",value:function addElementAsCopy(t,o,i){var l=this.getCellsInGridByElementId(t),r=l.cells[0].plannedElement.area,a={x:r.fromX,y:r.fromY};i.x>0?a.x=r.toX-1+i.x:i.x<0?a.x=r.fromX-(r.toX-r.fromX):i.y>0&&(a.y=r.toY-1+i.y);var h=-1==i.z||1==l.backside;a.x<0&&(a.x=0);for(var c=h?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u=this.createNewCells(o,a.x,a.y,h),d=0;d<u.length;d++)c[u[d].index.x]||(c[u[d].index.x]=[]),c[u[d].index.x][u[d].index.y]=u[d];this.plannerElements.set(o.getElementId(),o)}},{key:"deleteElement",value:function deleteElement(t,o){this.plannerElements.has(t)||P.error(new d.GE("Try to delete an elementId that does not exist"));this.getCellsInGridByElementId(t);k.Z.removeDockingPointRelations(this.plannerElements.get(t)),this.deleteElementByIdFromGrid(t),this.plannerElements.delete(t),this.hasActiveBackside}},{key:"updateGridElementDimensions",value:function updateGridElementDimensions(t,o){var i=this;if(!o)return!1;var l=structuredClone(this.generalPlanningState),r=this.getCellsInGridByElementId(t),a=this.gridSetupParams.forceSingleCellPerElement,h={x:r.cells[0].plannedElement.area.toX,y:r.cells[0].plannedElement.area.toY},c={x:0,y:0};r.cells.forEach((function(t){if(t.plannedElement){var l=t.plannedElement;l.size.width=o.width,l.size.height=o.height,l.size.depth=o.depth,l.area={fromX:l.area.fromX,toX:a?t.index.x+1:Math.round(l.area.fromX+o.width/i.gridSetupParams.fixCellRasterWidth),fromY:l.area.fromY,toY:a?t.index.y+1:Math.round(l.area.fromY+o.height/i.gridSetupParams.fixCellRasterHeight)},c.y=t.plannedElement.area.toY-h.y,c.x=t.plannedElement.area.toX-h.x}}));var u=r.cells[0],d=this.generalPlanningState.grids[0].matrix;if(0!=c.y)for(var m=u.plannedElement.area.fromX;m<u.plannedElement.area.toX;m++){var g=d[m];if(g)for(var E=h.y;E<g.length;E++){var I=g[E];I.index.y==E&&I.plannedElement.elementId!=u.plannedElement.elementId&&(I.index.y+=c.y,I.plannedElement.area.fromY+=c.y,I.plannedElement.area.toY+=c.y)}}else if(0!=c.x)for(var p=u.plannedElement.area.fromX;p<d.length;p++)for(var O=u.plannedElement.area.fromY;O<u.plannedElement.area.toY;O++){var R=d[p][O];R&&R.plannedElement.elementId!=t&&(R.index.x+=c.x,R.plannedElement.area.fromX+=c.x,R.plannedElement.area.toX+=c.x)}if(a)return!1;r.cells[0].plannedElement;for(var k,P=new Array,v=this.getAllUsedCellsInGrid(!1),T=function _loop3(){var t=v[V],r=t.plannedElement.area;if(P.find((function(o){return o.find((function(o){var i,l;return(null==o||null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==(null===(l=t.plannedElement)||void 0===l?void 0:l.elementId)}))})))return 0;for(var a=r.fromX;a<r.toX;a++)for(var h=r.fromY;h<r.toY;h++){P[a]||0!=r.fromY||(P[a]=[]);var c=v.find((function(o){return o.plannedElement.area.toX>=t.plannedElement.area.toX&&o.plannedElement.area.toY==t.index.y}));if(!c&&!P[a])return i.generalPlanningState=l,{v:!0};if(!P[a]&&!c)return i.generalPlanningState=l,{v:!0};P[a]||(P[a]=[]),P[a][h]=_objectSpread(_objectSpread({},t),{},{index:{x:a,y:h},plannedElement:_objectSpread(_objectSpread({},t.plannedElement),{},{area:{fromX:t.plannedElement.area.fromX,toX:t.plannedElement.area.fromX+(t.plannedElement.area.toX-t.plannedElement.area.fromX),fromY:t.plannedElement.area.fromY,toY:t.plannedElement.area.fromY+(t.plannedElement.area.toY-t.plannedElement.area.fromY)},size:_objectSpread(_objectSpread({},t.plannedElement.size),{},{depth:o.depth})})})}},V=0;V<v.length;V++)if(0!==(k=T())&&k)return k.v;return r.backside?this.generalPlanningState.grids[1].matrix=P:this.generalPlanningState.grids[0].matrix=P,!1}},{key:"updateWorldPosOfElements",value:function updateWorldPosOfElements(){var t,o,i,l=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.values());try{for(l.s();!(i=l.n()).done;){var r=i.value;k.Z.removeDockingPointRelations(r)}}catch(t){l.e(t)}finally{l.f()}for(var a=1,h=[],c=this.generalPlanningState.grids[0].matrix,u=null!==(t=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix)&&void 0!==t?t:[],m=0;m<c.length;m++)for(var g=0;g<c[m].length;g++){var E,I=c[m][g],p=null==I||null===(E=I.plannedElement)||void 0===E?void 0:E.elementId;if(p&&-1==h.indexOf(p)){var O=this.plannerElements.get(p);h.push(p);var R=this.getNeighborElements(p,"TOP"),v=this.getNeighborElements(p,"RIGHT"),T=this.getNeighborElements(p,"LEFT"),V=this.getNeighborElements(p,"DOWN");R.length>0&&k.Z.tryDockElement(O,"AVO",[R[0]]),T.length>0&&k.Z.tryDockElement(O,"AVL",[T[0]]),v.length>0&&k.Z.tryDockElement(O,"AVR",[v[0]]),V.length>0&&k.Z.tryDockElement(O,"AVU",[V[0]]),O.PosNr=a,a++}}for(var _=0;_<u.length;_++)for(var B=0;B<u[_].length;B++){var C,x=u[_][B],b=null==x||null===(C=x.plannedElement)||void 0===C?void 0:C.elementId;if(b&&-1==h.indexOf(b)){var y=this.plannerElements.get(b);h.push(b);var H=c[_][B],G=this.plannerElements.get(H.plannedElement.elementId);if(G){var D=null==G?void 0:G.getDockingPointById("AVO_AVO_2_IL");D?y&&k.Z.tryDockElementToDP(y,G,D):P.error(new d.GE("Error Loading DockingPoint AVO_2 for plannerElement"))}var L=this.getNeighborElements(b,"TOP"),A=this.getNeighborElements(b,"RIGHT");L.length>0&&k.Z.tryDockElement(y,"AVO",[L[0]]),A.length>0&&k.Z.tryDockElement(y,"AVL",[A[0]]),y.PosNr=a,a++}}}},{key:"destroyBoxPlannerGrid",value:function destroyBoxPlannerGrid(){var t,o=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.values());try{for(o.s();!(t=o.n()).done;){t.value.destroy()}}catch(t){o.e(t)}finally{o.f()}this.plannerElements.clear(),this.generalPlanningState.grids[0].matrix=[],this.hasActiveBackside&&(this.hasActiveBackside=!1,this.generalPlanningState.grids[1].matrix=[])}},{key:"destroyBacksideModuleGrid",value:function destroyBacksideModuleGrid(){this.hasActiveBackside=!1;var t,o=this.getAllElementsInBackGrid(),i=BoxPlannerGrid_createForOfIteratorHelper(o.values());try{for(i.s();!(t=i.n()).done;){var l=t.value;this.plannerElements.delete(l.ElementId),l.destroy()}}catch(t){i.e(t)}finally{i.f()}o=[],this.generalPlanningState.grids[1].matrix=[]}},{key:"getPlannerHasActiveBackside",value:function getPlannerHasActiveBackside(){return this.hasActiveBackside}},{key:"getForceSingleCellPerElement",value:function getForceSingleCellPerElement(){return this.gridSetupParams.forceSingleCellPerElement}},{key:"getBoundingBox",value:function getBoundingBox(){var t,o,i=this.generalPlanningState.grids[0].matrix,l=null==i||null===(t=i[0])||void 0===t||null===(t=t[0])||void 0===t?void 0:t.plannedElement,r=0,a=0,h=0,c=0,u=0,d=l?l.size.depth:0,m=0;o="RIGHT";for(var g=[],E=0;E<i.length;E++){var I,p=i[E][0];if(!p)break;var O=null===(I=p.plannedElement)||void 0===I?void 0:I.elementId;if(O&&-1==g.indexOf(O)){g.push(O);var R=this.plannerElements.get(O);if(!R)continue;var k=this.getValueOfOptionOfArticle(O,"OPTELEMENT");"RIGHT"==o?c+=R.getWidth():"FRONT"==o?d+=R.getWidth():"LEFT"==o?c-=R.getWidth():"BACK"==o&&(d-=R.getWidth()),"OPVECK_I"==k?"RIGHT"==o?o="FRONT":"FRONT"==o?o="LEFT":"LEFT"==o?o="BACK":"BACK"==o&&(o="RIGHT"):"OPVECK_A"==k&&("RIGHT"==o?o="BACK":"FRONT"==o?o="RIGHT":"LEFT"==o?o="FRONT":"BACK"==o&&(o="LEFT")),c<a&&(a=c),c>h&&(h=c),d<u&&(u=d),d>m&&(m=d);var P=this.getGridColumnHeight(E);r=r<P?P:r}}var v=m-u,T=h-a;return this.hasActiveBackside&&(v=2*d),{width:Math.round(1e3*T)/1e3,height:Math.round(1e3*r)/1e3,depth:Math.round(1e3*v)/1e3}}},{key:"getFreeMoveLocation",value:function getFreeMoveLocation(t){var o=this.getElementById(t);if(!o)return[];var i=this.getCellsInGridByElementId(t);if(0===i.cells.length)return[];var l,r=[],a=function isEmptyCell(t,o){var i;return void 0===(null===(i=h[t])||void 0===i?void 0:i[o])},h=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,c=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.keys());try{for(c.s();!(l=c.n()).done;){var u=l.value;if(u!=t){var d=this.getElementById(u);if(this.gridSetupParams.forceSingleCellPerElement){if(!this.getElementHasTopElement(u)&&d.getWidth()==o.getWidth()){var m=this.getCellsInGridByElementId(u),g=this.getAllElementsInRow(m.endRowIndex+1,m.backside);if(g.length>0&&g[0].getHeight()!=o.getHeight())continue;var E=this.createLocationInformation(o,i.backside,this.createEmptyCells(m.cells[0].plannedElement.area.fromX,m.cells[0].plannedElement.area.toX,m.cells[0].plannedElement.area.fromY,m.cells[0].plannedElement.area.toY+1,o.getWidth(),o.getHeight()),m.cells[0].plannedElement.area.fromX,m.cells[0].plannedElement.area.toX,1,1);r.push(E)}}else for(var I=this.getCellsInGridByElementId(u),p=-1,O=-1,R=I.cells[0].plannedElement.area.toY+1,k=I.startColIndex;k<=I.startColIndex+I.colCount-1;k++){var P=!1;if(a(k,R)){if(-1==p?(p=k,O=k):O=k,k==I.startColIndex+I.colCount-1)if(i.colCount<=O-p+1)P=!0;else{P=!0;for(var v=0;v<i.colCount;v++)if(a(p+v,I.endRowIndex)){P=!1;break}}}else i.colCount<=O-p+1&&(P=!0);if(P){var T=this.createLocationInformation(o,i.backside,this.createEmptyCells(p,I.endRowIndex+1,p+i.colCount-1,I.endRowIndex+i.rowCount-1,o.getWidth(),o.getHeight()),p,I.endRowIndex+1,i.colCount,i.rowCount);r.push(T)}}}}}catch(t){c.e(t)}finally{c.f()}var V=this.createLocationInformation(o,i.backside,this.createEmptyCells(-i.colCount,0,-1,i.rowCount-1,o.getWidth(),o.getHeight()),-i.colCount,0,i.colCount,i.rowCount);r.push(V);var _=this.createLocationInformation(o,i.backside,this.createEmptyCells(this.getColumnCount(),0,this.getColumnCount()+i.colCount-1,i.rowCount-1,o.getWidth(),o.getHeight()),this.getColumnCount(),0,i.colCount,i.rowCount);return r.push(_),r}},{key:"getFreePlanningLocation",value:function getFreePlanningLocation(t,o){var i=this.getElementById(t);if(i){var l=this.getCellsInGridByElementId(t);if(0!==l.cells.length){var r=l.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,a=l.startColIndex,h=l.endColIndex,c=l.startRowIndex,u=l.endRowIndex,d=-1,m=-1,g=-1,E=-1,I=[],p=function isValidCell(t,o){var i;return void 0===(null===(i=r[t])||void 0===i?void 0:i[o])};switch(o){case"LEFT":for(var O=a-1,R=!1,k=c;k<=u;k++)if(p(O,k)){m=k,R=!0;break}if(!R)return;R=!1;for(var P=a-1;P>=a-l.colCount&&(p(P,m)&&(0==m||!p(P,m-1)));P--)R=!0,d=P;if(!R)return;g=a-1,E=u,I=this.createEmptyCells(d,m,g,E,i.getWidth(),i.getHeight());break;case"TOP":for(var v=u+1,T=!1,V=h;V>=a;V--)p(V,v)&&(d=V,T=!0);if(!T)return;m=v,g=h,E=v+l.rowCount-1,I=this.createEmptyCells(d,m,g,E,i.getWidth(),i.getHeight());break;case"RIGHT":for(var _=h,B=!1,C=c;C<=u;C++)if(p(_,C)){m=C,B=!0;break}if(!B)return;B=!1;for(var x=h;x<=h+l.colCount&&(p(x,m)&&(0==m||!p(x,m-1)));x++)g=x,B=!0;if(!B)return;d=h,E=u,I=this.createEmptyCells(d,m,g,E,i.getWidth(),i.getHeight());break;default:return}return this.createLocationInformation(i,l.backside,I,d,m,g-d+1,E-m+1)}}}},{key:"createLocationInformation",value:function createLocationInformation(t,o,i,l,r,a,h){var c=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u={cells:i,widthPerCell:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:t.getWidth(),heightPerCell:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depthPerCell:t.getDepth(),width:this.gridSetupParams.forceFixCellRasterSize?a*this.gridSetupParams.fixCellRasterWidth:t.getWidth(),height:this.gridSetupParams.forceFixCellRasterSize?h*this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depth:t.getDepth(),startIndexWorldPos:new R.FM(0,0)};if(this.gridSetupParams.forceFixCellRasterSize)u.startIndexWorldPos=new R.FM(l*this.gridSetupParams.fixCellRasterWidth,r*this.gridSetupParams.fixCellRasterHeight);else{for(var d=0,m=0;m<l;m++){var g,E;d+=null!==(g=null===(E=c[m][0].plannedElement)||void 0===E?void 0:E.size.width)&&void 0!==g?g:0}l<0&&(d=-t.getWidth());var I=0;for(m=0;m<r;m++){var p,O;I+=null!==(p=null===(O=c[l][m].plannedElement)||void 0===O?void 0:O.size.width)&&void 0!==p?p:0}u.startIndexWorldPos=new R.FM(d,I)}return u}},{key:"getPlannerInteractionInformation",value:function getPlannerInteractionInformation(){for(var t=this.getAllElementsInGridSortedbyGridPos(),o={boxPlannerInteractionInformationPerElement:new Map},i=0;i<t.length;i++){var l=t[i],r=this.getCellsInGridByElementId(l.getElementId()),a=r.cells[0].plannedElement.area,h=this.createLocationInformation(l,r.backside,r.cells,a.fromX,a.toX,a.fromY,a.toY),c=this.getFreePlanningLocation(l.getElementId(),"LEFT"),u=this.getFreePlanningLocation(l.getElementId(),"RIGHT"),d=this.getFreePlanningLocation(l.getElementId(),"TOP"),m=this.getElementHasTopElement(l.getElementId()),g=[];!m&&t.length>1&&(g=this.getFreeMoveLocation(l.getElementId()));var E={location:h,isDeletable:!m&&t.length>1,availablePlanningLocations:{availableBoxPlannerCellsLeft:c,availableBoxPlannerCellsTop:d,availableBoxPlannerCellsRight:u},availableMovingLocations:g};o.boxPlannerInteractionInformationPerElement.set(l.getElementId(),E)}return o}},{key:"getGeneralPlanningState",value:function getGeneralPlanningState(){var t,o,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=arguments.length>1?arguments[1]:void 0;if(!i||!l)return this.generalPlanningState;var r=this.generalPlanningState.grids[0].matrix,a=[],h=r.length,c=0;r.forEach((function(t){t.length>c&&(c=t.length)}));Array.from(this.plannerElements.values()).map((function(t){return{basketId:t.getBasketId(),elementId:t.getElementId(),articleCodex:t.getArticleCodex(),size:{width:t.getWidth(),height:t.getHeight(),depth:t.getDepth()},area:{fromX:void 0,toX:void 0,fromY:void 0,toY:void 0}}}));var u=!1,d=void 0,g=void 0;if(l){var E=this.getCellsInGridByElementId(l);d={articleCodex:(g=E.cells[0].plannedElement).articleCodex,elementId:g.elementId,gridSpace:{rows:g.area.toY-g.area.fromY+1,colums:g.area.toX-g.area.fromX+1},area:g.area,size:g.size,rules:[]},u=!!r.find((function(t,o){return o>=g.area.fromX&&o<g.area.toX&&r[o].length>g.area.toY})),0==g.area.fromX&&this.getNeighborElements(g.elementId,"LEFT").length>0&&this.getNeighborElements(g.elementId,"RIGHT").length>0&&(u=!0)}if(u)return this.generalPlanningState;for(var I=0;I<h;I++){var p=0==g.area.fromX?I:I+1;a[p]||r[I]&&(a[p]=(0,m.Z)(r[I]));for(var O=0;O<c;O++)if(r[I].length>O&&r[I][O]){a[p][O].plannedElement;a[p][O]=_objectSpread({},r[I][O])}}var R=0==g.area.fromX?g.area.fromX:g.area.fromX+1,k=0==g.area.fromX?g.area.toX:g.area.toX+1;a.forEach((function(t,o){if(!(o>=R&&o<k)){var i=a[o],l=i.length,r=0==g.area.fromX?o:o-1;i[l]={index:{x:r,y:l}}}}));var P=a.length;return(null===(t=g)||void 0===t?void 0:t.area.toX)!=r.length&&(a[P]=[{index:{x:0==g.area.fromX?P:P-1,y:0}}]),0!=(null===(o=g)||void 0===o?void 0:o.area.fromX)&&(a[0]=[{index:{x:-1,y:0}}]),_objectSpread(_objectSpread({},this.generalPlanningState),{},{selectedElement:d,grids:[_objectSpread(_objectSpread({},this.generalPlanningState.grids[0]),{},{matrix:a})]})}},{key:"getRowSizes",value:function getRowSizes(t,o){if(this.getForceSingleCellPerElement()){for(var i=t[0].length,l=Array(i).fill(-1),r=function _loop4(i){var r,a=null===(r=t.find((function(t){var o,l;return void 0!==(null===(o=t[i].plannedElement)||void 0===o?void 0:o.size.height)&&-1!=(null===(l=t[i].plannedElement)||void 0===l?void 0:l.size.height)})))||void 0===r?void 0:r[i];if(null!=a&&a.plannedElement?l[i]=a.plannedElement.size.height:o&&(l[i]=o.size.height),-1===l[i])return 1},a=0;a<i&&!r(a);a++);return l.includes(-1)&&P.error(new Error("Column sizes are not set")),l}return 15}},{key:"getColumnSizes",value:function getColumnSizes(t,o){if(this.getForceSingleCellPerElement()){for(var i=t.length,l=Array(i).fill(-1),r=0;r<i;r++){var a=t[r].find((function(t){return t.plannedElement}));if(null!=a&&a.plannedElement?l[r]=a.plannedElement.size.width:o&&(l[r]=o.size.width),!l.includes(-1))break}if(l.includes(-1))throw new Error("Row sizes are not set");return l}return 15}},{key:"addFreeCellsToMatrix",value:function addFreeCellsToMatrix(t,o,i){o.forEach((function(o){var i=o.index.x,l=o.index.y,r=t.find((function(t){return t.find((function(t){return t.index.x===i}))}));if(!r){for(var a=[],h=0;h<t[0].length;h++)a.push({index:new R.FM(i,h),plannedElement:void 0});t[0][0].index.x>i?t.unshift(a):t.push(a)}var c=t.find((function(t){return t.find((function(t){return t.index.y===l}))}));c||t.map((function(t){var o;return t.push({index:new R.FM((null===(o=t[0])||void 0===o?void 0:o.index.x)||0,l),plannedElement:void 0})}))})),i.push({type:"FixedPositon",grids:[{gridIndex:0,places:[{lowestX:Math.min.apply(Math,(0,m.Z)(o.map((function(t){return t.index.x})))),lowestY:Math.min.apply(Math,(0,m.Z)(o.map((function(t){return t.index.y}))))}]}]})}}])}(),T=i(24829),V=i(57312),_=i(58178),B=d.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),C=function(){function DivaBoxPlanner(t,o){(0,r.Z)(this,DivaBoxPlanner),(0,h.Z)(this,"set",void 0),(0,h.Z)(this,"plannerID",void 0),(0,h.Z)(this,"constructionRulesHandler",void 0),(0,h.Z)(this,"boxPlannerGrid",void 0),(0,h.Z)(this,"nextElementId",1),this.set=t,this.plannerID=o,this.constructionRulesHandler=new O(this.set.getValueOfOptionOfArticle,this.set.checkArticleHasOption,this.set.updateCfgValuesByPlanner);this.boxPlannerGrid=new v({hasMaxGridRasterHeight:!1,hasMaxGridRasterWidth:!1,forceSingleCellPerElement:!0,forceFixCellRasterSize:!1},this.set.getValueOfOptionOfArticle)}return(0,a.Z)(DivaBoxPlanner,[{key:"initPlanner",value:(E=(0,l.Z)(u().mark((function _callee(t){var o,i,l,r,a,h,c,m,g,E,I,p,O;return u().wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(null==(o=JSON.parse(d.ZP.decodeBase64(t))).v||2!=o.v){u.next=26;break}if(o.set&&o.set.elements&&0!=o.set.elements.length){u.next=4;break}return u.abrupt("return");case 4:i=o.set.elements,l=0;case 6:if(!(l<i.length)){u.next=21;break}return r=i[l],a=parseInt(r.elementID),h=new V.Z(this.set.getSetId(),r.basketID,a,DivaBoxPlanner.plannerType),this.nextElementId<a+1&&(this.nextElementId=a+1),this.set.setElementId(r.basketID,h.ElementId),this.constructionRulesHandler.getConstructionRulesLoaded()||((c=this.set.getConstructionRuleOfElementId(h.ElementId))&&(this.boxPlannerGrid.GridSetupParams={fixCellRasterHeight:19.2,fixCellRasterWidth:19.2,forceFixCellRasterSize:null===(m=c.constructionRules.forceFixCellRasterSize)||void 0===m||m,forceSingleCellPerElement:null===(g=c.constructionRules.forceSingleCellPerElement)||void 0===g||g,hasMaxGridRasterHeight:c.constructionRules.hasMaxGridRasterHeight,maxGridRasterHeight:c.constructionRules.maxGridRasterHeight,hasMaxGridRasterWidth:c.constructionRules.hasMaxGridRasterWidth,maxGridRasterWidth:c.constructionRules.maxGridRasterWidth}),this.constructionRulesHandler.setConstructionRules(c)),(E=this.set.getPlannerData(h.ElementId))&&h.updatePlannerData(E),u.next=17,T.Z.loadSVG(h,this.set);case 17:this.boxPlannerGrid.addElementAtGridPos(h,r.boxPlannerInfo.gridPosCol,r.boxPlannerInfo.gridPosRow,r.boxPlannerInfo.isOnBackside);case 18:l++,u.next=6;break;case 21:return this.boxPlannerGrid.updateWorldPosOfElements(),u.next=24,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 24:u.next=42;break;case 26:I=1,l=0;case 28:if(!(l<o.Elements.length)){u.next=38;break}return p=o.Elements[l],(a=parseInt(p.ID))>I&&(I=a),O={boxElementID:p.ID,boxCol:p.col,boxRow:p.row,boxUpdateWholePlanning:!1},u.next=35,this.addPlannerElement(p.BasketID,O);case 35:l++,u.next=28;break;case 38:return this.nextElementId=I+1,this.boxPlannerGrid.updateWorldPosOfElements(),u.next=42,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 42:return u.abrupt("return",o);case 43:case"end":return u.stop()}}),_callee,this)}))),function initPlanner(t){return E.apply(this,arguments)})},{key:"saveSetPlanner",value:function saveSetPlanner(){for(var t=[],o=this.boxPlannerGrid.getAllElementIdsInGrid(),i=0;i<o.length;i++){var l=this.boxPlannerGrid.getElementById(o[i]);if(l){for(var r=this.boxPlannerGrid.getCellsInGridByElementId(o[i]),a=l.getDockingDockingPoints(),h=[],c=0;c<a.length;c++){var u,d={id:a[c].DpId,onID:a[c].OnElementId,onDPID:null===(u=a[c].OnDP)||void 0===u?void 0:u.DpId};h.push(d)}var m={elementID:l.getElementId(),basketID:this.set.getBasketId(l.getElementId()),CatalogCodex:this.set.getCatalogCodex(),Codex:this.set.getArticleCodex(l.getElementId()),posNr:l.PosNr,x:l.WorldPosCenter.x,y:l.WorldPosCenter.y,z:l.WorldPosCenter.z,rot:l.RotDeg,width:l.Width?l.Width:-1,height:l.Height?l.Height:-1,depth:l.Depth?l.Depth:-1,DP:h,boxPlannerInfo:{gridPosCol:r.startColIndex,gridPosRow:r.startRowIndex,isOnBackside:r.backside}};t.push(m)}}var g=this.boxPlannerGrid.getBoundingBox();return{setId:this.set.getSetId(),x:0,y:0,z:0,width:g.width,height:g.height,depth:g.depth,rot:0,elements:t}}},{key:"addPlannerElement",value:(g=(0,l.Z)(u().mark((function _callee2(t,o){var i,l,r,a,h;return u().wrap((function _callee2$(c){for(;;)switch(c.prev=c.next){case 0:if(null!=o&&null!=o.boxElementID&&null!=o.boxCol&&null!=o.boxRow){c.next=2;break}return c.abrupt("return");case 2:return i=new V.Z(this.set.getSetId(),t,o.boxElementID,DivaBoxPlanner.plannerType),this.nextElementId=isNaN(o.boxElementID)?this.nextElementId:o.boxElementID+1,this.set.setElementId(t,i.ElementId),l=this.set.getPlannerData(i.ElementId),i.updatePlannerData(l),c.next=9,T.Z.loadSVG(i,this.set);case 9:if(this.constructionRulesHandler.getConstructionRulesLoaded()||(r=this.set.getConstructionRuleOfElementId(i.ElementId))&&(this.boxPlannerGrid.GridSetupParams={fixCellRasterHeight:19.2,fixCellRasterWidth:19.2,forceFixCellRasterSize:null===(a=r.constructionRules.forceFixCellRasterSize)||void 0===a||a,forceSingleCellPerElement:null===(h=r.constructionRules.forceSingleCellPerElement)||void 0===h||h,hasMaxGridRasterHeight:r.constructionRules.hasMaxGridRasterHeight,maxGridRasterHeight:r.constructionRules.maxGridRasterHeight,hasMaxGridRasterWidth:r.constructionRules.hasMaxGridRasterWidth,maxGridRasterWidth:r.constructionRules.maxGridRasterWidth},this.constructionRulesHandler.setConstructionRules(r)),this.boxPlannerGrid.addElementAtGridPos(i,o.boxCol,o.boxRow,null!=o.backside&&o.backside),!o.boxUpdateWholePlanning){c.next=15;break}return this.boxPlannerGrid.updateWorldPosOfElements(),c.next=15,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 15:case"end":return c.stop()}}),_callee2,this)}))),function addPlannerElement(t,o){return g.apply(this,arguments)})},{key:"extendPlanner",value:(m=(0,l.Z)(u().mark((function _callee3(t,o){return u().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,o){return m.apply(this,arguments)})},{key:"movePlannerElement",value:(c=(0,l.Z)(u().mark((function _callee4(t,o){return u().wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:return this.boxPlannerGrid.moveElementAsCopy(t,o),this.boxPlannerGrid.updateWorldPosOfElements(),i.next=4,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,"",[t]);case 4:case"end":return i.stop()}}),_callee4,this)}))),function movePlannerElement(t,o){return c.apply(this,arguments)})},{key:"copyPlannerElement",value:(i=(0,l.Z)(u().mark((function _callee5(t,o){var i,l,r,a,h,c=this;return u().wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:if(o){u.next=3;break}return u.abrupt("return");case 3:"STD"==o.copyType&&(o.targetElements=[]),i=[],l=this,t.forEach((function(t){var l;-1==o.copyIndex.z?c.boxPlannerGrid.getPlannerHasActiveBackside()||c.boxPlannerGrid.prepareGridForBackSideCopy():c.boxPlannerGrid.prepareGridForColCopy(t.key,o.copyIndex);var r=new V.Z(c.set.getSetId(),t.value,c.nextElementId,DivaBoxPlanner.plannerType);c.nextElementId++,c.set.setElementId(t.value,r.ElementId);var a=c.set.getPlannerData(r.ElementId);r.updatePlannerData(a),c.boxPlannerGrid.addElementAsCopy(t.key,r,o.copyIndex),c.constructionRulesHandler.onElementCopy(t.key,r.getElementId()),i.push(r),"STD"==o.copyType&&(null===(l=o.targetElements)||void 0===l||l.push(r.getElementId()))})),r=0;case 8:if(!(r<i.length)){u.next=15;break}return u.next=11,T.Z.loadSVG(i[r],this.set);case 11:if(1==o.copyIndex.y&&this.constructionRulesHandler.getHasMaxElemCountPerColumn()&&this.boxPlannerGrid.getCellsInGridByElementId(i[r].ElementId).endRowIndex==l.constructionRulesHandler.getMaxElemCountPerColumn())for(a=i[r].getFreeDockingPointsByType("AVO"),h=0;h<a.length;h++)a[h].disableDP(!0);case 12:r++,u.next=8;break;case 15:return this.boxPlannerGrid.updateWorldPosOfElements(),u.next=18,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,o.changedOPT,o.targetElements);case 18:case"end":return u.stop()}}),_callee5,this)}))),function copyPlannerElement(t,o){return i.apply(this,arguments)})},{key:"initIDM3DMeta",value:function initIDM3DMeta(t){B.debug("No IDM3D Planner for BoxPlanner")}},{key:"getPlannerElementsInfluencedByDeletion",value:function getPlannerElementsInfluencedByDeletion(t,o){if(this.constructionRulesHandler.getForceWholePlanningSameHeight())return 0==this.boxPlannerGrid.getCellsInGridByElementId(t).startRowIndex?[]:this.boxPlannerGrid.getAllElementsInSameRowByElementId(t).elementIds.filter((function(o){return o!=t}));if(this.boxPlannerGrid.getPlannerHasActiveBackside()){if("BoxPlanner_backside"==o)return this.boxPlannerGrid.getAllElementsInBackGrid().map((function(t){return t.ElementId})).filter((function(o){return o!=t}));var i=this.boxPlannerGrid.getOppositeElement(t);if(i)return[i.getElementId()]}return[]}},{key:"getPlannerElementsInfluencedByCopy",value:function getPlannerElementsInfluencedByCopy(t,o){var i=[];if(o&&-1==o.copyIndex.z)return this.boxPlannerGrid.getAllElementIdsInGrid();if(o&&"BoxPlanner_COL"==o.copyType){for(var l=this.boxPlannerGrid.getCellsInGridByElementId(t),r=this.boxPlannerGrid.getAllElementsInColumn(l.startColIndex,l.backside),a=0;a<r.length;a++)i.push(r[a].getElementId());return i}if(i.push(t),o){if(0!=o.copyIndex.x)if(this.constructionRulesHandler.getForceWholePlanningSameHeight()){var h=this.boxPlannerGrid.getAllElementsInSameCol(t);i=h.elements,h.backside}else{var c=this.boxPlannerGrid.getAllElementsToFillUp(t,o.copyIndex.x>0?"RIGHT":"LEFT");i=c.elements,c.backside}if(0!=o.copyIndex.y&&this.constructionRulesHandler.getForceWholePlanningSameHeight()){var u=this.boxPlannerGrid.getAllElementsInSameRowByElementId(t);i=u.elementIds,u.backside}this.boxPlannerGrid.getPlannerHasActiveBackside()&&(i=i.concat(this.boxPlannerGrid.getOppositeElements(i).map((function(t){return t.ElementId}))))}return i}},{key:"deletePlannerElement",value:(o=(0,l.Z)(u().mark((function _callee6(t,o,i){var l,r,a,h;return u().wrap((function _callee6$(o){for(;;)switch(o.prev=o.next){case 0:if(l=this.boxPlannerGrid.getCellsInGridByElementId(t),r={row:l.startRowIndex,col:l.startColIndex,backside:!1},i&&"BoxPlanner_backside"==i?r={row:0,col:0,backside:!1}:l.startRowIndex>0?r.row--:(r.col=0==l.startColIndex?0:l.startColIndex-1,r.row=this.boxPlannerGrid.getRowCount(r.col,l.backside)-1),this.boxPlannerGrid.deleteElement(t,i),this.constructionRulesHandler.onElemDeleted(t),a=!0,i&&("BoxPlanner_backside"==i?(this.boxPlannerGrid.destroyBacksideModuleGrid(),a=!0):"STD_DONTUPDATE"==i&&(a=!1)),!a){o.next=11;break}return this.boxPlannerGrid.updateWorldPosOfElements(),o.next=11,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 11:if(!this.boxPlannerGrid.getPlannerElementAtGridPos(r.col,r.row,r.backside)){o.next=13;break}return o.abrupt("return",{newElementToSelect:null===(h=this.boxPlannerGrid.getPlannerElementAtGridPos(r.col,r.row,r.backside))||void 0===h?void 0:h.getElementId()});case 13:return o.abrupt("return",{});case 14:case"end":return o.stop()}}),_callee6,this)}))),function deletePlannerElement(t,i,l){return o.apply(this,arguments)})},{key:"getAllViewPlannerElements",value:function getAllViewPlannerElements(){return this.boxPlannerGrid.getAllElementsInGridSortedbyGridPos()}},{key:"getNeighborElements",value:function getNeighborElements(t,o){var i=this.boxPlannerGrid.getElementById(t);if(!i)return[];var l=null==i?void 0:i.getDockingDockingPointsByType(o);if(!l)return[];for(var r=[],a=0;a<(null==l?void 0:l.length);a++)null!=l[a]&&r.push(l[a].OnElementId);return r}},{key:"getFreeDockingPointsByElementId",value:function getFreeDockingPointsByElementId(t,o){return{dockingPoints:[],filter:[]}}},{key:"getDockedDockingPointsByElementId",value:function getDockedDockingPointsByElementId(t,o){return[]}},{key:"getDockedGroups",value:function getDockedGroups(){return[this.boxPlannerGrid.getAllElementIdsInGrid()]}},{key:"getBoundingBox",value:function getBoundingBox(){return B.warn("BoxPlanner - get2DViewPlannerBoundingBox not implemented yet","WC_0012"),new _.Z}},{key:"updatePlannerTrans",value:function updatePlannerTrans(t,o,i,l,r,a){return B.error(new d.GE("BoxPlanner - updatePlannerTrans not implemented yet",{code:"WC_0012"})),!1}},{key:"updatePlanner",value:(t=(0,l.Z)(u().mark((function _callee7(t,o){var i,l,r,a,h,c,d,m,g,E,I=this;return u().wrap((function _callee7$(u){for(;;)switch(u.prev=u.next){case 0:if(B.debug("BoxPlanner - configurationHasChanged "+t),i=!1,null==o||o.forEach((function(t){var o;i=I.boxPlannerGrid.updateGridElementDimensions(t,null===(o=I.set.getArticleByElementId(t))||void 0===o?void 0:o.plannerData)})),!i){u.next=5;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:"resizeerror",failed:!0});case 5:if(this.boxPlannerGrid.updateWorldPosOfElements(),!(t&&o&&o.length>0&&t.OPTELEMENT)||"OPVECK_I"!=t.OPTELEMENT&&"OPVECK_A"!=t.OPTELEMENT){u.next=23;break}if(!(o.length>1)){u.next=14;break}return u.next=10,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,o,!0);case 10:if(!(l=u.sent)){u.next=13;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:l,failed:!1});case 13:case 51:case 52:return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],failed:!1});case 14:if(r=this.boxPlannerGrid.getCellsInGridByElementId(o[0]),a=o[0],r.startRowIndex>0&&(a=this.boxPlannerGrid.getPlannerElementAtGridPos(r.startColIndex,0,!1).getElementId()),this.boxPlannerGrid.getElementHasLeftElement(a)&&this.boxPlannerGrid.getElementHasRightElement(a)){u.next=23;break}return h={x:0,y:0,z:0},this.boxPlannerGrid.getElementHasLeftElement(a)||(h.x=-1),this.boxPlannerGrid.getElementHasRightElement(a)||(h.x=1),c=this.getPlannerElementsInfluencedByCopy(a,{copyIndex:h,copyType:"BoxPlanner_COL"}),u.abrupt("return",{failed:!1,doDeleteBackGrid:!1,elemIdsToDelete:[],elementIdToCopy:c,copyType:"BoxPlanner_COL",ignoreOptionsToCopy:["OPTELEMENT"],changedOPT:t,targetElements:o});case 23:if(!t||!t.OPTDMOD){u.next=38;break}u.t0=t.OPTDMOD,u.next="OPVD_EIN"===u.t0?27:"OPVD_AUS"===u.t0?31:36;break;case 27:if(this.boxPlannerGrid.getPlannerHasActiveBackside()){u.next=30;break}return d=this.getPlannerElementsInfluencedByCopy(-1,{copyIndex:{x:0,y:0,z:-1},copyType:"BoxPlanner_backside"}),u.abrupt("return",{failed:!1,doDeleteBackGrid:!1,elemIdsToDelete:[],elementIdToCopy:d,copyType:"BoxPlanner_backside",changedOPT:t});case 30:case 35:return u.abrupt("break",36);case 31:if(!this.boxPlannerGrid.getPlannerHasActiveBackside()){u.next=35;break}if(!((m=this.boxPlannerGrid.getAllElementsInBackGrid()).length>0)){u.next=35;break}return u.abrupt("return",{failed:!1,doDeleteBackGrid:!0,elemIdsToDelete:m.map((function(t){return t.ElementId})),deletionType:"BoxPlanner_backside",changedOPT:t});case 36:case 42:u.next=52;break;case 38:if(!(t&&t.OPTFARBE_RAHMEN&&"OPVSCHWARZ_MATT"==t.OPTFARBE_RAHMEN&&this.boxPlannerGrid.getPlannerHasActiveBackside())){u.next=44;break}if(!((g=this.boxPlannerGrid.getAllElementsInBackGrid()).length>0)){u.next=42;break}return u.abrupt("return",{failed:!1,doDeleteBackGrid:!0,elemIdsToDelete:g.map((function(t){return t.ElementId})),deletionType:"BoxPlanner_backside",changedOPT:t,targetElements:o,viewMessageCodex:"BOXPLAN_BLACKFRAME_INCOMPATIBLE_ELEMENT_WARNING"});case 44:return u.next=46,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,o);case 46:if(!(E=u.sent)){u.next=51;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:E,failed:!1});case 53:case"end":return u.stop()}}),_callee7,this)}))),function updatePlanner(o,i){return t.apply(this,arguments)})},{key:"getSetData",value:function getSetData(t,o,i,l){for(var r={ID:"S1",H:"",x:0,y:0,z:0,w:0,ELE:[],Blob:this.set.CatalogData.supplierILN,Cat:this.set.getCatalogCodex(),ShowDim:i},a=this.boxPlannerGrid.getAllElementsInGridSortedbyGridPos(),h=0;h<a.length;h++){var c=a[h],u=c.ElementId,m=this.set.getPlannerConfigData(u).config,g={ID:"E"+u,N:m.N,Model:m.Model,x:-c.WorldPosCenter.x,y:c.WorldPosCenter.y,z:c.WorldPosCenter.z,PosPivot:"Center",w:c.getRotDeg(),RotPivot:"Center",DP:c.getDockingPointJS3D(),MAT:m.MAT,CFG:m.CFG,H:""},E=(0,d.FB)(JSON.stringify(g));g.H=E,r.ELE.push(g)}E=(0,d.FB)(JSON.stringify(r));return r.H=E,{constructionSet:r}}},{key:"getPlannerId",value:function getPlannerId(){return this.plannerID}},{key:"getElementPosInfo",value:function getElementPosInfo(){B.error(new d.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 o=this.boxPlannerGrid.getAllElementIdsInGrid(),i=0;i<o.length;i++){var l=o[i],r=this.boxPlannerGrid.getElementById(l);r&&(r.SetPosNr=t+r.PosNr-1,this.set.setPosNr(r.ElementId,r.getPosNr()))}return o.length}},{key:"clonePlanner",value:function clonePlanner(t,o,i){var l=new DivaBoxPlanner(t,o);return l.initPlanner(i),l}},{key:"getPlannerInteractionInformation",value:function getPlannerInteractionInformation(){return this.boxPlannerGrid.getPlannerInteractionInformation()}},{key:"getGeneralPlanningState",value:function getGeneralPlanningState(t){return this.boxPlannerGrid.getGeneralPlanningState(!0,t)}}]);var t,o,i,c,m,g,E}();(0,h.Z)(C,"plannerType","BOX")}}]);
|
|
2
|
+
"use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[304],{60304:(t,o,i)=>{i.r(o),i.d(o,{default:()=>C});var l=i(84658),r=i(13125),a=i(43860),h=i(80248),c=i(50747),u=i.n(c),d=i(98457),m=i(12952),g=i(34988),E=d.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),I=function(){return(0,a.Z)((function BoxPlannerPartlistHelper(t,o,i,l,a,c,u){(0,r.Z)(this,BoxPlannerPartlistHelper),(0,h.Z)(this,"constructionRules",void 0),(0,h.Z)(this,"getOptionVal",void 0),(0,h.Z)(this,"setOptionValue",void 0),(0,h.Z)(this,"getElementHasBottomPlate",void 0),(0,h.Z)(this,"getElementIsCornerElement",void 0),(0,h.Z)(this,"getCornerType",void 0),(0,h.Z)(this,"getElementHasTopPlate",void 0),(0,h.Z)(this,"getElementIsGarderobeElement",void 0),this.getOptionVal=t,this.getElementHasBottomPlate=i,this.setOptionValue=o,this.getElementIsCornerElement=l,this.getCornerType=a,this.getElementHasTopPlate=c,this.getElementIsGarderobeElement=u}),[{key:"setConstructionRules",value:function setConstructionRules(t){this.constructionRules=t}},{key:"getGroundPlatesNumOfRightNeighbors",value:function getGroundPlatesNumOfRightNeighbors(t,o,i){if(o.getForceSingleCellPerElement()){var l=0;if(this.getElementHasBottomPlate(t,i)&&l++,o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());if(this.getElementHasBottomPlate(r,i)&&l++,o.getElementHasRightElement(t.getElementId())){var a=o.getRightElements(t.getElementId());if(a.length>0){var h=a[0],c=o.getOppositeElement(h.getElementId());this.getElementHasBottomPlate(h,i)&&l++,this.getElementHasBottomPlate(c,i)&&l++}return l}return l}if(o.getElementHasRightElement(t.getElementId())){var u=o.getRightElements(t.getElementId());if(u.length>0){var m=u[0];this.getElementHasBottomPlate(m,i)&&l++}return l}return l}E.error(new d.GE("BoxPlannerError - function getGroundPlatesNumOfRightNeighbors not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"getTopPlatesNumOfRightNeighbors",value:function getTopPlatesNumOfRightNeighbors(t,o,i){if(o.getForceSingleCellPerElement()){var l=0;if(this.getElementHasTopPlate(t,o,i)&&l++,o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());if(this.getElementHasTopPlate(r,o,i)&&l++,o.getElementHasRightElement(t.getElementId())){var a=o.getRightElements(t.getElementId());if(a.length>0){var h=a[0],c=o.getOppositeElement(h.getElementId());this.getElementHasTopPlate(h,o,i)&&l++,this.getElementHasTopPlate(c,o,i)&&l++}return l}return l}if(o.getElementHasRightElement(t.getElementId())){var u=o.getRightElements(t.getElementId());if(u.length>0){var m=u[0];this.getElementHasTopPlate(m,o,i)&&l++}return l}return l}E.error(new d.GE("BoxPlannerError - function getTopPlatesNumOfRightNeighbors not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"getElementHeight",value:function getElementHeight(t,o){var i=this.getOptionVal(t.getElementId(),"OPTHOEHE",o);return"OPVH_6"==i?"6":"OPVH_11"==i?"11":"OPVH_18"==i?"18":"37"}},{key:"getElementDepth",value:function getElementDepth(t,o){var i=this.getOptionVal(t.getElementId(),"OPTTIEFE",o);return"OPVTIEFE_18"==i?"18":"37"}},{key:"getElementRahmenColor",value:function getElementRahmenColor(t,o){var i=this.getOptionVal(t.getElementId(),"OPTFARBE_RAHMEN",o);return"OPVCHROM"==i?"CHROM":"OPVSCHWARZ_MATT"==i?"BLACK":"CHROM"}},{key:"calculateRahmen",value:function calculateRahmen(t,o){for(var i=t.getAllElementsInGridSortedbyGridPos(),l=0;l<i.length;l++)this.constructionRules.VarticalRahmenInfo&&(this.correctRahmenVerticalLeftFront(i[l],t,o),this.correctRahmenVerticalLeftBack(i[l],t,o),this.correctRahmenVerticalRightFront(i[l],t,o),this.correctRahmenVerticalRightBack(i[l],t,o),E.debug("---------Correct Senkrechte Rahmen for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),E.debug("Senkrechter Rahmen links vorne: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_V",o)),E.debug("Senkrechter Rahmen links hinten: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_H",o)),E.debug("Senkrechter Rahmen rechts vorne : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_V",o)),E.debug("Senkrechter Rahmen rechts hinten : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_H",o))),this.constructionRules.DepthRahmenInfo&&(this.correctRahmenDepthLeftBottom(i[l],t,o),this.correctRahmenDepthLeftTop(i[l],t,o),this.correctRahmenDepthRightBottom(i[l],t,o),this.correctRahmenDepthRightTop(i[l],t,o),E.debug("---------Correct Tiefenverbinder Rahmen for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),E.debug("Tiefen Rahmen links unten: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_U",o)),E.debug("Tiefen Rahmen links oben: "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_L_O",o)),E.debug("Tiefen Rahmen rechts unten : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_U",o)),E.debug("Tiefen Rahmen rechts oben : "+this.getOptionVal(i[l].ElementId,"OPTRAHMEN_R_O",o)))}},{key:"correctRahmenDepthLeftBottom",value:function correctRahmenDepthLeftBottom(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId()))&&!o.getElementHasBottomElement(t.getElementId()))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(this.getElementHasBottomPlate(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}},{key:"correctRahmenDepthLeftTop",value:function correctRahmenDepthLeftTop(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(this.getElementIsCornerElement(t,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else if(this.getElementHasTopPlate(t,o,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_LeftTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}},{key:"correctRahmenDepthRightBottom",value:function correctRahmenDepthRightBottom(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId()))if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(l){var r=o.getRightElements(t.getElementId());if(r.length>0){var a=r[0];if(!this.getElementHasBottomPlate(t,i)||this.getElementIsCornerElement(t,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else if(!this.getElementHasBottomPlate(a,i)||this.getElementIsCornerElement(a,i))switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,i)}}else if(this.getElementHasBottomPlate(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);else switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}break;case"BLACK":l?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,i):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightBottom,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}else E.error(new d.GE("BoxPlannerError - function correctRahmenDepthRightBottom not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenDepthRightTop",value:function correctRahmenDepthRightTop(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(o.getPlannerHasActiveBackside())switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(!this.getElementHasTopPlate(t,o,i)||this.getElementIsCornerElement(t,i)){switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}return}if(!r)return void this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_chrom,i);var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(a.length>0){var h=a[0];if(!this.getElementHasTopPlate(h,o,i)||this.getElementIsCornerElement(h,i)){switch(this.getElementDepth(t,i)){case"18":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_18_chrom,i);break;case"37":this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenBV_37_chrom,i)}return}}this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_chrom,i);break;case"BLACK":r?this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Middle_black,i):this.setOptionValue(t.getElementId(),this.constructionRules.DepthRahmenInfo.rahmenOPT_RightTop,this.constructionRules.DepthRahmenInfo.rahmenOPVs.rahmenTV_Border_black,i)}}else E.error(new d.GE("BoxPlannerError - function correctRahmenDepthRightTop not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenVerticalLeftFront",value:function correctRahmenVerticalLeftFront(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i),!(o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}},{key:"correctRahmenVerticalLeftBack",value:function correctRahmenVerticalLeftBack(t,o,i){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l&&!(l?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId())))switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(o.getPlannerHasActiveBackside()){var r=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_LeftBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}},{key:"correctRahmenVerticalRightFront",value:function correctRahmenVerticalRightFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(a.length>0){var h=a[0];this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightFront,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}else E.error(new d.GE("BoxPlannerError - function correctRahmenVerticalRightFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctRahmenVerticalRightBack",value:function correctRahmenVerticalRightBack(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.noRahmen,i),o.getForceSingleCellPerElement()){var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l){var r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());switch(this.getElementHeight(t,i)){case"6":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH6,i);break;case"11":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH11,i);break;case"18":switch(this.getElementRahmenColor(t,i)){case"CHROM":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_black,i)}break;case"37":if(this.getElementIsGarderobeElement(t,i))this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i);else switch(this.getElementRahmenColor(t,i)){case"CHROM":if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId());if(0==a.length)return;if(a.length>0){var h=a[0];if(o.getPlannerHasActiveBackside()){var c=o.getOppositeElement(t.getElementId());if(!c)return;var u=o.getOppositeElement(h.getElementId());if(!u)return;this.getElementIsGarderobeElement(h,i)||this.getElementIsGarderobeElement(c,i)||this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}}else if(o.getPlannerHasActiveBackside()){var m=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(m,i)?this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH18_Garderobe,i):this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_chrom,i);break;case"BLACK":this.setOptionValue(t.getElementId(),this.constructionRules.VarticalRahmenInfo.rahmenOPT_RightBack,this.constructionRules.VarticalRahmenInfo.rahmenOPVs.rahmenH37_black,i)}}}}else E.error(new d.GE("BoxPlannerError - function correctRahmenVerticalRightBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"calculateKnots",value:function calculateKnots(t,o){if(this.constructionRules.hasKNOTS)for(var i=t.getAllElementsInGridSortedbyGridPos(),l=0;l<i.length;l++)this.correctKnotLeftTopFront(i[l],t,o),this.correctKnotLeftTopBack(i[l],t,o),this.correctKnotLeftBottomFront(i[l],t,o),this.correctKnotLeftBottomBack(i[l],t,o),this.correctKnotRightTopFront(i[l],t,o),this.correctKnotRightTopBack(i[l],t,o),this.correctKnotRightBottomFront(i[l],t,o),this.correctKnotRightBottomBack(i[l],t,o),this.correctKnotRightMiddleBack(i[l],t,o),this.correctKnotLeftMiddleBack(i[l],t,o),E.debug("---------Correct Knots for element with ID: "+i[l].ElementId+"; posNr: "+i[l].PosNr+" ----------"),E.debug("Links oben vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LTF",o)),E.debug("Links oben hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LTB",o)),E.debug("Links unten vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LBF",o)),E.debug("Links unten hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LBB",o)),E.debug("Rechts oben vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RTF",o)),E.debug("Rechts oben hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RTB",o)),E.debug("Rechts unten vorne : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RBF",o)),E.debug("Links mitte hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_LMB",o)),E.debug("Rechts mitte hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RMB",o)),E.debug("Rechts unten hinten : "+this.getOptionVal(i[l].ElementId,"OPTKNOTEN_RBB",o))}},{key:"correctKnotLeftBottomFront",value:function correctKnotLeftBottomFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())&&(l||(o.getPlannerHasActiveBackside()&&this.getElementHasBottomPlate(t,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i),this.getElementHasBottomPlate(t,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i)),this.getElementIsCornerElement(t,i))){var r=o.getLeftElements(t.getElementId());if(r.length>0){var a=r[0];if(this.getElementIsCornerElement(a,i))return;var h=o.getRightElements(t.getElementId());if(h.length>0){var c=h[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasBottomPlate(a,i)?this.getElementHasBottomPlate(c,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.getElementHasBottomPlate(c,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasBottomPlate(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftBottomFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftTopFront",value:function correctKnotLeftTopFront(t,o,i){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i),o.getForceSingleCellPerElement()){var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(l||(o.getPlannerHasActiveBackside()&&this.getElementHasTopPlate(t,o,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i),this.getElementHasTopPlate(t,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i)),this.getElementIsCornerElement(t,i)){var r=o.getElementHasLeftElement(t.getElementId());if(l&&this.getElementIsCornerElement(o.getLeftElements(t.getElementId())[0],i))return;var a=o.getElementHasRightElement(t.getElementId());if(r||a){if(a&&!r){var h=o.getRightElements(t.getElementId());if(h.length>0){var c=h[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(c,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else if(!a&&r){var u=o.getLeftElements(t.getElementId());if(u.length>0){var m=u[0];this.getElementHasTopPlate(m,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3erer_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(a&&r){var g=o.getLeftElements(t.getElementId())[0],I=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(g,o,i)?this.getElementHasTopPlate(I,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.getElementHasTopPlate(I,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftTopFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftBottomBack",value:function correctKnotLeftBottomBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())){if(!l)if(o.getPlannerHasActiveBackside()&&!o.getCellsInGridByElementId(t.getElementId()).backside){var r=o.getOppositeElement(t.getElementId());r&&(this.getElementHasBottomPlate(t,i)?this.getElementHasBottomPlate(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.getElementHasBottomPlate(r,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else o.getPlannerHasActiveBackside()||this.getElementHasBottomPlate(t,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var a=o.getLeftElements(t.getElementId())[0];if(this.getElementIsCornerElement(a,i))return;switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasBottomPlate(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":var h=o.getRightElements(t.getElementId())[0];this.getElementHasBottomPlate(a,i)?this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i)}}}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftBottomBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftTopBack",value:function correctKnotLeftTopBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(!l)if(o.getPlannerHasActiveBackside()&&!o.getCellsInGridByElementId(t.getElementId()).backside){var r=o.getOppositeElement(t.getElementId());r&&(this.getElementHasTopPlate(t,o,i)?this.getElementHasTopPlate(r,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.getElementHasTopPlate(r,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else o.getPlannerHasActiveBackside()||this.getElementHasTopPlate(t,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var a=o.getElementHasLeftElement(t.getElementId());if(l&&this.getElementIsCornerElement(o.getLeftElements(t.getElementId())[0],i))return;var h=o.getElementHasRightElement(t.getElementId());if(a||h){if(h&&!a){var c=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(c,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(!h&&a){var u=o.getLeftElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":case"OUTSIDE":this.getElementHasTopPlate(u,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(h&&a){var m=o.getLeftElements(t.getElementId())[0],g=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.getElementHasTopPlate(m,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.getElementHasTopPlate(m,o,i)?this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftTopBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightMiddleBack",value:function correctKnotRightMiddleBack(t,o,i){if(o.getForceSingleCellPerElement()){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i),this.getElementIsGarderobeElement(t,i)&&!o.getCellsInGridByElementId(t.getElementId()).backside)if(o.getElementHasRightElement(t.getElementId()))if(o.getPlannerHasActiveBackside()){var l=o.getOppositeElement(t.getElementId());if(!l)return;var r=o.getRightElements(t.getElementId());if(0==r.length)return;var a=r[0],h=o.getOppositeElement(a.getElementId());if(!h)return;this.getElementIsGarderobeElement(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.getElementIsGarderobeElement(l,i)?this.getElementIsGarderobeElement(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.getElementIsGarderobeElement(a,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else{var c=o.getRightElements(t.getElementId());if(0==c.length)return;var u=c[0];this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else if(o.getPlannerHasActiveBackside()){var m=o.getOppositeElement(t.getElementId());if(!m)return;this.getElementIsGarderobeElement(m,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else E.error(new d.GE("BoxPlannerError - function correctKnotRightMiddleBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotLeftMiddleBack",value:function correctKnotLeftMiddleBack(t,o,i){if(o.getForceSingleCellPerElement()){if(this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i),this.getElementIsGarderobeElement(t,i)){var l=o.getCellsInGridByElementId(t.getElementId()).backside;if(!l){var r=l?o.getElementHasRightElement(t.getElementId()):o.getElementHasLeftElement(t.getElementId());if(r){var a=o.getLeftElements(t.getElementId())[0];if(this.getElementIsGarderobeElement(a,i))return}if(r)if(o.getPlannerHasActiveBackside()){var h=o.getLeftElements(t.getElementId());if(0==h.length)return;var c=h[0],u=o.getOppositeElement(t.getElementId());if(!u)return;var m=o.getOppositeElement(null==c?void 0:c.getElementId());if(!m)return;this.getElementIsGarderobeElement(m,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.getElementIsGarderobeElement(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);else if(o.getPlannerHasActiveBackside()){var g=o.getOppositeElement(t.getElementId());this.getElementIsGarderobeElement(g,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_LeftMiddleBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i)}}}else E.error(new d.GE("BoxPlannerError - function correctKnotLeftMiddleBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightBottomFront",value:function correctKnotRightBottomFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())){if(o.getPlannerHasActiveBackside())if(this.getElementHasBottomPlate(t,i))if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasBottomPlate(h,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&(this.getElementHasBottomPlate(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);else if(this.getElementHasBottomPlate(t,i)){var m=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),g=void 0;m.length>0&&(g=m[0]),g&&!this.getElementHasBottomPlate(g,i)&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}else if(r){var I=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),p=void 0;I.length>0&&(p=I[0]),p&&!this.getElementIsCornerElement(p,i)&&(this.getElementHasBottomPlate(p,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);if(this.getElementIsCornerElement(t,i))switch(this.getCornerType(t,i)){case"INSIDE":var O=o.getRightElements(t.getElementId())[0];if(O&&this.getElementIsCornerElement(O,i))if(o.getElementHasRightElement(O.getElementId())){var R=o.getRightElements(O.getElementId())[0];this.getElementHasBottomPlate(R,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else O&&this.getElementHasBottomPlate(O,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else E.error(new d.GE("BoxPlannerError - function correctKnotRightBottomFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightTopFront",value:function correctKnotRightTopFront(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(o.getPlannerHasActiveBackside())if(this.getElementHasTopPlate(t,o,i))if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasTopPlate(h,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&(this.getElementHasTopPlate(u,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);else if(this.getElementHasTopPlate(t,o,i)){if(r){var m=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),g=void 0;m.length>0&&(g=m[0]),g&&(this.getElementHasTopPlate(g,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i))}}else if(r){var I=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),p=void 0;I.length>0&&(p=I[0]),p&&!this.getElementIsCornerElement(p,i)&&(this.getElementHasTopPlate(p,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot1er,i);if(this.getElementIsCornerElement(t,i)){var O=o.getElementHasLeftElement(t.getElementId()),R=o.getElementHasRightElement(t.getElementId());if(O||R){if(R&&!O){var k=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":if(this.getElementIsCornerElement(k,i))if(o.getElementHasRightElement(k.getElementId())){var P=o.getRightElements(k.getElementId())[0];this.getElementHasTopPlate(P,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(k,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(!R&&O){o.getLeftElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(R&&O){var v=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":if(this.getElementIsCornerElement(v,i))if(o.getElementHasRightElement(v.getElementId())){var T=o.getRightElements(v.getElementId())[0];this.getElementHasTopPlate(T,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(v,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case"OUTSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopFront,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else E.error(new d.GE("BoxPlannerError - function correctKnotRightTopFront not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightBottomBack",value:function correctKnotRightBottomBack(t,o,i){if(o.getForceSingleCellPerElement()){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getElementHasBottomElement(t.getElementId())&&!o.getCellsInGridByElementId(t.getElementId()).backside){if(o.getPlannerHasActiveBackside())switch(this.getGroundPlatesNumOfRightNeighbors(t,o,i)){case 0:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i);break;case 1:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case 2:r?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);break;case 3:r&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i);break;case 4:r&&this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,i)}else if(this.getElementHasBottomPlate(t,i)){if(r){var a=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),h=void 0;a.length>0&&(h=a[0]),h&&(this.getElementHasBottomPlate(h,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i))}}else if(r){var c=l?o.getLeftElements(t.getElementId()):o.getRightElements(t.getElementId()),u=void 0;c.length>0&&(u=c[0]),u&&!this.getElementIsCornerElement(u,i)&&(this.getElementHasBottomPlate(u,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i))switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":var m=o.getRightElements(t.getElementId())[0];if(this.getElementIsCornerElement(m,i)){var g=o.getRightElements(m.getElementId())[0];this.getElementHasBottomPlate(g,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.getElementHasBottomPlate(m,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightBottomBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else E.error(new d.GE("BoxPlannerError - function correctKnotRightBottomBack not supported for complex boxPlaner",{code:"WC_0012"}))}},{key:"correctKnotRightTopBack",value:function correctKnotRightTopBack(t,o,i){this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.noKnot,i);var l=o.getCellsInGridByElementId(t.getElementId()).backside,r=l?o.getElementHasLeftElement(t.getElementId()):o.getElementHasRightElement(t.getElementId());if(!o.getCellsInGridByElementId(t.getElementId()).backside){if(o.getPlannerHasActiveBackside())if(r)switch(this.getTopPlatesNumOfRightNeighbors(t,o,i)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_0GT,i);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_1GT,i);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_2GT,i);break;case 3:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i);break;case 4:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_4GT,i)}else switch(this.getTopPlatesNumOfRightNeighbors(t,o,i)){case 0:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i);break;case 1:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i);break;case 2:this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else if(this.getElementHasTopPlate(t,o,i)){if(r){var a=l?o.getLeftElements(t.getElementId())[0]:o.getRightElements(t.getElementId())[0];this.getElementIsCornerElement(a,i)||this.getElementHasTopPlate(a,o,i)||this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i)}}else if(r){var h=l?o.getLeftElements(t.getElementId())[0]:o.getRightElements(t.getElementId())[0];h&&!this.getElementIsCornerElement(h,i)&&(this.getElementHasTopPlate(h,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_1GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_0GT,i))}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_0GT,i);if(this.getElementIsCornerElement(t,i)){var c=o.getElementHasLeftElement(t.getElementId()),u=o.getElementHasRightElement(t.getElementId());if(c||u){if(u&&!c){var d=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":if(this.getElementIsCornerElement(d,i))if(o.getElementHasRightElement(d.getElementId())){var m=o.getRightElements(d.getElementId())[0];this.getElementHasTopPlate(m,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(d,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}else if(!u&&c)this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);else if(u&&c){var g=o.getRightElements(t.getElementId())[0];switch(this.getCornerType(t,i)){case"INSIDE":this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i);break;case"OUTSIDE":if(this.getElementIsCornerElement(g,i))if(o.getElementHasRightElement(g.getElementId())){var E=o.getRightElements(g.getElementId())[0];this.getElementHasTopPlate(E,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot4er_3GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i)}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i);else this.getElementHasTopPlate(g,o,i)?this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot3er_2GT,i):this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}else this.setOptionValue(t.getElementId(),this.constructionRules.knotInfo.knotOPT_RightTopBack,this.constructionRules.knotInfo.knotOPVs.knot2er_1GT,i)}}}}])}();function _createForOfIteratorHelper(t,o){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function _unsupportedIterableToArray(t,o){if(t){if("string"==typeof t)return _arrayLikeToArray(t,o);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(t,o):void 0}}(t))||o&&t&&"number"==typeof t.length){i&&(t=i);var l=0,r=function F(){};return{s:r,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,h=!0,c=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){c=!0,a=t},f:function f(){try{h||null==i.return||i.return()}finally{if(c)throw a}}}}function _arrayLikeToArray(t,o){(null==o||o>t.length)&&(o=t.length);for(var i=0,l=Array(o);i<o;i++)l[i]=t[i];return l}var p=d.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),O=function(){return(0,a.Z)((function ConstructionRulesHandler(t,o,i){var l=this;(0,r.Z)(this,ConstructionRulesHandler),(0,h.Z)(this,"getValueOfOptionOfArticle",void 0),(0,h.Z)(this,"checkArticleHasOption",void 0),(0,h.Z)(this,"updateCfgValuesByPlanner",void 0),(0,h.Z)(this,"constructionRules",void 0),(0,h.Z)(this,"constructionRulesLoaded",void 0),(0,h.Z)(this,"hideOptionsForConstruction",void 0),(0,h.Z)(this,"partlistHelper",void 0),(0,h.Z)(this,"getOptionVal",(function(t,o,i){if(i.has(t)&&i.get(t).has(o)){var r=i.get(t).get(o);return null!=r?r:""}var a=l.getValueOfOptionOfArticle(t,o);return null!=a?a:""})),(0,h.Z)(this,"hasOptionValue",(function(t,o,i){return!(!i.has(t)||!i.get(t).has(o))||!!l.getValueOfOptionOfArticle(t,o)})),(0,h.Z)(this,"setOptionValue",(function(t,o,i,r){var a;if(r.has(t)||r.set(t,new Map),null===(a=r.get(t))||void 0===a||a.set(o,i),l.hideOptionsForConstruction.has(t)){var h=l.hideOptionsForConstruction.get(t).indexOf(o);h>=0&&l.hideOptionsForConstruction.get(t).splice(h,1)}})),(0,h.Z)(this,"getElementHasBottomPlate",(function(t,o){if(!t)return!1;if(l.constructionRules.knotInfo.elementsWithGroundPlate)for(var i=0;i<l.constructionRules.knotInfo.elementsWithGroundPlate.length;i++){var r=l.constructionRules.knotInfo.elementsWithGroundPlate[i].onOPT,a=l.constructionRules.knotInfo.elementsWithGroundPlate[i].onOPVs,h=l.getOptionVal(t.getElementId(),r,o);return l.arrayContainsValue(a,h)}return!1})),(0,h.Z)(this,"getElementIsCornerElement",(function(t,o){return!!t&&(l.constructionRules.hasCORNER&&l.arrayContainsValue(l.constructionRules.knotInfo.cornerElements.onOPVs,l.getOptionVal(t.getElementId(),l.constructionRules.knotInfo.cornerElements.onOPT,o)))})),(0,h.Z)(this,"getElementIsGarderobeElement",(function(t,o){return l.constructionRules.hasGARDEROBE&&l.arrayContainsValue(l.constructionRules.knotInfo.garderobeElements.onOPVs,l.getOptionVal(t.getElementId(),l.constructionRules.knotInfo.garderobeElements.onOPT,o))})),(0,h.Z)(this,"getCornerType",(function(t,o){return"OPVECK_I"==l.getOptionVal(t.getElementId(),"OPTELEMENT",o)?"INSIDE":"OPVECK_A"==l.getOptionVal(t.getElementId(),"OPTELEMENT",o)?"OUTSIDE":"NOCORNER"})),(0,h.Z)(this,"getElementHasTopPlate",(function(t,o,i){if(o.getElementHasTopElement(t.getElementId())){var r=o.getTopElements(t.getElementId()),a=!1;return l.getElementHasBottomPlate(r[0],i)&&(a=!0),a}return!0})),this.constructionRulesLoaded=!1,this.getValueOfOptionOfArticle=t,this.checkArticleHasOption=o,this.hideOptionsForConstruction=new Map,this.updateCfgValuesByPlanner=i,this.partlistHelper=new I(this.getOptionVal,this.setOptionValue,this.getElementHasBottomPlate,this.getElementIsCornerElement,this.getCornerType,this.getElementHasTopPlate,this.getElementIsGarderobeElement)}),[{key:"arrayContainsValue",value:function arrayContainsValue(t,o){if(!t)return!1;if(Array.isArray(t)){for(var i=0;i<t.length;i++)if(t[i]==o)return!0;return!1}var l=t.split(";");for(i=0;i<l.length;i++)if(l[i]==o)return!0;return!1}},{key:"evalRule",value:function evalRule(t,o,i){for(var l=!0,r=o.split("&"),a=0;a<r.length;a++){var h=r[a].split("|");if(1!=h.length){for(var c=!1,u=0;u<h.length;u++){m=h[u].split("=")[0],g=h[u].split("=")[1];var d=this.getOptionVal(t,m,i);d&&d==g&&(c=!0)}l&&(l=c)}else{var m=r[a].split("=")[0],g=r[a].split("=")[1],E=this.getOptionVal(t,m,i);E&&E!=g&&(l=!1)}}return l}},{key:"setOptionDoShow",value:function setOptionDoShow(t,o,i){var l=this.constructionRules.optionsVisibilityInfo[o];if(l){var r;if(null!=l.doShow)i.has(t)||i.set(t,new Map),null===(r=i.get(t))||void 0===r||r.set(o,l.doShow);if(this.hideOptionsForConstruction.has(t)){var a,h=this.hideOptionsForConstruction.get(t).indexOf(o);if(h>=0)null===(a=this.hideOptionsForConstruction.get(t))||void 0===a||a.splice(h,1)}}}},{key:"setOptionDoHide",value:function setOptionDoHide(t,o,i){var l,r,a=this.constructionRules.optionsVisibilityInfo[o];a&&(i.has(t)||i.set(t,new Map),null===(l=i.get(t))||void 0===l||l.set(o,a.doHide),this.hideOptionsForConstruction.has(t)||this.hideOptionsForConstruction.set(t,[]),null===(r=this.hideOptionsForConstruction.get(t))||void 0===r||r.push(o))}},{key:"setOptionDoCustom",value:function setOptionDoCustom(t,o,i,l){var r,a,h=this.constructionRules.optionsVisibilityInfo[o];h&&(l.has(t)||l.set(t,new Map),null===(r=l.get(t))||void 0===r||r.set(o,h[i]),this.hideOptionsForConstruction.has(t)||this.hideOptionsForConstruction.set(t,[]),null===(a=this.hideOptionsForConstruction.get(t))||void 0===a||a.push(o))}},{key:"getCurOptionBasedConstructionRules",value:function getCurOptionBasedConstructionRules(t,o){for(var i=[],l=0;l<this.constructionRules.optionBasedConstructionRules.length;l++){var r=this.constructionRules.optionBasedConstructionRules[l];this.getOptionVal(t,r.masterOptionName,o)==r.masterOptionValue&&i.push(r)}return i}},{key:"setAllOptToDefault",value:function setAllOptToDefault(t,o,i,l){for(var r=[],a=void 0,h=0;h<this.constructionRules.optionsInfluenceRulesOfAllElements.length;h++){var c=this.constructionRules.optionsInfluenceRulesOfAllElements[h];for(var u in i)u==c.onOPT&&this.arrayContainsValue(c.onOPVs,i[u])&&r.push({opt:c.influenceOPT,opv:c.forceOPV,unvalidOPVs:c.unvalidOPVs,warning:c.warning,doShowWarning:!1})}for(var d=t.getAllElementIdsInGrid(),m=0;m<d.length;m++){var g;if(this.hideOptionsForConstruction.has(d[m])&&this.hideOptionsForConstruction.get(d[m]).length>0){for(;this.hideOptionsForConstruction.get(d[m]).length>0;){var E=this.hideOptionsForConstruction.get(d[m])[0];this.setOptionDoShow(d[m],E,o)}this.hideOptionsForConstruction.delete(d[m])}this.constructionRules.hasDMOD&&(t.getPlannerHasActiveBackside()?this.setOptionDoShow(d[m],"OPTDMOD",o):this.setOptionDoHide(d[m],"OPTDMOD",o));var I=t.getColumnCount();I>1?this.setOptionDoShow(d[m],"OPTMULTICOL",o):this.setOptionDoHide(d[m],"OPTMULTICOL",o),this.setOptionValue(d[m],"OPTCORNER_COL_L","OPVOHNE",o),this.setOptionValue(d[m],"OPTCORNER_COL_R","OPVOHNE",o);var p=t.getCellsInGridByElementId(d[m]);if(p.backside)this.setOptionValue(d[m],"OPTELEM_ON_BACK","OPVJA",o);else{if(this.setOptionValue(d[m],"OPTELEM_ON_BACK","OPVNEIN",o),p.startColIndex>0){var O=t.getPlannerElementAtGridPos(p.startColIndex-1,0,!1);if(O){var R=this.getOptionVal(O.getElementId(),"OPTELEMENT",o);"OPVECK_I"==R?this.setOptionValue(d[m],"OPTCORNER_COL_L","OPVECK_I",o):"OPVECK_A"==R?this.setOptionValue(d[m],"OPTCORNER_COL_L","OPVECK_A",o):this.setOptionValue(d[m],"OPTCORNER_COL_L","OPVOHNE",o)}}if(p.endColIndex<I-1){var k=t.getPlannerElementAtGridPos(p.endColIndex,0,!1);if(k){var P=this.getOptionVal(k.getElementId(),"OPTELEMENT",o);"OPVECK_I"==P?this.setOptionValue(d[m],"OPTCORNER_COL_R","OPVECK_I",o):"OPVECK_A"==P?this.setOptionValue(d[m],"OPTCORNER_COL_R","OPVECK_A",o):this.setOptionValue(d[m],"OPTCORNER_COL_R","OPVOHNE",o)}}}if(this.constructionRules.avoidOptionLastCol){var v=this.getOptionVal(d[m],this.constructionRules.avoidOptionLastCol.onOPT,o);this.arrayContainsValue(this.constructionRules.avoidOptionLastCol.onOPVs,v)&&p.endColIndex-1==I-1&&this.setOptionValue(d[m],this.constructionRules.avoidOptionLastCol.onOPT,this.constructionRules.avoidOptionLastCol.defaultOpv,o)}if(this.constructionRules.avoidOptionFirstCol){var T=this.getOptionVal(d[m],this.constructionRules.avoidOptionFirstCol.onOPT,o);this.arrayContainsValue(this.constructionRules.avoidOptionFirstCol.onOPVs,T)&&0==p.startColIndex&&this.setOptionValue(d[m],this.constructionRules.avoidOptionFirstCol.onOPT,this.constructionRules.avoidOptionFirstCol.defaultOpv,o)}var V=this.hasOptionValue(d[m],"OPTWW",o);if(t.getElementIsFirstInGrid(d[m])?(this.setOptionDoShow(d[m],"OPTWERKZEUGKASTEN",o),V&&(t.getSizeOfWholeSet(!0).y>173&&!t.getPlannerHasActiveBackside()?this.setOptionDoShow(d[m],"OPTWW",o):this.setOptionDoHide(d[m],"OPTWW",o))):(this.setOptionDoHide(d[m],"OPTWERKZEUGKASTEN",o),V&&this.setOptionDoHide(d[m],"OPTWW",o)),o.has(d[m])||o.set(d[m],new Map),null===(g=o.get(d[m]))||void 0===g||g.set("DEBUG",t.getElementById(d[m]).getPosNr()+""),r.length>0)for(var _=0;_<r.length;_++){var B=this.getOptionVal(d[m],r[_].opt,o),C=!1;if(r[_].unvalidOPVs&&0!=r[_].unvalidOPVs.length){for(var x=r[_].unvalidOPVs.split(";"),b=0;b<x.length;b++)if(x[b]==B){C=!0;break}}else C=!0;C&&(B!=r[_].opv&&(this.setOptionValue(d[m],r[_].opt,r[_].opv,o),r[_].doShowWarning||(r[_].doShowWarning=!0,a=r[_].warning)))}if(i)for(var u in i)if(""!=u&&i[u]&&""!=i[u])for(h=0;h<this.constructionRules.optionsInfluenceRulesOfSingleElement.length;h++){c=this.constructionRules.optionsInfluenceRulesOfSingleElement[h];var y=!1;if(c.dir&&l&&l.length>0){if("TOP"==c.dir&&t.getElementHasBottomElement(d[m]))for(var H=t.getBottomElements(d[m]),G=0;G<H.length;G++)l.indexOf(H[G].getElementId())>=0&&(y=!0);if("DOWN"==c.dir&&t.getElementHasTopElement(d[m]))for(var D=t.getTopElements(d[m]),L=0;L<D.length;L++)l.indexOf(D[L].getElementId())>=0&&(y=!0);if("LEFT_RIGHT"==c.dir){if(t.getElementHasLeftElement(d[m]))for(var A=t.getLeftElements(d[m]),S=0;S<A.length;S++)l.indexOf(A[S].getElementId())>=0&&(y=!0);if(t.getElementHasRightElement(d[m]))for(var w=t.getRightElements(d[m]),N=0;N<w.length;N++)l.indexOf(w[N].getElementId())>=0&&(y=!0)}if("COL"==c.dir){var M=t.getCellsInGridByElementId(d[m]);t.getAllElementsInColumn(M.startColIndex,M.backside).forEach((function(t){return l.indexOf(t.ElementId)>=0?y=!0:void 0}))}if("BACK"==c.dir&&t.getPlannerHasActiveBackside()){var W=t.getOppositeElement(d[m]);W&&l.indexOf(W.getElementId())>=0&&(y=!0)}}else y=!0;if(y){B=this.getOptionVal(d[m],c.influenceOPT,o);u==c.onOPT&&B&&""!=B&&this.arrayContainsValue(c.unvalidOPVs,B)&&this.arrayContainsValue(c.onOPVs,i[u])&&(this.setOptionValue(d[m],c.influenceOPT,c.defaultOpv,o),c.warning&&(a=c.warning))}}var K=this.getCurOptionBasedConstructionRules(d[m],o);if(K)for(var X=0;X<K.length;X++)if(K[X].defaultOptions)for(var z=0;z<K[X].defaultOptions.length;z++){var Z=K[X].defaultOptions[z];if(!Z.rule||""==Z.rule||this.evalRule(d[m],Z.rule,o))for(var Y=0;Y<Z.options.length;Y++)"doShow"==Z.value?this.setOptionDoShow(d[m],Z.options[Y],o):"doHide"==Z.value&&this.setOptionDoHide(d[m],Z.options[Y],o),Z.opv&&this.setOptionValue(d[m],Z.options[Y],Z.opv,o)}this.setOptionValue(d[m],"OPTFAF_L_V","OPVOHNE_FAF",o),this.setOptionValue(d[m],"OPTFAF_L_H","OPVOHNE_FAF",o),this.setOptionValue(d[m],"OPTFAF_R_V","OPVOHNE_FAF",o),this.setOptionValue(d[m],"OPTFAF_R_H","OPVOHNE_FAF",o)}return a}},{key:"doCorrectAffectedElementsByOption",value:function doCorrectAffectedElementsByOption(t,o,i,l){if(null!=l){var r=l[0];if(null!=i)for(var a in i){if(this.constructionRules.forceSameOptionInGrid&&this.arrayContainsValue(this.constructionRules.forceSameOptionInGrid,a)){var h=t.getCellsInGridByElementId(r).backside?t.getAllElementsInBackGrid():t.getAllElementsInFrontGrid();if(null!=h)for(var c=0;c<h.length;c++)this.setOptionValue(h[c].ElementId,a,i[a],o)}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInCol,a)){var u=t.getCellsInGridByElementId(r),d=t.getAllElementsInColumn(u.startColIndex,u.backside);if(null!=d){if(t.getPlannerHasActiveBackside()){var m,g=t.getAllElementsInColumn(u.startColIndex,!u.backside);g&&(d=null===(m=d)||void 0===m?void 0:m.concat(g))}for(c=0;c<d.length;c++)this.setOptionValue(d[c].ElementId,a,i[a],o)}}if(this.arrayContainsValue(this.constructionRules.forceSameOptionInRow,a)){var E=t.getCellsInGridByElementId(r),I=t.getAllElementsInRow(E.startRowIndex,E.backside);if(I&&t.getPlannerHasActiveBackside()){var p=t.getAllElementsInRow(E.startRowIndex,!E.backside);p&&(I=I.concat(p))}for(c=0;c<I.length;c++)this.setOptionValue(I[c].ElementId,a,i[a],o)}}var O=t.getCellsInGridByElementId(r),R=t.getAllElementsInRow(O.startRowIndex,O.backside);for(c=0;c<R.length;c++)if(R[c].getElementId()!=r)for(var k=0;k<(null===(P=this.constructionRules.forceSameOptionInRow)||void 0===P?void 0:P.length);k++){var P,v=this.getOptionVal(R[c].getElementId(),this.constructionRules.forceSameOptionInRow[k],o);this.setOptionValue(r,this.constructionRules.forceSameOptionInRow[k],v,o);break}}}},{key:"handleVisibility_SHOW_HIDE",value:function handleVisibility_SHOW_HIDE(t,o,i,l){if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var r=this.hideOptionsForConstruction.has(t)&&this.hideOptionsForConstruction.get(t).indexOf(i.OPTCurrentElem)>=0;this.setOptionDoHide(o,i.OPTNeighborElem,l),r||this.setOptionDoShow(t,i.OPTCurrentElem,l)}}},{key:"handleBacksideVisibility_SHOW_HIDE",value:function handleBacksideVisibility_SHOW_HIDE(t,o,i,l){if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var r=this.constructionRules.optionsVisibilityInfo[i.OPTCurrentElem],a=this.constructionRules.optionsVisibilityInfo[i.OPTNeighborElem];r&&a&&this.getOptionVal(t,i.OPTCurrentElem,l)==r.doShow&&this.getOptionVal(o,i.OPTNeighborElem,l)==a.doShow&&this.setOptionDoHide(t,i.OPTCurrentElem,l)}}},{key:"handleVisibiliy_HIDE_HIDE",value:function handleVisibiliy_HIDE_HIDE(t,o,i,l){var r=this.constructionRules.optionsVisibilityInfo[i.OPTCurrentElem];if(this.checkArticleHasOption(t,i.OPTCurrentElem)&&this.checkArticleHasOption(o,i.OPTNeighborElem)){var a=this.constructionRules.optionsVisibilityInfo[i.OPTNeighborElem],h=r.doShow==this.getOptionVal(t,i.OPTCurrentElem,l),c=this.getOptionVal(o,i.OPTNeighborElem,l)==a.doShow;h&&c&&(this.setOptionDoHide(t,i.OPTCurrentElem,l),this.setOptionDoHide(o,i.OPTNeighborElem,l))}}},{key:"correctSimpleOpt",value:function correctSimpleOpt(t,o,i,l,r){var a=i.getPlannerElementAtGridPos(t,o,r);if(a){if(this.constructionRules.defaultConstructionRules.TOP){var h=void 0;if(i.getElementHasTopElement(a.ElementId)){h=i.getPlannerElementAtGridPos(t,o+1,r);for(var c=0;c<this.constructionRules.defaultConstructionRules.TOP.length;c++){var u=this.constructionRules.defaultConstructionRules.TOP[c];"SHOW_HIDE"==u.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,h.ElementId,u,l):"HIDE_HIDE"==u.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,h.ElementId,u,l)}}}if(this.constructionRules.defaultConstructionRules.RIGHT){var d=void 0;if(r?i.getElementHasLeftElement(a.ElementId):i.getElementHasRightElement(a.ElementId)){d=r?i.getPlannerElementAtGridPos(t-1,o,r):i.getPlannerElementAtGridPos(t+1,o,r);for(c=0;c<this.constructionRules.defaultConstructionRules.RIGHT.length;c++){var m=this.constructionRules.defaultConstructionRules.RIGHT[c];"SHOW_HIDE"==m.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,d.ElementId,m,l):"HIDE_HIDE"==m.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,d.ElementId,m,l)}}}if(this.constructionRules.defaultConstructionRules.DOWN){var g=void 0;if(o>0){g=i.getPlannerElementAtGridPos(t,o-1,r);for(c=0;c<this.constructionRules.defaultConstructionRules.DOWN.length;c++){var E=this.constructionRules.defaultConstructionRules.DOWN[c];"SHOW_HIDE"==E.OPTValueRule?this.handleVisibility_SHOW_HIDE(a.ElementId,g.ElementId,E,l):"HIDE_HIDE"==E.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(a.ElementId,g.ElementId,E,l)}}}var I=r?i.getLeftElements(a.ElementId):i.getRightElements(a.ElementId),p=r?i.getRightElements(a.ElementId):i.getLeftElements(a.ElementId),O=i.getTopElements(a.ElementId),R=i.getBottomElements(a.ElementId),k=r?i.getTopLeftElement(a.ElementId):i.getTopRightElement(a.ElementId);I.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_RECHTS",this.getOptionVal(I[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_RECHTS",l),p.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_LINKS",this.getOptionVal(p[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_LINKS",l),O.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_OBEN",this.getOptionVal(O[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_OBEN",l),k?this.setOptionValue(a.ElementId,"OPTNACHBAR_OBEN_RECHTS",this.getOptionVal(k.ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_OBEN_RECHTS",l),this.constructionRules.hasNeighbors&&this.constructionRules.hasNeighbors.indexOf("OPTNACHBAR_UNTEN")>=0&&(R.length>0?this.setOptionValue(a.ElementId,"OPTNACHBAR_UNTEN",this.getOptionVal(R[0].ElementId,"OPTELEMENT",l),l):this.setOptionDoHide(a.ElementId,"OPTNACHBAR_UNTEN",l))}}},{key:"correctBack",value:function correctBack(t,o,i){if(this.constructionRules.hasDMOD)if(t.getPlannerHasActiveBackside()){var l=void 0;if(l=t.getOppositeElement(i),this.constructionRules.defaultConstructionRules.BACK)for(var r=0;r<this.constructionRules.defaultConstructionRules.BACK.length;r++){var a,h,c=this.constructionRules.defaultConstructionRules.BACK[r],u=!1;if(c.hideOnElemAndOppositeOPT&&c.hideOnElemAndOppositeOPV)this.arrayContainsValue(c.hideOnElemAndOppositeOPV,this.getOptionVal(i,c.hideOnElemAndOppositeOPT,o))&&this.arrayContainsValue(c.hideOnElemAndOppositeOPV,this.getOptionVal(null===(a=l)||void 0===a?void 0:a.getElementId(),c.hideOnElemAndOppositeOPT,o))&&(u=!0);if(u)this.setOptionDoHide(i,c.OPTCurrentElem,o),this.setOptionDoHide(l.getElementId(),c.OPTCurrentElem,o);else if("FORCE_HIDE"==c.OPTValueRule&&this.setOptionDoHide(l.getElementId(),c.OPTCurrentElem,o),"SHOW_HIDE"==c.OPTValueRule)this.handleBacksideVisibility_SHOW_HIDE(null===(h=l)||void 0===h?void 0:h.getElementId(),i,c,o);else"HIDE_HIDE"==c.OPTValueRule&&this.handleVisibiliy_HIDE_HIDE(l.ElementId,i,c,o)}l&&this.getElementHasBottomPlate(l,o)?this.setOptionDoShow(i,"OPTOPP_RAHMEN_U_V",o):this.setOptionDoHide(i,"OPTOPP_RAHMEN_U_V",o),this.getElementHasTopPlate(l,t,o)?this.setOptionDoShow(i,"OPTOPP_RAHMEN_O_V",o):this.setOptionDoHide(i,"OPTOPP_RAHMEN_O_V",o)}else this.setOptionDoHide(i,"OPTOPP_RAHMEN_U_V",o),this.setOptionDoHide(i,"OPTOPP_RAHMEN_O_V",o)}},{key:"correctBottom",value:function correctBottom(t,o,i){var l="";if(this.constructionRules.correctLeftRight&&null!=this.constructionRules.correctLeftRight.rowIndex)for(var r=t.getAllElementsInRow(this.constructionRules.correctLeftRight.rowIndex,i),a=0;a<r.length;a++){var h=r[a];if(0==a){if(null==(l=this.getOptionVal(h.ElementId,this.constructionRules.correctLeftRight.optWithOptVal,o)))return;i?this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRight,l,o):(this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeft,l,o),this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeftBack,l,o))}i?this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optLeft,l,o):(this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRight,l,o),this.setOptionValue(h.ElementId,this.constructionRules.correctLeftRight.optRightBack,l,o))}}},{key:"getValidLadder",value:function getValidLadder(t,o,i){for(var l=o.getAllElementsInColumn(t,!1),r=0;r<this.constructionRules.correctLadder.validLadder.length;r++){var a=this.constructionRules.correctLadder.validLadder[r];if(l.length==a.colCount){for(var h=!0,c=0;c<l.length;c++){var u=l[c];if(this.getOptionVal(u.ElementId,a.heightOption,i)!=a.heightPerRow[c]&&(h=!1),!h)break}if(h)return a}}}},{key:"validateDimensionRule",value:function validateDimensionRule(t,o,i,l,r){var a=!1,h=!1;return"height"==t.toLowerCase()&&i.y>o&&(a=!0),"height"==t.toLowerCase()&&i.y==o&&(h=!0),"width"==t.toLowerCase()&&i.x>o&&(a=!0),"width"==t.toLowerCase()&&i.x==o&&(h=!0),"depth"==t.toLowerCase()&&i.z>o&&(a=!0),"depth"==t.toLowerCase()&&i.z==o&&(h=!0),a||h?l:r}},{key:"correctOverHangingElement",value:function correctOverHangingElement(t,o,i,l){var r=this;if(l&&t){var a=o.getCellsInGridByElementId(t).startColIndex,h=o.getAllElementsInColumn(a,!1,!0),c=h.findIndex((function(o){return o.ElementId==t})),u=h[c];if(u){var d=Object.entries(l),m=d[0][0],g=d[0][1];h.forEach((function(t,l){if(l<c){var a=o.getNeighborElements(t.ElementId,"RIGHT",!1),h=t.Width;a.forEach((function(t){if(t.ElementId!=u.ElementId){var i=o.getNeighborElements(t.ElementId,"TOP",!1).filter((function(t){return t.ElementId!=u.ElementId})).reduce((function(t,o){return t+o.Width}),0);i<t.Width&&(h+=t.Width-i)}})),Math.round(u.Width)>Math.round(h)&&r.setOptionValue(t.ElementId,m,g,i)}else u.Width<t.Width&&r.setOptionValue(t.ElementId,m,g,i)}))}}}},{key:"correctFoot",value:function correctFoot(t,o){var i=this;t.getAllElementsInFrontGrid().forEach((function(l){t.getElementHasBottomElement(l.ElementId)&&(i.setOptionValue(l.ElementId,"OPTFUSS_SYS","OPVOHNE",o),i.setOptionValue(l.ElementId,"OPTPOSSIBILITY_FUSS_OHNE","OPVTRUE",o))}))}},{key:"correctOptionsInfluencedByDimensions",value:function correctOptionsInfluencedByDimensions(t,o,i){var l=this;if(this.constructionRules.optionsInfluencedByDimensions){var r=t.getSizeOfWholeSet(!1),a=t.getAllElementsInFrontGrid(),h=function setRule(t,r){if(i){var h=Object.entries(i).find((function(o){var i=(0,g.Z)(o,2),l=i[0];i[1];return l==t}));if(h)return void a.forEach((function(t){return l.setOptionValue(t.ElementId,h[0],h[1],o)}))}a.forEach((function(i){return l.setOptionDoCustom(i.ElementId,t,r,o)}))};this.constructionRules.optionsInfluencedByDimensions.forEach((function(t){if(Array.isArray(t)){var o=t.every((function(t){return"doshow"==l.validateDimensionRule(t.dimension,t.dimensionLimit,r,t.higherLimit,t.lowerLimit).toLowerCase()})),i=t[0];h(i.option,o?"doShow":"doHide")}else{var a=t,c=t;if(a.series){var u=a.series.findLast((function(t){return"1"==l.validateDimensionRule(t.dimension,t.dimensionLimit,r,"1","2")}));u&&h(a.option,u.value)}else h(c.option,l.validateDimensionRule(c.option,c.dimensionLimit,r,c.higherLimit,c.lowerLimit))}}))}}},{key:"correctLadder",value:function correctLadder(t,o){if(this.constructionRules.correctLadder){for(var i=t.getAllElementsInRow(this.constructionRules.correctLadder.rowIndex,!1),l=0;l<i.length;l++){var r=t.getRowCount(l,!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&-1==this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(r))for(var a=t.getAllElementsInColumn(l,!1),h=0;h<a.length;h++)this.setOptionValue(a[h].ElementId,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,o);if(r<t.getSizeOfHighesRow(!1)){var c,u=null===(c=t.getPlannerElementAtGridPos(l,r-1,!1))||void 0===c?void 0:c.getElementId();u&&this.getOptionVal(u,this.constructionRules.correctLadder.optHeight,o)==this.constructionRules.correctLadder.opvProblematicHeight&&this.setOptionValue(u,this.constructionRules.correctLadder.optHeight,this.constructionRules.correctLadder.opvDefaultHeight,o)}}for(l=0;l<i.length;l++){var d=i[l],m=this.getValidLadder(l,t,o);0==l&&this.setOptionValue(d.ElementId,this.constructionRules.correctLadder.optLadderLeft,m.optLadder,o);var g=m;if(t.getElementHasRightElement(d.getElementId())){var E=this.getValidLadder(l+1,t,o);E.colCount>m.colCount&&(g=E)}this.setOptionValue(d.getElementId(),this.constructionRules.correctLadder.optLadderRight,g.optLadder,o)}var I=t.getSizeOfHighesRow(!1);if(this.constructionRules.correctLadder.onElementHighestRowCount&&this.constructionRules.correctLadder.onElementHighestRowCount.indexOf(I)>=0){var p=t.getAllElementsInRow(I-1,!1);for(l=0;l<p.length;l++){var O=p[l];this.setOptionDoShow(O.getElementId(),this.constructionRules.correctLadder.optHasHeight,o)}}}}},{key:"correctCoverPlate",value:function correctCoverPlate(t,o,i){var l=this;t.onHighestElementsOnly||o.getHighestElementsPerSeries(!!t.onBottom).forEach((function(r){var a=0,h=t.seriesWidthToPlateOpv;r.forEach((function(r){var h;a+=null!==(h=r.size.width)&&void 0!==h?h:0,o.getAllElementsDown(r.elementId).elements.forEach((function(o){return l.setOptionValue(o,t.optABD,"OPVOHNE",i)})),l.setOptionValue(r.elementId,t.optABD,"OPVOHNE",i)}));for(var c,u=r[0],d=function _loop(){var o=h.findLast((function(t){var o=0,i=!1;return r.forEach((function(l){var r;o+=null!==(r=l.size.width)&&void 0!==r?r:0,Math.abs(o-t.limit)<1&&(i=!0)})),!!(t.limit<=a&&i)}));if(!o)return{v:void 0};l.setOptionValue(u.elementId,t.optABD,o.plateOpv,i);var c=0;u=r.find((function(t){var i;return(c+=null!==(i=t.size.width)&&void 0!==i?i:0)>o.limit})),a-=o.limit,h[1].limit>a&&(a=0)};0!=a;)if(c=d())return c.v}))}},{key:"correctSeries",value:function correctSeries(t,o){for(var i=!1,l=t.getAllElementIdsInGrid(),r=!1,a=!1,h=0;h<l.length;h++){var c=l[h];this.getElementIsCornerElement(t.getElementById(c),o)&&(r=!0),this.checkArticleHasOption(c,"OPTBR_ABDECKPLATTE")&&this.setOptionDoHide(c,"OPTBR_ABDECKPLATTE",o);var u=this.getOptionVal(c,"OPTABDECKPLATTE",o);this.checkArticleHasOption(c,"OPTABDECKPLATTE")&&"OPVMIT_PLATTE"==u&&(i=!0),"OPVBR_18"==this.getOptionVal(c,"OPTBR",o)&&(a=!0)}if(!t.getPlannerHasActiveBackside()&&t.getPlannerElementAtGridPos(0,0,!1)){for(var d=t.getSizeOfHighesRow(!1),m=[],g=[],E=[],I=0,p=0,O=t.getAllElementsInColumn(p,!1);O.length>0;){if(O.length==d){var R=O[d-1];E.push(R),"OPVBR_75"==(u=this.getOptionVal(R.ElementId,"OPTBR",o))?I+=75:"OPVBR_18"==u?I+=18.75:"OPVBR_37"==u&&(I+=37.5),this.setOptionDoHide(R.ElementId,"OPTOBEN",o)}else E.length>0&&(m.push(E),g.push(I)),E=[],I=0;p++,O=t.getAllElementsInColumn(p,!1)}for(E.length>0&&(m.push(E),g.push(I)),h=0;h<m.length;h++){var k=m[h][0],P="";if(this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_40")>=0&&Math.abs(g[h]-40.4)<3?P="OPVABDECKPLATTE_40":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_77")>=0&&Math.abs(g[h]-77.8)<3?P="OPVABDECKPLATTE_77":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_115")>=0&&Math.abs(g[h]-115.3)<3?P="OPVABDECKPLATTE_115":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_152")>=0&&Math.abs(g[h]-152.8)<3?P="OPVABDECKPLATTE_152":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_190")>=0&&Math.abs(g[h]-190.3)<3?P="OPVABDECKPLATTE_190":this.constructionRules.hasABD_Values.indexOf("OPVABDECKPLATTE_227")>=0&&Math.abs(g[h]-227.8)<3&&(P="OPVABDECKPLATTE_227"),""==P||r)for(var v=t.getAllElementsInGridSortedbyGridPos(),T=0;T<v.length;T++)this.checkArticleHasOption(v[T].getElementId(),"OPTABD_HIDE")&&this.setOptionDoShow(v[T].getElementId(),"OPTABD_HIDE",o);else for(var V=t.getAllElementsInGridSortedbyGridPos(),_=0;_<V.length;_++)this.checkArticleHasOption(V[_].getElementId(),"OPTABD_HIDE")&&this.setOptionDoHide(V[_].getElementId(),"OPTABD_HIDE",o);if(""==P||!i||r||a)for(var B=0;B<m[h].length;B++)this.setOptionDoShow(m[h][B].ElementId,"OPTOBEN",o);else this.setOptionValue(k.ElementId,"OPTBR_ABDECKPLATTE",P,o)}}}},{key:"correctForceOptOfElement",value:function correctForceOptOfElement(t,o,i,l){if(0!=o.getCellsInGridByElementId(t).cells.length)for(var r=this.getCurOptionBasedConstructionRules(t,i),a=0;a<r.length;a++){if(r[a].forceOptions)for(var h=0;h<r[a].forceOptions.length;h++){var c=r[a].forceOptions[h];if(!c.rule||""==c.rule||this.evalRule(t,c.rule,i))for(var u=c.options,d=c.value,m=0;m<u.length;m++){var g=u[m],E=this.constructionRules.optionsVisibilityInfo[g],I=E.complementDir;l&&("LEFT"==I?I="RIGHT":"RIGHT"==I&&(I="LEFT"));var p=o.getNeighborElements(t,I);if(p.length>0&&E.complementDir)for(var O=0;O<p.length;O++){for(var R=p[O],k=this.getCurOptionBasedConstructionRules(R.ElementId,i),P=E.complementOPT,v=!1,T=0;T<k.length;T++)if(k[T].forceOptions)for(var V=0;V<k[T].forceOptions.length;V++){var _=k[T].forceOptions[V];if((!_.rule||""==_.rule||this.evalRule(R.ElementId,_.rule,i))&&(this.arrayContainsValue(_.options,P)&&(v=!0,"doShow"==d&&"doShow"==_.value&&("OPVFUELLUNG"==this.getOptionVal(t,"OPTELEMENT",i)&&"OPVFUELLUNG"==this.getOptionVal(R.ElementId,"OPTELEMENT",i)?(this.setOptionDoHide(R.ElementId,P,i),this.setOptionDoHide(R.ElementId,P,i)):this.setOptionDoShow(R.ElementId,P,i)),"doHide"==d&&"doHide"==_.value&&(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)),"doShow"==d&&"doHide"==_.value||"doHide"==d&&"doShow"==_.value))){var B=!0;c.prio&&_.prio?B=c.prio<=_.prio:c.prio?B=!0:_.prio&&(B=!1),B?"doHide"==d?(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doShow"==d&&(this.setOptionDoShow(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doHide"==_.value?(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)):"doShow"==_.value&&(this.setOptionDoHide(t,g,i),this.setOptionDoShow(R.ElementId,P,i))}}v||("doShow"==d&&(this.setOptionDoShow(t,g,i),this.setOptionDoHide(R.ElementId,P,i)),"doHide"==d&&(this.setOptionDoHide(t,g,i),this.setOptionDoHide(R.ElementId,P,i)))}else"doShow"==d&&this.setOptionDoShow(t,g,i),"doHide"==d&&this.setOptionDoHide(t,g,i)}}if(r[a].changeOptions)for(var C=0;C<r[a].changeOptions.length;C++){for(var x=!0,b=r[a].changeOptions[C].rule.split("&"),y=0;y<b.length;y++)if(b[y].indexOf("!=")>0){var H=b[y].split("!=")[0],G=b[y].split("!=")[1];this.getOptionVal(t,H,i)==G&&(x=!1)}else{H=b[y].split("=")[0],G=b[y].split("=")[1];this.getOptionVal(t,H,i)!=G&&(x=!1)}x&&(r[a].changeOptions[C].doShow&&this.setOptionDoShow(t,r[a].changeOptions[C].doShow,i),r[a].changeOptions[C].doHide&&this.setOptionDoHide(t,r[a].changeOptions[C].doHide,i),r[a].changeOptions[C].opt&&r[a].changeOptions[C].opv&&this.setOptionValue(t,r[a].changeOptions[C].opt,r[a].changeOptions[C].opv,i))}}}},{key:"correctNeighborCustomOLTs",value:function correctNeighborCustomOLTs(t,o,i){if(this.constructionRules.correctNeighborOPT&&0!=this.constructionRules.correctNeighborOPT.length)for(var l=0;l<this.constructionRules.correctNeighborOPT.length;l++){var r=o.getCellsInGridByElementId(t);if(this.setOptionValue(t,this.constructionRules.correctNeighborOPT[l].opt,"OPVOHNE",i),0==r.cells.length)return;var a=o.getNeighborElements(t,this.constructionRules.correctNeighborOPT[l].dir);if(a.length>0){var h=this.getOptionVal(a[0].ElementId,this.constructionRules.correctNeighborOPT[l].neighborOPT,i);""!=h&&this.setOptionValue(t,this.constructionRules.correctNeighborOPT[l].opt,h,i)}}}},{key:"doChangeRetailArticleNumbers",value:function doChangeRetailArticleNumbers(t,o){var i=t.getAllElementsInGridSortedbyGridPos();if(this.constructionRules.correctRetailArticleNumberByRule&&this.constructionRules.correctRetailArticleNumberByRule.length>0)for(var l=0;l<this.constructionRules.correctRetailArticleNumberByRule.length;l++){var r=this.constructionRules.correctRetailArticleNumberByRule[l];if("global"==r.range){for(var a=!0,h=0;h<i.length&&a;h++){this.evalRule(i[h].getElementId(),r.rule,o)||(a=!1)}if(a)return{doChange:!0,retailArticleRules:r.retailArticleRules}}else if("singular"==r.range){var c=!1;for(h=0;h<i.length;h++){this.evalRule(i[h].getElementId(),r.rule,o)&&(c=!0)}if(c)return{doChange:!0,retailArticleRules:r.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,l.Z)(u().mark((function _callee(t,o,i,l){var r,a,h,c,m,g,E,I,O,R,k,P,v,T,V,_,B;return u().wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(null!=this.constructionRules&&this.constructionRulesLoaded){u.next=3;break}return p.error(new d.GE("Error construction rules are not set for boxPlanner",{code:"WC_0012"})),u.abrupt("return");case 3:if(a=(new Date).getTime(),h=void 0,p.debug("BoxPlanner - updateOptionLogicInGrid start updateOptionLogicInGrid"),c=new Map,l)for(m=t.getAllElementIdsInGrid(),o=void 0,i=void 0,g=0;g<m.length;g++)this.getElementIsCornerElement(t.getElementById(m[g]),c)&&this.setOptionValue(m[g],"OPTELEMENT","OPVOFFENES_FACH",c);for(h=this.setAllOptToDefault(t,c,o,i),this.doCorrectAffectedElementsByOption(t,c,o,i),this.correctBottom(t,c,!1),t.getPlannerHasActiveBackside()&&this.correctBottom(t,c,!0),this.correctSeries(t,c),g=0;g<t.getColumnCount();g++)for(E=0;E<t.getRowCount(g,!1);E++)this.correctSimpleOpt(g,E,t,c,!1);if(t.getPlannerHasActiveBackside())for(g=t.getColumnCount()-1;g>=0;g--)for(E=0;E<t.getRowCount(g,!1);E++)this.correctSimpleOpt(g,E,t,c,!0);g=0;case 17:if(!(g<t.getColumnCount())){u.next=31;break}E=0;case 19:if(!(E<t.getRowCount(g,!1))){u.next=28;break}if(O=null===(I=t.getPlannerElementAtGridPos(g,E,!1))||void 0===I?void 0:I.ElementId){u.next=23;break}return u.abrupt("continue",25);case 23:this.correctForceOptOfElement(O,t,c,!1),this.correctNeighborCustomOLTs(O,t,c);case 25:E++,u.next=19;break;case 28:g++,u.next=17;break;case 31:if(!t.getPlannerHasActiveBackside()){u.next=47;break}g=t.getColumnCount()-1;case 33:if(!(g>=0)){u.next=47;break}E=0;case 35:if(!(E<t.getRowCount(g,!1))){u.next=44;break}if(k=null===(R=t.getPlannerElementAtGridPos(g,E,!1))||void 0===R?void 0:R.ElementId){u.next=39;break}return u.abrupt("continue",41);case 39:this.correctForceOptOfElement(k,t,c,!0),this.correctNeighborCustomOLTs(k,t,c);case 41:E++,u.next=35;break;case 44:g--,u.next=33;break;case 47:if(this.correctFoot(t,c),this.correctLadder(t,c),this.correctOptionsInfluencedByDimensions(t,c,o),this.correctOverHangingElement(null===(r=i)||void 0===r?void 0:r[0],t,c,o),this.partlistHelper.calculateKnots(t,c),this.partlistHelper.calculateRahmen(t,c),this.constructionRules.coverPlateRule){P=_createForOfIteratorHelper(this.constructionRules.coverPlateRule);try{for(P.s();!(v=P.n()).done;)T=v.value,this.correctCoverPlate(T,t,c)}catch(t){P.e(t)}finally{P.f()}}g=0;case 55:if(!(g<t.getColumnCount())){u.next=68;break}E=0;case 57:if(!(E<t.getRowCount(g,!1))){u.next=65;break}if(_=null===(V=t.getPlannerElementAtGridPos(g,E,!1))||void 0===V?void 0:V.getElementId()){u.next=61;break}return u.abrupt("continue",62);case 61:this.correctBack(t,c,_);case 62:E++,u.next=57;break;case 65:g++,u.next=55;break;case 68:return B=this.doChangeRetailArticleNumbers(t,c),u.next=71,this.updateCfgValuesByPlanner(c,void 0,this.constructionRules.partlistRules.bundleRules,B);case 71:return p.debug("BoxPlanner updateOptionLogic - Duration after setting Option Values of all Articles: "+((new Date).getTime()-a)),p.debug("BoxPlanner updateOptionLogic - Duration after setting updating configurator: "+((new Date).getTime()-a)),u.abrupt("return",h);case 74:case"end":return u.stop()}}),_callee,this)}))),function updateOptionLogicBoxPlanner(o,i,l,r){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,o){if(this.hideOptionsForConstruction.has(t)){var i=this.hideOptionsForConstruction.get(t);this.hideOptionsForConstruction.set(o,(0,m.Z)(i))}}},{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}(),R=i(64357),k=i(33266);function BoxPlannerGrid_createForOfIteratorHelper(t,o){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function BoxPlannerGrid_unsupportedIterableToArray(t,o){if(t){if("string"==typeof t)return BoxPlannerGrid_arrayLikeToArray(t,o);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?BoxPlannerGrid_arrayLikeToArray(t,o):void 0}}(t))||o&&t&&"number"==typeof t.length){i&&(t=i);var l=0,r=function F(){};return{s:r,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,h=!0,c=!1;return{s:function s(){i=i.call(t)},n:function n(){var t=i.next();return h=t.done,t},e:function e(t){c=!0,a=t},f:function f(){try{h||null==i.return||i.return()}finally{if(c)throw a}}}}function BoxPlannerGrid_arrayLikeToArray(t,o){(null==o||o>t.length)&&(o=t.length);for(var i=0,l=Array(o);i<o;i++)l[i]=t[i];return l}function ownKeys(t,o){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);o&&(l=l.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),i.push.apply(i,l)}return i}function _objectSpread(t){for(var o=1;o<arguments.length;o++){var i=null!=arguments[o]?arguments[o]:{};o%2?ownKeys(Object(i),!0).forEach((function(o){(0,h.Z)(t,o,i[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(i,o))}))}return t}var P=d.ZP.initLog("Planner","BOX-PLANNER_GRID"),v=function(){return(0,a.Z)((function BoxPlannerGrid(t,o){(0,r.Z)(this,BoxPlannerGrid),(0,h.Z)(this,"plannerElements",void 0),(0,h.Z)(this,"generalPlanningState",void 0),(0,h.Z)(this,"hasActiveBackside",void 0),(0,h.Z)(this,"getValueOfOptionOfArticle",void 0),(0,h.Z)(this,"gridSetupParams",void 0),this.plannerElements=new Map,this.generalPlanningState={grids:[{matrix:[[]]}]},this.gridSetupParams=t,this.getValueOfOptionOfArticle=o,this.hasActiveBackside=!1}),[{key:"createNewCells",value:function createNewCells(t,o,i,l){if(this.gridSetupParams.forceSingleCellPerElement)return[{plannedElement:{elementId:t.ElementId,basketId:t.getBasketId(),size:{width:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:t.getWidth(),height:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depth:t.getDepth()},articleCodex:t.ArticleCodex,area:{fromX:o,toX:o+1,fromY:i,toY:i+1}},index:new R.FM(o,i)}];this.gridSetupParams.forceFixCellRasterSize||P.error(new d.GE("Box planner with params forceSingleCellPerElement is false and forceFixCellRasterSize is false are not allowed"));for(var r=Math.round(t.getWidth()/this.gridSetupParams.fixCellRasterWidth),a=Math.round(t.getHeight()/this.gridSetupParams.fixCellRasterHeight),h=[],c=0;c<r;c++)for(var u=0;u<a;u++){var m={plannedElement:{basketId:t.getBasketId(),elementId:t.getElementId(),articleCodex:t.ArticleCodex,size:{width:t.getWidth(),depth:t.getDepth(),height:t.getHeight()},area:{fromX:o,toX:Math.round(o+t.getWidth()/this.gridSetupParams.fixCellRasterWidth),fromY:i,toY:Math.round(i+t.getHeight()/this.gridSetupParams.fixCellRasterHeight)}},index:new R.FM(o+c,i+u)};h.push(m)}return h}},{key:"createEmptyCells",value:function createEmptyCells(t,o,i,l,r,a){for(var h=[],c=t;c<=i;c++)for(var u=o;u<=l;u++){var d={plannerElementId:-1,width:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:r,height:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:a,index:new R.FM(c,u)};h.push(d)}return h}},{key:"getCellCount",value:function getCellCount(t){return this.gridSetupParams.forceSingleCellPerElement?{colCount:1,rowCount:1}:{colCount:Math.round(t.getWidth()/this.gridSetupParams.fixCellRasterWidth),rowCount:Math.round(t.getHeight()/this.gridSetupParams.fixCellRasterWidth)}}},{key:"getAllUsedCellsInGrid",value:function getAllUsedCellsInGrid(t){for(var o=new Array,i=t?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=0;l<i.length;l++)for(var r=0;r<i[l].length;r++)null!=i[l][r]&&o.push(i[l][r]);return o}},{key:"getGridColumnWidth",value:function getGridColumnWidth(t){for(var o=this.generalPlanningState.grids[0].matrix,i=0;i<o[i].length;i++){var l,r,a=o[t][i];if(a)return null!==(l=null===(r=a.plannedElement)||void 0===r?void 0:r.size.width)&&void 0!==l?l:0}return 0}},{key:"getGridColumnHeight",value:function getGridColumnHeight(t){var o=0,i=!1,l=this.generalPlanningState.grids[0].matrix;if(l.length>t)for(var r=l[t],a=r.length-1;a>=0;a--){var h,c,u=r[a];!i&&u&&(i=!0),i&&(o+=null!==(h=null===(c=u.plannedElement)||void 0===c?void 0:c.size.height)&&void 0!==h?h:0),a=u.plannedElement?u.plannedElement.area.fromY-1:a-1}return o}},{key:"deleteElementByIdFromGrid",value:function deleteElementByIdFromGrid(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=o.endRowIndex-o.startRowIndex+1;this.getRowCount(o.startColIndex,o.backside),o.cells.reverse().forEach((function(t){i[t.index.x].splice(t.index.y,1),0==i[t.index.x].length&&i.splice(t.index.x,1)}));var r=[];i.forEach((function(t,o){r[o]=[],t.forEach((function(t,i){var l=t.plannedElement.area;r[o][i]={index:{x:o,y:i},plannedElement:_objectSpread(_objectSpread({},t.plannedElement),{},{area:{fromX:o,fromY:i,toX:o+(l.toX-l.fromX),toY:i+(l.toY-l.fromY)}})}}))})),o.backside?this.generalPlanningState.grids[1].matrix=r:this.generalPlanningState.grids[0].matrix=r}},{key:"getPlannerElementAtGridPos",value:function getPlannerElementAtGridPos(t,o,i){var l=i?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(l[t]&&l[t][o]){var r,a=l[t][o];if(null==a)return;var h=null===(r=a.plannedElement)||void 0===r?void 0:r.elementId;if(!h)return;return this.plannerElements.get(h)}}},{key:"getCellsInGridByElementId",value:function getCellsInGridByElementId(t){var o,i,l,r,a,h,c=!1,u=this.generalPlanningState.grids[0].matrix,d=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix,m=[];if(u.forEach((function(o){return o.forEach((function(o){var i;(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==t&&m.push(o)}))})),null==d||d.forEach((function(o){return o.forEach((function(o){var i;(null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==t&&(m.push(o),c=!0)}))})),0==m.length)return{cells:m,backside:c,startColIndex:0,endColIndex:0,startRowIndex:0,endRowIndex:0,colCount:0,rowCount:0};var g=null===(i=m[0].plannedElement)||void 0===i?void 0:i.area;return{cells:m,backside:c,startColIndex:null!==(l=null==g?void 0:g.fromX)&&void 0!==l?l:0,endColIndex:null!==(r=null==g?void 0:g.toX)&&void 0!==r?r:0,startRowIndex:null!==(a=null==g?void 0:g.fromY)&&void 0!==a?a:0,endRowIndex:null!==(h=null==g?void 0:g.toY)&&void 0!==h?h:0,colCount:g?g.toX-g.toX:0,rowCount:g?g.toY-g.fromY:0}}},{key:"GridSetupParams",set:function set(t){this.gridSetupParams=t}},{key:"getAllElementIdsInGrid",value:function getAllElementIdsInGrid(){return Array.from(this.plannerElements.keys())}},{key:"_getAllElementsInGrid",value:function _getAllElementsInGrid(t){for(var o=[],i=[],l=0;l<t.length;l++)for(var r=0;r<t[l].length;r++){var a,h=t[l][r];null!=h&&(null!==(a=h.plannedElement)&&void 0!==a&&a.elementId&&-1==o.indexOf(h.plannedElement.elementId)&&(o.push(h.plannedElement.elementId),i.push(this.plannerElements.get(h.plannedElement.elementId))))}return i}},{key:"getAllElementsInFrontGrid",value:function getAllElementsInFrontGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[0].matrix)}},{key:"getAllElementsInBackGrid",value:function getAllElementsInBackGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix)}},{key:"getAllElementsInBacksideModuleGrid",value:function getAllElementsInBacksideModuleGrid(){return this._getAllElementsInGrid(this.generalPlanningState.grids[1].matrix).map((function(t){return t.ElementId}))}},{key:"getAllElementsInGridSortedbyElementId",value:function getAllElementsInGridSortedbyElementId(){return Array.from(this.plannerElements.values())}},{key:"getAllElementsInGridSortedbyGridPos",value:function getAllElementsInGridSortedbyGridPos(){for(var t,o,i=[],l=[],r=this.generalPlanningState.grids[0].matrix,a=null!==(t=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix)&&void 0!==t?t:0,h=0;h<r.length;h++)for(var c=0;c<r[h].length;c++){var u,d=r[h][c],m=null===(u=d.plannedElement)||void 0===u?void 0:u.elementId;if(d&&m&&-1==l.indexOf(m)){var g=this.getElementById(m);l.push(m),i.push(g)}}for(h=0;h<a.length;h++)for(c=0;c<a[h].length;c++){var E,I=a[h][c],p=null===(E=I.plannedElement)||void 0===E?void 0:E.elementId;if(I&&p&&-1==l.indexOf(p)){var O=this.getElementById(p);l.push(p),i.push(O)}}return i}},{key:"getElementById",value:function getElementById(t){return this.plannerElements.get(t)}},{key:"getElementIsFirstInGrid",value:function getElementIsFirstInGrid(t){var o=this.getCellsInGridByElementId(t);return 0!=o.cells.length&&(0==o.cells[0].index.x&&0==o.cells[0].index.y&&!o.backside)}},{key:"getElementIsInLastCol",value:function getElementIsInLastCol(t,o){var i=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;return this.getCellsInGridByElementId(t).endColIndex==i.length}},{key:"getElementHasTopElement",value:function getElementHasTopElement(t){for(var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=o.startColIndex;l<o.endColIndex;l++)if(i[l].length>o.endRowIndex&&i[l][o.endRowIndex])return!0;return!1}},{key:"getTopElements",value:function getTopElements(t){var o,i=this.getCellsInGridByElementId(t),l=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=i.cells[0].plannedElement;if(!a)return r;for(var h=null===(o=l[a.area.fromX])||void 0===o?void 0:o[a.area.toY];h;){var c=h.plannedElement;if(!c)break;r.push(this.plannerElements.get(c.elementId)),h=l[c.area.fromX][c.area.toY]}return r}},{key:"getTopRightElement",value:function getTopRightElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(i.length>o.endColIndex&&i[o.endColIndex].length>o.endRowIndex&&i[o.endColIndex][o.endRowIndex]){var l=i[o.endColIndex][o.endRowIndex];return this.plannerElements.get(l.plannedElement.elementId)}}},{key:"getTopLeftElement",value:function getTopLeftElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(o.startColIndex>0&&i[o.startColIndex-1].length>0&&i[o.startColIndex-1][o.endRowIndex]){var l=i[o.startColIndex-1][o.endRowIndex];return this.plannerElements.get(l.plannedElement.elementId)}}},{key:"getElementHasBottomElement",value:function getElementHasBottomElement(t){return this.getCellsInGridByElementId(t).startRowIndex-1>=0}},{key:"getBottomElements",value:function getBottomElements(t){var o,i=this.getCellsInGridByElementId(t),l=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=i.cells[0].plannedElement;if(!a)return r;for(var h=null===(o=l[a.area.fromX])||void 0===o?void 0:o[a.area.fromY-1];h;){var c,u=h.plannedElement;if(!u)break;r.push(this.plannerElements.get(u.elementId)),h=null===(c=l[u.area.fromX])||void 0===c?void 0:c[u.area.fromY-1]}return r}},{key:"getElementHasRightElement",value:function getElementHasRightElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;if(i.length>o.endColIndex&&i[o.endColIndex].length>o.startRowIndex&&i[o.endColIndex][o.startRowIndex])return!0;return!1}},{key:"getRightElements",value:function getRightElements(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=o.cells[0].plannedElement;if(!a)return l;for(var h=a.area.fromY;h<a.area.toY;h++){var c,u,d=null===(c=i[a.area.toX])||void 0===c?void 0:c[h],m=null==d||null===(u=d.plannedElement)||void 0===u?void 0:u.elementId;d&&m&&-1==r.indexOf(m)&&(r.push(m),l.push(this.plannerElements.get(m)))}return l}},{key:"getElementHasLeftElement",value:function getElementHasLeftElement(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix;return!!(o.startColIndex>0&&i[o.startColIndex-1][o.startRowIndex])}},{key:"getLeftElements",value:function getLeftElements(t){var o=this.getCellsInGridByElementId(t),i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=o.cells[0].plannedElement;if(!a)return l;for(var h=a.area.fromY;h<a.area.toY;h++){var c,u,d=null===(c=i[a.area.fromX-1])||void 0===c?void 0:c[h],m=null==d||null===(u=d.plannedElement)||void 0===u?void 0:u.elementId;d&&m&&-1==r.indexOf(m)&&(r.push(m),l.push(this.plannerElements.get(m)))}return l}},{key:"getAllElementsInColumn",value:function getAllElementsInColumn(t,o){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],l=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,r=[],a=[];if(!l[t])return r;if(i)for(var h=0;h<l[t].length;h++){var c,u=l[t][h],d=null==u||null===(c=u.plannedElement)||void 0===c?void 0:c.elementId;d&&u&&-1==a.indexOf(d)&&(a.push(d),r.push(this.plannerElements.get(d)))}else for(h=l[t].length-1;h>=0;h--){var m,g=l[t][h],E=null==g||null===(m=g.plannedElement)||void 0===m?void 0:m.elementId;g&&E&&-1==a.indexOf(E)&&(a.push(E),r.push(this.plannerElements.get(E)))}return r}},{key:"getColumnCount",value:function getColumnCount(){return this.generalPlanningState.grids[0].matrix.length}},{key:"getRowCount",value:function getRowCount(t,o){return o?this.generalPlanningState.grids[1].matrix[t].length:this.generalPlanningState.grids[0].matrix[t].length}},{key:"getAllElementsInRow",value:function getAllElementsInRow(t,o){for(var i=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=[],a=0;a<i.length;a++)if(i[a].length>t){var h,c=i[a][t],u=null==c||null===(h=c.plannedElement)||void 0===h?void 0:h.elementId;c&&u&&-1==r.indexOf(u)&&(r.push(u),l.push(this.plannerElements.get(u)))}return l}},{key:"getSizeOfHighesRow",value:function getSizeOfHighesRow(t){for(var o=t?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,i=0,l=0;l<o.length;l++)for(var r=o[l].length;r>=0;r--){if(o[l][r]){i<r&&(i=r);break}}return i+1}},{key:"getNeighborElements",value:function getNeighborElements(t,o){var i,l,r=this,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],h=this.getCellsInGridByElementId(t),c=h.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u=[],d=h.cells[0].plannedElement;if(!d)return u;for(var m=c[d.area.fromX],g=0,E=0,I=0;I<m.length;){var p=m[I];p.index.y<h.startRowIndex&&(g=Math.round(1e3*(g+p.plannedElement.size.height))/1e3),p.index.y<h.endRowIndex&&(E=Math.round(1e3*(E+p.plannedElement.size.height))/1e3),I=p.plannedElement.area.toY}var O=0,R=[];switch(o){case"RIGHT":for(var k=d.area.toX;k<c.length;){for(var P,v,T=c[k],V=0;V<T.length;){var _,B,C=T[V];R.includes(C)||((d.area.fromY==V&&this.gridSetupParams.forceSingleCellPerElement&&d.area.toX==k||a&&!this.gridSetupParams.forceSingleCellPerElement&&O==g||!a&&O>=g&&O<=E)&&R.push(C),O=Math.round(1e3*(O+C.plannedElement.size.height))/1e3,V=null!==(_=null===(B=C.plannedElement)||void 0===B?void 0:B.area.toY)&&void 0!==_?_:V+1)}O=0,k=null!==(P=null===(v=T[0].plannedElement)||void 0===v?void 0:v.area.toX)&&void 0!==P?P:k+1}R.forEach((function(t){return!u.find((function(o){return o.ElementId==t.plannedElement.elementId}))&&u.push(r.plannerElements.get(t.plannedElement.elementId))}));break;case"LEFT":for(var x=d.area.fromX-1;x>0;){for(var b=c[x],y=0;y<b.length;){var H,G,D=b[y];R.includes(D)||((d.area.fromY==y&&this.gridSetupParams.forceSingleCellPerElement&&d.area.toX==x||a&&!this.gridSetupParams.forceSingleCellPerElement&&O==g||!a&&O>=g&&O<=E)&&R.push(D),O=Math.round(1e3*(O+D.plannedElement.size.height))/1e3,y=null!==(H=null===(G=D.plannedElement)||void 0===G?void 0:G.area.toY)&&void 0!==H?H:y+1)}O=0,x=b[0].plannedElement?b[0].plannedElement.area.fromX-1:x+1}R.forEach((function(t){return!u.find((function(o){return o.ElementId==t.plannedElement.elementId}))&&u.push(r.plannerElements.get(t.plannedElement.elementId))}));break;case"TOP":for(var L=[],A=d.area.fromX;A<d.area.toX;){var S=c[A][d.area.toY];if(!S)break;if(L.push(S),a)break;A=S.plannedElement.area.toX}if(0==L.length)break;L.forEach((function(t){var o,i=null===(o=t.plannedElement)||void 0===o?void 0:o.elementId;i&&u.push(r.plannerElements.get(i))}));break;case"DOWN":var w=null===(i=c[d.area.fromX])||void 0===i?void 0:i[d.area.fromY-1],N=null==w||null===(l=w.plannedElement)||void 0===l?void 0:l.elementId;N&&u.push(this.plannerElements.get(N));break;case"BACK":if(this.hasActiveBackside){var M=this.getPlannerElementAtGridPos(h.startColIndex,h.startRowIndex,!0);null!=M&&(u=[M])}}return u}},{key:"getOppositeElement",value:function getOppositeElement(t){if(this.hasActiveBackside){var o=this.getCellsInGridByElementId(t);return o.backside?this.getPlannerElementAtGridPos(o.startColIndex,o.startRowIndex,!1):this.getPlannerElementAtGridPos(o.startColIndex,o.startRowIndex,!0)}}},{key:"getOppositeElements",value:function getOppositeElements(t){var o=[];if(this.hasActiveBackside)for(var i=0;i<t.length;i++){var l=this.getOppositeElement(t[i]);null!=l&&o.push(l)}return o}},{key:"getSizeOfWholeSet",value:function getSizeOfWholeSet(t){for(var o=0,i=0,l=0,r=[],a=this.generalPlanningState.grids[0].matrix,h=0;h<a.length;){for(var c,u,d=0,m=a[h],g=0;g<m.length;){var E,I,p,O=m[g],k=null===(E=O)||void 0===E||null===(E=E.plannedElement)||void 0===E?void 0:E.elementId;k&&O&&-1==r.indexOf(k)&&(d+=this.plannerElements.get(k).getHeight(),0==h&&0==g&&(i=O.plannedElement.size.depth)),g=null!==(I=null===(p=O.plannedElement)||void 0===p?void 0:p.area.toY)&&void 0!==I?I:g+1}d>l&&(l=d);var P=this.getGridColumnWidth(h);t&&h>0&&(77.9==P?P=75:40.4==P?P=37.5:21.7==P&&(P=18.75)),o+=P,h=null!==(c=null==m||null===(u=m[0])||void 0===u||null===(u=u.plannedElement)||void 0===u?void 0:u.area.toX)&&void 0!==c?c:h+1}return this.hasActiveBackside&&(i*=2),new R.P(o,l,i)}},{key:"getHighestElementsPerSeries",value:function getHighestElementsPerSeries(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.hasActiveBackside)throw new Error("this function is doesnt implement the backside logic (yet)");for(var o=[],i=this.generalPlanningState.grids[0].matrix,l=-1,r=0;r<i.length;){for(var a,h=i[r],c=0,u=0;u<h.length;){var d=h[u].plannedElement;c+=d.size.height,u=d.area.toY}Math.round(c)==Math.round(l)||t?(o[o.length-1]||o.push([]),o[o.length-1].push(i[r][t?0:h.length-1].plannedElement)):i[r][h.length-1].plannedElement.area.fromX==r&&o.push([i[r][t?0:h.length-1].plannedElement]),l=c;var m=h[h.length-1].plannedElement.area.toX,g=null===(a=i[m])||void 0===a?void 0:a.length;if(g&&g!=h.length){var E=i[m][g-1];E.index.x!=E.plannedElement.area.fromX&&(m=E.plannedElement.area.toX)}r=m}return o}},{key:"getAllElementsInSameRowByElementId",value:function getAllElementsInSameRowByElementId(t){var o=this.getCellsInGridByElementId(t),i=this.getAllElementsInRow(o.startRowIndex,!1);return this.hasActiveBackside&&(i=i.concat(this.getAllElementsInRow(o.startRowIndex,!0))),{elementIds:i.map((function(t){return t.ElementId})),plannerElements:i,backside:o.backside}}},{key:"getAllElementsToFillUp",value:function getAllElementsToFillUp(t,o){var i=this,l=this.getCellsInGridByElementId(t),r=l.cells[0].plannedElement,a="LEFT"==o?l.startColIndex:l.endColIndex-1,h=l.startRowIndex,c=l.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u=[],d=r.area.toX-r.area.fromX,m="RIGHT"==o?+d:-d;u.push(r.elementId);_objectSpread(_objectSpread({},r.area),{},{fromX:r.area.fromX+m,toX:r.area.toX+m});for(var g=function _loop(t){var l,h=null===(l=c[a][t])||void 0===l?void 0:l.plannedElement;if(!h)return E=t,0;var d=i.getNeighborElements(h.elementId,"TOP",!1),m=0;d.forEach((function(t){return m+=t.Width}));var g=0;if(h.size.width>m&&(g=h.size.width-m),i.getNeighborElements(h.elementId,o,!1).forEach((function(t){i.getNeighborElements(t.ElementId,"TOP").length>0||(g+=t.Width)})),g>=r.size.width)return E=t,0;for(var I=r.size.width-g;I>0;)u.push(h.elementId),I=Math.round(I-h.size.width);t=h.area.fromY-1,E=t},E=h-1;E>=0&&0!==g(E););return{elements:u.reverse(),backside:l.backside}}},{key:"getAllElementsDown",value:function getAllElementsDown(t){var o=this.getCellsInGridByElementId(t);if(0==o.startRowIndex)return{elements:[],backside:!1};for(var i=o.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,l=[],r=o.startColIndex;r<o.endColIndex;r++)for(var a=o.startRowIndex--;a>=0;a--){var h,c=i[r][a],u=null==c||null===(h=c.plannedElement)||void 0===h?void 0:h.elementId;c&&u&&-1==l.indexOf(u)&&l.push(u)}return{elements:l,backside:o.backside}}},{key:"getAllElementsInSameCol",value:function getAllElementsInSameCol(t){var o=this.getCellsInGridByElementId(t),i=this.getAllElementsInColumn(o.startColIndex,o.backside);return null==i&&(i=[]),{elements:i.map((function(t){return t.ElementId})),backside:o.backside}}},{key:"prepareGridForColCopy",value:function prepareGridForColCopy(t,o){var i,l,r;if(!(o.y>0)){var a=this.getCellsInGridByElementId(t),h=o.x>0,c=a.cells[0].plannedElement,u={x:c.area.toX-1+o.x,y:c.area.fromY+o.y};o.x<0&&(u.x=a.cells[0].plannedElement.area.fromX-1);var d=this.generalPlanningState.grids[0].matrix,m=null!==(i=null===(l=this.generalPlanningState.grids[1])||void 0===l?void 0:l.matrix)&&void 0!==i?i:0,g=c.area.toX-c.area.fromX,E=null===(r=d[a.cells[0].index.x+o.x])||void 0===r?void 0:r[a.cells[0].index.y];(-1==u.x||E&&!h)&&(u.x-=o.x);var I=function moveGrid(t){for(var o=new Array,i=t.filter((function(t){return t.index.x==c.area.toX})),l=[],r=[],a=function _loop2(){var t=d[m][c.area.fromY],o=d[m][c.area.fromY-1];t&&!l.find((function(o){return o.plannedElement.elementId==t.plannedElement.elementId}))&&l.push(d[m][c.area.fromY]),o&&!r.find((function(t){return t.plannedElement.elementId==o.plannedElement.elementId}))&&r.push(d[m][c.area.fromY-1])},m=0;m<d.length;m++)a();var E=l.reduce((function(t,o){return t+o.plannedElement.size.width}),0),I=r?r.reduce((function(t,o){return t+o.plannedElement.size.width}),0):0,p=i.find((function(t){return t.index.y==u.y})),O=t.filter((function(t){return t.index.x==c.area.fromX-1})),R=O.find((function(t){return t.index.y==u.y}));return t.forEach((function(t){t.index.x>=u.x&&(h&&(p||0==i.length)&&(!(E<=I-c.size.width)||t.index.y>=c.area.fromY&&t.index.y<c.area.toY)||!h&&(R||0==O.length)||-1==u.x)&&(t.index.x+=g,t.plannedElement.area.fromX+=g,t.plannedElement.area.toX+=g),o[t.index.x]||(o[t.index.x]=[]),o[t.index.x][t.index.y]=t})),o};d=I(this.getAllUsedCellsInGrid(!1));for(var p=0;p<g;p++)d[u.x+p]||(d[u.x+p]=[]);if(this.generalPlanningState.grids[0].matrix=d,this.hasActiveBackside){m=I(this.getAllUsedCellsInGrid(!0));for(var O=0;O<g;O++)m[u.x+O]||(m[u.x+O]=[]);this.generalPlanningState.grids[1].matrix=m}}}},{key:"prepareGridForBackSideCopy",value:function prepareGridForBackSideCopy(){this.generalPlanningState.grids[1]={matrix:[[]]},this.hasActiveBackside=!0}},{key:"addElementAtGridPos",value:function addElementAtGridPos(t,o,i,l){for(var r=l?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,a=this.createNewCells(t,o,i,l),h=0;h<a.length;h++){var c=a[h];r[c.index.x]||(r[c.index.x]=[]),r[c.index.x][c.index.y]=c}this.plannerElements.set(t.getElementId(),t),l&&(this.hasActiveBackside=!0)}},{key:"moveElementAsCopy",value:function moveElementAsCopy(t,o){var i=this.plannerElements.get(t),l=this.getCellsInGridByElementId(t);if(i){this.deleteElement(t,"STD");var r=this.generalPlanningState.grids[0].matrix,a=void 0;if(o.x<0&&0==o.y){var h=l.endColIndex>=o.x;l.startColIndex<=o.x&&(o.x-=l.endColIndex-l.startColIndex),o.x<0&&(o.x=0),a=this.createNewCells(i,o.x,o.y,!1);var c=[],u=a[0].plannedElement;r.forEach((function(t,i){t.forEach((function(t,l){var a=i,d=0;l!=o.y&&0!=o.y||(a+=h?u.area.toX-u.area.fromX:0,d=h?u.area.toX-u.area.fromX:0),c[a]||(c[a]=[]);var m=r[i][l].plannedElement,g={plannedElement:_objectSpread(_objectSpread({},m),{},{area:{fromX:a,toX:m.area.toX+d,fromY:m.area.fromY,toY:m.area.toY}}),index:{x:a,y:l}};c[a][l]=g}))})),r=c}else o.x>l.startColIndex&&0==l.startRowIndex&&(o.x-=l.endColIndex-l.startColIndex),a=this.createNewCells(i,o.x,o.y,!1);for(var d=0;d<a.length;d++)r[a[d].index.x]||(r[a[d].index.x]=[]),r[a[d].index.x][a[d].index.y]=a[d];this.plannerElements.set(t,i),this.generalPlanningState.grids[0].matrix=r}}},{key:"addElementAsCopy",value:function addElementAsCopy(t,o,i){var l=this.getCellsInGridByElementId(t),r=l.cells[0].plannedElement.area,a={x:r.fromX,y:r.fromY};i.x>0?a.x=r.toX-1+i.x:i.x<0?a.x=r.fromX-(r.toX-r.fromX):i.y>0&&(a.y=r.toY-1+i.y);var h=-1==i.z||1==l.backside;a.x<0&&(a.x=0);for(var c=h?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u=this.createNewCells(o,a.x,a.y,h),d=0;d<u.length;d++)c[u[d].index.x]||(c[u[d].index.x]=[]),c[u[d].index.x][u[d].index.y]=u[d];this.plannerElements.set(o.getElementId(),o)}},{key:"deleteElement",value:function deleteElement(t,o){this.plannerElements.has(t)||P.error(new d.GE("Try to delete an elementId that does not exist"));this.getCellsInGridByElementId(t);k.Z.removeDockingPointRelations(this.plannerElements.get(t)),this.deleteElementByIdFromGrid(t),this.plannerElements.delete(t),this.hasActiveBackside}},{key:"updateGridElementDimensions",value:function updateGridElementDimensions(t,o){var i=this;if(!o)return!1;var l=structuredClone(this.generalPlanningState),r=this.getCellsInGridByElementId(t),a=this.gridSetupParams.forceSingleCellPerElement,h={x:r.cells[0].plannedElement.area.toX,y:r.cells[0].plannedElement.area.toY},c={x:0,y:0};r.cells.forEach((function(t){if(t.plannedElement){var l=t.plannedElement;l.size.width=o.width,l.size.height=o.height,l.size.depth=o.depth,l.area={fromX:l.area.fromX,toX:a?t.index.x+1:Math.round(l.area.fromX+o.width/i.gridSetupParams.fixCellRasterWidth),fromY:l.area.fromY,toY:a?t.index.y+1:Math.round(l.area.fromY+o.height/i.gridSetupParams.fixCellRasterHeight)},c.y=t.plannedElement.area.toY-h.y,c.x=t.plannedElement.area.toX-h.x}}));var u=r.cells[0],d=this.generalPlanningState.grids[0].matrix;if(0!=c.y)for(var m=u.plannedElement.area.fromX;m<u.plannedElement.area.toX;m++){var g=d[m];if(g)for(var E=h.y;E<g.length;E++){var I=g[E];I.index.y==E&&I.plannedElement.elementId!=u.plannedElement.elementId&&(I.index.y+=c.y,I.plannedElement.area.fromY+=c.y,I.plannedElement.area.toY+=c.y)}}else if(0!=c.x)for(var p=u.plannedElement.area.fromX;p<d.length;p++)for(var O=u.plannedElement.area.fromY;O<u.plannedElement.area.toY;O++){var R=d[p][O];R&&R.plannedElement.elementId!=t&&(R.index.x+=c.x,R.plannedElement.area.fromX+=c.x,R.plannedElement.area.toX+=c.x)}if(a)return!1;r.cells[0].plannedElement;for(var k,P=new Array,v=this.getAllUsedCellsInGrid(!1),T=function _loop3(){var t=v[V],r=t.plannedElement.area;if(P.find((function(o){return o.find((function(o){var i,l;return(null==o||null===(i=o.plannedElement)||void 0===i?void 0:i.elementId)==(null===(l=t.plannedElement)||void 0===l?void 0:l.elementId)}))})))return 0;for(var a=r.fromX;a<r.toX;a++)for(var h=r.fromY;h<r.toY;h++){P[a]||0!=r.fromY||(P[a]=[]);var c=v.find((function(o){return o.plannedElement.area.toX>=t.plannedElement.area.toX&&o.plannedElement.area.toY==t.index.y}));if(!c&&!P[a])return i.generalPlanningState=l,{v:!0};if(!P[a]&&!c)return i.generalPlanningState=l,{v:!0};P[a]||(P[a]=[]),P[a][h]=_objectSpread(_objectSpread({},t),{},{index:{x:a,y:h},plannedElement:_objectSpread(_objectSpread({},t.plannedElement),{},{area:{fromX:t.plannedElement.area.fromX,toX:t.plannedElement.area.fromX+(t.plannedElement.area.toX-t.plannedElement.area.fromX),fromY:t.plannedElement.area.fromY,toY:t.plannedElement.area.fromY+(t.plannedElement.area.toY-t.plannedElement.area.fromY)},size:_objectSpread(_objectSpread({},t.plannedElement.size),{},{depth:o.depth})})})}},V=0;V<v.length;V++)if(0!==(k=T())&&k)return k.v;return r.backside?this.generalPlanningState.grids[1].matrix=P:this.generalPlanningState.grids[0].matrix=P,!1}},{key:"updateWorldPosOfElements",value:function updateWorldPosOfElements(){var t,o,i,l=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.values());try{for(l.s();!(i=l.n()).done;){var r=i.value;k.Z.removeDockingPointRelations(r)}}catch(t){l.e(t)}finally{l.f()}for(var a=1,h=[],c=this.generalPlanningState.grids[0].matrix,u=null!==(t=null===(o=this.generalPlanningState.grids[1])||void 0===o?void 0:o.matrix)&&void 0!==t?t:[],m=0;m<c.length;m++)for(var g=0;g<c[m].length;g++){var E,I=c[m][g],p=null==I||null===(E=I.plannedElement)||void 0===E?void 0:E.elementId;if(p&&-1==h.indexOf(p)){var O=this.plannerElements.get(p);h.push(p);var R=this.getNeighborElements(p,"TOP"),v=this.getNeighborElements(p,"RIGHT"),T=this.getNeighborElements(p,"LEFT"),V=this.getNeighborElements(p,"DOWN");R.length>0&&k.Z.tryDockElement(O,"AVO",[R[0]]),T.length>0&&k.Z.tryDockElement(O,"AVL",[T[0]]),v.length>0&&k.Z.tryDockElement(O,"AVR",[v[0]]),V.length>0&&k.Z.tryDockElement(O,"AVU",[V[0]]),O.PosNr=a,a++}}for(var _=0;_<u.length;_++)for(var B=0;B<u[_].length;B++){var C,x=u[_][B],b=null==x||null===(C=x.plannedElement)||void 0===C?void 0:C.elementId;if(b&&-1==h.indexOf(b)){var y=this.plannerElements.get(b);h.push(b);var H=c[_][B],G=this.plannerElements.get(H.plannedElement.elementId);if(G){var D=null==G?void 0:G.getDockingPointById("AVO_AVO_2_IL");D?y&&k.Z.tryDockElementToDP(y,G,D):P.error(new d.GE("Error Loading DockingPoint AVO_2 for plannerElement"))}var L=this.getNeighborElements(b,"TOP"),A=this.getNeighborElements(b,"RIGHT");L.length>0&&k.Z.tryDockElement(y,"AVO",[L[0]]),A.length>0&&k.Z.tryDockElement(y,"AVL",[A[0]]),y.PosNr=a,a++}}}},{key:"destroyBoxPlannerGrid",value:function destroyBoxPlannerGrid(){var t,o=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.values());try{for(o.s();!(t=o.n()).done;){t.value.destroy()}}catch(t){o.e(t)}finally{o.f()}this.plannerElements.clear(),this.generalPlanningState.grids[0].matrix=[],this.hasActiveBackside&&(this.hasActiveBackside=!1,this.generalPlanningState.grids[1].matrix=[])}},{key:"destroyBacksideModuleGrid",value:function destroyBacksideModuleGrid(){this.hasActiveBackside=!1;var t,o=this.getAllElementsInBackGrid(),i=BoxPlannerGrid_createForOfIteratorHelper(o.values());try{for(i.s();!(t=i.n()).done;){var l=t.value;this.plannerElements.delete(l.ElementId),l.destroy()}}catch(t){i.e(t)}finally{i.f()}o=[],this.generalPlanningState.grids[1].matrix=[]}},{key:"getPlannerHasActiveBackside",value:function getPlannerHasActiveBackside(){return this.hasActiveBackside}},{key:"getForceSingleCellPerElement",value:function getForceSingleCellPerElement(){return this.gridSetupParams.forceSingleCellPerElement}},{key:"getBoundingBox",value:function getBoundingBox(){var t,o,i=this.generalPlanningState.grids[0].matrix,l=null==i||null===(t=i[0])||void 0===t||null===(t=t[0])||void 0===t?void 0:t.plannedElement,r=0,a=0,h=0,c=0,u=0,d=l?l.size.depth:0,m=0;o="RIGHT";for(var g=[],E=0;E<i.length;E++){var I,p=i[E][0];if(!p)break;var O=null===(I=p.plannedElement)||void 0===I?void 0:I.elementId;if(O&&-1==g.indexOf(O)){g.push(O);var R=this.plannerElements.get(O);if(!R)continue;var k=this.getValueOfOptionOfArticle(O,"OPTELEMENT");"RIGHT"==o?c+=R.getWidth():"FRONT"==o?d+=R.getWidth():"LEFT"==o?c-=R.getWidth():"BACK"==o&&(d-=R.getWidth()),"OPVECK_I"==k?"RIGHT"==o?o="FRONT":"FRONT"==o?o="LEFT":"LEFT"==o?o="BACK":"BACK"==o&&(o="RIGHT"):"OPVECK_A"==k&&("RIGHT"==o?o="BACK":"FRONT"==o?o="RIGHT":"LEFT"==o?o="FRONT":"BACK"==o&&(o="LEFT")),c<a&&(a=c),c>h&&(h=c),d<u&&(u=d),d>m&&(m=d);var P=this.getGridColumnHeight(E);r=r<P?P:r}}var v=m-u,T=h-a;return this.hasActiveBackside&&(v=2*d),{width:Math.round(1e3*T)/1e3,height:Math.round(1e3*r)/1e3,depth:Math.round(1e3*v)/1e3}}},{key:"getFreeMoveLocation",value:function getFreeMoveLocation(t){var o=this.getElementById(t);if(!o)return[];var i=this.getCellsInGridByElementId(t);if(0===i.cells.length)return[];var l,r=[],a=function isEmptyCell(t,o){var i;return void 0===(null===(i=h[t])||void 0===i?void 0:i[o])},h=i.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,c=BoxPlannerGrid_createForOfIteratorHelper(this.plannerElements.keys());try{for(c.s();!(l=c.n()).done;){var u=l.value;if(u!=t){var d=this.getElementById(u);if(this.gridSetupParams.forceSingleCellPerElement){if(!this.getElementHasTopElement(u)&&d.getWidth()==o.getWidth()){var m=this.getCellsInGridByElementId(u),g=this.getAllElementsInRow(m.endRowIndex+1,m.backside);if(g.length>0&&g[0].getHeight()!=o.getHeight())continue;var E=this.createLocationInformation(o,i.backside,this.createEmptyCells(m.cells[0].plannedElement.area.fromX,m.cells[0].plannedElement.area.toX,m.cells[0].plannedElement.area.fromY,m.cells[0].plannedElement.area.toY+1,o.getWidth(),o.getHeight()),m.cells[0].plannedElement.area.fromX,m.cells[0].plannedElement.area.toX,1,1);r.push(E)}}else for(var I=this.getCellsInGridByElementId(u),p=-1,O=-1,R=I.cells[0].plannedElement.area.toY+1,k=I.startColIndex;k<=I.startColIndex+I.colCount-1;k++){var P=!1;if(a(k,R)){if(-1==p?(p=k,O=k):O=k,k==I.startColIndex+I.colCount-1)if(i.colCount<=O-p+1)P=!0;else{P=!0;for(var v=0;v<i.colCount;v++)if(a(p+v,I.endRowIndex)){P=!1;break}}}else i.colCount<=O-p+1&&(P=!0);if(P){var T=this.createLocationInformation(o,i.backside,this.createEmptyCells(p,I.endRowIndex+1,p+i.colCount-1,I.endRowIndex+i.rowCount-1,o.getWidth(),o.getHeight()),p,I.endRowIndex+1,i.colCount,i.rowCount);r.push(T)}}}}}catch(t){c.e(t)}finally{c.f()}var V=this.createLocationInformation(o,i.backside,this.createEmptyCells(-i.colCount,0,-1,i.rowCount-1,o.getWidth(),o.getHeight()),-i.colCount,0,i.colCount,i.rowCount);r.push(V);var _=this.createLocationInformation(o,i.backside,this.createEmptyCells(this.getColumnCount(),0,this.getColumnCount()+i.colCount-1,i.rowCount-1,o.getWidth(),o.getHeight()),this.getColumnCount(),0,i.colCount,i.rowCount);return r.push(_),r}},{key:"getFreePlanningLocation",value:function getFreePlanningLocation(t,o){var i=this.getElementById(t);if(i){var l=this.getCellsInGridByElementId(t);if(0!==l.cells.length){var r=l.backside?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,a=l.startColIndex,h=l.endColIndex,c=l.startRowIndex,u=l.endRowIndex,d=-1,m=-1,g=-1,E=-1,I=[],p=function isValidCell(t,o){var i;return void 0===(null===(i=r[t])||void 0===i?void 0:i[o])};switch(o){case"LEFT":for(var O=a-1,R=!1,k=c;k<=u;k++)if(p(O,k)){m=k,R=!0;break}if(!R)return;R=!1;for(var P=a-1;P>=a-l.colCount&&(p(P,m)&&(0==m||!p(P,m-1)));P--)R=!0,d=P;if(!R)return;g=a-1,E=u,I=this.createEmptyCells(d,m,g,E,i.getWidth(),i.getHeight());break;case"TOP":for(var v=u+1,T=!1,V=h;V>=a;V--)p(V,v)&&(d=V,T=!0);if(!T)return;m=v,g=h,E=v+l.rowCount-1,I=this.createEmptyCells(d,m,g,E,i.getWidth(),i.getHeight());break;case"RIGHT":for(var _=h,B=!1,C=c;C<=u;C++)if(p(_,C)){m=C,B=!0;break}if(!B)return;B=!1;for(var x=h;x<=h+l.colCount&&(p(x,m)&&(0==m||!p(x,m-1)));x++)g=x,B=!0;if(!B)return;d=h,E=u,I=this.createEmptyCells(d,m,g,E,i.getWidth(),i.getHeight());break;default:return}return this.createLocationInformation(i,l.backside,I,d,m,g-d+1,E-m+1)}}}},{key:"createLocationInformation",value:function createLocationInformation(t,o,i,l,r,a,h){var c=o?this.generalPlanningState.grids[1].matrix:this.generalPlanningState.grids[0].matrix,u={cells:i,widthPerCell:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterWidth:t.getWidth(),heightPerCell:this.gridSetupParams.forceFixCellRasterSize?this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depthPerCell:t.getDepth(),width:this.gridSetupParams.forceFixCellRasterSize?a*this.gridSetupParams.fixCellRasterWidth:t.getWidth(),height:this.gridSetupParams.forceFixCellRasterSize?h*this.gridSetupParams.fixCellRasterHeight:t.getHeight(),depth:t.getDepth(),startIndexWorldPos:new R.FM(0,0)};if(this.gridSetupParams.forceFixCellRasterSize)u.startIndexWorldPos=new R.FM(l*this.gridSetupParams.fixCellRasterWidth,r*this.gridSetupParams.fixCellRasterHeight);else{for(var d=0,m=0;m<l;m++){var g,E;d+=null!==(g=null===(E=c[m][0].plannedElement)||void 0===E?void 0:E.size.width)&&void 0!==g?g:0}l<0&&(d=-t.getWidth());var I=0;for(m=0;m<r;m++){var p,O;I+=null!==(p=null===(O=c[l][m].plannedElement)||void 0===O?void 0:O.size.width)&&void 0!==p?p:0}u.startIndexWorldPos=new R.FM(d,I)}return u}},{key:"getPlannerInteractionInformation",value:function getPlannerInteractionInformation(){for(var t=this.getAllElementsInGridSortedbyGridPos(),o={boxPlannerInteractionInformationPerElement:new Map},i=0;i<t.length;i++){var l=t[i],r=this.getCellsInGridByElementId(l.getElementId()),a=r.cells[0].plannedElement.area,h=this.createLocationInformation(l,r.backside,r.cells,a.fromX,a.toX,a.fromY,a.toY),c=this.getFreePlanningLocation(l.getElementId(),"LEFT"),u=this.getFreePlanningLocation(l.getElementId(),"RIGHT"),d=this.getFreePlanningLocation(l.getElementId(),"TOP"),m=this.getElementHasTopElement(l.getElementId()),g=[];!m&&t.length>1&&(g=this.getFreeMoveLocation(l.getElementId()));var E={location:h,isDeletable:!m&&t.length>1,availablePlanningLocations:{availableBoxPlannerCellsLeft:c,availableBoxPlannerCellsTop:d,availableBoxPlannerCellsRight:u},availableMovingLocations:g};o.boxPlannerInteractionInformationPerElement.set(l.getElementId(),E)}return o}},{key:"getGeneralPlanningState",value:function getGeneralPlanningState(){var t,o,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=arguments.length>1?arguments[1]:void 0;if(!i||!l)return this.generalPlanningState;var r=this.generalPlanningState.grids[0].matrix,a=[],h=r.length,c=0;r.forEach((function(t){t.length>c&&(c=t.length)}));Array.from(this.plannerElements.values()).map((function(t){return{basketId:t.getBasketId(),elementId:t.getElementId(),articleCodex:t.getArticleCodex(),size:{width:t.getWidth(),height:t.getHeight(),depth:t.getDepth()},area:{fromX:void 0,toX:void 0,fromY:void 0,toY:void 0}}}));var u=!1,d=void 0,g=void 0;if(l){var E=this.getCellsInGridByElementId(l);d={articleCodex:(g=E.cells[0].plannedElement).articleCodex,elementId:g.elementId,gridSpace:{rows:g.area.toY-g.area.fromY+1,colums:g.area.toX-g.area.fromX+1},area:g.area,size:g.size,rules:[]},u=!!r.find((function(t,o){return o>=g.area.fromX&&o<g.area.toX&&r[o].length>g.area.toY})),0==g.area.fromX&&this.getNeighborElements(g.elementId,"LEFT").length>0&&this.getNeighborElements(g.elementId,"RIGHT").length>0&&(u=!0)}if(u)return this.generalPlanningState;for(var I=0;I<h;I++){var p=0==g.area.fromX?I:I+1;a[p]||r[I]&&(a[p]=(0,m.Z)(r[I]));for(var O=0;O<c;O++)if(r[I].length>O&&r[I][O]){a[p][O].plannedElement;a[p][O]=_objectSpread({},r[I][O])}}var R=0==g.area.fromX?g.area.fromX:g.area.fromX+1,k=0==g.area.fromX?g.area.toX:g.area.toX+1;a.forEach((function(t,o){if(!(o>=R&&o<k)){var i=a[o],l=i.length,r=0==g.area.fromX?o:o-1;i[l]={index:{x:r,y:l}}}}));var P=a.length;return(null===(t=g)||void 0===t?void 0:t.area.toX)!=r.length&&(a[P]=[{index:{x:0==g.area.fromX?P:P-1,y:0}}]),0!=(null===(o=g)||void 0===o?void 0:o.area.fromX)&&(a[0]=[{index:{x:-1,y:0}}]),_objectSpread(_objectSpread({},this.generalPlanningState),{},{selectedElement:d,grids:[_objectSpread(_objectSpread({},this.generalPlanningState.grids[0]),{},{matrix:a})]})}},{key:"getRowSizes",value:function getRowSizes(t,o){if(this.getForceSingleCellPerElement()){for(var i=t[0].length,l=Array(i).fill(-1),r=function _loop4(i){var r,a=null===(r=t.find((function(t){var o,l;return void 0!==(null===(o=t[i].plannedElement)||void 0===o?void 0:o.size.height)&&-1!=(null===(l=t[i].plannedElement)||void 0===l?void 0:l.size.height)})))||void 0===r?void 0:r[i];if(null!=a&&a.plannedElement?l[i]=a.plannedElement.size.height:o&&(l[i]=o.size.height),-1===l[i])return 1},a=0;a<i&&!r(a);a++);return l.includes(-1)&&P.error(new Error("Column sizes are not set")),l}return 15}},{key:"getColumnSizes",value:function getColumnSizes(t,o){if(this.getForceSingleCellPerElement()){for(var i=t.length,l=Array(i).fill(-1),r=0;r<i;r++){var a=t[r].find((function(t){return t.plannedElement}));if(null!=a&&a.plannedElement?l[r]=a.plannedElement.size.width:o&&(l[r]=o.size.width),!l.includes(-1))break}if(l.includes(-1))throw new Error("Row sizes are not set");return l}return 15}},{key:"addFreeCellsToMatrix",value:function addFreeCellsToMatrix(t,o,i){o.forEach((function(o){var i=o.index.x,l=o.index.y,r=t.find((function(t){return t.find((function(t){return t.index.x===i}))}));if(!r){for(var a=[],h=0;h<t[0].length;h++)a.push({index:new R.FM(i,h),plannedElement:void 0});t[0][0].index.x>i?t.unshift(a):t.push(a)}var c=t.find((function(t){return t.find((function(t){return t.index.y===l}))}));c||t.map((function(t){var o;return t.push({index:new R.FM((null===(o=t[0])||void 0===o?void 0:o.index.x)||0,l),plannedElement:void 0})}))})),i.push({type:"FixedPositon",grids:[{gridIndex:0,places:[{lowestX:Math.min.apply(Math,(0,m.Z)(o.map((function(t){return t.index.x})))),lowestY:Math.min.apply(Math,(0,m.Z)(o.map((function(t){return t.index.y}))))}]}]})}}])}(),T=i(24829),V=i(57312),_=i(58178),B=d.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),C=function(){function DivaBoxPlanner(t,o){(0,r.Z)(this,DivaBoxPlanner),(0,h.Z)(this,"set",void 0),(0,h.Z)(this,"plannerID",void 0),(0,h.Z)(this,"constructionRulesHandler",void 0),(0,h.Z)(this,"boxPlannerGrid",void 0),(0,h.Z)(this,"nextElementId",1),this.set=t,this.plannerID=o,this.constructionRulesHandler=new O(this.set.getValueOfOptionOfArticle,this.set.checkArticleHasOption,this.set.updateCfgValuesByPlanner);this.boxPlannerGrid=new v({hasMaxGridRasterHeight:!1,hasMaxGridRasterWidth:!1,forceSingleCellPerElement:!0,forceFixCellRasterSize:!1},this.set.getValueOfOptionOfArticle)}return(0,a.Z)(DivaBoxPlanner,[{key:"initPlanner",value:(E=(0,l.Z)(u().mark((function _callee(t){var o,i,l,r,a,h,c,m,g,E,I,p,O;return u().wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:if(null==(o=JSON.parse(d.ZP.decodeBase64(t))).v||2!=o.v){u.next=26;break}if(o.set&&o.set.elements&&0!=o.set.elements.length){u.next=4;break}return u.abrupt("return");case 4:i=o.set.elements,l=0;case 6:if(!(l<i.length)){u.next=21;break}return r=i[l],a=parseInt(r.elementID),h=new V.Z(this.set.getSetId(),r.basketID,a,DivaBoxPlanner.plannerType),this.nextElementId<a+1&&(this.nextElementId=a+1),this.set.setElementId(r.basketID,h.ElementId),this.constructionRulesHandler.getConstructionRulesLoaded()||((c=this.set.getConstructionRuleOfElementId(h.ElementId))&&(this.boxPlannerGrid.GridSetupParams={fixCellRasterHeight:19.2,fixCellRasterWidth:19.2,forceFixCellRasterSize:null===(m=c.constructionRules.forceFixCellRasterSize)||void 0===m||m,forceSingleCellPerElement:null===(g=c.constructionRules.forceSingleCellPerElement)||void 0===g||g,hasMaxGridRasterHeight:c.constructionRules.hasMaxGridRasterHeight,maxGridRasterHeight:c.constructionRules.maxGridRasterHeight,hasMaxGridRasterWidth:c.constructionRules.hasMaxGridRasterWidth,maxGridRasterWidth:c.constructionRules.maxGridRasterWidth}),this.constructionRulesHandler.setConstructionRules(c)),(E=this.set.getPlannerData(h.ElementId))&&h.updatePlannerData(E),u.next=17,T.Z.loadSVG(h,this.set);case 17:this.boxPlannerGrid.addElementAtGridPos(h,r.boxPlannerInfo.gridPosCol,r.boxPlannerInfo.gridPosRow,r.boxPlannerInfo.isOnBackside);case 18:l++,u.next=6;break;case 21:return this.boxPlannerGrid.updateWorldPosOfElements(),u.next=24,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 24:u.next=42;break;case 26:I=1,l=0;case 28:if(!(l<o.Elements.length)){u.next=38;break}return p=o.Elements[l],(a=parseInt(p.ID))>I&&(I=a),O={boxElementID:p.ID,boxCol:p.col,boxRow:p.row,boxUpdateWholePlanning:!1},u.next=35,this.addPlannerElement(p.BasketID,O);case 35:l++,u.next=28;break;case 38:return this.nextElementId=I+1,this.boxPlannerGrid.updateWorldPosOfElements(),u.next=42,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 42:return u.abrupt("return",o);case 43:case"end":return u.stop()}}),_callee,this)}))),function initPlanner(t){return E.apply(this,arguments)})},{key:"saveSetPlanner",value:function saveSetPlanner(){for(var t=[],o=this.boxPlannerGrid.getAllElementIdsInGrid(),i=0;i<o.length;i++){var l=this.boxPlannerGrid.getElementById(o[i]);if(l){for(var r=this.boxPlannerGrid.getCellsInGridByElementId(o[i]),a=l.getDockingDockingPoints(),h=[],c=0;c<a.length;c++){var u,d={id:a[c].DpId,onID:a[c].OnElementId,onDPID:null===(u=a[c].OnDP)||void 0===u?void 0:u.DpId};h.push(d)}var m={elementID:l.getElementId(),basketID:this.set.getBasketId(l.getElementId()),CatalogCodex:this.set.getCatalogCodex(),Codex:this.set.getArticleCodex(l.getElementId()),posNr:l.PosNr,x:l.WorldPosCenter.x,y:l.WorldPosCenter.y,z:l.WorldPosCenter.z,rot:l.RotDeg,width:l.Width?l.Width:-1,height:l.Height?l.Height:-1,depth:l.Depth?l.Depth:-1,DP:h,boxPlannerInfo:{gridPosCol:r.startColIndex,gridPosRow:r.startRowIndex,isOnBackside:r.backside}};t.push(m)}}var g=this.boxPlannerGrid.getBoundingBox();return{setId:this.set.getSetId(),x:0,y:0,z:0,width:g.width,height:g.height,depth:g.depth,rot:0,elements:t}}},{key:"addPlannerElement",value:(g=(0,l.Z)(u().mark((function _callee2(t,o){var i,l,r,a,h;return u().wrap((function _callee2$(c){for(;;)switch(c.prev=c.next){case 0:if(null!=o&&null!=o.boxElementID&&null!=o.boxCol&&null!=o.boxRow){c.next=2;break}return c.abrupt("return");case 2:return i=new V.Z(this.set.getSetId(),t,o.boxElementID,DivaBoxPlanner.plannerType),this.nextElementId=isNaN(o.boxElementID)?this.nextElementId:o.boxElementID+1,this.set.setElementId(t,i.ElementId),l=this.set.getPlannerData(i.ElementId),i.updatePlannerData(l),c.next=9,T.Z.loadSVG(i,this.set);case 9:if(this.constructionRulesHandler.getConstructionRulesLoaded()||(r=this.set.getConstructionRuleOfElementId(i.ElementId))&&(this.boxPlannerGrid.GridSetupParams={fixCellRasterHeight:19.2,fixCellRasterWidth:19.2,forceFixCellRasterSize:null===(a=r.constructionRules.forceFixCellRasterSize)||void 0===a||a,forceSingleCellPerElement:null===(h=r.constructionRules.forceSingleCellPerElement)||void 0===h||h,hasMaxGridRasterHeight:r.constructionRules.hasMaxGridRasterHeight,maxGridRasterHeight:r.constructionRules.maxGridRasterHeight,hasMaxGridRasterWidth:r.constructionRules.hasMaxGridRasterWidth,maxGridRasterWidth:r.constructionRules.maxGridRasterWidth},this.constructionRulesHandler.setConstructionRules(r)),this.boxPlannerGrid.addElementAtGridPos(i,o.boxCol,o.boxRow,null!=o.backside&&o.backside),!o.boxUpdateWholePlanning){c.next=15;break}return this.boxPlannerGrid.updateWorldPosOfElements(),c.next=15,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 15:case"end":return c.stop()}}),_callee2,this)}))),function addPlannerElement(t,o){return g.apply(this,arguments)})},{key:"extendPlanner",value:(m=(0,l.Z)(u().mark((function _callee3(t,o){return u().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,o){return m.apply(this,arguments)})},{key:"movePlannerElement",value:(c=(0,l.Z)(u().mark((function _callee4(t,o){return u().wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:return this.boxPlannerGrid.moveElementAsCopy(t,o),this.boxPlannerGrid.updateWorldPosOfElements(),i.next=4,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,"",[t]);case 4:case"end":return i.stop()}}),_callee4,this)}))),function movePlannerElement(t,o){return c.apply(this,arguments)})},{key:"copyPlannerElement",value:(i=(0,l.Z)(u().mark((function _callee5(t,o){var i,l,r,a,h,c=this;return u().wrap((function _callee5$(u){for(;;)switch(u.prev=u.next){case 0:if(o){u.next=3;break}return u.abrupt("return");case 3:"STD"==o.copyType&&(o.targetElements=[]),i=[],l=this,t.forEach((function(t){var l;-1==o.copyIndex.z?c.boxPlannerGrid.getPlannerHasActiveBackside()||c.boxPlannerGrid.prepareGridForBackSideCopy():c.boxPlannerGrid.prepareGridForColCopy(t.key,o.copyIndex);var r=new V.Z(c.set.getSetId(),t.value,c.nextElementId,DivaBoxPlanner.plannerType);c.nextElementId++,c.set.setElementId(t.value,r.ElementId);var a=c.set.getPlannerData(r.ElementId);r.updatePlannerData(a),c.boxPlannerGrid.addElementAsCopy(t.key,r,o.copyIndex),c.constructionRulesHandler.onElementCopy(t.key,r.getElementId()),i.push(r),"STD"==o.copyType&&(null===(l=o.targetElements)||void 0===l||l.push(r.getElementId()))})),r=0;case 8:if(!(r<i.length)){u.next=15;break}return u.next=11,T.Z.loadSVG(i[r],this.set);case 11:if(1==o.copyIndex.y&&this.constructionRulesHandler.getHasMaxElemCountPerColumn()&&this.boxPlannerGrid.getCellsInGridByElementId(i[r].ElementId).endRowIndex==l.constructionRulesHandler.getMaxElemCountPerColumn())for(a=i[r].getFreeDockingPointsByType("AVO"),h=0;h<a.length;h++)a[h].disableDP(!0);case 12:r++,u.next=8;break;case 15:return this.boxPlannerGrid.updateWorldPosOfElements(),u.next=18,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,o.changedOPT,o.targetElements);case 18:case"end":return u.stop()}}),_callee5,this)}))),function copyPlannerElement(t,o){return i.apply(this,arguments)})},{key:"initIDM3DMeta",value:function initIDM3DMeta(t){B.debug("No IDM3D Planner for BoxPlanner")}},{key:"getPlannerElementsInfluencedByDeletion",value:function getPlannerElementsInfluencedByDeletion(t,o){if(this.constructionRulesHandler.getForceWholePlanningSameHeight())return 0==this.boxPlannerGrid.getCellsInGridByElementId(t).startRowIndex?[]:this.boxPlannerGrid.getAllElementsInSameRowByElementId(t).elementIds.filter((function(o){return o!=t}));if(this.boxPlannerGrid.getPlannerHasActiveBackside()){if("BoxPlanner_backside"==o)return this.boxPlannerGrid.getAllElementsInBackGrid().map((function(t){return t.ElementId})).filter((function(o){return o!=t}));var i=this.boxPlannerGrid.getOppositeElement(t);if(i)return[i.getElementId()]}return[]}},{key:"getPlannerElementsInfluencedByCopy",value:function getPlannerElementsInfluencedByCopy(t,o){var i=[];if(o&&-1==o.copyIndex.z)return this.boxPlannerGrid.getAllElementIdsInGrid();if(o&&"BoxPlanner_COL"==o.copyType){for(var l=this.boxPlannerGrid.getCellsInGridByElementId(t),r=this.boxPlannerGrid.getAllElementsInColumn(l.startColIndex,l.backside),a=0;a<r.length;a++)i.push(r[a].getElementId());return i}if(i.push(t),o){if(0!=o.copyIndex.x)if(this.constructionRulesHandler.getForceWholePlanningSameHeight()){var h=this.boxPlannerGrid.getAllElementsInSameCol(t);i=h.elements,h.backside}else{var c=this.boxPlannerGrid.getAllElementsToFillUp(t,o.copyIndex.x>0?"RIGHT":"LEFT");i=c.elements,c.backside}if(0!=o.copyIndex.y&&this.constructionRulesHandler.getForceWholePlanningSameHeight()){var u=this.boxPlannerGrid.getAllElementsInSameRowByElementId(t);i=u.elementIds,u.backside}this.boxPlannerGrid.getPlannerHasActiveBackside()&&(i=i.concat(this.boxPlannerGrid.getOppositeElements(i).map((function(t){return t.ElementId}))))}return i}},{key:"deletePlannerElement",value:(o=(0,l.Z)(u().mark((function _callee6(t,o,i){var l,r,a,h;return u().wrap((function _callee6$(o){for(;;)switch(o.prev=o.next){case 0:if(l=this.boxPlannerGrid.getCellsInGridByElementId(t),r={row:l.startRowIndex,col:l.startColIndex,backside:!1},i&&"BoxPlanner_backside"==i?r={row:0,col:0,backside:!1}:l.startRowIndex>0?r.row--:(r.col=0==l.startColIndex?0:l.startColIndex-1,r.row=this.boxPlannerGrid.getRowCount(r.col,l.backside)-1),this.boxPlannerGrid.deleteElement(t,i),this.constructionRulesHandler.onElemDeleted(t),a=!0,i&&("BoxPlanner_backside"==i?(this.boxPlannerGrid.destroyBacksideModuleGrid(),a=!0):"STD_DONTUPDATE"==i&&(a=!1)),!a){o.next=11;break}return this.boxPlannerGrid.updateWorldPosOfElements(),o.next=11,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid);case 11:if(!this.boxPlannerGrid.getPlannerElementAtGridPos(r.col,r.row,r.backside)){o.next=13;break}return o.abrupt("return",{newElementToSelect:null===(h=this.boxPlannerGrid.getPlannerElementAtGridPos(r.col,r.row,r.backside))||void 0===h?void 0:h.getElementId()});case 13:return o.abrupt("return",{});case 14:case"end":return o.stop()}}),_callee6,this)}))),function deletePlannerElement(t,i,l){return o.apply(this,arguments)})},{key:"getAllViewPlannerElements",value:function getAllViewPlannerElements(){return this.boxPlannerGrid.getAllElementsInGridSortedbyGridPos()}},{key:"getNeighborElements",value:function getNeighborElements(t,o){var i=this.boxPlannerGrid.getElementById(t);if(!i)return[];var l=null==i?void 0:i.getDockingDockingPointsByType(o);if(!l)return[];for(var r=[],a=0;a<(null==l?void 0:l.length);a++)null!=l[a]&&r.push(l[a].OnElementId);return r}},{key:"getFreeDockingPointsByElementId",value:function getFreeDockingPointsByElementId(t,o){return{dockingPoints:[],filter:[]}}},{key:"getDockedDockingPointsByElementId",value:function getDockedDockingPointsByElementId(t,o){return[]}},{key:"getDockedGroups",value:function getDockedGroups(){return[this.boxPlannerGrid.getAllElementIdsInGrid()]}},{key:"getBoundingBox",value:function getBoundingBox(){return B.warn("BoxPlanner - get2DViewPlannerBoundingBox not implemented yet","WC_0012"),new _.Z}},{key:"updatePlannerTrans",value:function updatePlannerTrans(t,o,i,l,r,a){return B.error(new d.GE("BoxPlanner - updatePlannerTrans not implemented yet",{code:"WC_0012"})),!1}},{key:"updatePlanner",value:(t=(0,l.Z)(u().mark((function _callee7(t,o){var i,l,r,a,h,c,d,m,g,E,I=this;return u().wrap((function _callee7$(u){for(;;)switch(u.prev=u.next){case 0:if(B.debug("BoxPlanner - configurationHasChanged "+t),i=!1,null==o||o.forEach((function(t){var o;i=I.boxPlannerGrid.updateGridElementDimensions(t,null===(o=I.set.getArticleByElementId(t))||void 0===o?void 0:o.plannerData)})),!i){u.next=5;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:"resizeerror",failed:!0});case 5:if(this.boxPlannerGrid.updateWorldPosOfElements(),!(t&&o&&o.length>0&&t.OPTELEMENT)||"OPVECK_I"!=t.OPTELEMENT&&"OPVECK_A"!=t.OPTELEMENT){u.next=23;break}if(!(o.length>1)){u.next=14;break}return u.next=10,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,o,!0);case 10:if(!(l=u.sent)){u.next=13;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:l,failed:!1});case 13:case 51:case 52:return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],failed:!1});case 14:if(r=this.boxPlannerGrid.getCellsInGridByElementId(o[0]),a=o[0],r.startRowIndex>0&&(a=this.boxPlannerGrid.getPlannerElementAtGridPos(r.startColIndex,0,!1).getElementId()),this.boxPlannerGrid.getElementHasLeftElement(a)&&this.boxPlannerGrid.getElementHasRightElement(a)){u.next=23;break}return h={x:0,y:0,z:0},this.boxPlannerGrid.getElementHasLeftElement(a)||(h.x=-1),this.boxPlannerGrid.getElementHasRightElement(a)||(h.x=1),c=this.getPlannerElementsInfluencedByCopy(a,{copyIndex:h,copyType:"BoxPlanner_COL"}),u.abrupt("return",{failed:!1,doDeleteBackGrid:!1,elemIdsToDelete:[],elementIdToCopy:c,copyType:"BoxPlanner_COL",ignoreOptionsToCopy:["OPTELEMENT"],changedOPT:t,targetElements:o});case 23:if(!t||!t.OPTDMOD){u.next=38;break}u.t0=t.OPTDMOD,u.next="OPVD_EIN"===u.t0?27:"OPVD_AUS"===u.t0?31:36;break;case 27:if(this.boxPlannerGrid.getPlannerHasActiveBackside()){u.next=30;break}return d=this.getPlannerElementsInfluencedByCopy(-1,{copyIndex:{x:0,y:0,z:-1},copyType:"BoxPlanner_backside"}),u.abrupt("return",{failed:!1,doDeleteBackGrid:!1,elemIdsToDelete:[],elementIdToCopy:d,copyType:"BoxPlanner_backside",changedOPT:t});case 30:case 35:return u.abrupt("break",36);case 31:if(!this.boxPlannerGrid.getPlannerHasActiveBackside()){u.next=35;break}if(!((m=this.boxPlannerGrid.getAllElementsInBackGrid()).length>0)){u.next=35;break}return u.abrupt("return",{failed:!1,doDeleteBackGrid:!0,elemIdsToDelete:m.map((function(t){return t.ElementId})),deletionType:"BoxPlanner_backside",changedOPT:t});case 36:case 42:u.next=52;break;case 38:if(!(t&&t.OPTFARBE_RAHMEN&&"OPVSCHWARZ_MATT"==t.OPTFARBE_RAHMEN&&this.boxPlannerGrid.getPlannerHasActiveBackside())){u.next=44;break}if(!((g=this.boxPlannerGrid.getAllElementsInBackGrid()).length>0)){u.next=42;break}return u.abrupt("return",{failed:!1,doDeleteBackGrid:!0,elemIdsToDelete:g.map((function(t){return t.ElementId})),deletionType:"BoxPlanner_backside",changedOPT:t,targetElements:o,viewMessageCodex:"BOXPLAN_BLACKFRAME_INCOMPATIBLE_ELEMENT_WARNING"});case 44:return u.next=46,this.constructionRulesHandler.updateOptionLogicBoxPlanner(this.boxPlannerGrid,t,o);case 46:if(!(E=u.sent)){u.next=51;break}return u.abrupt("return",{doDeleteBackGrid:!1,elemIdsToDelete:[],viewMessageCodex:E,failed:!1});case 53:case"end":return u.stop()}}),_callee7,this)}))),function updatePlanner(o,i){return t.apply(this,arguments)})},{key:"getSetData",value:function getSetData(t,o,i,l){for(var r={ID:"S1",H:"",x:0,y:0,z:0,w:0,ELE:[],Blob:this.set.CatalogData.supplierILN,Cat:this.set.getCatalogCodex(),ShowDim:i},a=this.boxPlannerGrid.getAllElementsInGridSortedbyGridPos(),h=0;h<a.length;h++){var c=a[h],u=c.ElementId,m=this.set.getPlannerConfigData(u).config,g={ID:"E"+u,N:m.N,Model:m.Model,x:-c.WorldPosCenter.x,y:c.WorldPosCenter.y,z:c.WorldPosCenter.z,PosPivot:"Center",w:c.getRotDeg(),RotPivot:"Center",DP:c.getDockingPointJS3D(),MAT:m.MAT,CFG:m.CFG,H:""},E=(0,d.FB)(JSON.stringify(g));g.H=E,r.ELE.push(g)}E=(0,d.FB)(JSON.stringify(r));return r.H=E,{constructionSet:r}}},{key:"getPlannerId",value:function getPlannerId(){return this.plannerID}},{key:"getElementPosInfo",value:function getElementPosInfo(){B.error(new d.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 o=this.boxPlannerGrid.getAllElementIdsInGrid(),i=0;i<o.length;i++){var l=o[i],r=this.boxPlannerGrid.getElementById(l);r&&(r.SetPosNr=t+r.PosNr-1,this.set.setPosNr(r.ElementId,r.getPosNr()))}return o.length}},{key:"clonePlanner",value:function clonePlanner(t,o,i){var l=new DivaBoxPlanner(t,o);return l.initPlanner(i),l}},{key:"getPlannerInteractionInformation",value:function getPlannerInteractionInformation(){return this.boxPlannerGrid.getPlannerInteractionInformation()}},{key:"getGeneralPlanningState",value:function getGeneralPlanningState(t){return this.boxPlannerGrid.getGeneralPlanningState(!0,t)}}]);var t,o,i,c,m,g,E}();(0,h.Z)(C,"plannerType","BOX")}}]);
|