const d={handleChartSvg(t,e,a){const r=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(t)))}`,o=new Image;o.src=r,o.onload=function(){const n=document.createElement("canvas");n.width=this.naturalWidth||this.width,n.height=this.naturalHeight||this.height,n.getContext("2d").drawImage(this,0,0);const i=n.toDataURL("image/png"),c=new FormData;c.append("file",s(i,e)),a(c)};function s(n,u="file"){const i=n.split(","),c=i[0].match(/:(.*?);/)[1],m=c.split("/")[1],f=atob(i[1]);let h=f.length;const l=new Uint8Array(h);for(;h--;)l[h]=f.charCodeAt(h);return new File([l],`${u}.${m}`,{type:c})}},transformStructure(t){const e={};return t.forEach(r=>{const{factoryId:o,productKey:s,identifier:n}=r;e[o]||(e[o]={}),e[o][s]||(e[o][s]=[]),e[o][s].push(n)}),Object.keys(e).map(r=>{const o=Object.keys(e[r]).map(s=>({productKey:s,components:e[r][s]}));return{factoryId:parseInt(r,10),deviceTypes:o}})},formatLength(t){return t%1048576===0?`${t/1048576}M`:t%1024===0?`${t/1024}K`:t.toString()},formatFreq(t){return t%1e3===0?`${t/1e3}KHz`:t<1800?"1.6KHz":t>=1e4?"10KHz":`${t}KHz`},formatDuration(t){const e=Math.floor(t/1e3),a=Math.floor(e/86400),r=Math.floor(e%86400/3600),o=Math.floor(e%3600/60),s=e%60,n=[];return a>0&&n.push(`${a}\u5929`),r>0&&n.push(`${r}\u5C0F\u65F6`),o>0&&n.push(`${o}\u5206`),s>0&&n.push(`${s}\u79D2`),n.length?n.join(""):"0\u79D2"}};export{d as c};
