/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import{byId as o}from"../../core/domUtils.js";import{property as s,cast as i,subclass as n}from"../../core/accessorSupport/decorators.js";function d(t){return t&&"nodeType"in t}function r(t){return t&&"function"==typeof t.render}const c={component:"esri-component"};let l=class extends e{constructor(){super(...arguments),this.widget=null}destroy(){this.node=null,this.widget?.destroy()}get id(){return this._get("id")??this.widget?.id??this.node?.id}set id(t){this._set("id",t)}set node(t){const e=this._get("node");t!==e&&(t&&t.classList.add(c.component),e&&e.classList.remove(c.component),this._set("node",t))}castNode(t){return this.widget?.destroy(),t?"string"==typeof t||d(t)?(this._set("widget",null),o(t)):(r(t)&&!t.domNode&&(t.domNode=document.createElement("div")),this._set("widget",t),t.domNode):(this._set("widget",null),null)}};t([s()],l.prototype,"id",null),t([s()],l.prototype,"node",null),t([i("node")],l.prototype,"castNode",null),t([s({readOnly:!0})],l.prototype,"widget",void 0),l=t([n("esri.views.ui.Component")],l);const p=l;export{p as default};
