import{mutation_observer_styles_default as t}from"./chunk.YZHDFJWJ.js";import{watch as e}from"./chunk.C7FWPEOY.js";import{ShoelaceElement as a}from"./chunk.Z7XDKKOD.js";import{__decorateClass as r}from"./chunk.6M63UXML.js";import{html as i}from"../../../../lit/index.js";import{property as s}from"../../../../lit/decorators.js";var l=class extends a{constructor(){super(...arguments),this.attrOldValue=!1,this.charData=!1,this.charDataOldValue=!1,this.childList=!1,this.disabled=!1,this.handleMutation=t=>{this.emit("sl-mutation",{detail:{mutationList:t}})}}connectedCallback(){super.connectedCallback(),this.mutationObserver=new MutationObserver(this.handleMutation),this.disabled||this.startObserver()}disconnectedCallback(){this.stopObserver()}startObserver(){const t="string"==typeof this.attr&&this.attr.length>0,e=t&&"*"!==this.attr?this.attr.split(" "):void 0;try{this.mutationObserver.observe(this,{subtree:!0,childList:this.childList,attributes:t,attributeFilter:e,attributeOldValue:this.attrOldValue,characterData:this.charData,characterDataOldValue:this.charDataOldValue})}catch(t){}}stopObserver(){this.mutationObserver.disconnect()}handleDisabledChange(){this.disabled?this.stopObserver():this.startObserver()}handleChange(){this.stopObserver(),this.startObserver()}render(){return i` <slot></slot> `}};l.styles=t,r([s({reflect:!0})],l.prototype,"attr",2),r([s({attribute:"attr-old-value",type:Boolean,reflect:!0})],l.prototype,"attrOldValue",2),r([s({attribute:"char-data",type:Boolean,reflect:!0})],l.prototype,"charData",2),r([s({attribute:"char-data-old-value",type:Boolean,reflect:!0})],l.prototype,"charDataOldValue",2),r([s({attribute:"child-list",type:Boolean,reflect:!0})],l.prototype,"childList",2),r([s({type:Boolean,reflect:!0})],l.prototype,"disabled",2),r([e("disabled")],l.prototype,"handleDisabledChange",1),r([e("attr",{waitUntilFirstUpdate:!0}),e("attr-old-value",{waitUntilFirstUpdate:!0}),e("char-data",{waitUntilFirstUpdate:!0}),e("char-data-old-value",{waitUntilFirstUpdate:!0}),e("childList",{waitUntilFirstUpdate:!0})],l.prototype,"handleChange",1);export{l as SlMutationObserver};