import{a as o,_ as V}from"./app-PrSv7rSt.js";import{_ as $}from"./app-CVQkwzlf.js";import{r as v,J as S,o as u,g as z,a as _,u as e,b as h,bb as N,w as i,c as s,f as c,h as r}from"./app-SC54XQDl.js";const U={class:"ui fields inline"},C=["name","value"],M={class:"ui field"},w={class:"ui field"},G={__name:"SizeCapacityBox",props:["v-name","v-value","v-count","v-unit","size","maxlength","v-supported-units"],emits:["change"],setup(b,{emit:y}){const d=b,k=y,{capacity:m,countString:f,vSize:x,vMaxlength:B,supportedUnits:t}=function(){let n=d.vValue;n==null&&(n={count:d.vCount,unit:d.vUnit}),typeof n.count!="number"&&(n.count=-1);let a=d.size;a==null&&(a=6);let l=d.maxlength;l==null&&(l=10);let g=d.vSupportedUnits;return g==null&&(g=[]),{capacity:v(n),countString:v(n.count>=0?n.count.toString():""),vSize:v(a),vMaxlength:v(l),supportedUnits:v(g)}}(),p=function(){k("change",m.value)};return S(f,function(n){let a=n.trim();if(a.length==0){m.value.count=-1,p();return}let l=parseInt(a);isNaN(l)||(m.value.count=l),p()}),(n,a)=>(u(),z("div",U,[_("input",{type:"hidden",name:n.vName,value:JSON.stringify(e(m))},null,8,C),_("div",M,[h($,{type:"text",modelValue:e(f),"onUpdate:modelValue":a[0]||(a[0]=l=>N(f)?f.value=l:null),maxlength:e(B),size:e(x)},null,8,["modelValue","maxlength","size"])]),_("div",w,[h(V,{modelValue:e(m).unit,"onUpdate:modelValue":a[1]||(a[1]=l=>e(m).unit=l),onChange:p},{default:i(()=>[e(t).length==0||e(t).$contains("byte")?(u(),s(o,{key:0,value:"byte"},{default:i(()=>[c("字节 ")]),_:1})):r("",!0),e(t).length==0||e(t).$contains("kb")?(u(),s(o,{key:1,value:"kb"},{default:i(()=>[c("KiB")]),_:1})):r("",!0),e(t).length==0||e(t).$contains("mb")?(u(),s(o,{key:2,value:"mb"},{default:i(()=>[c("MiB")]),_:1})):r("",!0),e(t).length==0||e(t).$contains("gb")?(u(),s(o,{key:3,value:"gb"},{default:i(()=>[c("GiB")]),_:1})):r("",!0),e(t).length==0||e(t).$contains("tb")?(u(),s(o,{key:4,value:"tb"},{default:i(()=>[c("TiB")]),_:1})):r("",!0),e(t).length==0||e(t).$contains("pb")?(u(),s(o,{key:5,value:"pb"},{default:i(()=>[c("PiB")]),_:1})):r("",!0),e(t).length==0||e(t).$contains("eb")?(u(),s(o,{key:6,value:"eb"},{default:i(()=>[c("EiB")]),_:1})):r("",!0)]),_:1},8,["modelValue"])])]))}};export{G as _};
