1import{a6 as n,a3 as D,w as M,e as b,a7 as k,a8 as j,u as V,a as d,R as z,U as W,b as Y,F as Z,j as w,a9 as $,aa as y,ab as q,Z as J,_ as K}from"./index-af67f71a.js";const Q={text:"Cédula CiudadanÃa",value:"CC"},r={text:"Cédula ExranjerÃa",value:"CE"},i={text:"Pasaporte",value:"PASSPORT"},P={text:"DNI",value:"DNI"},X={text:"CPF",value:"CPF"},ee={text:"INE",value:"INE"},g={text:"Cédula de Identidad",value:"CI"},te=new Map([[n.Colombia,[Q,r,i]],[n.Peru,[P,r,i]],[n.Argentina,[P,i,r]],[n.Brasil,[X,i,r]],[n.Mexico,[ee,i,r]],[n.Ecuador,[g,i,r]],[n.Uruguay,[g,i,r]],[n.CostaRica,[g,i,r]],[n.Chile,[g,i,r]]]),ce=e=>te.get(e)||[];var h=(e=>(e.HasAntismoking="antismoking",e.AlcoholicBeverage="alcohol",e.CheckAlways="all",e))(h||{}),_=(e=>(e.HasAntismoking="has_antismoking",e.AlcoholicBeverage="alcoholic_beverage",e))(_||{});const ae=async()=>{try{const{data:e}=await D.get("/api/ms/users-ms/application-users/has-legal-age"),{user_has_legal_age:s}=e;return s}catch(e){return M.error({message:"[ERROR]: Error validating has legal age",error:e}),!1}},se=async({birthDate:e,documentNumber:s,restrictions:t})=>{const c={birth_date:e,dni:s,restrictions:t},{data:p}=await D.post("/api/dynamic/context/validate-user",c);return p},O={hasLegalAge:ae,validateUser:se},I=e=>{if(e){const s=new Date(e),t=Date.now()-s.getTime(),c=new Date(t);return Math.abs(c.getUTCFullYear()-1970)}return 0},oe=b.lazy(()=>k(()=>import("./Modal-26fcd19c.js"),["static/Modal-26fcd19c.js","static/chunk-DKFDJSXF-af5c60ed.js","static/index-af67f71a.js","static/css/index-d3589f92.css","static/css/Modal-856daddf.css"])),ne=b.lazy(()=>k(()=>import("./GuestModal-f4676561.js"),["static/GuestModal-f4676561.js","static/index-af67f71a.js","static/css/index-d3589f92.css"])),x=18,L=()=>{const e={restriction:[],showOncePerSession:!1},t={product_restrictions:[{country_code:"CL",restriction:[],showOncePerSession:!0},{country_code:"CO",restriction:[],showOncePerSession:!0}]}.product_restrictions.find(({country_code:c})=>c.toLocaleLowerCase()===j.infoCountry.codeIso)||e;return{restriction:t.restriction,showOncePerSession:t.showOncePerSession}},re=({onClose:e,product:s,user:t})=>{const{t:c}=V(),[p,u]=d.useState(!1),[T,B]=d.useState(!1),[U,v]=d.useState(!1),[N,C]=d.useState(!1),F=z.isUserGuest(),R=W(),G=async()=>{var m;const o=sessionStorage.getItem("IS_ADULT")==="true",a=L(),f=(m=a==null?void 0:a.restriction)==null?void 0:m.some(l=>l===h.AlcoholicBeverage&&s.alcoholicBeverage||l===h.HasAntismoking&&s.hasAntismoking||l===h.CheckAlways);if(a!=null&&a.showOncePerSession)A(!o);else if(f){const l=await O.hasLegalAge();A(!l)}else A(I(t==null?void 0:t.birthday)<x)},A=o=>{o?(B(!0),S(s)):(y.ageRestrictionValidated(!0),e())},S=o=>{const a=[];return o.hasAntismoking&&a.push(_.HasAntismoking),o.alcoholicBeverage&&a.push(_.AlcoholicBeverage),a},H=async(o,a)=>{u(!0);const f=S(s);if(I(o)<x){C(!0),u(!1);return}C(!1);try{await O.validateUser({birthDate:o,documentNumber:a,restrictions:f}),await q.updateUserData(R,{birthDate:o,documentNumber:a}),sessionStorage.setItem("IS_ADULT","true"),y.ageRestrictionValidated(!0),u(!1),e()}catch(l){u(!1),R({type:J.OpenSnackbar,payload:{open:!0,message:c("age_restrictions_modal.error.verify_info"),type:K.SnackbarTypes.ERROR}}),M.error({message:"[ERROR]: Error validating age user",error:l})}};d.useEffect(()=>{F?v(!0):G()},[]);const E=()=>{y.ageRestrictionValidated(!1),e()};return Y(Z,{children:[T&&w(oe,{defaultBirthDay:t==null?void 0:t.birthday,defaultDocumentNumber:t==null?void 0:t.identification,onClose:()=>E(),onSave:H,isFetching:p,showBirthdayError:N}),U&&w(ne,{onClose:()=>{E(),v(!1)},goToLogin:()=>{window.location.href=`/login?${$("WEB_HEADER")}`}})]})},le=Object.freeze(Object.defineProperty({__proto__:null,default:re,getRestrictionsConfig:L},Symbol.toStringTag,{value:"Module"}));export{le as A,ce as g};
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.