import{f as o}from"./app-DB4YCWeF.js";import{i as h}from"./BaseForm-CkSb_d40.js";function v(e,i=null){let{name:f,value:t,files:l,type:s,checked:u}=e.target;return s=="file"&&(t=l[0]),s=="checkbox"&&(t=u?1:0),g({name:f,value:t,files:l,type:s,checked:u},i)}const g=(e,i)=>{let{name:f,value:t,type:l}=e;return t==""?e:(["tel"].includes(l)&&!h(t)&&(t=i[f]?i[f]:""),["tel"].includes(l)&&(t==null?void 0:t.length)>13&&(t=i[f]?i[f]:t),{...e,value:t})},d=({e,name:i,setData:f,params:t,only:l=[],onBeforeSetData:s=null,isHtmlSelect:u=!1})=>{var c;let r={};r[i]=(e==null?void 0:e.value)??"",r[i]||(r[i]=e??""),u&&(r[i]=((c=e==null?void 0:e.target)==null?void 0:c.value)??""),s&&s(r),f(n=>({...n,...r})),t.set(i,r[i]),(l==null?void 0:l.length)>0&&o.visit(`?${t.toString()}`,{method:"get",only:[...l,"location"],preserveState:!0,async:!1})};export{d as h,v as u};
