/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
function s(e){for(;e.lastChild;)e.removeChild(e.lastChild)}function l(e){e.removeNode?e.removeNode(!0):e.remove?e.remove():e.parentNode.removeChild(e)}var r=class{constructor(t={}){this._config=t;this._initialize()}get element(){return this._element}destroy(){this.disconnect()}disconnect(){this._element.isConnected&&l(this._element)}_initialize(){var t,n,i,o;if(this._element=this._build(),!this._element)throw new Error(`Invalid component instance: ${this._element}`);this._applyProps(),this._applyStyle(),this._applyAttrs(),(n=(t=this._config.options)==null?void 0:t.parent)==null||n.append(this._element),(i=this._config.options)!=null&&i.children&&this._applyChildren(),(o=this._configure)==null||o.call(this)}_applyProps(){this._config.props&&Object.assign(this._element,this._config.props)}_applyStyle(){var t,n;if((t=this._config.options)!=null&&t.style){let i=Object.keys(this._config.options.style);for(let o of i)(n=this._element)==null||n.style.setProperty(o,this._config.options.style[o])}}_applyAttrs(){var t,n;if((t=this._config.options)!=null&&t.attributes)if(this._config.options.attributes instanceof Map)for(let[i,o]of Array.from(this._config.options.attributes))this._element.setAttribute(i,o);else{let i=Object.keys(this._config.options.attributes);for(let o of i)(n=this._element)==null||n.setAttribute(o,this._config.options.attributes[o])}}_applyChildren(){var t;this._element.hasChildNodes()&&s(this._element),(t=this._config.options)!=null&&t.children&&(typeof this._config.options.children=="string"?this._element.innerHTML=this._config.options.children:this._element.appendChild(this._config.options.children))}};var c=class extends r{constructor(t){super(t)}};export{r as BaseComponentDelegate,c as FormFieldComponentDelegate};
//# sourceMappingURL=index.js.map
