import{r,h as e,H as t,g as i}from"./p-BdVwMG9u.js";import{_ as s,a as n}from"./p-dfXERft2.js";import{B as a}from"./p-ByiN-QjD.js";import{m as o,l as c}from"./p-Ba5qjFjW.js";import{L as l}from"./p-D7ovid3w.js";import{d as h}from"./p-CBkFUwrD.js";import{L as p}from"./p-B-L34nz8.js";import"./p-B1u-Mq75.js";import"./p-D7M-7v58.js";const d=class{constructor(e){r(this,e),this.animated=h.animated,this.inverted=!1,this.deactivated=!1,this.color="blue",this.small=!1,this.variation="logo",this.animate=async()=>{this.animated?(await this.load(),void 0!==this.currentRaf&&cancelAnimationFrame(this.currentRaf),this.shouldAnimate()&&(this.destroy(),this.currentRaf=o((async()=>{this.animationFunction&&this.animationFunction(this.el,this.getColor())})))):this.destroy()},this.destroy=()=>{this.animationItem&&this.animationItem.destroy&&this.animationItem.destroy(),this.el.innerHTML=""},this.shouldAnimate=()=>"logo"===this.variation&&"undefined"!=typeof window&&void 0!==this.animationFunction&&!this.deactivated,this.load=async()=>new Promise(((r,e)=>{if(this.animationFunction)return r();c((async()=>{import("./p-BHFw3KrT.js").then((e=>{this.animationFunction=e.animate,r()})).catch(e)}))}))}createLogger(r){this.log=r}deactivatedWatcher(r,e){r!==e&&(this.deactivated?this.destroy():this.animate())}variationWatcher(r,e){r!==e&&("circle"===this.variation?this.destroy():this.animate())}componentDidLoad(){"logo"===this.variation?this.animate():this.destroy()}disconnectedCallback(){this.el&&!this.el.isConnected&&this.destroy()}configChanged(r){this.animated=r.animated,!1===r.animated&&this.destroy()}getColor(){return this.inverted||"white"===this.color?"#ffffff":"#151f6d"}render(){const r=a.block("spinner");return e(t,{key:"bf00a08aaa12fd4a3473d6f277a62abe4537ee8f",class:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r.class()),r.modifier("circle").class("circle"===this.variation)),r.modifier("small").class(this.small)),r.modifier("animated").class(this.animated)),r.modifier(`color-${this.color}`).class("circle"===this.variation)),role:"progressbar","aria-hidden":"true"})}get el(){return i(this)}static get watchers(){return{deactivated:["deactivatedWatcher"],variation:["variationWatcher"]}}};s([l("bal-spinner"),n("design:type",Function),n("design:paramtypes",[Function]),n("design:returntype",void 0)],d.prototype,"createLogger",null),s([p(),n("design:type",Function),n("design:paramtypes",[Object]),n("design:returntype",void 0)],d.prototype,"configChanged",null),d.style=":root{--bal-spinner-circle-background:var(--bal-color-grey);--bal-spinner-circle-progress:var(--bal-color-primary);--bal-spinner-circle-background-inverted:var(--bal-color-white);--bal-spinner-circle-progress-inverted:var(--bal-color-primary)}bal-spinner,.bal-spinner{text-align:center;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-line-pack:center;align-content:center;width:4rem}bal-spinner svg,.bal-spinner svg{-webkit-transform:unset !important;transform:unset !important}.bal-spinner--small{width:2rem}.bal-spinner--circle{margin:auto;border-width:.25rem;border-style:solid;border-color:var(--bal-spinner-circle-background);border-radius:50%;border-top-color:var(--bal-spinner-circle-progress);width:1.5rem;height:1.5rem}.bal-spinner--circle.bal-spinner--small{width:1.125rem;height:1.125rem;border-width:.2rem}.bal-spinner--circle.bal-spinner--animated{-webkit-animation:spinner 1.6s linear infinite;animation:spinner 1.6s linear infinite}.bal-spinner--circle.bal-spinner--color-white{border-color:var(--bal-spinner-circle-background-inverted);border-top-color:var(--bal-spinner-circle-progress-inverted)}@-webkit-keyframes spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}";export{d as bal_spinner}