/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{g as u}from"./CQMH7FNX.js";import{a as d}from"./ENDXE7YY.js";import{G as c,S as h,h as r,p as o}from"./PGOMURMZ.js";var b=[" ",`
`,"	","\r"],m=/[^\S\u00A0]+/g,a=class extends c{constructor(){super(...arguments),this.mutationObserver=d("mutation",()=>{this.ensureTextContentDependentProps(),this.calciteInternalOptionChange.emit()}),this.disabled=!1,this.calciteInternalOptionChange=o({cancelable:!1})}static{this.properties={disabled:[7,{},{reflect:!0,type:Boolean}],label:1,selected:[7,{},{reflect:!0,type:Boolean}],value:1}}connectedCallback(){super.connectedCallback(),this.ensureTextContentDependentProps(),this.mutationObserver?.observe(this.el,{attributeFilter:["label","value"],characterData:!0,childList:!0,subtree:!0})}willUpdate(e){e.has("disabled")&&(this.hasUpdated||this.disabled!==!1)&&this.handlePropChange(this.disabled,e.get("disabled"),"disabled"),e.has("label")&&this.handlePropChange(this.label,e.get("label"),"label"),e.has("selected")&&this.handlePropChange(this.selected,e.get("selected"),"selected"),e.has("value")&&this.handlePropChange(this.value,e.get("value"),"value")}disconnectedCallback(){super.disconnectedCallback(),this.mutationObserver?.disconnect()}handlePropChange(e,s,t){(t==="label"||t==="value")&&this.ensureTextContentDependentProps(),this.calciteInternalOptionChange.emit()}ensureTextContentDependentProps(){let{el:e,internallySetLabel:s,internallySetValue:t,label:p,value:i}=this,l=u(e.textContent,b).replaceAll(m," "),n=p;(!n||n===s)&&(this.label=l,this.internallySetLabel=l),(i==null||i===t)&&(this.value=l,this.internallySetValue=l)}render(){return r`<slot>${this.label}</slot>`}};h("calcite-option",a);export{a as Option};
