import{L as t,H as e,f as i,Q as r,K as s,M as a,N as n,O as o}from"./p-BD2o1F4P.js";import{_ as h,a as c}from"./p-dfXERft2.js";import{B as l}from"./p-ByiN-QjD.js";import{L as d}from"./p-DmcaVYuR.js";const m=class{constructor(t){e(this,t),this.animated=i.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=r((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(((t,e)=>{if(this.animationFunction)return t();s((async()=>{import("./p-BHFw3KrT.js").then((e=>{this.animationFunction=e.animate,t()})).catch(e)}))}))}createLogger(t){this.log=t}deactivatedWatcher(t,e){t!==e&&(this.deactivated?this.destroy():this.animate())}variationWatcher(t,e){t!==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(t){this.animated=t.animated,!1===t.animated&&this.destroy()}getColor(){return this.inverted||"white"===this.color?"#ffffff":"#151f6d"}render(){const t=l.block("spinner");return a(n,{key:"61330569cf09ee4964ef809792f354d060419b62",class:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t.class()),t.modifier("circle").class("circle"===this.variation)),t.modifier("small").class(this.small)),t.modifier("animated").class(this.animated)),t.modifier(`color-${this.color}`).class("circle"===this.variation)),role:"progressbar","aria-hidden":"true"})}get el(){return o(this)}static get watchers(){return{deactivated:["deactivatedWatcher"],variation:["variationWatcher"]}}};h([t("bal-spinner"),c("design:type",Function),c("design:paramtypes",[Function]),c("design:returntype",void 0)],m.prototype,"createLogger",null),h([d(),c("design:type",Function),c("design:paramtypes",[Object]),c("design:returntype",void 0)],m.prototype,"configChanged",null),m.style="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-color-grey);border-radius:50%;border-top-color:var(--bal-color-primary);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-color-white);border-top-color:var(--bal-color-primary)}@-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{m as bal_spinner}