var l=(r,c,m)=>new Promise((s,a)=>{var u=e=>{try{t(m.next(e))}catch(n){a(n)}},p=e=>{try{t(m.throw(e))}catch(n){a(n)}},t=e=>e.done?s(e.value):Promise.resolve(e.value).then(u,p);t((m=m.apply(r,c)).next())});import{bi as d,b6 as o}from"./bootstrap-Bqxdt4iG.js";import{u as x}from"./useEntityForm-CMwp7TbN.js";import{a1 as b,ai as _,aj as y,a9 as C}from"../jse/index-index-BUJ_4tQs.js";const B=b({__name:"uom-form",props:{uom:{default:null},mode:{}},emits:["cancel","submit"],setup(r,{expose:c,emit:m}){const s=r,a=m,u={code:"",name:""},p=[{component:"Input",componentProps:{"data-testid":"uom-form-code-input",id:"uom-form-code-input",placeholder:o("page.uoms.form.codePlaceholder"),maxlength:20},fieldName:"code",label:o("page.uoms.form.code"),rules:d().min(1,o("page.uoms.form.codeRequired")).max(20,o("page.uoms.form.codeMaxLength",{max:20}))},{component:"Input",componentProps:{"data-testid":"uom-form-name-input",placeholder:o("page.uoms.form.namePlaceholder"),maxlength:50},fieldName:"name",label:o("page.uoms.form.name"),rules:d().min(1,o("page.uoms.form.nameRequired")).max(50,o("page.uoms.form.nameMaxLength",{max:50}))}],{Form:t,focus:e,isDirty:n,resetForm:f,submitForm:h,watchEntity:g}=x({emptyValues:u,firstInputId:"uom-form-code-input",schema:p,wrapperClass:"grid-cols-1"});return g(()=>s.uom,()=>s.mode),c({cancel:()=>{a("cancel")},focus:e,isDirty:n,resetForm:f,submit:()=>l(null,null,function*(){const i=yield h();i&&a("submit",i)})}),(i,P)=>(y(),_(C(t)))}});export{B as _};
