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