const darkModeMediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),notForced=()=>!("colorSchemeOs"in document.documentElement.dataset),lightColor="rgba(255, 255, 255, 0.8)",darkColor="rgba(0, 0, 0, 0.8)",getColorScheme=()=>notForced()?darkModeMediaQuery.matches?darkColor:lightColor:"colorScheme"in document.documentElement.dataset?document.documentElement.dataset.colorScheme==="dark"?darkColor:lightColor:darkModeMediaQuery.matches?darkColor:lightColor;class JoomlaCoreLoader extends HTMLElement{get inline(){return this.hasAttribute("inline")}set inline(e){e!==null?this.setAttribute("inline",""):this.removeAttribute("inline")}get size(){return this.getAttribute("size")||"345"}set size(e){this.setAttribute("size",e)}get color(){return this.getAttribute("color")}set color(e){this.setAttribute("color",e)}static get observedAttributes(){return["color","size","inline"]}constructor(){super(),this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`
`,this.shadowRoot.appendChild(e.content.cloneNode(!0))}connectedCallback(){this.style.backgroundColor=this.color?this.color:getColorScheme(),darkModeMediaQuery.addEventListener("change",this.systemQuery),this.inline||this.classList.add("fullscreen")}disconnectedCallback(){darkModeMediaQuery.removeEventListener("change",this.systemQuery)}attributeChangedCallback(e,s,t){switch(e){case"color":t&&t!==s&&(this.style.backgroundColor=t);break;case"size":if(t&&t!==s){const i=this.shadowRoot.querySelector("svg");i.setAttribute("width",t),i.setAttribute("height",t)}break;case"inline":this.hasAttribute("inline")?this.classList.remove("fullscreen"):this.classList.add("fullscreen");break}}systemQuery(e){if(!notForced()||this.color)return;const s=e.matches===!0?darkColor:lightColor;this.style.backgroundColor!==s&&(this.style.backgroundColor=s)}}window.customElements.define("joomla-core-loader",JoomlaCoreLoader);