import{f as o}from"./app-Bup04Qnx.js";import{i as h}from"./format-CisCU4Rs.js";function S(e,i=null){let{name:f,value:t,files:l,type:r,checked:n}=e.target;return r=="file"&&(t=l[0]),r=="checkbox"&&(t=n?1:0),g({name:f,value:t,files:l,type:r,checked:n},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})},b=({e,name:i,setData:f,params:t=null,only:l=[],onBeforeSetData:r=null,isHtmlSelect:n=!1})=>{var c;let u={};u[i]=(e==null?void 0:e.value)??"",u[i]||(u[i]=e??""),n&&(u[i]=((c=e==null?void 0:e.target)==null?void 0:c.value)??""),r&&r(u),f(s=>({...s,...u})),t&&(t==null||t.set(i,u[i]),(l==null?void 0:l.length)>0&&o.visit(`?${t.toString()}`,{method:"get",only:[...l,"location"],preserveState:!0,async:!1}))};export{b as h,S as u};
