import{LocalizeController as t}from"./chunk.2A3352EO.js";import{ShoelaceElement as i}from"./chunk.Z7XDKKOD.js";import{__decorateClass as e}from"./chunk.6M63UXML.js";import{property as o}from"../../../../lit/decorators.js";var r=class extends i{constructor(){super(...arguments),this.localize=new t(this),this.value=0,this.unit="byte",this.display="short"}render(){if(isNaN(this.value))return"";const t="bit"===this.unit?["","kilo","mega","giga","tera"]:["","kilo","mega","giga","tera","peta"],i=Math.max(0,Math.min(Math.floor(Math.log10(this.value)/3),t.length-1)),e=t[i]+this.unit,o=parseFloat((this.value/Math.pow(1e3,i)).toPrecision(3));return this.localize.number(o,{style:"unit",unit:e,unitDisplay:this.display})}};e([o({type:Number})],r.prototype,"value",2),e([o()],r.prototype,"unit",2),e([o()],r.prototype,"display",2);export{r as SlFormatBytes};