import{r as t,c as s,h as i,g as e}from"./p-52e3bb32.js";import{r}from"./p-ffe5c0e8.js";const h=class{constructor(i){t(this,i),this.afOnChange=s(this,"afOnChange",7),this._observer=null,this._isObserving=!1,this.afId=r("digi-util-mutation-observer"),this.afOptions={attributes:!1,childList:!0,subtree:!1,characterData:!1}}afOptionsWatcher(t){this._afOptions="string"==typeof t?JSON.parse(t):t}componentWillLoad(){this.afOptionsWatcher(this.afOptions),this.initObserver()}disconnectedCallback(){this._isObserving&&this.removeObserver()}initObserver(){this._observer=new MutationObserver((t=>{for(const s of t)"childList"!==s.type&&"attributes"!==s.type&&"characterData"!==s.type||this.changeHandler(s)})),this._observer.observe(this.$el,this._afOptions),this._isObserving=!0}removeObserver(){this._observer.disconnect(),this._isObserving=!1}changeHandler(t){this.afOnChange.emit(t)}render(){i("div",{id:this.afId,ref:t=>this.$el=t},i("slot",null))}get $el(){return e(this)}static get watchers(){return{afOptions:["afOptionsWatcher"]}}};export{h as digi_util_mutation_observer}