import{K as h,bi as F}from"./entry.client-CV0PzNS2.js";const $=p=>{var d,i,f,o,r,n,m,b,_,V,y,x;const{defaultLabel:k,defaultValue:L,id:l,defaultPrefixLabel:g,defaultPrefixValue:P,defaultNumber:z}=p,{user:e}=h(),{prefillUser:N}=F(),a={defaultLabel:k,defaultValue:L,defaultNumber:z,defaultPrefixLabel:g,defaultPrefixValue:P},s=e&&l?e[l]:null;if(N){if(s&&typeof s=="string"&&s.match(/^((\+\d+)\s+)?(\d+)$/)&&l!=="zip"&&l!=="numemployees"&&l!=="course_tax_code"&&l!=="course_district_sub_num"){const t=s.match(/^((\+\d+)\s+)?(\d+)$/);if((t==null?void 0:t.length)===4){const c=t[2],u=t[3];c&&(a.defaultPrefixLabel=c,a.defaultPrefixValue=c),u&&(a.defaultNumber=u)}else if((t==null?void 0:t.length)===2){const c="+39",u=t[1];a.defaultPrefixLabel=c,a.defaultPrefixValue=c,u&&(a.defaultNumber=u)}}else if(e&&typeof e=="object")switch(l){case"email":case"mail":case"e-mail":a.defaultValue=e.email;break;case"name":case"firstname":case"first_name":a.defaultValue=e.firstname;break;case"lastname":case"last_name":a.defaultValue=e.lastname;break;case"country":a.defaultLabel=(d=e==null?void 0:e.country)==null?void 0:d.name,a.defaultValue=(i=e==null?void 0:e.country)==null?void 0:i.code;break;case"state":a.defaultLabel=(f=e==null?void 0:e.state)==null?void 0:f.name,a.defaultValue=(o=e==null?void 0:e.state)==null?void 0:o.code;break;case"sector":case"industry":a.defaultLabel=(r=e==null?void 0:e.sector)==null?void 0:r.name,a.defaultValue=(n=e==null?void 0:e.sector)==null?void 0:n.id;break;case"category":case"business_category":a.defaultLabel=(m=e==null?void 0:e.category)==null?void 0:m.name,a.defaultValue=(b=e==null?void 0:e.category)==null?void 0:b.id;break;case"numemployees":a.defaultLabel=e.numemployees,a.defaultValue=e.numemployees;break;case"zip":case"zip_code":case"zipcode":a.defaultValue=e.zip;break;case"course_district_id":a.defaultLabel=(_=e==null?void 0:e.course_district)==null?void 0:_.name,a.defaultValue=(V=e==null?void 0:e.course_district)==null?void 0:V.id;break;case"course_user_category_id":a.defaultLabel=(y=e==null?void 0:e.course_user_category)==null?void 0:y.name,a.defaultValue=(x=e==null?void 0:e.course_user_category)==null?void 0:x.id;break;case"course_tax_code":a.defaultValue=e==null?void 0:e.course_tax_code;break;case"course_district_sub_num":a.defaultValue=e==null?void 0:e.course_district_sub_num;break;default:a.defaultValue=e[l]||void 0}}return a};export{$ as u};