1import{n as W}from"./vue-i18n-C1fzrKht.js";import{t as Z}from"./useUrqlClient-BFtAmdNo.js";import{Ot as $,Vt as k,a as G,ct as K,jt as Q}from"./app/api/graphql/generated/graphql.ts-CstZYwUw.js";import{y as X}from"./dist-DEYh4ltr.js";import{t as J}from"./NotificationStore-CgKXRZSY.js";import{K as Y}from"#entry";import{t as r}from"./FormFieldTranslationEnum-CbYI5XM0.js";import{t as V}from"./useDateOfBirth-BDDOComC.js";import{_ as a,f as u,h as m,i as ee,n as E,p as C,s as te,u as se,v as re}from"./zod-B0ljh6Kv.js";var ue=(O={useAsBilling:!0,useAsShipping:!0,type:G.Custom})=>{const{t:s}=W(),N=Z(),S=J(),{handleResponseMessageArray:x,getFragmentedMessages:I}=Y(),{dateOfBirthRegex:P}=V(),g=(e,n,t,i)=>m({[e]:n,[t]:o}).refine(R=>R[e]===R[t],{error:i,path:[t]}),d={upperLower:/^(?=.*[a-z])(?=.*[A-Z])/,number:/\d/,special:/[^a-zA-Z\d\s:]/},c=/^(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?[-. /]?)?((?:\(?\d{1,}\)?[-. /]?)+)(?:[-. /]?(?:#|ext\.?|extension|x)[-. /]?(\d+))?$/i,b=/^\d*$/,f=ee(Q,{error:()=>s(r.ERROR_SALUTATION)}),o=E().trim().min(1,s(r.ERROR_REQUIRED)).default(""),h=E().nullable().optional(),w=a().regex(b,s(r.ERROR_NUMERIC)),l=se({error:s(r.ERROR_EMAIL)}),M=a().regex(c,s(r.ERROR_PHONE)),T=a().refine(e=>e===""||c.test(e),{message:s(r.ERROR_PHONE)}).optional().or(C("")),v=a().regex(c,s(r.ERROR_PHONE_FOR_SHIPMENT)),D=re([a().regex(P.value,s(r.ERROR_DATE)).optional(),C("")]),A=a().min(8,s(r.ERROR_PASSWORD_RULES)).regex(d.upperLower,s(r.ERROR_PASSWORD_RULES)).regex(d.number,s(r.ERROR_PASSWORD_RULES)).regex(d.special,s(r.ERROR_PASSWORD_RULES)),L=m({email:u(o,l),password:o}),_=m({salutation:f,firstName:o,lastName:o}),U=_.extend({address1:o,address3:a().nullish(),zipCode:h,city:o,countryIso2Code:o}),F=te().superRefine(async(e,n)=>{const t=await j({...e,...O});if(t)for(const i of t)i?.reference&&i.message&&n.issues.push({code:"custom",path:[i?.reference],message:i?.message,input:void 0})}),q=g("password",u(o,A),"passwordConfirmation",s(r.ERROR_PASSWORDCONFIRMATION)),z=g("email",u(o,l),"emailConfirmation",s(r.ERROR_EMAIL_CONFIRMATION)),j=X(async e=>{S.removeNotificationByCode($.AddressError);const n=e.zipCode?y(e.zipCode,e.countryIso2Code):e.zipCode,{data:t,error:i}=await N.query(k,{address:{id:e.id,salutation:e.salutation,firstName:e.firstName,lastName:e.lastName,address1:e.address1,address3:e.address3,zipCode:n,city:e.city,countryIso2Code:e.countryIso2Code,deliveryStationCustomerNumber:e.deliveryStationCustomerNumber,deliveryStationId:e.deliveryStationId,email:e.email,phone:e.phone,newsletter:e.newsletter??!1,...O}});if(i)S.pushAndRemoveNotification({type:K.Error,message:s(i.message)});else if(t){const R=I(t.validateAddressSet?.messages)?.errorMessages;R&&x(R);const p=R?.filter(H=>H?.reference);if(p&&p.length>0)return p}return null},500),B=e=>{if(e)return E().trim().max(e,s(r.ERROR_MAX_LENGTH,{max:e}))},y=(e,n)=>{let t=e?.trim()?.replace(/\s+/g," ");return e&&n==="NL"&&(t=t.toUpperCase(),t.charAt(4)!==" "&&t.length>4&&(t=t.slice(0,4)+" "+t.slice(4))),t};return{passwordRuleRegex:d,phoneRuleRegex:c,isSalutationRule:f,isRequiredRule:o,isOptionalRule:h,isNumericStringRule:w,isEmailRule:l,isPhoneRule:M,isOptionalPhoneRule:T,isPhoneRequiredForShipmentRule:v,isBirthdayRule:D,isPasswordRule:A,loginSchemaObject:L,addressSchemaObject:U,salutationSchemaObject:_,passwordSchemaEffect:q,emailSchemaEffect:z,backendAddressValidation:F,preproccessZipCode:y,createMaxLengthRule:B}};export{ue as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.