/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{property as o,subclass as r}from"../../../core/accessorSupport/decorators.js";import{ElementTemplateBase as s}from"./ElementTemplateBase.js";import{isFieldElementTemplate as i}from"./support/templateUtils.js";let l=class extends s{constructor(e){super(e),this.initialState="expanded",this.type="group"}initialize(){for(const e of this.elements)e.group=this}foldIn(e){const{elements:o}=this,r=e.elements;if(o.length!==r.length)throw new t("unable-to-fold-in","Unable to fold in the given GroupElementTemplate because it has a different number of child elements");for(const t of e.layers){this.addLayer(t,e.getExpressionExecutorsForLayer(t));for(let e=0;e<o.length;e++){const t=o.at(e),s=r.at(e);i(t)&&i(s)&&t.foldIn(s)}}}};e([o()],l.prototype,"initialState",void 0),e([o()],l.prototype,"elements",void 0),e([o()],l.prototype,"type",void 0),l=e([r("esri.widgets.BatchAttributeForm.templates.GroupElementTemplate")],l);export{l as GroupElementTemplate};
