var u=(n,c,s)=>new Promise((r,l)=>{var i=e=>{try{a(s.next(e))}catch(m){l(m)}},p=e=>{try{a(s.throw(e))}catch(m){l(m)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(i,p);a((s=s.apply(n,c)).next())});import{u as k}from"./useEntityForm-CMwp7TbN.js";import{c8 as g,b6 as o}from"./bootstrap-Bqxdt4iG.js";import{a1 as L,ai as P,aj as v,a9 as w}from"../jse/index-index-BUJ_4tQs.js";const y=L({__name:"custom-link-form",props:{customLink:{default:null},mode:{}},emits:["cancel","submit"],setup(n,{expose:c,emit:s}){const r=n,l=s,i={title:"",description:"",url:"",visibleToRoles:[],sortOrder:0},p=g.map(t=>({value:t.value,label:t.label})),a=[{component:"Input",componentProps:{placeholder:o("page.customLinks.form.titlePlaceholder")},fieldName:"title",formItemClass:"col-span-2",label:o("page.customLinks.form.title"),rules:"required"},{component:"Input",componentProps:{placeholder:o("page.customLinks.form.urlPlaceholder")},fieldName:"url",formItemClass:"col-span-2",label:o("page.customLinks.form.url"),rules:"required"},{component:"Textarea",componentProps:{placeholder:o("page.customLinks.form.descriptionPlaceholder"),autoSize:{minRows:2,maxRows:4}},fieldName:"description",formItemClass:"col-span-2",label:o("page.customLinks.form.description")},{component:"InputNumber",componentProps:{class:"w-full",min:0},fieldName:"sortOrder",label:o("page.customLinks.form.sortOrder")},{component:"Select",componentProps:{mode:"multiple",options:p,placeholder:o("page.customLinks.form.visibleToRolesPlaceholder"),allowClear:!0},fieldName:"visibleToRoles",formItemClass:"col-span-2",label:o("page.customLinks.form.visibleToRoles")}],{Form:e,focus:m,isDirty:d,resetForm:f,submitForm:b,watchEntity:h}=k({emptyValues:i,schema:a,wrapperClass:"grid-cols-2 gap-x-6"});return h(()=>r.customLink,()=>r.mode),c({cancel:()=>l("cancel"),focus:m,isDirty:d,resetForm:f,submit:()=>u(null,null,function*(){const t=yield b();t&&l("submit",t)})}),(t,I)=>(v(),P(w(e)))}});export{y as _};
