1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];if(null!=t)for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],{"_sentryBundlerPluginAppKey:kombo-app":!0})}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{16781:(e,r,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/[locale]/discount-card/[slug]",function(){return t(69935)}])},23309:(e,r,t)=>{"use strict";t.d(r,{u:()=>u});var a=t(80001);let n=(e,r,t)=>{if(e&&"reportValidity"in e){let n=(0,a.Jt)(t,r);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},i=(e,r)=>{for(let t in r.fields){let a=r.fields[t];a&&a.ref&&"reportValidity"in a.ref?n(a.ref,t,e):a&&a.refs&&a.refs.forEach(r=>n(r,t,e))}},s=(e,r)=>{r.shouldUseNativeValidation&&i(e,r);let t={};for(let n in e){let i=(0,a.Jt)(r.fields,n),s=Object.assign(e[n]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(l(r.names||Object.keys(e),n)){let e=Object.assign({},(0,a.Jt)(t,n));(0,a.hZ)(e,"root",s),(0,a.hZ)(t,n,e)}else(0,a.hZ)(t,n,s)}return t},l=(e,r)=>{let t=o(r).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(e=>o(e).match(`^${t}\\.\\d+`))};function o(e){return e.replace(/\[(\d+)]/g,".$1").replace(/[[\]]/g,"")}function d(){return(d=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(null,arguments)}function c(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}function u(e,r,t){if(void 0===t&&(t={}),"_zod"in e&&"object"==typeof e._zod)return function(n,l,o){try{return Promise.resolve(c(function(){function a(e){return o.shouldUseNativeValidation&&i({},o),{errors:{},values:t.raw?Object.assign({},n):e}}return"sync"===t.mode?a(e.parse(n,r)):Promise.resolve(e.parseAsync(n,r)).then(a)},function(e){var r;if(!(null==e||null==(r=e._zod)||null==(r=r.traits)||!r.has("$ZodError")))return{values:{},errors:s(function(e,r){for(var t=Object.create(null);e.length;)!function(){var n=e[0],i=n.code,s=n.message,l=n.path.join(".");if(!t[l])if("invalid_union"===n.code&&n.errors.length>0){var o,c,u=n.errors.reduce(function(e,r){return r.length<e.length?r:e})[0];t[l]={message:null!=(o=null==u?void 0:u.message)?o:s,type:null!=(c=null==u?void 0:u.code)?c:i}}else t[l]={message:s,type:i};if("invalid_union"===n.code&&n.errors.forEach(function(r){return r.forEach(function(r){return e.push(d({},r,{path:[].concat(n.path,r.path)}))})}),r){var p=t[l].types,f=p&&p[n.code];t[l]=(0,a.Gb)(l,r,t,i,f?[].concat(f,n.message):n.message)}e.shift()}();return t}(e.issues,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};if("_def"in e&&"object"==typeof e._def)return function(n,l,o){try{return Promise.resolve(c(function(){return Promise.resolve(e["sync"===t.mode?"parse":"parseAsync"](n,r)).then(function(e){return o.shouldUseNativeValidation&&i({},o),{errors:{},values:t.raw?Object.assign({},n):e}})},function(e){if(Array.isArray(null==e?void 0:e.issues))return{values:{},errors:s(function(e,r){for(var t=Object.create(null);e.length;){var n=e[0],i=n.code,s=n.message,l=n.path.join(".");if(!t[l])if("unionErrors"in n){var o,d,c=n.unionErrors.reduce(function(e,r){return r.errors.length<e.errors.length?r:e}).errors[0];t[l]={message:null!=(o=null==c?void 0:c.message)?o:s,type:null!=(d=null==c?void 0:c.code)?d:i}}else t[l]={message:s,type:i};if("unionErrors"in n&&n.unionErrors.forEach(function(r){return r.errors.forEach(function(r){return e.push(r)})}),r){var u=t[l].types,p=u&&u[n.code];t[l]=(0,a.Gb)(l,r,t,i,p?[].concat(p,n.message):n.message)}e.shift()}return t}(e.errors,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};throw Error("Invalid input: not a Zod schema")}},45390:e=>{e.exports={"input-container":"styles_input-container__N8H76","reverse-cities-icon":"styles_reverse-cities-icon__j22sO","autocomplete-suggestions-container":"styles_autocomplete-suggestions-container__CUJgN"}},48610:(e,r,t)=>{"use strict";t.d(r,{A:()=>g});var a=t(80263),n=t(95217),i=t.n(n),s=t(74770),l=t(94638),o=t(87913),d=t(68981),c=t(43449),u=t(44915),p=t(59116),f=t(97423),h=t.n(f),v=t(20286);let m=i().bind(h()),g=e=>{let{name:r,hideHeadings:t=!1,hideInfoText:n=!1}=e,{t:i}=(0,l.B)([u.NS.PassengerForm]),[,f]=(0,s.Mt)(r),[h,g]=(0,s.Mt)("".concat(r,".street")),[C,y]=(0,s.Mt)("".concat(r,".city")),[x,j]=(0,s.Mt)("".concat(r,".zipPostCode")),[b,A]=(0,s.Mt)("".concat(r,".country")),S="";return f.error&&("string"==typeof f.error?S=f.error:g.touched&&g.error?S="INCORRECT_STREET":y.touched&&y.error?S="INCORRECT_CITY":j.touched&&j.error?S="INCORRECT_ZIPPOSTCODE":A.touched&&A.error?S="INCORRECT_COUNTRY":f.touched&&f.error&&(S="INCORRECT_ADDRESS")),(0,a.jsx)(d.A,{headingIcon:(0,a.jsx)(c.A,{icon:"location",height:{mobile:"16px",desktop:"20px"},width:{mobile:"16px",desktop:"20px"}}),headingText:i("address"),hideHeadings:t,infoText:n?"":i("WHY_ADDRESS"),wrapperClass:m("journey","text-field-address","address"),children:(0,a.jsxs)(o.A,{d:"flex",flexDirection:"column",gap:"16px",children:[(0,a.jsx)(p.Ay,{...h,label:i("address"),type:"text",placeholder:i("PLACEHOLDER_ADDRESS"),autoComplete:"street-address"}),(0,a.jsx)(p.Ay,{...C,label:i("city"),type:"text",placeholder:i("PLACEHOLDER_CITY"),autoComplete:"address-level2"}),(0,a.jsx)(p.Ay,{...x,label:i("zipPostCode"),type:"text",placeholder:i("PLACEHOLDER_ZIPPOSTCODE"),autoComplete:"postal-code"}),(0,a.jsx)(v.A,{name:b.name}),(0,a.jsx)("div",{className:m("text-field-container"),children:S?(0,a.jsx)("div",{className:m("text-field","error"),children:i(S)}):""})]})})}},69935:(e,r,t)=>{"use strict";t.r(r),t.d(r,{__N_SSG:()=>G,default:()=>W});var a=t(80263),n=t(17343),i=t(40586),s=t(87913),l=t(95053),o=t(59913),d=t(77686),c=t(47591),u=t(63310),p=t(73858),f=t(44250),h=t(75129),v=t(17744),m=t(20110),g=t(44915),C=t(13609),y=t(65708),x=t(53239),j=t(94638),b=t(17740),A=t(45608),S=t(11306),E=t(23309),I=t(98879),D=t(93543),L=t(43449),N=t(71863),O=t(88821),T=t(80001),_=t(7146);let P=_.Ikc({discountCardId:_.bzn(),departureCityId:_.aig().positive({message:"Departure city is required"}),arrivalCityId:_.aig().positive({message:"Arrival city is required"})}),k=e=>{var r,t,n,i,l,o,d,c;let{discountCards:u,onSubmit:p,isLoading:f}=e,{t:h}=(0,j.B)([g.NS.DiscountCardFunnel]),{register:v,handleSubmit:m,control:C,formState:{errors:y}}=(0,T.mN)({resolver:(0,E.u)(P),defaultValues:{discountCardId:null==(r=u[0])?void 0:r.id}});return Object.keys(y).length>0&&console.log(y),(0,a.jsx)("form",{onSubmit:m(e=>{p(e)}),children:(0,a.jsxs)(s.A,{display:"flex",flexDirection:"column",gap:"12px",children:[(0,a.jsxs)(D.A,{children:[(0,a.jsx)(T.xI,{control:C,name:"discountCardId",render:e=>
1{let{field:{onChange:r,value:t}}=e;return(0,a.jsx)(N.A,{value:String(t),onValueChange:e=>{r(e)},options:u.map(e=>({label:e.name,value:e.id.toString()}))})}}),"string"==typeof(null==(t=y.discountCardId)?void 0:t.message)&&(null==(n=y.discountCardId)?void 0:n.message)!==""&&(0,a.jsx)("div",{style:{color:"red"},children:null==(i=y.discountCardId)?void 0:i.message})]}),(0,a.jsx)(D.A,{children:(0,a.jsxs)(s.A,{display:"flex",flexDirection:"column",gap:"8px",children:[(0,a.jsx)(O.U,{...v("departureCityId",{valueAsNumber:!0}),placeholder:h("Ville de d\xe9part",{ns:g.NS.Common}),label:h("Ville de d\xe9part",{ns:g.NS.Common}),errorMessage:null==(o=y.departureCityId)||null==(l=o.message)?void 0:l.toString(),leftIcon:(0,a.jsx)(L.A,{icon:"currentLocation",width:"16px",height:"16px"})}),(0,a.jsx)(O.U,{...v("arrivalCityId",{valueAsNumber:!0}),placeholder:h("Ville d'arriv\xe9e",{ns:g.NS.Common}),label:h("Ville d'arriv\xe9e",{ns:g.NS.Common}),errorMessage:null==(c=y.arrivalCityId)||null==(d=c.message)?void 0:d.toString(),leftIcon:(0,a.jsx)(L.A,{icon:"mapMarker",color:"primary",width:"16px",height:"16px"})})]})}),(0,a.jsx)(I.A,{isLoading:f,type:"submit",children:h("discount-card.search.cta.continue")})]})})};var w=t(29515),V=t(55851),M=t(48610),R=t(15200),F=t(19702),q=t(70719),U=t(74770),z=t(23803);let B=e=>{var r,t;let{discountCardDetails:i,hideSubmit:l,passengersError:o}=e,{values:d,errors:c,handleSubmit:u,isSubmitting:p}=(0,U.j7)(),[f,,h]=(0,U.Mt)("travelClass");if(!(null==(r=i.possibleTravelClasses)?void 0:r.length))return null;let v=(null==(t=i.possibleTravelClasses.find(e=>e.id.toString()===f.value))?void 0:t.price)||0;return(0,a.jsx)("form",{onSubmit:u,children:(0,a.jsxs)(s.A,{display:"flex",flexDirection:"column",gap:"12px",children:[(0,a.jsxs)(D.A,{children:[(0,a.jsx)(N.A,{name:"travelClass",value:d.travelClass,onValueChange:e=>{h.setValue(e),h.setTouched(!0)},options:i.possibleTravelClasses.map(e=>({label:e.name,secondaryLabel:"".concat(e.price/100," â¬"),value:e.id.toString()}))}),""!==c.travelClass&&(0,a.jsx)("div",{style:{color:"red"},children:c.travelClass})]}),(0,a.jsxs)(D.A,{children:[(0,a.jsx)(V.A,{name:"passenger",disableReducedMobilityInput:!0,displayElements:{discountCards:!0,email:!0},requireElements:{discountCards:!0,email:!0},preSelectedDiscountCardId:n.DiscountCardIdValues.TrenitaliaCartafreccia}),(0,a.jsx)(M.A,{name:"passenger.address",hideInfoText:!0})]}),!l&&(0,a.jsxs)(a.Fragment,{children:[(null==o?void 0:o.includes("discount-card.error"))&&(0,a.jsx)(w.A,{message:o,type:F.VL.Error,namespaces:[g.NS.DiscountCardFunnel]}),(0,a.jsxs)(I.A,{isLoading:p,type:"submit",children:["Continua - Informazioni sui viaggiatori ",Math.floor(v/100),"â¬"]})]})]})})},X=e=>{var r,t;let{discountCardDetails:i,locale:s,onSubmit:l,isLoading:o,hideSubmit:d,passengersError:c}=e;return(0,a.jsx)(U.l1,{initialValues:{travelClass:(null==(t=i.possibleTravelClasses)||null==(r=t[0])?void 0:r.id.toString())||"",passenger:{...(0,q.kR)(),discountCards:[{cardType:{id:n.DiscountCardIdValues.TrenitaliaCartafreccia,providerId:n.ProviderId.TrenItalia}}]}},validationSchema:z.Ik({passenger:z.Ik({sex:(0,R.ji)(),firstName:(0,R.KT)().required(),lastName:(0,R.KT)().required(),birthday:(0,R.Qz)().required(),email:(0,R.jy)(!0).required(),address:z.Ik({street:(0,R.WF)(!0),city:(0,R.iT)(!0),zipPostCode:(0,R.f0)(!0)})})}),onSubmit:l,children:(0,a.jsx)(B,{discountCardDetails:i,locale:s,onSubmit:l,isLoading:o,hideSubmit:d,passengersError:c})})},Z=e=>n.trenitaliaCarnetAVIds.some(r=>r===e.id),H=e=>n.trenitaliaCarnetICIds.some(r=>r===e.id),Y=e=>n.trenitaliaCarnetFBIds.some(r=>r===e.id),$=e=>e.id===n.DiscountCardIdValues.TrenitaliaCarnetSmart,J=e=>{let{discountCards:r,locale:t,cardSlug:i}=e,E=(0,y.useRouter)(),{mutate:I,isSuccess:D,isPending:L,isError:N,data:O,error:T}=(0,C.n)({mutationFn:async e=>{let{discountCardId:r,departureCityId:a,arrivalCityId:n}=e;return m.N.getCardDetails(r,t,a,n)}}),{t:_}=(0,j.B)([g.NS.PaymentForm]),[P,w]=(0,x.useState)(),[V,M]=(0,x.useState)(),[R,F]=(0,x.useState)(),q=async e=>{var r,a;if(!O)return;let i=await m.N.createDraft({locale:t,travelClassId:+e.travelClass,passenger:e.passenger,cardType:O.cardType,cityFromId:null==(r=O.cityFrom)?void 0:r.id,cityToId:null==(a=O.cityTo)?void 0:a.id,providerId:n.ProviderId.TrenItalia,purchaseType:n.DiscountCardPurchaseType.CREATION});i.success?(M(i.encodedBookingId),F(i.price)):!1===i.success&&i.errorMessage&&w(i.errorMessage)},U=(0,x.useCallback)(async e=>{if(!V)throw Error("Encoded booking ID is not set");return m.N.retrieveAxeptaEncodedData(V,e)},[V]);return(0,a.jsx)(h.A,{idName:"discount-card-purchase-funnel-body",handleBack:()=>E.back(),locale:t,children:(0,a.jsx)(o.A,{children:(0,a.jsx)(d.$5,{children:(0,a.jsx)(c.r_,{children:(0,a.jsx)(f.G,{buttons:V&&void 0!==R?(0,a.jsx)(b.A,{activeStep:3,handleFormContinueClick:()=>{var e;
1return null==(e=document.getElementById("submit-form-button"))?void 0:e.click()},cardPrice:R,isLoading:L}):void 0,displayButtons:!1,children:(0,a.jsxs)(v.A,{children:[(0,a.jsx)(s.A,{paddingTop:"20px",children:(0,a.jsxs)(l.A,{disabled:!0,isDefaultOpen:!0,title:"Acquisto o rinnovo",children:[(0,a.jsx)(A.A,{cardSlug:i}),(0,a.jsx)(k,{onSubmit:I,isLoading:L,discountCards:r}),!!(N&&T)&&(0,a.jsx)("div",{style:{color:"red"},children:_(n.DiscountCardPurchaseError.DepartureAndArrivalCitiesDoNotMatchCardType,{ns:g.NS.DiscountCardFunnel})})]})}),(0,a.jsxs)(s.A,{paddingTop:"20px",children:[D&&!V&&(0,a.jsx)(l.A,{disabled:!0,isDefaultOpen:!0,title:"Informazioni sui carnet e viaggiatori",children:(0,a.jsx)(X,{discountCardDetails:O,locale:t,onSubmit:q,isLoading:L,hideSubmit:!!V,passengersError:P})}),V&&void 0!==R&&(0,a.jsx)(p.tR,{getEncodedDataRequest:U,children:(0,a.jsx)(u.ts,{children:(0,a.jsx)(S.A,{title:_("PAIEMENT"),price:R,isClickable:!1,isOpen:!0,encodedBookingId:V,locale:t,cardTypeUrlParam:i})})})]})]})})})})})})},K=[{slug:"trenitalia-carnet-av",locale:n.LOCALE.it,component:()=>(0,a.jsx)(J,{locale:n.LOCALE.it,discountCards:n.AvailableDiscountCardSchemas.filter(Z),cardSlug:"trenitalia-carnet-av"})},{slug:"trenitalia-carnet-ic",locale:n.LOCALE.it,component:()=>(0,a.jsx)(J,{locale:n.LOCALE.it,discountCards:n.AvailableDiscountCardSchemas.filter(H),cardSlug:"trenitalia-carnet-ic"})},{slug:"trenitalia-carnet-fb",locale:n.LOCALE.it,component:()=>(0,a.jsx)(J,{locale:n.LOCALE.it,discountCards:n.AvailableDiscountCardSchemas.filter(Y),cardSlug:"trenitalia-carnet-fb"})},{slug:"trenitalia-carnet-smart",locale:n.LOCALE.it,component:()=>(0,a.jsx)(J,{locale:n.LOCALE.it,discountCards:n.AvailableDiscountCardSchemas.filter($),cardSlug:"trenitalia-carnet-smart"})},{slug:"carte-avantage-senior",locale:n.LOCALE.fr,component:()=>{let e=n.AvailableDiscountCardSchemas.filter(i.Xy).find(e=>e.id===n.DiscountCardIdValues.SncfAvantageSenior);return e?(0,a.jsx)(i.b4,{cardSlug:"carte-avantage-senior",locale:n.LOCALE.fr,discountCardDetails:e}):null}},{slug:"carte-avantage-jeune",locale:n.LOCALE.fr,component:()=>{let e=n.AvailableDiscountCardSchemas.filter(i.Xy).find(e=>e.id===n.DiscountCardIdValues.SncfAvantageJeune);return e?(0,a.jsx)(i.b4,{cardSlug:"carte-avantage-jeune",locale:n.LOCALE.fr,discountCardDetails:e}):null}},{slug:"carte-avantage-adulte",locale:n.LOCALE.fr,component:()=>{let e=n.AvailableDiscountCardSchemas.filter(i.Xy).find(e=>e.id===n.DiscountCardIdValues.SncfAvantageAdulte);return e?(0,a.jsx)(i.b4,{cardSlug:"carte-avantage-adulte",locale:n.LOCALE.fr,discountCardDetails:e}):null}},{slug:"carte-liberte",locale:n.LOCALE.fr,component:()=>{let e=n.AvailableDiscountCardSchemas.filter(i.Xy).find(e=>e.id===n.DiscountCardIdValues.SncfLiberte);return e?(0,a.jsx)(i.b4,{cardSlug:"carte-liberte",locale:n.LOCALE.fr,discountCardDetails:e}):null}}];var G=!0;let W=e=>{let{slug:r}=e,t=K.find(e=>e.slug===r);if(void 0!==t){let e=t.component;return(0,a.jsx)(e,{})}}},88821:(e,r,t)=>{"use strict";t.d(r,{U:()=>m});var a=t(80263),n=t(23365),i=t(74196),s=t(95217),l=t.n(s),o=t(53239),d=t(55414),c=t(73296),u=t(80053),p=t(92259),f=t(45390),h=t.n(f);let v=l().bind(h()),m=(0,o.forwardRef)((e,r)=>{var t;let{rightIcon:s,leftIcon:l,rightIconOnClick:f,errorMessage:h,label:m,...g}=e,[C,y]=(0,o.useState)(""),{data:x,error:j,isLoading:b}=(e=>{let{term:r}=e,t=(0,d.Y)();return(0,i.I)({queryKey:["city-search",r],queryFn:async()=>c.j.search({locale:t,term:r}),enabled:r.length>2,staleTime:1e5})})({term:C}),{data:A}=(e=>{let{cityId:r}=e,t=(0,d.Y)();return(0,i.I)({queryKey:["city",r,t],queryFn:async()=>p.k.getCity(r,t),enabled:r>0,staleTime:1e5})})({cityId:+(g.value||-1)});(0,o.useEffect)(()=>{A&&y(A.name)},[A]);let[S,E]=(0,o.useState)(!1),[I,D]=(0,o.useState)(null);return(0,a.jsxs)("div",{className:v("input-container"),children:[(0,a.jsx)(n.A,{type:"search",label:m,value:C,iconLeft:l,placeholder:"",isError:!!h,onChange:e=>{E(!0),y(e.currentTarget.value)}}),!!s&&(0,a.jsx)("button",{className:v("reverse-cities-icon"),onClick:f,children:s}),(0,a.jsx)("input",{ref:r,...g,type:"hidden",value:null!=(t=null==I?void 0:I.id)?t:0}),!!h&&(0,a.jsx)("div",{style:{color:"red"},children:h}),!j&&!b&&S&&(0,a.jsx)("div",{className:v("autocomplete-suggestions-container"),children:null==x?void 0:x.results.map(e=>(0,a.jsx)(u.X,{showIcons:!1,entry:{id:e.i,displayName:e.n,countryName:e.c},onSelect:e=>{E(!1),D(e),y(e.displayName);let r=new Event("change",{bubbles:!0});Object.defineProperty(r,"target",{value:{value:e.id,name:g.name}}),g.onChange&&g.onChange(r)}},e.i))})]})});m.displayName="SearchCityInput"}},e=>{e.O(0,[596,7146,4457,8834,5040,2496,4335,5744,8514,2559,9141,6740,7376,2977,636,6593,8792],()=>e(e.s=16781)),_N_E=e.O()}]);
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.