import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";var isChromatic=function(t){const e=t||"undefined"!=typeof window&&window;return!(!e||!e.navigator.userAgent.match(/Chromatic/)&&!e.location.href.match(/chromatic=true/))};const vaLoadingIndicatorCss=":host{display:block;font-size:1.06rem;text-align:center}.loading-indicator{display:block;height:4rem;margin-top:1rem}.loading-indicator:after{content:' ';display:inline-block;width:2.1875rem;height:2.1875rem;margin:1px;border-radius:50%;border:8px solid var(--vads-color-primary);border-color:var(--vads-color-primary) transparent var(--vads-color-primary)\n    transparent;-webkit-animation:spin 1.5s linear infinite;animation:spin 1.5s linear infinite}.loading-indicator.chromatic:after{-webkit-animation:none;animation:none}.loading-indicator:focus{outline:none}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}",VaLoadingIndicatorStyle0=vaLoadingIndicatorCss,VaLoadingIndicator$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.loadingStartTime=null,this.observer=null,this.message=void 0,this.label="Loading",this.setFocus=!1,this.enableAnalytics=!1}componentDidLoad(){var t;this.setFocus&&this.spinner&&this.spinner.focus(),this.loadingStartTime=Date.now();const e=null===(t=this.el)||void 0===t?void 0:t.parentNode;e instanceof Node&&(this.observer=new MutationObserver(t=>{for(const i of t)if("childList"===i.type){const t=Array.from(i.removedNodes.values()).filter(t=>{var e;return"va-loading-indicator"===(null===(e=null==t?void 0:t.tagName)||void 0===e?void 0:e.toLowerCase())}).length>0;if(this.enableAnalytics&&t){const t=new CustomEvent("component-library-analytics",{bubbles:!0,composed:!0,detail:{componentName:"va-loading-indicator",action:"displayed",details:{displayTime:Date.now()-this.loadingStartTime,message:this.message}}});e.dispatchEvent(t)}}}),this.observer.observe(e,{childList:!0}))}render(){const{message:t,label:e}=this;let i="loading-indicator";return isChromatic()&&(i+=" chromatic"),h(Host,{key:"8a24109ab8b6b401627ad5249b5133b90871351e","aria-live":"polite"},h("div",{key:"696ffcdadd577100f66e376e52f9ca3ad27411b7",ref:t=>this.spinner=t,class:i,role:"progressbar","aria-label":e,"aria-valuetext":t,tabindex:"-1"}),t)}get el(){return this}static get style(){return VaLoadingIndicatorStyle0}},[1,"va-loading-indicator",{message:[1],label:[1],setFocus:[4,"set-focus"],enableAnalytics:[4,"enable-analytics"]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-loading-indicator"].forEach(t=>{"va-loading-indicator"===t&&(customElements.get(t)||customElements.define(t,VaLoadingIndicator$1))})}const VaLoadingIndicator=VaLoadingIndicator$1,defineCustomElement=defineCustomElement$1;export{VaLoadingIndicator,defineCustomElement};