vendor: 4,428 bytes, line 1
1import{c as ni,b as mt,g as it,p as Tl,T as qi,H as Kt,r as P,k as e,Q as gr,s as ye,C as di,D as _e,U as _l,V as kl,W as Al,u as Gt,L as ke,S as Re,w as fr,y as Rl,n as mn,e as Hi,o as ii,j as Ml,h as xr,d as hn,i as pn,E as Ol,X as zl,Y as Ll,Z as El,_ as Fl,l as Bl,f as ei,$ as $l,P as Wl,K as Ul,a0 as br,a1 as Vl}from"../8Yht-gTw.js";import{s as De,D as k,d as te,S as V,p as _,a as Qt,h as Ki,c as Si,j as fe,n as Gl,e as dt,v as qe,q as Dt,P as la,u as It,z as ql,K as Hl,L as yr,y as jr,A as Kl,V as Ql,N as Jl}from"../D06Tu0vu.js";import{Q as Bi,C as Qi,ae as $i,aj as da,q as Ni,J as Yl,G as we,S as Sr,ak as ss,a3 as Tt,X as Zl,O as vi,D as Wi,h as Xl,t as xt,o as fs,T as Ct,a7 as Nr,a as ct,v as xs,$ as at,al as ed,I as ot,am as Ui,i as bs,an as td,g as ys,ao as id,ap as wi,aq as ja,ar as lt,a8 as Sa,u as Se,m as ai,e as ad,as as sd,at as nd,au as js,l as rd,av as od,L as Je,a1 as ld,ab as dd,ac as cd,_ as Ci,aw as ud,ax as wr,ad as Ss,w as Be,f as Ns,P as md,k as hd,R as pd,ay as vd,c as gd,az as fd,aA as xd,aB as bd,aC as yd,ah as Cr,H as jd,n as Sd}from"../WuHAdAb1.js";import{F as Ji,E as Nd,_ as Pr,T as ca,D as wd,S as vn,a as ws,b as ze,g as Cd,l as Na,H as Wa,P as Dr,A as Cs,c as Pd,d as _t,e as Dd,B as Id,C as Td,f as Ir,h as _d,i as Tr,j as ns,k as _r,m as kd,I as Ps,n as kr,o as wa,p as Pe,q as Ad,r as Ye,s as Ar,t as rs,u as Rr,v as Mr,w as Rd,V as Md,x as Od,y as Ca,z as Xe,W as zd,G as He,J as Yi,K as Ld,L as Ed,M as Ds,N as Fd,O as gn,Q as os,R as We,U as Bd,X as fn,Y as $d,Z as Wd,$ as Ud,a0 as Vd,a1 as Gd,a2 as qd,a3 as Hd,a4 as Kd,a5 as Qd,a6 as Jd,a7 as Yd,a8 as Zd,a9 as Xd,aa as ec,ab as Or,ac as tc,ad as ic,ae as ac,af as sc,ag as nc,ah as rc,ai as oc,aj as lc,ak as dc,al as cc,am as uc,an as mc,ao as hc,ap as pc,aq as vc,ar as gc,as as fc,at as xc,au as bc,av as yc,aw as jc,ax as Sc,ay as Nc,az as wc,aA as Cc,aB as Pc,aC as Dc,aD as Ua,aE as Is,aF as Ic,aG as Tc,aH as _c,aI as Ts,aJ as Pa,aK as kc,aL as ls,aM as Ac,aN as zr,aO as Rc,aP as Mc,aQ as Lr,aR as Er,aS as Oc,aT as zc,aU as Fr,aV as Lc,aW as _s,aX as ks,aY as Ec,aZ as xn,a_ as Fc,a$ as bn,b0 as Bc,b1 as Br,b2 as $r,b3 as Va,b4 as $c,b5 as Wc,b6 as Uc,b7 as Vc,b8 as Gc,b9 as Wr,ba as qc,bb as ds,bc as yn,bd as As,be as Hc,bf as Kc,bg as Qc,bh as Jc,bi as Yc,bj as Zc,bk as Xc,bl as Rs,bm as eu,bn as tu,bo as iu}from"../OKWQlYh6.js";import{b8 as au,b9 as su,N as Q,ba as ne,bb as nu,bc as ru,bd as ou,be as lu,bf as du,bg as cu,p as Qe,aK as Fe,aG as Ut,ak as cs,aq as uu,bh as Ur,ap as Ms,bi as Vr,b as ie,w as bt,E as ri,V as Lt,a as et,J as ce,bj as mu,bk as hu,S as Da,D as Os,bl as zs,_ as pu,i as ua,bm as Ls,bn as Es,ai as Me,bo as Zi,k as ht,aI as Ve,aN as Ne,e as oa,bp as vu,g as Gr,c as ci,h as si,b3 as fi,an as oi,b4 as Ia,B as Ft,j as gu,bq as Vt,aW as Xi,br as qr,bs as hi,bt as jn,bu as fu,a3 as Ee,bv as xu,bw as Fs,a2 as yt,bx as Oe,by as Bs,bz as Hr,bA as xi,bB as Kr,bC as Qr,bD as Jr,K as bu,o as xe,bE as Et,b7 as Yr,ac as $s,bF as yu,bG as Ws,M as Zr,bH as Xr,bI as ma,bJ as Us,bK as ju,R as J,bL as Ta,az as li,aA as Sn,ay as us,aj as Pt,a7 as Ge,bM as bi,U as eo,L as Su,bN as yi,r as _a,bO as Pi,bP as Nu,bQ as wu,bR as to,bS as Cu,bT as Vs,bU as Pu,b6 as kt,bV as Du,bW as Iu,a8 as Tu,bX as _u,ag as ji,bY as Nn,bZ as io,b_ as ku,b$ as Au,c0 as Ru,F as Gs,aY as ka,aH as ao,P as Fi,aU as Mu,z as ft,c1 as Ou,c2 as zu,c3 as so,c4 as Li,c5 as Lu,c6 as Eu,b1 as Fu,c7 as Bu,c8 as $u,c9 as Wu,ca as Ai,cb as Uu,a9 as Vu,ab as Gu,y as qu,cc as Ga,cd as Hu,ce as wn,cf as Ku}from"../eoMzmDS_.js";import{a as qs,b as Hs,c as ui,S as Cn,d as qa,e as Qu,r as pt,D as Ju,f as Yu,h as st,g as no,i as ro,j as oo,k as lo,l as co,m as uo,n as mo,T as ho,o as Aa,p as Zu,q as ea,L as Xu,s as po,E as em}from"../DkAH6N0u.js";import"./booking-pt2ctFRd.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}
1function s(n){if(n.ep)return;n.ep=!0;const r=t(n);fetch(n.href,r)}})();const tm="modulepreload",im=function(i){return"/"+i},Pn={},q=function(a,t,s){let n=Promise.resolve();if(t&&t.length>0){const r=document.getElementsByTagName("link");n=Promise.all(t.map(o=>{if(o=im(o),o in Pn)return;Pn[o]=!0;const d=o.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(!!s)for(let m=r.length-1;m>=0;m--){const h=r[m];if(h.href===o&&(!d||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${u}`))return;const l=document.createElement("link");if(l.rel=d?"stylesheet":tm,d||(l.as="script",l.crossOrigin=""),l.href=o,document.head.appendChild(l),d)return new Promise((m,h)=>{l.addEventListener("load",m),l.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${o}`)))})}))}return n.then(()=>a()).catch(r=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=r,window.dispatchEvent(o),!o.defaultPrevented)throw r})};let vo=class{constructor(){this.Title="My wallet",this.Errore="There were problems retrieving data. Please, retry.",this.ErroreAutorizzazione="User unauthorized",this.NessunBorsellinoAssociato="You haven't already associated a wallet!",this.RiferimentoBiglietto="Ref. ticket",this.RiferimentoAbbonamento="Ref. subscription",this.Data="Date",this.Descrizione="Description",this.Importo="Amount",this.TipoOperazione="Type",this.TagliRicarica="Recharge amount",this.Status="Status",this.OpTypeRicarica="Recharge",this.OpTypeRimborso="Refund",this.OpTypePagamento="Payment",this.WalletState="Wallet state",this.RechargeAmount="Recharge amount",this.ToPayAmount="To pay",this.CreateWallet="Create your wallet",this.NotIterestedToRegister="Not interested in additional services?"}};vo.id="EndUserWallet";let Ks=class{constructor(){this.Title="Il mio borsellino",this.Errore="Si sono verificati problemi nel recupero dei dati del borsellino elettronico. Riprova.",this.ErroreAutorizzazione="Utente non autorizzato",this.NessunBorsellinoAssociato="Non hai ancora un borsellino associato al tuo account!",this.RiferimentoBiglietto="Rif.to biglietto",this.RiferimentoAbbonamento="Rif.to abbonamento",this.Data="Data",this.Descrizione="Descrizione",this.Importo="Importo",this.TipoOperazione="Tipo",this.TagliRicarica="Tagli di ricarica",this.Status="Status",this.OpTypeRicarica="Ricarica",this.OpTypeRimborso="Rimborso",this.OpTypePagamento="Pagamento",this.WalletState="Stato borsellino",this.RechargeAmount="Importo Ricarica",this.ToPayAmount="Importo da pagare",this.CreateWallet="Crea il tuo borsellino"}};Ks.id="EndUserWallet";let go=class{constructor(){this.Title="Mein Portemonnaie",this.Errore="Fehler sind bei der Wiederbeschaffung der Daten in Bezug auf das elektronische Portemonnaie aufgetreten. Erneut probieren.",this.ErroreAutorizzazione="Nicht autorisierter Benutzer",this.NessunBorsellinoAssociato="Sie haben kein Portemonnaie mit Ihrem Account kombiniert!",this.RiferimentoBiglietto="bezüglich der Fahrkarte",this.RiferimentoAbbonamento="bezüglich dem Abo",this.Data="Datum",this.Descrizione="Beschreibung",this.Importo="Betrag",this.TipoOperazione="Typ",this.TagliRicarica="Guthaben kürzen",this.Status="Status",this.OpTypeRicarica="Guthaben",this.OpTypeRimborso="Rückvergütung",this.OpTypePagamento="bezahlt",this.WalletState="Portemonnaiestand",this.RechargeAmount="Betrag des Guthabens",this.ToPayAmount="Zu bezahlender Betrag",this.CreateWallet="Portemonnaie erstellen",this.NotIterestedToRegister="Keine Lust auf Zusatzleistungen?"}};go.id="EndUserWallet";let fo=class{constructor(){this.Title="Mon porte-monaie",this.Errore="Des problèmes se sont produits lors de la récupération des données de votre porte-monnaie électronique. Sâil vous plaît essayer à nouveau.",this.ErroreAutorizzazione="Utilisateur non autorisé",this.NessunBorsellinoAssociato="Vous nâavez pas encore un porte-monnaie associé à votre compte!",this.RiferimentoBiglietto="Réf. billet",this.RiferimentoAbbonamento="Réf. abonnement",this.Data="Data",this.Descrizione="Description",this.Importo="Montant",this.TipoOperazione="Type",this.TagliRicarica="Montants de recharge",this.Status="Status",this.OpTypeRicarica="Recharge",this.OpTypeRimborso="Remboursement",this.OpTypePagamento="Paiement",this.WalletState="Ãtat porte-monnaie",this.RechargeAmount="Montant Recharge",this.ToPayAmount="Montant à payer",this.CreateWallet="Créez votre porte-monnaie"}};fo.id="EndUserWallet";class xo{constructor(){this.Title="Mi monedero",this.Errore="Se produjeron problemas al recuperar los datos del monedero electrónico. Intente de nuevo.",this.ErroreAutorizzazione="Usuario no autorizado",this.NessunBorsellinoAssociato="¡Aún no tienes un monedero asociado a tu cuenta!",this.RiferimentoBiglietto="Ref. billete",this.RiferimentoAbbonamento="Ref. abono",this.Data="Fecha",this.Descrizione="Descripción",this.Importo="Importe",this.TipoOperazione="Tipo",this.TagliRicarica="Importes de recarga",this.Status="Estado",this.OpTypeRicarica="Recarga",this.OpTypeRimborso="Reembolso",this.OpTypePagamento="Pago",this.WalletState="Estado del monedero",this.RechargeAmount="Importe de recarga",this.ToPayAmount="Importe a pagar",this.CreateWallet="Crea tu monedero"}}xo.id="EndUserWallet";let Qs=class{constructor(){this.ScopriMarinobus="Scopri Marinobus",this.ChiSiamo="Chi siamo",this.GliAutobusMarinobus="Gli autobus Marinobus",this.NoleggiaAutobus="Noleggia un autobus",this.LavoraConNoi="Lavora con noi",this.AreaStampa="Area stampa",this.IlTuoProssimoViaggio="Il tuo prossimo viaggio",this.DestinazioneFermate="Destinazioni e fermate",this.ProtocolloCovid="Protocollo di sicurezza Covid-19",this.CercaAgenzie="Cerca agenzie",this.Assistenza="Assistenza",this.Modulistica="Modulistica",this.Certificazioni="Certificazioni",this.CondizioniServizio="Condizioni di servizio",this.Faq="Domande frequenti | FAQ",this.CartaDeiServizi="
1Carta dei servizi",this.MetodiPagamento="Metodi di Pagamento",this.ReclamiSegnalazioni="Reclami e segnalazioni",this.Destinazioni="Destinazioni",this.AgevolazioniTariffe="Agevolazioni Tariffe",this.Orari="Orari",this.Contatti="Contatti",this.Offerte="Offerte",this.Allegati="Allegati",this.Azienda="Azienda",this.LaNostraStoria="La nostra storia",this.Qualita="Qualità ",this.PoliticaSgi="Politica SGI",this.Avvisi="Avvisi",this.Servizi="Servizi",this.Promozioni="Promozioni",this.Noleggio="Noleggio",this.LineeIntercity="Linee Intercity",this.TerminiCondizioni="Termini e condizioni",this.LineeTpl="Linee TPL",this.BiglietterieTpl="Biglietterie TPL",this.OggettiSmarriti="Oggetti smarriti",this.Reclami="Reclami",this.Loading="Caricamento in corso",this.Indietro="Indietro",this.ScaricaPdf="Scarica PDF",this.BNOrariTraghettiElba="Orari Traghetti isola d'Elba",this.BNPartiPrima="Parti prima o parti dopo",this.BNNaviTempoReale="Navi in tempo reale",this.BNWhatsapp="Scrivici su Whatsapp",this.BNLinkOfferte="https://blunavytraghetti.com/offerte-sconti-traghetti-elba/",this.BNLinkOrari="https://blunavytraghetti.com/orari-traghetti-isola-elba/",this.BNLinkPartiPrima="https://blunavytraghetti.com/parti-prima-o-parti-dopo/",this.BNLinkTempoReale="https://blunavytraghetti.com/rotta-in-tempo-reale/",this.BNLinkContatti="https://blunavytraghetti.com/contatti/",this.BNLinkWhatsapp="https://api.whatsapp.com/send?phone=390565269710",this.BNLinKFaq="https://blunavytraghetti.com/faq/",this.ICHTratteOrari="TRATTE E ORARI",this.ICHBon="Porto di Bonifacio",this.ICHStg="Porto di Santa Teresa di Gallura",this.ICHVedi="Vedi Tratte",this.ICHConvenzioni="CONVENZIONI",this.ICHChiSiamo="CHI SIAMO",this.ICHAssistenza="ASSISTENZA",this.ICHDomFreq="Domande Frequenti",this.ICHRimborsi="Rimborsi",this.ICHReclami="Reclami",this.ICHFattura="Fattura",this.ICHBlog="BLOG",this.ICHContatti="CONTATTI",this.SAISInfoPrenotazioni=`Info e 2prenotazioni`,this.SAISAiuto="Aiuto"}};Qs.id="HeaderNavs";let bo=class{constructor(){this.ScopriMarinobus="Meet Marinobus",this.ChiSiamo="Our company",this.GliAutobusMarinobus="Marinobus buses",this.NoleggiaAutobus="Rent a bus",this.LavoraConNoi="Careers - Join us",this.AreaStampa="Press area",this.IlTuoProssimoViaggio="Your next travel",this.DestinazioneFermate="Stops and destinations",this.ProtocolloCovid="Covid-19 Safety Informations",this.CercaAgenzie="Search Ticket Point",this.Assistenza="Help",this.Modulistica="Forms",this.Certificazioni="Certifications",this.CondizioniServizio="Travel conditions",this.Faq="Frequent ask | FAQ",this.CartaDeiServizi="Service card",this.MetodiPagamento="Payment method",this.ReclamiSegnalazioni="Complaints",this.Destinazioni="Destinations",this.AgevolazioniTariffe="Fare Reductions",this.Orari="Timetable",this.Contatti="Contacts",this.Offerte="Offerte",this.Allegati="Attachments",this.Azienda="Company",this.LaNostraStoria="Our story",this.Qualita="Quality",this.PoliticaSgi="SGI Policies",this.Avvisi="News",this.Servizi="Services",this.Promozioni="Promotions",this.Noleggio="Rent",this.LineeIntercity="Intercity lines",this.TerminiCondizioni="Terms and conditions",this.LineeTpl="TPL lines",this.BiglietterieTpl="TPL ticket office",this.OggettiSmarriti="Lost items",this.Reclami="Complaints",this.Loading="Loading",this.Indietro="Back",this.ScaricaPdf="Download PDF",this.BNOrariTraghettiElba="Ferry timetables for the Island of Elba",this.BNPartiPrima="Leave earlier or leave later",this.BNNaviTempoReale="Ships in real time",this.BNWhatsapp="Message us on WhatsApp",this.BNLinkOfferte="https://blunavytraghetti.com/en/elba-ferry-offers-discounts/",this.BNLinkOrari="https://blunavytraghetti.com/en/elba-island-ferry-schedules/",this.BNLinkPartiPrima="https://blunavytraghetti.com/en/leave-earlier-or-leave-later/",this.BNLinkTempoReale="https://blunavytraghetti.com/en/route-in-real-time/",this.BNLinkContatti="https://blunavytraghetti.com/en/contact/",this.BNLinkWhatsapp="https://api.whatsapp.com/send?phone=390565269710",this.BNLinKFaq="https://blunavytraghetti.com/en/faq/",this.ICHTratteOrari="ROUTES AND TIMETABLES",this.ICHBon="Port of Bonifacio",this.ICHStg="Port of Santa Teresa Gallura",this.ICHVedi="View Routes",this.ICHConvenzioni="AGREEMENTS",this.ICHChiSiamo="ABOUT US",this.ICHAssistenza="SUPPORT",this.ICHDomFreq="Frequently Asked Questions",this.ICHRimborsi="Refunds",this.ICHReclami="Complaints",this.ICHFattura="Invoice",this.ICHBlog="BLOG",this.ICHContatti="CONTACTS",this.SAISInfoPrenotazioni=`Info & 3bookings`,this.SAISAiuto="Help"}};bo.id="HeaderNavs";let yo=class{constructor(){this.ScopriMarinobus="Meet Marinobus",this.ChiSiamo="Our company",this.GliAutobusMarinobus="Marinobus buses",this.NoleggiaAutobus="Rent a bus",this.LavoraConNoi="Careers - Join us",this.AreaStampa="Press area",this.IlTuoProssimoViaggio="Your next travel",this.DestinazioneFermate="Stops and destinations",this.ProtocolloCovid="Covid-19 Safety Informations",this.CercaAgenzie="Search Ticket Point",this.Assistenza="Aide",this.Modulistica="Forms",this.Certificazioni="Certifications",this.CondizioniServizio="Travel conditions",this.Faq="Questions fréquentes | FAQ",this.CartaDeiServizi="Service card",this.MetodiPagamento="Payment method",this.ReclamiSegnalazioni="Complaints",this.Destinazioni="Destinations",this.AgevolazioniTariffe="Fare Reductions",this.Orari="Horaires",this.Contatti="Nous contacter",this.Offerte="Offres",this.Allegati="Pièces jointes",this.Azienda="Company",this.LaNostraStoria="Our story",this.Qualita="Quality",this.PoliticaSgi="SGI Policies",this.Avvisi="News",this.Servizi="Services",this.Promozioni="Promotions",this.Noleggio="Rent",this.LineeIntercity="Intercity lines",this.TerminiCondizioni="Terms and conditions",this.LineeTpl="TPL lines",this.BiglietterieTpl="TPL ticket office",this.OggettiSmarriti="Lost items",this.Reclami="Complaints",this.Loading="Loading",this.Indietro="Back",this.ScaricaPdf="Download PDF",this.BNOrariTraghettiElba="Horaires des ferrys île d'Elbe",this.BNPartiPrima="Partez avant ou après",this.BNNaviTempoReale="Nos ferrys en temps réel",this.BNWhatsapp="
3Ãcrivez-nous sur WhatsApp",this.BNLinkOfferte="https://blunavytraghetti.com/fr/offres-reductions-ferries-elbe/",this.BNLinkOrari="https://blunavytraghetti.com/fr/horaires-des-ferrys-ile-delbe/",this.BNLinkPartiPrima="https://blunavytraghetti.com/fr/partez-avant-ou-apres/",this.BNLinkTempoReale="https://blunavytraghetti.com/fr/nos-ferrys-en-temps-reel/",this.BNLinkContatti="https://blunavytraghetti.com/fr/contact/",this.BNLinkWhatsapp="https://api.whatsapp.com/send?phone=390565269710",this.BNLinKFaq="https://blunavytraghetti.com/fr/faq/",this.ICHTratteOrari="TRAJETS ET HORAIRES",this.ICHBon="Port de Bonifacio",this.ICHStg="Port de Santa Teresa Gallura",this.ICHVedi="Voir les trajets",this.ICHConvenzioni="CONVENTIONS",this.ICHChiSiamo="QUI SOMMES-NOUS",this.ICHAssistenza="ASSISTANCE",this.ICHDomFreq="Questions Fréquemment Posées",this.ICHRimborsi="Remboursements",this.ICHReclami="Réclamations",this.ICHFattura="Facture",this.ICHBlog="BLOG",this.ICHContatti="CONTACTS",this.SAISInfoPrenotazioni=`Info et 4réservations`,this.SAISAiuto="Aide"}};yo.id="HeaderNavs";let jo=class{constructor(){this.ScopriMarinobus="Meet Marinobus",this.ChiSiamo="Our company",this.GliAutobusMarinobus="Marinobus buses",this.NoleggiaAutobus="Rent a bus",this.LavoraConNoi="Careers - Join us",this.AreaStampa="Press area",this.IlTuoProssimoViaggio="Your next travel",this.DestinazioneFermate="Stops and destinations",this.ProtocolloCovid="Covid-19 Safety Informations",this.CercaAgenzie="Search Ticket Point",this.Assistenza="Hilfe",this.Modulistica="Forms",this.Certificazioni="Certifications",this.CondizioniServizio="Travel conditions",this.Faq="Häufig gestellte Fragen | FAQ",this.CartaDeiServizi="Service card",this.MetodiPagamento="Payment method",this.ReclamiSegnalazioni="Complaints",this.Destinazioni="Destinations",this.AgevolazioniTariffe="Fare Reductions",this.Orari="Fahrpläne",this.Contatti="Contacts",this.Offerte="Angebote",this.Allegati="Anhänge",this.Azienda="Company",this.LaNostraStoria="Our story",this.Qualita="Quality",this.PoliticaSgi="SGI Policies",this.Avvisi="News",this.Servizi="Services",this.Promozioni="Promotions",this.Noleggio="Rent",this.LineeIntercity="Intercity lines",this.TerminiCondizioni="Terms and conditions",this.LineeTpl="TPL lines",this.BiglietterieTpl="TPL ticket office",this.OggettiSmarriti="Lost items",this.Reclami="Complaints",this.Loading="Loading",this.Indietro="Back",this.ScaricaPdf="Download PDF",this.BNOrariTraghettiElba="Fahrpläne der Fähren zur Insel Elba",this.BNPartiPrima="Frühere oder spätere Abfahrt",this.BNNaviTempoReale="Schiffe in Echtzeit",this.BNWhatsapp="Schreib uns bei WhatsApp",this.BNLinkOfferte="https://blunavytraghetti.com/de/elba-faehrenangebote-rabatte/",this.BNLinkOrari="https://blunavytraghetti.com/de/fahrplaene-der-faehren-nach-elba/",this.BNLinkPartiPrima="https://blunavytraghetti.com/de/gehe-vorher-oder-nachher/",this.BNLinkTempoReale="https://blunavytraghetti.com/de/die-route-in-echtzeit/",this.BNLinkContatti="https://blunavytraghetti.com/de/kontakte/",this.BNLinkWhatsapp="https://api.whatsapp.com/send?phone=390565269710",this.BNLinKFaq="https://blunavytraghetti.com/de/faq/",this.ICHTratteOrari="STRECKEN UND ZEITPLÃNE",this.ICHBon="Hafen von Bonifacio",this.ICHStg="Hafen von Santa Teresa Gallura",this.ICHVedi="Strecken anzeigen",this.ICHConvenzioni="VEREINBARUNGEN",this.ICHChiSiamo="ÃBER UNS",this.ICHAssistenza="KUNDENDIENST",this.ICHDomFreq="Häufige Fragen",this.ICHRimborsi="Erstattungen",this.ICHReclami="Beschwerden",this.ICHFattura="Rechnung",this.ICHBlog="BLOG",this.ICHContatti="KONTAKTE",this.SAISInfoPrenotazioni=`Info & 5Buchungen`,this.SAISAiuto="Hilfe"}};jo.id="HeaderNavs";class So{constructor(){this.ScopriMarinobus="Descubre Marinobus",this.ChiSiamo="Quiénes somos",this.GliAutobusMarinobus="Los autobuses Marinobus",this.NoleggiaAutobus="Alquila un autobús",this.LavoraConNoi="Trabaja con nosotros",this.AreaStampa="Ãrea de prensa",this.IlTuoProssimoViaggio="Tu próximo viaje",this.DestinazioneFermate="Destinos y paradas",this.ProtocolloCovid="Protocolo de seguridad Covid-19",this.CercaAgenzie="Buscar puntos de venta",this.Assistenza="Asistencia",this.Modulistica="Formularios",this.Certificazioni="Certificaciones",this.CondizioniServizio="Condiciones de viaje",this.Faq="Preguntas frecuentes | FAQ",this.CartaDeiServizi="
5Carta de servicios",this.MetodiPagamento="Métodos de pago",this.ReclamiSegnalazioni="Reclamaciones",this.Destinazioni="Destinos",this.AgevolazioniTariffe="Descuentos y tarifas",this.Orari="Horarios",this.Contatti="Contactos",this.Offerte="Ofertas",this.Allegati="Archivos adjuntos",this.Azienda="Empresa",this.LaNostraStoria="Nuestra historia",this.Qualita="Calidad",this.PoliticaSgi="PolÃtica SGI",this.Avvisi="Avisos",this.Servizi="Servicios",this.Promozioni="Promociones",this.Noleggio="Alquiler",this.LineeIntercity="LÃneas Intercity",this.TerminiCondizioni="Términos y condiciones",this.LineeTpl="LÃneas TPL",this.BiglietterieTpl="Taquillas TPL",this.OggettiSmarriti="Objetos perdidos",this.Reclami="Reclamaciones",this.Loading="Cargando",this.Indietro="Atrás",this.ScaricaPdf="Descargar PDF",this.BNOrariTraghettiElba="Horarios de ferris para la Isla de Elba",this.BNPartiPrima="Sal antes o después",this.BNNaviTempoReale="Barcos en tiempo real",this.BNWhatsapp="EnvÃanos un mensaje por WhatsApp",this.BNLinkOfferte="https://blunavytraghetti.com/en/elba-ferry-offers-discounts/",this.BNLinkOrari="https://blunavytraghetti.com/en/elba-island-ferry-schedules/",this.BNLinkPartiPrima="https://blunavytraghetti.com/en/leave-earlier-or-leave-later/",this.BNLinkTempoReale="https://blunavytraghetti.com/en/route-in-real-time/",this.BNLinkContatti="https://blunavytraghetti.com/en/contact/",this.BNLinkWhatsapp="https://api.whatsapp.com/send?phone=390565269710",this.BNLinKFaq="https://blunavytraghetti.com/es/faq/",this.ICHTratteOrari="RUTAS Y HORARIOS",this.ICHBon="Puerto de Bonifacio",this.ICHStg="Puerto de Santa Teresa Gallura",this.ICHVedi="Ver rutas",this.ICHConvenzioni="CONVENIOS",this.ICHChiSiamo="QUIÃNES SOMOS",this.ICHAssistenza="SOPORTE",this.ICHDomFreq="Preguntas frecuentes",this.ICHRimborsi="Reembolsos",this.ICHReclami="Reclamaciones",this.ICHFattura="Factura",this.ICHBlog="BLOG",this.ICHContatti="CONTACTOS",this.SAISInfoPrenotazioni=`Info y 6reservas`,this.SAISAiuto="Ayuda"}}So.id="HeaderNavs";let Ra=class{constructor(){this.ModalEyebrow="Area riservata",this.ModalTitle="Hai accesso all'Area Agenzie",this.ModalText="Abbiamo notato che il tuo account può accedere all'Area Agenzie: uno spazio dedicato con strumenti professionali pensati per la tua attività , molto più completi rispetto al booking standard.",this.ModalAdvIntro="Nell'Area Agenzie puoi:",this.ModalAdvIssue="Emettere biglietti, abbonamenti e bagagli",this.ModalAdvSearch="Cercare e gestire i biglietti emessi",this.ModalAdvNetwork="Gestire la tua rete vendita e le anagrafiche",this.ModalAdvReports="Consultare report e movimenti di cassa",this.ModalAdvInvoicing="Gestire la fatturazione",this.ModalGoToAgency="Vai all'Area Agenzie",this.ModalContinueBooking="Continua su Booking",this.InviteTitle="Sei un'agenzia di viaggio?",this.InviteRegister="Registra agenzia",this.InviteLogin="Accedi all'Area Agenzie",this.BannerText="Fatturazione automatica e gestione prenotazioni dedicata."}};Ra.id="AgencyArea";let No=class{constructor(){this.ModalEyebrow="Reserved area",this.ModalTitle="You have access to the Agency Area",this.ModalText="We noticed your account can access the Agency Area: a dedicated space with professional tools built for your business, far more complete than the standard booking.",this.ModalAdvIntro="In the Agency Area you can:",this.ModalAdvIssue="Issue tickets, passes and luggage",this.ModalAdvSearch="Search and manage issued tickets",this.ModalAdvNetwork="Manage your sales network and customers",this.ModalAdvReports="View reports and cash movements",this.ModalAdvInvoicing="Manage invoicing",this.ModalGoToAgency="Go to the Agency Area",this.ModalContinueBooking="Continue on Booking",this.InviteTitle="Are you a travel agency?",this.InviteRegister="Register agency",this.InviteLogin="Access the Agency Area",this.BannerText="Automatic invoicing and dedicated booking management."}};No.id="AgencyArea";let wo=class{constructor(){this.ModalEyebrow="Espace réservé",this.ModalTitle="Vous avez accès à l'Espace Agences",this.ModalText="Nous avons remarqué que votre compte peut accéder à l'Espace Agences : un espace dédié avec des out
6ils professionnels conçus pour votre activité, bien plus complets que le booking standard.",this.ModalAdvIntro="Dans l'Espace Agences, vous pouvez :",this.ModalAdvIssue="Ãmettre des billets, abonnements et bagages",this.ModalAdvSearch="Rechercher et gérer les billets émis",this.ModalAdvNetwork="Gérer votre réseau de vente et vos clients",this.ModalAdvReports="Consulter les rapports et mouvements de caisse",this.ModalAdvInvoicing="Gérer la facturation",this.ModalGoToAgency="Accéder à l'Espace Agences",this.ModalContinueBooking="Continuer sur Booking",this.InviteTitle="Vous êtes une agence de voyage ?",this.InviteRegister="Inscrire l'agence",this.InviteLogin="Accéder à l'Espace Agences",this.BannerText="Facturation automatique et gestion des réservations dédiée."}};wo.id="AgencyArea";let Co=class{constructor(){this.ModalEyebrow="Reservierter Bereich",this.ModalTitle="Sie haben Zugriff auf den Agenturbereich",this.ModalText="Wir haben festgestellt, dass Ihr Konto auf den Agenturbereich zugreifen kann: ein eigener Bereich mit professionellen Werkzeugen für Ihr Geschäft, deutlich umfassender als das Standard-Booking.",this.ModalAdvIntro="Im Agenturbereich können Sie:",this.ModalAdvIssue="Tickets, Abonnements und Gepäck ausstellen",this.ModalAdvSearch="Ausgestellte Tickets suchen und verwalten",this.ModalAdvNetwork="Ihr Vertriebsnetz und Kunden verwalten",this.ModalAdvReports="Berichte und Kassenbewegungen einsehen",this.ModalAdvInvoicing="Die Rechnungsstellung verwalten",this.ModalGoToAgency="Zum Agenturbereich",this.ModalContinueBooking="Weiter auf Booking",this.InviteTitle="Sind Sie ein Reisebüro?",this.InviteRegister="Agentur registrieren",this.InviteLogin="Zum Agenturbereich",this.BannerText="Automatische Rechnungsstellung und dedizierte Buchungsverwaltung."}};Co.id="AgencyArea";class Po{constructor(){this.ModalEyebrow="Ãrea reservada",this.ModalTitle="Tienes acceso al Ãrea de Agencias",this.ModalText="Hemos detectado que tu cuenta puede acceder al Ãrea de Agencias: un espacio dedicado con herramientas profesionales pensadas para tu actividad, mucho más completas que el booking estándar.",this.ModalAdvIntro="En el Ãrea de Agencias puedes:",this.ModalAdvIssue="Emitir billetes, abonos y equipaje",this.ModalAdvSearch="Buscar y gestionar los billetes emitidos",this.ModalAdvNetwork="Gestionar tu red de venta y los clientes",this.ModalAdvReports="Consultar informes y movimientos de caja",this.ModalAdvInvoicing="Gestionar la facturación",this.ModalGoToAgency="Ir al Ãrea de Agencias",this.ModalContinueBooking="Continuar en Booking",this.InviteTitle="¿Eres una agencia de viajes?",this.InviteRegister="Registrar agencia",this.InviteLogin="Acceder al Ãrea de Agencias",this.BannerText="Facturación automática y gestión de reservas dedicada."}}Po.id="AgencyArea";var Ce={};De(Ce,"en",au);De(Ce,"en",su);De(Ce,"en",vo);De(Ce,"en",bo);De(Ce,"en",No);De(Ce,"it",Q);De(Ce,"it",ne);De(Ce,"it",Ks);De(Ce,"it",Qs);De(Ce,"it",Ra);De(Ce,"de",nu);De(Ce,"de",ru);De(Ce,"de",go);De(Ce,"de",jo);De(Ce,"de",Co);De(Ce,"fr",ou);De(Ce,"fr",lu);De(Ce,"fr",fo);De(Ce,"fr",yo);De(Ce,"fr",wo);De(Ce,"es",du);De(Ce,"es",cu);De(Ce,"es",xo);De(Ce,"es",So);De(Ce,"es",Po);var am=Ce,sm=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Ha="selectedFareCategories";class Wt{static getOutboundRequest(a){return{dep:a.dep,arr:a.arr,date:k.fromCompactDateString(a.depd)}}static getReturnRequest(a){return a.retd?{dep:a.arr,arr:a.dep,date:k.fromCompactDateString(a.retd)}:void 0}static getCategories(a,t){var s=te.maxEndUserPassengers;const n=new Bi(a),r=[Qe.GetDefaultFareCategory(),...t];if(Object.keys(n.Parsed).find(c=>c==Ha))return JSON.parse(n.Parsed[Ha]).map(l=>Fe.FromRequest(l,r));const o=r.filter(c=>c.tenants.includes(te.environmentName));let d=Object.keys(n.Parsed).map(c=>{const l=o.findIndex(m=>V.invariantEquals(c,m.description));if(l!=-1){const m=+(n.Parsed[c]||0);return{category:o[l],total:m}}else{const m=r.findIndex(h=>V.invariantEquals(c,h.description));if(m!=-1){const h=+(n.Parsed[c]||0);return{category:r[m],total:h}}else return null}}).filter(c=>c!=null);d.length==0&&(d=[{category:Qe.GetDefaultFareCategory(),total:1}]);let u=[];for(const c of ni(d,l=>l.category.type).filter((l,m)=>m<=s-1))for(let l=0;l<c.total;l++)u=Ut.onAdd(c.category,u,r,{});return u}static getQuery(a,t){var s;let n={};const r=mt(it(a,d=>d.subGroupId),(d,u)=>
6({key:u,tot:d.length})).some(d=>d.tot>1);if(a.some(d=>d.extra!=null&&Object.keys(d.extra).length>0)||r){const d=a.map(u=>Fe.ToRequest(u));n[Ha]=JSON.stringify(d)}else mt(it(a,d=>d.category.id),d=>{var u,c;return n[(c=(u=t.find(l=>l.id==d[0].category.id))===null||u===void 0?void 0:u.description)!==null&&c!==void 0?c:Qe.GetDescription(null)]=d.length.toString()});const o=(s=new URLSearchParams(window.location.search))===null||s===void 0?void 0:s.get("referral");return o&&(n.referral=o),n}static getSearchData(a){return sm(this,void 0,void 0,function*(){const t=a.passengerReservations[0].tickets[0],s=a.passengerReservations[0].tickets[1],n={};let r;return cs.isInitialized()?r=cs.getall():r=yield uu.GetAll(),Tl(it(a.passengerReservations,d=>d.passenger.fareCategoryId),(d,u)=>{var c,l;return n[(l=(c=r.find(m=>m.id==u))===null||c===void 0?void 0:c.description)!==null&&l!==void 0?l:Qe.GetDefaultFareCategory().description]=d.length}),{departureId:t.segments[0].departureId,arrivalId:t.segments[t.segments.length-1].arrivalId,outboundDate:k.ToDate(t.segments[0].departureTime),returnDate:t.segments[0]&&k.ToDate(s==null?void 0:s.segments[0].departureTime),query:n}})}static getPassengers(a,t){const s=a.filter(u=>u.category.type==0),n=[];for(var r=0;r<s.length;++r){let u=s[r];var o=t&&r==0&&r==0?t.name:"",d=t&&r==0&&r==0?t.surname:"";n.push(new Ur({fareCategoryId:u.category.id,name:o,notes:"",surname:d,nominal:!1,hasDisabilities:!1,personId:void 0}))}return n}}const Ma=()=>{const{dep:i,arr:a,depd:t,retd:s}=qi(),n=Ms.useAll(),{search:r}=Kt(),{dep:o,arr:d}=Vr(i??"",a??""),u=n!=null?Wt.getCategories(r,n):null;return{departure:o,arrival:d,departureDate:t?k.fromCompactDateString(t):null,returnDate:s?k.fromCompactDateString(s):null,selectedFareCategories:u,channel:1}};let nm=Qi.ResponsiveCombo(),rm=Qi.ResponsiveCombo();const ha=i=>{const a=P.useRef(null);return e.jsxs("div",{className:"booking-search input-group fw-bold text-medium border-primary-light w-100",children:[e.jsx("span",{className:"input-group-text border-0 text-primary flex-shrink-0",children:e.jsx("i",{className:i.departure?"fa-solid fa-location-dot":"fa-regular fa-flag"})}),e.jsx("input",{className:"form-control border-0 py-2",style:{minWidth:0},value:i.value,ref:a,onChange:t=>{var s;return i.onChange((s=t.target)===null||s===void 0?void 0:s.value)},onFocus:i.onFocus,readOnly:i.readonly,placeholder:i.placeholder}),e.jsx("button",{type:"button",onClick:t=>{var s;t.stopPropagation(),t.preventDefault(),(s=a.current)===null||s===void 0||s.focus(),i.onChange(null)},title:"Rimuovi selezione",className:"input-group-text border-0 pe-4 bg-transparent flex-shrink-0",children:e.jsx("i",{className:"fas fa-times text-danger"})})]})},Oa=_(class extends P.PureComponent{constructor(){super(...arguments),this.getI18nStopDescription=a=>{var t,s,n,r,o;const d=(r=(t=this.props.hl)===null||t===void 0?void 0:t.toUpperCase().trim())!==null&&r!==void 0?r:"IT";return(o=(n=(s=a.names)===null||s===void 0?void 0:s.find(u=>u.country===d))===null||n===void 0?void 0:n.name)!==null&&o!==void 0?o:a.description},this.CustomInputDeparture=a=>e.jsx(ha,Object.assign({},a,{departure:!0}))}render(){const{departures:a,arrivals:t,departureValue:s,arrivalValue:n,onSelectDeparture:r,onSelectArrival:o,disable:d,onExchangeDepartureArrival:u,size:c}=this.props;var{formatMessage:l}=this.props.i18n.get(ie),m=a!=null&&a.filter(f=>!f.isZoneType)||[],h=t!=null&&t.filter(f=>!f.isZoneType)||[];return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:gr("col-12 d-flex pe-lg-0 mb-1 mb-lg-0",(s==null?void 0:s.isZoneType)!=!0?"col-lg-6":"col-lg-12"),children:e.jsx("div",{className:"flex-fill",children:e.jsx(nm,{placeholder:l(f=>f.PartenzaPlaceholder),data:m||[],busy:!a,value:s||null,textField:f=>this.getI18nStopDescription(f),idSelector:f=>f.id,allowNull:!0,onSelect:r,readonly:d,style:{height:c},customInput:this.CustomInputDeparture,noMargin:!0})})}),(s==null?void 0:s.isZoneType)!=!0&&e.jsxs("div",{className:"col-12 col-lg-6 d-flex ps-lg-0 mb-1 mb-lg-0",children:[e.jsx("div",{className:"d-none d-lg-flex col-auto align-items-center justify-content-center px-2",children:e.jsx("a",{onClick:u,className:"bg-white py-1",children:e.jsx("i",{className:"fas fa-exchange-alt fa-lg text-primary"})})}),e.jsx("div",{className:"flex-fill",children:e.jsx(rm,{placeholder:l(f=>f.ArrivalPlaceholder),data:h||[],busy:!t,value:n||null,textField:f=>this.getI18nStopDescription(f),idSelector:f=>f.id,allowNull:!0,onSelect:o,readonly:d,style:{height:c},customInput:ha,noMargin:!0})})]})]})}}),om=i=>e.jsxs("div",{children:[i.label&&e.jsx("label",{className:"form-label",children:i.label}),e.jsx(Do,Object.assign({},i))]}),Do=i=>{var a="input-group p-1 border border-info rounded flex-nowrap";return i.class&&(a+=` ${i.class}`),e.jsxs("div",{className:a,style:{width:100},children:[e.jsx("button",{type:"button",className:"btn btn-link",onClick:i.onRemove,disabled:i.value==0,children:e.jsx("i",{className:"fas fa-minus text-info"})}),e.jsx("input",{style:{width:32},className:"text-center border-0 bg-white fw-bold text-info px-1",type:"text",readOnly:!0,value:i.value.toString()}),e.jsx("button",{type:"button",className:"btn btn-link",onClick:i.onAdd,disabled:i.onAdd==null,children:e.jsx("i",{className:"fas fa-plus text-info"})})]})};class lm extends P.PureComponent{render(){const{fareCategory:a,value:t,hl:s}=this.props;return a?e.jsx("div",{className:"border rounded p-2 mb-2",children:e.jsxs("div",{className:"d-flex justify-content-between align-items-center",title:Qe.GetDetailedDescription(a,s),children:[e.jsxs("div",{className:"d-flex flex-nowrap align-items-center p-2",children:[e.jsx("div",{children:e.jsx(Ji,{id:a.id,size:"2x",className:"me-2"})}),e.jsxs("div",{children:[e.jsx("span",{className:"fontsize-3u fw-bold",children:V.capitalize(Qe.GetDescription(a,s))}),a.link?e.jsx("a",{href:a.link,target:"_blank",children:e.jsx("i",{className:"fa-solid fa-circle-info text-info ms-1"})}):null,(a==null?void 0:a.subtitle)&&e.jsx("div",{className:"w-100 fontsize-3d",children:a.subtitle})]})]}),e.jsx(Do,{value:t,onAdd:this.props.onAdd,onRemove:this.props.onRemove})]})}):e.jsx("span",{})}}const Io=_(lm),dm=_(i=>{const{onAdd:a,onRemove:t,enabledCategories:s}=i,{formatMessage:n}=i.i18n.get(Q),r=te.maxEndUserPassengers<=i.selectedCategories.filter(d=>d.category.type==0).length,o=s.filter(d=>{var u;return d.type==0&&(((u=d.parents)===null||u===void 0?void 0:u.length)==0||d.parents.find(c=>i.selectedCategories.find(l=>c.id==l.category.id)))}).map(d=>{var u=i.selectedCategories.filter(p=>p.category.id==d.id);const c=u&&u.length||0;let l;if(d&&d.parents.length>0){var m=d.parents.filter(p=>i.selectedCategories.find(g=>g.category.id==p.id)),h=i.selectedCategories.filter(p=>p.category.type==0&&m.find(g=>
6g.id==p.category.id)).length;m.every(p=>p.max)&&(l=ye(m.map(p=>{var g;return(g=p.max)!==null&&g!==void 0?g:0}),p=>p)*h)}const f=l!=null&&l>0&&l<=c||!1;return e.jsx("div",{children:e.jsx(Io,{fareCategory:d,onAdd:r||f?void 0:()=>a(d),onRemove:()=>t(d),value:c})},d.id)});return e.jsxs("div",{className:"d-flex flex-column justify-content-center",children:[o,r&&e.jsx("span",{className:"alert alert-danger fw-bold mt-2 text-center p-2",children:n(d=>d.CarrelloPieno)})]})}),cm=bt(_(i=>{var a,t,s,n;const{category:r,enabledCategories:o,extraParamsData:d,selection:u,onChange:c}=i,[l,m]=P.useState({extraData:ri.generateDefault((t=(a=r.extraParams)===null||a===void 0?void 0:a.map(f=>d[f.key]).filter(f=>f).map(f=>f))!==null&&t!==void 0?t:[]),selectedSubLuggages:[]}),h=r.extraParams!=null&&r.extraParams.some(f=>f.mandatory)&&ri.extraParamsErrors(i.extraParamsData,r.extraParams,l.extraData,i.i18n.get(Lt).formatMessage)!=null;return e.jsxs("div",{children:[e.jsxs("div",{className:"fw-bold fontsize-3u mb-2",children:[r.frontendIcon&&e.jsx("i",{className:`${r.frontendIcon} me-2`})," ",Qe.GetDescription(r,i.hl)]}),r.extraParams.some(f=>f.mandatory)&&e.jsx(Nd,{extraParams:(s=r.extraParams)!==null&&s!==void 0?s:[],extraData:(n=l.extraData)!==null&&n!==void 0?n:{},maxDepartureDate:new Date,onChange:f=>m(Object.assign(Object.assign({},l),{extraData:f}))}),(l.extraData||l.selectedSubLuggages)&&e.jsx("button",{className:"btn btn-primary w-100",onClick:()=>{let f=Ut.onAdd(r,u,o,d,void 0,l.extraData);for(const p of l.selectedSubLuggages)f=Ut.onAdd(p,f,o,d,void 0,l.extraData);c(f)},disabled:h,children:"Conferma"})]})}))(i=>i.allByKey(),"extraParamsData"),um=bt(_(et(i=>{const{onChange:a,enabledCategories:t,selectedCategories:s,extraParamsData:n}=i,[r,o]=P.useState(null);if(P.useEffect(()=>{o(null)},[]),!i.roles.find(c=>ce.canissueluggages.name==c))return null;const u=c=>{c.extraParams.some(l=>l.mandatory)?o(c):a(Ut.onAdd(c,s,t,n))};return r!=null?e.jsx(cm,{category:r,enabledCategories:t,selection:s,onChange:c=>{o(null),a(c)}}):e.jsx("div",{className:"d-flex flex-column justify-content-center",children:t.filter(c=>c.type==2&&Ut.isVehicleNonDependantOnAnotherVehicle(c.id,t)).map(c=>{let l=Fe.getMaxSelectableQuantity(c,s);if(l=="parentsneeded")return null;const m=Fe.getSelectedQty(c,s),h=l!=null&&m>=l;return e.jsx("div",{children:e.jsx(Io,{fareCategory:c,onAdd:h?void 0:()=>u(c),onRemove:()=>a(Ut.onRemove(c,s,t)),value:m})},c.id)}).filter(c=>c)})})))(i=>i.allByKey(),"extraParamsData"),pa=bt(_(i=>{const{selectedCategories:a,onChange:t}=i,s=Ms.useForSearchWithLuggages(i.arrival,i.departureDate,i.returnDate);if(s==null)return null;const n=[Qe.GetDefaultFareCategory(),...s],r=u=>{const c=Ut.onAdd(u,a,s,i.extraParamsData);i.onChange(c)},o=u=>{const c=Ut.onRemove(u,a,n);c&&i.onChange(c)},d=u=>{t(u)};return e.jsxs("div",{className:"d-flex flex-column justify-content-center responsive-popover",children:[i.mode=="passengers"&&e.jsx(e.Fragment,{children:e.jsx(dm,{enabledCategories:n,onAdd:r,onRemove:o,selectedCategories:a})}),i.mode=="vehicles"&&e.jsx("div",{children:e.jsx(um,{enabledCategories:n,onChange:d,selectedCategories:a})})]})}))(i=>i.allByKey(),"extraParamsData"),Vi=P.forwardRef(({value:i,onClick:a,label:t,disabled:s,isReturn:n,hasError:r},o)=>e.jsx("button",{ref:o,onClick:a,disabled:s,className:`w-100 btn py-2 ${r?"border border-danger":""} d-flex align-items-center justify-content-center fw-bold text-nowrap ${r?"animate__animated animate__headShake":""}`,children:e.jsxs("span",{className:`${r?"text-danger":s?"":"text-primary"}`,children:[e.jsx("i",{className:"fa-regular fa-calendar me-2"})," ",i||t]})})),Dn=_(i=>{const{selection:a,i18n:t}=i;var{formatMessage:s}=t.get(ie);const n=a.filter(o=>o.category.type==0).length,r=a.filter(o=>o.category.type==2).length;return r>0?e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsxs("div",{className:"me-3",children:[e.jsx("i",{className:"fa-regular fa-user text-primary me-1"}),n," ",s(n===1?o=>o.Passeggero:o=>
6o.Passeggeri)]}),e.jsxs("div",{children:[e.jsx("i",{className:"fa-solid fa-car text-primary me-1"}),r," ",s(r===1?o=>o.Vehicle:o=>o.Vehicles)]})]}):e.jsxs("div",{children:[e.jsx("i",{className:"fa-regular fa-user text-primary me-2"}),n," ",s(n===1?o=>o.Passeggero:o=>o.Passeggeri)]})}),mm=_(i=>{const{selection:a,i18n:t}=i;var{formatMessage:s}=t.get(ie);const n=a.filter(r=>r.category.type==0).length;return e.jsxs("div",{children:[e.jsx("i",{className:"fa-regular fa-user text-primary me-2"}),n," ",s(n===1?r=>r.Passeggero:r=>r.Passeggeri)]})}),hm=_(i=>{const{selection:a,i18n:t}=i;var{formatMessage:s}=t.get(ie);const n=a.filter(o=>o.category.type==2).length,r=()=>n==0?`${s(o=>o.HaiUnVeicolo)}?`:`${n} ${s(n===1?o=>o.Vehicle:o=>o.Vehicles)}`;return e.jsx("div",{className:"d-flex align-items-center",children:e.jsxs("div",{children:[e.jsx("i",{className:"fa-solid fa-car text-primary me-1"}),r()]})})});class pm extends P.PureComponent{constructor(){super(...arguments),this.outboundPicker=P.createRef(),this.returnPicker=P.createRef(),this.innerChangeDateTo=a=>{a&&this.props.onChangeDateTo(a)}}render(){var a,t,s,n,{formatMessage:r}=this.props.i18n.get(ie),o=this.props.i18n.get(Q).formatMessage;const{onChangeDateFrom:d,onChangeDepartureArrival:u,onClickReturn:c,onSearchSolutions:l,searchData:m,searchButton:h,outboundError:f,returnError:p,onChangePassengerSelection:g}=this.props;return e.jsx("div",{className:"container-fluid py-0",children:e.jsxs("div",{className:"row shadow justify-content-center border border border-primary bg-white rounded-2",children:[e.jsx("div",{className:"col-12 d-flex flex-column flex-lg-row align-items-center bg-white rounded-2 py-0 px-0",children:e.jsx("div",{className:"col-12 px-3 py-2",children:e.jsx(Pr,{onChange:c,return:(n=m.return)!==null&&n!==void 0?n:!1})})}),e.jsxs("div",{className:"row g-0 align-items-stretch bg-white rounded-2 p-0",children:[e.jsx("div",{className:`col-12 ${h?"col-lg-4":"col-lg-5"} border border-start border-top border-bottom border-primary order-1`,children:e.jsx(qs,{onSelect:u,selectedDeparture:m.departure,selectedArrival:m.arrival,component:Oa,combinationComponent:Hs})}),e.jsx("div",{className:"col-12 col-lg-3 order-2",children:e.jsxs("div",{className:"row g-0 h-100",children:[e.jsx("div",{className:"col-6 d-flex align-items-center border-start border-top border-bottom border-primary",children:e.jsx($i,{ref:this.outboundPicker,value:m.date,placeHolder:r(v=>v.Outbound),dateRange:ca.GetSearchPeriod(Temporal.Now.plainDateISO()),onSelectDate:v=>v&&d(v),enableDates:(s=(t=(a=m.arrival)===null||a===void 0?void 0:a.p2pTickets)===null||t===void 0?void 0:t.dates)===null||s===void 0?void 0:s.map(v=>k.ToPlainDate(k.fromDateOnlyString(v))),customInput:e.jsx(Vi,{label:f?r(v=>v.Select):o(v=>v.DepartureDate),hasError:f})})}),e.jsx("div",{className:"col-6 d-flex align-items-center border-start border-top border-bottom border-primary",children:e.jsx($i,{ref:this.returnPicker,value:m.return&&m.returnDate?m.returnDate:void 0,placeHolder:r(v=>v.Return),dateRange:m.date?ca.GetSearchPeriod(m.date):void 0,onSelectDate:this.innerChangeDateTo,customInput:e.jsx(Vi,{label:r(p?v=>v.Select:v=>v.DataDelViaggioRitorno),hasError:p,isReturn:!0})})})]})}),e.jsx("div",{className:"col-6 col-lg-2 d-flex align-items-center border border-primary order-3",children:e.jsx("div",{className:"flex-grow-1 w-100",children:e.jsx(da,{buttonClass:"btn w-100 py-2 fw-bold d-flex align-items-center justify-content-center rounded flex-wrap",buttonTemplate:e.jsx(mm,{selection:m.selectedFareCategories}),children:e.jsx(pa,{selectedCategories:m.selectedFareCategories,arrival:m.arrival,onChange:g,departureDate:m.date?k.PlainDateToDate(m.date):null,returnDate:m.returnDate?k.PlainDateToDate(m.returnDate):null,mode:"passengers"})})})}),e.jsx("div",{className:"col-6 col-lg-2 d-flex align-items-center border border-primary order-4",children:e.jsx("div",{className:"flex-grow-1 w-100",children:e.jsx(da,{buttonClass:"btn w-100 py-2 fw-bold d-flex align-items-center justify-content-center rounded flex-wrap",buttonTemplate:e.jsx(hm,{selection:m.selectedFareCategories}),children:e.jsx(pa,{selectedCategories:m.selectedFareCategories,arrival:m.arrival,onChange:g,departureDate:m.date?k.PlainDateToDate(m.date):null,returnDate:m.returnDate?k.PlainDateToDate(m.returnDate):null,mode:"vehicles"})})})}),h&&e.jsx("div",{className:"col-12 col-lg-1 d-flex align-items-stretch order-5",children:e.jsx("button",{type:"button",className:"btn btn-primary w-100 py-2",disabled:h.disabled,onClick:()=>l(m),children:h.label})})]})]})})}}const vm=_(pm);var gm=function(i,a,t,s){var n=arguments.length,r=n<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,t):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,a,t,s);else for(var d=i.length-1;d>=0;d--)(o=i[d])&&(r=(n<3?o(r):n>3?o(a,t,r):o(a,t))||r);return n>3&&r&&Object.defineProperty(a,t,r),r},Ka=function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)};const fm=new mu;class To{requestAll(){return fm.getAll()}}gm([Qt,Ka("design:type",Function),Ka("design:paramtypes",[]),Ka("design:returntype",void 0)],To.prototype,"requestAll",null);const In=new To;class xm extends Ki{constructor(){super(a=>a.id),this.sorted=()=>ni(this.getall(),a=>a.id),this.useAll=()=>this.useAllWithAction(()=>In.requestAll()),this.hasGroups=()=>{const a=this.getall();return a&&a.length>0},Si.onfunction(In.requestAll,a=>this.setAll(a))}}const Di=new xm;class bm{static GetDescription(a,t=null){return a?t==="en"?a.descriptionEn||a.description||"":t==="de"?a.descriptionDe||a.description||"":t==="fr"?a.descriptionFr||a.description||"":t==="es"?a.descriptionEs||a.description||"":a.description||"":""}}function _o({selectedTab:i,onTabChange:a,hl:t=null}){const s=Di.useAll();if(!s||s.length===0)return null;const n=s.length,r=d=>{const u=i===d,c=d===0,l=d===n-1;return{borderBottomWidth:u?0:void 0,borderTopLeftRadius:c?"0.5rem":void 0,borderTopRightRadius:l?"0.5rem":void 0,boxShadow:u&&c?"10px 0 5px -5px rgba(0,0,0,0.2)":u&&l?"-10px 0 5px -5px rgba(0,0,0,0.2)":u?"10px 0 5px -5px rgba(0,0,0,0.2), -10px 0 5px -5px rgba(0,0,0,0.2)":"",zIndex:u?1:void 0}},o=d=>{const u=i===d;let c="";return n===1?c="col-12":n===2?c="col-6 col-md-3":n===3?c="col-4":n===4?c="col-6 col-md-3":n===6?c="col-6 col-md-2":c="col-12 col-md-auto",`${`${c} d-flex align-items-center justify-content-center btn btn-light btn-highlight py-2 m-0 border-top border-left text-primary border-primary`} ${u?"bg-white":"bg-primary-light"}`};return e.jsx("div",{className:"row p-0",children:s.map((d,u)=>e.jsx("div",{className:o(u),style:r(u),onClick:()=>a(u),children:e.jsx("div",{className:"fs-5",children:bm.GetDescription(d,t)})},d.id))})}function ym(i){var a,t,s,n;const{formatMessage:r}=i.i18n.get(ie),o=i.i18n.get(Q).formatMessage,{onChangeDateFrom:d,onChangeDepartureArrival:u,onClickReturn:c,onSearchSolutions:l,searchData:m,searchButton:h,outboundError:f,returnError:p,onChangePassengerSelection:g,currentSaleGroupId:v,showTabs:x}=i,S=y=>{y&&i.onChangeDateTo(y)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-12 d-flex flex-column flex-lg-row align-items-centerpy-0 px-0",children:e.jsx("div",{className:`bg-white border border-top-0 border-primary border-left border-right col-12 ${x?"border-bottom-0 p-2":"border-bottom-0 rounded-top p-2"}`,children:e.jsx(Pr,{onChange:c,return:(n=m.return)!==null&&n!==void 0?n:!1})})}),e.jsxs("div",{className:"col-12 d-flex flex-column flex-lg-row align-items-stretch bg-white p-0 border border-primary rounded-bottom",children:[e.jsx("div",{className:`col-12 ${h?"col-lg-5":"col-lg-6"}`,children:e.jsx("div",{className:"row",children:e.jsx(qs,{onSelect:u,selectedDeparture:m.departure,selectedArrival:m.arrival,component:Oa,combinationComponent:Hs,saleGroupId:v})})}),e.jsx("div",{className:"col-12 d-lg-none border border-primary",children:e.jsx("div",{className:"flex-grow-1 w-100",children:e.jsx(da,{buttonClass:"btn w-100 py-2 fw-bold d-flex align-items-center justify-content-center rounded flex-nowrap text-nowrap",buttonTemplate:e.jsx(Dn,{selection:m.selectedFareCategories}),children:e.jsx(pa,{selectedCategories:m.selectedFareCategories,arrival:m.arrival,onChange:g,departureDate:m.date?k.PlainDateToDate(m.date):null,returnDate:m.returnDate?k.PlainDateToDate(m.returnDate):null,mode:"passengers"})})})}),e.jsxs("div",{className:"d-flex flex-column col-12 col-lg-6 flex-lg-row align-items-stretch w-lg-auto",children:[e.jsxs("div",{className:"d-flex col-12 col-lg-8",children:[e.jsx("div",{className:"d-flex col-6 align-items-center border-start border-primary",children:e.jsx($i,{value:m.date,placeHolder:r(y=>
6y.Outbound),dateRange:ca.GetSearchPeriod(Temporal.Now.plainDateISO()),onSelectDate:y=>y&&d(y),enableDates:(s=(t=(a=m.arrival)===null||a===void 0?void 0:a.p2pTickets)===null||t===void 0?void 0:t.dates)===null||s===void 0?void 0:s.map(y=>k.ToPlainDate(k.fromDateOnlyString(y))),customInput:e.jsx(Vi,{label:f?r(y=>y.Select):o(y=>y.DepartureDate),hasError:f})})}),e.jsx("div",{className:"d-flex col-6 align-items-center border-start border-end border-primary",children:e.jsx($i,{value:m.return&&m.returnDate?m.returnDate:void 0,placeHolder:r(y=>y.Return),dateRange:m.date?ca.GetSearchPeriod(m.date):void 0,onSelectDate:S,customInput:e.jsx(Vi,{label:r(p?y=>y.Select:y=>y.DataDelViaggioRitorno),hasError:p,isReturn:!0})})})]}),e.jsx("div",{className:"d-none d-lg-flex align-items-center col-lg-4",children:e.jsx("div",{className:"flex-grow-1 w-100",children:e.jsx(da,{buttonClass:"btn w-100 py-2 fw-bold d-flex align-items-center justify-content-center rounded flex-nowrap text-nowrap",buttonTemplate:e.jsx(Dn,{selection:m.selectedFareCategories}),children:e.jsx(pa,{selectedCategories:m.selectedFareCategories,arrival:m.arrival,onChange:g,departureDate:m.date?k.PlainDateToDate(m.date):null,returnDate:m.returnDate?k.PlainDateToDate(m.returnDate):null,mode:"passengers"})})})})]}),e.jsx("div",{className:"d-flex flex-column col-12 col-lg-1 flex-lg-row align-items-stretch w-lg-auto",children:h&&e.jsx("button",{type:"button",className:"btn btn-primary w-100 py-2",disabled:h.disabled,onClick:()=>l(m),children:h.label})})]})]})}let Tn=Qi.Grouped();const _n=i=>e.jsxs("div",{className:"ps-4",children:[e.jsx("div",{className:"fw-bold",children:V.capitalize(i.item.description)}),e.jsx("div",{children:V.capitalize(i.item.address)})]}),kn=i=>e.jsxs("div",{className:"fontsize-3u fw-bold ",children:[e.jsx("i",{className:"fa-solid fa-city me-2"})," ",V.capitalize(i.item)]}),jm=_(class extends P.PureComponent{constructor(){super(...arguments),this.getI18nStopDescription=a=>a.description,this.CustomInputDeparture=a=>e.jsx(ha,Object.assign({},a,{departure:!0}))}render(){const{departures:a,arrivals:t,departureValue:s,arrivalValue:n,onSelectDeparture:r,onSelectArrival:o,disable:d,onExchangeDepartureArrival:u}=this.props;var{formatMessage:c}=this.props.i18n.get(ie);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-12 col-lg-6 d-flex pe-lg-0 mb-1 mb-lg-0",children:e.jsx("div",{className:"flex-fill",children:e.jsx(Tn,{placeholder:c(l=>l.PartenzaPlaceholder),data:a||[],busy:!a,value:s||null,textField:l=>`${this.getI18nStopDescription(l)} ${l.address}`,allowNull:!0,onSelect:r,readonly:d,customInput:this.CustomInputDeparture,noMargin:!0,itemComponent:_n,groupBy:{selector:l=>l.shortDescription,component:kn}})})}),e.jsxs("div",{className:"col-12 col-lg-6 d-flex ps-lg-0 mb-1 mb-lg-0",children:[e.jsx("div",{className:"d-none d-lg-flex col-auto align-items-center justify-content-center px-2",style:{display:d?"none":void 0,zIndex:1},children:e.jsx("a",{onClick:u,className:"bg-white py-1",children:e.jsx("i",{className:"fas fa-exchange-alt fa-lg text-primary"})})}),e.jsx("div",{className:"flex-fill",children:e.jsx(Tn,{placeholder:c(l=>l.ArrivalPlaceholder),data:t||[],busy:!t,value:n||null,textField:l=>`${this.getI18nStopDescription(l)} ${l.address}`,allowNull:!0,onSelect:o,readonly:d,customInput:ha,noMargin:!0,itemComponent:_n,groupBy:{selector:l=>l.shortDescription,component:kn}})})]})]})}}),ko=i=>{const{options:a,selectedValue:t,onSelect:s,disabled:n=!1,className:r=""}=i,o=a.map(d=>typeof d=="string"?{label:d,value:d}:d);return e.jsx("div",{className:`d-flex gap-2 ${r}`,children:o.map(d=>{const u=t===d.value,c=`btn rounded px-4 py-2 fw-bold ${u?"btn-primary text-white":"btn-outline-primary"} ${n?"opacity-50 cursor-not-allowed":""}`;return e.jsx("button",{type:"button",className:c,onClick:()=>!n&&s(d.value),disabled:n,"aria-pressed":u,children:d.label},d.value)})})};function Sm(i){const{formatMessage:a}=i.i18n.get(ie),{currentMode:t,onModeChange:s,onSelectTplStops:n,tplDeparture:r,tplArrival:o,currentSaleGroupId:d,showTabs:u}=i,c=(l,m)=>{n(l,m,d)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-12 d-flex flex-column flex-lg-row align-items-centerpy-0 px-0",children:e.jsx("div",{className:`bg-white border border-top-0 border-primary border-left border-right col-12 ${u?"border-bottom-0 p-2":"border-bottom-0 rounded-top p-2"}`,children:e.jsx(ko,{options:[{label:a(l=>l.Acquista),value:"purchase"},{label:a(l=>l.Orari),value:"view"}],selectedValue:t,onSelect:l=>s(l)})})}),e.jsx("div",{className:"col-12 d-flex flex-column flex-lg-row align-items-stretch bg-white p-0 border border-primary rounded-bottom",children:e.jsx(hu,{onSelect:c,selectedDeparture:r??void 0,selectedArrival:o??void 0,component:jm,saleGroupId:d})})]})}const Nm=i=>{var a;P.useEffect(()=>{var s;i.departures==null&&Os.getDepartureLocalities((s=i.saleGroupId)!==null&&s!==void 0?s:null)},[i.departures,i.saleGroupId]);const t=P.useMemo(()=>{var s;return((s=i.departures)!==null&&s!==void 0?s:[]).filter(n=>((n==null?void 0:n.isZoneType)||!1)===!0)},[i.departures]);return!t||t.length===0?null:e.jsx("div",{className:`d-flex row row-cols-auto align-item-center gap-3 p-3 ${(a=i.className)!==null&&a!==void 0?a:""}`,children:t.map((s,n)=>{var r,o;const d=((o=(r=s.shortestDescription)===null||r===void 0?void 0:r.length)!==null&&o!==void 0?o:0)>0?s.shortestDescription:s.description;return e.jsx("div",{className:"p-0",style:{minWidth:120},children:e.jsx("button",{className:'btn w-100 btn-primary text-bg-primary"} ',onClick:()=>{var u;(u=i.onSelectCity)===null||u===void 0||u.call(i,s)},children:d})},n)})})},wm=fe(Nm,Da,(i,a)=>{var t;return{departures:i.getDepartures(a.hl,(t=a.saleGroupId)!==null&&t!==void 0?t:null)}}),Ao=_(wm),Cm=Qi.Grouped(),Pm=i=>{var a,t;return e.jsx("div",{className:"ps-4",children:V.capitalize(((a=i.item.address)===null||a===void 0?void 0:a.trim())||((t=i.item.shortDe
6scription)===null||t===void 0?void 0:t.trim())||i.item.description)})},Dm=i=>e.jsxs("div",{className:"fontsize-3u fw-bold",children:[e.jsx("i",{className:"fa-solid fa-city me-2"})," ",V.capitalize(i.item)]});function An(i){const{selectedCity:a,selectedStopId:t,onSelectStop:s,placeholder:n="Seleziona fermata",disabled:r=!1,availableStopIds:o}=i,d=zs.useAll(),[u,c]=P.useState(!1),l=a&&d?d.find(p=>V.invariantEquals(p.description,a.description)||V.invariantEquals(p.description,a.shortestDescription)):null;P.useEffect(()=>{l&&l.stopsIds.length>0?(c(!1),pu.getManyAccumulated(l.stopsIds).then(()=>c(!0)).catch(p=>{console.error("Error loading stops for pool:",p),c(!0)})):c(!0)},[l==null?void 0:l.id]);const m=l&&u?l.stopsIds.map(p=>{const g=ua.get(p);return g?{id:g.id,description:g.description,shortDescription:g.shortDescription,address:g.address}:null}).filter(p=>p!=null).sort((p,g)=>p.address.localeCompare(g.address)):null,h=m&&o?m.filter(p=>o.has(p.id)):m,f=(h==null?void 0:h.find(p=>p.id===t))||null;return!d||l&&!u?e.jsx("div",{className:"spinner-border spinner-border-sm",role:"status"}):e.jsxs("div",{className:"flex-fill city-stop-selector-wrapper",children:[e.jsx("style",{children:` 7 .city-stop-selector-wrapper .bncombo { 8 border: none !important; 9 } 10 .city-stop-selector-wrapper .form-control { 11 border: none !important; 12 box-shadow: none !important; 13 } 14 .city-stop-selector-wrapper .input-group-text { 15 border: none !important; 16 background: transparent !important; 17 } 18 `}),e.jsx(Cm,{placeholder:n,data:h||[],busy:!h,value:f,textField:p=>p.description,allowNull:!0,onSelect:s,readonly:r,noMargin:!0,itemComponent:Pm,groupBy:{selector:p=>p.shortDescription?p.shortDescription.trim().toLowerCase():"",component:Dm}})]})}const Im=i=>{const{saleGroupId:a,showTabs:t,searchData:s,currentMode:n,onModeChange:r}=i,{formatMessage:o}=i.i18n.get(ie),d=i.i18n.get(Q).formatMessage,[u,c]=di(),l=_e(),[m,h]=P.useState(s.urbanCity||null),[f,p]=P.useState(s.date?s.date:Temporal.Now.plainDateISO()),[g,v]=P.useState(null),[x,S]=P.useState(null),y=Ls.useAll();P.useEffect(()=>{if(!y)return;const z=y.filter(L=>L.type===4);if(z.length===0)return;const R=z.map(L=>L.id).join(","),M=new Date(f.year,f.month-1,f.day);new Es().getActiveStopIds(R,M).then(L=>S(new Set(L))).catch(()=>S(null))},[y,f.toString()]);const b=P.useMemo(()=>{var z;return((z=i.departures)!==null&&z!==void 0?z:[]).filter(R=>((R==null?void 0:R.isZoneType)||!1)===!0)},[i.departures]),[j,I]=P.useState(null);P.useEffect(()=>{const z=u.get("urbanoPoolId"),R=u.get("urbanoDate"),M=u.get("urbanoStop");if(z&&!m&&b.length>0){const F=b.find(L=>L.id===z);if(F){if(h(F),R){const L=Temporal.PlainDate.from(R);p(L)}M&&v(M)}}},[u,b]),P.useEffect(()=>{I(b&&b.length===1),j&&!m&&b.length===1&&w(b[0])},[b,j]);const N=ua.use(g);P.useEffect(()=>{N&&g&&m&&T(N)},[N,g]);const w=z=>{var R;s.urbanCity=z,s.urbanDeparture=null,s.departure=null,s.arrival=null,h(z),v(null);const M=new URLSearchParams,F=(R=u.get("tab"))!==null&&R!==void 0?R:a;F&&M.set("tab",F),M.set("mode","purchase"),M.set("urbanoPoolId",z.id),M.set("urbanoDate",f.toJSON()),s.date=f;const L=u.get("type");L&&M.set("type",L);const U=u.get("personCode");U&&M.set("personCode",U);const Y=Ni.getLocale();l(`/${Y}/?${M.toString()}`,{replace:!0})},T=z=>{s.urbanDeparture=z;const R=new URLSearchParams(u);z&&m?(R.set("urbanoStop",z.id),R.set("urbanoPoolId",m.id),R.set("urbanoDate",f.toJSON())):(R.delete("urbanoStop"),R.delete("urbanoPoolId"),R.delete("urbanoStatGroup"),R.delete("urbanoDate")),c(R)},C=z=>{if(z&&(p(z),m)){const R=new URLSearchParams(u);R.set("urbanoDate",z.toJSON()),c(R)}},A=()=>{const z=new URLSearchParams(u);z.delete("urbanoStop"),z.delete("urbanoPoolId"),z.delete("urbanoStatGroup"),z.delete("urbanoDate"),z.delete("type"),c(z),h(null),v(null)},H=m?m.shortestDescription||m.description:"Seleziona città ";return e.jsxs(e.Fragment,{children:[!m&&e.jsx("div",{className:"col-12 d-flex flex-column flex-lg-row align-items-centerpy-0 px-0",children:e.jsx("div",{className:`bg-white border border-top-0 border-primary border-left border-right col-12 ${t?"p-2 rounded-bottom":"rounded-top p-2"}`,children:e.jsx(Ao,{saleGroupId:a,onSelectCity:w})})}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-12 d-flex flex-column flex-lg-row align-items-centerpy-0 px-0",children:e.jsx("div",{className:`bg-white border border-top-0 border-primary border-left border-right col-12 ${t?"border-bottom-0 p-2":"border-bottom-0 rounded-top p-2"}`,children:e.jsx(ko,{options:[{label:o(z=>z.Acquista),value:"purchase"},{label:o(z=>z.Orari),value:"view"}],selectedValue:n,onSelect:z=>r(z)})})}),e.jsxs("div",{className:"col-12 d-flex flex-column flex-lg-row align-items-stretch bg-white p-0 border border-primary rounded-bottom",children:[e.jsx("div",{className:"d-flex col-12 col-lg-3 align-items-center border-end border-primary",children:e.jsxs("button",{type:"button",className:"btn btn-primary w-100 h-100",onClick:A,disabled:j??!1,style:{cursor:j?"default":"pointer"},children:[e.jsx("i",{className:j?"fa-solid fa-city me-2":"fa-solid fa-chevron-up me-2"}),H]})}),e.jsx("div",{className:"d-none d-lg-flex col-12 col-lg-6 align-items-center border-end border-primary",children:e.jsx(An,{saleGroupId:a,selectedCity:m,selectedStopId:g,onSelectStop:T,availableStopIds:x})}),e.jsx("div",{className:"d-flex d-lg-none col-12 col-lg-6 align-items-center border-bottom border-primary",children:e.jsx(An,{saleGroupId:a,selectedCity:m,selectedStopId:g,onSelectStop:T,availableStopIds:x})}),e.jsx("div",{className:"d-flex col-12 col-lg-3 align-items-center border-0",children:e.jsx($i,{value:f,placeHolder:o(z=>z.Outbound),dateRange:Gl.Create(Temporal.Now.plainDateISO(),Temporal.Now.plainDateISO().add({months:12})),onSelectDate:C,customInput:e.jsx(Vi,{label:d(z=>z.DepartureDate)})})})]})]})]})},Tm=fe(Im,Da,(i,a)=>{var t;return{departures:i.getDepartures(a.hl,(t=a.saleGroupId)!==null&&t!==void 0?t:null)}}),_m=_(Tm),km=i=>{var a,t;const[s]=di(),n=Di.useAll(),r=s.get("tab");let o=0;if(n&&r){const u=n.findIndex(c=>c.id===r);u>=0&&(o=u)}const d=(t=(a=n==null?void 0:n[o])===null||a===void 0?void 0:a.id)!==null&&t!==void 0?t:void 0;return e.jsx(Mm,Object.assign({},i,{saleGroupId:d}))},Am=i=>{var a,t,s;const[n,r]=di(),o=Di.useAll(),[d,u]=P.useState(0),[c,l]=P.useState(null),[m,h]=P.useState(null),f=n.get("mode")||"purchase";P.useEffect(()=>{var w;if(i.departures==null){const T=o==null?void 0:o[d];Os.getDepartureLocalities((w=T==null?void 0:T.id)!==null&&w!==void 0?w:null)}},[i.departures,d,o]),P.useEffect(()=>{if(o&&o.length>0){const w=n.get("tab");if(w){const T=o.findIndex(C=>C.id===w);T>=0&&T!==d&&u(T)}else d!==0&&u(0)}},[n,o]),P.useEffect(()=>{const w=n.get("dep"),T=n.get("arr");w!==c&&l(w),T!==m&&h(T)},[n]);const p=(w,T,C)=>{var A,H;l((A=w==null?void 0:w.id)!==null&&A!==void 0?A:null),h((H=T==null?void 0:T.id)!==null&&H!==void 0?H:null),i.onSelectTplStops&&i.onSelectTplStops(w,T,C)},g=w=>{if(u(w),o&&o[w]){const T=o[w],C=o[d],A=new URLSearchParams;A.set("tab",T.id);const H=n.get("mode");if((C==null?void 0:C.saleGroupType)===T.saleGroupType&&H?A.set("mode",H):(T.saleGroupType===2||T.saleGroupType===1)&&A.set("mode","purchase"),T.saleGroupType===2){const z=n.get("urbanoPoolId"),R=n.get("urbanoDate"),M=n.get("urbanoStop"),F=n.get("urbanoStatGroup");z&&A.set("urbanoPoolId",z),R&&A.set("urbanoDate",R),M&&A.set("urbanoStop",M),F&&A.set("urbanoStatGroup",F)}if(T.saleGroupType===1){const z=n.get("dep"),R=n.get("arr");z&&A.set("dep",z),R&&A.set("arr",R)}r(A,{replace:!0})}},v=w=>{const T=new URLSearchParams(n);T.set("mode",w),r(T)},x=o==null?void 0:o[d],S=(a=x==null?void 0:x.id)!==null&&a!==void 0?a:null,y=((t=o==null?void 0:o.length)!==null&&t!==void 0?t:0)>0,b=!y||(x==null?void 0:x.saleGroupType)===0,j=y&&(x==null?void 0:x.saleGroupType)===1,I=y&&(x==null?void 0:x.saleGroupType)===2,N=((s=o==null?void 0:o.length)!==null&&s!==void 0?s:0)>1;return e.jsxs("div",{children:[N&&e.jsx(_o,{selectedTab:d,onTabChange:g,hl:i.hl}),e.jsx("div",{className:`row justify-content-center shadow ${N?"border-top-0":""}`,children:b?e.jsx(ym,{searchData:i.searchData,onChangeDepartureArrival:i.onChangeDepartureArrival,onClickReturn:i.onClickReturn,onChangeDateFrom:i.onChangeDateFrom,onChangeDateTo:i.onChangeDateTo,onSearchSolutions:i.onSearchSolutions,onChangePassengerSelection:i.onChangePassengerSelection,outboundError:i.outboundError,returnError:i.returnError,searchButton:i.searchButton,currentSaleGroupId:S,showTabs:N,hl:i.hl,i18n:i.i18n}
18):j?e.jsx(Sm,{currentMode:f,onModeChange:v,onSelectTplStops:p,tplDeparture:c,tplArrival:m,currentSaleGroupId:S,showTabs:N,hl:i.hl,i18n:i.i18n}):I?e.jsx(_m,{saleGroupId:S,showTabs:N,searchData:i.searchData,currentMode:f,onModeChange:v}):null})]})},Rm=fe(Am,Da,(i,a)=>{var t;return{departures:i.getDepartures(a.hl,(t=a.saleGroupId)!==null&&t!==void 0?t:void 0)}}),Mm=_(Rm),Om=km;class zm extends P.PureComponent{render(){var a,t,s,n,{formatMessage:r}=this.props.i18n.get(ie),o=this.props.i18n.get(Q).formatMessage;const{searchData:d}=this.props,u=d.selectedFareCategories.filter(l=>l.category.type==0).length,c=d.selectedFareCategories.filter(l=>l.category.type==2).length;return e.jsx("div",{className:"row justify-content-center border border-primary bg-white rounded-2",style:{cursor:this.props.onClick?"pointer":"default",transition:"box-shadow 0.2s ease-in-out"},onClick:this.props.onClick,onMouseEnter:l=>{this.props.onClick&&(l.currentTarget.style.boxShadow="0 0 0 2px rgba(13, 110, 253, 0.25)")},onMouseLeave:l=>{this.props.onClick&&(l.currentTarget.style.boxShadow="none")},children:e.jsxs("div",{className:"col-12 d-flex flex-column flex-xl-row align-items-stretch bg-white rounded-2 p-0",children:[e.jsxs("div",{className:"row d-md-none g-0",children:[e.jsx("div",{className:"d-flex col-6 align-items-center border border-start border-bottom border-top border-primary",children:e.jsxs("div",{className:"booking-search input-group flex-nowrap fw-bold text-medium w-100",children:[e.jsx("span",{className:"input-group-text border-0 text-primary",children:e.jsx("i",{className:"fa-solid fa-location-dot"})}),e.jsx("div",{className:"flex-fill border-0 py-1 d-flex align-items-center",children:((a=d.departure)===null||a===void 0?void 0:a.description)||r(l=>l.PartenzaPlaceholder)})]})}),e.jsx("div",{className:"d-flex col-6 px-0 align-items-center border border-bottom border-top border-primary",children:e.jsxs("div",{className:"booking-search input-group flex-nowrap fw-bold text-medium w-100",children:[e.jsx("span",{className:"input-group-text border-0 text-primary",children:e.jsx("i",{className:"fa-regular fa-flag"})}),e.jsx("div",{className:"flex-fill border-0 py-1 d-flex align-items-center",children:((t=d.arrival)===null||t===void 0?void 0:t.description)||r(l=>l.ArrivalPlaceholder)})]})})]}),e.jsx("div",{className:`col-12 d-none d-md-block${this.props.mode==="navigation"?" col-xl-4":" col-xl-6"}`,children:e.jsxs("div",{className:"row m-0",children:[e.jsx("div",{className:"d-flex col-6 align-items-center border border-start border-bottom border-top border-primary",children:e.jsxs("div",{className:"booking-search input-group flex-nowrap fw-bold text-medium w-100",children:[e.jsx("span",{className:"input-group-text border-0 text-primary",children:e.jsx("i",{className:"fa-solid fa-location-dot"})}),e.jsx("div",{className:"flex-fill border-0 py-2 d-flex align-items-center",children:((s=d.departure)===null||s===void 0?void 0:s.description)||r(l=>l.PartenzaPlaceholder)})]})}),e.jsx("div",{className:"d-flex col-6 px-0 align-items-center border border-bottom border-top border-primary",children:e.jsxs("div",{className:"booking-search input-group flex-nowrap fw-bold text-medium w-100",children:[e.jsx("span",{className:"input-group-text border-0 text-primary",children:e.jsx("i",{className:"fa-regular fa-flag"})}),e.jsx("div",{className:"flex-fill border-0 py-2 d-flex align-items-center",children:((n=d.arrival)===null||n===void 0?void 0:n.description)||r(l=>l.ArrivalPlaceholder)})]})})]})}),e.jsxs("div",{className:`d-flex flex-column col-12 flex-xl-row align-items-stretch w-xl-auto${this.props.mode==="navigation"?" col-xl-8":" col-xl-6"}`,children:[e.jsxs("div",{className:"d-flex col-12 col-xl-8",children:[e.jsx("div",{className:"d-flex col-6 align-items-center border-start border-top border-bottom border border-primary",children:e.jsx("div",{className:"w-100 py-xl-2 py-1 px-2 d-flex align-items-center justify-content-start fw-bold text-nowrap",children:e.jsxs("span",{className:"text-primary",children:[e.jsx("i",{className:"fa-regular fa-calendar me-2"}),d.date?k.format(d.date,"dd/MM/yyyy"):o(l=>l.DepartureDate)]})})}),e.jsx("div",{className:"d-flex col-6 align-items-center border-end border-top border-bottom border border-primary",children:e.jsx("div",{className:"w-100 py-xl-2 py-1 px-2 d-flex align-items-center justify-content-start fw-bold text-nowrap",children:e.jsxs("span",{className:d.return&&d.returnDate?"text-primary":"text-muted",children:[e.jsx("i",{className:"fa-regular fa-calendar me-2"}),d.return&&d.returnDate?k.format(d.returnDate,"dd/MM/yyyy"):r(l=>l.DataDelViaggioRitorno)]})})})]}),e.jsx("div",{className:"d-flex align-items-center col-12 col-xl-4 border border-primary",children:e.jsx("div",{className:"flex-grow-1 w-100 h-100 d-flex align-items-center justify-content-center fw-bold py-xl-2 py-1",children:c>0||this.props.mode==="navigation"?e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsxs("div",{className:"me-3",children:[e.jsx("i",{className:"fa-regular fa-user text-primary me-1"}),u," ",r(u===1?l=>l.Passeggero:l=>
18l.Passeggeri)]}),e.jsxs("div",{children:[e.jsx("i",{className:"fa-solid fa-car text-primary me-1"}),c," ",r(c===1?l=>l.Vehicle:l=>l.Vehicles)]})]}):e.jsxs("div",{children:[e.jsx("i",{className:"fa-regular fa-user text-primary me-2"}),u," ",r(u===1?l=>l.Passeggero:l=>l.Passeggeri)]})})})]})]})})}}const Rn=_(zm),Lm=i=>i.arrival!=null&&i.departure!=null&&i.date!=null&&(!i.return||i.returnDate!=null),Em=i=>{const{formatMessage:a}=i.i18n.get(ie),[t,s]=P.useState({outboundError:!1,returnError:!1}),[n,r]=P.useState(!0),o=P.useRef(null),d=i.searchData.arrival==null||i.searchData.departure==null,u=i.autoSerch||!n?void 0:{label:a(N=>N.Cerca),disabled:d},c=!u,{refs:l,context:m}=_l({open:!i.isCompactedView&&c,onOpenChange:N=>{var w;!N&&c&&((w=i.onCompactedViewChange)===null||w===void 0||w.call(i,!0))}}),h=kl(m,{enabled:!i.isCompactedView&&c,outsidePressEvent:"mousedown",escapeKey:!0,bubbles:!0}),{getFloatingProps:f}=Al([h]),p=N=>{i.onChangeSearchData(N),i.autoSerch&&Lm(N)&&i.onSearchSolutions(N)},g=N=>{var w;if(!N.date&&!I()){s(Object.assign(Object.assign({},t),{outboundError:!0}));return}if(N.return&&!N.returnDate){s(Object.assign(Object.assign({},t),{returnError:!0}));return}s({outboundError:!1,returnError:!1}),r(!1),dt.environmentName!="blunavy"&&((w=i.onCompactedViewChange)===null||w===void 0||w.call(i,!0)),i.onSearchSolutions(N)},v=()=>{i.navigate(-1)},x=(N,w)=>{p(Object.assign(Object.assign({},i.searchData),{departure:N,arrival:w}))},S=N=>{const w=Temporal.Now.plainDateISO();Temporal.PlainDate.compare(N,w)<0&&(N=w);const T=Object.assign(Object.assign({},i.searchData),{date:N});i.searchData.returnDate&&Temporal.PlainDate.compare(i.searchData.returnDate,N)<=0&&(T.returnDate=N),p(T)},y=N=>{var w;const T=(w=i.searchData.date)!==null&&w!==void 0?w:Temporal.Now.plainDateISO();Temporal.PlainDate.compare(N,T)<0&&(N=T.add({days:1})),p(Object.assign(Object.assign({},i.searchData),{date:T,return:!0,returnDate:N}))},b=N=>{var w,T;const C=(w=i.searchData.date)!==null&&w!==void 0?w:Temporal.Now.plainDateISO();p(Object.assign(Object.assign({},i.searchData),{return:N,date:C,returnDate:N?(T=i.searchData.returnDate)!==null&&T!==void 0?T:C:void 0}))},j=N=>{const w=te.maxEndUserPassengers;w>0?N.filter(T=>T.category.type==0).length<=w&&p(Object.assign(Object.assign({},i.searchData),{selectedFareCategories:N})):p(Object.assign(Object.assign({},i.searchData),{selectedFareCategories:N}))},I=()=>i.searchData.arrival&&i.searchData.arrival.p2pTickets==null&&i.searchData.arrival.open;return te.environmentName==="blunavy"||te.environmentName==="ichnusa"?e.jsxs("div",Object.assign({ref:N=>{o.current=N,l.setFloating(N)}}
18,f(),{children:[!u&&e.jsx("div",{className:"mb-2",children:e.jsxs("a",{style:{cursor:"pointer"},className:"text-white fs-5",onClick:v,children:[e.jsx("i",{className:"fa-solid fa-arrow-left pe-2"}),a(N=>N.TornaIndietro)]})}),u||!i.isCompactedView?e.jsx(vm,{onChangeDateFrom:S,onChangeDateTo:y,onChangeDepartureArrival:x,onChangePassengerSelection:j,onClickReturn:b,onSearchSolutions:g,searchData:i.searchData,outboundError:t.outboundError,returnError:t.returnError,searchButton:u,navigate:i.navigate}):e.jsx(Rn,{searchData:i.searchData,mode:"navigation",onClick:()=>{var N;(N=i.onCompactedViewChange)===null||N===void 0||N.call(i,!1)}})]})):I()?e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-12 col-lg-4",children:e.jsx(qs,{onSelect:x,selectedDeparture:i.searchData.departure,selectedArrival:i.searchData.arrival,component:Oa,combinationComponent:Hs})}),e.jsx("div",{className:"col-12 col-lg-1 d-flex justify-content-end",children:e.jsx("button",{type:"button",style:{width:108,height:"fit-content"},className:"btn btn-primary btn-highlight py-2",disabled:!i.searchData.arrival,onClick:()=>g(i.searchData),children:a(N=>N.Cerca)})})]}):e.jsxs("div",Object.assign({ref:N=>{o.current=N,l.setFloating(N)}}
18,f(),{children:[!u&&e.jsx("div",{className:"mb-2",children:e.jsxs("a",{style:{cursor:"pointer"},className:"text-white fs-5",onClick:v,children:[e.jsx("i",{className:"fa-solid fa-arrow-left pe-2"}),a(N=>N.TornaIndietro)]})}),u||!i.isCompactedView?e.jsx(Om,{onChangeDateFrom:S,onChangeDateTo:y,onChangeDepartureArrival:x,onChangePassengerSelection:j,onClickReturn:b,onSearchSolutions:g,searchData:i.searchData,outboundError:t.outboundError,returnError:t.returnError,searchButton:u,navigate:i.navigate,i18n:i.i18n,onSelectTplStops:i.onSelectTplStops}):e.jsx(Rn,{searchData:i.searchData,mode:"standard",onClick:()=>{var N;(N=i.onCompactedViewChange)===null||N===void 0||N.call(i,!1)}})]}))},Ro=_(Em);function Mn(i){return Object.assign(Object.assign({},i),{date:i.date.toString()})}function On(i){return Object.assign(Object.assign({},i),{date:Temporal.PlainDate.from(i.date)})}class Yt{}class Fm{constructor(){this._storage=new Yl("TicketSaleStore",60*24),this._storage.get()||this.clear()}getSolution(){var a,t;const s=(t=(a=this._storage.get())===null||a===void 0?void 0:a.solution)!==null&&t!==void 0?t:null;return s?On(s):null}setSolution(a){var t,s=(t=this._storage.get())!==null&&t!==void 0?t:new Yt;s.solution=a?Mn(a):null,this._storage.set(s)}getReturnSolution(){var a,t;const s=(t=(a=this._storage.get())===null||a===void 0?void 0:a.returnSolution)!==null&&t!==void 0?t:null;return s?On(s):null}setReturnSolution(a){var t,s=(t=this._storage.get())!==null&&t!==void 0?t:new Yt;s.returnSolution=a?Mn(a):null,this._storage.set(s)}getCoupon(){var a;return(a=this._storage.get())===null||a===void 0?void 0:a.coupon}setCoupon(a){var t,s=(t=this._storage.get())!==null&&t!==void 0?t:new Yt;s.coupon=a,this._storage.set(s)}getEmail(){var a;return(a=this._storage.get())===null||a===void 0?void 0:a.email}setEmail(a){var t,s=(t=this._storage.get())!==null&&t!==void 0?t:new Yt;s.email=a,this._storage.set(s)}getPhone(){var a;return(a=this._storage.get())===null||a===void 0?void 0:a.phone}setPhone(a){var t,s=(t=this._storage.get())!==null&&t!==void 0?t:new Yt;s.phone=a,this._storage.set(s)}getCallingCode(){var a;return(a=this._storage.get())===null||a===void 0?void 0:a.callingCode}setCallingCode(a){var t,s=(t=this._storage.get())!==null&&t!==void 0?t:new Yt;s.callingCode=a,this._storage.set(s)}clear(){this._storage.set(new Yt)}}const K=new Fm;class Mo{constructor(){this.return=!1,this.selectedFareCategories=[]}}const Bm=_(i=>{var a;const t=new Mo;t.departure=i.departure,t.arrival=i.arrival,t.date=i.departureDate?k.ToPlainDate(i.departureDate):void 0,t.return=i.ar||i.returnDate!=null,t.returnDate=i.returnDate?k.ToPlainDate(i.returnDate):void 0,t.selectedFareCategories=i.selectedFareCategories;const[s,n]=P.useState(!0);P.useEffect(()=>{Me.delete()},[]);const r=(a=Ms.useForSearchWithLuggages(i.arrival,t.date?k.PlainDateToDate(t.date):null,t.returnDate?k.PlainDateToDate(t.returnDate):null))!==null&&a!==void 0?a:[],o=h=>{var f,p,g,v;const x=D.TravelSelection(h.return,(g=(f=h.departure)===null||f===void 0?void 0:f.description)!==null&&g!==void 0?g:" ",h.date?k.PlainDateToDate(h.date):void 0,(v=(p=h.arrival)===null||p===void 0?void 0:p.description)!==null&&v!==void 0?v:" ",h.return&&h.returnDate?k.PlainDateToDate(h.returnDate):void 0);i.history({pathname:x,search:new Bi(Wt.getQuery(h.selectedFareCategories,r)).stringify()},{replace:!0})},d=h=>{var f,p,g,v,x,S,y,b;const j=Fe.getOccupation(h.selectedFareCategories),I={id:`${h.departure}_${h.arrival}`,departureId:(x=(f=h.departure)===null||f===void 0?void 0:f.id)!==null&&x!==void 0?x:"",departure:(S=(p=h.departure)===null||p===void 0?void 0:p.description)!==null&&S!==void 0?S:"",arrivalId:(y=(g=h.arrival)===null||g===void 0?void 0:g.id)!==null&&y!==void 0?y:"",arrival:(b=(v=h.arrival)===null||v===void 0?void 0:v.description)!==null&&b!==void 0?b:"",departureDate:h.date?k.PlainDateToDate(h.date):void 0,return:h.return,returnDate:h.return&&h.returnDate?k.PlainDateToDate(h.returnDate):void 0,adults:j.adults,children:j.children};qe.send(new Sr(I))},u=h=>{if(K.clear(),Me.delete(),h.departure&&h.arrival&&(h.date||h.arrival.p2pTickets==null&&h.arrival.open)){const f=D.SelectSolutionPath(h.departure.description,h.date?k.PlainDateToDate(h.date):null,h.arrival.description,h.return&&h.returnDate?k.PlainDateToDate(h.returnDate):void 0);i.history({pathname:f,search:new Bi(Wt.getQuery(i.selectedFareCategories,r)).stringify()}
18),d(h)}},c=(h,f,p)=>{const g=new URLSearchParams;p&&g.set("tab",p),h&&g.set("dep",h.id),f&&g.set("arr",f.id),g.set("mode","purchase"),i.history({pathname:D.TravelSelection(),search:g.toString()},{replace:!1})},{i18n:l}=i,m=l.get(ie).formatMessage;return e.jsxs("div",{className:"shadow bg-primary",style:{height:80},children:[e.jsx("title",{children:m(h=>h.HomePageTitle(dt.environmentName))}),e.jsx("meta",{name:"description",content:m(h=>h.HomePageMetaDescription(dt.environmentName))}),e.jsx("link",{rel:"canonical",href:we(D.TravelSelection())}),e.jsx("div",{className:"container pt-4",children:e.jsx(Ro,{onChangeSearchData:o,onSearchSolutions:u,onSelectTplStops:c,searchData:t,navigate:i.history,isCompactedView:s,onCompactedViewChange:n})})]})});function $m(i){var a;if(i.length===0)return!1;const t=new Map;for(const s of i){const n=s.getDay();t.set(n,((a=t.get(n))!==null&&a!==void 0?a:0)+1)}return[...t.values()].every(s=>s===2)}const va=(i,a)=>{var t,s;const n=new Date(i);return n.setDate(n.getDate()+((t=a.days)!==null&&t!==void 0?t:0)),n.setHours(a.hours,a.minutes,(s=a.seconds)!==null&&s!==void 0?s:0,0),n},Wm=i=>{var a,t;const{departure:s,arrival:n}=i.data,{routes:r,data:o}=i,d=o.routes;if(r.length===0)return[];const u=(a=o.dates[0])!==null&&a!==void 0?a:new Date,c=[];let l=s;for(let m=0;m<r.length;m++){let h=r[m].stops;const f=h.findIndex(p=>p.stopId===l);if(f>=0&&(h=h.slice(f)),m===r.length-1){const p=h.findIndex(g=>g.stopId===n);p>=0&&(h=h.slice(0,p+1))}else{const p=new Set(r[m+1].stops.map(v=>v.stopId)),g=h.findIndex(v=>p.has(v.stopId));g>=0&&(h=h.slice(0,g+1),l=h[h.length-1].stopId)}c.push({tripId:(t=d[m])!==null&&t!==void 0?t:String(m),tripCode:String(m),stops:h.map((p,g)=>({stop:{stopId:p.stopId,stopTimeDeparture:va(u,p.departureTime),stopTimeArrival:va(u,p.arrivalTime)},type:g===h.length-1?1:3}))})}return c},Um=i=>{var a,t;const s=Gt(i.solution.routes.map(n=>n.routeCustomersDescription)).filter(n=>n==null?void 0:n.trim()).join(", ")||"Visualizza fermate";return s?e.jsxs(Tt,{text:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"d-none d-lg-inline d-xl-none",style:{width:0,overflow:"hidden"}}),e.jsx("span",{className:"d-inline d-lg-none d-xl-inline fontsize-2d",children:s})]}),className:"btn btn-outline-primary w-100",icon:"fa-solid fa-circle-info fa-lg",children:[e.jsx(ws,{segments:Wm(i.solution)}),e.jsx(ze,{role:ce.management,children:e.jsxs("a",{className:"btn btn-primary btn-sm w-100 mt-2",href:`${Zl()}${Cd(va((a=i.solution.data.dates[0])!==null&&a!==void 0?a:new Date,i.solution.data.departureTime),va((t=i.solution.data.dates[0])!==null&&t!==void 0?t:new Date,i.solution.data.arrivalTime),i.solution.data.routes.join(",")).slice(1)}`,target:"_blank",children:[e.jsx("i",{className:"fa-solid fa-bus me-1"}),"Visualizza corse soluzione"]})})]}):null},zn=_(i=>{var{formatMessage:a}=i.i18n.get(ie);const{departureDateTime:t,arrivalDateTime:s}=i;var n=new Dt(s).differenceInHoursAndMinutes(new Dt(t));return e.jsxs("div",{style:{fontSize:"0.8em"},children:[e.jsx(vi.Stopwatch,{color:"medium-gray"}),`${n.hours} ${a(r=>r.Ore)} ${n.minutes} ${a(r=>r.Minuti)}`]})}),Ln=_(i=>{const{formatMessage:a}=i.i18n.get(ie),t=i.routes.length-1;return e.jsxs("div",{className:"btn btn-primary-light w-100",children:[e.jsx("i",{className:"fa-solid fa-circle-info text-primary pt-2 pe-2"}),a(s=>s.TripChangesNumber(t))]})});class Vm extends P.PureComponent{render(){const{i18n:a,solution:t,purchaseLink:s}=this.props,{data:n}=t,{formatMessage:r}=a.get(ie);let o=new Dt(n.departureTime),d=new Dt(n.arrivalTime),u=e.jsx(wd,{});const c=$m(t.data.dates),l=new Date;l.setHours(0,0,0,0);const m=[0,1].map(g=>[0,1,2,3,4,5,6].map(v=>{const x=new Date(l);x.setDate(l.getDate()+g*7+v);const S=t.data.dates.some(y=>y.getFullYear()===x.getFullYear()&&y.getMonth()===x.getMonth()&&y.getDate()===x.getDate());return{date:x,notServed:!S}})),h=[1,2,3,4,5,6,0],f=t.data.dates.length>0?t.data.dates[0]:new Date,p=h.map(g=>{const v=t.data.dates.find(x=>x.getDay()===g);if(v)return{date:v,notServed:!1};{const x=new Date(f);let S=g==0?7:g;return x.setDate(x.getDate()-x.getDay()+S),{date:x,notServed:!0}}}).sort((g,v)=>{const x=g.date.getDay()===0?7:g.date.getDay(),S=v.date.getDay()===0?7:v.date.getDay();return x-S});return e.jsx("div",{className:"travel-solution my-4 py-3 bg-white shadow",style:{transition:"all 2s"},children:e.jsxs("div",{className:"row px-4",children:[e.jsx("div",{className:"col-sm-12 col-lg-7",children:e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-12 col-sm-11 px-0",children:e.jsx("div",{className:"px-4",children:e.jsxs("div",{className:"row",children:[e.jsxs("div",{className:"col-12 col-sm-5 d-flex flex-column justify-content-center",style:{paddingRight:0},children:[e.jsx("div",{className:"fw-bold text-info fontsize-2d",children:r(g=>g.Partenza)}),e.jsx("div",{className:"fw-bold",children:e.jsx(vn,{stopId:n.departure,stopDateTime:o,translation:{tredici:"1.5em",sedici:"1.4em",diciannove:"1.3em",ventuno:"1.2em",ventitre:"1.1em"}})}),e.jsx("div",{className:"text-mediumgray text-default",children:e.jsx(ht,{id:n.departure,selector:g=>e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("span",{children:g.address}),g.latitude&&g.longitude&&e.jsx(ss,{hideIcon:!0,className:"position-relative",style:{zIndex:999},text:e.jsx("i",{className:"fa-solid fa-location-dot mx-1"}),query:{lat:g.latitude,lng:g.longitude}})]})})})]}),e.jsxs("div",{className:"d-none d-sm-flex flex-column justify-content-center col-sm-2 text-center",style:{padding:0,height:85,left:-15},children:[u,e.jsx(zn,{departureDateTime:n.departureTime,arrivalDateTime:n.arrivalTime}),e.jsx(Ln,{routes:t.routes})]}),e.jsxs("div",{className:"col-12 col-sm-5 d-flex flex-column justify-content-center",style:{paddingRight:0},children:[e.jsx("div",{className:"fw-bold text-info fontsize-2d",children:r(g=>g.Arrival)}),e.jsx("div",{className:"fw-bold",children:e.jsx(vn,{stopId:n.arrival,stopDateTime:d,translation:{tredici:"1.5em",sedici:"1.4em",diciannove:"1.3em",ventuno:"1.2em",ventitre:"1.1em"}})}),e.jsx("div",{className:"text-mediumgray text-default",children:e.jsx(ht,{id:n.arrival,selector:g=>e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("span",{children:g.address}),g.latitude&&g.longitude&&e.jsx(ss,{hideIcon:!0,className:"position-relative",style:{zIndex:999},text:e.jsx("i",{className:"fa-solid fa-location-dot mx-1"}),query:{lat:g.latitude,lng:g.longitude}})]})})}),e.jsx("div",{className:"travel-arrival-date"})]})]})})})})}),e.jsx("div",{className:"col-4 d-sm-none",children:e.jsx(Ln,{routes:t.routes})}),e.jsx("div",{className:"col-4 d-sm-none ps-0",children:e.jsx("div",{className:"btn btn-outline-primary-light text-primary w-100 h-100 justify-content-center align-items-center d-flex fontsize-2u",children:e.jsx(zn,{departureDateTime:n.departureTime,arrivalDateTime:n.arrivalTime})})}),e.jsx("div",{className:"col-12 col-lg-1",children:e.jsx("div",{className:"d-flex flex-column align-items-center pt-1 h-100 w-100 justify-content-center align-items-center",children:e.jsx(Um,{solution:t})})}),e.jsx("div",{className:gr("col-12 pt-md-0 pt-1",s?"col-lg-3":"col-lg-4"),children:e.jsxs("div",{className:"d-flex flex-column align-items-center h-100 w-100 justify-content-center",style:{fontSize:"1.1em"},children:[e.jsx("div",{children:"Si effettua"}),c?e.jsx("div",{className:"row g-1 w-100",children:p.map(g=>{var v,x;return e.jsx("div",{className:"col",style:{flex:"0 0 calc(100% / 7)",maxWidth:"calc(100% / 7)"},children:e.jsxs("span",{className:"d-flex align-items-center justify-content-center p-1 fontsize-3d text-uppercase border border-1 border-dark fw-bold "+(g.notServed?"bg-light text-muted":"bg-success bg-gradient text-white"),title:k.getDayOfWeekName(g.date),children:[e.jsx("span",{className:"d-none d-lg-inline d-xl-none",children:k.getDayOfWeekName(g.date,(v=this.props.hl)!==null&&v!==void 0?v:"it").substring(0,2)}),e.jsx("span",{className:"d-inline d-lg-none d-xl-inline",children:k.getDayOfWeekName(g.date,(x=this.props.hl)!==null&&x!==void 0?x:"it")})]})},g.date.valueOf())})}):e.jsx("div",{className:"d-flex flex-column gap-1 w-100",children:m.map((g,v)=>e.jsx("div",{className:"row g-1 w-100",children:g.map(x=>{var S;return e.jsx("div",{className:"col",style:{flex:"0 0 calc(100% / 7)",maxWidth:"calc(100% / 7)"},children:e.jsxs("span",{className:"d-flex align-items-center justify-content-center p-1 fontsize-3d text-uppercase border border-1 border-dark fw-bold "+(x.notServed?"bg-light text-muted":"bg-success bg-gradient text-white"),title:k.getDayOfWeekName(x.date),children:[k.getDayOfWeekName(x.date,(S=this.props.hl)!==null&&S!==void 0?S:"it").substring(0,2)," ",x.date.getDate()]})},x.date.valueOf())})},v))})]})}),s?e.jsx("div",{className:"col-sm-12 pt-1 col-lg-1 d-flex flex-column justify-content-center align-items-center",children:s}):null]})})}}const Oo=_(Zi(Vm));class Gm extends Ki{constructor(){super(a=>a.id),this.useAll=()=>this.useAllWithAction(()=>Ve.getByUser()),Si.onfunction(Ve.getByUser,a=>{this.setAll(a)}).onfunction(Ve.save,a=>this.updateOrAdd(a)).onfunction(Ve.renewWithAttachments,a=>this.updateOrAdd(a[0])).onfunction(Ve.delete,a=>{a.success&&this.delete(a.id)})}}const Js=new Gm;var qm=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Hm=Wi.DropDown(),Km=({item:i})=>{const a=Ne.isActive(i);return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontSize:"1rem"},children:Ne.Description(i)}),!a&&e.jsx("div",{style:{fontSize:"0.8rem"},className:"text-danger",children:"Devi attendere l'attivazione del vettore"})]})};
18class Qm extends P.Component{constructor(a){super(a),this.state={person:null}}componentDidMount(){return qm(this,void 0,void 0,function*(){this.props.persons.length===0&&(yield Ve.getByUser())})}render(){const{persons:a,selectedId:t,onChange:s,allowNull:n,label:r,placeholder:o}=this.props;return e.jsx(Hm,{label:r,placeholder:o,data:a,onSelect:s,value:t&&a.find(d=>d.id===t)||null,allowNull:n??!1,readonly:this.props.disabled||a.length===0,itemComponent:Km,textField:d=>Ne.Description(d),required:this.props.required})}}const zo=fe(Qm,Js,(i,a)=>({persons:a.selectionFilter?i.getall().filter(a.selectionFilter):i.getall()})),X=_(i=>{var{formatMessage:a}=i.i18n.get(Q);return e.jsxs("div",{className:"d-flex flex-column align-items-center justify-content-center mt-5",children:[e.jsxs("div",{className:"text-primary d-flex align-items-center justify-content-center position-relative p-3",children:[e.jsx("svg",{className:"position-absolute loading-out",width:"47px",height:"47px",viewBox:"0 0 47 47",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("g",{id:"loader",transform:"translate(-617.000000, -179.000000)",stroke:"var(--bs-primary)",strokeWidth:"3",children:e.jsx("g",{id:"Group-5",transform:"translate(565.000000, 181.000000)",children:e.jsx("g",{id:"Group-3",transform:"translate(54.000000, 0.000000)",children:e.jsx("path",{d:"M21.5,43 C33.3741221,43 43,33.3741221 43,21.5 C43,9.62587788 33.3741221,0 21.5,0 C9.62587788,0 0,9.62587788 0,21.5",id:"Oval"})})})})})}),e.jsx("svg",{className:"position-absolute loading-in",width:"28px",height:"26px",viewBox:"0 0 28 26",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("g",{id:"loader",transform:"translate(-626.000000, -191.000000)",stroke:"var(--bs-primary)",strokeWidth:"3",children:e.jsx("g",{id:"Group-5",transform:"translate(565.000000, 181.000000)",children:e.jsx("g",{id:"Group-3",transform:"translate(54.000000, 0.000000)",children:e.jsx("path",{d:"M21.2202474,34.1359649 C27.8864212,34.1359649 33.2904228,28.7319633 33.2904228,22.0657895 C33.2904228,15.3996157 27.8864212,9.99561404 21.2202474,9.99561404 C14.5540736,9.99561404 9.15007194,15.3996157 9.15007194,22.0657895",id:"Oval",transform:"translate(21.220247, 22.065789) rotate(-210.000000) translate(-21.220247, -22.065789) "})})})})})})]}),e.jsx("img",{className:"mt-4",src:"/images/icon.svg",height:60}),e.jsx("div",{className:"fontsize-5u mt-3",children:i.label||a(t=>t.Loading)})]})}),Ys=i=>i.isLoading?e.jsx(X,{label:i.label}):e.jsx(e.Fragment,{children:i.children}),Jm=_(ui(i=>{var a,t,s,n,r,o,d;const{departure:u,arrival:c,onChangeStops:l,saleChannel:m,subscriptionTypes:h,onSelect:f,subscriptionTypeId:p,i18n:g,user:v,qty:x,mode:S,person:y}=i,{formatMessage:b}=g.get(oa),[j,I]=P.useState({subscriptionType:p&&(s=h[p])!==null&&s!==void 0?s:null}),{subscriptionType:N}=j,w=(a=vu.use(u,c,m))===null||a===void 0?void 0:a.filter(A=>S==null?!0:h[A.typeId].type==S);if(w==null)return e.jsx(X,{});const T=(A,H)=>{const z=(y==null?void 0:y.id)!=(H==null?void 0:H.id)&&A!=null&&A.personRequired?null:A;((z==null?void 0:z.id)!=(N==null?void 0:N.id)||(H==null?void 0:H.id)!=(y==null?void 0:y.id))&&(I(Object.assign(Object.assign({},j),{subscriptionType:z})),f(z,H))},C=Object.keys(h).every(A=>{var H;return((H=h[A])===null||H===void 0?void 0:H.personRequired)==!1});return v!=null?e.jsxs("div",{children:[!C&&e.jsx("div",{className:"bg-white p-3 shadow my-2",children:e.jsx(zo,{label:b(A=>A.Person),selectedId:(n=y==null?void 0:y.id)!==null&&n!==void 0?n:null,onChange:A=>T(null,A),selectionFilter:A=>A.validForSubscriptions&&Ne.isActive(A),allowNull:!0,navigate:i.navigate})}),(y==null?void 0:y.id)==null&&w.length>0&&e.jsx(Cn,{previews:w,selectedId:(r=N==null?void 0:N.id)!==null&&r!==void 0?r:null,onSelect:A=>T(A,y??null),qty:x,children:A=>A!=null&&A.preview&&l?e.jsx(qa,{combinationData:i.combinationData,onSelect:l,preview:A.preview,departurePool:u,arrivalPool:c}):null}),(y==null?void 0:y.id)!=null&&e.jsx(Qu,{personId:y==null?void 0:y.id,departure:u,arr
18ival:c,saleChannnel:m,onChange:A=>T(A,y??null),value:(o=(t=j.subscriptionType)===null||t===void 0?void 0:t.id)!==null&&o!==void 0?o:null,mode:i.mode,qty:x,children:A=>A!=null&&A.preview&&l?e.jsx(qa,{combinationData:i.combinationData,onSelect:l,preview:A.preview,departurePool:u,arrivalPool:c}):null})]}):v==null&&w.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-warning shadow my-2",children:[e.jsx("div",{className:"fw-bold fontsize-5u",children:b(A=>A.HaiUnaTessera)}),e.jsxs("div",{children:[e.jsxs(ke,{to:Na,children:[b(A=>A.AccediArea)," "]})," ",b(A=>A.AccediArea2)]})]}),e.jsx(Cn,{previews:w,selectedId:(d=N==null?void 0:N.id)!==null&&d!==void 0?d:null,onSelect:A=>T(A,y??null),qty:x,children:A=>A!=null&&A.preview&&l?e.jsx(qa,{combinationData:i.combinationData,onSelect:l,preview:A.preview,departurePool:u,arrivalPool:c}):null})]}):e.jsx("div",{className:"alert alert-warning",children:b(A=>A.NotFareable)})})),Ym=Gr(Jm)(i=>i.allByKey(),"subscriptionTypes");var Ke=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Zm=Qi.ResponsiveCombo(),za=bt(pt(ci(_(class extends P.Component{constructor(i){var a,t,s,n,r,o,d;super(i),this.loadSubscriptionInfo=u=>Ke(this,void 0,void 0,function*(){var c,l,m,h,f,p,g,v,x;const S=(p=(f=u.departure)!==null&&f!==void 0?f:this.props.combinationData.departure)!==null&&p!==void 0?p:(c=this.props.departure)===null||c===void 0?void 0:c.id,y=(v=(g=u.arrival)!==null&&g!==void 0?g:this.props.combinationData.arrival)!==null&&v!==void 0?v:(l=this.props.arrival)===null||l===void 0?void 0:l.id,b=u.subscriptionType;if(!S||!b||b.maxKm!=null&&y==null&&!this.props.combinationData.departure)return;this.setState({loading:!0});const j=yield si.REQUEST_INFO({departureStopOrPool:S,arrivalId:y??S,subscriptionTypeId:b==null?void 0:b.id,date:u.date,saleChannel:this.props.salesChannel,personId:u.personId,paymentMethod:u.paymentMethod,ministeroVoucherData:u.btCode?{code:u.btCode.code,fiscalCode:u.btCode.fiscalCode,type:u.btCode.voucherType}:void 0,coupon:this.state.coupon,vatNumber:u.vatNumber,qty:u.qty,billingOperator:null,fareCategoryId:u.fareCategoryId,extraData:u.extraData}),I=this.props.i18n.get(oa).formatMessage;var N=null;return j!=null&&j.validityOk===!1&&(N=I(w=>w.ValidityNotIncludedWarning)),j!=null&&j.personIsInvariantForPrice!=((m=this.state.subscriptionInfo)===null||m===void 0?void 0:m.personIsInvariantForPrice)&&j.personIsInvariantForPrice&&(yield Re.fire(I(w=>w.CannotPurchaseTitle).replace("Non puoi acquistare questi prodotti!",""),I(w=>w.PersonPriceInvariantWarning))),this.setState({subscriptionInfo:j,couponCode:j==null?void 0:j.couponCode,coupon:j==null?void 0:j.couponCode,loading:!1,error:N,date:this.state.date==null?(x=(h=j==null?void 0:j.validity)===null||h===void 0?void 0:h.from)!==null&&x!==void 0?x:null:this.state.date}),this.sendSubscriptionSelectedEvent(j,b),j}),this.onChangeSubscriptionData=(u,c,l)=>Ke(this,void 0,void 0,function*(){var m,h,f,p,g,v,x,S,y,b,j,I,N,w,T,C,A,H,z,R,M,F,L,U,Y,W,E,Z,de;const ue=((m=this.state.subscriptionType)===null||m===void 0?void 0:m.id)!==(u==null?void 0:u.id),O=ue?null:this.state.btTrasporti;let se=this.state.fiscalCode,ae=this.state.enable730;!(u!=null&&u.enable730Transmission)||(c==null?void 0:c.fiscalCode)==null?se=null:this.state.enable730&&(c!=null&&c.fiscalCode)&&!se?se=c.fiscalCode:ue&&(ae=!0,se=c==null?void 0:c.fiscalCode),yield this.setState({person:c,subscriptionType:u,btTrasporti:O,name:(T=(w=c==null?void 0:c.name)!==null&&w!==void 0?w:this.state.name)!==null&&T!==void 0?T:(h=this.props.user)===null||h===void 0?void 0:h.name,surname:(A=(C=c==null?void 0:c.surname)!==null&&C!==void 0?C:this.state.surname)!==null&&A!==void 0?A:(f=this.props.user)===null||f===void 0?void 0:f.surname,email:(z=(H=c==null?void 0:c.email)!==null&&H!==void 0?H:this.state.email)!==null&&z!==void 0?z:(p=this.props.user)===null||p===void 0?void 0:p.email,callingCode:(M=(R=c==null?void 0:c.callingCode)!==null&&R!==void 0?R:this.state.callingCode)!==null&&M!==void 0?M:(g=this.props.user)===null||g===void 0?void 0:g.callingCode,ph
18oneNumber:(L=(F=c==null?void 0:c.phoneNumber)!==null&&F!==void 0?F:this.state.phoneNumber)!==null&&L!==void 0?L:(v=this.props.user)===null||v===void 0?void 0:v.phoneNumber,paymentMethod:null,useWallet:!1,forcedPrice:null,date:l,fiscalCode:se,enable730:ae,qty:1,fareCategory:c!=null?null:this.state.fareCategory,extraData:c!=null?{}:this.state.extraData}),yield this.loadSubscriptionInfo({departure:(U=this.props.combinationData.departure)!==null&&U!==void 0?U:(x=this.props.departure)===null||x===void 0?void 0:x.id,arrival:(W=(Y=this.props.combinationData.arrival)!==null&&Y!==void 0?Y:(S=this.props.arrival)===null||S===void 0?void 0:S.id)!==null&&W!==void 0?W:(y=this.props.departure)===null||y===void 0?void 0:y.id,subscriptionType:u,date:l,personId:(E=c==null?void 0:c.id)!==null&&E!==void 0?E:null,paymentMethod:(Z=(b=this.state.paymentMethod)===null||b===void 0?void 0:b.type)!==null&&Z!==void 0?Z:null,btCode:O,coupon:this.state.coupon,fiscalCode:O==null?void 0:O.fiscalCode,vatNumber:(j=this.state.invoiceData)===null||j===void 0?void 0:j.vatNumber,qty:1,fareCategoryId:c!=null?null:(de=(I=this.state.fareCategory)===null||I===void 0?void 0:I.id)!==null&&de!==void 0?de:null,extraData:c!=null?{}:this.state.extraData}),this.props.onChangePerson&&((N=this.state.person)===null||N===void 0?void 0:N.id)!=(c==null?void 0:c.id)&&(this.props.onChangePerson(c==null?void 0:c.id),c!=null&&c.fiscalCode&&this.setState({fiscalCode:c==null?void 0:c.fiscalCode}))}),this.sendSubscriptionSelectedEvent=(u,c)=>Ke(this,void 0,void 0,function*(){var l,m,h,f,p,g;const v={departure:u.departurePool,arrival:u.arrivalPool,subscriptionType:(l=c==null?void 0:c.description)!==null&&l!==void 0?l:"",subscriptionTypeId:(m=c==null?void 0:c.id)!==null&&m!==void 0?m:"",validityFrom:u.validity.from,validityTo:u.validity.to,validityOk:u.validityOk,tripsNumber:(h=u.tripsNumber)!==null&&h!==void 0?h:0,reliefId:(f=u.reliefId)!==null&&f!==void 0?f:"",reliefDescription:(p=u.reliefDescription)!==null&&p!==void 0?p:"",reliefAmount:(g=u.reliefAmount)!==null&&g!==void 0?g:0,price:u.price};qe.send(new Xl(v))}),this.applyCoupon=()=>Ke(this,void 0,void 0,function*(){var u,c,l,m,h,f,p,g,v,x,S,y,b,j;this.setState({couponCode:void 0}),yield this.loadSubscriptionInfo({departure:(v=this.props.combinationData.departure)!==null&&v!==void 0?v:(u=this.props.departure)===null||u===void 0?void 0:u.id,arrival:(S=(x=this.props.combinationData.arrival)!==null&&x!==void 0?x:(c=this.props.arrival)===null||c===void 0?void 0:c.id)!==null&&S!==void 0?S:(l=this.props.departure)===null||l===void 0?void 0:l.id,subscriptionType:this.state.subscriptionType,date:this.state.date,personId:(y=(m=this.state.person)===null||m===void 0?void 0:m.id)!==null&&y!==void 0?y:null,paymentMethod:(b=(h=this.state.paymentMethod)===null||h===void 0?void 0:h.type)!==null&&b!==void 0?b:null,btCode:this.state.btTrasporti,coupon:this.state.coupon,fiscalCode:(f=this.state.btTrasporti)===null||f===void 0?void 0:f.fiscalCode,vatNumber:(p=this.state.invoiceData)===null||p===void 0?void 0:p.vatNumber,qty:this.state.qty,fareCategoryId:(j=(g=this.state.fareCategory)===null||g===void 0?void 0:g.id)!==null&&j!==void 0?j:null,extraData:this.state.extraData})}),this.dismissCoupon=()=>Ke(this,void 0,void 0,function*(){var u,c,l,m,h,f,p,g,v,x,S,y,b,j;this.setState({couponCode:void 0,coupon:void 0}),yield this.loadSubscriptionInfo({departure:(v=this.props.combinationData.departure)!==null&&v!==void 0?v:(u=this.props.departure)===null||u===void 0?void 0:u.id,arrival:(S=(x=this.props.combinationData.arrival)!==null&&x!==void 0?x:(c=this.props.arrival)===null||c===void 0?void 0:c.id)!==null&&S!==void 0?S:(l=this.props.departure)===null||l===void 0?void 0:l.id,subscriptionType:this.state.subscriptionType,date:this.state.date,personId:(y=(m=this.state.person)===null||m===void 0?void 0:m.id)!==null&&y!==void 0?y:null,paymentMethod:(b=(h=this.state.paymentMethod)===null||h===void 0?void 0:h.type)!==null&&b!==void 0?b:null,btCode:this.state.btTrasporti,coupon:void 0,fiscalCode:(f=this.state.btTrasporti)===null||f===void 0?void 0:f.fiscalCode,vatNumber:(p=this.state.invoiceData)===null||p===void 0?void 0:p.vatNumber,qty:this.state.qty,fareCategoryId:(j=(g=this.state.fareCategory)===null||g===void 0?void 0:g.id)!==null&&j!==void 0?j:null,extraData:this.state.extraData})}),this.applyInvoiceData=fr((u,c)=>Ke(this,void 0,void 0,function*(){var l=new fi(this.props.i18n).validate(this.state.invoiceData);this.setState({invoiceData:c,invoice:u});const m=f=>Ke(this,void 0,void 0,function*(){var p,g,v,x,S,y,b,j,I,N;const w=(y=this.props.combinationData.departure)!==null&&y!==void 0?y:(p=this.props.departure)===null||p===void 0?void 0:p.id,T=(b=this.props.combinationData.arrival)!==null&&b!==void 0?b:(g=this.props.arrival)===null||g===void 0?void 0:g.id,C=this.state.subscriptionType;if(!w||!C||C.maxKm!=null&&T==null&&!this.props.combinationData.departure)return;const A=yield si.REQUEST_INFO({departureStopOrPool:w,arrivalId:T??w,subscriptionTypeId:C==null?void 0:C.id,date:this.state.date,
18saleChannel:this.props.salesChannel,personId:(j=(v=this.state.person)===null||v===void 0?void 0:v.id)!==null&&j!==void 0?j:null,paymentMethod:(I=(x=this.state.paymentMethod)===null||x===void 0?void 0:x.type)!==null&&I!==void 0?I:null,ministeroVoucherData:this.state.btTrasporti?{code:this.state.btTrasporti.code,fiscalCode:this.state.btTrasporti.fiscalCode,type:this.state.btTrasporti.voucherType}:void 0,coupon:this.state.coupon,vatNumber:f==null?void 0:f.vatNumber,qty:this.state.qty,billingOperator:null,fareCategoryId:(N=(S=this.state.fareCategory)===null||S===void 0?void 0:S.id)!==null&&N!==void 0?N:null,extraData:this.state.extraData});this.setState({subscriptionInfo:A,couponCode:A==null?void 0:A.couponCode,coupon:A==null?void 0:A.couponCode,error:null})});var h=new fi(this.props.i18n).validate(c);h.isValid?yield m(c):(!c||l.isValid)&&m(null)}),500),this.onChangeNotes=(u,c)=>this.setState({notes:c}),this.onChangeBonusTrasporti=u=>Ke(this,void 0,void 0,function*(){var c,l,m,h,f,p,g,v,x,S,y,b,j;this.setState({btTrasporti:u}),yield this.loadSubscriptionInfo({departure:(v=this.props.combinationData.departure)!==null&&v!==void 0?v:(c=this.props.departure)===null||c===void 0?void 0:c.id,arrival:(S=(x=this.props.combinationData.arrival)!==null&&x!==void 0?x:(l=this.props.arrival)===null||l===void 0?void 0:l.id)!==null&&S!==void 0?S:(m=this.props.departure)===null||m===void 0?void 0:m.id,subscriptionType:this.state.subscriptionType,date:this.state.date,personId:(y=(h=this.state.person)===null||h===void 0?void 0:h.id)!==null&&y!==void 0?y:null,paymentMethod:(b=(f=this.state.paymentMethod)===null||f===void 0?void 0:f.type)!==null&&b!==void 0?b:null,coupon:this.state.coupon,vatNumber:(p=this.state.invoiceData)===null||p===void 0?void 0:p.vatNumber,btCode:u,fiscalCode:u==null?void 0:u.fiscalCode,qty:this.state.qty,fareCategoryId:(j=(g=this.state.fareCategory)===null||g===void 0?void 0:g.id)!==null&&j!==void 0?j:null,extraData:this.state.extraData})}),this.onChangePaymentMethod=(u,c)=>Ke(this,[u,c],void 0,function*([l,m],h){var f,p,g,v,x,S,y,b,j,I,N,w,T,C;this.state.useWallet!=m&&this.setState({useWallet:m}),Wa.show730Transmision(this.state)?(this.setState({fiscalCode:null}),this.setState({enable730:!1})):((f=this.state.person)===null||f===void 0?void 0:f.fiscalCode)!=null&&(this.setState({fiscalCode:this.state.person.fiscalCode}),this.setState({enable730:!0})),(!Dr(h,this.state.additionalData)||l!=this.state.paymentMethod)&&(this.setState({paymentMethod:l,additionalData:h}),yield this.loadSubscriptionInfo({departure:(j=this.props.combinationData.departure)!==null&&j!==void 0?j:(p=this.props.departure)===null||p===void 0?void 0:p.id,arrival:(N=(I=this.props.combinationData.arrival)!==null&&I!==void 0?I:(g=this.props.arrival)===null||g===void 0?void 0:g.id)!==null&&N!==void 0?N:(v=this.props.departure)===null||v===void 0?void 0:v.id,subscriptionType:this.state.subscriptionType,date:this.state.date,personId:(w=(x=this.state.person)===null||x===void 0?void 0:x.id)!==null&&w!==void 0?w:null,paymentMethod:(T=l==null?void 0:l.type)!==null&&T!==void 0?T:null,btCode:this.state.btTrasporti,coupon:this.state.coupon,fiscalCode:(S=this.state.btTrasporti)===null||S===void 0?void 0:S.fiscalCode,vatNumber:(y=this.state.invoiceData)===null||y===void 0?void 0:y.vatNumber,qty:this.state.qty,fareCategoryId:(C=(b=this.state.fareCategory)===null||b===void 0?void 0:b.id)!==null&&C!==void 0?C:null,extraData:this.state.extraData}))}),this.validate=()=>{const{departure:u,arrival:c,combinationData:l}=this.props,{subscriptionType:m,date:h,person:f,paymentMethod:p,subscriptionInfo:g,name:v,surname:x,email:S,phoneNumber:y,rulesAccepted:b}=this.state,j=g.price,I=Wa.validate(this.state),N=this.props.i18n.get(oa).formatMessage;if(!I.isValid)return this.setState({error:N(T=>T.FiscalCodeError)}),!1;if(u){if(!c&&(m==null?void 0:m.maxKm)==null)return this.setState({error:N(T=>T.SelectArrivalError)}),!1;if((m==null?void 0:m.maxKm)!=null&&!l.departure)return this.setState({error:N(T=>T.SelectDepartureStopError)}),!1;if(m)if(h){if(m.personRequired&&!f)return this.setState({error:N(T=>T.SelectPersonError)}),!1;if(m.personRequired&&!Ne.isValidForSubscriptionIssue(f,m))return this.setState({error:N(T=>T.PersonNotValidError)}),!1;if(m.personRequired&&!Ne.isActive(f))return this.setState({error:N(T=>T.PersonNotActiveError)}),!1;if(!m.personRequired&&this.state.btTrasporti==null&&g.passengerNameRequired&&(!v||!x))return this.setState({error:N(T=>T.PassengerDataRequiredError)}),!1;if((!m.personRequired||(p==null?void 0:p.type)==17)&&!S&&!y)return this.setState({error:N(T=>T.ContactDataRequiredError)}),!1;if(f&&!Ne.isValidForSubscriptionPeriodIssue(f,g==null?void 0:g.validity,m==null?void 0:m.calculateValidityOnFirstReservation))return this.setState({error:N(T=>T.ValidityPeriodError)}),!1;if(g.validityOk)if(b){if(j>0&&p==null)return this.setState({error:N(T=>T.SelectPaymentMethodError)}),!1;if(this.props.user==null&&(this.state.directMarketing==null||this.state.indirectMarketing==null))return this.setState({marketingErrors:N(T=>T.SelectMarketingError)}),!1;if(this.state.invoice){var w=new fi(this.props.i18n).validate(this.state.invoiceData);if(this.setState({invoiceDataErrors:w.errors}),!w.isValid)return xt.warning(N(T=>T.InvoiceDataWarning)),!1}}else return this.setState({error:N(T=>T.AcceptTermsError)}),!1;else return this.setState({error:N(T=>T.ValidityPeriodError)}),!1}else return this.setState({error:N(T=>T.SelectStartDateError)}),!1;else return this.setState({error:N(T=>T.SelectSubscriptionTypeError)}),!1}else return this.setState({error:N(T=>T.SelectDepartureError)}),!1;return!0},this.onIssue=u=>{var c,l,m;const{departure:h,arrival:f,combinationData:p,user:g}=this.props,{subscriptionType:v,date:x,person:S,paymentMethod:y,forcedPrice:b,subscriptionInfo:j,name:I,surname:N,email:w,phoneNumber:T,callingCode:C,additionalData:A}=this.state,H=j.price;var z=this.validate();if(!z||!v||!x)return;const R=(l=p.departure)!==null&&l!==void 0?l:h.id,M=(m=p.arrival)!==null&&m!==void 0?m:(f??h).id,F=(Z,de,ue)=>{var O,se,ae,be,pe,oe;this.props.onIssue({departure:R,arrival:M,subscriptionType:v,date:x,person:S,paymentMethod:(be=y==null?void 0:y.type)!==null&&be!==void 0?be:null,invoiceData:this.state.invoice?this.state.invoiceData:null,forcedPrice:b??void 0,paymentDataId:A.paymentDataId,savePaymentData:A.savePaymentData,callingCode:C,email:w,phoneNumber:T,useWallet:this.state.useWallet,couponCode:this.state.couponCode,saleChannel:1,ministeroVoucherData:this.state.btTrasporti?{code:this.state.btTrasporti.code,fiscalCode:this.state.btTrasporti.fiscalCode,type:this.state.btTrasporti.voucherType}:void 0,fiscalCode:(O=this.state.btTrasporti)===null||O===void 0?void 0:O.fiscalCode,price:H,items:Rl(this.state.qty||1).map(le=>{var me,vt,Ae,nt,G;return{name:(Ae=(me=this.state.btTrasporti)===null||me===void 0?void 0:me.name)!==null&&Ae!==void 0?Ae:I,surname:(nt=(vt=this.state.btTrasporti)===null||vt===void 0?void 0:vt.surname)!==null&&nt!==void 0?nt:N,notes:(G=this.state.notes)!==null&&G!==void 0?G:void 0}}),anonymous:g==null,clientIntegrationPaymentId:Z??void 0,fiscalCode730:(pe=this.state.fiscalCode)!==null&&pe!==void 0?pe:void 0,sendSms:this.state.sendSms,numContratto:de,nexiApmResponse:ue,fareCategoryId:(se=this.state.fareCategory)===null||se===void 0?void 0:se.id,extraData:this.state.extraData,subPaymentMethod:(oe=(ae=this.state.additionalData)===null||ae===void 0?void 0:ae.subPaymentMethod)!==null&&oe!==void 0?oe:void 0})},{paymentMethodMetadata:L,validity:U}=j,{formatMessage:Y}=this.props.i18n.get(Cs);if((L==null?void 0:L.type)=="paypal"&&L.clientIntegration)fs(Z=>e.jsx(Pd,{payPalMetaData:L,proceed:de=>{Z.close(),F(de,void 0,void 0)},request:{subscription:{useWallet:this.state.useWallet,departure:R,arrival:M,paymentMethod:y.type,price:H,subscriptionType:v.id,validity:U}},formatMessage:Y,payPalFullWidth:!0}),{size:"lg",showFooter:!0});else{var W=null,E=void 0;((c=this.state.paymentMethod)===null||c===void 0?void 0:c.type)==3&&(W=this.state.nexiBuildClientIntegrationPaymentId),F(W,E,u)}},this.onToggleForcedPriceMode=()=>{var u,c;this.state.forcedPrice==null?this.setState({forcedPrice:(c=(u=this.state.subscriptionInfo)===null||u===void 0?void 0:u.price)!==null&&c!==void 0?c:null}):this.setState({forcedPrice:null})},this.onToggleResetPriceMode=()=>{this.state.forcedPrice==null?this.setState({forcedPrice:0}):this.setState({forcedPrice:null})},this.onChangeForcedPrice=u=>{u>=0&&this.setState({forcedPrice:u})},this.onAcceptRules=u=>{this.setState({rulesAccepted:u})},this.onChangeMarketingFlags=(u,c)=>{this.setState({directMarketing:c,indirectMarketing:u,marketingErrors:""})},this.setCoupon=(u,c)=>{this.setState({coupon:c})},this.setEnable730=u=>{var c;this.setState({enable730:u,fiscalCode:u?this.state.fiscalCode?this.state.fiscalCode:((c=this.state.person)===null||c===void 0?void 0:c.fiscalCode)||null:null})},this.setQty=u=>Ke(this,void 0,void 0,function*(){var c,l,m,h,f,p,g,v,x,S,y,b,j,I,N,w;const T=u<=0?1:u;this.setState({qty:T});let C=this.state.fareCategory;u>1&&((S=(l=(c=this.state.fareCategory)===null||c===void 0?void 0:c.extraParams)===null||l===void 0?void 0:l.length)!==null&&S!==void 0?S:0>0)&&(C=null,this.setState({fareCategory:null})),yield this.loadSubscriptionInfo({departure:(y=this.props.combinationData.departure)!==null&&y!==void 0?y:(m=this.props.departure)===null||m===void 0?void 0:m.id,arrival:(j=(b=this.props.combinationData.arrival)!==null&&b!==void 0?b:(h=this.props.arrival)===null||h===void 0?void 0:h.id)!==null&&j!==void 0?j:(f=this.props.departure)===null||f===void 0?void 0:f.id,subscriptionType:this.state.subscriptionType,date:this.state.date,personId:(I=(p=this.state.person)===null||p===void 0?void 0:p.id)!==null&&I!==void 0?I:null,paymentMethod:(N=(g=this.state.paymentMethod)===null||g===void 0?void 0:g.type)!==null&&N!==void 0?N:null,coupon:this.state.coupon,vatNumber:(v=this.state.invoiceData)===null||v===void 0?void 0:v.vatNumber,btCode:this.state.btTrasporti,fiscalCode:(x=this.state.btTrasporti)===null||x===void 0?void 0:x.fiscalCode,qty:T,fareCategoryId:(w=C==null?void 0:C.id)!==null&&w!==void 0?w:null,extraData:this.state.extraData}),yield this.onChangePaymentMethod([null,!1],_t)}),this.onChangeFareCategory=u=>Ke(this,void 0,void 0,function*(){var c,l,m,h,f,p,g,v,x,S,y,b,j;const{formatMessage:I}=this.props.i18n.get(Lt),N={},w=ri.extraParamsErrors(this.props.extraParamsData,u==null?void 0:u.extraParams,N,I);this.setState({fareCategory:u,extraData:N,extraDataErrors:w??null}),yield this.loadSubscriptionInfo({departure:(v=this.props.combinationData.departure)!==null&&v!==void 0?v:(c=this.props.departure)===null||c===void 0?void 0:c.id,arrival:(S=(x=this.props.combinationData.arrival)!==null&&x!==void 0?x:(l=this.props.arrival)===null||l===void 0?void 0:l.id)!==null&&S!==void 0?S:(m=this.props.departure)===null||m===void 0?void 0:m.id,subscriptionType:this.state.subscriptionType,date:this.state.date,personId:(y=(h=this.state.person)===null||h===void 0?void 0:h.id)!==null&&y!==void 0?y:null,paymentMethod:(b=(f=this.state.paymentMethod)===null||f===void 0?void 0:f.type)!==null&&b!==void 0?b:null,btCode:this.state.btTrasporti,coupon:void 0,fiscalCode:(p=this.state.btTrasporti)===null||p===void 0?void 0:p.fiscalCode,vatNumber:(g=this.state.invoiceData)===null||g===void 0?void 0:g.vatNumber,qty:this.state.qty,fareCategoryId:(j=u==null?void 0:u.id)!==null&&j!==void 0?j:null,extraData:this.state.extraData})}),this.onChangeExtraData=u=>Ke(this,void 0,void 0,function*(){var c,l,m,h,f,p,g,v,x,S,y,b,j,I,N;const{formatMessage:w}=this.props.i18n.get(Lt),T=ri.extraParamsErrors(this.props.extraParamsData,(c=this.state.fareCategory)===null||c===void 0?void 0:c.extraParams,u,w);this.setState({extraData:u,extraDataErrors:T??null}),yield this.loadSubscriptionInfo({departure:(S=this.props.combinationData.departure)!==null&&S!==void 0?S:(l=this.props.departure)===null||l===void 0?void 0:l.id,arrival:(b=(y=this.props.combinationData.arrival)!==null&&y!==void 0?y:(m=this.props.arrival)===null||m===void 0?void 0:m.id)!==null&&b!==void 0?b:(h=this.props.departure)===null||h===void 0?void 0:h.id,subscriptionType:this.state.subscriptionType,date:this.state.date,personId:(j=(f=this.state.person)===null||f===void 0?void 0:f.id)!==null&&j!==void 0?j:null,paymentMethod:(I=(p=this.state.paymentMethod)===null||p===void 0?void 0:p.type)!==null&&I!==void 0?I:null,btCode:this.state.btTrasporti,coupon:this.state.coupon,fiscalCode:(g=this.state.btTrasporti)===null||g===void 0?void 0:g.fiscalCode,vatNumber:(v=this.state.invoiceData)===null||v===void 0?void 0:v.vatNumber,qty:this.state.qty,fareCategoryId:(N=(x=this.state.fareCategory)===null||x===void 0?void 0:x.id)!==null&&N!==void 0?N:null,extraData:u})}),this.state={subscriptionTypes:[],subscriptionType:(o=i.subscriptionType)!==null&&o!==void 0?o:null,subscriptionInfo:null,person:null,date:null,paymentMethod:null,loading:!1,error:null,invoice:!1,additionalData:_t,invoiceData:new oi(this.props.roles.indexOf(ce.canrequestinvoice.name)!=-1),invoiceDataErrors:new Ia,forcedPrice:null,useWallet:!1,btTrasporti:null,notes:null,name:(a=i.user)===null||a===void 0?void 0:a.name,surname:(t=i.user)===null||t===void 0?void 0:t.surname,email:(s=i.user)===null||s===void 0?void 0:s.email,callingCode:(d=(n=i.user)===null||n===void 0?void 0:n.callingCode)!==null&&d!==void 0?d:"+39",phoneNumber:(r=i.user)===null||r===void 0?void 0:r.phoneNumber,fiscalCode:null,enable730:!0,qty:1,nexiBuildClientIntegrationPaymentId:null,nexiNumContratto:null,sendSms:!1,marketingErrors:"",rulesAccepted:!1,fareCategory:null,extraDataErrors:null,extraData:{}}}componentDidMount(){return Ke(this,void 0,void 0,function*(){var i,a,t,s,n,r,o,d,u,c,l;const{departure:m,arrival:h,combinationData:f,subscriptionType:p,personCode:g}=this.props;var v=null;g&&(v=yield Ve.getByCode(g)),p&&(yield this.onChangeSubscriptionData(p,v&&v[0],null)),m&&h&&(yield this.loadSubscriptionInfo({departure:(r=f.departure)!==null&&r!==void 0?r:m==null?void 0:m.id,arrival:(d=(o=f.arrival)!==null&&o!==void 0?o:h==null?void 0:h.id)!==null&&d!==void 0?d:m==null?void 0:m.id,subscriptionType:this.state.subscriptionType,date:this.state.date,personId:(u=(i=this.state.person)===null||i===void 0?void 0:i.id)!==null&&u!==void 0?u:null,paymentMethod:(c=(a=this.state.paymentMethod)===null||a===void 0?void 0:a.type)!==null&&c!==void 0?c:null,btCode:this.state.btTrasporti,coupon:this.state.coupon,fiscalCode:(t=this.state.btTrasporti)===null||t===void 0?void 0:t.fiscalCode,vatNumber:(s=this.state.invoiceData)===null||s===void 0?void 0:s.vatNumber,qty:this.state.qty,fareCategoryId:(l=(n=this.state.fareCategory)===null||n===void 0?void 0:n.id)!==null&&l!==void 0?l:null,extraData:this.state.extraData}))})}componentDidUpdate(i){return Ke(this,void 0,void 0,function*(){var a,t,s,n,r,o,d,u,c,l,m,h,f,p,g,v;const{departure:x,arrival:S,combinationData:y}=this.props;if((x==null?void 0:x.id)!=((a=i.departure)===null||a===void 0?void 0:a.id)||(S==null?void 0:S.id)!=((t=i.arrival)===null||t===void 0?void 0:t.id))if(S==null||x==null)this.setState({subscriptionTypes:[],subscriptionType:null,subscriptionInfo:null,person:null});else{this.setState({subscriptionTypes:null});const{types:b}=yield si.getfor(x.id,S.id);this.setState({subscriptionTypes:b,subscriptionType:null,subscriptionInfo:null,person:null})}else(y.departure!=i.combinationData.departure||y.arrival!=i.combinationData.arrival)&&(yield this.loadSubscriptionInfo({departure:(m=this.props.combinationData.departure)!==null&&m!==void 0?m:(s=this.props.departure)===null||s===void 0?void 0:s.id,arrival:(f=(h=this.props.combinationData.arrival)!==null&&h!==void 0?h:(n=this.props.arrival)===null||n===void 0?void 0:n.id)!==null&&f!==void 0?f:(r=this.props.departure)===null||r===void 0?void 0:r.id,subscriptionType:this.state.subscriptionType,date:this.state.date,personId:(p=(o=this.state.person)===null||o===void 0?void 0:o.id)!==null&&p!==void 0?p:null,paymentMethod:(g=(d=this.state.paymentMethod)===null||d===void 0?void 0:d.type)!==null&&g!==void 0?g:null,btCode:this.state.btTrasporti,coupon:this.state.coupon,fiscalCode:(u=this.state.btTrasporti)===null||u===void 0?void 0:u.fiscalCode,vatNumber:(c=this.state.invoiceData)===null||c===void 0?void 0:c.vatNumber,qty:this.state.qty,fareCategoryId:(v=(l=this.state.fareCategory)===null||l===void 0?void 0:l.id)!==null&
18&v!==void 0?v:null,extraData:this.state.extraData}))})}render(){var i,a,t,s,n,r,o,d,u,c,l,m,h,f,p,g,v,x,S,y,b,j,I,N,w,T,C,A,H,z,R,M,F;const{subscriptionType:L,person:U,date:Y,paymentMethod:W,forcedPrice:E,name:Z,surname:de,btTrasporti:ue}=this.state,{departure:O,arrival:se,combinationData:ae,onChangeCombinationData:be}=this.props,{i18n:pe}=this.props,oe=pe.get(Ft).formatMessage,le=pe.get(oa).formatMessage,me=this.props.roles.indexOf((L==null?void 0:L.type)==1?ce.canissueopentickets.name:ce.canissuesubscriptions.name)!=-1,vt=me&&this.props.roles.find(B=>B==ce.canrequestinvoice.name||B==ce.canrequestinvoiceforprivateusers.name)!=null,Ae=U||!(L!=null&&L.personRequired),nt={pathname:Na,search:`?returnUrl= ${encodeURIComponent(window.location.href)}`},G=(f=(h=ae.departure)!==null&&h!==void 0?h:O==null?void 0:O.id)!==null&&f!==void 0?f:"",ve=(g=(p=ae.arrival)!==null&&p!==void 0?p:(i=se??O)===null||i===void 0?void 0:i.id)!==null&&g!==void 0?g:"",ge=(v=this.state.forcedPrice)!==null&&v!==void 0?v:((x=(a=this.state.subscriptionInfo)===null||a===void 0?void 0:a.price)!==null&&x!==void 0?x:0)*this.state.qty,ee=this.state.loading||!L||!this.state.subscriptionInfo,$e=L!=null&&!L.personRequired&&U==null;return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-12 col-lg-7",children:this.props.departure&&this.props.arrival&&e.jsx(Ym,{departure:this.props.departure.id,arrival:this.props.arrival.id,saleChannel:this.props.salesChannel,navigate:this.props.navigate,mode:this.props.mode,onSelect:(B,je)=>{this.onChangeSubscriptionData(B,je,null),O&&this.props.onChangeSearchData&&this.props.onChangeSearchData(O.description,(je==null?void 0:je.id)!==(U==null?void 0:U.id)||B==null?void 0:B.description,je==null?void 0:je.code)},onChangeStops:B=>{be&&be(B),this.props.onChangeSearchData&&this.props.onChangeSearchData(ae.departure)},combinationData:this.props.combinationData,qty:1,subscriptionTypeId:L==null?void 0:L.id,person:U})}),L!=null&&e.jsx("div",{className:"col-12 col-lg-5",children:e.jsx("div",{className:"card",children:e.jsxs("div",{className:"card-body",children:[L.maxKm!=null&&O!=null&&be&&e.jsx(gu,{id:O.id,selector:B=>{var je;return e.jsx(Zm,{data:B.stopsIds,required:!0,idSelector:Le=>Le,onSelect:Le=>be({departure:Le,arrival:null,isValidForAllPools:!1}),textField:Le=>{var jt,mi;return(mi=(jt=ht.getStop(Le))===null||jt===void 0?void 0:jt.description)!==null&&mi!==void 0?mi:""},itemComponent:Le=>e.jsx(Vt,{id:Le.item}),allowNull:!1,label:le(Le=>Le.DepartureStop),value:(je=B.stopsIds.find(Le=>Le==ae.departure))!==null&&je!==void 0?je:null})}}),L.type==1&&e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-12 col-md-6",children:e.jsx(om,{value:this.state.qty,onAdd:()=>this.setQty(this.state.qty+1),onRemove:()=>this.setQty(this.state.qty-1),class:"justify-content-between mb-2",label:le(B=>B.Quantity)})})}),(L.personRequired==!1||(W==null?void 0:W.type)==17)&&e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-12 col-md-6",children:e.jsx(Ct,{name:"name",label:le(B=>B.Name),value:(y=(S=ue==null?void 0:ue.name)!==null&&S!==void 0?S:Z)!==null&&y!==void 0?y:"",disabled:ue!=null||((b=U==null?void 0:U.name)!==null&&b!==void 0?b:"").length>0,onChange:(B,je)=>this.setState({name:je}),maxLength:150})}),e.jsx("div",{className:"col-12 col-md-6",children:e.jsx(Ct,{label:le(B=>B.Surname),name:"surname",value:(I=(j=ue==null?void 0:ue.surname)!==null&&j!==void 0?j:de)!==null&&I!==void 0?I:"",disabled:ue!=null||((N=U==null?void 0:U.surname)!==null&&N!==void 0?N:"").length>0,onChange:(B,je)=>this.setState({surname:je}),maxLength:150})}),e.jsxs("div",{className:"col-sm-12 col-md-6",children:[e.jsx(Nr,{label:le(B=>B.Email),disabled:((w=U==null?void 0:U.email)!==null&&w!==void 0?w:"").length>0,value:this.state.email||"",onChange:(B,je)=>this.setState({email:je})}),e.jsx(ze,{role:ce.cansendsms,children:e.jsx(ct,{checked:this.state.sendSms,onChange:()=>this.setState({sendSms:!this.state.sendSms}),label:le(B=>B.SendSms)})})]}),e.jsx("div",{className:"col-sm-12 col-md-6",children:e.jsx(xs,{label:le(B=>B.Mobile),name:"phone",callingCode:this.state.callingCode||"+39",phoneNumber:this.state.phoneNumber||"",onChange:(B,je,Le)=>this.setState({callingCode:je,phoneNumber:Le}),disabled:((T=U==null?void 0:U.phoneNumber)!==null&&T!==void 0?T:"").length>0})})]}),$e&&this.state.subscriptionType&&this.state.subscriptionType.onlyCategories!=null&&this.state.subscriptionType.onlyCategories.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-12",children:e.jsx(Dd,{selectedId:(C=(t=this.state.fareCategory)===null||t===void 0?void 0:t.id)!==null&&C!==void 0?C:null,onSelect:this.onChangeFareCategory,subscriptionType:this.state.subscriptionType,startValidity:Y||new Date,qty:this.state.qty})}),this.state.fareCategory&&e.jsx("div",{className:"col-12",children:e.jsx(Ju,{extraParams:(A=this.state.fareCategory.extraParams)!==null&&A!==void 0?A:[],extraData:this.state.extraData,onChange:this.onChangeExtraData,errors:(H=this.state.extraDataErrors)!==null&&H!==void 0?H:void 0,maxDepartureDate:null,fromPersonId:(s=this.state.person)===null||s===void 0?void 0:s.id})})]}),(L==null||L.calculateValidityOnFirstReservation)&&Ae?null:e.jsx("div",{className:"my-2",children:e.jsx(Yu,{date:(z=Y??((r=(n=this.state.subscriptionInfo)===null||n===void 0?void 0:n.validity)===null||r===void 0?void 0:r.from))!==null&&z!==void 0?z:new Date,onChange:B=>{if(U!=null&&!Ne.isActive(U,k.getMaxDate([B,k.Today()]))){xt.warning(le(Le=>Le.CardNotValidForPeriod)),this.setState({date:B,subscriptionInfo:null});return}let je=L!=null&&L.salePeriod.from.valueOf()>B.valueOf()?L.salePeriod.from:B;this.onChangeSubscriptionData(L,U,je)},subscriptionType:L,disabled:this.props.roles.find(B=>B==ce.canchangesubscriptionstartvalidity.name)==null})}),Ae&&e.jsx(ze,{role:ce.caninsertpassengernotes,children:e.jsx("div",{children:e.jsx(Ct,{label:le(B=>B.Notes),placeholder:le(B=>B.Notes),name:"notes",style:{marginBottom:5},value:this.state.notes||"",onChange:this.onChangeNotes,maxLength:200})})}),this.state.subscriptionInfo&&((o=this.state.subscriptionInfo)===null||o===void 0?void 0:o.price)>0&&Ae&&e.jsxs("div",{className:"row mt-1",children:[e.jsxs("div",{className:"col-12 col-lg-6",children:[e.jsx(Ct,{name:"coupon",label:le(B=>B.Coupon),placeholder:le(B=>B.CouponPlaceholder),value:this.state.coupon||"",onChange:this.setCoupon,readonly:!!this.state.couponCode,style:{maxWidth:250},children:e.jsx("button",{type:"button",className:"btn btn-primary",onClick:this.state.couponCode?this.dismissCoupon:this.applyCoupon,children:this.state.couponCode?le(B=>B.CouponDissociate):le(B=>B.CouponApply)})}),this.state.couponCode&&Ae&&e.jsx("div",{className:"text-danger",children:le(B=>B.CouponApplied)})]}),e.jsxs("div",{className:"col-12 col-lg-6",children:[this.state.subscriptionInfo&&Ae&&e.jsx(Id,{btTrasporti:this.state.btTrasporti,onApply:this.onChangeBonusTrasporti,subscriptionType:L,passengerData:{person:U,name:(R=this.state.name)!==null&&R!==void 0?R:"",surname:(M=this.state.surname)!==null&&M!==void 0?M:""},subscriptionInfo:this.state.subscriptionInfo}),this.state.subscriptionInfo&&Ae&&e.jsx(Td,{btTrasporti:this.state.btTrasporti,onApply:this.onChangeBonusTrasporti,subscriptionType:L,subscriptionInfo:this.state.subscriptionInfo})]})]}),L!=null&&L.personRequired&&this.state.person==null&&e.jsxs("div",{className:"alert alert-warning mt-2 mb-2",children:[e.jsx("strong",{style:{marginRight:10,fontSize:"0.8em"},children:le(B=>B.CardRequired)}),e.jsxs("div",{children:[le(B=>B.CardRequiredDescription),this.props.user&&e.jsx(ze,{role:Xi.persons.write,children:e.jsxs("div",{children:[e.jsx(at,{to:D.MyPersonsPage,children:le(B=>B.ClickHereToCreateNew)}),"."]})})||e.jsx("div",{children:e.jsx(at,{to:Ir(window.location.href),children:le(B=>B.LoginOrRegisterToCreate)})})]})]}),O&&(se||ae.departure)&&L!=null&&Ae&&e.jsx(_d,{info:this.state.subscriptionInfo,type:this.state.subscriptionType,forcedPrice:E,onChangeForcePrice:this.onChangeForcedPrice,onClickForcePrice:this.onToggleForcedPriceMode,onClickResetPrice:this.onToggleResetPriceMode,loading:this.state.loading}),me&&O&&(se||ae.departure)&&this.state.subscriptionInfo!=null&&(L.personRequired&&U||!L.personRequired)&&e.jsxs("div",{className:"py-2",children:[this.state.subscriptionInfo.price>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fw-bold fontsize-2u mt-2 mb-1",children:le(B=>B.PaymentMode)}),e.jsx(Tr,{selectedPaymentMethod:[W,this.state.useWallet],onChangePaymentMethod:this.onChangePaymentMethod,price:ge,additionalData:this.state.additionalData,walletRechargeLink:D.WalletPath,saleChannel:this.props.salesChannel,sisalExcluded:this.state.btTrasporti!=null&&this.state.btTrasporti.isOk,clientIntegrationPaymentId:null,hasCommissionKept:((F=(d=this.state.subscriptionInfo)===null||d===void 0?void 0:d.commissionKept)!==null&&F!==void 0?F:0)>0,nexiBuildProceed:(B,je)=>{this.setState({nexiBuildClientIntegrationPaymentId:B,nexiNumContratto:je})},nexiBuildRequest:{subscription:{useWallet:this.state.useWallet,departure:G,arrival:ve,subscriptionType:L.id,price:ge,validity:this.state.subscriptionInfo.validity,paymentMethod:((u=this.state.paymentMethod)===null||u===void 0?void 0:u.type)||0}},nexiClientIntegrationPaymentId:this.state.nexiBuildClientIntegrationPaymentId,vatNumber:(c=this.state.invoiceData)===null||c===void 0?void 0:c.vatNumber}),ns((l=this.state.paymentMethod)===null||l===void 0?void 0:l.type)&&e.jsx("div",{style:{maxWidth:400},children:e.jsx(_r,{})}),e.jsx(kd,{paymentMethod:(m=this.state.paymentMethod)===null||m===void 0?void 0:m.type,expiryDate:this.state.additionalData.expirationDate})]}),Wa.show730Transmision(Object.assign({},this.state))&&e.jsx("div",{className:"row mt-2 mb-2",children:e.jsx(ed,{enable730:this.state.enable730,setEnable730:B=>this.setEnable730(B),fiscalCode:this.state.fiscalCode,setFiscalCode:B=>this.setState({fiscalCode:B})})}),vt&&e.jsx("div",{children:e.jsx(Ps,{invoice:this.state.invoice,invoiceData:this.state.invoiceData,onChange:(B,je)=>this.applyInvoiceData(B,je),errors:this.state.invoiceDataErrors,searchBar:!0})})]}),this.props.user==null&&e.jsxs("div",{className:"mb-2",children:[" ",e.jsx(kr,{directMarketing:this.state.directMarketing,indirectMarketing:this.state.indirectMarketing,errors:this.state.marketingErrors,onChange:this.onChangeMarketingFlags})]}),me&&Ae&&e.jsx("div",{style:{marginBottom:10},children:e.jsxs("div",{className:`alert ${this.state.rulesAccepted?"alert-success":"alert-primary-light"} d-flex align-items-center`,children:[e.jsx(ct,{className:"border-highlighted",name:"rulesAccepted",checked:this.state.rulesAccepted,onChange:this.onAcceptRules}),e.jsx(wa,{})]})}),this.state.error&&e.jsx("div",{className:"my-2",children:e.jsx(ot,{error:this.state.error})}),me?this.state.subscriptionInfo&&!ee&&e.jsxs("button",{type:"button",className:"btn btn-primary btn-lg w-100",role:"button",onClick:()=>this.onIssue(void 0),disabled:ee,children:[e.jsx("span",{style:{marginRight:10},className:"fa fa-shopping-cart","aria-hidden":"true"})," ",le(B=>B.Purchase)]}):this.props.user==null?e.jsx(at,{to:nt,className:"btn btn-primary py-2 px-4 btn-highlight fw-bolder text-medium w-100",children:oe(B=>B.SignIn)}):e.jsxs("div",{className:"alert alert-warning",children:[e.jsx("strong",{children:le(B=>B.CannotPurchaseTitle)}),e.jsx("br",{}),le(B=>B.CannotPurchaseDescription)]})]})})})]})})}}))))(i=>i.allByKey(),"extraParamsData");var En=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Xm=({history:i,dep:a,arr:t,mode:s,i18n:n,className:r})=>{var o,d,u;const[c]=di(),l=Di.useAll(),m=c.get("tab"),h=(d=(o=l==null?void 0:l.find(w=>w.id===m))===null||o===void 0?void 0:o.id)!==null&&d!==void 0?d:null,f=qr.use(a,t),p=a&&t?f:[],[g,v]=P.useState(()=>hi.getDeparture(a,h)),[x,S]=P.useState(()=>hi.getArrival(t,h));P.useEffect(()=>{const w=()=>{v(hi.getDeparture(a,h)),S(hi.getArrival(t,h))};return hi.Changed.register(w),()=>hi.Changed.unregister(w)},[a,t,h]),P.useEffect(()=>{En(void 0,void 0,void 0,function*(){a&&(yield jn.GetDepartures(h),yield jn.GetArrivals(a,h))})},[a,t,h]);const{formatMessage:y}=n.get(ie),b=w=>En(void 0,void 0,void 0,function*(){const T=yield si.ISSUE(w,we(D.subscriptionokPath),we(D.subscriptionkoPath),void 0,Ui(D.PayByLinkSubscriptionsPath));j(w);let C=!0;
18if(T.redirect&&(C=yield st(T.redirect,i)),C)i(D.SubscriptionOk(T.result.id,T.result.pnr));else throw"unexpected error"}),j=w=>{var T,C,A;const H={departure:w.departure,arrival:w.arrival,subscriptionTypeId:w.subscriptionType.id,subscriptionType:w.subscriptionType.description,fareCategoryId:(C=w.fareCategoryId)!==null&&C!==void 0?C:"",paymentMethod:w.paymentMethod?Pe.getPaymentMethodStringDescription(w.paymentMethod):"",personCode:(A=(T=w.person)===null||T===void 0?void 0:T.code)!==null&&A!==void 0?A:"",price:w.price};qe.send(new bs(H))},I=f==null,N=!I&&((u=p==null?void 0:p.length)!==null&&u!==void 0?u:0)===0;return e.jsxs("div",{className:"container px-0",children:[s==="view"&&e.jsx("div",{className:r,children:I?e.jsx("div",{className:"text-center",children:e.jsx("div",{className:"spinner-border text-primary",role:"status",children:e.jsx("span",{className:"visually-hidden",children:"Caricamento..."})})}):N?e.jsx("div",{className:"alert alert-info text-center",role:"alert",children:y(w=>w.NoSolutionsAvailable)}):p==null?void 0:p.map((w,T)=>e.jsx(Oo,{solution:w,purchaseLink:void 0},T))}),s==="purchase"&&e.jsx("div",{className:r,children:e.jsx(za,{departure:g,arrival:x,combinationData:{departure:a,arrival:t,isValidForAllPools:!1},mode:null,salesChannel:1,onIssue:b,navigate:i,onChangeCombinationData:()=>{}})})]})},eh=_(Xm);function th({timeTables:i,departureId:a,i18n:t}){const{formatMessage:s}=t.get(ie),[n,r]=P.useState(new Set),o=u=>{r(c=>{const l=new Set(c);return l.has(u)?l.delete(u):l.add(u),l})},d=u=>{let c=!1;return u.Stops.map((m,h)=>((m.Stop.stopId===a||a==null)&&(c=!0),c?m:null)).filter(m=>m!=null)};return e.jsx(e.Fragment,{children:i.map((u,c)=>{var l;return e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-primary mb-3",children:u.timeTable}),e.jsx("div",{className:"timeline-trips",children:(l=u.trips)===null||l===void 0?void 0:l.map((m,h)=>{const f=`${c}-${h}`,p=n.has(f),g=m.Stops[0],v=m.Stops[m.Stops.length-1],x=m.Stops.find(I=>I.Stop.stopId==a),S=d(m),y=S[0].TransitTime.DepartureTime,b=S[S.length-1].TransitTime.DepartureTime,j=Math.round((b.valueOf()-y.valueOf())/60);return e.jsx("div",{className:"card mb-2 shadow-sm",style:{borderLeft:m.Route.Color?`5px solid ${m.Route.Color}`:void 0},children:e.jsxs("div",{className:"card-body py-2 px-3",children:[e.jsxs("div",{className:"d-flex align-items-center gap-3",children:[e.jsx("span",{className:"fontsize-10u",style:{minWidth:"60px",fontFamily:"monospace"},children:x==null?void 0:x.TransitTime.DepartureTime.toTimeString()}),e.jsxs("div",{className:"d-flex align-items-center gap-2",children:[e.jsx("i",{className:"d-none d-lg-flex fa-solid fa-bus fontsize-6u"}),m.Data.DailyCode&&e.jsx("span",{className:"badge bg-primary rounded-pill d-flex align-items-center justify-content-center",children:m.Data.DailyCode})]}),e.jsx("div",{className:"d-flex flex-grow-1 align-items-center gap-2",children:e.jsxs("div",{className:"fontsize-4u",children:[e.jsx(Vt,{id:g.Stop.stopId})," - ",e.jsx(Vt,{id:v.Stop.stopId})]})}),e.jsx("div",{className:"d-none d-lg-flex align-items-center gap-2",children:e.jsx("div",{className:"text-truncate",children:e.jsx("p",{className:"card-text mb-0",children:e.jsxs("span",{className:"text-muted",children:[e.jsx("i",{className:"fa-solid fa-clock me-2"}),j," ",s(I=>I.Min)]})})})}),e.jsx("div",{className:"d-none d-lg-flex",style:{minWidth:0},children:e.jsx("div",{className:"text-truncate",children:e.jsx("p",{className:"card-text mb-0",children:e.jsxs("span",{className:"text-muted",children:[e.jsx("i",{className:"fa-solid fa-map-pin me-2"}),S.length," ",s(I=>I.Stops)]})})})}),e.jsx("button",{className:"btn btn-link text-dark p-0",onClick:()=>o(f),"aria-label":s(p?I=>I.Collapse:I=>I.Expand),style:{minWidth:"30px"},children:e.jsx("i",{className:`fa-solid fa-chevron-${p?"up":"down"}`})})]}),p&&e.jsxs("div",{className:"mt-3 pt-3 border-top",children:[e.jsx("h6",{className:"mb-3",children:s(I=>I.StopsLabel)}),e.jsx("div",{className:"list-group",children:S.map((I,N)=>e.jsx("div",{className:"list-group-item d-flex justify-content-between align-items-center",children:e.jsxs("div",{children:[e.jsx("i",{className:"fa-solid fa-location-dot me-2 text-danger"}),e.jsx("strong",{style:{fontFamily:"monospace"}
18,children:I.TransitTime.DepartureTime.toTimeString()}),e.jsx("span",{className:"ms-2",children:e.jsx(Vt,{id:I.Stop.stopId})})]})},N))})]})]})},f)})})]},"timetable"+c)})})}const ih=_(th),Lo=i=>{const{timeTable:a,departureId:t}=i;let s=400,n=100;const r=()=>{let o=!1;return a.Stops.map((d,u)=>((d.StopId===t||t==null)&&(o=!0),o?e.jsxs("tr",{children:[e.jsx("td",{className:"text-nowrap",children:e.jsx(Vt,{id:d.StopId})}),d.StopTimes.map((c,l)=>{var m,h,f;return e.jsx("td",{className:"text-center text-nowrap",children:(f=(h=(m=c==null?void 0:c.TransitTime)===null||m===void 0?void 0:m.ArrivalTime)===null||h===void 0?void 0:h.toTimeString())!==null&&f!==void 0?f:"-"},l)})]},u):null)).filter(d=>d!=null)};return e.jsxs(td,{bordered:!0,responsive:!0,hover:!0,striped:!0,className:"table align-middle",style:{width:"auto"},children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{style:{width:s},children:"Percorso"}),a.Trips.map((o,d)=>e.jsx("th",{className:"text-center text-nowrap",style:{width:n},children:o.Route.Description},o.Id))]}),e.jsxs("tr",{children:[e.jsx("th",{style:{width:s},children:"Corsa"}),a.Trips.map((o,d)=>e.jsx("th",{className:"text-center text-nowrap",style:{width:n},children:o.Data.DailyCode},o.Id))]})]}),e.jsx("tbody",{children:r()})]})};function ah({timeTables:i,departureId:a}){return e.jsx(e.Fragment,{children:i.map((t,s)=>e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-primary mb-3",children:t.timeTable}),t.timeTables.map((n,r)=>e.jsx(Lo,{timeTable:n,departureId:a,refLineIds:Ls.getall().filter(o=>o.type===4).map(o=>o.id)},"table"+r))]},"timetable"+s))})}var Fn=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const sh=({stopId:i,poolId:a,date:t,mode:s,saleGroupId:n,i18n:r,className:o,type:d,personCode:u})=>{var c,l,m,h;const[f,p]=P.useState(null),[g,v]=P.useState(!1),[x,S]=P.useState(!1),[y,b]=P.useState("table"),j=_e(),{formatMessage:I}=r.get(ie),N=zs.useAll(),w=fu.useAll(),T=Ls.useAll(),C=N==null?void 0:N.find(M=>M.id===a);if(P.useEffect(()=>{window.innerWidth<768&&b("timeline")},[]),C&&s==="purchase"){const M={departureId:C.id,arrivalId:C.id,departure:C.description,arrival:C.description};qe.send(new ys(M))}const A=M=>{var F,L,U;const Y={departure:M.departure,arrival:M.arrival,subscriptionTypeId:M.subscriptionType.id,subscriptionType:M.subscriptionType.description,fareCategoryId:(L=M.fareCategoryId)!==null&&L!==void 0?L:"",paymentMethod:M.paymentMethod?Pe.getPaymentMethodStringDescription(M.paymentMethod):"",personCode:(U=(F=M.person)===null||F===void 0?void 0:F.code)!==null&&U!==void 0?U:"",price:M.price};qe.send(new bs(Y))},H=M=>Fn(void 0,void 0,void 0,function*(){S(!0);try{const F=yield si.ISSUE(M,we(D.subscriptionokPath),we(D.subscriptionkoPath),void 0,we(D.PayByLinkSubscriptionsPath));A(M);let L=!0;if(F.redirect&&(L=yield st(F.redirect,j)),L)j(D.SubscriptionOk(F.result.id,F.result.pnr));else throw new Error("Payment cancelled")}catch(F){console.error("Error issuing subscription:",F)}finally{S(!1)}});P.useEffect(()=>{if(!i||!t||!T){p(null);return}Fn(void 0,void 0,void 0,function*(){v(!0);try{const F=T.filter(O=>O.type===4);if(F.length===0){p([]),v(!1);return}const L=F.map(O=>O.id).join(","),Z=(yield new Es().getRoutesForTimeTable(i,L,t)).flatMap(O=>{const se=no.factory({Color:O.color,CustomersDescription:O.customersDescription,Description:O.description,Direction:O.direction,LineId:O.lineId,IsShuttle:O.isShuttle});return O.tripTemplates.map(ae=>{var be,pe;const oe={DailyCode:ae.dailyCode,CarrierId:ae.carrierId,OperatingCalendarId:ae.operatingCalendarId,Validities:((be=ae.validities)!==null&&be!==void 0?be:[]).map(me=>ro.fromDto(me)),Tags:ae.tags},le=ae.stops.map(me=>new lo(oo.factory(me.stopId),new Dt(me.stopTime),new Dt(me.stopTime),new Dt(me.timeFromPrevious)));return new co(se,ae.templateId,O.routeCode,oe,le,(pe=O.timeTable)!==null&&pe!==void 0?pe:`${F.find(me=>me.id===O.lineId).description} (${O.direction==0?I(me=>me.Outbound):I(me=>me.Return)})`)})}).filter(O=>O.Stops.length>0).sort((O,se)=>{const ae=O.Stops[0].TransitTime.DepartureTime,be=se.Stops[0].TransitTime.DepartureTime;return ae.valueOf()-be.valueOf()}),de=it(Z,O=>{var se;return(se=O.TimeTable)!==null&&se!==void 0?se:""}),ue=Object.values(mt(de,O=>{var se;return{timeTable:(se=O[0].TimeTable)!==null&&se!==void 0?se:"",timeTables:uo.Factory(O,O[0].Route.Direction),trips:O}}));p(ue)}catch(F){console.error("Error loading city timetables:",F),p([])}finally{v(!1)}})},[i,t]);const z=(M,F,L)=>{const U=new URLSearchParams(window.location.search);F?U.set("type",F):U.delete("type"),L?U.set("personCode",L):U.delete("personCode");const Y=Ni.getLocale();j(`/${Y}/?${U.toString()}`,{replace:!0})};var R=void 0;return d&&(R=(l=(c=w==null?void 0:w.find(M=>V.invariantEquals(M.description,d)))!==null&&c!==void 0?c:w==null?void 0:w.find(M=>V.startsWith(M.description,d)))!==null&&l!==void 0?l:w==null?void 0:w.find(M=>V.contains(M.description,d))),e.jsxs("div",{className:"container px-0",children:[s==="view"&&e.jsxs("div",{className:`${o}`,children:[g&&e.jsx(X,{}),!g&&!f&&null,!g&&f&&f.length===0&&e.jsx("div",{className:"alert alert-info text-center",role:"alert",children:I(M=>M.NoSolutionsAvailable)}),!g&&f&&f.length>0&&e.jsxs("div",{className:"pt-2",children:[e.jsx("div",{className:"d-none d-md-flex justify-content-center mb-4",children:e.jsxs("div",{className:"btn-group",role:"group",children:[e.jsxs("button",{type:"button",className:`btn ${y==="table"?"btn-primary":"btn-outline-primary"} rounded-start`,onClick:()=>b("table"),children:[e.jsx("i",{className:"fa-solid fa-table me-2"}),I(M=>M.TimeTableView)]}),e.jsxs("button",{type:"button",className:`btn ${y==="timeline"?"btn-primary":"btn-outline-primary"} rounded-end`,onClick:()=>b("timeline"),children:[e.jsx("i",{className:"fa-solid fa-clock me-2"}),I(M=>M.TimelineView)]})]})}),y==="table"&&e.jsx(ah,{timeTables:f,departureId:i}),y==="timeline"&&e.jsx(ih,{timeTables:f,departureId:i})]})]}),s==="purchase"&&e.jsxs("div",{className:`${o} px-0`,children:[(!C||!w)&&e.jsx(X,{}),C&&w&&x&&e.jsx(X,{label:I(M=>M.Issuing)}),C&&w&&!x&&e.jsxs("div",{className:"pt-2",children:[e.jsx("h3",{className:"mb-4",children:C.description}),e.jsx(za,{departure:{id:C.id,description:(m=C.shortDescription)!==null&&m!==void 0?m:C.description,isZoneType:!0},arrival:{id:C.id,description:(h=C.shortDescription)!==null&&h!==void 0?h:C.description,isZoneType:!0},combinationData:{departure:null,arrival:null,isValidForAllPools:!0},mode:null,salesChannel:1,onIssue:H,navigate:j,onChangeSearchData:z,subscriptionType:R,personCode:u})]})]})]})},nh=_(sh),ta=()=>{const{retd:i}=qi(),a=_e(),[t]=di(),s=Di.useAll(),n=t.get("tab"),r=t.get("dep"),o=t.get("arr"),d=t.get("mode"),u=t.get("urbanoStop"),c=t.get("urbanoDate"),l=t.get("urbanoPoolId"),m=t.get("type"),h=t.get("personCode"),f=r&&o&&n&&d&&(s==null?void 0:s.some(b=>b.id===n&&b.saleGroupType===1)),p=l&&n&&d&&(s==null?void 0:s.some(b=>b.id===n&&b.saleGroupType===2))&&(d==="purchase"||d==="view"&&u),{departure:g,arrival:v,selectedFareCategories:x,departureDate:S,returnDate:y}=Ma();return x==null?null:e.jsxs(e.Fragment,{children:[e.jsx(Bm,{ar:i!=null,departure:g,arrival:v,departureDate:S,returnDate:y,history:a,selectedFareCategories:x}),f&&e.jsxs("div",{children:[" ",e.jsx(eh,{dep:r,arr:o,mode:d,history:a,className:"mt-tpl-solution-view"})," "]}),p&&e.jsx("div",{children:e.jsx(nh,{stopId:u||null,poolId:l,date:c?new Date(c):k.Today(),mode:d,saleGroupId:n,type:m||void 0,personCode:h||void 0,className:"mt-city-solution-view"})})]})},Eo=({children:i,fullWidht:a})=>e.jsx("div",{className:"row",children:e.jsx("div",{className:`col-12 ${a?"":"col-lg-8 col-xl-6"}`,children:i})}),Fo=P.forwardRef((i,a)=>e.jsx("div",{className:"bg-white shadow p-4 mb-5",children:e.jsx("div",{className:"container",children:e.jsx("h1",{ref:a,tabIndex:-1,
18children:i.title})})})),re=({title:i,fullWidth:a,children:t})=>{const s=P.useRef(null);return P.useEffect(()=>{var n;i&&((n=s.current)===null||n===void 0||n.focus())},[]),e.jsxs("div",{className:"mt-2",children:[i&&e.jsx(Fo,{ref:s,title:i}),e.jsx("div",{className:"container",children:e.jsx(Eo,{fullWidht:a,children:t})})]})};class rh extends P.Component{constructor(){super(...arguments),this.onChangePeriodFilter=a=>{var t=mn(this.props.value);t.period=a,this.props.onChange(t)},this.changeRadio=a=>{var t=mn(this.props.value);t.showCanceled=a,this.props.onChange(t)}}render(){var{formatMessage:a}=this.props.i18n.get(Q);return e.jsxs("div",{className:"row align-items-end",children:[e.jsx("div",{className:"col-12 col-lg-6",children:e.jsx(id,{label:"",hideLabel:!0,period:this.props.value.period,onChangePeriodFilter:this.onChangePeriodFilter,allowedRange:this.props.allowedRange})}),e.jsx("div",{className:"col-12 col-lg-4",style:{marginTop:23},children:e.jsxs("button",{className:`btn ${this.props.value.showCanceled?"btn-primary btn-highlight":"btn-primary-light"} py-2`,onClick:()=>this.changeRadio(!this.props.value.showCanceled),children:[e.jsx("i",{className:`${this.props.value.showCanceled?"fa-solid fa-square-check":"fa-regular fa-square"} me-2`})," ",a(t=>t.MostraAnnullatiScaduti)]})})]})}}const oh=_(rh),lh=i=>{const{icon:a,title:t,actionButton:s}=i;return e.jsxs("div",{className:"d-flex align-items-center justify-content-between flex-wrap py-2",children:[e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("span",{className:"fontsize-5u icon me-4",children:a}),e.jsx("div",{className:"fs-2 fw-bold",children:t})]}),s&&e.jsx("button",{type:"button",className:`${s.className} me-0 ms-auto`,onClick:s.onClick,children:s.content})]})},Bt=({header:i,className:a,children:t})=>e.jsxs("div",{className:`booking-card ${a||""}`,children:[i&&e.jsx("div",{className:"header",children:i}),e.jsx("div",{className:"body",children:t})]}),Ie=({icon:i,title:a,actionButton:t,children:s})=>e.jsx(Bt,{header:e.jsx(lh,{icon:i,title:a,actionButton:t}),children:s}),ms=i=>e.jsx("div",{className:"d-flex justify-content-between align-items-center border p-2 text-nowrap",children:e.jsx(Bo,{departureDateTime:i.departureDateTime,arrivalDateTime:i.arrivalDateTime})}),Bo=_(i=>{var{formatMessage:a}=i.i18n.get(ie),t=k.differenceInHoursAndMinutes(i.arrivalDateTime,i.departureDateTime);const s=t.hours?`${t.hours}h`:"",n=t.minutes?`${t.minutes}m`:"";return e.jsxs("div",{className:"d-flex justify-content-between align-items-center text-nowrap",children:[e.jsx("div",{children:e.jsx("i",{className:"fa-regular fa-clock me-2"})}),e.jsxs("div",{children:[a(r=>r.Durata)," ",`${s} ${n}`]})]})}),Ze=_(i=>{const{stopId:a,departureDateTime:t,label:s,hl:n,showTimeDay:r}=i;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fw-bolder text-medium",children:s}),e.jsx(ht,{id:a,selector:o=>e.jsxs("div",{tabIndex:0,children:[e.jsxs("div",{className:"mb-1",children:[e.jsx("span",{className:"fw-bolder text-medium text-nowrap me-2 fontsize-20u",children:k.getReadableTimeString(t,{timezone:o.timezone})}),r&&e.jsx("span",{className:"text-primary",children:k.getShortFriendlyDate2(t,n??"it",{timezone:o.timezone})})]}),e.jsxs("div",{className:"fw-bolder text-medium fontsize-2u d-flex flex-nowrap align-items-center",children:[e.jsx("div",{children:o.shortDescription}),o.latitude&&o.longitude&&e.jsx(ss,{hideIcon:!0,className:"position-relative",style:{zIndex:999},tabIndex:-1,text:e.jsx("i",{className:"fa-solid fa-location-dot mx-1"}),query:{lat:o.latitude,lng:o.longitude},onClick:d=>d.stopPropagation()})]}),e.jsx("div",{children:o.address})]})})]})}),dh=_(i=>{var a,t,{formatMessage:s}=i.i18n.get(ie);const{selectable:n,selected:r,onClick:o,solution:d,luggagesOrVehiclesSelectable:u}=i,c=Ee.getTripDetails(d);let l={label:s(m=>m.Select),className:"btn-primary btn-highlight"};return c.isBlocked?l={label:s(m=>m.SoluzioneBloccata),className:"btn-outline-secondary"}:c.canceled?l={label:s(m=>m.CorsaAnnullata),className:"btn-outline-secondary"}:!n&&(!((a=c.exclusion)===null||a===void 0)&&a.trip||!((t=c.exclusion)===null||t===void 0)&&t.route)?l={label:s(m=>m.NotForSale),className:"btn-outline-secondary"}:n?r&&(l={icon:"fa-solid fa-check",label:`${s(m=>m.Selected)}`,className:"btn-success btn-highlight text-white"}):u?l={label:s(m=>m.PostiEsauriti),className:"btn-outline-secondary"}:l={label:i.selectedFareCategories.some(h=>h.category.type==1)?s(h=>h.LuggageSlotsEsauriti):s(h=>h.VehiclesSlotsEsauriti),className:"btn-outline-secondary"},e.jsxs("button",{disabled:!n,"aria-pressed":r,className:`btn btn-lg ${l.className} w-100 d-flex align-items-center justify-content-center`,onClick:n&&!r?o:void 0,children:[l.icon&&e.jsx("i",{className:"fa-solid fa-check me-2"})," ",V.capitalize(l.label)]})}),Zs=i=>{const{formatMessage:a}=i.i18n.get(ie),{solution:t,limitationId:s,notAllowed:n,selectedFareCategories:r}
18=i,o=Ee.getTripDetails(t),{isBlocked:d,canceled:u,exclusion:c,remainingSeats:l}=o,m=Ee.GetTotalPassengers(r??[Fe.Default]);let h="fa-solid fa-user-check",f=e.jsx("span",{className:"text-success",children:`${a(x=>x.PostiDisponibili)}`}),p="bg-success",g="text-success",v=!1;return c.trip||c.route?(p="bg-danger",g="text-danger",h="fa-solid fa-user-slash",f=e.jsx(Ad,{exclusions:c}),v=!0):u?(p="bg-danger",g="text-danger",h="fa-solid fa-user-slash",f=e.jsx("span",{className:"text-danger",children:a(x=>x.CorsaAnnullata)}),v=!0):d?(p="bg-warning",g="text-warning",h="fa-solid fa-wrench",f=e.jsx("span",{className:"text-danger",children:a(x=>x.SoluzioneBloccata)}),v=!0):n?(p="bg-warning",g="text-warning",h="fa-solid fa-wrench",f=e.jsxs("span",{className:"text-danger",children:[e.jsx(Ye,{id:n})," ",a(x=>x.NotAllowed)]}),v=!0):s?(p="bg-warning",g="text-warning",h="fa-solid fa-wrench",f=e.jsxs("span",{className:"text-danger",children:[a(x=>x.Seats)," ",e.jsx(Ye,{id:s})," ",a(x=>x.Terminati)]}),v=!0):l!=null&&(l===0||m>l)?(p="bg-warning",g="text-warning",h="fa-solid fa-user-xmark",f=e.jsx("span",{className:"text-danger",children:a(x=>x.PostiEsauriti)}),v=!0):l!=null&&l<=10?(p="bg-danger",g="text-danger",h="fa-solid fa-user-clock",f=e.jsx("span",{className:"text-danger",children:a(x=>x.RemainingSeats(l))}),v=!0):l!=null&&l>10&&(p="bg-success",g="text-success",h="fa-solid fa-user-check",f=e.jsx("span",{className:"text-success",children:`${l} ${a(x=>x.PostiDisponibili)}`}),v=!1),{icon:h,text:f,backgroundColor:p,textColor:g,isAlert:v}},ch=_(i=>{const{icon:a,text:t,textColor:s}=Zs(i);return e.jsxs("div",{className:"text-nowrap",children:[e.jsx("i",{className:`${a} ${s}`})," ",e.jsx("span",{children:t})]})}),uh=_(i=>{const{icon:a,backgroundColor:t}=Zs(i);return e.jsx("div",{className:`rounded-circle ${t} d-flex justify-content-center align-items-center border`,style:{width:30,height:30},children:e.jsx("i",{className:`${a} text-white`})})}),mh=_(i=>{const{icon:a,textColor:t,text:s,isAlert:n}=Zs(i);return n?e.jsxs("div",{className:"text-nowrap",children:[e.jsx("i",{className:`${a} ${t}`})," ",e.jsx("span",{children:s})]}):null}),$o=_(i=>{if(te.environmentName=="sais")return null;var a=xu(Object.assign({},i));return e.jsx("div",{className:"text-info fw-bold text-nowrap",children:a})}),hh=_(i=>{const{formatMessage:a}=i.i18n.get(ie);return te.environmentName=="sais"?null:e.jsx("div",{className:"text-info fw-bold text-nowrap",children:a(t=>t.ReturnFare)})}),Xs=i=>{const{formatMessage:a}=i.i18n.get(ie),{solution:t,selectedFareCategories:s,type:n}=i;var r="text-success",o="text-success",d="bg-success";let u=!1;var c=i.type==2?a(S=>S.VehiclesSlotsDisponibili):a(S=>S.LuggageSlotsDisponibili),l=i.type==2?"fa-solid fa-car":"fa-solid fa-suitcase-rolling";const m=Ee.getTripDetails(t),{isBlocked:h,canceled:f,exclusion:p,remainingSeats:g}=m,v=Ee.GetSlotsOccupationForSelection(s.filter(S=>S.category.type==n));(p.trip||p.route||f||h||g==0)&&(r="text-danger",o="text-danger",d="bg-danger");const x=Ee.GetRemainingSlots(t.trips);return x!=null&&x-v<=0?(r="text-danger",o="text-danger",d="bg-danger",u=!0,c=i.type==2?a(S=>S.VehiclesSlotsEsauriti):a(S=>S.LuggageSlotsEsauriti)):x!=null&&x-v<=te.luggageSlotThreshold&&(r="text-danger",o="text-warning",d="bg-warning",u=!0,c=i.type==2?a(S=>S.RemainingVehiclesSLots):a(S=>S.RemainingLuggageSLots)),{text:c,icon:l,textColor:r,iconColor:o,backgroudColor:d,isAlert:u}},Bn=_(i=>{const{icon:a,iconColor:t,text:s,textColor:n}=Xs(i);return e.jsxs("div",{className:"text-nowrap",children:[e.jsx("i",{className:`${a} ${t}`})," ",e.jsx("span",{className:"ms-1",children:e.jsx("span",{className:n,children:s})})]})}),$n=_(i=>{const{icon:a,iconColor:t,text:s,textColor:n,isAlert:r}=Xs(i);return r?e.jsxs("div",{className:"text-nowrap",children:[e.jsx("i",{className:`${a} ${t}`})," ",e.jsx("span",{className:"ms-1",children:e.jsx("span",{className:n,children:s})})]}):null}),Wn=_(i=>{const{icon:a,text:t,backgroudColor:s}=Xs(i);return e.jsx("div",{className:`rounded-circle ${s} d-flex align-items-center justify-content-center`,title:t,style:{width:30,height:30},children:e.jsx("i",{className:`${a} text-white`})})}),ph=i=>{var{formatMessage:a}=i.i18n.get(ie);const{price:t,fullPrice:s,arPromoAvailable:n}=i;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-medium fw-bold",children:a(r=>r.TotalPrice)}),e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsxs("div",{className:"fw-bolder text-medium text-nowrap me-2 fontsize-20u",children:["⬠",V.toDecimalString(t)]}),s&&s>t&&e.jsxs("div",{className:"text-body-secondary text-decoration-line-through fontsize-5u text-nowrap ms-1 fw-bold",children:["⬠",V.toDecimalString(s)]})]}),e.jsx("div",{children:n&&e.jsx("span",{className:"text-success fontsize-10d mt-1",children:a(r=>r.ReturnFare)})})]})},vh=_(i=>{var{formatMessage:a}=i.i18n.get(ie);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-medium fw-bold",children:a(t=>t.NotAvailable)}),e.jsx("div",{className:"d-flex align-items-center",children:e.jsx("div",{className:"fw-bolder text-medium text-nowrap me-2 fontsize-20u",children:e.jsx("i",{className:"fa-solid fa-ban"})})})]})}),Wo=i=>{var{formatMessage:a}=i.i18n.get(ie);const{waitingTime:t}=i;if(!t)return null;const s=t%60,n=s>0?`${s}m`:"",r=Math.floor(t/60),o=r>0?`${r}h`:"";return e.jsx("div",{className:"text-danger fw-bold fontsize-2d ms-2",children:`${o} ${n} ${a(d=>d.WaitingTime)}`})},ga=_(i=>{var{formatMessage:a}=i.i18n.get(ie);const{trips:t}=i;return!t.some(n=>n.carrierId==="libertylines"||n.carrierId=="interss"||n.carrierId=="prontobus"||n.lineType!=null&&n.lineType!=1)||t.length>1?e.jsx("span",{children:a(n=>n.TripChangesNumber(t.length-1))}):e.jsx("span",{children:a(n=>n.TripDetails)})});
18let gh=class extends P.PureComponent{constructor(a){super(a),this.SolutionSelectorTemplate=t=>{if(this.props.customSelector!=null){const s=this.props.customSelector;return e.jsx(s,Object.assign({},t))}else return e.jsx(dh,Object.assign({},t))},this.GetBorderStyle=(t,s)=>t?"border border-primary border-3":s?"border border-info":""}render(){var a,t,s;const{formatMessage:n}=this.props.i18n.get(ie),{selected:r,isVisible:o,onSelect:d,solution:u,selectedFareCategories:c,bestPriceOfDay:l}=this.props,{trips:m}=u,h=this.GetBorderStyle(r,l);let f=m[0].departureDateTime,p=m[m.length-1].arrivalDateTime;const{selectable:g,limitation:v,luggagesOrVehiclesSelectable:x,notAllowed:S}=Ee.SolutionSelectable(u,c,"passengers"),y=u.trips.map(b=>({arrivalDateTime:b.arrivalDateTime,departureDateTime:b.departureDateTime,arrivalStopId:b.arrivalStopId,departureStopId:b.departureStopId,carrierId:b.trip.carrierId,tripId:b.trip.tripId,departureLocality:b.departureLocality,arrivalLocality:b.arrivalLocality,routeCustomersDescription:b.routeCustomersDescription,lineType:b.trip.lineType}));return e.jsxs("div",{className:`bg-white p-3 ${g?"":"opacity-50"} shadow mb-3 ${h} ${o?"":"d-none"} position-relative`,children:[e.jsxs("div",{className:"row align-items-start",children:[e.jsx("div",{className:"col-6 col-lg-4 my-1",children:e.jsx(Ze,{stopId:u.departureStopId,label:n(b=>b.Partenza),showTimeDay:!0,departureDateTime:f})}),e.jsx("div",{className:"col-6 col-lg-4 my-1",children:e.jsx(Ze,{stopId:u.arrivalStopId,label:n(b=>b.Arrival),showTimeDay:!0,departureDateTime:p})}),e.jsxs("div",{className:"col-12 col-lg-4 my-1 d-flex align-items-center justify-content-between",children:[e.jsxs("div",{children:[this.props.subscriptionReservation?null:u.priceInfo&&g?e.jsx("div",{className:"d-flex align-items-center",children:e.jsxs("div",{tabIndex:0,children:[e.jsx(ph,{price:(s=(a=u.priceInfo)===null||a===void 0?void 0:a.totalPrice)!==null&&s!==void 0?s:0,fullPrice:(t=u.priceInfo)===null||t===void 0?void 0:t.fullPrice,arPromoAvailable:!1,i18n:this.props.i18n}),u.priceInfo.returnPrice&&e.jsx($o,{returnPrice:u.priceInfo.returnPrice,returnPriceDaysConfigured:u.returnPriceDaysConfigured})]})}):e.jsx(vh,{}),e.jsxs("div",{className:"d-flex fontsize-2d mt-1",children:[e.jsx(ch,{solution:u,limitationId:v,notAllowed:S,selectedFareCategories:c}),c.some(b=>b.category.type==2)&&e.jsx("div",{className:"ms-3",children:e.jsx(Bn,{solution:u,type:2,selectedFareCategories:this.props.selectedFareCategories})}),c.some(b=>b.category.type==1)&&e.jsx("div",{className:"ms-3",children:e.jsx(Bn,{solution:u,type:1,selectedFareCategories:this.props.selectedFareCategories})})]})]}),e.jsx(mo,{messageIds:u.customMessages})]})]}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx("div",{className:"d-flex mt-2",children:e.jsxs(ze,{role:ce.canviewfullsolutioninfo,children:[e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx(Tt,{header:e.jsx("h4",{className:"modal-title",children:n(b=>b.InfoViaggio)}),className:"btn btn-gray border-0 fw-bold text-medium p-2 me-2",text:e.jsxs("div",{className:"d-flex justify-content-between align-items-center text-nowrap",children:[e.jsx("span",{children:e.jsx("i",{className:"fa-solid fa-info-circle fa-lg me-2"})}),e.jsx(ga,{trips:m.map(b=>b.trip)}),e.jsx(Wo,{waitingTime:Ar(u.trips),i18n:this.props.i18n})]}),children:e.jsx(rs,{solution:y})}),e.jsx(ms,{departureDateTime:f,arrivalDateTime:p})]}),e.jsx(Rr,{children:e.jsx(wi,{heading:b=>e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsxs("button",{className:`btn ${b?"btn-primary btn-highlight text-white":"btn-gray"} d-flex text-nowrap d-flex justify-content-center align-items-center fw-bold text-medium p-2 me-2`,style:{width:130},children:[e.jsx("span",{children:e.jsx("i",{className:`fa-solid ${b?"fa-chevron-up":"fa-chevron-down"} fa-lg me-2`})}),e.jsx(ga,{trips:m.map(j=>j.trip)})]}),e.jsx(ms,{departureDateTime:f,arrivalDateTime:p})]}),children:e.jsx("div",{className:"pt-2",children:e.jsx(rs,{solution:y})})})})]})})}),e.jsx("div",{className:"col-12 col-lg-4 my-1 d-flex align-items-end",children:e.jsx(Fs,{trips:u.trips.map(b=>({carrierId:b.trip.carrierId,departure:b.departureStopId,arrival:b.arrivalStopId,vehicleDescription:b.trip.vehicleDescription,travelMode:b.trip.travelMode,lineId:b.trip.lineId}))})}),e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(this.SolutionSelectorTemplate,{selected:r,selectable:g,luggagesOrVehiclesSelectable:x,onClick:d,solution:u,selectedFareCategories:this.props.selectedFareCategories,i18n:this.props.i18n,ticketIndex:this.props.ticketIndex})})]}),e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-12",children:e.jsx(ho,{messageIds:u.customMessages})})}),l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"d-none d-lg-block position-absolute translate-middle badge bg-info text-uppercase px-3",style:{to
18p:0,left:"95%"},children:n(b=>b.BestPrice)}),e.jsx("span",{className:"d-block d-lg-none position-absolute translate-middle badge bg-info text-uppercase px-3",style:{top:0,left:"85%"},children:n(b=>b.BestPrice)})]})]})}};const fh=_(Zi(gh)),qt=_(i=>{var{formatMessage:a}=i.i18n.get(ie),{formatMessage:t}=i.i18n.get(ne);const{price:s,fullPrice:n,toPay:r}=i;return r!=null&&r>0?e.jsxs("div",{className:"d-flex",children:[e.jsxs("div",{children:[e.jsx("div",{className:"fw-bold text-medium",children:t(o=>o.DaPagare)}),e.jsxs("div",{className:"fw-bolder text-medium text-nowrap text-warning me-2 fontsize-20u",children:["⬠",V.toDecimalString(r)]})]}),i.pnr&&e.jsxs("div",{className:"ms-4",children:[e.jsx("div",{className:"fw-bold text-medium",children:t(o=>o.Pnr)}),e.jsx("div",{className:"fw-bolder text-medium text-uppercase me-2 fontsize-20u",children:i.pnr})]})]}):e.jsxs("div",{children:[e.jsx("div",{className:"fw-bold text-medium",children:a(o=>o.TotalPrice)}),e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsxs("div",{className:"fw-bolder text-medium text-nowrap me-2 fontsize-20u",children:["⬠",V.toDecimalString(s)]}),n!=null&&n>s&&e.jsxs("div",{className:"text-body-secondary text-decoration-line-through fontsize-5u text-nowrap ms-1 fw-bold",children:["⬠",V.toDecimalString(n)]})]})]})}),Mt=i=>{const a=_e();return e.jsx("button",{onClick:()=>{var t;return i.disabled?Re.fire((t=i.alertTitle)!==null&&t!==void 0?t:"",i.alertMessage):a(i.link)},className:`btn ${i.disabled?"btn-light border text-body-secondary":"btn-gray fw-bold"} py-2 px-4 m-1 me-3 text-nowrap d-flex flex-nowrap align-items-center`,children:i.children})},Uo=i=>{const a=_e();return e.jsx("button",{onClick:()=>{var t;return i.disabled?Re.fire((t=i.alertTitle)!==null&&t!==void 0?t:"",i.alertMessage):a(i.link)},className:`btn ${i.disabled?"btn-light border text-body-secondary":"btn-info text-white fw-bold"} py-2 px-4 m-1 me-3 text-nowrap d-flex flex-nowrap align-items-center`,children:i.children})},xh=_(bt(i=>{const{categories:a,items:t,extraFares:s}=i;return e.jsxs(e.Fragment,{children:[a.concat(t).map((n,r)=>e.jsxs("div",{className:"d-flex justify-content-between fw-bold w-100 border rounded px-3 py-2 mb-2",children:[e.jsx("div",{children:e.jsx(en,{count:n.count,faraCategoryId:n.category})}),e.jsxs("div",{className:"text-end fontsize-3u",children:["⬠",V.toDecimalString(n.price)]})]},`priceDetail_${r}`)),s.map((n,r)=>{var o;return e.jsxs("div",{className:"d-flex justify-content-between fw-bold w-100 border rounded px-3 py-2 mb-2",children:[e.jsx("div",{children:e.jsx(Mr,{id:(o=n.category)!==null&&o!==void 0?o:null,hl:i.hl})}),e.jsxs("div",{className:"text-end fontsize-3u",children:["⬠",V.toDecimalString(n.price)]})]},`extraFares_${r}`)})]})})(i=>i.allByKey(),"extraParamsData")),en=_(i=>{const{count:a,faraCategoryId:t,showX:s}=i;return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"opacity-75 me-2",children:e.jsx(Ji,{id:t})})," ",a," ",s&&e.jsx(e.Fragment,{children:" x "}),e.jsx(Ye,{id:t,hl:i.hl})]})}),bh=_(i=>{const{count:a,faraCategoryId:t,showX:s}=i;return e.jsxs("div",{className:"list-group-item",children:[e.jsxs("div",{className:"d-flex align-items-center ",children:[e.jsxs("div",{className:"w-100 d-flex flex-row opacity-75",children:[e.jsx("div",{children:e.jsx(Ji,{id:t,size:"3x",className:"me-4"})}),e.jsxs("div",{children:[e.jsx("div",{children:e.jsxs("span",{className:"fw-bold",children:[a," ",s&&e.jsx(e.Fragment,{children:" x "}),e.jsx(Ye,{id:t,hl:i.hl})]})}),e.jsx("div",{children:e.jsx("small",{children:e.jsx(Rd,{id:t,hl:i.hl})})})]})]}),e.jsx("div",{className:"d-none d-lg-flex justify-content-end",children:i.children})]}),e.jsx("div",{className:"d-flex d-lg-none justify-content-end",children:i.children})]})}),yh=_(bt(i=>{const{categories:a,items:t,extraFares:s}=i;return e.jsxs("div",{className:"d-flex flex-wrap fontsize-5d",style:{gap:"1px 5px"},children:[a.concat(t).map((n,r)=>e.jsxs("div",{className:"d-flex align-items-center fw-bold border rounded px-3 py-2 mb-2",children:[e.jsx("div",{className:"me-2",children:e.jsx(en,{count:n.count,faraCategoryId:n.category})}),e.jsxs("div",{className:"text-end fontsize-3u",children:["⬠",V.toDecimalString(n.price)]})]},`priceDetail_${r}`)),s.map((n,r)=>{var o;return e.jsxs("div",{className:"d-flex align-items-center fw-bold border rounded px-3 py-2 mb-2",children:[e.jsx("div",{className:"me-2",children:e.jsx(Mr,{id:(o=n.category)!==null&&o!==void 0?o:null,hl:i.hl})}),e.jsxs("div",{className:"text-end fontsize-3u",children:["⬠",V.toDecimalString(n.price)]})]},`extraFares_${r}`)})]})})(i=>i.allByKey(),"extraParamsData")),jh=yt(xh)(i=>i.allByKey(),"fareCategories"),Sh=yt(yh)(i=>i.allByKey(),"fareCategories"),Nh=_(i=>{const a=i.ticket;var{formatMessage:t}=i.i18n.get(ne);const s=a.itemType===2;return e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:"me-2",children:s?e.jsx(Ji,{id:a.passenger.fareCategoryId,size:"lg"}):e.jsx("i",{className:"fa-solid fa-user fa-lg text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{children:t(s?n=>n.Vehicle:n=>n.Passenger)}),e.jsxs("div",{className:"fw-bolder",children:[s&&e.jsx("div",{className:"me-1",children:e.jsx(Ye,{id:a.passenger.fareCategoryId})}),s?e.jsx(Md,{extraData:a.extraData}):e.jsxs(e.Fragment,{children:[a.passenger.name," ",a.passenger.surname]})]})]})]})}),wh=i=>{var{formatMessage:a}=i.i18n.get(ne),{formatMessage:t}=i.i18n.get(Q),{formatMessage:s}=i.i18n.get(ie);const n=i.ticket,r=n.parts[0],o=n.parts[n.parts.length-1],d=n.isCanceled||n.expired,u=n.parts.map(p=>({arrivalDateTime:p.arrivalDate,arrivalStopId:p.arrivalId,carrierId:p.carrierId,departureDateTime:p.departureDate,departureStopId:p.departureId,tripId:p.tripId,departureLocality:"",arrivalLocality:"",routeCustomersDescription:"",travelMode:p.travelMode,vehicleDescription:"",lineId:p.lineId})),c=Oe.isEnableForChangeDate(i.roles,i.user,n,!0),l=Oe.isEnabledForCancelation(i.roles,i.user,n),m=mt(n.accompaniedLuggage,p=>({category:p.id,count:1,price:Bs(p.valueDetail),tkts:1,extraData:[p.extraData]})),h=Hi(n.parts.map(p=>p.carrierId).filter(p=>p.length>0),p=>p).length>1,f=Oe.canPayToBePayed([n],i.roles);return e.jsxs(Bt,{className:d?"opacity-50":"",children:[e.jsxs("div",{className:"row position-relative",children:[!d&&e.jsx(ke,{to:D.GetTicketDetail(i.ticket.id),className:"stretched-link"}),e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(Ze,{stopId:r.departureId,label:s(p=>p.Partenza),showTimeDay:!0,departureDateTime:r.departureDate})}),e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(Ze,{stopId:o.arrivalId,label:s(p=>p.Arrival),showTimeDay:!0,departureDateTime:o.arrivalDate})}),e.jsxs("div",{className:"col-12 col-lg-4 my-1",children:[e.jsx(qt,{price:n.price-n.reliefAmount,fullPrice:n.price,toPay:n.toPay,pnr:n.pnr}),n.isPayed&&e.jsx("div",{children:e.jsx("div",{className:"fw-bold text-success",children:t(p=>p.Pagato)})}),n.expiryDate!=null&&e.jsxs("div",{children:[e.jsx("div",{className:"fw-bolder text-medium",children:t(p=>p.DataDiScadenza)}),e.jsx("div",{children:k.getReadableDateTimeString(n.expiryDate)})]})]})]}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx("div",{className:"d-flex",children:e.jsxs(ze,{role:ce.canviewfullsolutioninfo,children:[e.jsx(Tt,{header:e.jsx("h4",{className:"modal-title",children:s(p=>p.InfoViaggio)}),className:"btn btn-primary-light border-0 fw-bold px-2 py-1 me-2",text:e.jsxs("div",{className:"d-flex justify-content-between align-items-center text-nowrap",children:[e.jsx("span",{children:e.jsx("i",{className:"fa-solid fa-info-circle fa-lg me-2"})}),e.jsx(ga,{trips:n.parts.map(p=>({lineType:p.LineType,carrierId:p.carrierId}))}),e.jsx(Wo,{waitingTime:Ar(u),i18n:i.i18n})]}),children:e.jsx(Od,{solution:u})}),e.jsx(Rr,{children:e.jsx(wi,{heading:p=>e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsxs("button",{className:`btn ${p?"btn-primary btn-highlight text-white":"btn-gray"} d-flex text-nowrap d-flex justify-content-center align-items-center fw-bold text-medium p-2 me-2`,style:{width:130},children:[e.jsx("span",{children:e.jsx("i",{className:`fa-solid ${p?"fa-chevron-up":"fa-chevron-down"} fa-lg me-2`})}),e.jsx(ga,{trips:n.parts.map(g=>({lineType:g.LineType,carrierId:g.carrierId}))})]}),e.jsx(ms,{departureDateTime:r.departureDate,arrivalDateTime:o.arrivalDate})]}),children:e.jsx("div",{className:"pt-2",children:e.jsx(rs,{solution:u})})})})]})})}),h&&e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(Fs,{trips:u.map(p=>({carrierId:p.carrierId,departure:p.departureStopId,arrival:p.arrivalStopId,vehicleDescription:p.vehicleDescription,lineId:p.lineId,travelMode:p.travelMode}))})})]}),e.jsxs("div",{className:"row border-top mt-3 pt-4 pb-3 align-items-center",children:[e.jsx("div",{className:"col-12 col-lg-4",children:e.jsx(Nh,{ticket:n})}),i.displayServices&&((m==null?void 0:m.length)||0)>0&&e.jsxs("div",{className:"col-12 col-lg-4",children:[e.jsx("div",{children:t(p=>p.Servizi)}),e.jsx("div",{className:"fw-bolder",children:mt(it(m,p=>p.category),(p,g)=>e.jsx("div",{children:e.jsx(en,{count:p.length,faraCategoryId:p[0].category,showX:!0})},g))})]}),!d&&!i.hideActionButtons&&e.jsx("div",{className:"col-12 col-lg-8",children:e.jsxs("div",{className:"w-100 d-flex flex-wrap align-items-center justify-content-md-end",children:[f&&e.jsxs(Uo,{link:D.GetPayToBePayedUrl(n.groupid),alertMessage:a(p=>p.RetryPayment),disabled:!1,children:[e.jsx("i",{className:"fa-solid fa-repeat me-2"}),a(p=>p.RetryPayment)]}),n.expiryDate==null&&e.jsxs(Mt,{link:D.GetTicketDetail(n.id),alertTitle:`${a(p=>p.Biglietto)} ${a(p=>p.DaPagare).toLowerCase()}`,alertMessage:a(p=>p.CompletaIlPagamento),disabled:n.expiryDate!=null,children:[e.jsx("i",{className:"fa-solid fa-qrcode me-2"}),a(p=>p.BigliettoElettronico)]}),i.user!=null&&e.jsxs(Mt,{disabled:!c,link:D.GetChangeDate(n.id),alertMessage:a(p=>p.CambioCorsaNonPossibile),children:[e.jsx("i",{className:"fa-solid fa-arrow-right-arrow-left me-2"}),a(p=>p.Change)," ",e.jsx("span",{className:"ms-1",children:a(p=>p.Travel)})]}),i.user!=null&&e.jsxs(Mt,{disabled:!l,link:D.GetCancelationPreview(n.id),alertMessage:a(p=>p.AnnullamentoNonPossibile),children:[e.jsx("i",{className:"fa-solid fa-times me-2"}),a(p=>p.Cancel)," ",e.jsx("span",{className:"ms-1",children:a(p=>p.Travel)})]})]})})]})]})},$t=_(ui(pt(wh))),Un=i=>{const{id:a,label:t}=i;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fw-bolder text-medium",children:t}),e.jsx(e.Fragment,{children:e.jsx("div",{className:"fw-bolder text-medium fontsize-2u",children:e.jsx(Hr,{id:a})})})]})},Ch=_(Aa(pt(class extends P.Component{render(){var a,{formatMessage:t}=this.props.i18n.get(ne),{formatMessage:s}=this.props.i18n.get(Q),{formatMessage:n}=this.props.i18n.get(ie);const r=this.props.ticket,o=r.isCanceled||r.expiryDate!=null&&r.expiryDate<new Date;return e.jsxs(Bt,{className:o?"opacity-50":"",children:[e.jsx("div",{className:"row position-relative",children:e.jsxs("h4",{className:"text-medium fw-bold",children:[" ",e.jsx(Ca,{id:r.subscriptionTypeId})]})}
18),e.jsxs("div",{className:"row position-relative",children:[!o&&e.jsx(ke,{to:D.GetTicketDetail(this.props.ticket.id),className:"stretched-link"}),e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(Un,{id:r.departureStopOrPool,label:n(d=>d.Partenza)})}),r.maxKm==null&&r.departureStopOrPool!=r.arrivalPool&&e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(Un,{id:r.arrivalPool,label:n(d=>d.Arrival)})}),e.jsxs("div",{className:"col-12 col-lg-4 my-1",children:[e.jsx(qt,{price:r.value-((a=r.reliefAmount)!==null&&a!==void 0?a:0),fullPrice:r.value,toPay:r.yetToBePayed,pnr:r.pnr}),r.isPayed&&e.jsx("div",{children:e.jsx("div",{className:"fw-bold text-success",children:s(d=>d.Pagato)})}),r.expiryDate!=null&&e.jsxs("div",{children:[e.jsx("div",{className:"fw-bolder text-medium",children:s(d=>d.DataDiScadenza)}),e.jsx("div",{children:k.getReadableDateTimeString(r.expiryDate)})]})]})]}),e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx("div",{className:"d-flex"})})}),e.jsxs("div",{className:"row border-top mt-3 pt-4 pb-3 align-items-center",children:[e.jsxs("div",{className:"col-12 col-lg-4",children:[e.jsx("div",{children:t(d=>d.Passenger)}),e.jsxs("div",{className:"fw-bolder",children:[r.passenger.name," ",r.passenger.surname]})]}),!o&&e.jsx("div",{className:"col-12 col-lg-8",children:e.jsx("div",{className:"w-100 d-flex flex-wrap align-items-center justify-content-md-end",children:e.jsxs(Mt,{link:D.getSubscriptionDetail(r.id),alertTitle:`${t(d=>d.Biglietto)} ${t(d=>d.DaPagare).toLowerCase()}`,alertMessage:t(d=>d.CompletaIlPagamento),disabled:r.expiryDate!=null,children:[e.jsx("i",{className:"fa-solid fa-qrcode me-2"}),t(d=>d.BigliettoElettronico)]})})})]})]})}}))),Te=_(i=>{var a;const{formatMessage:t}=i.i18n.get(Q),s=_e();return e.jsx("div",{className:"mb-3",children:e.jsx("a",{className:"text-primary fw-bold clickable",onClick:()=>i.customLink?s(i.customLink):window.history.back(),children:(a=i.customLabel)!==null&&a!==void 0?a:t(n=>n.Indietro)})})}),Vo=Aa(_(i=>{var a;const{formatMessage:t}=i.i18n.get(Q),s=Kt(),r=(a=new URLSearchParams(s.search).get("subscriptionId"))!==null&&a!==void 0?a:void 0,o=xi.useAll(),d=Kr.useAll(),u=Qr.useAll(),c=Jr.useAll();return o==null||d==null||u==null||c==null?e.jsx(X,{}):(o.length==0&&d.length==0&&u.length==0&&c.length==0&&e.jsx(xa,{title:t(l=>l.PrenotaIlTuoViaggio),subtitle:t(l=>l.NonCiSonoViaggiPassati)}),e.jsx(Go,{subscriptionId:r,tickets:[...d,...o],open:[...c,...u]}))})),fa=_(i=>e.jsx("div",{children:mt(it(i.tickets,a=>V.capitalize(k.getShortFriendlyDateWithMonthNameAndYear(a.parts[0].departureDate,i.hl))),(a,t)=>e.jsxs("div",{className:"my-5",children:[e.jsx("div",{className:"fontsize-10u text-medium fw-bolder mb-2",children:t}),a.map(s=>e.jsx($t,{ticket:s},s.id))]},t))})),tn=_(i=>e.jsx("div",{children:i.tickets.map(a=>e.jsx("div",{className:"my-5",children:e.jsx(Ch,{ticket:a},a.id)},a.id))})),xa=_(i=>{const{formatMessage:a}=i.i18n.get(Q),t=_e();return e.jsxs("div",{className:"h-100 mt-3 p-5 bg-white shadow border rounded-3",children:[e.jsx("h2",{className:"fw-bold text-medium",children:i.title}),e.jsx("p",{children:i.subtitle}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-12 col-md-4 col-lg-2",children:e.jsx(at,{to:"/",className:"btn btn-primary w-100",type:"button",children:a(s=>s.Prenota)})}),i.historyLink&&e.jsx("div",{className:"col-12 col-md-4 col-lg-2",children:e.jsx("button",{onClick:()=>t(i.historyLink),className:"btn btn-outline-secondary w-100",type:"button",children:a(s=>
18s.ViaggiPrecedenti)})})]})]})}),Go=_(i=>{const{formatMessage:a}=i.i18n.get(Q),t=ii(i.tickets,h=>{var f;return(f=h.leastDepartureDateTime)!==null&&f!==void 0?f:h.issueDate},["desc"]),s=ii(i.open,h=>h.issueDate,["desc"]),n=Ml(t.map(h=>{var f;return(f=h.leastDepartureDateTime)!==null&&f!==void 0?f:h.issueDate}).concat(s.map(h=>h.issueDate)),h=>h.valueOf()),r=xr(t.map(h=>{var f;return(f=h.leastDepartureDateTime)!==null&&f!==void 0?f:h.issueDate}).concat(s.map(h=>h.issueDate)),h=>h.valueOf()),[o,d]=P.useState(void 0);if(!n&&!r&&t.length==0&&s.length==0)return e.jsx(xa,{title:a(h=>h.NonCiSonoViaggiPassati),subtitle:a(h=>h.NonCiSonoViaggiPassati)});const[u,c]=P.useState({period:la.Create(k.ToDate(n),k.EndOfDay(r)),showCanceled:!t.some(h=>!h.isCanceled&&!h.expired)}),l=hs(t,i.subscriptionId,u.showCanceled,u.period),m=Ph(s,u.showCanceled,u.period);return P.useEffect(()=>{d(la.Create(n,k.AddYears(k.Today(),1)))},[]),e.jsxs("div",{children:[e.jsx("div",{className:"mb-5",children:e.jsx(oh,{value:u,onChange:c,allowedRange:o})}),e.jsx(tn,{tickets:m}),e.jsx(fa,{tickets:l})]})}),hs=(i,a,t,s)=>{const n=i.filter(r=>(!a||a==r.subscriptionId)&&(t||!r.isCanceled&&!r.expired));return s?n.filter(r=>{var o,d;return((o=r.leastDepartureDateTime)!==null&&o!==void 0?o:r.issueDate)>=s.from&&((d=r.leastDepartureDateTime)!==null&&d!==void 0?d:r.issueDate)<=s.to}):n},Ph=(i,a,t)=>{const s=i.filter(n=>a||!n.isCanceled);return t?s.filter(n=>n.issueDate>=t.from&&n.issueDate<=t.to):s},Vn=_(i=>{var a;const{formatMessage:t}=i.i18n.get(Q),{formatMessage:s}=i.i18n.get(Xe),n=Kt(),o=(a=new URLSearchParams(n.search).get("subscriptionId"))!==null&&a!==void 0?a:void 0,d=xi.useAll(),u=Kr.useAll(),c=Qr.useAll(),l=Jr.useAll();if(d==null||u==null||c==null||l==null)return e.jsx(X,{});const m=hs(d,o,!1),h=hs(u,o,!1),f=h.length>0,p=[...u,...d],g=[...l,...c].filter(v=>!v.expiryDate||v.expiryDate>new Date);return e.jsxs(re,{title:o?s(v=>v.PrenotazioniEffettuata):t(v=>v.MyTickets),fullWidth:!0,children:[(m.length>0||c.length>0)&&e.jsx("div",{className:"d-flex justify-content-end",children:e.jsx(Te,{customLink:"/",customLabel:t(v=>v.Prenota)})}),d.length==0&&u.length==0&&c.length==0&&l.length==0?e.jsx(xa,{title:t(v=>v.PrenotaIlTuoViaggio),subtitle:t(v=>v.NonCiSonoViaggiPassati)}):e.jsxs(ja,{children:[e.jsx(lt,{name:"next",caption:t(v=>v.ProssimiViaggi),children:m.length||c.length?e.jsxs(e.Fragment,{children:[e.jsx(tn,{tickets:c}),e.jsx(fa,{tickets:m})]}):e.jsx(xa,{title:t(v=>v.NessunViaggioPianificato),subtitle:t(v=>v.NonCiSonoViaggiFuturi),historyLink:f?D.GetMyTicketsPage("previous"):D.GetMyTicketsPage("filter")})}),f&&e.jsx(lt,{name:"previous",caption:t(v=>v.ViaggiPrecedenti),children:e.jsx(fa,{tickets:h})}),e.jsx(lt,{name:"filter",caption:t(v=>v.Filtra),children:e.jsx(Go,{tickets:p,subscriptionId:o,open:g})})]})]})}),Dh=Object.freeze(Object.defineProperty({__proto__:null,MyOpenList:tn,MyTicketsList:fa,MyTicketsPage:Vn,MyTicketsTabless:Vo,default:Vn},Symbol.toStringTag,{value:"Module"}));class Ih extends P.Component{render(){return e.jsx(zd,{rechargePath:D.RechargePath})}}var an=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Th=_(i=>{const{formatMessage:a}=i.i18n.get(He);return i.operation.operationType.ricarica?e.jsxs("div",{className:"d-flex flex-nowrap align-items-center",children:[e.jsx("span",{children:a(t=>t.OpTypeRicarica)})," ",e.jsx("strong",{className:"ms-1 text-info",children:e.jsx(Oh,{operation:i.operation})})]}):i.operation.operationType.ricaricamanuale?e.jsx("span",{children:a(t=>t.OpTypeRicaricaManuale)}):i.operation.operationType.rimborso?e.jsx("span",{children:a(t=>t.OpTypeRimborso)}):i.operation.operationType.storno?e.jsx("span",{children:a(t=>t.OpTypeStorno)}):i.operation.operationType.conversionecoupon?e.jsx("span",{children:a(t=>t.OpTypeCouponConversion)}):i.operation.operationType.pagamento?e.jsx("span",{children:a(t=>t.OpTypePagamento)}):null}),_h=i=>
18{const[a,t]=P.useState(null),s=()=>an(void 0,void 0,void 0,function*(){const r=yield new Yr().getReceiptUrl(i);t(r.pdfUrl)});return P.useEffect(()=>{s()},[i]),a},kh=i=>{const[a,t]=P.useState(null),s=()=>an(void 0,void 0,void 0,function*(){const n=yield xe.ticketGroup(i.groupId);t(n.tickets)});return P.useEffect(()=>{s()},[i.groupId]),a==null?e.jsx(X,{}):e.jsx(e.Fragment,{children:a.map(n=>e.jsx($t,{ticket:n}))})},Ah=i=>{const[a,t]=P.useState(null),s=()=>an(void 0,void 0,void 0,function*(){const n=yield Et.SUBSCRIPTION_DETAIL_REQUESTED(i.subscriptionId);t(n)});return P.useEffect(()=>{s()},[i.subscriptionId]),a==null?e.jsx(X,{}):e.jsx(Ld,{subscription:a})},Rh=i=>{if(i.operation.operationType.ricarica==!1)return null;const a=_h(i.operation.id);return a==null?null:e.jsxs("a",{href:a,className:"btn btn-link btn-sm fontsize-2u ps-0",target:"_blank",children:[e.jsx("i",{className:"fa-solid fa-info-circle me-2"}),i.text]})},Mh=_(i=>{const{formatMessage:a}=i.i18n.get(He),{operation:t}=i;return t.operationType.conversionecoupon?e.jsxs("span",{children:["Coupon: ",t.couponCode]}):t.operationType.ricarica&&t.transactionCode?e.jsx(Rh,{operation:t,text:a(s=>s.Ricevuta)}):t.groupId?e.jsx(Tt,{modalSize:"xl",className:"btn btn-link btn-sm fontsize-2u ps-0",text:a(s=>s.RiferimentoBiglietto),icon:"fa-solid fa-info-circle me-2",children:e.jsx(kh,{groupId:t.groupId})}):t.subscriptionId?e.jsx(Tt,{modalSize:"xl",className:"btn btn-link btn-sm fontsize-2u ps-0",text:a(s=>s.RiferimentoAbbonamento),icon:"fa-solid fa-info-circle me-2",children:e.jsx(Ah,{subscriptionId:t.subscriptionId})}):e.jsx("div",{})}),Oh=i=>{const{operation:a}=i;return e.jsx(Yi,{method:a.paymentMethod})},zh=i=>{const{operation:a}=i;return e.jsxs("div",{className:"row bg-white shadow mb-4 align-items-center p-3",children:[e.jsx("div",{className:"col-6 col-lg-1 fw-bolder text-medium text-nowrap",children:e.jsx("div",{className:`fontsize-5u ${a.amount<0?"text-danger":""}`,children:`${a.amount>0?"+":"-"}${V.toDecimalString(Math.abs(a.amount))}â¬`})}),e.jsx("div",{className:"col-6 col-lg-2 border-start border-2",children:e.jsxs("div",{children:[e.jsx("i",{className:"fa-solid fa-calendar me-2"})," ",k.getReadableDateTimeString(a.date)]})}),e.jsxs("div",{className:"col-6 col-lg-2 border-start border-2 d-flex flex-nowrap align-items-center",children:[e.jsx("i",{className:"fa-solid fa-file me-2"})," ",e.jsx(Th,{operation:a})]}),e.jsx("div",{className:"col-6 col-lg-3 border-start border-2",children:e.jsx(Mh,{operation:a})}),e.jsx("div",{className:"col-12 col-lg-3 border-start border-2",children:e.jsx("span",{className:"fontsize-2d",children:a.notes})})]})},Lh=i=>{const{agencyId:a,operatorId:t}=i.owner,s=It(()=>bu.filterOperations(t??null,a??null,la.Always),[a,t]);if(s==null)return e.jsx(X,{});const{formatMessage:n}=i.i18n.get(He);return s.operations.length===0?e.jsxs("div",{className:"alert alert-secondary",children:[" ",n(r=>r.NessunaOperazione)]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"row d-none d-lg-flex p-3 fw-bold",children:[e.jsx("div",{className:"col-12 col-lg-1 fw-bolder text-medium text-nowrap",children:n(r=>r.Importo)}),e.jsx("div",{className:"col-12 col-lg-2",children:n(r=>r.Data)}),e.jsx("div",{className:"col-12 col-lg-2",children:n(r=>r.TipoOperazione)}),e.jsx("div",{className:"col-12 col-lg-3",children:n(r=>r.InfoOperazione)}),e.jsx("div",{className:"col-12 col-lg-3",children:n(r=>r.Notes)})]}),s.operations.map(r=>e.jsx(zh,{operation:r},r.date.valueOf()))]})},Eh=_(Lh),sn=$s(i=>{const{wallet:a}=i;return a?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-5",children:e.jsx(Ih,{})}),e.jsx(Eh,{owner:{agencyId:a.agencyId,operatorId:a.operatorId}})]}):null})("wallet"),Fh=_(i=>{const{formatMessage:a}=i.i18n.get(Ks),{formatMessage:t}=i.i18n.get(Q);return e.jsxs(re,{title:a(s=>s.Title),fullWidth:!0,children:[e.jsx("div",{className:"d-flex justify-content-end",children:e.jsx(Te,{customLink:"/",customLabel:t(s=>s.Prenota)})}),e.jsx(sn,{})]})}),Gn=Object.freeze(Object.defineProperty({__proto__:null,MyWallet:sn,default:Fh},Symbol.toStringTag,{value:"Module"})),Bh=_(i=>{const{formatMessage:a}=i.i18n.get(Q),t=yu.useGeneratedByUser();return e.jsx(re,{fullWidth:!0,children:e.jsx(Sa,{isLoading:t==null,children:e.jsxs("div",{className:"d-flex flex-wrap justify-content-center justify-content-lg-start",children:[t&&t.length<=0&&e.jsx("div",{className:"mt-3",children:e.jsx("div",{className:"fw-bold",children:a(s=>
18s.NoCoupons)})}),t&&t.map((s,n)=>{var r=s.isRemainder?"Coupon di resto":s.type===1?"Coupon sconto":"Coupon annullamento",o=s.amount!=null?""+s.amount.toFixed(2)+" â¬":" Sconto "+(s.percentage*100).toFixed(0)+"%",d=s.expiryDateTime?"Scade il "+k.getReadableDateString(s.expiryDateTime):"Sempre valido";return e.jsxs("div",{className:"card shadow me-3 mb-3",style:{width:320},children:[e.jsxs("div",{className:"card-header d-flex justify-content-between align-items-center text-uppercase text-white bg-primary fw-bold",children:[e.jsxs("div",{className:"me-2 ",children:[e.jsx("i",{className:"fas fa-ticket-alt me-3 text-white"}),s.id]}),e.jsx("div",{children:o})]}),e.jsx("div",{className:"card-body d-flex flex-column justify-content-between",children:e.jsxs("div",{children:[e.jsx("div",{className:"my-2",children:r}),e.jsx("div",{className:"fw-bold d-flex justify-content-end",children:d})]})})]},n)})]})})})});var $h=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Wh=_(i=>{const{formatMessage:a}=i.i18n.get(Q),[t,s]=P.useState([]),[n,r]=P.useState(!0);P.useEffect(()=>{$h(void 0,void 0,void 0,function*(){const u=yield Ws.fidelityInfosForCurrentOperator();s(u),r(!1)})},[]);const o=t.filter(d=>d.IsCurrentlyActive);return e.jsx(re,{fullWidth:!0,children:e.jsx(Sa,{isLoading:n,children:e.jsxs("div",{className:"d-flex flex-column",children:[!o.length&&e.jsx("div",{className:"mt-3",children:e.jsx("div",{className:"fw-bold",children:a(d=>d.NoFidelity)})}),o.map((d,u)=>{const c=`${a(h=>h.FidelityPoints)} ${d.CurrentFidelityPoints}`,l=d.IsCurrentlyActive?a(h=>h.FidelityActive):a(h=>h.FidelityExpired),m=d.FidelityThreshold>0?a(h=>h.FidelityAvailableDiscount):`${a(h=>h.FidelityPointsNeeded)} ${Math.abs(d.FidelityThreshold)} ${a(h=>h.FidelityPointsCount)}`;return e.jsxs("div",{className:"card shadow mb-3",style:{width:320,minHeight:220},children:[e.jsx("div",{className:"card-header d-flex justify-content-between align-items-center text-uppercase text-white bg-primary fw-bold",children:e.jsx("div",{className:"me-2 text-truncate",children:d.FidelityName})}),e.jsx("div",{className:"card-body d-flex flex-column justify-content-center align-items-center text-center",children:e.jsxs("div",{children:[e.jsx("div",{className:"display-6 fw-bold",children:c}),e.jsx("div",{className:"mt-2 text-body-secondary",children:m})]})}),d.IsCurrentlyActive&&e.jsx("div",{className:"card-footer bg-white border-0 d-flex justify-content-end",children:e.jsxs("span",{className:"badge bg-success d-flex align-items-center",children:[e.jsx("i",{className:"fas fa-check me-1"})," ",l]})})]},u)})]})})})}),Uh=_(et(i=>{const{formatMessage:a}=i.i18n.get(Ft),{formatMessage:t}=i.i18n.get(Q),[s,n]=P.useState(null);return P.useEffect(()=>{Ws.CurrentOperatorHasFidelity().then(r=>n(r))},[]),e.jsxs(re,{title:a(r=>r.AccountPage),fullWidth:!0,children:[e.jsx("div",{className:"d-flex justify-content-end",children:e.jsx(Te,{customLink:"/",customLabel:t(r=>r.Prenota)})}),e.jsxs(ja,{children:[e.jsx(lt,{name:"account",caption:a(r=>r.AccountPage),children:e.jsx(Eo,{children:e.jsx(Ed,{})})}),e.jsx(lt,{name:"mytickets",caption:t(r=>r.MyTickets),children:e.jsx(Vo,{})}),i.roles.find(r=>r===ce.canusewallet.name)!=null&&e.jsx(lt,{name:"wallet",caption:t(r=>r.MyWallet),children:e.jsx(sn,{})}),i.roles.find(r=>r===ce.canviewremaindercoupons.name)!=null&&e.jsx(lt,{name:"coupons",caption:t(r=>r.MyCoupons),children:e.jsx(Bh,{})}),s===null&&e.jsx(X,{}),s===!0&&e.jsx(lt,{name:"fidelities",caption:t(r=>r.MyFidelity),children:e.jsx(Wh,{})})]})]})})),Vh=_(i=>{const{selectable:a,selected:t,onClick:s}=i;return a?e.jsx("a",{className:"stretched-link position-relative",onClick:t?void 0:s,style:{color:"inherit",cursor:"pointer"},children:i.children}):e.jsx("div",{style:{cursor:"not-allowed"},children:i.children})}),Gh=_(i=>{var{formatMessage:a}=i.i18n.get(ie);const{price:t,fullPrice:s}=i;return e.jsx("div",{className:"d-flex align-items-center",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-medium fw-bold",children:a(n=>n.TotalPrice)}),e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsxs("div",{className:"fw-bolder text-medium text-nowrap me-2 fontsize-20u",children:["⬠",V.toDecimalString(t)]}),s&&s>t&&e.jsxs("div",{className:"text-body-secondary text-decoration-line-through fontsize-5u text-nowrap ms-1 fw-bold",children:["⬠",V.toDecimalString(s)]})]})]})})}),qh=_(i=>{var{formatMessage:a}=i.i18n.get(ie);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-medium fw-bold",children:a(t=>t.TotalPrice)}),e.jsx("div",{className:"d-flex align-items-center",children:e.jsx("div",{className:"fw-bolder text-medium text-nowrap me-2 fontsize-20u",children:" / "})})]})}),qn=_(i=>{const{returnPrice:a}=i,{formatMessage:t}=i.i18n.get(ie);return a?e.jsx("div",{className:"d-flex align-items-center",children:e.jsx("button",{onClick:s=>{s.stopPropagation(),fs(n=>e.jsx("div",{className:"fw-bold fontsize-5u text-info my-2",children:t(r=>r.ReturnFareInfo)}),{showFooter:!0})},className:"btn btn-link position-relative",style:{zIndex:900,textDecoration:"none"},children:e.jsx($o,{returnPrice:a,returnPriceDaysConfigured:i.returnPriceDaysConfigured})})}):null}),Hh=Zi(i=>{var a,t,s;const{trips:n}=i,r=Zr.useApplicationConfig();if(r==null)return null;const o=(t=(a=Xr.getDefault())===null||a===void 0?void 0:a.id)!==null&&t!==void 0?t:"",d=ma.GetSolutionCarriers(n);if(!ma.NeedExternalCarrierInfos(n,r,o))return null;const u=d.map((c,l)=>e.jsx("div",{className:"d-flex align-items-center flex-nowrap",children:e.jsx(Us,{companyId:c.carrierId,template:m=>e.jsxs("div",{className:"text-nowrap fontsize-3d fw-bold text-info",children:["Operata da ",m.description]})})}));return e.jsx("div",{className:`${(s=i.containerClassName)!==null&&s!==void 0?s:""} d-flex flex-wrap`,children:u})}),Kh=Zi(i=>{const{trips:a}=i;return e.jsx("div",{className:"fw-bold text-nowrap",children:a[0].vehicleDescription})}),Qh=i=>{var a,t,s,n;const r=C=>{if(i.customSelector!=null){const A=i.customSelector;return e.jsx(A,Object.assign({},C))}else return e.jsx(Vh,Object.assign({},C))},o=(C,A)=>C?"border border-primary border-3":A?"border border-info border-2":"",d=Zr.useApplicationConfig();if(d==null)return null;const{formatMessage:u}=i.i18n.get(ie),{selected:c,isVisible:l,onSelect:m,solution:h,selectedFareCategories:f,bestPriceOfDay:p}=i,{trips:g}=h;let v=g[0].departureDateTime,x=g[g.length-1].arrivalDateTime;const{limitation:S,selectable:y,notAllowed:b,luggagesOrVehiclesSelectable:j}=Ee.SolutionSelectable(h,f,"passengers"),I=o(c,p),N=h.trips.map(C=>({carrierId:C.trip.carrierId,departure:C.departureStopId,arrival:C.arrivalStopId,vehicleDescription:C.trip.vehicleDescription,travelMode:C.trip.travelMode,lineId:C.trip.lineId})),w=(a=Xr.getDefault())===null||a===void 0?void 0:a.id,T=ma.NeedExternalCarrierInfos(N,d,w??"");return e.jsx(e.Fragment,{children:e.jsxs("div",{className:`bg-white rounded ${y?"":"opacity-50"} p-3 shadow mb-3 ${I} ${l?"":"d-none"} position-relative`,children:[e.jsxs(r,{selected:c,selectable:y,luggagesOrVehiclesSelectable:j,onClick:m,solution:h,selectedFareCategories:i.selectedFareCategories,i18n:i.i18n,ticketIndex:i.ticketIndex,children:[e.jsxs("div",{className:"row align-items-center",children:[e.jsx("div",{className:"col-4 col-lg-2",children:e.jsx(Ze,{stopId:h.departureStopId,label:u(C=>C.Partenza),showTimeDay:v.getDate()!=x.getDate(),departureDateTime:v})}),e.jsxs("div",{className:"col-4 col-lg-1 d-flex flex-column align-items-center justify-content-center",children:[T?e.jsx("div",{children:e.jsx(ju,{carrierId:ma.GetSolutionCarriers(N)[0].carrierId,height:40})}):e.jsx("div",{children:e.jsx("img",{src:"./images/ferry.svg",height:40})}),!T&&e.jsx(ze,{role:ce.canviewvehicleinfo,children:e.jsx(Kh,{trips:N})}),e.jsx(Hh,{trips:N}),e.jsx("div",{children:e.jsx(Bo,{departureDateTime:v,arrivalDateTime:x})})]}),e.jsx("div",{className:"col-4 col-lg-2 d-flex justify-content-end",children:e.jsx("div",{children:e.jsx(Ze,{stopId:h.arrivalStopId,label:u(C=>C.Arrival),showTimeDay:v.getDate()!=x.getDate(),departureDateTime:x})})}),e.jsx("div",{className:"col-12 col-lg-2 my-2",children:e.jsx(mo,{messageIds:h.customMessages})}),e.jsxs("div",{className:"col-6 col-lg-2",children:[e.jsx("div",{className:"fw-bolder text-medium mb-2",children:u(C=>C.Disponibilita)}),e.jsxs("div",{className:"fontsize-2d",children:[e.jsxs("div",{className:"d-flex flex-nowrap align-items-center mb-2",style:{gap:"0.5rem"},children:[e.jsx(uh,{solution:h,limitationId:S,notAllowed:b,selectedFareCategories:f}),e.jsx(Wn,{solution:h,selectedFareCategories:f,type:2}),e.jsx(Wn,{solution:h,selectedFareCategories:f,type:1})]}),e.jsx(mh,{solution:h,limitationId:S,notAllowed:b,selectedFareCategories:f}),f.some(C=>C.category.type==2)&&e.jsx("div",{children:e.jsx($n,{solution:h,type:2,selectedFareCategories:i.selectedFareCategories})}),f.some(C=>C.category.type==1)&&e.jsx("div",{children:e.jsx($n,{solution:h,type:1,selectedFareCategories:i.selectedFareCategories})})]})]}),e.jsx("div",{className:"col-6 col-lg-3",children:i.subscriptionReservation?null:e.jsx("div",{children:e.jsxs("div",{className:"d-flex flex-column align-items-lg-center align-items-end",children:[h.priceInfo&&y?e.jsxs(e.Fragment,{children:[e.jsx(Gh,{price:(s=h.priceInfo.totalPrice)!==null&&s!==void 0?s:0,fullPrice:(n=h.priceInfo.onWayPrice)!==null&&n!==void 0?n:h.priceInfo.fullPrice}),y&&h.priceInfo!=null&&h.priceInfo.returnPrice!=null&&e.jsx("div",{className:"d-none d-lg-block",children:e.jsx(qn,{returnPrice:h.priceInfo.returnPrice,totalPrice:h.priceInfo.fullPrice,returnPriceDaysConfigured:h.returnPriceDaysConfigured})})]}):e.jsx(qh,{}),((t=h.priceInfo)===null||t===void 0?void 0:t.onWayPrice)&&e.jsx(hh,{})]})})}),y&&h.priceInfo!=null&&h.priceInfo.returnPrice!=null&&e.jsx("div",{className:"d-flex d-lg-none col-12 justify-content-end p-2",children:e.jsx(qn,{returnPrice:h.priceInfo.returnPrice,totalPrice:h.priceInfo.fullPrice,returnPriceDaysConfigured:h.returnPriceDaysConfigured})})]}),e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-12",children:e.jsx(ho,{messageIds:h.customMessages})})})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"d-none d-lg-block position-absolute translate-middle badge bg-info text-uppercase px-3",style:{to
18p:0,left:"95%"},children:u(C=>C.BestPrice)}),e.jsx("span",{className:"d-block d-lg-none position-absolute translate-middle badge bg-info text-uppercase px-3",style:{top:0,left:"85%"},children:u(C=>C.BestPrice)})]})]})})},Jh=_(Zi(Qh)),ba=_(i=>te.environmentName=="blunavy"||te.environmentName=="ichnusa"?e.jsx(Jh,Object.assign({},i)):e.jsx(fh,Object.assign({},i))),Yh=_(et(i=>{const{departure:a,arrival:t,i18n:s,roles:n}=i,{formatMessage:r}=s.get(ne);return!i.arrival.subscription||!n.find(o=>o==ce.canissuesubscriptions.name)?null:e.jsx("div",{className:"alert alert-primary-light animate__animated animate__headShake my-3 d-flex flex-wrap justify-content-between align-items-center",children:e.jsxs("div",{children:[e.jsx("strong",{children:r(o=>o.SubscriptionDisclaimer)}),e.jsx(at,{className:"text-primary fw-bold ms-2",to:D.SubscriptionBuyPath(a.description,t.description),children:r(o=>o.FindOutMore)})]})})})),qo=i=>e.jsx("div",{className:"navigation-header-lg bg-primary border-top border-primary shadow",style:i.customStyle,children:e.jsx("div",{className:"container pt-2",children:i.children})});var nn=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Zh=_(i=>{const{i18n:a,canProceed:t,proceed:s}=i,{formatMessage:n}=a.get(ne);return e.jsx("button",{className:"btn btn-primary btn-lg btn-highlight d-flex align-items-center justify-content-center fw-bold fontsize-5u py-3 w-100 h-100",disabled:!t,onClick:()=>nn(void 0,void 0,void 0,function*(){t&&(yield s())}),children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{children:e.jsx("i",{className:"fa-solid fa-play"})}),e.jsx("div",{children:n(r=>r.Continua)})]})})}),Xh=_(i=>{const{i18n:a,canProceed:t,proceed:s}=i,{formatMessage:n}=a.get(ne);return e.jsxs("button",{className:"btn btn-primary btn-highlight d-flex align-items-center justify-content-center fw-bold fontsize-5u w-100",style:{height:60},disabled:!t,onClick:()=>nn(void 0,void 0,void 0,function*(){t&&(yield s())}),children:[e.jsx("div",{className:"me-2",children:e.jsx("i",{className:"fa-solid fa-play"})}),e.jsx("div",{children:n(r=>r.Continua)})]})}),Hn=_(i=>{const{i18n:a,canProceed:t,proceed:s}=i,{formatMessage:n}=a.get(ne);return e.jsx("button",{className:"btn btn-primary btn-highlight d-flex align-items-center justify-content-center fw-bold fontsize-2u py-2 w-100 rounded",disabled:!t,onClick:()=>nn(void 0,void 0,void 0,function*(){t&&(yield s())}),children:e.jsx("span",{children:n(r=>r.Continua)})})});var ep=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const tp=new Ta,Ho=i=>(te.environmentName=="blunavy"||te.environmentName=="ichnusa")&&(i==null||i.agencyId=="a7feaf5c-fe0c-436b-b339-56889237e06e"),ip=ci(_(i=>{var a;if(i.reservation==null&&!Ho(i.user))return null;const{formatMessage:t}=i.i18n.get(He),[s,n]=P.useState({coupon:void 0}),r=Ma(),o=Kt(),d=(a=new URLSearchParams(o.search).get("referral"))!==null&&a!==void 0?a:null,{departure:u,arrival:c,selectedFareCategories:l,departureDate:m,returnDate:h}=r;if(P.useEffect(()=>{d!=null?p(d):s.coupon&&p(s.coupon)},[d,u==null?void 0:u.id,c==null?void 0:c.id,m==null?void 0:m.valueOf(),h==null?void 0:h.valueOf()]),r==null)return null;const f=v=>{var x,S,y,b,j,I;if(r&&r.departure&&r.arrival&&r.departureDate){const w=li.getSearchPeriod(k.ToPlainDate(m??new Date));var N=new Sn({departure:(y=u==null?void 0:u.description)!==null&&y!==void 0?y:"",arrival:(b=c==null?void 0:c.description)!==null&&b!==void 0?b:"",dateFrom:w.from,dateTo:w.to,channel:i.saleChannel,passengers:l??[Fe.Default],isReturn:r.returnDate!=null,changeDate:!1,subscriptionTypeId:void 0,locale:i.hl,coupon:v,useReservedSeats:!1},(x=i.reservation)===null||x===void 0?void 0:x.reservationId);if(us.TRAVEL_SOLUTION_SEARCHED(N),r.returnDate!=null){const T=li.getSearchPeriod(k.ToPlainDate(r.returnDate));var N=new Sn({departure:(j=c==null?void 0:c.description)!==null&&j!==void 0?j:"",arrival:(I=u==null?void 0:u.description)!==null&&I!==void 0?I:"",dateFrom:T.from,dateTo:T.to,channel:i.saleChannel,passengers:l??[Fe.Default],isReturn:r.returnDate!=null,changeDate:!1,subscriptionTypeId:void 0,locale:i.hl,coupon:v,useReservedSeats:!1},(S=i.reservation)===null||S===void 0?void 0:S.reservationId);us.TRAVEL_SOLUTION_SEARCHED(N)}}},p=v=>ep(void 0,void 0,void 0,function*(){(yield tp.verify({code:v,saleChannel:i.saleChannel})).isValid?(K.setCoupon(v),f(v),n({coupon:v})):(K.setCoupon(void 0),f(void 0),n({coupon:void 0,error:t(S=>S.NotValidCoupon)}))}),g=()=>{K.setCoupon(void 0),f(void 0),n({coupon:void 0})};return i.reservation?e.jsx(Ds,{onAssigned:p,onDismiss:g}):e.jsx(Fd,{assignedCoupon:s.coupon,onAssigned:p,onDismiss:g,error:s.error})})),rn=fe(ip,J(),(i,a)=>({reservation:i.get()})),Ue=i=>{const{title:a,description:t,imageLink:s,darkened:n}=i;return e.jsxs("div",{style:{backgroundColor:n?"#000000":void 0,height:120},className:"rounded position-relative",children:[i.redirectLink&&e.jsx("a",{href:i.redirectLink,className:"stretched-link"}),e.jsx("div",{className:"w-100 h-100 rounded",style:{backgroundImage:`url("${s}")`,backgroundSize:"cover",backgroundPosition:"center",opacity:n?"60%":void 0}}),a!=null||t!=null?e.jsx("div",{className:"position-absolute text-white",style:{to
18p:0},children:e.jsxs("div",{className:"p-4",children:[e.jsx("div",{className:"fontsize-3u mb-4 fw-bold",children:a}),e.jsx("div",{className:"fontsize-2d",children:t})]})}):null]})};function ap(i){switch(i){case"en":return"https://tools.blunavytraghetti.com/booking/en/header-checkout.jpg";case"de":return"https://tools.blunavytraghetti.com/booking/de/header-checkout.jpg";case"fr":return"https://tools.blunavytraghetti.com/booking/fr/header-checkout.jpg";default:return"https://tools.blunavytraghetti.com/booking/it/header-checkout.jpg"}}function sp(i){switch(i){case"it":return"https://www.cortinaexpress.it/wp-content/uploads/2024/05/banner-bol-cortina-express-ita.jpg";default:return"https://www.cortinaexpress.it/wp-content/uploads/2024/05/banner-bol-cortina-express-eng.jpg"}}function np(i){switch(i){case"it":return"https://www.lefrecce.it/Channels.Website.WEB/#/white-label/MINISITI/?isRoundTrip=false&departureStation=&arrivalStation=&lang=it&minisitiCallBackId=57149&minisitiHeaderImageIt=&minisitiFooterImageIt=&minisitiHeaderImageEn=&minisitiFooterImageEn=&minisitiHeaderImageDe=&minisitiFooterImageDe=&minisitiHeaderImageFr=&minisitiFooterImageFr=";default:return"https://www.lefrecce.it/Channels.Website.WEB/#/white-label/MINISITI/?isRoundTrip=false&departureStation=&arrivalStation=&lang=en&minisitiCallBackId=57149&minisitiHeaderImageIt=&minisitiFooterImageIt=&minisitiHeaderImageEn=&minisitiFooterImageEn=&minisitiHeaderImageDe=&minisitiFooterImageDe=&minisitiHeaderImageFr=&minisitiFooterImageFr="}}const rp=_(i=>{var a;const{formatMessage:t}=i.i18n.get(ne),s=(a=i.hl)!==null&&a!==void 0?a:"it";switch(te.environmentName){case"blunavy":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitle),description:t(n=>n.ImageBannerDescription),imageLink:ap(s),darkened:!0});case"marinobus":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitleMarinobus),description:t(n=>n.ImageBannerDescriptionMarinobus),imageLink:"https://marinobus.it/wp-content/uploads/2024/05/Immagine_sitrap-1.jpg",darkened:!0});case"sais":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitleSais),description:t(n=>n.ImageBannerDescriptionSais),imageLink:"https://uploads-ssl.webflow.com/62441ad55224c8087dcfa73e/665de66c52529f731abd8b4b_sais-autolinee-autobus.png",darkened:!0});case"libertylines":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitleLiberty),description:t(n=>n.ImageBannerDescriptionLiberty),imageLink:"/images/side-banner.png",darkened:!0});case"salemi":return e.jsx(Ue,{title:"",description:"",imageLink:"https://www.autoservizisalemi.it/wp-content/uploads/2024/11/banner-booking-ANDATA-RITORNO.gif"});case"cortinaexpress":return e.jsx(Ue,{imageLink:sp(s),redirectLink:np(s)});case"dicarlobus":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitle),description:t(n=>n.ImageBannerDescription),imageLink:"https://dicarlobus.com/wp-content/uploads/2024/04/Aeroporto-scaled.jpg",darkened:!0});case"intersaj":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitle),description:t(n=>n.ImageBannerDescription),imageLink:"https://www.saj.it/assets/images/new/8.jpg",darkened:!0});case"acierno":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitle),description:t(n=>n.ImageBannerDescription),imageLink:"https://irp-cdn.multiscreensite.com/f8529d6f/dms3rep/multi/autolinee-Acierno-Stefano-Autoservizi-Baiano-035-2cfd94ce.jpg",darkened:!0});case"livignoexpress":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitle),description:t(n=>n.ImageBannerDescription),imageLink:"https://www.livignoexpress.com/wp-content/uploads/2022/10/itinerario2-300x200.jpg",darkened:!0});case"tiemme":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitle),description:t(n=>n.ImageBannerDescription),imageLink:"https://www.tiemmespa.it/wp-content/uploads/2023/08/bus-gran-turismo-04.jpg",darkened:!0});case"marozzi":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitle),description:t(n=>n.ImageBannerDescription),imageLink:"https://www.marozzivt.it/wp-content/uploads/2023/06/home.png",darkened:!0});case"interss":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitleInterSs),description:t(n=>n.ImageBannerDescriptionInterSs),imageLink:"https://transferandcruise.com/wp-content/uploads/2024/06/bus-msc.jpg",darkened:!0});case"ichnusa":return e.jsx(Ue,{title:t(n=>n.ImageBannerTitle),description:t(n=>n.ImageBannerDescription),imageLink:"https://ichnusalines.com/wp-content/uploads/2022/07/Ichnusa-lines-il-traghetto-tra-corsica-e-sardegna.jpg",darkened:!0});default:return e.jsx(Ue,{title:t(n=>n.ImageBannerTitle),description:t(n=>n.ImageBannerDescription),imageLink:"/images/side-banner-bus.jpg",darkened:!0})}}),op=i=>{var a,t,s;const{reservation:n,i18n:r}=i,{formatMessage:o}=r.get(ie),{formatMessage:d}=r.get(Q),u=Pt.Solutions(n),{returnDate:c}=Ma();if(!(c!=null?n!=null&&u[1]!=null:n!=null&&u[0]!=null))return null;var m=0;n!=null&&n.changeDateDetail!=null&&(m=n.changeDateDetail.tobepayed!=0?n.changeDateDetail.tobepayed-n.changeDateDetail.calculatedPenalty:0);const h=i.useWallet&&(t=(a=i.wallet)===null||a===void 0?void 0:a.credit)!==null&&t!==void 0?t:0;return e.jsxs("div",{className:"animate__animated animate__bounceInRight sticky-bottom",children:[e.jsx(rp,{title:"Scegli la combinazione perfetta per te",description:"Continua a raccogliere punti fedeltà e risparmia per i prossimi viaggi."}),n!=null&&e.jsx(Kn,{solution:u[0],price:hn(n.passengerReservations.flatMap(f=>{var p;return f.tickets[0].price+ye((p=f.tickets[0].luggages)!==null&&p!==void 0?p:[],g=>g.price)})),title:o(f=>f.Outbound)}),n!=null&&u[1]!=null&&e.jsx(Kn,{solution:(s=u[1])!==null&&s!==void 0?s:null,price:hn(n.passengerReservations.flatMap(f=>{var p,g,v;return((g=(p=f.tickets[1])===null||p===void 0?void 0:p.price)!==null&&g!==void 0?g:0)+ye((v=f.tickets[1].luggages)!==null&&v!==void 0?v:[],x=>x.price)})),title:o(f=>f.Return)}),n!=null&&e.jsx(dp,{reservation:n}),e.jsxs(Qo,{children:[e.jsx(rn,{saleChannel:1}),e.jsx(Ko,{reservation:n}),n!=null&&n.changeDateDetail!=null&&e.jsxs("div",{className:"fw-bolder text-medium",children:[m!=0&&e.jsxs("div",{className:"d-flex justify-content-between align-items-center my-2 fw-bold",children:[e.jsx("div",{className:"text-lowercase fontsize-1d",children:d(f=>f.Adeguamento)}),e.jsxs("div",{className:"fontsize-5u",children:[V.toDecimalString(m)," â¬"]})]}),n.changeDateDetail.calculatedPenalty>0&&e.jsxs("div",{className:"d-flex justify-content-between text-danger align-items-center my-2 fw-bold",children:[e.jsx("div",{className:"text-lowercase fontsize-1d",children:d(f=>f.Penale)}),e.jsxs("div",{className:"fontsize-5u",children:[V.toDecimalString(n.changeDateDetail.calculatedPenalty)," â¬"]})]})]}),n&&e.jsx("div",{tabIndex:0,children:i.useWallet&&h>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"d-flex justify-content-between align-items-center my-2 fw-bold",children:[e.jsx("div",{className:"text-lowercase fontsize-1d",children:o(f=>f.TotalPrice)}),e.jsxs("div",{className:"fontsize-5u",children:[V.toDecimalString(Pt.GetAmountToShow(n,void 0))," â¬"]})]}),e.jsxs("div",{className:"d-flex justify-content-between align-items-center my-2 fw-bold",children:[e.jsx("div",{className:"text-lowercase fontsize-1d",children:o(f=>f.WalletApplied)}),e.jsxs("div",{className:"fontsize-5u",children:["-",V.toDecimalString(h)," â¬"]})]}),e.jsxs("div",{className:"d-flex justify-content-between text-gold align-items-center my-2 fw-bold",children:[e.jsx("div",{className:"text-lowercase fontsize-2d",children:o(f=>f.PriceToPay)}),e.jsxs("div",{className:"fontsize-30u",children:[V.toDecimalString(Pt.GetAmountToShow(n,void 0)-h)," â¬"]})]})]})||e.jsxs("div",{className:"d-flex justify-content-between text-gold align-items-center my-2 fw-bold",children:[e.jsx("div",{className:"text-lowercase fontsize-2d",children:o(f=>f.TotalPrice)}),e.jsxs("div",{className:"fontsize-30u",children:[V.toDecimalString(Pt.GetAmountToShow(n,void 0))," â¬"]})]})}),e.jsx("div",{className:"mt-3",children:e.jsx(lp,Object.assign({},i))})]})]})},lp=i=>
18{const{reservation:a,canProceed:t,proceed:s}=i;return a==null||!t?e.jsx(Hn,{canProceed:!1,proceed:()=>{}}):e.jsx(Hn,{canProceed:t,proceed:s})},Ko=i=>{const{reservation:a}=i;if(a==null||a.reliefTotalAmount==0)return;const t=mt(it(a.passengerReservations.flatMap(s=>s.tickets.filter(n=>n.reliefAmount>0)),s=>s.reliefDescription),(s,n,r)=>e.jsxs("div",{className:"my-1",children:[e.jsx("strong",{className:"fw-bold",children:n})," ",V.toDecimalString(ye(s,o=>o.reliefAmount)),"â¬"]},n??"relief"+r));return e.jsx("div",{className:"my-3",children:t})},Qo=i=>e.jsx("div",{className:"border border-2 rounded bg-white shadow p-3 my-2",tabIndex:i.tabIndex,children:i.children}),dp=_(i=>{const{formatMessage:a}=i.i18n.get(ie),{categories:t,items:s,extraFares:n}=Pt.getItemsDetails(i.reservation);return e.jsx(wi,{heading:r=>e.jsx("div",{className:`bg-white p-3 rounded ${r?"border border-top-2 border-end-2 border-start-2 border-bottom-0":"border border-2 shadow"}`,children:e.jsxs("div",{className:"d-flex align-items-center text-info fw-bolder",children:[e.jsx("span",{className:"text-uppercase",children:a(o=>o.SaleSummary)}),e.jsx("i",{className:`ms-2 ${r?"fas fa-caret-down":"fas fa-caret-right"} fa-lg`})]})}),children:e.jsx("div",{className:"bg-white p-3 border border-top-0 border-end-2 border-start-2 border-bottom-2",children:e.jsx(jh,{categories:t,items:s,extraFares:n})})})}),ps=_(i=>{const{solution:a,title:t}=i;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-uppercase text-info fw-bolder mb-2 d-flex justify-content-between align-items-center",children:[e.jsx("div",{children:t}),e.jsx("div",{children:k.getShortFriendlyDateWithMonthNameAndYear(a[0].departureTime,i.hl)})]}),e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:"fontsize-3u fw-bolder",children:k.getTimeString(a[0].departureTime)}),e.jsxs("div",{className:"d-flex justify-content-between w-100 mx-3 align-items-center",children:[e.jsx("div",{style:{borderRadius:"50%",backgroundColor:"#e7eaec",padding:"3px"}}),e.jsx("div",{className:"w-100",style:{borderTop:"1px dashed #e7eaec"}}),e.jsx("div",{style:{borderRadius:"50%",backgroundColor:"#e7eaec",padding:"3px"}})]}),e.jsx("div",{className:"fontsize-3u fw-bolder",children:k.getTimeString(a[a.length-1].arrivalTime)})]}),e.jsxs("div",{className:"d-flex justify-content-between fw-bold",children:[e.jsx("div",{children:e.jsx(Ge,{id:a[0].departureId})}),e.jsx("div",{className:"text-end",children:e.jsx(Ge,{id:a[a.length-1].arrivalId})})]})]})}),Kn=_(i=>{const{solution:a,price:t,title:s,i18n:n}=i;if(a==null)return null;const{formatMessage:r}=n.get(ie);return e.jsxs(Qo,{tabIndex:0,children:[e.jsx(ps,{title:s,solution:a}),e.jsx("div",{className:"w-100 my-2",style:{borderTop:"1px dashed #e7eaec"}}),e.jsxs("div",{className:"d-flex justify-content-between align-items-center",children:[e.jsx("div",{className:"text-disabled text-uppercase fontsize-2d",children:r(o=>o.TotalPrice)}),e.jsxs("div",{className:"fontsize-5u text-disabled",children:[V.toDecimalString(t)," â¬"]})]})]})}),cp=fe(op,J(),i=>({reservation:i.get()})),up=$s(_(cp))("wallet"),mp=i=>{var a,t;const{reservation:s,i18n:n,canProceed:r,proceed:o}=i;if(!s)return null;const d=Pt.Solutions(s),[u,c]=P.useState(!1),{formatMessage:l}=n.get(ie),{formatMessage:m}=n.get(Q),{categories:h,items:f,extraFares:p}=Pt.getItemsDetails(s),g=J().GetAmountToShow(void 0);var v=0;s!=null&&s.changeDateDetail!=null&&(v=s.changeDateDetail.tobepayed!=0?s.changeDateDetail.tobepayed-s.changeDateDetail.calculatedPenalty:0);const x=i.useWallet&&(t=(a=i.wallet)===null||a===void 0?void 0:a.credit)!==null&&t!==void 0?t:0;return e.jsx("div",{className:`footer bg-white shadow-lg ${u?"expanded":""}`,children:u?e.jsxs("div",{className:"h-100 d-flex flex-column justify-content-between",onClick:()=>c(!u),children:[e.jsx("div",{className:"w-100 text-center mb-1",children:e.jsx("i",{className:"fa-solid fa-chevron-down"})}),e.jsx("div",{className:"p-1",children:e.jsxs("div",{className:"h-100 d-flex flex-column justify-content-end px-4",children:[e.jsx("div",{className:"my-2",children:e.jsx(ps,{title:l(S=>S.Outbound),solution:d[0]})}),d[1]&&e.jsx("div",{className:"my-2",children:e.jsx(ps,{title:l(S=>S.Return),solution:d[1]})}),e.jsx("div",{className:"w-100 my-4",style:{borderTop:"1px solid #e7eaec"}}),e.jsx("div",{className:"my-2",children:e.jsx(Sh,{categories:h,items:f,extraFares:p})}),e.jsxs("div",{className:"my-2",children:[e.jsx(Ko,{reservation:s}),s!=null&&s.changeDateDetail!=null&&e.jsxs("div",{className:"d-flex flex-row",children:[v!=0&&e.jsxs("div",{className:"d-flex flex-column me-2",children:[e.jsx("div",{className:"fw-bolder text-medium",children:m(S=>S.Adeguamento)}),e.jsx("div",{className:"d-flex align-items-center justify-content-between",children:e.jsxs("div",{className:"fontsize-5u fw-bolder text-medium",children:[V.toDecimalString(v)," â¬"]})})]}),s.changeDateDetail.tobepayed>0&&e.jsxs("div",{className:"d-flex flex-column",children:[e.jsx("div",{className:"fw-bolder text-medium",children:m(S=>S.Penale)}),e.jsx("div",{className:"d-flex align-items-center justify-content-between",children:e.jsxs("div",{className:"fontsize-5u fw-bolder text-medium text-danger",children:[V.toDecimalString(s.changeDateDetail.calculatedPenalty)," â¬"]})})]})]}),s&&e.jsx(e.Fragment,{children:i.useWallet&&x>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-medium",children:l(S=>S.TotalPrice)}),e.jsxs("div",{className:"d-flex align-items-center justify-content-between",children:[e.jsxs("div",{className:"fontsize-5u fw-bolder text-medium",children:[V.toDecimalString(g)," â¬"]}),s.fullPrice>s.price&&e.jsxs("div",{className:"text-danger text-decoration-line-through ms-3",children:[s.fullPrice," â¬"]})]}),e.jsx("div",{className:"text-medium",children:l(S=>S.WalletApplied)}),e.jsx("div",{className:"d-flex align-items-center justify-content-between",children:e.jsxs("div",{className:"fontsize-5u fw-bolder text-small",children:["-",V.toDecimalString(x)," â¬"]})}),e.jsx("div",{className:"fw-bolder text-medium",children:l(S=>S.PriceToPay)}),e.jsx("div",{className:"d-flex align-items-center justify-content-between",children:e.jsxs("div",{className:"fontsize-20u fw-bolder text-medium text-gold",children:[V.toDecimalString(g-x)," â¬"]})})]})||e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fw-bolder text-medium",children:l(S=>S.TotalPrice)}),e.jsxs("div",{className:"d-flex align-items-center justify-content-between",children:[e.jsxs("div",{className:"fontsize-20u fw-bolder text-medium text-gold",children:[V.toDecimalString(g-x)," â¬"]}),s.fullPrice>s.price&&e.jsxs("div",{className:"text-danger text-decoration-line-through ms-3",children:[s.fullPrice," â¬"]})]})]})})]})]})}),e.jsx("div",{className:"d-flex align-items-end p-0",children:s&&r&&e.jsx(Xh,{canProceed:r,proceed:o})})]}):e.jsxs("div",{className:"row align-items-center h-100",children:[e.jsxs("div",{className:"col-7 px-4",onClick:()=>c(!u),children:[e.jsxs("div",{className:"w-100 d-flex justify-content-between mb-1",children:[e.jsx("div",{className:"fw-bolder text-medium",children:l(S=>S.TotalPrice)}),e.jsxs("div",{className:"text-info",children:[e.jsx("i",{className:"fa-solid fa-chevron-up me-2"}),l(S=>S.InfoViaggio)]})]}),e.jsx("div",{className:"d-flex align-items-center justify-content-between",children:e.jsxs("div",{className:"fontsize-20u fw-bolder text-medium",children:[V.toDecimalString(g-x)," â¬"]})})]}),e.jsx("div",{className:"col-5 h-100 p-0",children:s&&r&&e.jsx(Zh,{canProceed:r,proceed:o})})]})})},hp=$s(fe(_(mp),J(),i=>({reservation:i.get()})))("wallet"),Ii=i=>e.jsxs(e.Fragment,{children:[i.title&&e.jsx(Fo,{title:i.title}),e.jsx("div",{className:"container",children:e.jsxs("div",{className:"row",children:[i.showNavigation&&e.jsx("div",{className:"col-12",children:e.jsx("div",{className:"my-3",children:e.jsx(Te,{})})}),e.jsx("div",{className:"col-12 col-xl-9",children:i.children}),e.jsx("div",{className:"col-12 col-xl-3 d-none d-xl-block",children:e.jsx("div",{className:"sticky-top",children:e.jsx(up,{proceed:i.proceed,canProceed:i.canProceed,canProceedWithApm:i.canProceedWithApm,useWallet:i.useWallet})})})]})}),e.jsx("div",{className:"footer-container d-xl-none",children:e.jsx("div",{className:`fixed-bottom ${i.entranceAnimation?"animate__animated animate__bounceInLeft":""}`,children:e.jsx(hp,{proceed:i.proceed,canProceed:i.canProceed,canProceedWithApm:i.canProceedWithApm,useWallet:i.useWallet})})})]});var Ri=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};
18class Jo extends P.Component{constructor(a){super(a),this.unreserveAndClear=()=>{K.getSolution()!=null&&K.setSolution(null),this.state.selectedOutboundSolution!=null&&this.setState({selectedOutboundSolution:null}),K.getReturnSolution()!=null&&K.setReturnSolution(null),this.state.selectedReturnSolution!=null&&this.setState({selectedReturnSolution:null}),J().get()!=null&&Me.delete()},this.reservationListener=()=>{var t,s;const n=(s=J().get())!==null&&s!==void 0?s:null;n&&(n==null?void 0:n.reservationId)!=((t=this.state.reservation)===null||t===void 0?void 0:t.reservationId)&&this.setState({reservation:n})},this.proceed=()=>Ri(this,void 0,void 0,function*(){const{selectedOutboundSolution:t,selectedReturnSolution:s}=this.state,{formatMessage:n}=this.props.i18n.get(ne);if(t&&s&&s.trips[0].departureDateTime.valueOf()<t.trips[t.trips.length-1].arrivalDateTime.valueOf()){yield ai(n(r=>r.DepartureAfterReturn));return}this.props.user!=null?this.props.history(D.TicketPaymentMethodPath):this.props.history(D.TicketRegisterOrNotPath)}),this.onChangeOutboundDate=t=>{this.setState({selectedOutboundDate:t})},this.onChangeReturnDate=t=>{this.setState({selectedReturnDate:t})},this.onSearchSolutions=t=>{if(t.departure&&t.arrival&&t.date){let s=D.SelectSolutionPath(t.departure.description,k.PlainDateToDate(t.date),t.arrival.description,t.return&&t.returnDate?k.PlainDateToDate(t.returnDate):void 0);this.props.history({pathname:s,search:new Bi(Wt.getQuery(t.selectedFareCategories,this.props.fareCategories)).stringify()}),pn(this.props.selectedFareCategories,t.selectedFareCategories)||li.clear()}},this.onSelectOutboundSolution=t=>Ri(this,void 0,void 0,function*(){K.setSolution(t),K.setReturnSolution(null),this.setState({selectedOutboundSolution:t,showAllOutbounds:!1,selectedReturnSolution:null},()=>this.reserve(this.props)),this.sendSelectedEvent(t,"outbound")}),this.onSelectReturnSolution=t=>{K.setReturnSolution(t),this.setState({selectedReturnSolution:t,showAllReturns:!1},()=>this.reserve(this.props)),this.sendSelectedEvent(t,"inbound")},this.onShowAllOutbounds=()=>{this.setState({showAllOutbounds:!0})},this.onShowAllReturns=()=>{this.setState({showAllReturns:!0})},this.onOpenIssueRequested=t=>Ri(this,void 0,void 0,function*(){const s=yield si.ISSUE(t,we(D.subscriptionokPath),we(D.subscriptionkoPath),void 0,we(D.PayByLinkSubscriptionsPath));let n=!0;if(s.redirect&&(n=yield st(s.redirect,this.props.history)),n)this.props.history(D.SubscriptionOk(s.result.id,s.result.pnr));else throw"unexpected error"}),this.onChangeSearchData=t=>{var s,n,r;const o=D.TravelSelection(t.return,(r=(s=t.departure)===null||s===void 0?void 0:s.description)!==null&&r!==void 0?r:" ",t.date?k.PlainDateToDate(t.date):void 0,(n=t.arrival)===null||n===void 0?void 0:n.description,t.return&&t.returnDate?k.PlainDateToDate(t.returnDate):void 0);this.props.history({pathname:o,search:new Bi(Wt.getQuery(t.selectedFareCategories,this.props.fareCategories)).stringify()},{replace:!0})},this.onSelectTplStops=(t,s,n)=>{const r=new URLSearchParams(window.location.search);n&&r.set("tab",n),r.set("dep",t.id),r.set("arr",s.id),r.has("mode")||r.set("mode","purchase"),this.props.history({pathname:D.TravelSelection(),search:r.toString()},{replace:!1})},this.state={selectedOutboundSolution:K.getSolution(),selectedReturnSolution:K.getReturnSolution(),reservation:J().get(),selectedOutboundDate:k.ToPlainDate(this.props.departureDate),selectedReturnDate:this.props.returnDate?k.ToPlainDate(this.props.returnDate):null,showAllOutbounds:!1,showAllReturns:!1,isCompactedView:!0}}UNSAFE_componentWillReceiveProps(a){if(this.props.dep!=a.dep||this.props.arr!=a.arr||this.props.returnDate!=null!=(a.returnDate!=null))this.unreserveAndClear();else if(!pn(this.props.selectedFareCategories,a.selectedFareCategories)){let t=!0;const s=K.getSolution(),n=K.getReturnSolution();if(n!=null){const r=n.remainingSeats;let o=Wt.getPassengers(a.selectedFareCategories,a.user);r!=null&&r<o.length&&(this.unreserveAndClear(),t=!1)}else if(s!=null){const r=s.remainingSeats;let o=Wt.getPassengers(a.selectedFareCategories,a.user);r!=null&&r<o.length&&(this.unreserveAndClear(),t=!1)}t&&this.reserve(a)}a.departure&&a.arrival&&this.sendSearchedSolutionEvent({departure:a.departure,arrival:a.arrival,date:k.ToPlainDate(a.departureDate),selectedFareCategories:a.selectedFareCategories,return:a.returnDate!==null,returnDate:a.returnDate?k.ToPlainDate(a.returnDate):void 0}),this.setState({selectedOutboundSolution:K.getSolution(),selectedReturnSolution:K.getReturnSolution(),selectedOutboundDate:k.ToPlainDate(a.departureDate),selectedReturnDate:a.returnDate?k.ToPlainDate(a.returnDate):null})}componentDidMount(){J().Changed.register(this.reservationListener)}componentWillUnmount(){J().Changed.unregister(this.reservationListener)}reserve(a){return Ri(this,void 0,void 0,function*(){var t;let s=Wt.getPassengers(a.selectedFareCategories,a.user);const n=a.selectedFareCategories.filter(o=>o.category.type!=0);if(a.returnDate==null&&(K.setReturnSolution(null),this.state.selectedReturnSolution!=null&&this.setState({selectedReturnSolution:null})),this.state.selectedOutboundSolution&&s.length>0){J().applyPassengers(s),J().luggageSelection=n;const d=(t=new URLSearchParams(window.location.search).get("referral"))!==null&&t!==void 0?t:void 0;yield Me.createOrUpdate(1,[this.state.selectedOutboundSolution,this.state.selectedReturnSolution].filter(u=>u),n,d)}const r=K.getCoupon();r&&(yield Me.applyCoupon(r))})}canProceed(){return this.state.reservation!=null&&this.state.selectedOutboundSolution!=null&&(this.props.returnDate==null||this.state.selectedReturnSolution!=null)}render(){var a,t,s,n,r,o,d,u;const{formatMessage:c}=this.props.i18n.get(ne),{reservation:l}=this.state,m=this.props.selectedFareCategories;let h=this.state.selectedReturnDate;var f=K.getSolution();f&&h&&Temporal.PlainDate.compare(h,f.date)<0&&(h=f.date);var p=new Mo;p.departure=this.props.departure,p.arrival=this.props.arrival,p.date=k.ToPlainDate(this.props.departureDate),p.return=this.props.returnDate!=null,p.returnDate=this.props.returnDate?k.ToPlainDate(this.props.returnDate):void 0,p.selectedFareCategories=this.props.selectedFareCategories;const g=b=>e.jsx(ba,Object.assign({},b,{selectedFareCategories:m})),v=b=>e.jsx(ba,Object.assign({},b,{selectedFareCategories:m})),{i18n:x}=this.props,S=x.get(ie).formatMessage,y=Ho(this.props.user);return e.jsxs(e.Fragment,{children:[e.jsx("title",{children:S(b=>b.TravelSelectionTitle(dt.environmentName,this.props.dep,this.props.arr))}),e.jsx("meta",{name:"description",content:S(b=>b.TravelSelectionMetaDescription(dt.environmentName,this.props.dep,this.props.arr))}),e.jsx("link",{rel:"canonical",href:we(D.SelectSolutionPath(this.props.dep,null,this.props.arr))}),e.jsxs("div",{className:"position-relative",children:[e.jsx(qo,{customStyle:{minHeight:100},children:e.jsx(Ro,{onSearchSolutions:this.onSearchSolutions,onSelectTplStops:this.onSelectTplStops,searchData:p,onChangeSearchData:this.onChangeSearchData,navigate:this.props.history,autoSerch:!0,isCompactedView:dt.environmentName=="blunavy"?!1:this.state.isCompactedView,onCompactedViewChange:dt.environmentName=="blunavy"?void 0:b=>this.setState({isCompactedView:b})})}),e.jsxs("div",{className:this.state.isCompactedView?"mt-4":"mt-4 mt-xl-6rem",children:[y&&e.jsx("div",{className:"d-block d-xl-none",children:e.jsx("div",{className:"bg-white shadow p-3 mb-3",children:e.jsx(rn,{saleChannel:1})})}),e.jsxs(Ii,{proceed:this.proceed,canProceed:this.canProceed(),entranceAnimation:!0,canProceedWithApm:!0,useWallet:!1,children:[p.departure&&p.arrival&&e.jsx(Yh,{departure:p.departure,arrival:p.arrival}),this.props.arrival&&this.props.arrival.p2pTickets==null&&this.props.arrival.open?e.jsx("div",{children:e.jsx(za,{departure:this.props.departure,arrival:(r=this.props.arrival)!==null&&r!==void 0?r:this.props.departure,combinationData:{departure:null,arrival:null,isValidForAllPools:!0},mode:null,salesChannel:1,onIssue:this.onOpenIssueRequested,navigate:this.props.history})}):((a=this.props.departure)===null||a===void 0?void 0:a.description)&&((t=this.props.arrival)===null||t===void 0?void 0:t.description)&&e.jsxs(e.Fragment,{children:[e.jsx(gn,{fareCategories:m,selectedSolution:this.state.selectedOutboundSolution,minimumDate:Temporal.Now.plainDateISO(),onChangeDate:this.onChangeOutboundDate,request:{date:this.props.departureDate,dep:this.props.departure.description,arr:(s=this.props.arrival)===null||s===void 0?void 0:s.description},onSelectSolution:this.onSelectOutboundSolution,ticketIndex:0,onShowAll:this.onShowAllOutbounds,showAll:this.state.showAllOutbounds,reservationId:l==null?void 0:l.reservationId,selectedDate:this.state.selectedOutboundDate,travelSolutionTemplate:g,title:c(b=>b.OutboundSearchResult),titleButtonShow:c(b=>b.ChangeSolution),channel:1,isReturn:(o=p.return)!==null&&o!==void 0?o:!1,reservedSeats:os(this.props.roles),showWithDisabilitiesSeats:this.props.roles.find(b=>b==ce.canviewwithdisabilitiesseats.name)!=null,changeDate:!1,locale:this.props.hl,coupon:(d=l==null?void 0:l.couponCode)!==null&&d!==void 0?d:K.getCoupon(),useReservedSeats:!1}),this.props.returnDate&&p.return&&e.jsx(gn,{fareCategories:m,selectedSolution:this.state.selectedReturnSolution,minimumDate:this.state.selectedOutboundDate,onChangeDate:this.onChangeReturnDate,request:{date:this.props.returnDate,arr:(n=this.props.departure)===null||n===void 0?void 0:n.description,dep:this.props.arrival.description},onSelectSolution:this.onSelectReturnSolution,ticketIndex:1,onShowAll:this.onShowAllReturns,showAll:this.state.showAllReturns,reservationId:l==null?void 0:l.reservationId,selectedDate:h??this.state.selectedOutboundDate,travelSolutionTemplate:v,title:c(b=>b.ReturnSearchResult),titleButtonShow:c(b=>b.ChangeSolution),channel:1,isReturn:p.return,reservedSeats:os(this.props.roles),showWithDisabilitiesSeats:this.props.roles.find(b=>b==ce.canviewwithdisabilitiesseats.name)!=null,changeDate:!1,locale:this.props.hl,coupon:(u=l==null?void 0:l.couponCode)!==null&&u!==void 0?u:K.getCoupon(),useReservedSeats:!1})]})]})]})]})]})}sendSelectedEvent(a,t){return Ri(this,void 0,void 0,function*(){var s,n,r,o,d,u;const c=Ee.getSolutionId(a),l=yield bi.get(a.departureStopId),m=yield bi.get(a.arrivalStopId),h=this.props.selectedFareCategories,f=Fe.getOccupation(h),p={id:c,departure:(n=l==null?void 0:l.shortDe
18scription)!==null&&n!==void 0?n:"",departureId:(r=l==null?void 0:l.id)!==null&&r!==void 0?r:"",arrival:(o=m==null?void 0:m.shortDescription)!==null&&o!==void 0?o:"",arrivalId:(d=m==null?void 0:m.id)!==null&&d!==void 0?d:"",departureDate:a.trips[0].departureDateTime,arrivalDate:a.trips[a.trips.length-1].arrivalDateTime,connectionsCount:a.trips.length-1,totalPrice:(u=(s=a.priceInfo)===null||s===void 0?void 0:s.totalPrice)!==null&&u!==void 0?u:0,direction:t,adults:f.adults,children:f.children};qe.send(new ad(p))})}sendSearchedSolutionEvent(a){var t,s,n,r,o,d,u,c;const l=Fe.getOccupation(a.selectedFareCategories),m={id:`${a.departure}_${a.arrival}`,departureId:(o=(t=a.departure)===null||t===void 0?void 0:t.id)!==null&&o!==void 0?o:"",departure:(d=(s=a.departure)===null||s===void 0?void 0:s.description)!==null&&d!==void 0?d:"",arrivalId:(u=(n=a.arrival)===null||n===void 0?void 0:n.id)!==null&&u!==void 0?u:"",arrival:(c=(r=a.arrival)===null||r===void 0?void 0:r.description)!==null&&c!==void 0?c:"",departureDate:a.date?k.PlainDateToDate(a.date):void 0,return:a.return,returnDate:a.return&&a.returnDate?k.PlainDateToDate(a.returnDate):void 0,adults:l.adults,children:l.children};qe.send(new Sr(m))}}const on=_(eo(pt(ui(Jo)))(i=>i.getall(),"fareCategories")),pp=()=>{const{dep:i,arr:a}=Se(),t=_e(),{departure:s,arrival:n,departureDate:r,returnDate:o,selectedFareCategories:d}=Ma();return d==null?null:e.jsx(on,{dep:i,arr:a,departure:s,arrival:n,history:t,departureDate:r??k.Today(),returnDate:o,selectedFareCategories:d})},Qn=Object.freeze(Object.defineProperty({__proto__:null,SolutionSelectionInternal:Jo,SolutionSelectionPure:on,default:pp},Symbol.toStringTag,{value:"Module"})),vp=()=>{const i=_e(),{dep:a,arr:t}=Vr("Piombino","Portoferraio");return a==null||t==null?e.jsx(X,{}):e.jsx(on,{history:i,dep:a.description,departure:a,arr:t.description,arrival:t,departureDate:k.Today(),returnDate:k.Today(),selectedFareCategories:[Fe.Default]})};var $=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const he=i=>`/${Ni.getLocale()}/`+Ol(i,"/");class gp{constructor(){this.SubscriptionDetailPath="/subscriptiondetail/:id",this.getSubscriptionDetail=a=>`/subscriptiondetail/${a}`,this.SubscriptionReservation=a=>he(`/subscriptions/${a}`),this.SubscriptionReservationPath="/subscriptions/:id",this.SubscriptionReservationResultPath="/reservationResult/:subscriptionId/:groupId/",this.SubscriptionReservationResultServerPath=a=>`/reservationResult/${a}`,this.SubscriptionReservationResult=(a,t)=>he(`/reservationResult/${a}/${t}`),this.SubscriptionBuyTemplate="/subscriptions/buy/:departure?/:arrival?/",this.SubscriptionBuyPath=(a,t)=>{var s="/subscriptions/buy/";return a&&(s+=`${encodeURIComponent(a)}/`,t&&(s+=`${encodeURIComponent(t)}/`)),he(s)},this.SubscriptionPassengerInsertionPath="/subscriptions/buy/passenger",this.SubscriptionPaymentMethodPath="/subscriptions/buy/payment",this.subscriptionkoTemplate=We.SubscriptionkoTemplate,this.subscriptionkoPath=We.SubscriptionkoPath,this.subscriptionokPath=We.SubscriptionokPath,this.subscriptionOkTemplate=We.SubscriptionOkTemplate,this.SubscriptionsPath="/subscriptions",this.GetMySubscriptionsPage=a=>he(a?`/subscriptions?tab=${a}`:"/subscriptions"),this.MyPersonsPage="/persons",this.PersonsCreate="/persons/create",this.PersonsEditTemplate="/persons/:id",this.PersonsNewChildTemplate="/addChild/:id/:categoryId",this.PersonsEditChildTemplate="/addChild/:id/:categoryId/:childId",this.PersonRenewPageTemplate="/persons/renew/:personId",this.GetPersonCreateUri=a=>he(a&&`${this.PersonsCreate}?category=${a}`||this.PersonsCreate),this.GetPersonEditUri=a=>he(`/persons/${a}`),this.GetPersonNewChildUri=(a,t)=>he(`/addChild/${a}/${t}`),this.GetPersonEditChildUri=(a,t,s)=>he(`/addChild/${a}/${t}/${s}`),this.GetPersonRenewLink=a=>he(`/persons/renew/${a}`),this.MissingAccountInformationPath="/missingAccountInformationPage",this.TravelPlanningTemplate="/plans/:dep/:arr",this.TravelPlanning=(a,t)=>he(`/plans/${a}/${t}`),this.UrbanoLandingTemplate="/u/:zone/:type?/:personCode?",this.TravelSelectionTemplate="/s/:dep?/:depd?/to/:arr?/:retd?",this.TravelSelectionTemplateAr="/s/ar/:dep?/:depd?/to/:arr?/:retd?",this.ByStopTravelSelectionTemplate="/st/:dep?/:arr?",this.SelectSolutionTemplatePath="/from/:dep/:depd/to/:arr/:retd?",this.TicketRegisterOrNotPath="/search/solution/register",this.TicketSeatSelectionPath="/search/solution/seatSelection",this.GetSeatSelectionPath=(a,t)=>he(`${this.TicketSeatSelectionPath}?redirectUrl=${encodeURIComponent(t)}${a?"&isreturn=true":""}`),this.TicketPaymentMethodPath="/search/solution/paymentMethod",this.TicketResultRedirectPath=We.TicketResultRedirectPath,this.TicketResultPath=We.TicketResultPath,this.TicketResultRedirectPathKo=We.TicketResultRedirectPathKo,this.TicketResultPathKo=We.TicketResultPathKo,this.ConfirmPinSisalRedirectPath="/search/solution/pinSisal",this.ConfirmPinSisalPath="/search/solution/pinSisal/:phone/:callingCode/:email",this.ConfirmPinSisalPath2="/search/solution/pinSisal/:phone/:callingCode",this.WalletPath="/wallet",this.WalletDetailPath="/wallet/:id",this.RechargePath="/recharge",this.WalletRechargeOkTemplate="/rechargeok/:id",this.WalletRechargeOk="/rechargeok",this.WalletRechargeKoTemplate="/rechargeko
18/:id",this.WalletRechargeKo="/rechargeko",this.DownloadAppleWalletPass="/passes/apple/downloadPassPage/:ticketid",this.DownloadGoogleWalletPass="/passes/google/downloadPassPage/:ticketid",this.TicketsPathTemplate="/tickets",this.GetMyTicketsPage=a=>he(a?`/tickets?tab=${a}`:"/tickets"),this.GetTicketsPath=a=>he(a?`/tickets?subscriptionId=${a}`:"/tickets"),this.TicketCancelationTemplate="/cancelPreview/:id?",this.GetCancelationPreview=a=>he(`/cancelPreview/${a}`),this.TicketDetailPath="/tickets/:id",this.TicketDetailWithSubscriptionPath="/ticket/:id",this.RequestInvoice="/invoices/requestInvoice/:ticketGroupId",this.ChangeDatePath="/tickets/changeDate/:id",this.AnonymousLinkForm="/groupTickets/:id",this.ChangeDateSeatSelectionPath="/tickets/changeDateSeatSelection/:id",this.ChangeDatePaymentMethodPath="/tickets/changeDatePaymentMethod/:id",this.ChangeDateMultiResultPath="/tickets/changeDateMultiResult/:ids",this.ChangeDateMultiKoPath="/tickets/changeDateMultiKo/:ids",this.ManageLuggagesPath="/tickets/manageLuggages/:id/:luggageId",this.ManageLuggagesOkPath="/tickets/manageLuggagesok/:id",this.ManageLuggagesKoPath="/tickets/manageLuggagesko/:id",this.UserRegisterPath="/register",this.AgenciesListPath="/agencies",this.PayPalButtonsForWebView="/payPalWebView/:clientId/:requestAsJson",this.PayPalButtonsForAdvancedWebView="/payPalAdvancedWebView/:clientId/:advanced/:requestAsJson",this.GetspayForWebView="/gestpayWebView/:requestAsJson",this.GetspayHostedPage="/gestpayHosted/:paymenyId/:paymenyToken/:merchantId/:live",this.StopLiveDepartureStatusTvMonitorRoot="/stoplivestatus/tv",this.StopLiveDepartureStatusTemplateTvMonitor=`${this.StopLiveDepartureStatusTvMonitorRoot}/:stopId`,this.StopLiveDepartureStatusTemplate="/stoplivestatus/:stopId",this.StopLiveArrivalStatusTvMonitorRoot="/stoplivestatus/arrival/tv",this.StopLiveArrivalStatusTemplateTvMonitor=`${this.StopLiveArrivalStatusTvMonitorRoot}/:stopId`,this.StopLiveArrivalStatusTemplate="/stoplivestatus/arrival/:stopId",this.StopLiveStatusTicketTemplate="/stoplivestatus/ticket/:ticketId",this.GetStopLiveStatusTicketPage=a=>this.StopLiveStatusTicketTemplate.replace(":ticketId",a),this.TimeTablePage="/timetables",this.PayByLinkPath=We.PayByLinkPath,this.PayByLinkReservationPath=We.PayByLinkReservationPath,this.PayByLinkSubscriptionsPath=We.PayByLinkSubscriptionPath,this.PayByLinkResultRedirectPath=We.TicketPayByLinkResultRedirectPath,this.PayByLinkResultPath=We.TicketPayByLinkResultPath,this.RefundByLinkTemplate="/refundByLink/:id",this.GetRefundByLinkUrl=a=>he(`/refundByLink/${a}`),this.RentalRequest="/rentalRequest",this.RentalRequestSent="/rentalRequestSent",this.PayToBePayedTemplate="/payToBePayed/:groupId",this.GetPayToBePayedUrl=a=>he(this.PayToBePayedTemplate.replace(":groupId",a))}SubscriptionOk(a,t){return he(`/subscriptionok/${a}`+(t?`/${t}`:""))}UrbanoLanding(a,t,s){let n=`/u/${a}`;return t&&(n+=`/${encodeURIComponent(t)}`,s&&(n+=`/${s}`)),he(n)}TravelSelection(a,t,s,n,r){if(!a&&!t&&!s&&!n&&!r)return he("/");let o="/s";return a&&(o+="/ar"),t&&(o+="/"+t),s&&(o+="/"+k.compactDateString(s)),o+="/to",n&&(o+="/"+n),r&&(o+="/"+k.compactDateString(r)),he(o)}ByStopTravelSelection(a,t){let s="/st";return a&&(s+="/"+a),t&&(s+="/"+t),he(s)}SelectSolutionPath(a,t,s,n){return he(`/from/${a}/${t?k.compactDateString(t):"today"}/to/${s||""}/${n?k.compactDateString(n):""}`)}GetAnonymousLinkForm(a){return he("/groupTickets/"+a)}GetTicketDetail(a){return he("/tickets/"+a)}GetChangeDate(a){return he("/tickets/changeDate/"+a)}GetManageLuggages(a,t){return he("/tickets/manageluggages/"+a+"/"+t)}GetManageLuggagesOk(a){return he("/tickets/manageluggagesok/"+a)}GetManageLuggagesKo(a){return he("/tickets/manageluggagesko/"+a)}GetChangeDateSeatSelection(a){return he("/tickets/changeDateSeatSelection/"+a)}GetChangeDatePaymentMethod(a){return he("/tickets/changeDatePaymentMethod/"+a.join(","))}GetChangeDateResult(a){let t=`/tickets/changeDateMultiResult/${a.join(",")}`;return he(t)}GetChangeDateKo(a){return he("/tickets/changeDateMultiKo/"+a.join(","))}GetChangeDateMultiKo(a){return he("/tickets/changeDateMultiKo/"+a.join(","))}}var D=new gp;const wt=(i,a)=>{const t=a;return()=>$(void 0,void 0,void 0,function*(){return{Component:s=>e.jsx(fp,{title:i,children:e.jsx(t,Object.assign({},s))})}})},fp=_(i=>{const{formatMessage:a}=i.i18n.get(Ft),t=typeof i.title=="string"?i.title:a(i.title);return e.jsx(re,{title:t,children:i.children})}),xp=()=>[{path:"/",element:dt.environmentName=="blunavy"?e.jsx(vp,{}):e.jsx(ta,{})},{path:D.TravelSelectionTemplateAr,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:i=>e.jsx(ta,Object.assign({},i,{ar:!0}))}})},{path:D.TravelSelectionTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:i=>e.jsx(ta,Object.assign({},i,{ar:!0}))}})},{path:D.SelectSolutionTemplatePath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Qn),void 0)).default}})},{path:Na,element:e.jsx(Bd,{registerUrl:fn,showHeader:!1})},{path:D.MissingAccountInformationPath,lazy:wt(i=>i.CompleteRegistration,ic)},{path:$d+"/:userid",lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>import("../OKWQlYh6.js").then(i=>i.bp),__vite__mapDeps([0,1,2,3,4,5,6,7]))).default}})},{path:fn,lazy:wt(i=>i.SignUp,ac)},{path:Wd,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:Ud}})},{path:Vd,lazy:wt(i=>i.ConfirmPhoneNumberButton,sc)},{path:Gd,lazy:wt("Reset Password",nc)},{path:qd,lazy:wt(i=>i.ChangePassword,rc)},{path:Hd,lazy:wt(i=>i.ChangePassword,oc)},{path:Kd,lazy:wt(i=>i.ChangePhone,lc)},{path:Qd,lazy:wt(i=>i.ChangeEmailLink,dc)},{path:Jd,lazy:wt(i=>i.ChangeEmailLink,cc)},{path:Yd,lazy:wt(i=>i.DeleteUser,uc)},{path:Zd+"/:userId?/:operatorId?",lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>import("../OKWQlYh6.js").then(i=>i.bt),__vite__mapDeps([0,1,2,3,4,5,6,7]))).default}})},{path:Xd,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>import("../OKWQlYh6.js").then(i=>i.br),__vite__mapDeps([0,1,2,3,4,5,6,7]))).default}})},{path:ec,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>import("../OKWQlYh6.js").then(i=>i.bs),__vite__mapDeps([0,1,2,3,4,5,6,7]))).default}})},{path:Or,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:Uh}})},{path:D.ByStopTravelSelectionTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Bp),void 0)).default}})},{path:D.TravelSelectionTemplateAr,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:i=>e.jsx(ta,Object.assign({},i,{ar:!0}))}})},{path:D.SelectSolutionTemplatePath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Qn),void 0)).default}})},{path:D.UrbanoLandingTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Up),void 0)).default}})},{path:D.TicketsPathTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Dh),void 0)).default}})},{path:D.TicketCancelationTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Qp),void 0)).default}})},{path:D.TicketDetailPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Zn),void 0)).default}})},{path:D.TicketDetailWithSubscriptionPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Zn),void 0)).default}})},{path:D.ManageLuggagesPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>fv),void 0)).default}})},{path:D.ManageLuggagesOkPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>bv),void 0)).default}})},{path:D.ManageLuggagesKoPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>jv),void 0)).default}})},{path:D.ChangeDatePath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Cv),void 0)).default}})},{path:D.ChangeDatePaymentMethodPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Av),void 0)).default}})},{path:D.ChangeDateMultiKoPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>er),void 0)).default}})},{path:D.ChangeDateMultiResultPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Ev),void 0)).default}})},{path:D.ChangeDateMultiKoPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>er),void 0)).default}})},{path:D.SubscriptionBuyTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Uv),void 0)).default}})},{path:D.subscriptionOkTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Xv),void 0)).default}})},{path:D.subscriptionkoTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Qv),void 0)).default}})},{path:D.SubscriptionsPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>sg),void 0)).default}})},{path:D.MyPersonsPage,lazy:()=>$(void 0,void 0,void 0,function*(){const{MyPersonsPage:i}=yield q(()=>Promise.resolve().then(()=>lg),void 0);return{Component:i}})},{path:D.PersonsCreate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>ug),void 0)).default}})},{path:D.PersonsEditTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Sg),void 0)).default}})},{path:D.PersonsNewChildTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>nr),void 0)).default}})},{path:D.PersonsEditChildTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>nr),void 0)).default}})},{path:D.PersonRenewPageTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Tg),void 0)).default}})},{path:D.SubscriptionDetailPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Og),void 0)).default}})},{path:D.SubscriptionReservationPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Hg),void 0)).default}})},{path:D.SubscriptionReservationResultPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Jg),void 0)).default}})},{path:D.TicketRegisterOrNotPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>sf),void 0)).default}})},{path:D.TicketPaymentMethodPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>ff),void 0)).default}})},{path:D.TicketSeatSelectionPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Cf),void 0)).default}})},{path:D.TicketResultPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Df),void 0)).default}})},{path:D.TicketResultPathKo,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>_f),void 0)).default}})},{path:D.DownloadAppleWalletPass,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Rf),void 0)).default}})},{path:D.DownloadGoogleWalletPass,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>zf),void 0)).default}})},{path:D.RequestInvoice,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Ff),void 0)).default}})},{path:D.WalletPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Gn),void 0)).default}})},{path:D.WalletDetailPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Gn),void 0)).default}})},{path:D.RechargePath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Wf),void 0)).default}})},{path:D.WalletRechargeOkTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){const{RechargeOkBooking:i}=yield q(()=>Promise.resolve().then(()=>mr),void 0);return{Component:i}})},{path:D.WalletRechargeKoTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){const{RechargeKoBooking:i}=yield q(()=>Promise.resolve().then(()=>mr),void 0);return{Component:i}})},{path:D.TravelPlanningTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Hf),void 0)).default}})},{path:D.AgenciesListPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Jf),void 0)).default}})},{path:"/deleteaccount",lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:tc}})},{path:D.StopLiveDepartureStatusTemplateTvMonitor,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>ex),void 0)).default}})},{path:D.StopLiveDepartureStatusTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>nv),void 0)).default}})},{path:D.StopLiveArrivalStatusTemplateTvMonitor,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>ox),void 0)).default}})},{path:D.StopLiveArrivalStatusTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>hx),void 0)).default}})},{path:D.StopLiveStatusTicketTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>gx),void 0)).default}})},{path:D.PayPalButtonsForWebView,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>xx),void 0)).default}})},{path:D.PayPalButtonsForAdvancedWebView,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>yx),void 0)).default}})},{path:D.TimeTablePage,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Sx),void 0)).default}})},{path:D.GetspayForWebView,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>wx),void 0)).default}})},{path:D.GetspayHostedPage,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Dx),void 0)).default}})},{path:D.PayByLinkReservationPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Rx),void 0)).default}})},{path:D.PayByLinkSubscriptionsPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Ox),void 0)).default}})},{path:D.PayByLinkPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Bx),void 0)).default}})},{path:D.PayByLinkResultPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>Ux),void 0)).default}})},{path:D.PayByLinkResultPath,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>import("../OKWQlYh6.js").then(i=>i.bq),__vite__mapDeps([0,1,2,3,4,5,6,7]))).default}})},{path:D.RentalRequest,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>tb),void 0)).default}})},{path:D.AnonymousLinkForm,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>rb),void 0)).default}})},{path:D.PayToBePayedTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>db),void 0)).default}})},{path:D.RentalRequestSent,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>mb),void 0)).default}})},{path:D.Refund
18ByLinkTemplate,lazy:()=>$(void 0,void 0,void 0,function*(){return{Component:(yield q(()=>Promise.resolve().then(()=>yb),void 0)).default}})}];var bp=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const yp=i=>{var a,t,s,n,r,o;const[d,u]=P.useState(!1),c=P.useRef(null),l=()=>bp(void 0,void 0,void 0,function*(){yield Su.logOff(),window.location.replace(te.live&&te.homepage?te.homepage:"/")});P.useEffect(()=>{const g=v=>{c.current&&!c.current.contains(v.target)&&u(!1)};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[]);const m=()=>{u(!d)},{formatMessage:h}=i.i18n.get(Ft),f=()=>{u(!1)};let p;return i.user==null?p=e.jsx(ke,{className:"btn btn-primary-light btn-account fw-bolder text-medium "+i.customClassName||"",to:Ir(window.location.href),style:(s=i.customStyles)!==null&&s!==void 0?s:{backgroundColor:"#fff"},children:e.jsxs("span",{children:[e.jsx("i",{className:"fas fa-user me-2"}),h(g=>g.SignIn)]})}):p=e.jsxs("div",{className:"dropdown dropdown-user nav-item position-relative",ref:c,children:[e.jsxs("button",{type:"button",className:`btn btn-primary-light btn-account dropdown-toggle fw-bolder text-medium ${d?"show":""} ${i.customClassName||""}`,onClick:m,"aria-expanded":d,style:(n=i.customStyles)!==null&&n!==void 0?n:{backgroundColor:"#fff"},children:[e.jsx("i",{className:"fas fa-user me-2"}),(o=(r=(a=i.user)===null||a===void 0?void 0:a.name)!==null&&r!==void 0?r:(t=i.user)===null||t===void 0?void 0:t.surname)!==null&&o!==void 0?o:"Il mio account"]}),e.jsxs("div",{className:`dropdown-menu dropdown-menu-end ${d?"show":""} animate__animated animate__slideInDown animate__faster`,style:Object.assign({right:0,left:"auto"},i.customStyles),children:[e.jsx("li",{children:e.jsx(ke,{to:Or,className:"dropdown-item",onClick:f,children:e.jsx("span",{className:"align-middle",children:h(g=>g.AccountPage)})})}),e.jsx("li",{children:e.jsx(ke,{to:i.myTicketsUrl,className:"dropdown-item",onClick:f,children:e.jsx("span",{className:"align-middle",children:h(g=>g.MieiBiglietti)})})}),e.jsx(ze,{role:ce.canusewallet,children:e.jsx("li",{children:e.jsx(ke,{to:i.walletUrl,className:"dropdown-item",onClick:f,children:e.jsx("span",{className:"align-middle",children:h(g=>g.Borsellino)})})})}),e.jsx(ze,{role:Xi.persons.read,children:e.jsx("li",{children:e.jsx(ke,{to:i.myPersonsUrl,className:"dropdown-item",onClick:f,children:e.jsx("span",{className:"align-middle",children:h(g=>g.MyPersons)})})})}),i.subscriptionEnabled&&e.jsx("li",{children:e.jsx(ke,{to:i.mySubscriptionsUrl,className:"dropdown-item",onClick:f,children:e.jsx("span",{className:"align-middle",children:h(g=>g.MieiAbbonamenti)})})}),e.jsx("li",{children:e.jsx("hr",{className:"dropdown-divider"})}),e.jsx("li",{children:e.jsx("button",{type:"button",className:"dropdown-item text-danger",onClick:()=>{l(),f()},children:e.jsxs("span",{className:"align-middle",children:[e.jsx("i",{className:"fa-solid fa-right-from-bracket me-2","aria-hidden":"true"})," ",h(g=>g.Logout)]})})})]})]}),e.jsx("div",{className:"p-0 h-100",style:{minWidth:80},children:e.jsx("div",{children:p})})},jp=_(ci(yp)),gt=_(i=>e.jsx(e.Fragment,{children:e.jsx(Sp,Object.assign({},i))})),Sp=_(i=>{var a,t,s,n,r,o,d,u,c,l,m,h,f,p,g,v,x,S,y,b,j,I,N,w,T,C,A,H,z,R,M,F,L;const{i18n:U}=i,{formatMessage:Y}=U.get(Ft),{formatMessage:W}=U.get(Xe),[E,Z]=P.useState(null),[de,ue]=P.useState(!1);return P.useEffect(()=>{const O=se=>{E&&!se.target.closest(".dropdown")&&Z(null)};return document.addEventListener("click",O),()=>{document.removeEventListener("click",O)}},[E]),e.jsx("nav",{className:`navbar navbar-expand-xl ${!((t=(a=i.customGraphics)===null||a===void 0?void 0:a.navbar)===null||t===void 0)&&t.style?"":"bg-primary"} p-0 border-bottom border-primary`,style:Object.assign({},(n=(s=i.customGraphics)===null||s===void 0?void 0:s.navbar)===null||n===void 0?void 0:n.style),children:e.jsxs("div",{className:"container px-0",children:[e.jsx("a",{href:te.homepage,className:"navbar-brand h-100 py-2 d-flex justify-content-start align-items-center",children:e.jsx("img",{className:"img-fluid",src:"/images/header-logo.svg",alt:te.environmentReadableName,style:{height:"3rem",maxWidth:"70vw"}})}),e.jsx("button",{className:"navbar-toggler",type:"button",onClick:()=>ue(!de),"aria-controls":"navbarNav","aria-expanded":de,"aria-label":"Toggle navigation",children:e.jsx("i",{className:`fa-solid fa-bars ${(F=(o=(r=i.customGraphics)===null||r===void 0?void 0:r.navbar)===null||o===void 0?void 0:o.hamburgerClassName)!==null&&F!==void 0?F:"text-white"}`})}),e.jsx("div",{className:`collapse navbar-collapse ${de?"show":""}`,id:"navbarNav",children:e.jsxs("ul",{className:"navbar-nav d-flex justify-content-end align-items-xl-center w-100 mb-0 me-0 pt-xl-1 p-2",children:[e.jsx("li",{className:"nav-item",children:e.jsx(ze,{role:ce.cansendrentalrequestfrombookingname,children:e.jsx(ke,{style:Object.assign({}
18,(c=(u=(d=i.customGraphics)===null||d===void 0?void 0:d.navbar)===null||u===void 0?void 0:u.links)===null||c===void 0?void 0:c.style),className:`dropdown-item ${(h=(m=(l=i.customGraphics)===null||l===void 0?void 0:l.navbar)===null||m===void 0?void 0:m.links)===null||h===void 0?void 0:h.className}`,to:D.RentalRequest,children:Y(O=>O.RentalRequest)})})}),e.jsx("li",{children:i.companyData!=null&&e.jsxs("div",{style:{color:"black",textAlign:"center"},children:[i.companyData.companyName,e.jsx("br",{}),"P.Iva ",i.companyData.vatNumber]})}),te.environmentName!=null&&((f=i.headerLinks)===null||f===void 0?void 0:f.map((O,se)=>{var ae,be,pe,oe,le,me,vt,Ae,nt,G,ve,ge;if(O.sublinks!=null){const ee=`dsknav_head_dnd_${se}`;return e.jsxs("li",{className:`nav-item dropdown ${E===ee?"show":""}`,children:[e.jsx("a",{className:`nav-link dropdown-toggle ${E===ee?"show":""} ${(pe=(be=(ae=i.customGraphics)===null||ae===void 0?void 0:ae.navbar)===null||be===void 0?void 0:be.links)===null||pe===void 0?void 0:pe.className}`,href:"#",id:`navbarDropdown${se}`,style:Object.assign({},(me=(le=(oe=i.customGraphics)===null||oe===void 0?void 0:oe.navbar)===null||le===void 0?void 0:le.links)===null||me===void 0?void 0:me.style),role:"button",onClick:$e=>{$e.preventDefault(),Z(E===ee?null:ee)},"aria-expanded":E===ee,children:O.description}),e.jsx("ul",{className:`dropdown-menu dropdown-menu-end ${E===ee?"show":""}`,"aria-labelledby":`navbarDropdown${se}`,children:O.sublinks.map($e=>e.jsx("li",{children:e.jsx("a",{className:"dropdown-item",href:$e.link,children:$e.description})},$e.link))})]},ee)}return e.jsx("li",{className:"nav-item",children:e.jsx("a",{className:`nav-link ${(nt=(Ae=(vt=i.customGraphics)===null||vt===void 0?void 0:vt.navbar)===null||Ae===void 0?void 0:Ae.links)===null||nt===void 0?void 0:nt.className}`,href:O.link,style:Object.assign({},(ge=(ve=(G=i.customGraphics)===null||G===void 0?void 0:G.navbar)===null||ve===void 0?void 0:ve.links)===null||ge===void 0?void 0:ge.style),children:O.description})},O.description+se)})),e.jsx(ze,{role:ce.canissuecitysubscriptions,children:e.jsxs("li",{className:`nav-item dropdown ${E==="subscriptions"?"show":""} ${(v=(g=(p=i.customGraphics)===null||p===void 0?void 0:p.navbar)===null||g===void 0?void 0:g.links)===null||v===void 0?void 0:v.className}`,children:[e.jsx("a",{className:`nav-link dropdown-toggle ${E==="subscriptions"?"show":""} ${(y=(S=(x=i.customGraphics)===null||x===void 0?void 0:x.navbar)===null||S===void 0?void 0:S.links)===null||y===void 0?void 0:y.className}`,href:"#",id:"subscriptionsDropdown",role:"button",style:Object.assign({},(I=(j=(b=i.customGraphics)===null||b===void 0?void 0:b.navbar)===null||j===void 0?void 0:j.links)===null||I===void 0?void 0:I.style),onClick:O=>{O.preventDefault(),Z(E==="subscriptions"?null:"subscriptions")},"aria-expanded":E==="subscriptions",children:W(O=>O.Abbonamenti)}),e.jsxs("ul",{className:`dropdown-menu dropdown-menu-end ${E==="subscriptions"?"show":""}`,"aria-labelledby":"subscriptionsDropdown",children:[e.jsx("li",{children:e.jsx(ke,{className:"dropdown-item",to:D.SubscriptionBuyPath(),children:W(O=>O.NuovoAbbonamento)})}),e.jsx("li",{children:e.jsx(ke,{className:"dropdown-item",to:D.SubscriptionsPath,children:Y(O=>O.MieiAbbonamenti)})})]})]})}),(N=i.additionalLinks)===null||N===void 0?void 0:N.map(O=>{var se,ae,be,pe,oe,le;return e.jsx("li",{children:e.jsxs("a",{className:`nav-link ${(be=(ae=(se=i.customGraphics)===null||se===void 0?void 0:se.navbar)===null||ae===void 0?void 0:ae.links)===null||be===void 0?void 0:be.className} ${O.additionalClassNames}`,style:Object.assign({},(le=(oe=(pe=i.customGraphics)===null||pe===void 0?void 0:pe.navbar)===null||oe===void 0?void 0:oe.links)===null||le===void 0?void 0:le.style),href:O.link,children:[O.icon," ",O.description]})})}),e.jsx("li",{className:"nav-item",children:(L=(w=i.customComponent)===null||w===void 0?void 0:w.langComponent)!==null&&L!==void 0?L:e.jsx(sd,{additionalClassName:(A=(C=(T=i.customGraphics)===null||T===void 0?void 0:T.navbar)===null||C===void 0?void 0:C.links)===null||A===void 0?void 0:A.className})}),e.jsx("li",{className:"nav-item",children:e.jsx(jp,{walletUrl:D.WalletPath,myTicketsUrl:D.GetTicketsPath(),mySubscriptionsUrl:D.SubscriptionsPath,myPersonsUrl:D.MyPersonsPage,subscriptionEnabled:te.subscriptionEnabled,customStyles:(z=(H=i.customGraphics)===null||H===void 0?void 0:H.loginButtonCustom)===null||z===void 0?void 0:z.style,customClassName:(M=(R=i.customGraphics)===null||R===void 0?void 0:R.loginButtonCustom)===null||M===void 0?void 0:M.classname})})]})})]})})}),Np=(i,a)=>{switch(i){case"marinobus":return[{description:a(t=>t.ScopriMarinobus),sublinks:[{link:"https://www.marinobus.it/chi-siamo/",description:a(t=>t.ChiSiamo)},{link:"https://www.marinobus.it/flotta/",description:a(t=>t.GliAutobusMarinobus)},{link:"https://www.marinobus.it/noleggia-un-autobus/",description:a(t=>t.NoleggiaAutobus)},{link:"https://www.marinobus.it/lavora-con-noi/",description:a(t=>t.LavoraConNoi)},{link:"https://www.marinobus.it/area-stampa/",description:a(t=>t.AreaStampa)}]},{description:a(t=>t.IlTuoProssimoViaggio),sublinks:[{link:"https://www.marinobus.it/destinazioni-e-fermate/",description:a(t=>t.DestinazioneFermate)},{link:"https://www.marinobus.it/protocollo-di-sicurezza-covid-19/",de
18scription:a(t=>t.ProtocolloCovid)},{link:"https://www.marinobus.it/cerca-agenzie/",description:a(t=>t.CercaAgenzie)}]},{description:"Blog MarinoBus",link:"https://www.marinobus.it/blog-marinobus/"},{description:a(t=>t.Assistenza),sublinks:[{link:"https://www.marinobus.it/modulistica/",description:a(t=>t.Modulistica)},{link:"https://www.marinobus.it/certificazioni/",description:a(t=>t.Certificazioni)},{link:"https://www.marinobus.it/condizioni-di-servizio/",description:a(t=>t.CondizioniServizio)},{link:"https://marinobus.it/privacy-policy/",description:"Privacy policy"},{link:"https://www.marinobus.it/domande-frequenti/",description:a(t=>t.Faq)},{link:"https://www.marinobus.it/carta-dei-servizi/",description:a(t=>t.CartaDeiServizi)},{link:"https://www.marinobus.it/metodi-di-pagamento/",description:a(t=>t.MetodiPagamento)},{link:"https://www.marinobus.it/segnalazione-reclamo/",description:a(t=>t.ReclamiSegnalazioni)}]}];case"libertylines":return[{description:a(t=>t.Destinazioni),link:"https://www.libertylines.it/destinazioni/"},{description:a(t=>t.AgevolazioniTariffe),link:"https://www.libertylines.it/offerte/"},{description:a(t=>t.Orari),link:"https://www.libertylines.it/orari-tariffe/"},{description:a(t=>t.Contatti),link:"https://www.libertylines.it/contatti/"}];case"liscio":return[{description:a(t=>t.Azienda),sublinks:[{description:a(t=>t.LaNostraStoria),link:"https://www.autolineeliscio.it/azienda/storia"},{description:a(t=>t.ChiSiamo),link:"https://www.autolineeliscio.it/azienda/chi_siamo"},{description:a(t=>t.Qualita),link:"https://www.autolineeliscio.it/azienda/qualit%c3%a0"},{description:a(t=>t.PoliticaSgi),link:"http://autolineeliscio.it/azienda/politicaSGI"},{description:"Privacy",link:"https://www.autolineeliscio.it/azienda/privacy"}]},{description:"News",link:"https://www.autolineeliscio.it/news"},{description:a(t=>t.Avvisi),link:"https://www.autolineeliscio.it/avvisi"},{description:a(t=>t.Servizi),sublinks:[{description:a(t=>t.Promozioni),link:"https://www.autolineeliscio.it/servizi/promozioni"},{description:a(t=>t.Noleggio),link:"https://www.autolineeliscio.it/servizi/noleggio"}]},{description:a(t=>t.LineeIntercity),sublinks:[{description:"Matera-Potenza-Roma",link:"https://www.autolineeliscio.it/linee/1"},{description:"Potenza-Roma-Perugia",link:"https://autolineeliscio.it/linee/2"},{description:a(t=>t.TerminiCondizioni),link:"https://autolineeliscio.it/termini_e_condizioni"}]},{description:a(t=>t.LineeTpl),sublinks:[{description:"Potenza-Salerno-Fisciano-Napoli",link:"https://www.autolineeliscio.it/tpl/3"},{description:"Potenza-Policoro",link:"https://www.autolineeliscio.it/tpl/4"},{description:a(t=>t.BiglietterieTpl),link:"https://www.cotrab.it/biglietterie-cotrab/"}]},{description:a(t=>t.Assistenza),sublinks:[{description:"Customer care",link:"https://www.autolineeliscio.it/assistenza/customer_care"},{description:a(t=>t.OggettiSmarriti),link:"https://www.autolineeliscio.it/assistenza/oggetti_smarriti"},{description:a(t=>t.Modulistica),link:"https://www.autolineeliscio.it/assistenza/modulistica"},{description:a(t=>t.Reclami),link:"https://www.autolineeliscio.it/assistenza/reclami"},{description:"FAQ",link:"https://www.autolineeliscio.it/assistenza/faq"},{description:a(t=>t.Contatti),link:"https://www.autolineeliscio.it/assistenza/contatti"}]}];case"sais":return[{description:a(t=>t.TerminiCondizioni),sublinks:[{description:"Privacy policy",link:"https://www.saisautolinee.it/privacy-policy"},{description:"Cookie policy",link:"https://www.saisautolinee.it/cookie-policy"}]}];case"gaspari":return[{description:"Customer Satisfaction",sublinks:[{description:"Schema indagine soddisfazione clienti",link:"https://gasparionline.it/pdf/gasparilines/Scheda-indagine-soddisfazione-clienti.pdf"}]},{description:a(t=>t.Allegati),sublinks:[{description:"Carta dei Servizi",link:"https://www.gasparionline.it/carta-servizi-locali/"},{description:"Carta della mobilità ",link:"https://www.gasparionline.it/pdf/gasparilines/Carta-della-Mobilita-Gaspari-Lines.pdf"},{description:"Gaspari Lines - ISO 1400",link:"https://www.gasparionline.it/pdf/gasparilines/Certificazione-ISO-140012015.pdf"},{description:"Gaspari Lines - ISO 4500",link:"https://www.gasparionline.it/pdf/gasparilines/Certificazione-ISO-450012018.pdf"},{description:"Gaspari Lines - ISO 9001",link:"https://www.gasparionline.it/pdf/gasparilines/certificazione-ISO-90012015.pdf"},{description:"Gaspari Sergio - ISO 1400",link:"https://www.gasparionline.it/pdf/gasparilines/Certificazione-ISO-140012015-Gaspari-Sergio.pdf"},{description:"Gaspari Sergio - ISO 4500",link:"https://www.gasparionline.it/pdf/gasparilines/Certificazione-ISO-450012018-Gaspari-Sergio.pdf"},{description:"Gaspari Sergio - ISO 9001",link:"https://www.gasparionline.it/pdf/gasparilines/certificazione-ISO-90012015-Gaspari-Sergio.pdf"},{description:"Schema di Sintesi - Gaspari Lines",link:"https://www.gasparionline.it/pdf/gasparilines/Gaspari-Line
18s-Controllo-diffuso-schema-di-sintesi.pdf"},{description:"Contratto di Servizio - Gaspari Lines",link:"https://www.gasparionline.it/pdf/gasparilines/Gaspari-Lines-contratto-di-servizio.pdf"},{description:"Schema di Sintesi - Gaspari Sergio",link:"https://www.gasparionline.it/pdf/gasparilines/Gaspari-Sergio-controllo-diffuso-schemadi-sintesi.pdf"},{description:"Contratto di Servizio - Gaspari Sergio",link:"https://www.gasparionline.it/pdf/gasparilines/Contratto-di-servizio-Gaspari-Sergio.pdf"}]},{description:"Reclami",sublinks:[{description:"Gaspari Sergio",link:"https://www.gasparionline.it/pdf/gasparilines/Scheda-Reclamo-Gaspari-Sergio.pdf"},{description:"Gaspari Lines",link:"https://www.gasparionline.it/pdf/gasparilines/Scheda-reclamo-Gaspari-Lines.pdf"}]},{description:a(t=>t.Orari),sublinks:[{description:"Linee Cittadine",link:"https://www.gasparionline.it/linee-cittadine/"},{description:"Linea Interurbana",link:"https://www.gasparionline.it/orari-servizio-trasporto-locale/"}]},{description:"Grafico della rete",sublinks:[{description:"TPL Estivo",link:"https://www.google.com/maps/d/edit?mid=1swLOwJ_pPrFmcUp5f8lwpZTyzjMvcbs&usp=sharing"},{description:"TPL Invernale",link:"https://www.google.com/maps/d/edit?mid=1i-WGVeMa9NY-v4MD1ytpKSdIwZ64w4k&usp=sharing"}]},{description:a(t=>t.Contatti),sublinks:[{description:"Assistenza e Contatti",link:"https://www.gasparionline.it/assistenza-contatti/"}]}];case"blunavy":return[{description:a(t=>t.Offerte),link:a(t=>t.BNLinkOfferte)},{description:a(t=>t.Orari),sublinks:[{description:a(t=>t.BNOrariTraghettiElba),link:a(t=>t.BNLinkOrari)},{description:a(t=>t.BNPartiPrima),link:a(t=>t.BNLinkPartiPrima)}]},{description:a(t=>t.BNNaviTempoReale),link:a(t=>t.BNLinkTempoReale)},{description:a(t=>t.Assistenza),sublinks:[{description:a(t=>t.Contatti),link:a(t=>t.BNLinkContatti)},{description:a(t=>t.BNWhatsapp),link:" https://wa.me/390565269710"}]},{description:a(t=>t.Faq),link:a(t=>t.BNLinKFaq)}];case"ichnusa":return[{description:a(t=>t.ICHTratteOrari),sublinks:[{description:a(t=>t.ICHBon),link:"https://ichnusalines.com/tratte-e-orari/porto-di-bonifacio/"},{description:a(t=>t.ICHStg),link:"https://ichnusalines.com/tratte-e-orari/porto-di-santa-teresa-di-gallura/"},{description:a(t=>t.ICHVedi),link:"https://ichnusalines.com/tratte-e-orari/"}]},{description:a(t=>t.ICHConvenzioni),link:"https://ichnusalines.com/convenzioni/"},{description:a(t=>t.ICHChiSiamo),link:"https://ichnusalines.com/chi-siamo/"},{description:a(t=>t.ICHAssistenza),sublinks:[{description:a(t=>t.ICHDomFreq),link:"https://ichnusalines.com/assistenza/domande-frequenti/"},{description:a(t=>t.ICHRimborsi),link:"https://ichnusalines.com/assistenza/rimborsi/"},{description:a(t=>t.ICHReclami),link:"https://ichnusalines.com/assistenza/reclami/"},{description:a(t=>t.ICHFattura),link:"https://ichnusalines.com/assistenza/fattura/"}]},{description:a(t=>t.ICHBlog),link:"https://ichnusalines.com/blog/"},{description:a(t=>t.ICHContatti),link:"https://ichnusalines.com/contatti/"}];default:return}},wp=_(i=>{const{formatMessage:a}=i.i18n.get(Qs),t=Np(te.environmentName,a);switch(te.environmentName){case"liscio":return e.jsx(gt,{headerLinks:t,customGraphics:{navbar:{style:{backgroundColor:"#ffff"},hamburgerClassName:"text-primary",links:{className:"text-dark"}},loginButtonCustom:{classname:"bg-primary-light"}}});case"marinobus":return e.jsx(gt,{headerLinks:t,customGraphics:{navbar:{style:{backgroundColor:"#d10118"},links:{className:"text-white"}},loginButtonCustom:{style:{backgroundColor:"#ffffff"}}}});case"sais":return e.jsx(gt,{headerLinks:t,additionalLinks:[{description:a(s=>s.SAISInfoPrenotazioni),link:"tel:+390912776999",icon:e.jsx("i",{className:"text-light fa-solid fa-phone"})},{description:a(s=>s.SAISAiuto),link:"https://www.saisautolinee.it/aiuto-e-domande-frequenti",icon:e.jsx("i",{className:"text-light fa-regular fa-circle-question"}),additionalClassNames:"mx-2"},{description:a(s=>s.Contatti),link:"https://www.saisautolinee.it/contattaci",additionalClassNames:"border border-white px-2"}],customGraphics:{navbar:{links:{className:"fw-bold",style:{fontSize:"11.5px"}}}}});case"tiemme":return e.jsx(gt,{customGraphics:{navbar:{style:{backgroundColor:"#fff"},hamburgerClassName:"text-primary",links:{className:"text-dark"}},loginButtonCustom:{classname:"bg-primary-light"}},companyData:{companyName:"Tiemme Spa",vatNumber:"02046440513"}});case"gaspari":return e.jsx(gt,{headerLinks:t});case"bus4fly":return e.jsx(gt,{customGraphics:{navbar:{style:{background:"linear-gradient(140deg, #FFFF 38%, #BCCBD2 38%, #BCCBD2 43%, #FFFF 43%, #FFFF 45%, #FE0000 45%)"},hamburgerClassName:"text-white",links:{className:"text-dark"}},loginButtonCustom:{classname:"rounded-pill px-5"}},customComponent:{langComponent:e.jsx(nd,{})}});case"giunta2":return e.jsx(gt,{customGraphics:{navbar:{style:{backgroundColor:"#EC008F"},links:{className:"text-light"}},loginButtonCustom:{style:{backgroundColor:"#ffffff"}}}});case"cmtravel":return e.jsx(gt,{customGraphics:{navbar:{style:{backgroundColor:"#ffff"},hamburgerClassName:"text-primary",links:{className:"text-dark"}}}});case"dipaola":return e.jsx(gt,{customGraphics:{navbar:{style:{backgroundColor:"#ffffff"},hamburgerClassName:"text-dark"},loginButtonCustom:{classname:"bg-primary-light"}}});case"fiumex":return e.jsx(gt,{customGraphics:{navbar:{style:{backgroundColor:"#FFFE0D"},hamburgerClassName:"text-dark"},loginButtonCustom:{classname:"bg-primary-light"}}});default:return e.jsx(gt,{headerLinks:t})}}),Yo="agencyAreaChoice",Cp=()=>{try{return sessionStorage.getItem(Yo)}catch{return null}},Jn=i=>{try{sessionStorage.setItem(Yo,i)}catch{}},Pp=_(i=>{const{formatMessage:a}=i.i18n.get(Ra),[t,s]=P.useState(()=>Cp());if(t!=null)return null;const n=()=>{Jn("agency"),s("agency"),window.location.href=js()},r=()=>{Jn("booking"),s("booking")},o=[{icon:"fa-ticket",label:d=>d.ModalAdvIssue},{icon:"fa-magnifying-glass",label:d=>d.ModalAdvSearch},{icon:"fa-users",label:d=>d.ModalAdvNetwork},{icon:"fa-chart-bar",label:d=>d.ModalAdvReports},{icon:"fa-file-invoice",label:d=>d.ModalAdvInvoicing}];return e.jsx("div",{className:"modal d-block",style:{backgroundColor:"rgba(0,0,0,0.5)"},role:"dialog","aria-modal":"true","aria-labelledby":"agency-area-modal-title",children:e.jsx("div",{className:"modal-dialog modal-dialog-centered modal
18-lg",children:e.jsxs("div",{className:"modal-content border-0 shadow-lg overflow-hidden animate__animated animate__fadeInUp animate__faster",children:[e.jsx("div",{className:"modal-header text-bg-primary border-0 py-4 px-4",children:e.jsxs("div",{className:"d-flex align-items-center gap-3",children:[e.jsx("span",{className:"d-inline-flex align-items-center justify-content-center bg-black bg-opacity-10 rounded-3 flex-shrink-0",style:{width:48,height:48},children:e.jsx("i",{className:"fa-solid fa-briefcase fs-4","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fw-semibold opacity-75 lh-1 mb-2",style:{fontSize:".72rem",letterSpacing:".12em"},children:a(d=>d.ModalEyebrow)}),e.jsx("h1",{className:"modal-title fs-4 fw-bold lh-1 mb-0",id:"agency-area-modal-title",children:a(d=>d.ModalTitle)})]})]})}),e.jsxs("div",{className:"modal-body p-4",style:{fontSize:"1.05rem"},children:[e.jsx("p",{className:"text-secondary",children:a(d=>d.ModalText)}),e.jsx("p",{className:"fw-semibold mb-3",children:a(d=>d.ModalAdvIntro)}),e.jsx("div",{className:"row row-cols-1 row-cols-sm-2 g-3",children:o.map(d=>e.jsx("div",{className:"col",children:e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("span",{className:"d-inline-flex align-items-center justify-content-center bg-primary bg-opacity-10 rounded-circle flex-shrink-0 me-3",style:{width:42,he
18ight:42},children:e.jsx("i",{className:`fa-solid ${d.icon} text-body-emphasis`,"aria-hidden":"true"})}),e.jsx("span",{children:a(d.label)})]})},d.icon))})]}),e.jsxs("div",{className:"modal-footer border-0 px-4 pb-4 pt-0",children:[e.jsx("button",{type:"button",className:"btn btn-outline-secondary btn-lg fw-semibold px-4 me-auto",onClick:r,children:a(d=>d.ModalContinueBooking)}),e.jsxs("button",{type:"button",className:"btn btn-primary btn-lg fw-semibold px-4",onClick:n,children:[a(d=>d.ModalGoToAgency),e.jsx("i",{className:"fa-solid fa-arrow-right ms-2","aria-hidden":"true"})]})]})]})})})});function Dp(){return e.jsx(ze,{role:ce.canuseagency,children:e.jsx(Pp,{})})}const Ip=i=>e.jsx("div",{className:"booking d-flex flex-column justify-content-around h-100 min-vh-100",children:e.jsx("div",{children:e.jsx("div",{children:i.children})})}),Yn=i=>e.jsx("div",{className:"booking d-flex flex-column h-100 min-vh-100 dark-style",children:e.jsx("div",{children:e.jsx("div",{children:i.children})})}),Tp=i=>e.jsx("div",{className:"booking d-flex flex-column justify-content-between h-100 min-vh-100",children:e.jsxs("div",{children:[e.jsx("a",{href:"#main-content",onClick:a=>{a.preventDefault();const t=document.getElementById("main-content");t&&(t.focus(),t.scrollIntoView())},className:"visually-hidden-focusable btn btn-primary position-absolute top-0 start-0 m-2",style:{zIndex:2e3},children:"Salta al contenuto"}),e.jsx(wp,{}),e.jsx(Dp,{}),e.jsxs("main",{id:"main-content",tabIndex:-1,children:[e.jsx("h1",{className:"visually-hidden",children:te.environmentReadableName}),i.children]})]})}),_p=i=>{var a;const{pathName:t,search:s}=i,n=((a=new URLSearchParams(s).get("noHeader"))===null||a===void 0?void 0:a.toLowerCase())=="true";return t.indexOf("payPalWebView/")!=-1?e.jsx(Ip,{children:i.children}):t.indexOf(D.StopLiveDepartureStatusTvMonitorRoot)!=-1||n?e.jsx(Yn,{children:i.children}):t.indexOf(D.StopLiveArrivalStatusTvMonitorRoot)!=-1||n?e.jsx(Yn,{children:i.children}):e.jsx(Tp,{children:i.children})};var kp=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};`${te.environmentReadableName}`;ql.SC=1;function Ap(i){return i==="*"?i:`/:lang?${i}`}const Rp=i=>i.map(a=>({path:Ap(a.path),element:a.element,lazy:a.lazy?()=>kp(void 0,void 0,void 0,function*(){const t=(yield a.lazy()).Component;return{Component:()=>e.jsx(t,{})}}):void 0,hydrateFallback:Je,errorElement:e.jsx(gc,{})})),Mp=(i,a)=>[{HydrateFallback:Je,element:e.jsx(pc,{baseName:a,children:e.jsx(_p,{pathName:window.location.pathname,search:window.location.search,children:e.jsx(El,{})})}),children:Rp(i)},{path:"*",element:e.jsx(vc,{})}];class Op extends P.Component{componentDidMount(){mc(),hc(),te.zendeskChat&&rd(`https://static.zdassets.com/ekr/snippet.js?key=${te.zendeskChat}`,void 0,"ze-snippet"),te.environmentName=="romaexpress"&&ai(e.jsx("div",{children:"Dal 10 Luglio 2023 fino a data da destinarsi le corse saranno temporaneamente sospese fino a nuova comunicazione."})),document.title=te.environmentReadableName}render(){const a=od(""),t=xp(),s=Mp(t,a),n=zl(s,{basename:a});return e.jsx(Ll,{router:n})}}const zp={environmentName:apiUrl.environmentName,environmentReadableName:apiUrl.environmentReadableName,maxEndUserPassengers:apiUrl.maxEndUserPassengers,facebookClientId:apiUrl.facebookClientId,serverUrl:apiUrl.serverUrl,albatrossVersion:apiUrl.albatrossVersion,localStorage:(i,a)=>new ld(i),googleAPIKey:apiUrl.googleAPIKey,recaptchaSiteKey:apiUrl.recaptchaSiteKey,live:apiUrl.live,cookieBotId:apiUrl.cookieBotId,facebookEventsId:apiUrl.facebookEventsId,useCriteo:apiUrl.useCriteo,googleAnalyticsIdentifier:apiUrl.googleAnalyticsIdentifier,googleGTagConversionId:apiUrl.googleGTagConversionId,bookingThirdLevel:apiUrl.bookingThirdLevel,homepage:apiUrl.homepage,subscriptionEnabled:apiUrl.subscriptionEnabled,zendeskChat:apiUrl.zendeskChat,useGoogleTagManager:apiUrl.useGoogleTagManager,useKwanko:apiUrl.useKwanko,frontendVersion:apiUrl.frontendVersion,luggageSlotThreshold:apiUrl.luggageSlotThreshold,googleLoginClientId:apiUrl.googleLoginClientId,canLimitStopsOnSubscriptionsSale:apiUrl.canLimitStopsOnSubscriptionsSale,liveStatusDisabled:apiUrl.liveStatusDisabled,flixbusPartnerId:apiUrl.flixbusPartnerId};Object.assign(te,zp);Ni.setMessages(fc);Ni.setMessages(am);xc(te);let Ht=[];Ht.push(new bc(apiUrl.cookieBotId));apiUrl.useCriteo&&Ht.push(new yc);apiUrl.useKwanko&&Ht.push(new jc);Ht.push(new Sc(apiUrl.googleAnalyticsIdentifier));Ht.push(new Nc(apiUrl.facebookEventsId));apiUrl.useGoogleTagManager?Ht.push(new wc(apiUrl.googleGTagConversionId)):Ht.push(new Cc(apiUrl.googleGTagConversionId));Hl(Ht);const Lp=document.getElementById("endUsersApp"),Ep=Fl.createRoot(Lp);Ep.render(e.jsx(Op,{}));const Fp=()=>{const i=_e();return P.useEffect(()=>{const a=`${window.location.origin}/it?tab=tpl`;window.location.search.includes("tab=tpl")||(window.location.href=a)},[i]),e.jsx("div",{},"placeholder")},Bp=Object.freeze(Object.defineProperty({__proto__:null,default:Fp},Symbol.toStringTag,{value:"Module"}));var $p=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Wp=()=>{const i=Se(),a=_e();return e.jsx(Zo,{zone:i.zone,type:i.type,personCode:i.personCode,history:a})},Zo=i=>{var a,t;const s=u=>$p(void 0,void 0,void 0,function*(){var c,l,m,h;const f={departureId:(c=u==null?void 0:u.id)!==null&&c!==void 0?c:"",arrivalId:(l=u==null?void 0:u.id)!==null&&l!==void 0?l:"",departure:(m=u==null?void 0:u.description)!==null&&m!==void 0?m:"",arr
18ival:(h=u==null?void 0:u.description)!==null&&h!==void 0?h:""};qe.send(new ys(f))}),n=zs.useAll(),r=Di.useAll(),o=(t=(a=n==null?void 0:n.find(u=>V.invariantEquals(u.description,i.zone)))!==null&&a!==void 0?a:n==null?void 0:n.find(u=>V.startsWith(u.description,i.zone)))!==null&&t!==void 0?t:n==null?void 0:n.find(u=>V.contains(u.description,i.zone));if(o==null||r==null)return e.jsx(X,{});const d=r.find(u=>u.saleGroupType===2);if(d){const u=Temporal.Now.plainDateISO(),c=new URLSearchParams({tab:d.id,mode:"purchase",urbanoPoolId:o.id,urbanoDate:u.toJSON()});i.type&&c.set("type",i.type),i.personCode&&c.set("personCode",i.personCode);const l=Ni.getLocale();return i.history(`/${l}/?${c.toString()}`,{replace:!0}),e.jsx(X,{})}return s(o),e.jsx(X,{})},Up=Object.freeze(Object.defineProperty({__proto__:null,UrbanoLanding:Zo,default:Wp},Symbol.toStringTag,{value:"Module"}));function Ei(i){return ye(i.penaltyDetailsDto,a=>a.total)}const Xo=_(i=>{var a,t,s,n,r,o,d,u;const{formatMessage:c}=i.i18n.get(Q),l=i.selected!=null&&(n=i.data.find(m=>m.mode==i.selected))!==null&&n!==void 0?n:null;return e.jsxs("div",{className:"d-flex flex-wrap justify-content-center justify-content-lg-start",children:[i.data.map(m=>e.jsx(Pc,{imgSrc:Dc(m.mode),name:Ua(m.mode),onSelect:()=>i.onChange(m),selectable:!0,selected:i.selected==m.mode},m.mode)),i.selected===2&&e.jsxs("div",{className:"col-12 col-lg-8",children:[e.jsx(dd,{name:"iban",label:"Iban",placeholder:c(m=>m.Iban),value:(r=i.iban)!==null&&r!==void 0?r:"",onChange:(m,h)=>i.onChangeIban(h),required:!0}),e.jsx("span",{style:{display:(((a=i.iban)===null||a===void 0?void 0:a.substring(0,2))||"IT")==="IT"&&!i.bic?"none":""},children:e.jsx(cd,{label:"Bic",placeholder:"Bic",name:"bic",value:(o=i.bic)!==null&&o!==void 0?o:"",onChange:(m,h)=>i.onChangeBic(h),isoCode:((t=i.iban)===null||t===void 0?void 0:t.substring(0,2))||"IT"})}),e.jsx(Ct,{name:"fullname",label:c(m=>m.IntestatarioConto),placeholder:c(m=>m.IntestatarioConto),value:(d=i.fullName)!==null&&d!==void 0?d:"",onChange:(m,h)=>i.onChangeFullName(h)})]}),i.selected==null&&i.data.every(m=>m.amountRefunded==0&&Ei(m)>0)&&e.jsx("div",{className:"col-12",children:e.jsxs("div",{className:"text-danger text-medium",children:[e.jsx("div",{className:"fontsize-5u",children:c(m=>m.ImportoPenale)}),e.jsxs("div",{className:"fontsize-15u fw-bolder",children:["⬠",V.toDecimalString(Ei(i.data[0]))]}),e.jsx("div",{className:"my-2",children:c(m=>m.NoRimborso)})]})}),l&&e.jsxs("div",{className:"col-12",children:[Ei(l)>0&&e.jsxs("div",{className:"text-danger text-medium",children:[e.jsx("div",{className:"fontsize-5u",children:c(m=>m.ImportoPenale)}),e.jsxs("div",{className:"fontsize-15u fw-bolder",children:["⬠",V.toDecimalString(Ei(l))]})]}),l.amountRefunded!==0&&e.jsxs("div",{className:"text-medium",children:[e.jsx("div",{className:"fontsize-5u",children:c(m=>m.TotaleDaRicevere)}),e.jsxs("div",{className:"fontsize-15u fw-bolder",children:["⬠",V.toDecimalString(i.refundDue)]})]}),l.details&&i.walletAmountToRefund&&i.walletAmountToRefund>0&&e.jsxs("div",{className:"alert alert-warning",children:[e.jsx("strong",{children:"Dettaglio rimborso:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:["⬠",V.toDecimalString(((s=l.details)===null||s===void 0?void 0:s.length)>0?ye(l.details,m=>m.residualAmount):l.amountRefunded)," ",Ua(l.mode)]}),i.walletAmountToRefund&&e.jsxs("li",{children:["⬠",V.toDecimalString(i.walletAmountToRefund)," ",Ua((u=i.remainderMode)!==null&&u!==void 0?u:1)]})]})]})||null]})]})});var Vp=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Gp=i=>{var a,t,s,n,r,o;const d=_e(),{ids:u}=i,c=u.join(","),l=yi.useBooking(u[0]),m=It(()=>i.cancelPreviewAction(c),[c]),[h,f]=P.useState({mode:null,iban:"",bic:"",fullname:"",walletAmountToRefund:null,loading:!1});if(!m||!l)return e.jsx(X,{});const p=!((a=m.availableRefundModes)===null||a===void 0)&&a.some(W=>W.mode===1)?1:!((t=m.availableRefundModes)===null||t===void 0)&&t.some(W=>W.mode===3)?3:null,g=u.length,v=g>1,x=W=>{var E;const Z=m.availableRefundModes.find(O=>O.mode===W.mode);let de=Z.amountRefunded,ue=0;if(((E=Z.details)===null||E===void 0?void 0:E.length)>0){ue=Z.amountRefunded;for(const O of Z.details)ue+=O.residualAmount}f(Object.assign(Object.assign({},h),{mode:Z,walletAmountToRefund:ue>0?de-ye(Z.details,O=>O.residualAmount):null}))},S=W=>f(Object.assign(Object.assign({},h),{iban:W.toUpperCase()})),y=W=>f(Object.assign(Object.assign({},h),{bic:W})),b=W=>f(Object.assign(Object.assign({},h),{fullname:W})),j=()=>Vp(void 0,void 0,void 0,function*(){var W,E,Z;const{formatMessage:de}=i.i18n.get(Q),ue=de(ae=>ae.VuoiAnnullareTitolo),{mode:O}=h;if(l)if(O===null&&z.some(ae=>ae.amountRefunded>0))ai(de(ae=>ae.SelezionaModalitaRimborso));else if((O==null?void 0:O.mode)===2&&((h.iban.length<3||h.fullname.length<3||yr.Validate(h.iban,!0))===!1||h.iban.substring(0,2).toUpperCase()!=="IT"&&!h.bic))ai(de(ae=>ae.Errore_DatiBonifico));else{var se="";(O===null?z.length>0&&z.every(pe=>pe.amountRefunded===0):O.amountRefunded===0&&Ei(O)>0)&&(se=de(pe=>pe.NoRimborso));const be=v?`${ue} ${g} ${de(pe=>pe.Biglietti)}?`:`${ue} ${l.code}?`;if(yield Ci(e.jsxs("div",{children:[e.jsx("div",{className:"fw-bold fontsize-3u",children:be}),se&&e.jsx("div",{className:"text-danger",children:se})]}))){const pe=h.mode===null?void 0:{mode:h.mode.mode,amount:h.mode.amountRefunded,transactionCode:(Z=(E=(W=h.mode.details)===null||W===void 0?void 0:W[0])===null||E===void 0?void 0:E.transactionCode)!==null&&Z!==void 0?Z:void 0,iban:h.iban,bic:h.bic,fullName:h.fullname};try{f(Object.assign(Object.assign({},h),{loading:!0}));const oe=yield i.cancelAction({ticketIds:u,detail:pe,specifiedEmail:l.email,specifiedPhone:l.phone,specifiedCallingCode:l.callingcode});f(Object.assign(Object.assign({},h),{loading:!1})),i.onRefundComplete?i.onRefundComplete(oe):(fs(le=>e.jsxs("div",{children:[e.jsx("div",{className:"fontsize-10u mb-3",children:de(me=>me.AnnullamentoEffettuato)}),e.jsxs("div",{className:"my-2",children:[e.jsx("div",{className:"text-uppercase",children:de(me=>me.TotaleOperazione)}),e.jsxs("div",{className:"fontsize-5u fw-bold",children:[V.toDecimalString(oe.refundedAmount)," â¬"]})]}),oe.coupon&&e.jsxs("div",{className:"my-1",children:[e.jsxs("div",{className:"my-2",children:[e.jsx("div",{className:"text-uppercase",children:T(me=>me.RemainderCoupon)}),e.jsx("div",{className:"fontsize-5u fw-bold text-uppercase",children:oe.coupon})]}),e.jsxs("div",{className:"my-2",children:[e.jsx("div",{className:"text-uppercase",children:T(me=>me.DataDiScadenza)}),e.jsx("div",{className:"fontsize-5u fw-bold text-uppercase",children:k.getReadableDateTimeString(oe.expiration)})]})]}),oe.Message&&e.jsx("div",{className:"alert alert-info",children:oe.Message})]}),{showFooter:!0}),i.isAnonymous||d(D.GetTicketsPath()))}catch{f(Object.assign(Object.assign({},h),{loading:!1})),ai(de(le=>le.Errore_annullamento))}}}}),{mode:I,loading:N}=h,{formatMessage:w}=i.i18n.get(Q);var{formatMessage:T}=i.i18n.get(ne);const C=i.isRefundOnly?w(W=>W.Rimborso):w(W=>W.Annullamento),A=v?`${C} - ${g} ${w(W=>W.Biglietti)}`:C.concat(" ").concat(l.code);
18if(!(i.isAnonymous||Oe.isEnabledForCancelation(i.roles,i.user,l))){const W=e.jsxs(e.Fragment,{children:[!i.isAnonymous&&e.jsx(Te,{customLink:D.GetTicketsPath()}),e.jsx("div",{className:"alert alert-danger",children:w(E=>E.Errore_annullamento)})]});return i.isAnonymous?W:e.jsx(re,{title:A,children:W})}const z=(s=m.availableRefundModes)!==null&&s!==void 0?s:[],R=z.filter(W=>W.amountRefunded>0),M=yi.getValidParts(l),F=M[0],L=M[M.length-1],U=(n=i.showTicketSummary)!==null&&n!==void 0?n:!0,Y=e.jsxs(e.Fragment,{children:[!i.isAnonymous&&e.jsx(Te,{customLink:D.GetTicketsPath()}),v&&!l.isCanceled&&e.jsxs("div",{className:"alert alert-info mt-4",children:[e.jsx("i",{className:"fas fa-info-circle me-2"}),w(W=>W.StaiPerAnnullare)," ",g," ",w(W=>W.Biglietti)]}),!l.isCanceled||i.isRefundOnly?e.jsxs(Bt,{className:"mt-4",children:[U&&e.jsxs("div",{className:"row border-bottom py-2",children:[e.jsx("div",{className:"col-6 col-lg-4 my-1",children:e.jsx(Ze,{stopId:F.departureId,label:T(W=>W.Partenza),departureDateTime:F.departureDate,showTimeDay:!0})}),e.jsx("div",{className:"col-6 col-lg-4 my-1",children:e.jsx(Ze,{stopId:L.arrivalId,label:T(W=>W.Arrivo),departureDateTime:L.arrivalDate,showTimeDay:!0})}),e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsxs("div",{children:[e.jsx("div",{className:"fw-bold text-medium",children:w(W=>W.Prezzo)}),e.jsx("div",{className:"d-flex align-items-center",children:e.jsxs("div",{className:"fw-bolder text-medium text-nowrap me-2 fontsize-20u",children:["⬠",V.toDecimalString(l.price)]})})]})})]}),e.jsxs(Ys,{isLoading:N,children:[e.jsx("div",{className:"row mt-3",children:R.length>0&&e.jsxs("div",{className:"col-12",children:[e.jsx("div",{className:"mb-2 fw-bold fontsize-2u mb-3",children:w(W=>W.SelezionaModalitaRimborso)}),e.jsx(Xo,{refundDue:(r=I==null?void 0:I.amountRefunded)!==null&&r!==void 0?r:0,data:R,selected:(o=I==null?void 0:I.mode)!==null&&o!==void 0?o:null,onChange:x,iban:h.iban,onChangeIban:S,bic:h.bic,onChangeBic:y,fullName:h.fullname,onChangeFullName:b,walletAmountToRefund:h.walletAmountToRefund,remainderMode:p})]})}),e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-12",children:e.jsx("div",{className:"d-grid d-lg-block",children:e.jsxs("button",{type:"button",className:"btn btn-success btn-highlight my-4 fontsize-5u py-2 px-5",onClick:j,children:[e.jsx("i",{className:"fas fa-check fa-lg me-3"}),l.price!==0&&l.payedAmount+l.discount!==0||l.yetToBePayedOrRefunded<0?w(W=>W.ConfermaOperazione):w(W=>W.Annulla)]})})})})]})]}):e.jsx("div",{className:"alert alert-info my-4",children:w(W=>W.AnnullamentoEffettuato)})]});return i.isAnonymous?Y:e.jsx(re,{title:A,fullWidth:!0,children:e.jsx("div",{className:"container",children:Y})})},el=_(Gp),qp=new Pi,Hp=i=>{const a=Se(),t=n=>qp.bookingCancelPreview({ticketIds:n,ignoreOneWayPriceDiff:!1,specifiedDate:void 0}),s=n=>xe.bookingCancel(n);return e.jsx(el,{cancelAction:s,cancelPreviewAction:t,ids:[a.id],roles:i.roles,user:i.user,isAnonymous:!1,showTicketSummary:!0})},Kp=_(_a(et(Hp))),Qp=Object.freeze(Object.defineProperty({__proto__:null,default:Kp},Symbol.toStringTag,{value:"Module"}));var Jp=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Yp=yt(i=>{var a;const t=P.createRef();if(!i.ticket.extraData||!i.ticket.passenger.fareCategoryId)return null;const s=(a=i.fareCategories[i.ticket.passenger.fareCategoryId])===null||a===void 0?void 0:a.extraParams;if(!s||!(s.find(u=>u.editable)||!1))return null;const[r,o]=P.useState(i.ticket.extraData),d=()=>Jp(void 0,void 0,void 0,function*(){var u;(u=t==null?void 0:t.current)===null||u===void 0||u.close();try{var c={ticketId:i.ticket.id,callingcode:i.ticket.callingcode,email:i.ticket.email,name:i.ticket.passenger.name,notes:i.ticket.passenger.notes,phonenumber:i.ticket.phone,surname:i.ticket.passenger.surname,hasDisabilities:i.ticket.passenger.hasDisabilities,isFamily:i.ticket.isFamily,extraData:r,language:i.ticket.language,hiddenPrice:i.ticket.hiddenPrice,notesForOnboard:i.ticket.notesForOnboard};yield xe.ModifyTicketData(c),yield xe.ticketDetail(i.ticket.id);var l="Modifica effettuata!";xt.success(l)}catch{xt.error("Si sono verificati errori in fase di modifica dati b
18iglietto")}});return e.jsxs(ud,{text:"Modifica",ref:t,title:"Modifica",divClassName:"d-flex justify-content-end",children:[e.jsx(Zu,{ticket:i.ticket,extraData:r,onChange:o,fromBooking:!0}),e.jsx("button",{type:"button",className:"btn btn-primary btn-highlight d-flex align-items-center",onClick:d,children:"Modifica"})]})})(i=>i.allByKey(),"fareCategories");var ln=function(i,a,t,s){var n=arguments.length,r=n<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,t):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,a,t,s);else for(var d=i.length-1;d>=0;d--)(o=i[d])&&(r=(n<3?o(r):n>3?o(a,t,r):o(a,t))||r);return n>3&&r&&Object.defineProperty(a,t,r),r},Ot=function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)};class zt{getStopLiveDepartureStatus(a){return zt.service.getStopLiveDepartureStatus(a)}getStopLiveStatusForArrival(a){return zt.service.getStopLiveStatusForArrival(a)}getStopLiveStatusForTicket(a){return zt.service.getStopLiveStatusForTicket(a)}}zt.service=new Nu;ln([Qt,Ot("design:type",Function),Ot("design:paramtypes",[String]),Ot("design:returntype",void 0)],zt.prototype,"getStopLiveDepartureStatus",null);ln([Qt,Ot("design:type",Function),Ot("design:paramtypes",[String]),Ot("design:returntype",void 0)],zt.prototype,"getStopLiveStatusForArrival",null);ln([Qt,Ot("design:type",Function),Ot("design:paramtypes",[String]),Ot("design:returntype",void 0)],zt.prototype,"getStopLiveStatusForTicket",null);const At=new zt;class Zp extends Ki{constructor(){super(a=>a.tripId),this.useAll=a=>this.useAllWithAction(()=>At.getStopLiveDepartureStatus(a)),Si.onfunction(At.getStopLiveDepartureStatus,a=>this.setAll(a))}}const Xp=new Zp,ev=i=>{const a=i.stopId;if(!a)return null;P.useEffect(()=>{At.getStopLiveDepartureStatus(a);const n=setInterval(()=>{At.getStopLiveDepartureStatus(a)},60*1e3);return()=>clearInterval(n)},[]);const t=i.liveStatus;if(!t)return e.jsx(X,{});const s=i.template;return e.jsx(s,{liveStatus:t,stopId:a})},tl=fe(ev,Xp,(i,a)=>{var t;return{liveStatus:a.stopId&&(t=i.getall())!==null&&t!==void 0?t:null}}),tv=_(i=>{const{segments:a}=i;return e.jsx("div",{className:"",children:e.jsx("div",{className:"px-3 py-2",children:a.map(t=>e.jsx("div",{children:t.stops.map((s,n)=>{const{stop:r,withChange:o}=s,d=n===t.stops.length-1;return e.jsx(ht,{id:r.stopId,selector:u=>e.jsxs("div",{className:"d-flex align-items-start",style:{minHeight:"80px"},children:[e.jsx("div",{style:{width:"60px"},className:"text-secondary pt-1",children:k.getReadableTimeString(r.stopTimeArrival,{timezone:u.timezone})}),e.jsxs("div",{className:"d-flex flex-column align-items-center mx-3 position-relative",children:[n>0&&e.jsx("div",{style:{width:"2px",height:"40px",backgroundColor:"#dee2e6",position:"absolute",top:"-40px",left:"50%",transform:"translateX(-50%)"}}),e.jsx("div",{style:{position:"relative",zIndex:10},children:e.jsx("i",{className:`${o?"fas fa-exchange-alt":"fa-regular fa-circle"} ${o?"text-primary":""} fa-lg`})}),!d&&e.jsx("div",{style:{width:"2px",height:"40px",backgroundColor:"#dee2e6",position:"absolute",bottom:"-40px",left:"50%",transform:"translateX(-50%)"}})]}),e.jsxs("div",{className:"flex-grow-1 pt-1",children:[e.jsxs("div",{className:`fw-bold mb-1 ${o?"text-primary":" "}`,children:[e.jsx(Ge,{id:r.stopId}),o&&e.jsx("span",{className:"ms-2 badge bg-primary",children:"Cambio"})]}),e.jsx("div",{className:"small text-secondary",children:e.jsx(wu,{id:r.stopId})})]})]},r.stopId)},r.stopId)})},t.tripId))})})}),il=_(i=>{const{highlighted:a,trip:t,isOpen:s}=i,{formatMessage:n}=i.i18n.get(Q);return e.jsx("div",{className:`p-3 ${s?"mt-2":"my-2"} ${a?"bg-primary text-white":"bg-white"} shadow`,children:e.jsxs("div",{className:"row align-items-center",children:[e.jsx("div",{className:"col-11",children:e.jsxs("div",{className:"row align-items-center",children:[e.jsxs("div",{className:"col-4 col-lg-2",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:n(r=>r.Departure)}),e.jsx("div",{className:"fontsize-10u fw-bold",children:k.getReadableTimeString(t.stopTime)})]}),e.jsxs("div",{className:"col-8 col-lg-4 d-lg-block d-flex flex-column align-items-end",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:n(r=>r.Arrival)}),e.jsxs("div",{className:"text-uppercase fontsize-10u text-nowrap",children:[" ",e.jsx(Ge,{id:t.lastArrivalStopId})]})]}),e.jsx("div",{className:"col-10 col-lg-5",children:t.vehicleSerialNumber&&e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:n(r=>r.Mezzo)}),e.jsxs("div",{className:"text-uppercase fontsize-10u",children:[" ",t.vehicleSerialNumber]})]})}),e.jsx("div",{className:"col-2 col-lg-1 d-lg-block d-flex flex-column align-items-end",children:t.delay&&t.delay>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:n(r=>r.Ritardo)}),e.jsxs("div",{className:"text-uppercase fontsize-5u badge bg-danger",children:["+",Math.round(t.delay),"'"]})]})})]})}),t.nextStops.length>0&&e.jsx("div",{className:"col-1 d-flex justify-content-center",children:e.jsx("i",{className:`${s?"fas fa-chevron-up":"fas fa-chevron-down"} fa-2x`})})]})})}),al=_(i=>{const{trip:a,isOpen:t}=i,{formatMessage:s}=i.i18n.get(Q);return e.jsx("div",{className:`p-3 ${t?"mt-2":"my-2"} bg-danger text-white shadow`,children:e.jsxs("div",{className:"row align-items-center",children:[e.jsx("div",{className:"col-11",children:e.jsxs("div",{className:"row align-items-center",children:[e.jsxs("div",{className:"col-4 col-lg-2",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:s(n=>n.Departure)}),e.jsx("div",{className:"fontsize-10u fw-bold text-decoration-line-through",children:k.getReadableTimeString(a.stopTime)})]}),e.jsxs("div",{className:"col-8 col-lg-4 d-lg-block d-flex flex-column align-items-end",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:s(n=>n.Arrival)}),e.jsxs("div",{className:"text-uppercase fontsize-10u text-decoration-line-through",children:[" ",e.jsx(Ge,{id:a.lastArrivalStopId})]})]}),e.jsx("div",{className:"col-12 col-lg-4 d-flex justify-content-center",children:e.jsxs("div",{className:"text-uppercase fontsize-10u text-center w-100",children:[e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-2"})," ",s(n=>n.CorsaAnnullata)]})})]})}),a.nextStops.length>0&&e.jsx("div",{className:"col-1 d-flex justify-content-center",children:e.jsx("i",{className:`${t?"fas fa-chevron-up":"fas fa-chevron-down"} fa-2x`})})]})})}),sl=_(i=>{const{highlighted:a,trip:t,isOpen:s,carrierId:n}=i,{formatMessage:r}=i.i18n.get(Q);return e.jsx("div",{className:`p-3 ${s?"mt-2":"my-2"} ${a?"bg-primary text-white":"bg-white"} shadow`,children:e.jsxs("div",{className:"row align-items-center",children:[n&&e.jsx("div",{className:"col-1 d-none d-sm-flex justify-content-center",children:e.jsx(to,{carrierId:n})}),e.jsx("div",{className:n&&"col-10"||"col-11",children:e.jsxs("div",{className:"row align-items-center",children:[e.jsxs("div",{className:"col-4 col-lg-2",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:r(o=>o.Departure)}),e.jsx("div",{className:"fontsize-10u fw-bold",children:k.getReadableTimeString(t.stopTime)})]}),e.jsxs("div",{className:"col-8 col-lg-4 d-lg-block d-flex flex-column align-items-end",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:"Arrivo"}),e.jsxs("div",{className:"text-uppercase fontsize-10u text-nowrap",children:[" ",e.jsx(Ge,{id:t.lastArrivalStopId})]}),n&&e.jsxs("div",{className:"d-flex flex-column d-sm-none align-items-end",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:r(o=>o.Vettore)}),e.jsx(Us,{companyId:n,template:o=>o.description})]})]}),e.jsx("div",{className:"col-10 col-lg-5",children:t.vehicleSerialNumber&&e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:r(o=>o.Mezzo)}),e.jsxs("div",{className:"text-uppercase fontsize-10u",children:[" ",t.vehicleSerialNumber]})]})}),e.jsx("div",{className:"col-2 col-lg-1 d-lg-block d-flex flex-column align-items-end",children:t.delay&&t.delay>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:r(o=>o.Ritardo)}),e.jsxs("div",{className:"text-uppercase fontsize-5u badge bg-danger",children:["+",Math.round(t.delay),"'"]})]})})]})}),t.nextStops.length>0&&e.jsx("div",{className:"col-1 d-flex justify-content-center",children:e.jsx("i",{className:`${s?"fas fa-chevron-up":"fas fa-chevron-down"} fa-2x`})})]})})}),nl=_(i=>{const{trip:a,isOpen:t,carrierId:s}=i,{formatMessage:n}=i.i18n.get(Q);return e.jsx("div",{className:`p-3 ${t?"mt-2":"my-2"} bg-danger text-white shadow`,children:e.jsxs("div",{className:"row align-items-center",children:[s&&e.jsx("div",{className:"col-1 d-none d-sm-flex justify-content-center",children:e.jsx(to,{carrierId:s})}),e.jsx("div",{className:s&&"col-10"||"col-11",children:e.jsxs("div",{className:"row align-items-center",children:[e.jsxs("div",{className:"col-4 col-lg-2",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:n(r=>r.Departure)}),e.jsx("div",{className:"fontsize-10u fw-bold text-decoration-line-through",children:k.getReadableTimeString(a.stopTime)})]}),e.jsxs("div",{className:"col-8 col-lg-4 d-lg-block d-flex flex-column align-items-end",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:n(r=>r.Arrival)}),e.jsxs("div",{className:"text-uppercase fontsize-10u text-decoration-line-through",children:[" ",e.jsx(Ge,{id:a.lastArrivalStopId})]}),s&&e.jsxs("div",{className:"d-flex flex-column d-sm-none align-items-end",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:n(r=>r.Vettore)}),e.jsx(Us,{companyId:s,template:r=>r.description})]})]}),e.jsx("div",{className:"col-12 col-lg-4 d-flex justify-content-center",children:e.jsxs("div",{className:"text-uppercase fontsize-10u text-center w-100",children:[e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-2"})," ",n(r=>r.CorsaAnnullata)]})})]})}),a.nextStops.length>0&&e.jsx("div",{className:"col-1 d-flex justify-content-center",children:e.jsx("i",{className:`${t?"fas fa-chevron-up":"fas fa-chevron-down"} fa-2x`})})]})})}),iv=_(i=>{const{liveStatus:a,stopId:t}=i,{formatMessage:s}=i.i18n.get(Q);return e.jsx(re,{title:e.jsx(Vt,{id:t}),fullWidth:!0,children:e.jsx("div",{children:a.length>0&&a.map((n,r)=>e.jsx(wi,{heading:o=>n.isCanceled?e.jsx(al,{trip:n,isOpen:o}):e.jsx(il,{highlighted:r==0,trip:n,isOpen:o}),children:n.nextStops.length>0&&e.jsxs("div",{className:"bg-white mb-2 shadow p-3",children:[e.jsxs("div",{className:"mb-2 text-uppercase",children:["Corsa ",n.tripCode]}),e.jsx("div",{className:"fw-bold fontsize-2u text-uppercase",children:s(o=>o.ProssimePartenze)}
18),e.jsx(tv,{segments:[{tripId:n.tripId,tripCode:n.tripCode,stops:n.nextStops.map(o=>({withChange:o.withChange,stop:{stopId:o.stopId,stopTimeDeparture:o.stopTime,stopTimeArrival:o.stopTime}}))}]})]})},n.tripId))||e.jsxs("div",{className:"h-100 mt-3 p-5 bg-white shadow border rounded-3",children:[e.jsx("h2",{className:"fw-bold text-medium",children:s(n=>n.NessunaPartenza)}),e.jsx("p",{children:s(n=>n.NessunaPartenzaExtended)})]})})})}),av=i=>{const{liveStatus:a,stopId:t}=i;return e.jsx(iv,{liveStatus:a,stopId:t})},sv=()=>{const i=Se();return e.jsx(tl,{template:av,stopId:i.stopId})},nv=Object.freeze(Object.defineProperty({__proto__:null,CanceledTrip:al,TicketCanceledTrip:nl,TicketValidTrip:sl,ValidTrip:il,default:sv},Symbol.toStringTag,{value:"Module"}));var rv=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const ov=i=>{if(dt.liveStatusDisabled)return null;const a=i.ticket;if(!a)return null;const[t,s]=P.useState(null),n=()=>rv(void 0,void 0,void 0,function*(){const o=yield At.getStopLiveStatusForTicket(a.id);s(o)});if(P.useEffect(()=>{n();const o=setInterval(()=>{n()},60*1e3);return()=>clearInterval(o)},[]),!t||t.length==0)return null;const r=Hi(a.parts.map(o=>o.carrierId).filter(o=>o.length>0),o=>o).length>1;return e.jsx("div",{className:"my-2",children:e.jsx(lv,{data:t,trips:r?a.parts.map(o=>({tripId:o.tripId,carrierId:o.carrierId})):[]})})},lv=_(i=>{const{formatMessage:a}=i.i18n.get(Q),{data:t,trips:s}=i;if(t==null)return null;const n=ni(i.data,r=>k.differenceInMinutes(k.NowWithMinutePrecision(),r.stopTime))[0];return e.jsx(e.Fragment,{children:t.map(r=>{var o,d=(o=s.find(u=>u.tripId==r.tripId))===null||o===void 0?void 0:o.carrierId;return e.jsx(wi,{open:r.tripId==n.tripId,heading:u=>r.isCanceled?e.jsx(nl,{trip:r,isOpen:u,carrierId:d}):e.jsx(sl,{highlighted:!0,trip:r,isOpen:u,carrierId:d}),children:e.jsx("div",{className:"bg-white mb-2 shadow w-100",children:e.jsxs("div",{className:"row",children:[r.nextStops.length>0&&e.jsxs("div",{className:"col-12 col-lg-3 p-5",children:[e.jsxs("div",{className:"mb-2 text-uppercase fw-bold fontsize-3u",children:[a(u=>u.Trip)," ",r.dailyCode," - ",r.tripCode]}),e.jsx(ws,{segments:[{tripId:r.tripId,tripCode:r.tripCode,stops:r.nextStops.map(u=>({stop:{stopId:u.stopId,stopTimeDeparture:u.stopTime,stopTimeArrival:u.stopTime},type:3}))}]})]}),e.jsx("div",{className:"col-12 col-lg-9",children:r.lastPosition!=null&&e.jsx(wr,{markers:[r.lastPosition],centerMap:r.lastPosition,height:500})})]})})},r.tripId)})})}),rt=i=>e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{children:i.label}),e.jsx("div",{className:"fw-bold",children:i.value})]}),dv=_(i=>{var a,t,s,n;const r=Se(),o=_e(),d=yi.useBooking(r.id);if(!d)return e.jsx(X,{});const{formatMessage:u}=i.i18n.get(Q),{formatMessage:c}=i.i18n.get(ne),l=Oe.canResendAndReprintTicket(d);var m=ea(d.urlPdf,i.hl);const h=`/images/walletPasses/apple/${i.hl}_add_to_apple_wallet.svg`,f=`/images/walletPasses/google/${i.hl}_add_to_google_wallet.svg`,p=`/passes/apple/downloadPassPage/${r.id}?passType=ticket`,g=`/passes/google/downloadPassPage/${r.id}?passType=ticket`,v=yi.getValidParts(d),x=v[0],S=v[v.length-1],y=mt(d.accompaniedLuggage,C=>({category:C.id,count:1,price:Bs(C.valueDetail),tkts:1,extraData:[C.extraData]})),b=d.isPayed||!d.expired&&(d.paymentMethod===2||d.paymentMethod==7),j=x.departureDate.getDate()!=S.arrivalDate.getDate(),I=Hi(d.parts.map(C=>C.carrierId).filter(C=>C.length>0),C=>C).length>1,N=Oe.canIssueLuggages(i.roles,i.user,d),w=Oe.isEnableForChangeDate(i.roles,i.user,d,!0),T=N&&w;return e.jsx(re,{title:e.jsxs("span",{children:[" ",c(C=>C.BigliettoElettronico)]}),fullWidth:!0,children:e.jsxs("div",{className:"container",children:[e.jsx(Te,{customLink:D.GetMyTicketsPage()}),e.jsx("h2",{className:"text-medium fw-bold",children:d.isReturnTicket?u(C=>C.ViaggioRitorno):u(C=>C.ViaggioAndata)}),e.jsxs(Bt,{className:"mt-4",children:[e.jsx("div",{className:"col-12 col-lg-12",children:e.jsxs("div",{className:"row border-bottom py-2",children:[e.jsx("div",{className:I?"col-6 col-lg-3 my-1":"col-6 col-lg-4 my-1",children:e.jsx(Ze,{stopId:x.departureId,label:c(C=>C.Partenza),showTimeDay:j,departureDateTime:x.departureDate})}),e.jsx("div",{className:I?"col-6 col-lg-3 my-1":"col-6 col-lg-4 my-1",children:e.jsx(Ze,{stopId:S.arrivalId,label:c(C=>C.Arrivo),showTimeDay:j,departureDateTime:S.arrivalDate})}),I&&e.jsxs("div",{className:"col-6 col-lg-3 my-1 justify-content-end",children:[e.jsx("div",{className:"me-3 fw-bold",children:u(C=>C.TrattaEseguitaDa)}),e.jsx(Fs,{trips:d.parts.map(C=>({carrierId:C.carrierId,departure:C.departureId,arrival:C.arrivalId,vehicleDescription:"",travelMode:C.travelMode,lineId:C.lineId}))})]}),e.jsx("div",{className:"col-6 col-lg-3 my-1",children:e.jsx(qt,{price:d.price-d.reliefAmount,fullPrice:d.price,toPay:d.toPay})})]})}),e.jsxs("div",{className:"row border-bottom py-2 mt-4",children:[e.jsx("div",{className:"col-12 d-flex justify-content-center justify-content-lg-between mb-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"fw-bold text-medium fontsize-15u text-uppercase",children:[d.pnr?"PNR":e.jsx(e.Fragment,{children:u(C=>C.Codice)})," ",d.pnr||d.code]}),u(C=>C.DataDiEmissioe),": ",k.getReadableDateTimeString(d.issueDate)]})}),e.jsx("div",{className:"col-12 col-lg-5",children:e.jsxs("div",{className:"row g-3 align-items-start",children:[b&&e.jsx("div",{className:"col-12 col-md-auto d-flex justify-content-center justify-content-lg-start",children:e.jsx("div",{style:{width:200},children:e.jsx(Ss,{className:"mb-3",text:d.qrCodeContent,size:200})})}),e.jsx("div",{className:"col-12 col-md d-flex justify-content-center justify-content-lg-start",children:e.jsxs("div",{children:[e.jsx(rt,{label:u(C=>C.Passeggero),value:e.jsxs(e.Fragment,{children:[(s=(a=d.passenger)===null||a===void 0?void 0:a.name)!==null&&s!==void 0?s:""," ",(n=(t=d.passenger)===null||t===void 0?void 0:t.surname)!==null&&n!==void 0?n:""]})}),e.jsx(rt,{label:u(C=>C.FareCategory),value:e.jsx(Ye,{id:d.passenger.fareCategoryId})}),d.paymentMethod!=null&&d.paymentMethod!=0&&e.jsx(rt,{label:u(C=>C.MetodoPagamento),value:e.jsx(Yi,{method:d.paymentMethod})}),d.parts.some(C=>!C.hideSeat)&&e.jsx(rt,{label:u(C=>C.PostoNumero),value:d.parts.filter(C=>!C.hideSeat).map(C=>C.seatNumbers.join(",")).join(" - ")})]})})]})}),e.jsx("div",{className:"col-12 col-lg-7 d-flex justify-content-center justify-content-lg-start",children:e.jsxs("div",{style:{minWidth:200},children:[d.passenger.personId&&e.jsx(rt,{label:u(C=>C.Tessera),value:e.jsx(Is,{id:d.passenger.personId,selector:C=>e.jsxs(e.Fragment,{children:["Tessera ",C.code]})})}),e.jsxs("div",{className:"d-flex justify-content-between",children:[e.jsx("div",{className:"d-flex flex-column",children:e.jsx(Ic,{hl:i.hl,data:d.extraData,selector:C=>e.jsx(rt,{label:C.description,value:C.formattedValue},C.key)})}),e.jsx(Yp,{ticket:d})]}),d.reliefDescription&&e.jsx(rt,{label:c(C=>C.Agevolazioni),value:d.reliefDescription})]})})]}),y.length>0&&e.jsxs("div",{className:"row mt-4",children:[e.jsxs("div",{className:"d-flex align-items-center justify-content-center justify-content-lg-between mb-3",children:[e.jsx("div",{children:e.jsx("div",{className:"fw-bold text-medium fontsize-8u text-uppercase",children:c(C=>C.Services)})}),T&&e.jsx("button",{type:"button",className:"btn btn-primary-light fw-bold py-3 px-5 align-items-center d-none d-lg-flex",onClick:()=>o(D.GetManageLuggages(d.id)),children:c(C=>C.AddLuggages)})]}),T&&e.jsx("div",{className:"col-12 d-flex d-lg-none",children:e.jsx("button",{type:"button",className:"btn btn-primary-light fw-bold py-3 px-5 align-items-center w-100 mb-2",onClick:()=>o(D.GetManageLuggages(d.id)),children:c(C=>C.AddLuggages)})}),e.jsx("div",{children:e.jsx(e.Fragment,{children:y.map(C=>e.jsx("div",{children:e.jsx(bh,{count:C.count,faraCategoryId:C.category,showX:!0,children:T&&e.jsx("a",{type:"button",className:"btn btn-link fw-bold",onClick:()=>o(D.GetManageLuggages(d.id,C.category)),children:c(A=>A.Change)})||void 0})}))})})]})||e.jsx("div",{className:"row mt-4",children:e.jsxs("div",{className:"d-flex align-items-center justify-content-center justify-content-lg-between mb-3",children:[e.jsx("div",{}),T&&e.jsx("button",{type:"button",className:"btn btn-primary-light fw-bold py-3 px-5 align-items-center",onClick:()=>o(D.GetManageLuggages(d.id)),children:c(C=>C.AddLuggages)})]})}),l&&e.jsxs("div",{className:"row d-none d-lg-flex",children:[e.jsx("a",{href:m,className:"col-4 btn btn-primary-light btn-lg fw-bold py-2 px-5 d-flex align-items-center justify-content-center",target:"_blank",style:{marginBottom:3,minHeight:50},children:u(C=>C.ScaricaPdf)}),e.jsx("div",{className:"col-6",children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-md-auto",children:e.jsx("a",{href:p,target:"_blank",style:{marginBottom:3},children:e.jsx("img",{src:h,style:{height:50,objectFit:"contain"},alt:"Add to Apple Wallet"})})}),e.jsx("div",{className:"col-md-auto",children:e.jsx("a",{href:g,target:"_blank",style:{marginBottom:3},children:e.jsx("img",{src:f,style:{height:50,objectFit:"contain"},alt:"Add to Google Wallet"})})})]})})]}),l&&e.jsxs("div",{className:"row d-lg-none mt-2 g-2",children:[e.jsx("div",{className:"col-12",children:e.jsx("a",{href:m,className:"btn btn-primary-light d-flex align-items-center justify-content-center fw-bold py-3 px-5 w-100",target:"_blank",rel:"noopener",children:u(C=>C.ScaricaPdf)})}),e.jsx("div",{className:"col-12",children:e.jsxs("div",{className:"row g-2",children:[e.jsx("div",{className:"col-6 text-center",children:e.jsx("a",{href:p,target:"_blank",rel:"noopener",className:"d-block py-2",children:e.jsx("img",{src:h,alt:"Aggiungi ad Apple Wallet",className:"img-fluid",style:{height:50,objectFit:"contain"},draggable:!1})})}),e.jsx("div",{className:"col-6 text-center",children:e.jsx("a",{href:g,target:"_blank",rel:"noopener",className:"d-block py-2",children:e.jsx("img",{src:f,alt:"Aggiungi a Google Wallet",className:"img-fluid",style:{height:50,objectFit:"contain"},draggable:!1})})})]})})]}),d.coupon.length>0&&e.jsxs("div",{className:"row mt-4",children:[e.jsx("div",{className:"d-flex align-items-center justify-content-center justify-content-lg-between mb-3",children:e.jsx("div",{children:e.jsx("div",{className:"fw-bold text-medium fontsize-8u text-uppercase",children:"Coupon"})})}),e.jsx("div",{children:d.coupon.map((C,A)=>{var H=C.isRemainder?"di resto":C.type===1?"sconto":"annullamento",z=C.amount?" - "+C.amount.toFixed(2)+" â¬":" Sconto "+C.percentage+"%",R=e.jsxs("span",{children:[e.jsx("strong",{children:C.id})," ",z]});return C.linkedTicketId&&(R=e.jsxs("span",{children:[e.jsxs("s",{children:[e.jsx("strong",{children:C.id})," ",z]})," utilizzato"]})),e.jsxs("div",{className:"list-group-item",children:[e.jsx("i",{className:"fa fa-id-badge rounded-pill me-1"}),"Coupon "+H,e.jsx("br",{}),e.jsx("i",{className:"fa fa-hashtag me-1"}),R,e.jsx("br",{}),e.jsx("i",{className:"fa fa-exclamation-triangle text-danger me-1"}),"Scade il ",e.jsx("strong",{children:k.getReadableDateTimeString(C.expiryDateTime)})]},A)})})]})]}),e.jsx(ov,{ticket:d})]})})}),cv=ci(et(dv)),Zn=Object.freeze(Object.defineProperty({__proto__:null,PassengerDataValue:rt,default:cv},Symbol.toStringTag,{value:"Module"})),uv=i=>{const{ticketId:a,filter:t,enabledFareCategories:s,allFareCategories:n}=i,r=Cu.useForTicket(a,null)||[],o=Bl(r),d=Vs.use(a);if(!r||!d||!n||!o)return e.jsx(Je,{});const u=r.flatMap(Pu);return e.jsx(Tc,{data:i.luggageSelection.map(c=>{var l,m;const h=o.priced.luggages.find(f=>f.luggageId==c.item.id);return{category:(l=n[c.item.id])!==null&&l!==void 0?l:Qe.GetDefaultFareCategory(),extra:c.item.extraData,extraFares:c.extraFares,price:c.price,faresInfo:h.faresInfo,subGroupId:d.passengerIndex,cardId:(m=c.item.cardId)!==null&&m!==void 0?m:null}}),passengers:[{passenger:d.passenger,subGroupId:d.passengerIndex}],fareableLuggages:u.filter(c=>{var l;const m=(l=s[c.luggageId])!==null&&l!==void 0?l:n[c.luggageId];return m?!t||t(m):(console.warn("Luggage not found in enabled fare categories",c.luggageId),!1)}),onChange:i.onChange,freeLuggagesSlots:o.priced.luggagesSlots,fromCard:i.fromCard,children:i.children})};let mv=yt(eo(uv)(i=>i.allByKey(),"enabledFareCategories"))(i=>i.allByKey(),"allFareCategories");const hv=i=>{const{ticketId:a}=i;return e.jsx(mv,{ticketId:a,onChange:i.onChange,luggageSelection:i.luggageSelection,children:(t,s)=>e.jsxs("div",{children:[s!=null&&e.jsx("div",{children:s}),t!=null&&e.jsx("div",{children:t})]})})},pv=_(hv);var ia=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const vv=yt(_(i=>{var a,t;const[s,n]=P.useState([]),[r,o]=P.useState([]),[d,u]=P.useState(e.jsx(e.Fragment,{})),[c,l]=P.useState(null),[m,h]=P.useState(!1),[f,p]=P.useState(_t),[g,v]=P.useState(null),[x,S]=P.useState(null),[y,b]=P.useState(null),[j,I]=P.useState(null),[N,w]=P.useState(null),[T,C]=P.useState(!1),[A,H]=P.useState(),[z,R]=P.useState(),[M,F]=P.useState(),L=Se(),U=L.id,Y=Vs.use(U),W=L.luggageId;var{formatMessage:E}=i.i18n.get(ne),{formatMessage:Z}=i.i18n.get(Q);const{formatCurrency:de}=i.i18n;if(P.useEffect(()=>{if(console.log("useEffect",Y,W),Y){const G=Y.accompaniedLuggage.find(ve=>ve.id==W);if(G){const ve=[{index:0,selected:!0,value:Bs(G.valueDetail),extraData:G.extraData,forcedPenalty:void 0,id:G.id,cardId:G.cardId}];o(ve),se(ve),u(e.jsxs(e.Fragment,{children:[E(ge=>ge.Change)," ",ve.map((ge,ee)=>e.jsxs(e.Fragment,{children:[e.jsx(Ye,{id:ge.id,hl:i.hl},ee),ee<ve.length-1&&", "]}))," ",E(ge=>ge.With),":"]}))}else u(E(ve=>ve.AddLuggages))}else u(E(G=>G.AddLuggages))},[Y,W]),!Y)return e.jsx(Je,{});const ue=G=>ia(void 0,void 0,void 0,function*(){const{items:ve,hasUnavailable:ge}=yield Du(U,G);ge&&Re.fire({title:E(ee=>ee.ServiceOrLuggageNotAvailable),icon:"error"}),n(ve)}),O=()=>{const G=Oe.calculateLuggageOperationAmount(Y.isPayed,Y.toPay,r,s);return G<0&&(j!=null&&j.DoNotRefund)?0:G},se=G=>ia(void 0,void 0,void 0,function*(){var ve=null;try{Y&&(ve=yield xe.getCancelTicketLuggagesPreviewForBooking(Y.id,G.filter(ge=>ge.selected).map(ge=>ge.id)))}catch{o([]),Re.fire(E(ee=>ee.Attenzione),E(ee=>ee.NonPuoiCambiareServizi),"error")}I(ve),w(null)}),ae=(G,ve)=>ia(void 0,[G,ve],void 0,function*([ge,ee],$e){m!=ee&&(h(ee),l(null),p(_t),v(null),S(null),b(null)),(f.paymentDataId!=$e.paymentDataId||$e.savePaymentData!=f.savePaymentData||ge!=c)&&(l(ge),p($e),v(null),v(null),S(null),b(null)),I(null),w(null)}),be=()=>{const G=O(),ve=r.filter(ee=>ee.selected),ge=s.map(ee=>ee.item);if(ge.length===0&&ve.length===0)return Re.fire(E(ee=>ee.Attenzione),E(ee=>ee.AlmenoUnServizio),"warning"),!1;if(ve.length==1&&ge.length>1)return Re.fire(E(ee=>ee.Attenzione),E(ee=>ee.SoloUnServizio),"warning"),!1;if(G<0){if(N==null)return Re.fire(E(ee=>ee.Attenzione),E(ee=>ee.SelezionaModalitaRimborso),"warning"),!1;if(N.mode===2&&(!A||A.length<3||!M||M.length<3||yr.Validate(A,!0)===!1||A&&A.substring(0,2).toUpperCase()!=="IT"&&!z))return Re.fire(E(ee=>ee.Attenzione),E(ee=>ee.InserisciDatiBonifico),"warning"),!1}else if(G>0&&c==null)return Re.fire(E(ee=>ee.Attenzione),E(ee=>ee.SelezionaModalitaPagamento),"warning"),!1;return!0},pe=G=>ia(void 0,void 0,void 0,function*(){var ve,ge,ee;if(!be())return;const $e=D.GetTicketDetail(U),B=D.GetManageLuggagesKo(U),je=we($e),Le=we(B),jt=O();try{if(jt===0){const St={TicketId:U,ToAdd:s.map(Jt=>Jt.item),ToRemove:r.filter(Jt=>Jt.selected),PaymentData:void 0,RefundData:void 0,callingCode:i.user.callingCode,ph
18oneNumber:i.user.phoneNumber,email:i.user.email};C(!0),yield xe.modifyTicketLuggagesOnATicketForBooking(St),yield xe.getManyAnonymous([U]),yield xe.ticketDetail(U),C(!1),i.history($e,{replace:!0})}else if(jt>0){let St=null;var mi=void 0;(c==null?void 0:c.type)==4&&(St=g),(c==null?void 0:c.type)==3&&(St=x,mi=f.savePaymentData&&y||void 0);const Jt={TicketId:U,ToAdd:s.map(Nt=>Nt.item),ToRemove:r.filter(Nt=>Nt.selected),PaymentData:{PaymentDataId:f.paymentDataId||void 0,PaymentMethod:c.type,SavePaymentData:f.savePaymentData,KoUrl:Le,OkUrl:je,addressData:void 0,useWallet:m,transactionCode:void 0,clientIntegrationPaymentId:St||void 0,numContratto:mi,nexiApmResponse:G},RefundData:void 0,callingCode:i.user.callingCode,phoneNumber:i.user.phoneNumber,email:i.user.email};C(!0);const Ti=yield xe.modifyTicketLuggagesOnATicketForBooking(Jt);yield xe.getManyAnonymous([U]),yield xe.ticketDetail(U);let _i=!0;C(!1),Ti.redirect&&(_i=yield st(Ti.redirect,i.history)),_i?i.history($e,{replace:!0}):i.history(B,{replace:!0})}else if(jt<0){let St=[];if(N){const Nt=ye(N.details,ki=>ki.residualAmount);if(Nt>0&&Nt<jt){let ki=jt;for(const $a of N.details)ki-=$a.residualAmount,St.push({amount:$a.residualAmount,mode:N.mode,transactionCode:$a.transactionCode,iban:A,bic:z,fullName:M});ki>0&&St.push({amount:ki,mode:1,transactionCode:void 0,iban:"",bic:"",fullName:""})}else St.push({amount:Math.abs(jt),mode:N.mode,transactionCode:(ee=(ge=(ve=N.details)===null||ve===void 0?void 0:ve[0])===null||ge===void 0?void 0:ge.transactionCode)!==null&&ee!==void 0?ee:void 0,iban:A,bic:z,fullName:M})}const Jt={TicketId:U,ToAdd:s.map(Nt=>Nt.item),ToRemove:r.filter(Nt=>Nt.selected),PaymentData:void 0,RefundData:St,callingCode:i.user.callingCode,phoneNumber:i.user.phoneNumber,email:i.user.email};C(!0);const Ti=yield xe.modifyTicketLuggagesOnATicketForBooking(Jt);yield xe.getManyAnonymous([U]),yield xe.ticketDetail(U);let _i=!0;C(!1),Ti.redirect&&(_i=yield st(Ti.redirect,i.history)),_i?i.history($e,{replace:!0}):i.history(B,{replace:!0})}}finally{C(!1)}}),oe=O(),le=oe<0&&N||oe==0,me=s.length>0&&oe<=0&&le||kt.canProceed(c,g,x,f.subPaymentMethod,f.paymentDataId),vt=()=>Pe.IsGooglePay(f)?"GOOGLEPAY":Pe.IsApplePay(f)?"APPLEPAY":null,Ae=Pe.IsGooglePay(f),nt=Pe.IsApplePay(f);return e.jsxs(re,{title:E(G=>G.ManageLuggages),fullWidth:!0,children:[e.jsx(Ie,{title:d||E(G=>G.AddLuggages),children:e.jsx(pv,{ticketId:U,onChange:ue,luggageSelection:s})}),(L.luggageId&&r.length>0&&s.length>0&&oe!==0||s.length>0&&oe>0)&&e.jsxs(Ie,{title:oe<0?Z(G=>G.SelezionaModalitaRimborso):Z(G=>G.ConfermaOperazione),children:[j!=null&&oe<0&&j.cancelPreview.length>0&&e.jsx("div",{className:"d-flex flex-column justify-content-end",children:e.jsx(Xo,{refundDue:Math.abs(oe),data:j.cancelPreview.map(G=>({mode:G.mode,amountRefunded:G.amount,details:G.details,penaltyDetailsDto:[],maxRefundable:G.amount})),selected:(N==null?void 0:N.mode)||null,onChange:G=>{const ve=j.cancelPreview.find(ge=>ge.mode==G.mode);w(ve)},iban:A,bic:z,fullName:M,onChangeIban:H,onChangeBic:R,onChangeFullName:F,walletAmountToRefund:null})}),oe>0&&e.jsx("div",{children:e.jsx(_c,{price:oe,departureDate:(t=Y.leastDepartureDateTime)!==null&&t!==void 0?t:Y.parts[0].departureDate,carriers:Y.parts.map(G=>G.carrierId),onChangePaymentMethod:ae,additionalData:f,selectedPaymentMethod:[c,m],walletRechargeLink:"#",i18n:i.i18n,saleChannel:0,payPalProceed:G=>v(G),payPalRequest:{addLuggages:c&&{ticketId:Y.id,luggagesToAddIds:s.map(G=>G.item.id),luggagesToRemoveIds:r.map(G=>G.id),useWallet:m,paymentMethod:c.type,toPay:oe}||void 0},clientIntegrationPaymentId:g,payPalFullWidth:!0,hasCommissionKept:!1,nexiBuildProceed:(G,ve)=>{S(G),b(ve)},nexiBuildRequest:{addLuggages:c&&{ticketId:Y.id,luggagesToAddIds:s.map(G=>G.item.id),luggagesToRemoveIds:r.map(G=>G.id),useWallet:m,paymentMethod:c.type,toPay:oe}||void 0},nexiClientIntegrationPaymentId:x})})]}),(Ae||nt)&&me&&e.jsx(Ts,{type:vt(),request:{addLuggages:c&&{ticketId:Y.id,luggagesToAddIds:s.map(G=>G.item.id),luggagesToRemoveIds:r.map(G=>G.id),useWallet:m,paymentMethod:c.type,toPay:oe}||void 0},metadata:((a=c==null?void 0:c.metadata)===null||a===void 0?void 0:a.type)=="creditCard"?c==null?void 0:c.metadata:void 0,apmProceed:G=>pe(G),clientIntegrationPaymentId:void 0,onChangePaymentMethod:()=>{},isSelectedPaymentMethod:(c==null?void 0:c.type)===3&&(Ae||nt),savePaymentData:!1,paymentDataId:null})||e.jsx(Pa,{className:"btn btn-primary btn-lg btn-highlight d-flex align-items-center justify-content-center fw-bold fontsize-5u py-3 w-100 mb-3",onClick:()=>pe(void 0),disabled:!me||T==!0,children:oe>0?`${E(G=>G.Paga)} ${de(oe)}`:E(G=>G.Continua)})]})}))(i=>
18i.getall(),"allCategories"),gv=_a(Be(vv)),fv=Object.freeze(Object.defineProperty({__proto__:null,default:gv},Symbol.toStringTag,{value:"Module"})),xv=_(i=>{const a=Se();var{formatMessage:t}=i.i18n.get(ne);return e.jsx(re,{title:t(s=>s.ManageLuggages),fullWidth:!0,children:e.jsxs(Ie,{title:t(s=>s.AddLuggagesOkTitle),children:[e.jsx("div",{className:"d-flex justify-content-center justify-content-lg-between mb-3",children:t(s=>s.AddLuggagesOkText)}),e.jsx("div",{className:"row border-top mt-3 pt-4 pb-3 align-items-center",children:e.jsx("div",{className:"w-100 d-flex flex-wrap align-items-center justify-content-md-end",children:e.jsxs(Mt,{link:D.GetTicketDetail(a.id),alertTitle:`${t(s=>s.Biglietto)}}`,disabled:!1,children:[e.jsx("i",{className:"fa-solid fa-qrcode me-2"}),t(s=>s.BackToTicket)]})})})]})})}),bv=Object.freeze(Object.defineProperty({__proto__:null,default:xv},Symbol.toStringTag,{value:"Module"})),yv=_(ci(et(i=>{const a=Se();var{formatMessage:t}=i.i18n.get(ne);const s=yi.useBooking(a.id);if(!s)return e.jsx(Je,{});const n=Oe.canPayToBePayed([s],i.roles);return e.jsx(re,{title:t(r=>r.ManageLuggages),fullWidth:!0,children:e.jsxs(Ie,{title:t(r=>r.AddLuggagesKoTitle),children:[e.jsx("div",{className:"d-flex justify-content-center justify-content-lg-between mb-3",children:t(r=>r.AddLuggagesKoText)}),e.jsx("div",{className:"row border-top mt-3 pt-4 pb-3 align-items-center",children:e.jsxs("div",{className:"w-100 d-flex flex-wrap align-items-center justify-content-md-end",children:[n&&e.jsxs(Uo,{link:D.GetPayToBePayedUrl(s.groupid),alertMessage:t(r=>r.RetryPayment),disabled:!1,children:[e.jsx("i",{className:"fa-solid fa-repeat me-2"}),t(r=>r.RetryPayment)]}),e.jsxs(Mt,{link:D.GetTicketDetail(a.id),alertTitle:`${t(r=>r.Biglietto)}}`,disabled:!1,children:[e.jsx("i",{className:"fa-solid fa-qrcode me-2"}),t(r=>r.BackToTicket)]})]})})]})})}))),jv=Object.freeze(Object.defineProperty({__proto__:null,default:yv},Symbol.toStringTag,{value:"Module"}));var gi=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Sv=()=>{const a=Se().id;P.useEffect(()=>{K.clear(),J().clear()},[]);const t=It(()=>gi(void 0,void 0,void 0,function*(){const n=yield xe.ticketGroupDetailedByIdForChangeDate(a),r=n.tickets[0].groupid,o=yield xe.ticketGroup(r);return{sameDirectionTickets:n,ticketGroup:o}}),[a]);if(t==null)return e.jsx(X,{});const s=t.sameDirectionTickets.tickets.find(n=>n.id==a);return s?e.jsx(rl,{masterTicket:s,sameDirectionTickets:t.sameDirectionTickets.tickets.filter(n=>!n.isCanceled&&!n.expired),ticketGroup:t.ticketGroup.tickets}):null},rl=i=>{const{masterTicket:a,sameDirectionTickets:t,ticketGroup:s}=i,[n,r]=P.useState([]),o=()=>gi(void 0,void 0,void 0,function*(){const u=t.filter(c=>c.passenger.personId).map(c=>c.passenger.personId);if(u.length>0){const c=yield Ve.getManyAccumulated(u);r(c)}});jr(()=>{o()},[t.map(u=>u.id)]);const d=t.map(u=>({ticket:u,person:u.passenger.personId?n.find(c=>c.id==u.passenger.personId):void 0}));return e.jsx(wv,{masterTicket:a,sameDirectionTickets:d,ticketGroup:s})},La=_(i=>{const{ticket:a,selected:t,onClick:s}=i,n=Oe.getTicketValidParts(a),r=n[0],o=n[n.length-1];return e.jsxs("div",{className:`col-12 col-lg-auto bg-white shadow d-flex justify-content-lg-between align-items-center p-3 clickable border rounded ${t?"border border-3 border-primary":""}`,onClick:s,children:[e.jsxs("div",{className:"me-3 d-flex align-items-center",children:[s&&e.jsx("i",{className:`fa-regular fa-2x ${t?"fa-square-check text-success":"fa-square"} me-2`}),e.jsx("span",{className:"fw-bold fontsize-5u",children:a.passengerIndex+1})]}),e.jsxs("div",{children:[e.jsx("div",{className:"fw-bold text-medium",children:a.itemType==2?e.jsx(kc,{vehicleId:a.passenger.fareCategoryId,extraData:a.extraData}):e.jsxs(e.Fragment,{children:[a.passenger.name," ",a.passenger.surname]})}),e.jsx("div",{children:r&&o&&e.jsx(ht,{id:r.departureId,selector:d=>e.jsx(ht,{id:o.arrivalId,selector:u=>e.jsxs("div",{className:"fontsize-3d text-uppercase",children:[e.jsxs("div",{children:[d.shortDescription.substring(0,4)," ",e.jsx("i",{className:"fas fa-arrow-right mx-1"}
18)," ",u.shortDescription.substring(0,4)]}),e.jsx("div",{children:k.getShortFriendlyDate(r.departureDate,i.hl,{timezone:d.timezone})})]})})})})]})]})}),Nv=yt(Iu(_(i=>{const{masterTicket:a,loginStatus:t,sameDirectionTickets:s,allCategories:n,reservation:r,ticketGroup:o}=i,d=_e(),[u,c]=P.useState({selectedTickets:s,date:Temporal.Now.plainDateISO()}),{selectedTickets:l,date:m}=u,{formatMessage:h}=i.i18n.get(ne),f=j=>gi(void 0,void 0,void 0,function*(){const I=l.findIndex(T=>T.ticket.id==j.ticket.id);let N=[];I>=0?N=l.length>1?[...l.slice(0,I),...l.slice(I+1)]:[...l]:N=[...l,j],c(Object.assign(Object.assign({},u),{selectedTickets:ni(N,T=>T.ticket.id)}));const w=K.getSolution();if(w!=null){if(N.every(T=>T.ticket.itemType!=0)){Re.fire(h(T=>T.ChangeDateVehicleOnly));return}yield x(N,w)}}),p=()=>gi(void 0,void 0,void 0,function*(){l.length>0&&d(D.GetChangeDatePaymentMethod(l.map(j=>j.ticket.id)))});if((t==null?void 0:t.data)==null)return null;const g=Fe.FromPassengers(l.map(j=>({passenger:j.ticket.passenger,subGroupId:j.ticket.passengerIndex})),n),v=j=>gi(void 0,void 0,void 0,function*(){var I;if(l.some(w=>w.person!=null&&!Ne.isActive(w.person,j.trips[0].departureDateTime))){Re.fire(h(w=>w.ChangeDateCardNotValid));return}if(l.every(w=>w.ticket.itemType!=0)){Re.fire(h(w=>w.ChangeDateVehicleOnly));return}for(const w of l){const T=s.find(C=>C.ticket.id==w.ticket.id).ticket;if(T.changeDateMaxAllowedDeparture!=null&&T.changeDateMaxAllowedDeparture<j.trips[0].departureDateTime){Re.fire(h(C=>C.ChangeDateMaxAllowedDepartureExceeded(T.code,k.getReadableDateTimeString(T.changeDateMaxAllowedDeparture))));return}}for(const w of l)if(w.ticket.isRoundTripSale&&w.ticket.returnWithinDays!=null){const T=s.find(z=>z.ticket.id==w.ticket.id).ticket,C=o.find(z=>z.isReturnTicket!=T.isReturnTicket&&z.passengerIndex==T.passengerIndex),A=(I=Oe.getDepartureDate(C))!==null&&I!==void 0?I:k.Today(),H=Oe.getLimitedARPeriod(T.returnWithinDays,A);if(H&&!H.contains(j.trips[0].departureDateTime)){const z=T.returnWithinDays?h(R=>R.ChangeDateRoundTripRuleWithinDays(T.code,T.returnWithinDays)):h(R=>R.ChangeDateRoundTripRuleSameDay(T.code));Re.fire(z);return}}if(Oe.hasSameTravelSpecs(l[0].ticket,j)){Re.fire(h(w=>w.ChangeDateSameTrip));return}yield x(l,j),K.setSolution(j)}),x=(j,I)=>gi(void 0,void 0,void 0,function*(){const N=Hi(j,w=>w.ticket.id).map(w=>({passenger:Object.assign(Object.assign({},w.ticket.passenger),{extraData:w.ticket.extraData}),tickets:[{ticketId:w.ticket.id,solution:I}]}));yield Me.createOrUpdateForChangeDate(N,1,a.groupid)}),S=j=>e.jsx(ba,Object.assign({},j,{selectedFareCategories:g,subscriptionReservation:l.some(I=>I.ticket.subscriptionId!=null)})),y=l.find(j=>j.ticket.isRoundTripSale&&j.ticket.returnWithinDays==0),b=y!=null?k.ToPlainDate(Oe.getTicketValidParts(y.ticket)[0].departureDate):void 0;return e.jsxs("div",{className:"container",children:[e.jsxs("div",{className:"my-3",children:[e.jsx("div",{className:"form-label mb-2",children:h(j=>j.SelectTicketToChangeTrip)}),e.jsx("div",{className:"row align-items-center flex-wrap p-3",style:{gap:15},children:s.map(j=>e.jsx(La,{ticket:j.ticket,selected:l.some(I=>I.ticket.id==j.ticket.id),onClick:()=>f(j)},j.ticket.id))})]}),e.jsx(Ii,{proceed:p,canProceed:l.length>0&&r!=null,entranceAnimation:!0,showNavigation:!0,canProceedWithApm:!0,useWallet:!1,children:e.jsx(ht,{id:a.departureId,selector:j=>e.jsx(ht,{id:a.arrivalId,selector:I=>e.jsx(ls,{departure:j.localityId,arrival:I.localityId,selectedDate:b??m,selectedPassengers:g,onSelectSolution:v,ticketIndex:0,minimumDate:Temporal.Now.plainDateISO(),selectedSolution:K.getSolution(),channel:1,travelSolutionTemplate:S,onChangeDate:N=>c(Object.assign(Object.assign({},u),{date:N})),reservationId:r==null?void 0:r.reservationId,hideCarousel:b!=null,skipPrice:l.some(N=>N.ticket.subscriptionId!=null),locale:i.hl,isReturn:!1,changeDate:!0,useReservedSeats:!1})})})})]})})))(i=>i.getall(),"allCategories"),wv=fe(Nv,J(),i=>({reservation:i.get()})),Cv=Object.freeze(Object.defineProperty({__proto__:null,ChangeDateTicketGroupWithPersons:rl,TicketButton:La,default:Sv},Symbol.toStringTag,{value:"Module"}));var Xn=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Pv=i=>{var a,t,s;const{useWallet:n,onChangeUseWallet:r,changeDate:o}=i,d=(g,v)=>Xn(void 0,[g,v],void 0,function*([x,S],y){var b,j,I,N;const{reservation:w}=i;n!=S&&r(S),((b=i.expirationDate)===null||b===void 0?void 0:b.valueOf())!=((j=y.expirationDate)===null||j===void 0?void 0:j.valueOf())&&i.onChooseExpirationDate(y.expirationDate),(y.paymentDataId!=(w==null?void 0:w.paymentDataId)||y.savePaymentData!=(w==null?void 0:w.savePaymentData)||(x==null?void 0:x.type)!=w.paymentMethod)&&(yield Me.selectPaymentMethod((I=x==null?void 0:x.type)!==null&&I!==void 0?I:0,(N=y.paymentDataId)!==null&&N!==void 0?N:void 0,y.savePaymentData,y.subPaymentMethod||void 0),i.nexiClientIntegrationPaymentId&&i.nexiBuildProceed&&(x==null?void 0:x.type)!==3&&i.nexiBuildProceed(null,null)),x==null&&(i.nexiClientIntegrationPaymentId&&i.nexiBuildProceed&&i.nexiBuildProceed(null,null),i.payPalClientIntegrationPaymentId&&i.payPalProceed&&i.payPalProceed(null))}),{price:u,reservation:c}=i,[l,m]=P.useState([]),h=()=>Xn(void 0,void 0,void 0,function*(){var g;const v=yield Tu.getForReservation((g=i.reservation)===null||g===void 0?void 0:g.reservationId,o);m(v)});P.useEffect(()=>{h()},[i.reservation,i.changeDate]);const{paymentMethodMetadata:f}=c,p=(f==null?void 0:f.type)=="paypal"||(f==null?void 0:f.type)=="creditCard"?f:void 0;return e.jsx(e.Fragment,{children:e.jsx(Ac,{onChangePaymentMethod:d,selectedPaymentMethod:[(a=l.f
18ind(g=>g.type==(c==null?void 0:c.paymentMethod)))!==null&&a!==void 0?a:null,n],price:u??c.price,hasCommissionKept:((t=c.commissionsKept)!==null&&t!==void 0?t:0)>0,rechargeLink:D.RechargePath,data:l,additionalData:{paymentDataId:(s=c.paymentDataId)!==null&&s!==void 0?s:null,savePaymentData:c.savePaymentData,expirationDate:i.expirationDate,subPaymentMethod:c.subPaymentMethod=="gpay"||c.subPaymentMethod=="applepay"?c.subPaymentMethod:null},onNeedsFetch:h,canChooseExpiration:i.canChooseExpiration||!1,fromChangeDate:i.changeDate,payPalRequest:i.payPalRequest,payPalProceed:i.payPalProceed,addressData:i.addressData,billingAddressSelector:i.billingAddressSelector,paymentMethodMetadata:p,paypalClientIntegrationPaymentId:i.payPalClientIntegrationPaymentId,nexiBuildProceed:i.nexiBuildProceed,nexiBuildRequest:i.nexiBuildRequest,nexiClientIntegrationPaymentId:i.nexiClientIntegrationPaymentId})})},Dv=_(Pv),ol=fe(Dv,J(),i=>({reservation:i.get()}));function Ea(i){return i.trip.canSelectSeat}const dn=i=>{var a;return e.jsx("i",{className:`fa-solid fa-arrow-right ${(a=i.className)!==null&&a!==void 0?a:""}`,style:{color:"#212121",opacity:"0.4"}})};_(i=>{const{formatMessage:a}=i.i18n.get(ie);return i.seats.length>0?e.jsx("div",{style:{borderLeft:"5px solid #DCDDDE",paddingLeft:5},children:e.jsxs("div",{children:[e.jsx(vi.Seat,{style:{marginRight:3}}),e.jsxs("span",{className:"badge bg-info",style:{marginRight:10},children:[i.seats.length>1?a(t=>t.Seats):a(t=>t.Seat),": ",i.seats.join(",")]})]})}):null});const Iv=i=>{if(!i.solution||i.solution.length<=0)return e.jsx("div",{});const{formatMessage:a}=i.i18n.get(ie),t=i.solution[0],s=i.solution[i.solution.length-1];return e.jsx(ht,{id:t.departureId,selector:n=>{var r;return e.jsxs("div",{className:"me-2",children:[e.jsx("div",{className:"mb-1",children:e.jsx("span",{className:"fw-bold",children:(r=i.label)!==null&&r!==void 0?r:a(o=>o.Travel)})}),e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:"me-1 fw-bold",children:n.shortDescription}),e.jsx("div",{children:e.jsx(dn,{className:"me-1"})}),e.jsx("div",{className:"me-2 fw-bold border-end border-2 pe-2",children:e.jsx(Ge,{id:s.arrivalId})}),e.jsx("i",{className:"fa-solid fa-calendar me-2",style:{color:"#212121",opacity:"0.4"}}),e.jsxs("div",{className:"fw-bold me-2 text-nowrap",children:[k.getDayOfMonth(t.departureTime,i.hl,{timezone:n.timezone})," ",k.getMonthName(t.departureTime,i.hl,{timezone:n.timezone})," ",k.getYear(t.departureTime,i.hl,{timezone:n.timezone})]}),e.jsx("i",{className:"fa-solid fa-clock me-2 text-gray",style:{color:"#212121",opacity:"0.4"}}),e.jsx("div",{className:"fw-bold me-2",children:k.getReadableTimeString(t.departureTime,{timezone:n.timezone})})]})]})}})};_(Iv);const Qa=_(i=>{const{formatMessage:t}=i.i18n.get(ne),s=i.trips.map(n=>n.trip);return e.jsxs("table",{className:"table align-middle table-borderless",style:{maxWidth:200+i.trips.length*70},children:[e.jsxs("thead",{children:[i.showTableTitle&&e.jsxs("tr",{children:[e.jsx("th",{}),mt(it(i.trips,n=>n.description),(n,r)=>e.jsx("th",{colSpan:n.length,className:"text-center",children:r},"header"+r))]}),e.jsxs("tr",{children:[e.jsx("th",{style:{maxWidth:250},children:t(n=>n.Passengers)}),s.map(n=>e.jsxs("th",{className:"text-uppercase text-nowrap text-center",children:[e.jsx(ht,{id:n.departureStopId,selector:r=>r.shortDescription.substring(0,3)}),e.jsx(dn,{className:"mx-1"}),e.jsx(ht,{id:n.arrivalStopId,selector:r=>r.shortDescription.substring(0,3)})]},"seat_"+n.trip.tripId))]})]}),e.jsx("tbody",{children:i.passengers.map((n,r)=>e.jsxs("tr",{children:[e.jsx("td",{children:n.name&&n.surname&&n.name.concat(" ").concat(n.surname)||`${t(o=>o.Passenger)} ${r+1}`}),s.map(o=>{var d,u,c,l,m;const h=(u=(d=i.reservation.passengerReservations[r])===null||d===void 0?void 0:d.tickets)===null||u===void 0?void 0:u.find(g=>g.segments.some(v=>v.tripId===o.trip.tripId)),f=h==null?void 0:h.segments.find(g=>g.tripId==o.trip.tripId),p=(l=f==null?void 0:f.seatChosen)!==null&&l!==void 0?l:!1;return e.jsx("td",{className:"text-center",children:p?e.jsx("div",{className:"badge bg-success fontsize-1u",children:(m=(c=f==null?void 0:f.seatNumbers)===null||c===void 0?void 0:c.join(","))!==null&&m!==void 0?m:"-"}):e.jsx("div",{className:"badge fontsize-1u",children:"-"})},r+o.trip.tripId)})]},n.name+n.surname+r))})]})}),Tv=et(ci(_(i=>{var a,t,s,n;const{formatMessage:r}=i.i18n.get(Q),{formatMessage:o}=i.i18n.get(He),{reservation:d,roles:u}=i;if(!d||!u.some(h=>h==Xi.piantinebus.read.name))return null;const c=[...i.outboud.trips,...(s=(a=i.inbound)===null||a===void 0?void 0:a.trips)!==null&&s!==void 0?s:[]].filter(h=>Ea(h)).map(h=>h.trip.tripId);if(c.length==0)return null;if(!d.passengerReservations.some(h=>h.tickets.some(f=>f.segments.filter(p=>c.indexOf(p.tripId)!=-1).some(p=>p.seatChosen==!0))))return e.jsx(Ie,{title:r(h=>h.PreferenzePerIlPosto),icon:e.jsx(vi.Seat,{}),children:e.jsxs("div",{className:"row align-items-center",children:[e.jsxs("div",{className:"col-12 col-lg-9",children:[e.jsxs("div",{className:"fontsize-5u",children:[r(h=>h.SelectSeatTitle),"."]}),e.jsxs("div",{children:[e.jsx("span",{className:"badge bg-warning text-uppercase me-1",children:o(h=>h.Attenzione)})," ",r(h=>h.SelectSeatDisclaimer)]})]}),e.jsx("div",{className:"col-12 col-lg-3",children:e.jsxs(at,{className:"btn btn-primary-light fw-bold w-100",to:D.GetSeatSelectionPath(!1,i.redirectUrl),children:[e.jsx(vi.Seat,{color:"primary",className:"me-2"})," ",r(h=>h.PreferenzePerIlPosto)]})})]})});const m=d.passengerReservations.some(h=>h.tickets.some(f=>f.segments.filter(p=>c.indexOf(p.tripId)!=-1).some(p=>p.seatChosen==!1)));return e.jsxs(Ie,{title:"Selezione posto",icon:e.jsx(vi.Seat,{}),children:[e.jsx("div",{className:"d-none d-lg-block",children:e.jsx(Qa,{passengers:i.passengers,reservation:d,showTableTitle:!0,trips:[...i.outboud.trips.map(h=>({description:r(f=>
18f.ViaggioAndata),trip:h})),...(n=(t=i.inbound)===null||t===void 0?void 0:t.trips.map(h=>({description:r(f=>f.ViaggioRitorno),trip:h})))!==null&&n!==void 0?n:[]]})}),e.jsxs("div",{className:"d-block d-lg-none table-responsive",children:[e.jsx("div",{className:"fw-bolder text-medium fontsize-5u mb-2",children:r(h=>h.ViaggioAndata)}),e.jsx(Qa,{passengers:i.passengers,reservation:d,trips:i.outboud.trips.map(h=>({description:r(f=>f.ViaggioAndata),trip:h}))}),i.inbound&&e.jsxs("div",{children:[e.jsx("div",{className:"fw-bolder text-medium fontsize-5u mb-2",children:r(h=>h.ViaggioRitorno)}),e.jsx(Qa,{passengers:i.passengers,reservation:d,trips:i.inbound.trips.map(h=>({description:r(f=>f.ViaggioRitorno),trip:h}))})]})]}),e.jsx("div",{className:"row justify-content-end",children:e.jsx("div",{className:"col-lg-3",children:e.jsxs(at,{className:"btn btn-primary-light fw-bold w-100 py-2",to:D.GetSeatSelectionPath(!1,i.redirectUrl),children:[e.jsx(vi.Seat,{className:"me-2",color:"primary"}),e.jsx("span",{children:r(m?h=>h.ScegliPosto:h=>h.ModificaPosti)})]})})})]})}))),ll=fe(Tv,J(),i=>({reservation:i.get(),passengers:i.passengers}));var Ja=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const _v=i=>{const a=Vs.use(i.ticketId);return a==null?null:e.jsx(La,{ticket:a,selected:!0,onClick:()=>{}})};class dl extends P.Component{constructor(a){super(a),this.errorDiv=P.createRef(),this.refresh=()=>Ja(this,void 0,void 0,function*(){const t=J().get(),s=t&&t.reservationExpiryDate||null;this.setState({expiryDate:s,reservation:t})}),this.onAcceptRules=t=>this.setState({rulesAccepted:t}),this.setError=t=>{this.setState({submitError:t},()=>{var s,n;return(n=(s=this.errorDiv)===null||s===void 0?void 0:s.current)===null||n===void 0?void 0:n.scrollIntoView({behavior:"smooth"})})},this.validate=()=>{const{formatMessage:t}=this.props.i18n.get(Q);return this.state.rulesAccepted?!0:(this.setError(t(s=>s.Errore_TermsAndConditions)),!1)},this.proceed=t=>Ja(this,void 0,void 0,function*(){const{formatMessage:s}=this.props.i18n.get(Q),n=this.props.params.id.split(","),{reservation:r}=this.state;if(n&&n.length>0&&r){const u=r.changeDateDetail?r.changeDateDetail.tobepayed:0;if(u>0&&!r.paymentMethod){this.setError(s(l=>l.Errore_selezionaMetodoPagamento));return}if(!this.validate()){this.setError(s(l=>l.Errore_TermsAndConditions));return}this.setState({loading:!0});var o=null,d=void 0;r.paymentMethod==4&&(o=this.state.payPalclientIntegrationPaymentId),r.paymentMethod==3&&(o=this.state.nexiBuildClientIntegrationPaymentId,d=r.savePaymentData&&this.state.nexiNumContratto||void 0);const c={ticketIds:n,reservationId:r.reservationId,expectedPayment:u,okUrl:we(D.GetChangeDateResult(n)),koUrl:we(D.GetChangeDateKo(n)),callingcode:this.props.user.callingCode,phone:this.props.user.phoneNumber,email:this.props.user.email,sendSms:!1,addressData:void 0,requestedExpiration:void 0,clientIntegrationPaymentId:o??void 0,payByLinkUrl:void 0,numContratto:d,nexiApmResponse:t,useWallet:this.state.useWallet};try{const l=yield xe.CHANGE_DATE(c);let m=!0;l.redirect&&(li.clear(),m=yield st(l.redirect,this.props.history)),m&&l.result&&(li.clear(),this.props.history(D.GetChangeDateResult(n)))}catch(l){this.setState({loading:!1}),l.message.indexOf("InvalidSubscriptionReservationException")>-1?xt.error(s(m=>m.Errore_DataNonRientraAbbonamento)):xt.error(s(m=>m.Errore_ritenta))}this.setState({loading:!1})}}),this.state={passengers:J().getPassengers()||[],reservation:J().get(),loading:!1,redirectingForExternalPayments:!1,redirectingForInternalPayments:!1,expiryDate:null,summaryVisible:!1,useWallet:!1,expirationDate:null,rulesAccepted:!1,submitError:null,payPalclientIntegrationPaymentId:null,nexiBuildClientIntegrationPaymentId:null,nexiNumContratto:null}}componentDidMount(){return Ja(this,void 0,void 0,function*(){if(!this.state.reservation){this.props.history(D.TravelSelection(),{replace:!0});return}if(!K.getSolution()){this.props.history(D.TravelSelection(),{replace:!0});return}const a=this.state.reservation.changeDateDetail;if(a&&a.calculatedPenalty==this.state.reservation.fullPrice&&a.calculatedPenalty>0){const{formatMessage:n}=this.props.i18n.get(ne);if(!(yield Re.fire({title:n(o=>o.ChangeDateFullPenaltyTitle),text:n(o=>o.ChangeDateFullPenaltyWarning),icon:"warning",confirmButtonText:n(o=>o.Conferma),showCancelButton:!0,cancelButtonText:n(o=>o.Cancel)})).isConfirmed){this.props.history(-1);return}}const t=this.state.reservation.changeDateDetail?this.state.reservation.changeDateDetail.tobepayed:0;var s=kt.canProceedReservationAndPrice(t,this.state.reservation,this.state.payPalclientIntegrationPaymentId,this.state.nexiBuildClientIntegrationPaymentId);s&&(yield this.proceed()),J().Changed.register(this.refresh),this.refresh()})}componentWillUnmount(){J().Changed.unregister(this.refresh)}render(){var a,t,s;const{formatMessage:n}=this.props.i18n.get(ne),r=this.props.i18n.get(Q).formatMessage,o=this.props.i18n.get(He).formatMessage,{formatMessage:d}=this.props.i18n.get(He),u=(s=(a=this.props.params.id)===null||a===void 0?void 0:a.split(","))!==null&&s!==void 0?s:[],{reservation:c,redirectingForExternalPayments:l,redirectingForInternalPayments:m,loading:h}=this.state;if(h)return e.jsx(X,{});if(!c)return e.jsx(X,{});if(l)return e.jsx(X,{label:r(v=>v.WaitForRedirectToPayment)});if(m)return e.jsx(X,{label:r(v=>v.WaitForInternalPayment)});const f=J().GetAmountToShow(void 0),p=J().getSolutions();var g=kt.canProceedReservationAndPrice(f,c,this.state.payPalclientIntegrationPaymentId,this.state.nexiBuildClientIntegrationPaymentId);return e.jsxs(Ii,{proceed:v=>this.proceed(v),canProceed:g,showNavigation:!0,canProceedWithApm:this.state.rulesAccepted&&!this.state.submitError,useWallet:this.state.useWallet,children:[e.jsxs(Ie,{icon:e.jsx("i",{className:"fa-solid fa-users"}),title:n(v=>v.OperationSummary),children:[e.jsx("div",{className:"form-label mb-2",children:n(v=>v.SelectedTickets)}),e.jsx("div",{className:"row align-items-center",style:{gap:15},children:u.map(v=>e.jsx(_v,{ticketId:v},v))}),e.jsx("div",{className:"row",children:f>0&&e.jsx("div",{className:"col-12 d-block d-xl-none my-3",children:e.jsx("div",{style:{maxWidth:300},children:e.jsx(Ds,{label:e.jsxs(e.Fragment,{children:[e.jsx("strong",{className:"me-2",children:d(v=>v.HaiUnCoupon)}),e.jsx("span",{children:d(v=>v.InserisciCoupon)})]}),hasExternal:Pe.hasExternal(c)})})})})]}),e.jsx(ll,{outboud:K.getSolution(),inbound:K.getReturnSolution(),redirectUrl:this.props.location.pathname}),f>0&&e.jsxs(Ie,{title:n(v=>v.PaymentMethod),icon:e.jsx("i",{className:"fa-solid fa-wallet"}),children:[e.jsx(ol,{price:f,onChangeUseWallet:v=>this.setState({useWallet:v}),useWallet:this.state.useWallet,changeDate:!0,expirationDate:this.state.expirationDate||null,onChooseExpirationDate:v=>{this.setState({expirationDate:v||null})},payPalProceed:v=>this.setState({payPalclientIntegrationPaymentId:v}),payPalRequest:{changeDate:{reservationId:c.reservationId,useWallet:this.state.useWallet,forcedPenalty:void 0,ticketIds:u,paymentMethod:c.paymentMethod}},payPalClientIntegrationPaymentId:this.state.payPalclientIntegrationPaymentId,nexiBuildProceed:(v,x)=>{this.setState({nexiBuildClientIntegrationPaymentId:v,nexiNumContratto:x})},nexiBuildRequest:{changeDate:{reservationId:c.reservationId,useWallet:this.state.useWallet,forcedPenalty:void 0,ticketIds:u,paymentMethod:c.paymentMethod}},nexiClientIntegrationPaymentId:this.state.nexiBuildClientIntegrationPaymentId}),((t=this.state.reservation)===null||t===void 0?void 0:t.paymentMethod)==2&&e.jsx("div",{className:"alert alert-warning",children:c.reservationExpiryDate&&n(v=>v.NonFarScaderePrenotazione(c.reservationExpiryDate))})]}),e.jsx("div",{className:"alert alert-primary-light",children:e.jsx(ct,{className:"border-highlighted",name:"rulesAccepted",checked:this.state.rulesAccepted,onChange:this.onAcceptRules,label:e.jsx(wa,{})})}),e.jsx(zr,{tripsCarrierIds:Gt(p[0].map(v=>v.carrierId)),lines:Gt(p[0].map(v=>v.lineId).filter(v=>v))}),this.state.submitError&&e.jsxs("div",{ref:this.errorDiv,className:"alert bg-danger text-white",children:[e.jsx("span",{className:"badge bg-light me-2 fontsize-1u text-danger",children:o(v=>v.Attenzione)}),e.jsx("span",{className:"me-2",children:this.state.submitError})]})]})}}dl.ticketService=new Pi;const kv=_(Aa(Be(dl))),Av=Object.freeze(Object.defineProperty({__proto__:null,default:kv},Symbol.toStringTag,{value:"Module"})),cl=_(class extends P.PureComponent{render(){const{i18n:a}=this.props,{formatMessage:t}=a.get(ne),s=a.get(Cs).formatMessage,n=this.props.isSisal||this.props.paymentMethod===void 0,r=!n&&this.props.paymentMethod!=null&&this.props.isPayed,o=!n&&this.props.paymentMethod!=null&&this.props.isPayed==!1;return e.jsx("div",{className:"w-100 bg-white shadow-sm rounded",children:e.jsxs("div",{className:"row align-items-center p-3",children:[this.props.price!=0&&e.jsx("div",{className:"col-12 col-sm-6 col-lg-7 text-center default-bg rounded",style:{minHeight:46},children:n?e.jsxs("div",{children:[e.jsxs("span",{className:"text-nowrap",children:[t(d=>d.CostoViaggio)," "]}),e.jsx("br",{}),this.props.price&&e.jsx("span",{className:"fw-bolder text-medium ext-price-container",children:`⬠${V.toDecimalString(this.props.price)}`})]}):r?e.jsxs("div",{children:[e.jsx("div",{className:"fontsize-5d fw-bold text-success",children:s(d=>d.PagamentoEffettuatoCon)+": "+Pe.getPaymentMethodStringDescription(this.props.paymentMethod,s)}),e.jsx("div",{className:"fontsize-10u fw-bolder text-medium ext-price-container",children:this.props.price&&`⬠${V.toDecimalString(this.props.price)}`})]}):o?e.jsxs("div",{children:[e.jsxs("div",{className:"fontsize-20u text-danger fw-bold",children:[e.jsx("i",{className:"fa fa-times text-danger me-2"}),s(d=>d.PagamentoNonEffettuato)]}),e.jsx(Rc,{})]}):e.jsx("span",{})}),this.props.viewPrintButton&&this.props.printUrl.length>0&&e.jsx("div",{className:`${this.props.price===0?"col-12":"col-12 col-sm-6 col-lg-5"} no-padding btn-group`,role:"group",children:e.jsxs("a",{className:"btn btn-lg btn-success",href:this.props.printUrl,role:"button",target:"_blank",style:{height:"100%"},children:[e.jsx("i",{className:"fa-solid fa-file-pdf"})," ",e.jsx("span",{children:t(d=>this.props.isSisal?d.StampaSisal:d.Stampa)})]})})]})})}});var Rv=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};
18class ul extends P.Component{constructor(a){super(a),this.state={tickets:null}}componentDidMount(){return Rv(this,void 0,void 0,function*(){const a=yield xe.getManyAnonymous(this.props.params.ids.split(","));this.setState({tickets:a.tickets})})}componentWillUnmount(){K.clear(),J().clear()}render(){if(!this.state.tickets)return e.jsx(X,{});var{formatMessage:a}=this.props.i18n.get(ne),t=this.state.tickets;if(!t)return e.jsx(X,{});var s="",n=t.map(r=>e.jsx(ke,{to:`/ticket/${r.id}`,children:e.jsx($t,{ticket:r},"tkt_"+r.id)},"tkt_"+r.id));return e.jsx("div",{className:"wrapper",children:e.jsxs("div",{className:"row gray-bg",children:[e.jsx("div",{className:"col-sm-12 col-12 col-lg-12",children:e.jsx("div",{style:{paddingLeft:"20px",paddingTop:"10px",paddingBottom:"10px"},children:e.jsxs("h3",{className:"text-info text-uppercase",children:[e.jsx("i",{className:"fa fa-thumbs-up fa-lg",style:{marginRight:10}}),e.jsx("strong",{children:a(r=>r.CambioDataKo)})]})})}),e.jsx("div",{className:"col-sm-12 col-12 col-lg-12",style:{marginBottom:10},children:e.jsx("div",{className:"card float-e-margins",children:e.jsxs("div",{className:"card-body",children:[n,e.jsx(cl,{isSisal:!1,price:0,viewPrintButton:!0,printUrl:s})]})})})]})})}}const Mv=_(Be(ul)),er=Object.freeze(Object.defineProperty({__proto__:null,ChangeDateMultiKo:ul,default:Mv},Symbol.toStringTag,{value:"Module"})),Ov=_(i=>{var{formatMessage:a}=i.i18n.get(ne);if(!i.couponCode)return null;const t=It(()=>new Ta().get(i.couponCode),[i.couponCode]);return t==null?e.jsx(X,{}):e.jsxs("div",{className:"row gray-border-bottom",style:{marginTop:10},children:[e.jsx("div",{className:"col-sm-3 col-lg-3 col-12 default-bg",style:{marginBottom:5},children:e.jsxs("div",{style:{marginBottom:10,marginTop:10,padding:10,lineHeight:1},children:[e.jsx("span",{className:"text-uppercase",children:a(s=>s.RemainderCoupon)}),e.jsx("br",{}),e.jsx("span",{style:{fontSize:"1.5em",fontWeight:"bold"},children:t.id})]})}),e.jsx("div",{className:"col-sm-6 col-lg-6 col-12",children:e.jsxs("div",{children:[e.jsx("div",{style:{borderLeft:"5px solid #DCDDDE",paddingLeft:"5px",marginBottom:10},children:e.jsxs("div",{children:[e.jsx("strong",{children:e.jsx("span",{style:{marginRight:10},children:a(s=>s.DataDiScadenza)})}),e.jsx("span",{children:k.getReadableDateString(t.expiryDateTime)})]})}),e.jsx("div",{style:{borderLeft:"5px solid #DCDDDE",paddingLeft:"5px",marginBottom:10},children:e.jsxs("div",{children:[e.jsx("strong",{children:e.jsxs("span",{style:{marginRight:10},children:[a(s=>s.Amount),":"]})}),e.jsxs("span",{children:["⬠",V.toDecimalString(t.amount||0)]})]})})]})})]})}),cn=_(i=>{const{i18n:a,tickets:t,pdfUrl:s,coupon:n}=i,r=ye(t,f=>f.price+f.penaltiesAmount-f.payedAmount-f.discount-f.reliefAmount),o=t[0].paymentMethod===2,d=t[0].pnr,u=t[0].paymentMethod===7,c=ye(t,f=>f.price-f.discount-f.reliefAmount),l=r<=0||r>0&&(o||u);var{formatMessage:m}=a.get(ne),h=`/images/cortinaexpress/trenitalia-${i.hl=="it"?"it":"en"}.jpg`;return e.jsxs(e.Fragment,{children:[o?e.jsxs("div",{children:[e.jsxs("span",{className:"text-danger",style:{fontSize:"1.2em"},children:["PNR: ",d]}),e.jsxs("span",{className:"text-darkgray",children:[" | ",m(f=>f.DataDiScadenza),": ",k.getReadableDateTimeString(t[0].expiryDate),e.jsx("br",{}),m(f=>f.VaiInRicevitoria)]})]}):e.jsx("span",{}),t.map(f=>e.jsx($t,{ticket:f},f.id)),e.jsx(Ov,{couponCode:n}),e.jsx(cl,{isSisal:o,price:c,viewPrintButton:l,printUrl:s,paymentMethod:t[0].paymentMethod,isPayed:t[0].isPayed}),te.environmentName==="cortinaexpress"&&(t.some(f=>f.departureId=="0465b2a7-759e-4021-b8a6-e6cf5a9c7493")||t.some(f=>f.arrivalId=="0465b2a7-759e-4021-b8a6-e6cf5a9c7493"))&&e.jsx("div",{className:"col-12",children:e.jsx("a",{href:"https://www.lefrecce.it/Channels.Website.WEB/#/white-label/MINISITI/?isRoundTrip=false&departureStation=&arrivalStation=&lang=it&minisitiCallBackId=57149&minisitiHeaderImageIt=&minisitiFooterImageIt=&minisitiHeaderImageEn=&minisitiFooterImageEn=&minisitiHeaderImageDe=&minisitiFooterImageDe=&minisitiHeaderImageFr=&minisitiFooterImageFr=",children:e.jsx("img",{src:h,style:{width:"100%",height:"auto"},className:"mt-3"})})})]})});var zv=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};
18class ml extends P.Component{constructor(a){super(a),this.state={tickets:null}}componentDidMount(){return zv(this,void 0,void 0,function*(){const a=yield xe.getManyAnonymous(this.props.params.ids.split(",").filter(t=>t.length>0));this.setState({tickets:a.tickets})})}componentWillUnmount(){K.clear(),J().clear()}render(){if(!this.state.tickets)return e.jsx(X,{});const{formatMessage:a}=this.props.i18n.get(ne);return this.state.tickets?e.jsxs(re,{title:a(s=>s.CambioDataOk),fullWidth:!0,children:[e.jsx("div",{className:"d-flex justify-content-end",children:e.jsx(Te,{customLink:"/",customLabel:a(s=>s.BackHome)})}),e.jsx(cn,{pdfUrl:"",tickets:this.state.tickets})]}):e.jsx(X,{})}}const Lv=_(Be(ml)),Ev=Object.freeze(Object.defineProperty({__proto__:null,ChangeDateMultiResult:ml,default:Lv},Symbol.toStringTag,{value:"Module"})),Fv=i=>{const[a,t]=P.useState({data:{departure:null,arrival:null,isValidForAllPools:!0}});return e.jsx(za,Object.assign({},i,{combinationData:a.data,onChangeCombinationData:s=>t({data:s})}))};var tr=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};class Bv extends P.Component{constructor(a){var t,s;super(a),this.onChangeDepartureArrival=(n,r)=>{this.setState({departure:n,arrival:r,subscriptionType:null,subscriptionInfo:null,departureString:n==null?void 0:n.description,arrivalString:r==null?void 0:r.description},()=>{const o=D.SubscriptionBuyPath(n==null?void 0:n.description,r==null?void 0:r.description);this.props.history(o,{replace:!0}),n&&r&&this.sendSearchedEvent(n,r)})},this.sendSearchedEvent=(n,r)=>tr(this,void 0,void 0,function*(){var o,d,u,c;const l={departureId:(o=n==null?void 0:n.id)!==null&&o!==void 0?o:"",arrivalId:(d=r==null?void 0:r.id)!==null&&d!==void 0?d:"",departure:(u=n==null?void 0:n.description)!==null&&u!==void 0?u:"",arrival:(c=r==null?void 0:r.description)!==null&&c!==void 0?c:""};qe.send(new ys(l))}),this.onIssueRequested=n=>tr(this,void 0,void 0,function*(){this.setState({redirecting:!0});const r=yield si.ISSUE(n,we(D.subscriptionokPath),we(D.subscriptionkoPath),void 0,we(D.PayByLinkSubscriptionsPath));if(r.errorCode)Mc(r.errorCode),this.setState({redirecting:!1});else{this.sendSubscriptionIssuedEvent(n);let o=!0;if(r.redirect&&(o=yield st(r.redirect,this.props.history)),o)this.props.history(D.SubscriptionOk(r.result.id,r.result.pnr));else throw"unexpected error"}}),this.sendSubscriptionIssuedEvent=n=>{var r,o,d;const u={departure:n.departure,arrival:n.arrival,subscriptionTypeId:n.subscriptionType.id,subscriptionType:n.subscriptionType.description,fareCategoryId:(o=n.fareCategoryId)!==null&&o!==void 0?o:"",paymentMethod:n.paymentMethod?Pe.getPaymentMethodStringDescription(n.paymentMethod):"",personCode:(d=(r=n.person)===null||r===void 0?void 0:r.code)!==null&&d!==void 0?d:"",price:n.price};qe.send(new bs(u))},this.onSelectedCity=n=>{this.props.history(D.UrbanoLanding(n.description))},this.state={departure:null,arrival:null,subscriptionType:null,subscriptionInfo:null,person:null,date:new Date,paymentMethod:null,loading:!1,error:null,invoice:!1,invoiceData:new oi(a.roles.indexOf(ce.canrequestinvoice.name)!=-1),invoiceDataErrors:new Ia,forcedPrice:null,paymentDataId:null,savePaymentData:!1,useWallet:!1,currency:void 0,btTrasporti:null,departureStopId:null,expirationDate:null,redirecting:!1,departureString:(t=this.props.params.departure)!==null&&t!==void 0?t:void 0,arrivalString:(s=this.props.params.arrival)!==null&&s!==void 0?s:void 0,selectedRouteType:0}}componentDidMount(){var a,t;(this.props.params.departure||this.props.params.arrival)&&this.setState({departureString:(a=this.props.params.departure)!==null&&a!==void 0?a:void 0,arrivalString:(t=this.props.params.arrival)!==null&&t!==void 0?t:void 0}),this.props.departures==null&&Os.getDepartureLocalities(null)}componentDidUpdate(a){const{departure:t,arrival:s}=a.params;(t!=this.props.params.departure||s!=this.props.params.arrival)&&this.setState({departureString:this.props.params.departure,arrivalString:this.props.params.arrival})}render(){var a;const t=(a=this.props.departures)===null||a===void 0?void 0:a.filter(n=>((n==null?void 0:n.isZoneType)||!1)===!0),s=(t??[]).length>0;return this.state.redirecting?e.jsx(X,{label:"Emissione..."}):e.jsxs(e.Fragment,{children:[e.jsxs(qo,{children:[s&&e.jsx(_o,{selectedTab:this.state.selectedRouteType,onTabChange:n=>this.setState({selectedRouteType:n}),hl:this.props.hl}),e.jsx("div",{className:`row bg-white ${s?"border-top-0":""} border border-primary rounded-bottom`,children:e.jsx("div",{className:"col-12",children:this.state.selectedRouteType==0?e.jsx("div",{className:"row",children:e.jsx(_u,{onSelect:this.onChangeDepartureArrival,component:Oa,selectedDeparture:this.state.departureString,
18selectedArrival:this.state.arrivalString})}):e.jsx(Ao,{onSelectCity:this.onSelectedCity})})})]}),this.state.selectedRouteType==0&&e.jsx("div",{className:"container pt-3",children:e.jsx(Fv,{departure:this.state.departure,arrival:this.state.arrival,salesChannel:1,terms:e.jsx(wa,{}),onIssue:this.onIssueRequested,mode:0,navigate:this.props.history,qty:1})})]})}}var $v=fe(Bv,Da,(i,a)=>({departures:i.getDepartures(a.hl)}));const Wv=_(et(Be($v))),Uv=Object.freeze(Object.defineProperty({__proto__:null,default:Wv},Symbol.toStringTag,{value:"Module"})),ya=i=>{const{id:a,label:t}=i;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fw-bolder text-medium",children:t}),e.jsx("div",{className:"fw-bolder text-medium fontsize-5u",children:e.jsx(Hr,{id:a})})]})},hl=i=>e.jsx(Lr,{validity:i.subscription.validity,children:a=>e.jsxs("div",{className:"border p-2 text-nowrap text-center",children:[e.jsx("i",{className:"fas fa-calendar me-1 icon"})," ",a]})}),pl=i=>e.jsx(Er,{subscription:i.subscription,template:(a,t)=>e.jsxs("div",{className:"border p-2 text-nowrap text-center",children:[e.jsx("i",{className:"fa-solid fa-right-left me-1 icon"})," ",a.description," ",e.jsxs("span",{className:`fw-bolder fontsize-2u ${a.trips==0?"text-danger":""}`,children:[a.trips," / "]}),t]})}),Vv=i=>i.subscription.fiscalCode?e.jsx("div",{className:"border p-2 text-nowrap text-center",children:e.jsx(Oc,{subscription:i.subscription})}):null,Gv=_(i=>{var a,t;const{i18n:s,subscription:n,disableOpacity:r,past:o}=i,{formatMessage:d}=s.get(ne),{formatMessage:u}=s.get(Q),{formatMessage:c}=s.get(Xe),{formatMessage:l}=s.get(ie),m=n.isCanceled||!n.isPayed;return e.jsx(e.Fragment,{children:e.jsxs(Bt,{className:`${o?"bg-light":""} ${m&&!r?"opacity-50":""}`,children:[e.jsxs("div",{className:"row position-relative",children:[!m&&e.jsx(at,{to:D.getSubscriptionDetail(n.id),className:"stretched-link"}),e.jsx("div",{className:"fontsize-10u text-medium fw-bolder mb-2",children:e.jsx(Ca,{id:n.subscriptionTypeId})}),e.jsx("div",{className:"col-6 col-lg-4 my-1",children:e.jsx(ya,{id:n.departureStopOrPool,label:l(h=>h.Partenza)})}),n.maxKm==null&&n.departureStopOrPool!=n.arrivalPool&&e.jsx("div",{className:"col-6 col-lg-4 my-1",children:e.jsx(ya,{id:n.arrivalPool,label:l(h=>h.Arrival)})}),i.showPrice&&e.jsxs("div",{className:"col-12 col-lg-4 my-1",children:[e.jsx(qt,{price:n.value,fullPrice:n.value,toPay:n.value-((a=n.reliefAmount)!==null&&a!==void 0?a:0)-n.payedAmount-((t=n.discount)!==null&&t!==void 0?t:0),pnr:n.pnr}),n.isPayed&&e.jsx("div",{children:e.jsx("div",{className:"fw-bold text-success",children:u(h=>h.Pagato)})})]})]}),e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-12 col-lg-10 my-1",children:e.jsxs("div",{className:"row",children:[n.personId&&e.jsx("div",{className:"col",children:e.jsxs("div",{className:"border p-2 text-nowrap text-center",children:[e.jsx("i",{className:"fa-solid fa-id-card me-1 icon"}),c(h=>h.Tessera),e.jsx(Is,{id:n.personId,selector:h=>e.jsx("span",{className:"fw-bolder ms-1",children:h.code.toUpperCase()})})]})}),ji.showValidity(i.subscription)&&e.jsx("div",{className:"col",children:e.jsx(hl,{subscription:n})}),!o&&e.jsx("div",{className:"col",children:e.jsx(pl,{subscription:n})}),e.jsx("div",{className:"col",children:e.jsx(Vv,{subscription:n})})]})})}),e.jsxs("div",{className:"row border-top mt-3 pt-4 pb-3 align-items-center",children:[e.jsxs("div",{className:"col-12 col-lg-4",children:[e.jsx("div",{children:d(h=>h.Passenger)}),e.jsxs("div",{className:"fw-bolder",children:[n.passenger.name," ",n.passenger.surname]})]}),!m&&!o&&e.jsx("div",{className:"col-12 col-lg-8",children:e.jsxs("div",{className:"w-100 d-flex flex-wrap align-items-center justify-content-md-end",children:[e.jsxs(Mt,{link:D.getSubscriptionDetail(n.id),alertTitle:`${c(h=>h.Abbonamento)} ${d(h=>h.DaPagare).toLowerCase()}`,alertMessage:d(h=>h.CompletaIlPagamento),disabled:m||!n.isPayed,children:[e.jsx("i",{className:"fa-solid fa-qrcode me-2"}),c(h=>h.VersioneDigitale)]}),n.isCity==!1&&n.tripsUsed>0&&e.jsxs(Mt,{link:D.GetTicketsPath(n.id),disabled:m||!n.isPayed,children:[e.jsx("i",{className:"fa-solid fa-file-circle-check me-2"}),c(h=>h.GestisciPrenotazioni)," (",n.tripsUsed,")"]}),n.isCity==!1&&e.jsxs(Mt,{link:D.SubscriptionReservation(n.id),alertTitle:c(h=>h.Prenota),alertMessage:c(h=>h.Abbonamenti),disabled:ji.getRemainingTrips(n)==0||!n.isPayed,children:[e.jsx("i",{className:"fa fa-arrow-circle-right me-2"}),c(h=>h.Prenota)]})]})})]})]})})}),Gi=_(i=>e.jsx(Gv,{subscription:i.subscription,showPrice:i.showPrice,disableOpacity:i.disableOpacity,past:i.past}));var qv=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const un=_(i=>{const{formatMessage:a}=i.i18n.get(ne),{formatMessage:t}=i.i18n.get(Xe),{formatMessage:s}=i.i18n.get(Q),{subscriptions:n,saleOk:r}=i;return e.jsxs(re,{fullWidth:!0,title:a(r?o=>o.AcquistoOk:o=>o.AcquistoKo),children:[e.jsxs("div",{className:"d-flex justify-content-between align-items-center",children:[n[0].type==0?e.jsx(Te,{customLabel:r?t(o=>o.IMieiAbbonamenti):void 0,customLink:r?D.SubscriptionsPath:D.SubscriptionBuyPath()}):e.jsx(Te,{customLabel:r?s(o=>o.MyTickets):void 0,customLink:r?D.GetMyTicketsPage():D.TravelSelection()}),r&&n[0].type==0?e.jsx(ke,{className:"btn btn-lg btn-primary btn-highlight",to:D.SubscriptionBuyPath(),children:t(o=>o.NuovoAbbonamento)}):e.jsx(ke,{className:"btn btn-lg btn-primary btn-highlight",to:D.TravelSelection(),children:t(o=>o.NuovoBiglietto)})]}),e.jsxs("div",{className:"mb-2",children:[e.jsxs("span",{children:[s(o=>o.MetodoPagamento),": "]}),e.jsxs("span",{style:{fontSize:"1.2em"},children:[e.jsx(Yi,{method:n[0].paymentMethod})," "]})]}),n.map((o,d)=>e.jsx(Gi,{subscription:o,showPrice:r},d))]})});
18class Hv extends P.Component{constructor(a){super(a),this.state={subscriptions:null}}componentDidMount(){return qv(this,void 0,void 0,function*(){const a=yield Et.getByGroupId(this.props.params.id);this.setState({subscriptions:a.items})})}render(){const{subscriptions:a}=this.state;return a?e.jsx(un,{saleOk:!1,subscriptions:a}):e.jsx(Je,{})}}const Kv=Be(Hv),Qv=Object.freeze(Object.defineProperty({__proto__:null,SubscriptionResult:un,default:Kv},Symbol.toStringTag,{value:"Module"}));var vs=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const vl=i=>{var a;return i.remainderCoupon?e.jsxs("div",{className:"d-flex align-items-center pb-1 pt-1 flex-wrap",children:[e.jsxs("div",{className:"bg-light me-2",style:{position:"relative",minWidth:120,maxWidth:200,padding:5},children:[e.jsx("span",{className:"text-uppercase text-nowrap text-start",style:{fontSize:"0.8em"},children:"Coupon di resto: "}),e.jsx("br",{}),e.jsx("span",{className:"fw-bold",style:{fontSize:"1.5em"},children:i.remainderCoupon.id}),e.jsx("br",{})]}),e.jsxs("div",{className:"fw-bold",children:[e.jsxs("span",{style:{fontSize:"1em"},children:["Importo: ",i.remainderCoupon.amount?((a=i.remainderCoupon.amount)===null||a===void 0?void 0:a.toFixed(2))+" â¬":""]}),e.jsx("br",{}),e.jsxs("span",{style:{fontSize:"1em"},children:["Scade il: ",k.getReadableDateString(i.remainderCoupon.expiryDateTime)]})]})]}):null},gl=i=>{let a="Acquisto avvenuto con successo";return i.isSisal&&(a="Prenotazione Mooney creata con successo"),i.toBePayed>0&&(a=`Riepilogo ordine - Da pagare ${V.toDecimalString(i.toBePayed)}â¬`),e.jsx("strong",{children:a})};class Jv extends P.Component{constructor(a){super(a),this.state={subscriptions:null}}componentDidMount(){return vs(this,void 0,void 0,function*(){xi.isInitialized()&&(yield xi.clear());const a=yield Et.getByGroupId(this.props.params.id);this.setState({subscriptions:a.items}),yield this.sendTransactionEvent(a.items)})}sendTransactionEvent(a){return vs(this,void 0,void 0,function*(){let t=Pe.getPaymentMethodStringDescription(a[0].paymentMethod);const s=[],n=yield Nn.get(a[0].departureStopOrPool),r=yield Nn.get(a[0].arrivalPool);a.map(d=>{var u,c,l;return s.push({id:d.id,name:d.type==0?"subscription":"open",departureName:(u=n==null?void 0:n.shortDescription)!==null&&u!==void 0?u:d.departureStopOrPool,departureId:d.departureStopOrPool,departureDate:d.issueDate,arrivalName:(c=r==null?void 0:r.shortDescription)!==null&&c!==void 0?c:d.arrivalPool,arrivalId:d.arrivalPool,arrivalDate:d.issueDate,price:d.value,discount:(l=d.discount)!==null&&l!==void 0?l:0,quantity:1})});const o={id:a[0].id,date:a[0].issueDate,grandtotal:a[0].payedAmount,paymentMethod:t,details:s,email:a[0].email};qe.send(new Ns(o))})}render(){const{subscriptions:a}=this.state;return a?e.jsx(un,{saleOk:!0,subscriptions:a}):e.jsx(Je,{})}}const Yv=_(Be(Jv)),Zv=_(({id:i,pnr:a,hl:t,i18n:s})=>{var n;const[r,o]=P.useState(),{formatMessage:d}=s.get(Q),u=g=>vs(void 0,void 0,void 0,function*(){const v=yield Et.SUBSCRIPTION_DETAIL_REQUESTED(g);o({subscription:v,pnr:v.pnr})});if(P.useEffect(()=>{u(i)},[i]),(r==null?void 0:r.subscription)==null)return e.jsx(Je,{});const c=r.subscription.urlPdf?ea(r.subscription.urlPdf,t):"#",{subscription:l}=r;if(!l)return e.jsx(Je,{});const m=a?e.jsxs("div",{className:"card-body",children:[e.jsxs("span",{className:"text-danger",style:{fontSize:"1.2em"},children:["PNR: ",a]}),e.jsxs("span",{className:"text-darkgray",children:[" | Data di scadenza: ",k.getReadableDateTimeString(l.expiryDate)]})]}):e.jsx("span",{}),h=l.value,f=l.discount,p=l.generatedCoupons.find(g=>g.isRemainder);return e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-12",children:e.jsx("div",{style:{paddingLeft:20,paddingTop:10,paddingBottom:10},children:e.jsxs("h2",{className:"text-info text-uppercase",children:[e.jsx("i",{className:"fa fa-thumbs-up fa-lg",style:{marginRight:10}}),e.jsx(gl,{toBePayed:l.value-((n=l.discount)!==null&&n!==void 0?n:0)-l.payedAmount,isSisal:l.paymentMethod==2})]})})}),e.jsx("div",{className:"col-12",style:{marginBottom:10},children:e.jsxs("div",{className:"card float-e-margins",children:[e.jsxs("div",{className:"card-body",children:[e.jsxs("span",{className:"text-uppercase",style:{fontSize:"0.8em"},children:[d(g=>g.MetodoPagamento),": "]}),e.jsx("span",{style:{fontSize:"1.2em"},children:e.jsx(Yi,{method:l.paymentMethod})}),m,e.jsx(Gi,{subscription:l}),p&&e.jsx(vl,{remainderCoupon:p}),e.jsxs("div",{className:"bg-light p-2",children:[e.jsx("span",{className:"text-uppercase text-nowrap",style:{fontSize:"0.8em"},children:"Costo dell'abbonamento "}),f&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"fw-bold",style:{fontSize:"1.2em"},children:[e.jsx("del",{children:h!=null?V.toDecimalString(h):""})," "]}),e.jsxs("span",{className:"fw-bold",style:{fontSize:"1.2em"},children:[" ",V.toDecimalString(h-f)]})]})||e.jsxs("span",{className:"fw-bold",style:{fontSize:"1.2em"},children:[h!=null?V.toDecimalString(h):""," "]})]})]}),e.jsx("div",{className:"card-body ",children:e.jsxs("a",{className:"btn btn-lg btn-success text-uppercase",href:c,role:"button",target:"_blank",style:{marginBottom:0,marginLeft:5},children:[e.jsx("i",{className:"fa fa-print"})," ",e.jsx("span",{style:{fontSize:"0.7em"},children:r.pnr?"Stampa prenotazione":"Stampa"})]})})]})})]})}),Xv=Object.freeze(Object.defineProperty({__proto__:null,RemainderCoupon:vl,SaleOkOnMo
18dal:Zv,SaleOkTitle:gl,default:Yv},Symbol.toStringTag,{value:"Module"}));class eg extends Kl{constructor(){super(a=>a.id),Si.onfunction(io.ActiveSubscriptions,a=>this.setAll(a))}}const tg=new eg,ir=i=>e.jsx("div",{className:"h-100 mt-3 p-5 bg-white shadow border rounded-3",children:e.jsx("h2",{className:"fw-bold text-medium",children:i.message})}),ig=_(i=>{const{formatMessage:a}=i.i18n.get(ne),t=[{label:a(g=>g.Last30Days),value:6},{label:a(g=>g.Last90Days),value:8},{label:a(g=>g.ThisYear),value:2},{label:a(g=>g.LastYear),value:3}],s=Kt(),n=new URLSearchParams(s.search).get("tab"),[r,o]=P.useState(!1),[d,u]=P.useState(8),[c,l]=P.useState(null),[m,h]=P.useState(n==="previous");P.useEffect(()=>{o(!0),io.ActiveSubscriptions().finally(()=>o(!1))},[]),P.useEffect(()=>{m&&(l(null),ku.getPastSubscriptionsByUser(d).then(l))},[d,m]);const f=g=>{g==="previous"&&h(!0)};let p=ni(i.subscriptions,g=>g.validity.from.valueOf());return p=ni(p,g=>g.tripsNumber==null?2:g.tripsUsed<(g.tripsNumber||0)?1:3),e.jsxs(re,{title:a(g=>g.IMieiAbbonamenti),fullWidth:!0,children:[e.jsx(Te,{customLink:"/",customLabel:a(g=>g.BackHome)}),e.jsx("div",{className:"row justify-content-end mb-3",children:e.jsx("div",{className:"col-12 col-lg-2",children:e.jsxs(ke,{className:"btn btn-primary btn-highlight w-100",role:"button",to:D.SubscriptionBuyPath(),children:[e.jsx("i",{className:"fa-solid fa-cart-shopping me-1"})," ",a(g=>g.NuovoAbbonamento)]})})}),e.jsxs(ja,{onClickTab:f,children:[e.jsx(lt,{name:"next",caption:a(g=>g.ActiveSubscription),children:r?e.jsx(X,{}):p.length>0?p.map((g,v)=>e.jsx(Gi,{subscription:g},v)):e.jsx(ir,{message:a(g=>g.NessunAbbonamentoAttivo)})}),e.jsxs(lt,{name:"previous",caption:a(g=>g.PastSubscription),children:[e.jsx("div",{className:"mb-3",children:e.jsx("select",{className:"form-select",style:{maxWidth:220},value:d,onChange:g=>u(Number(g.target.value)),children:t.map(g=>e.jsx("option",{value:g.value,children:g.label},g.value))})}),c==null?m?e.jsx(X,{}):null:c.length===0?e.jsx(ir,{message:a(g=>g.NessunAbbonamento)}):c.map((g,v)=>e.jsx(Gi,{subscription:g,past:!0},v))]})]})]})}),ag=_(fe(ig,tg,i=>({subscriptions:i.getall()}))),sg=Object.freeze(Object.defineProperty({__proto__:null,default:ag},Symbol.toStringTag,{value:"Module"})),ng=Ru(pt(i=>i.roles.find(t=>t===ce.canissuesubscriptions.name)&&i.subscriptionTypes.some(t=>{var s;return t.onlyCategories===null||((s=t.onlyCategories)===null||s===void 0?void 0:s.find(n=>n===i.person.fareCategoryId))})?e.jsx(at,{className:"btn btn-gray",to:D.SubscriptionsPath,children:i.label}):null))(i=>i.getall(),"subscriptionTypes"),rg=pt(_(Au(i=>{var a,t,s,n;const{formatMessage:r}=i.i18n.get(Xe),o=mt(it(i.categories,l=>{var m,h;return(h=(m=l.bookingGroupDescription)===null||m===void 0?void 0:m.It)!==null&&h!==void 0?h:"default"}),(l,m)=>({key:m,categories:l})),[d,u]=P.useState((s=(a=o[0])===null||a===void 0?void 0:a.key)!==null&&s!==void 0?s:"default"),c=(n=(t=o.find(l=>l.key===d))===null||t===void 0?void 0:t.categories)!==null&&n!==void 0?n:[];return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"fontsize-10u mb-2",children:r(l=>l.RichiediTessera)}),o.length>1&&e.jsx("div",{className:"d-flex flex-wrap mb-3",children:o.map(l=>{var m;return e.jsxs("button",{type:"button",className:`btn ${l.key===d?"btn-primary":"btn-outline-primary"}`,onClick:()=>{var h;return u((h=l.key)!==null&&h!==void 0?h:"default")},children:[l.key!="default"?Qe.GetLocalizedString(l.categories[0].bookingGroupDescription,i.hl):r(h=>h.CategoriaNonDefinitaTessere),e.jsxs("span",{className:`ms-2 badge rounded-pill ${l.key===d?"bg-light text-primary":"bg-primary text-bg-primary"}`,children:[" ",l.categories.length]})]},(m=l.key)!==null&&m!==void 0?m:"default")})}),e.jsx("div",{className:"row",children:c.map(l=>e.jsx("div",{className:"col-12 col-lg-auto",children:e.jsx(at,{className:"btn btn-primary-light my-1 mx-1 d-flex rounded w-100",to:D.GetPersonCreateUri(l==null?void 0:l.id),style:{minWidth:220,height:60},children:e.jsxs("div",{className:"d-flex",children:[e.jsx("div",{className:"me-2 my-auto",children:e.jsx("i",{className:"fas fa-plus text-primary fa-2x"})}),e.jsxs("div",{className:"flex-grow-1 my-auto",children:[e.jsxs("div",{className:"fw-bold text-uppercase",children:[" ",Qe.GetDescription(l,i.hl)]}),l.subtitle&&e.jsx("div",{className:"lh-1",children:e.jsx("small",{children:l.subt
18itle})})]})]})})},l.id))})]})})((i,a)=>i.getPersonsFareCategories(a.roles.indexOf(ce.canissueprivatecards.name)!=-1),"categories"))),og=_(i=>{const{formatMessage:a}=i.i18n.get(Xe),{formatMessage:t}=i.i18n.get(Q),s=Js.useAll();if(s==null)return e.jsx(X,{});const n=s.filter(r=>Ne.isValid(r));return e.jsxs(re,{title:a(r=>r.LeMieTessere),fullWidth:!0,children:[e.jsx("div",{className:"d-flex justify-content-end",children:e.jsx(Te,{customLink:"/",customLabel:t(r=>r.Prenota)})}),e.jsx("div",{className:"d-flex flex-wrap justify-content-center justify-content-lg-start",children:n.map(r=>e.jsxs("div",{className:"card shadow me-3 mb-3",style:{width:320},children:[e.jsxs("div",{className:`card-header d-flex justify-content-between align-items-center text-uppercase text-white ${Ne.isActive(r)?"bg-primary":r.status==3?"bg-warning":"bg-danger"}`,children:[e.jsx("div",{className:"me-2",children:e.jsxs("div",{className:"mb-0",children:[a(o=>o.Tessera)," ",r.code]})}),e.jsx("div",{children:Ne.isActive(r)?a(o=>o.TesseraAttiva):r.status==3?a(o=>o.TesseraInAttesa):a(o=>o.TesseraNonAttiva)})]}),e.jsxs("div",{className:"card-body d-flex flex-column justify-content-between",children:[e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:"me-2",children:e.jsx(zc,{photoBitmap:r.photoBitmap,width:60,height:60})}),e.jsxs("div",{children:[e.jsxs("div",{className:"d-flex flex-column",children:[e.jsxs("div",{className:"my-1 d-flex justify-content-between",children:[e.jsxs("strong",{className:"me-1",children:[r.surname," ",r.name]}),r.birthDate&&e.jsx("span",{children:k.getReadableDateDtoString(r.birthDate)})]}),r.fareCategoryId&&e.jsx("div",{className:"my-1 fw-bold",children:e.jsx(Ye,{id:r.fareCategoryId})})]}),e.jsxs("div",{className:"me-0 ms-auto my-1",children:[e.jsx(Fr,{validity:r.validity,status:r.status,isPayed:r.isPayed}),Ne.canRequestRenew(r)&&e.jsxs(at,{className:"btn btn-sm btn-warning w-100 my-1",to:D.GetPersonRenewLink(r.id),children:[e.jsx("i",{className:"fas fa-up-right-from-square"})," ",a(o=>o.RinnovaTessera)]})]})]})]}),e.jsx("div",{className:"d-flex justify-content-center mt-2",children:r.status!==4&&r.status!==5&&r.status!==2&&e.jsxs(e.Fragment,{children:[e.jsxs(at,{className:"btn btn-gray",to:D.GetPersonEditUri(r.id),children:[e.jsx("i",{className:"fa-regular fa-address-card me-1"}),a(o=>o.Apri)]}),Ne.isActive(r)&&e.jsxs("a",{className:"btn btn-gray",href:r.urlPdf,target:"_blank",children:[e.jsx("i",{className:"fa-solid fa-file-pdf"})," ",a(o=>o.StampaTessera)]}),Ne.isActive(r)&&e.jsx(ng,{label:a(o=>o.Abbonamenti),person:r})]})})]})]},r.id))}),e.jsx(ze,{role:Xi.persons.write,children:e.jsx("div",{className:"mt-5",children:e.jsx(rg,{})})})]})}),lg=Object.freeze(Object.defineProperty({__proto__:null,MyPersonsPage:og},Symbol.toStringTag,{value:"Module"}));var dg=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const cg=bt(et(fe(_(_a(i=>{const a=Kt(),t=_e(),{formatMessage:s}=i.i18n.get(Xe),n=new URLSearchParams(a.search).get("category"),r=n?Qe.GetDescription(i.categories.find(l=>l.id===n),i.hl):"",o=Js.useAll(),[d,u]=P.useState({person:Object.assign(Object.assign({},new Ne),{name:i.user.name,surname:i.user.surname,linkedUserId:i.user.id,email:i.user.email,phoneNumber:i.user.phoneNumber,callingCode:i.user.callingCode,fareCategoryId:n||void 0,fareCategoryDescription:r}),errors:new ka,loading:!1,documents:null}),c=(l,m,h,f)=>dg(void 0,void 0,void 0,function*(){u(Object.assign(Object.assign({},d),{loading:!0}));const p=new _s().validate(d.person,i.extraParamsData,l,m,h,i.roles,f,i.i18n.get(Lt).formatMessage);if(!p.isValid)u(Object.assign(Object.assign({},d),{errors:p.errors,loading:!1}));else{const v=o==null?void 0:o.filter(x=>{var S,y,b,j,I,N;return x.name.toLowerCase()==d.person.name.toLowerCase()&&x.surname.toLowerCase()==d.person.surname.toLowerCase()&&((S=x.birthDate)===null||S===void 0?void 0:S.day)==((y=d.person.birthDate)===null||y===void 0?void 0:y.day)&&((b=x.birthDate)===null||b===void 0?void 0:b.month)==((j=d.person.birthDate)===null||j===void 0?void 0:j.month)&&((I=x.birthDate)===null||I===void 0?void 0:I.year)==((N=d.person.birthDate)===null||N===void 0?void 0:N.year)&&x.fareCategoryId==(h==null?void 0:h.id)&&x.status!=5});if(v&&v.length>0)u(Object.assign(Object.assign({},d),{errors:p.errors,loading:!1})),Re.fire(s(x=>x.Attenzione),s(x=>x.AlertRichiestaDuplicatoTessera));else{var g=yield Ve.save(d.person,l,m,!0,d.person.id.length<=0);u(Object.assign(Object.assign({},d),{loading:!1})),t(D.GetPersonEditUri(g.id))}}});return e.jsx(re,{title:`${s(l=>l.RichiediTessera)} ${n?r:""}`,fullWidth:!0,children:e.jsxs(Ys,{isLoading:d.loading,label:s(l=>l.RichiediTessera),children:[e.jsx(Te,{}),e.jsx("div",{className:"bg-white p-4",children:e.jsx(Lc,{person:d.person,roles:i.roles,onChange:l=>u(Object.assign(Object.assign({},d),{person:l})),errors:d.errors,onSave:c,hideCategorySelection:n!=null,documents:d.documents,changeDocuments:l=>u(Object.assign(Object.assign({},d),{documents:l})),showSubmit:!0})})]})})})),Gs,(i,a)=>({categories:i.getPersonsFareCategories(a.roles.indexOf(ce.canissueprivatecards.name)!=-1)}))))(i=>i.allByKey(),"extraParamsData"),ug=Object.freeze(Object.defineProperty({__proto__:null,default:cg},Symbol.toStringTag,{value:"Module"}));var fl=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const mg=i=>{var a,t;const{person:s}=i,n=s.parentId,r=o=>fl(void 0,void 0,void 0,function*(){(yield Ci("Sei sicuro di voler eliminare il veicolo collegato?"))&&(yield Ve.deleteChild(o,n))});return e.jsx("li",{className:"list-group-item",children:e.jsxs("div",{className:"row align-items-center justify-content-between",children:[e.jsxs("div",{className:"col",children:[e.jsx("div",{className:"fontsize-3d text-uppercase mb-1",children:"Modello"}),e.jsx("div",{className:"fw-bold text-uppercase",children:(a=s.extraData.Modello)!==null&&a!==void 0?a:""})]}),e.jsxs("div",{className:"col",children:[e.jsx("div",{className:"fontsize-3d text-uppercase mb-1",children:"Targa"}),e.jsx("div",{className:"fw-bold text-uppercase",children:(t=s.extraData.Targa)!==null&&t!==void 0?t:""})]}),s.fareCategoryId&&e.jsxs("div",{className:"col",children:[e.jsx("div",{className:"fontsize-3d text-uppercase mb-1",children:"Stato"}),e.jsx("div",{className:"fw-bold text-uppercase",children:e.jsx(ks,{validity:s.validity,status:s.status,isPayed:s.isPayed})})]}),e.jsxs("div",{className:"col d-flex justify-content-end align-items-center",children:[e.jsx(ze,{role:ce.personsadminmode,children:e.jsx(ke,{to:D.GetPersonEditChildUri(n,s.fareCategoryId,s.id),children:e.jsx("i",{className:"fas fa-pencil me-2"})})}),e.jsx("button",{type:"button",onClick:()=>r(s.id),className:"btn btn-link text-danger",children:e.jsx("i",{className:"fas fa-times fa-lg"})})]})]})},s.id)},hg=i=>{const{person:a}=i,t=a.parentId,s=n=>fl(void 0,void 0,void 0,function*(){(yield Ci("Sei sicuro di voler eliminare l'accessorio collegato?"))&&(yield Ve.deleteChild(n,t))});return e.jsx("li",{className:"list-group-item",children:e.jsxs("div",{className:"row align-items-center justify-content-between",children:[e.jsxs("div",{className:"col",children:[e.jsx("div",{className:"fontsize-3d text-uppercase mb-1",children:"Modello"}),e.jsx("div",{className:"fw-bold text-uppercase",children:e.jsx(Ye,{id:a.fareCategoryId})})]}),e.jsxs("div",{className:"col",children:[e.jsx("div",{className:"fontsize-3d text-uppercase mb-1",children:"Note"}),e.jsx("div",{className:"fw-bold text-uppercase",children:a.notes})]}),a.fareCategoryId&&e.jsxs("div",{className:"col",children:[e.jsx("div",{className:"fontsize-3d text-uppercase mb-1",children:"Stato"}),e.jsx("div",{className:"fw-bold text-uppercase",children:e.jsx(ks,{validity:a.validity,status:a.status,isPayed:a.isPayed})})]}),e.jsx("div",{className:"col d-flex justify-content-end align-items-center",children:e.jsx("button",{type:"button",onClick:()=>s(a.id),className:"btn btn-link text-danger",children:e.jsx("i",{className:"fas fa-times fa-lg"})})})]})},a.id)},pg=i=>{const{person:a,allFareCategories:t}=i,s=a.fareCategoryId!=null?t[a.fareCategoryId]:void 0;return s==null?null:s.type==2?e.jsx(mg,{person:a}):e.jsx(hg,{person:a})},vg=_(yt(i=>{const{parent:a,children:t,fareCategories:s}=i,{formatMessage:n}=i.i18n.get(Xe),r=Ne.CanAddChildren(a,s);if(!r&&t.length==0)return null;const o=d=>{i.navigate(D.GetPersonNewChildUri(a.id,d.id))};return e.jsxs("div",{children:[t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fontsize-5u mb-3",children:n(d=>d.Children)}),e.jsx("ul",{className:"list-group",children:t.map(d=>e.jsx(pg,{allFareCategories:s,person:d},d.id))})]}),r&&a.fareCategoryId&&e.jsxs("div",{children:[e.jsxs("div",{className:"fontsize-5u mt-3",children:[n(d=>d.AddChild),":"]}),e.jsx(Xu,{parentId:a.fareCategoryId,children:t,onAdd:o})]})]})})(i=>i.allByKey(),"fareCategories")),gg=i=>{var a;const{fareCategory:t,person:s}=i;
18if(s==null)return null;const n=s.extraData.Modello,r=s.extraData.Targa,o=!V.isNullOrWhiteSpace(n)||!V.isNullOrWhiteSpace(r);return e.jsx("div",{className:"d-flex align-items-center",children:e.jsxs("div",{className:"d-flex align-items-center my-2",children:[e.jsx("div",{className:"me-2",children:e.jsx("i",{className:`${(a=t==null?void 0:t.frontendIcon)!==null&&a!==void 0?a:"fas fa-auto"} text-primary fa-lg`})}),e.jsxs("div",{className:"d-flex align-items-center justify-content-between w-100",children:[e.jsx("div",{className:"text-uppercase",children:o?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"me-1",children:s.extraData.Modello})," ",e.jsx("span",{children:s.extraData.Targa})]}):e.jsx(Ye,{id:t==null?void 0:t.id})}),!Ne.isActive(s)&&e.jsx("div",{className:"ms-2",children:e.jsx(ks,{status:s.status,validity:s.validity,isPayed:s.isPayed})})]})]})})},fg=i=>{var a;const{fareCategory:t,person:s}=i;return s==null?null:e.jsx("div",{className:"d-flex align-items-center",children:e.jsxs("div",{className:"d-flex align-items-center my-2",children:[e.jsx("div",{className:"me-2",children:e.jsx("i",{className:`${(a=t==null?void 0:t.frontendIcon)!==null&&a!==void 0?a:"fas fa-auto"} text-primary fa-lg`})}),e.jsx("div",{children:e.jsx("div",{className:"text-uppercase",children:e.jsx(Ye,{id:t==null?void 0:t.id})})})]})})},xg=i=>{const{fareCategory:a,person:t}=i;return t==null||a==null?null:a.type==2?e.jsx(gg,{person:t,fareCategory:a}):e.jsx(fg,{person:t,fareCategory:a})},bg=yt(i=>{const{parent:a,fareCategories:t}=i,s=ao.use(a.id);if(s==null)return null;const n=s.filter(o=>o.status!=5&&o.status!=4),r=Ne.CanAddChildren(a,t);return e.jsxs("div",{className:"mt-4",children:[n.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-uppercase fontsize-3d fw-bold",children:"Veicoli & Accessori"}),n.map((o,d)=>{const u=o.fareCategoryId!=null?t[o.fareCategoryId]:void 0;return e.jsx(xg,{person:o,fareCategory:u},o.id)})]}),(r||n.length>0)&&e.jsx(Tt,{className:"btn-primary-light w-100",text:"Aggiungi veicolo\\accessorio",children:e.jsx(vg,{parent:a,children:n,navigate:i.navigate})})]})})(i=>i.allByKey(),"fareCategories"),xl=i=>{var a;const{person:t}=i;return e.jsx("div",{className:"bg-white p-4 shadow w-100",children:e.jsxs("div",{className:"d-flex flex-column align-items-center",children:[e.jsx(Ec,{className:"rounded",image:(a=t==null?void 0:t.photoBitmap)!==null&&a!==void 0?a:null,width:128,height:128}),e.jsx("div",{className:"my-3 fw-bolder fontsize-5u",children:e.jsxs("div",{children:[t.name," ",t.surname]})}),e.jsxs("div",{className:"my-5",children:[e.jsxs("div",{className:"d-flex align-items-center my-2",children:[e.jsx("div",{className:"me-2",children:e.jsx("i",{className:"fas fa-asterisk text-primary fa-lg"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fw-bold fontsize-5d",children:"Tipologia tessera"}),e.jsx("div",{children:t.fareCategoryDescription})]})]}),e.jsxs("div",{className:"d-flex align-items-center my-2",children:[e.jsx("div",{className:"me-2",children:e.jsx("i",{className:"fa fa-info-circle text-primary fa-lg"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fw-bold fontsize-5d",children:"Stato"}),e.jsx("div",{children:e.jsx(Fr,{validity:t.validity,status:t.status,isPayed:t.isPayed})})]})]}),e.jsxs("div",{className:"row my-2",children:[e.jsx("div",{className:"d-flex align-items-center col",children:t.email&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"me-2",children:e.jsx("i",{className:"fa fa-envelope text-primary fa-lg"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fw-bold fontsize-5d",children:"Email"}),e.jsx("div",{children:t.email})]})]})}),e.jsx("div",{className:"d-flex align-items-center col",children:t.phoneNumber&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"me-2",children:e.jsx("i",{className:"fa fa-mobile-alt text-primary fa-lg"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fw-bold fontsize-5d",children:"Telefono"}),e.jsxs("div",{className:"text-nowrap",children:[t.callingCode," ",t.phoneNumber]})]})]})})]}),(t.birthLocalityId||t.localityId)&&e.jsxs("div",{className:"row my-4",children:[t.birthLocalityId&&e.jsxs("div",{className:"d-flex align-items-center col",children:[e.jsx("div",{className:"me-2",children:e.jsx("i",{className:"fa fa-calendar-alt text-primary fa-lg"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fw-bold fontsize-5d",children:"Luogo e data di nascita"}),e.jsxs("div",{children:[e.jsx(xn,{id:t.birthLocalityId,selector:s=>s.description})," ",t.birthDate&&k.getReadableDateDtoString(t.birthDate)]})]})]}),t.localityId&&e.jsxs("div",{className:"d-flex align-items-center col",children:[e.jsx("div",{className:"me-2",children:e.jsx("i",{className:"far fa-map text-primary fa-lg"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fw-bold fontsize-5d",children:"Residenza"}),e.jsxs("div",{children:[e.jsx(xn,{id:t.localityId,selector:s=>s.description})," ",t.address]})]})]})]}),e.jsx(bg,{parent:t,navigate:i.navigate})]}),!i.hideQrCode&&e.jsx(Ss,{className:"my-4",text:t==null?void 0:t.code,size:150}),i.children]})})};var ar=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};
18let yg=class extends P.Component{constructor(a){super(a),this.listener=()=>{const{id:t}=this.props.params;var s=Fi.get(t);this.setState({person:s})},this.state={person:null,errors:new ka,loading:!1,documents:[]}}componentDidMount(){return ar(this,void 0,void 0,function*(){Fi.Changed.register(this.listener),Gs.isInitialized()||(yield Mu.getFareCategoriesForPersons());const{id:a}=this.props.params;yield Ve.get(a)})}componentWillUnmount(){return ar(this,void 0,void 0,function*(){Fi.Changed.unregister(this.listener)})}componentDidUpdate(a,t,s){this.props.params.id&&a.params.id!=this.props.params.id&&Ve.children(this.props.params.id)}render(){const{person:a,loading:t}=this.state;if(!a)return e.jsx(X,{});const{formatMessage:s}=this.props.i18n.get(Xe);return e.jsxs(re,{title:Ne.isExpired(a)?s(n=>n.RinnovaTessera):e.jsxs(e.Fragment,{children:[s(n=>n.Tessera)," ",a.code]}),children:[e.jsx(Te,{customLink:D.MyPersonsPage}),e.jsx(Ys,{isLoading:t,children:e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-12 col-lg-8",children:e.jsx(xl,{person:a,navigate:this.props.history})})})})]})}};const jg=et(fe(_(_a(Be(yg))),Gs,i=>({categories:i.getall()}))),Sg=Object.freeze(Object.defineProperty({__proto__:null,default:jg},Symbol.toStringTag,{value:"Module"}));var sr=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Ng=i=>{var a;const t=_e(),s=Se(),n=s.id,r=cs.use(s.categoryId),[o,d]=P.useState(null),[u,c]=P.useState(),[l,m]=P.useState(new ka);if(s.childId){const v=Fi.use(s.childId);v&&c(v)}P.useEffect(()=>{h()},[n,s.childId]);const h=()=>{var v;if(s.childId){var S=(v=ao.get(n))!==null&&v!==void 0?v:[];const y=S.find(b=>b.id==s.childId);c(y)}else{var x=new Ne;x.fareCategoryId=s.categoryId,x.parentId=n,c(x)}},f=(v,x,S,y)=>sr(void 0,void 0,void 0,function*(){let b=new _s().validate(v,i.extraParamsData,x,S,r,i.roles,y,i.i18n.get(Lt).formatMessage);b.isValid?(yield Ve.saveChild(v,x,S),p()):m(b.errors)}),p=()=>{t(D.GetPersonEditUri(n))};if(!parent||!r||!u)return null;const{formatMessage:g}=i.i18n.get(Xe);return e.jsxs(re,{title:e.jsxs(e.Fragment,{children:[((a=u==null?void 0:u.code)===null||a===void 0?void 0:a.length)>0?g(v=>v.Apri):g(v=>v.Add)," ",e.jsx(Ye,{id:r.id})]}),fullWidth:!0,children:[e.jsx(Te,{}),e.jsx("div",{className:"bg-white p-4",children:e.jsx(Fc,{parentId:n,person:u,changeDocuments:v=>{d(v)},documents:o,onChange:v=>c(v),onSubmit:(v,x,S)=>sr(void 0,void 0,void 0,function*(){f(u,v,x,S)}),errors:l,onCancel:p,hideTitle:!0})})]})},wg=bt(et(_(Ng)))(i=>i.allByKey(),"extraParamsData"),nr=Object.freeze(Object.defineProperty({__proto__:null,default:wg},Symbol.toStringTag,{value:"Module"}));var Cg=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Pg=i=>{var a,t,s,n,r,o,d,u;const c=Se(),l=_e(),{formatMessage:m}=i.i18n.get(Xe),{formatMessage:h}=i.i18n.get(Ft),[f,p]=P.useState({person:null,errors:new ka,rulesAccepted:!1,documents:[]}),g=Fi.use(c.personId);if(g==null)return e.jsx(X,{});if(!Ne.canRequestRenew(g)&&!Ne.canRenew(g))return null;const v=g.fareCategoryId!=null?i.fareCategories[g.fareCategoryId]:void 0;if(!v)return null;const x=()=>Cg(void 0,void 0,void 0,function*(){if(yield Ci("Stai richiedendo il rinnovo della tessera: la validità attuale non verrà modificata. Riceverai una notifica via mail a rinnovo avvenuto. Vuoi procedere?")){const y=new _s().validateAttachments(g,f.documents,v,i.roles);y.isValid?(yield Ve.renewWithAttachments(g.id,f.documents),l(D.MyPersonsPage)):p(Object.assign(Object.assign({},f),{errors:y.errors}))}}),S=(y,b)=>{if(y==null||y.length==0){p(Object.assign(Object.assign({},f),{documents:[]}));return}let j=[...f.documents||[]];for(let I=0;I<y.length;
18I++)j.push({file:y[I],isIdentityDocumentType:b});p(Object.assign(Object.assign({},f),{documents:j}))};return e.jsx(re,{title:e.jsxs(e.Fragment,{children:[m(y=>y.RinnovaTessera)," ",g.code]}),children:e.jsx("div",{className:"row",children:e.jsxs("div",{className:"col-12 col-lg-8",children:[e.jsx(Te,{customLink:D.MyPersonsPage}),e.jsxs(xl,{person:g,navigate:l,hideQrCode:!0,children:[e.jsxs("div",{className:"row",children:[(v==null?void 0:v.idDocumentRequired)==!0&&e.jsx("div",{className:"col-12",children:e.jsx(bn,{files:(d=(t=(a=f.documents)===null||a===void 0?void 0:a.filter(y=>y.isIdentityDocumentType))===null||t===void 0?void 0:t.map(y=>y.file))!==null&&d!==void 0?d:[],label:h(y=>y.AttachIdentityDocument),onChange:y=>S(y,!0),accept:Ne.PersonAttchmentsAccptedExtensions(),error:f.errors.identitydocumentAttachment,multiple:!0})}),(v==null?void 0:v.requiresAttachment)==!0&&e.jsx("div",{className:"col-12",children:e.jsx(bn,{files:(u=(n=(s=f.documents)===null||s===void 0?void 0:s.filter(y=>!y.isIdentityDocumentType))===null||n===void 0?void 0:n.map(y=>y.file))!==null&&u!==void 0?u:[],label:`${h(y=>y.AttachmentRequested)}: ${v==null?void 0:v.attachmentsNotes}`,accept:Ne.PersonAttchmentsAccptedExtensions(),error:f.errors.fareCategoryAttachment,onChange:y=>S(y,!1),maxFileSize:Ne.maxAttachmentSize,multiple:!0})})]}),v&&v.link&&e.jsxs("div",{className:"alert alert-info my-2 d-flex align-items-center fw-bold",children:[e.jsx("i",{className:"fas fa-info-circle fa-lg me-2"}),e.jsx("a",{href:v.link,target:"blank",className:"link-underline-primary",style:{textDecoration:"underline"},children:h(y=>y.CheckCarrierForModulesDetails)})]}),((r=v==null?void 0:v.personPrivacyFlag)===null||r===void 0?void 0:r.link)&&((o=v==null?void 0:v.personPrivacyFlag)===null||o===void 0?void 0:o.label)&&e.jsxs("div",{className:"alert alert-warning my-2 d-flex align-items-center",children:[e.jsx("div",{className:"me-2",children:e.jsx(ct,{className:"border-highlighted",name:"rulesAccepted",checked:f.rulesAccepted,onChange:y=>p(Object.assign(Object.assign({},f),{rulesAccepted:y}))})}),e.jsxs("div",{children:[e.jsx("div",{children:Qe.GetPersonPrivacyFlagLabel(v,i.hl)}),e.jsx("a",{href:Qe.GetPersonPrivacyFlagLink(v,i.hl),target:"_blank",children:e.jsx("strong",{children:h(y=>y.ViewPrivacyPolicy)})}),f.errors.rulesAccepted&&e.jsxs("div",{children:[" ",e.jsx(ot,{error:f.errors.rulesAccepted})]})]})]}),e.jsx("button",{type:"button",className:"btn btn-primary btn-highlight px-5 mt-2",onClick:x,children:m(y=>y.RinnovaTessera)})]})]})})})},Dg=yt(Pg)(i=>i.allByKey(),"fareCategories"),Ig=_(et(Dg)),Tg=Object.freeze(Object.defineProperty({__proto__:null,default:Ig},Symbol.toStringTag,{value:"Module"})),_g=i=>{const{reservations:a}=i;return e.jsx(e.Fragment,{children:a.map(t=>e.jsx(kg,{reservation:t},t.id))})},kg=i=>{const{reservation:a}=i,t=It(()=>xe.ticket(a.id),[a.id]);return t?e.jsx($t,{ticket:t}):null};class Ag extends P.Component{componentDidMount(){ft().subscriptionId=this.props.params.id,Et.SUBSCRIPTION_DETAIL_REQUESTED(this.props.params.id)}render(){var a,t,s,n,r,o;const{subscription:d,i18n:u}=this.props,c=!!d&&(d.isCanceled||new Date(d.validity.to)<new Date),{formatMessage:l}=u.get(Xe),{formatMessage:m}=this.props.i18n.get(Q);var{formatMessage:h}=u.get(ie);if(!d)return e.jsx("div",{});const f=d.reservations.filter(j=>!j.isCanceled),p=ea(d.urlPdf,this.props.hl),g=`/images/walletPasses/apple/${this.props.hl}_add_to_apple_wallet.svg`,v=`/images/walletPasses/google/${this.props.hl}_add_to_google_wallet.svg`,x=`/passes/apple/downloadPassPage/${this.props.params.id}?passType=subscription`,S=`/passes/google/downloadPassPage/${this.props.params.id}?passType=subscription`,y=!d.isCanceled&&d.isPayed&&(d.isValid||d.validity.to<new Date),b=d.type==1;return e.jsx(re,{title:e.jsxs("span",{children:[" ",l(j=>j.VersioneDigitale)]}),fullWidth:!0,children:e.jsxs("div",{className:"container",children:[e.jsx(Te,{customLink:D.SubscriptionsPath}),e.jsxs("h2",{className:"text-medium fw-bold",children:[" ",e.jsx(Ca,{id:d.subscriptionTypeId})]}),e.jsxs(Bt,{className:"mt-4",children:[e.jsxs("div",{className:"row position-relative",children:[e.jsx("div",{className:"fontsize-10u text-medium fw-bolder mb-2"}),e.jsx("div",{className:"col-6 col-lg-4 my-1",children:e.jsx(ya,{id:d.departureStopOrPool,label:h(j=>j.Partenza)})}),d.maxKm==null&&d.departureStopOrPool!=d.arrivalPool&&e.jsx("div",{className:"col-6 col-lg-4 my-1",children:e.jsx(ya,{id:d.arrivalPool,label:h(j=>j.Arrival)})}),e.jsxs("div",{className:"col-12 col-lg-4 my-1",children:[e.jsx(qt,{price:d.value,fullPrice:d.value,toPay:d.value-d.payedAmount-((s=d.discount)!==null&&s!==void 0?s:0)-((n=d.reliefAmount)!==null&&n!==void 0?n:0),pnr:d.pnr}),d.isPayed&&e.jsx("div",{children:e.jsx("div",{className:"fw-bold text-success",children:m(j=>j.Pagato)})})]})]}),e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsxs("div",{className:"row",children:[ji.showValidity(d)&&e.jsx("div",{className:"col",children:e.jsx(hl,{subscription:d})}),!c&&e.jsx("div",{className:"col",children:e.jsx(pl,{subscription:d})})]})})}),e.jsxs("div",{className:"row border-top mt-3 pt-4 pb-3 align-items-center",children:[e.jsx("div",{className:"col-12 d-flex justify-content-center justify-content-lg-between mb-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"fw-bold text-medium fontsize-15u text-uppercase",children:[d.pnr?"PNR":e.jsx(e.Fragment,{children:l(j=>j.Codice)})," ",d.pnr||d.code]}),m(j=>j.DataDiEmissioe),": ",k.getReadableDateTimeString(d.issueDate)]})}),e.jsx("div",{className:"col-12 col-lg-5",children:e.jsxs("div",{className:"row",children:[!c&&e.jsx("div",{className:"col-12 col-md-auto d-flex justify-content-center justify-content-lg-start",children:e.jsx(Ss,{className:"mb-3",text:d.code,size:200})}),e.jsx("div",{className:"col-12 col-sm d-flex justify-content-center justify-content-lg-start",children:e.jsxs("div",{style:{minWidth:200},children:[e.jsx(rt,{label:m(j=>j.Passeggero),value:e.jsxs(e.Fragment,{children:[(r=(a=d.passenger)===null||a===void 0?void 0:a.name)!==null&&r!==void 0?r:""," ",(o=(t=d.passenger)===null||t===void 0?void 0:t.surname)!==null&&o!==void 0?o:""]})}),d.personId&&e.jsx(rt,{label:l(j=>j.Tessera),value:e.jsx(Is,{id:d.personId,selector:j=>e.jsxs(e.Fragment,{children:["Tessera ",j.code]})})}),e.jsx(rt,{label:l(j=>j.FareCategory),value:e.jsx(Ye,{id:d.passenger.fareCategoryId})}),d.paymentMethod!=null&&d.paymentMethod!=0&&e.jsx(rt,{label:m(j=>j.MetodoPagamento),value:e.jsx(Yi,{method:d.paymentMethod})})]})})]})}),y&&e.jsxs("div",{className:"row d-none d-lg-flex",children:[e.jsx("a",{href:p,className:"col-4 btn btn-primary-light btn-lg fw-bold py-2 px-5 d-flex align-items-center justify-content-center",target:"_blank",style:{marginBottom:3,minHeight:50},children:m(j=>j.ScaricaPdf)}),d.validity.to>new Date&&!b&&e.jsx("div",{className:"col-6",children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-md-auto",children:e.jsx("a",{href:x,target:"_blank",style:{marginBottom:3},children:e.jsx("img",{src:g,style:{height:50,objectFit:"contain"},alt:"Add to Apple Wallet"})})}),e.jsx("div",{className:"col-md-auto",children:e.jsx("a",{href:S,target:"_blank",style:{marginBottom:3},children:e.jsx("img",{src:v,style:{height:50,objectFit:"contain"},alt:"Add to Google Wallet"})})})]})})]}),y&&e.jsxs("div",{className:"row d-lg-none mt-2 g-2",children:[e.jsx("div",{className:"col-12",children:e.jsx("a",{href:p,className:"btn btn-primary-light d-flex align-items-center justify-content-center fw-bold py-3 px-5 w-100",target:"_blank",rel:"noopener",children:m(j=>j.ScaricaPdf)})}),!b&&e.jsx("div",{className:"col-12",children:e.jsxs("div",{className:"row g-2",children:[e.jsx("div",{className:"col-6 text-center",children:e.jsx("a",{href:x,target:"_blank",rel:"noopener",className:"d-block py-2",children:e.jsx("img",{src:g,alt:"Aggiungi ad Apple Wallet",className:"img-fluid",style:{height:50,objectFit:"contain"},draggable:!1})})}),e.jsx("div",{className:"col-6 text-center",children:e.jsx("a",{href:S,target:"_blank",rel:"noopener",className:"d-block py-2",children:e.jsx("img",{src:v,alt:"Aggiungi a Google Wallet",className:"img-fluid",style:{height:50,objectFit:"contain"},draggable:!1})})})]})})]}),e.jsx(Bc,{subscription:d})]})]}),f.length>0&&e.jsx("div",{className:"fontsize-5u mt-4 mb-2 fw-bold",children:l(j=>j.PrenotazioniEffettuata)}),e.jsx(_g,{reservations:f})]})})}}const Rg=Be(Ag),Mg=fe(_(Rg),ft(),({subscription:i})=>({subscription:i})),Og=Object.freeze(Object.defineProperty({__proto__:null,default:Mg},Symbol.toStringTag,{value:"Module"})),zg=i=>{const{subscription:a,reservations:t}=i;return a==null?null:e.jsx("div",{className:"row",children:e.jsxs("div",{className:"col-12",children:[e.jsx(Ou,{id:a.departureStopOrPool,selector:(s,n)=>{var r,o;return e.jsxs("div",{className:"me-2",children:[e.jsx("div",{className:"fontsize-3d mb-1",children:e.jsx("span",{className:"fw-bold",children:(r=i.label)!==null&&r!==void 0?r:e.jsx(Br,{typeId:a.subscriptionTypeId})})}),e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:"me-1 fw-bold",children:(o=s==null?void 0:s.description)!==null&&o!==void 0?o:n==null?void 0:n.shortDescription}),e.jsx("div",{children:e.jsx(dn,{className:"me-1"})}),e.jsx("div",{className:"me-2 fw-bold",children:e.jsx(zu,{id:a.arrivalPool})})]})]})}}),e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{children:e.jsx("i",{className:"fa-solid fa-calendar me-2",style:{color:"#212121",opacity:"0.4"}})}),e.jsx("div",{className:"fw-bold me-2 text-nowrap",children:e.jsx(Lr,{validity:a.validity,children:s=>e.jsx(e.Fragment,{children:s})})}),e.jsx("i",{className:"fa-solid fa-calendar-check me-2 text-gray",style:{color:"#212121",opacity:"0.4"}}),e.jsx("div",{className:"fw-bold me-2",children:e.jsx(Er,{subscription:a,temporary:t.length})})]})]})})},Lg=fe(zg,ft(),i=>({reservations:i.solutions,subscription:i.subscription})),Eg=i=>{const{reservation:a,i18n:t,canProceed:s,onProceed:n,showCoupon:r,entranceAnimation:o}=i;if(!a)return null;const{formatMessage:d}=t.get(ie),{formatMessage:u}=t.get(He);return e.jsx("div",{className:`footer-container ${r?"coupon":""}`,children:e.jsx("div",{className:`footer ${r?"coupon":""} fixed-bottom bg-white shadow-lg ${o?"animate__animated animate__bounceInLeft":""}`,children:e.jsx("div",{className:"container py-3 h-100",children:e.jsxs("div",{className:"row align-items-center h-100",children:[r&&e.jsx("div",{className:"col-12 col-lg-9",children:e.jsx("div",{style:{maxWidth:300},children:e.jsx(Ds,{label:e.jsxs(e.Fragment,{children:[e.jsx("strong",{className:"me-2",children:u(c=>c.HaiUnCoupon)}),e.jsx("span",{children:u(c=>c.InserisciCoupon)})]}),hasExternal:Pe.hasExternal(a)})})}
18),e.jsx("div",{className:`col-6 ${r?"col-lg-3 ":"col-lg-12"} `,children:e.jsxs("div",{className:"mb-2",children:[e.jsx("div",{className:"fontsize-5u fw-bolder text-medium",children:d(c=>c.TotalPrice)}),e.jsxs("div",{className:"fontsize-20u fw-bolder text-medium",children:["⬠",V.toDecimalString(a.price)]})]})}),e.jsx("div",{className:"d-none d-lg-block col-lg-9 mt-2",children:e.jsx(Lg,{})}),e.jsx("div",{className:"col-6 col-lg-3 d-flex align-items-center",children:e.jsx("button",{className:"btn btn-primary btn-lg btn-highlight d-flex align-items-center justify-content-center fw-bold fontsize-5u py-3 w-100",disabled:!s,onClick:s?n:void 0,children:e.jsx("span",{children:"Prenota"})})})]})})})})},Fg=fe(_(Eg),ft(),i=>({reservation:i.reservation}));var Bg=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const $g=_(i=>{var a,t,{formatMessage:s}=i.i18n.get(ie);const{selectable:n,selected:r,onClick:o,solution:d,reservation:u}=i,c=Ee.getTripDetails(d),l=d.trips.some(v=>Ea(v)),m=Pt.GetSelectedSeats(u),h=m.some(v=>d.trips.some(x=>x.trip.tripId==v.tripId)&&v.passengers.some(x=>x.seats.length>0)),f=P.useRef(null),p=v=>Bg(void 0,void 0,void 0,function*(){var x;yield Li.SelectSeat(u.reservationId,v),(x=f==null?void 0:f.current)===null||x===void 0||x.close()});let g={label:s(v=>v.Select),className:"btn-primary btn-highlight"};if(c.isBlocked)g={label:s(v=>v.SoluzioneBloccata),className:"btn-outline-secondary"};else if(c.canceled)g={label:s(v=>v.CorsaAnnullata),className:"btn-outline-secondary"};else if(!n&&(!((a=c.exclusion)===null||a===void 0)&&a.trip||!((t=c.exclusion)===null||t===void 0)&&t.route))g={label:s(v=>v.NotForSale),className:"btn-outline-secondary"};else if(!n)g={label:s(v=>v.PostiEsauriti),className:"btn-outline-secondary"};else if(r&&!l)g={icon:"fa-solid fa-check",label:`${s(v=>v.Selected)}`,className:"btn-success btn-highlight text-white"};else if(r&&l&&h)g={icon:"fa-solid fa-check",label:`${s(v=>v.Seat)} ${s(v=>v.Selected)}`,className:"btn-success btn-highlight text-white"};else if(r&&l&&!h){const v=typeof i.ticketIndex=="function"?i.ticketIndex(d):i.ticketIndex;return e.jsx(Tt,{ref:f,disabled:!n,text:`${s(x=>x.Select)} ${s(x=>x.Seats)}`,icon:"fa-solid fa-check me-2",className:"btn btn-lg btn-success btn-highlight text-white w-100 d-flex align-items-center justify-content-center",children:e.jsx($r,{occupation:i.solution.trips.map((x,S)=>so(x,S!=0,S!=i.solution.trips.length-1))||[],passengers:i.passengers,reservationId:u.reservationId,onSeatsChanged:p,selectedSeats:m,reservedSeats:"hide",showDisabilities:!1,ticketIndex:v})})}return e.jsxs("button",{disabled:!n,className:`btn btn-lg ${g.className} w-100 d-flex align-items-center justify-content-center`,onClick:n?o:void 0,children:[g.icon&&e.jsx("i",{className:"fa-solid fa-check me-2"})," ",V.capitalize(g.label)]})}),Wg=fe($g,ft(),(i,a)=>{var t,s;return{reservation:i.reservation,passengers:(s=(t=i.reservation)===null||t===void 0?void 0:t.passengerReservations.map(n=>n.passenger))!==null&&s!==void 0?s:[]}});var aa=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};class Ug extends P.Component{constructor(a){super(a),this.SubscriptionSolutionSelection=t=>e.jsx(Wg,Object.assign({},t)),this.TravelSolutionTemplate=t=>e.jsx(ba,Object.assign({},t,{selectedFareCategories:[Fe.Default],customSelector:this.SubscriptionSolutionSelection,subscriptionReservation:!0})),this.onChangeDate=t=>{t&&this.setState({date:t})},this.issue=()=>aa(this,void 0,void 0,function*(){var t;const{subscription:s,reservation:n}=this.props;if(!s||!n)return;if(n.fullPrice>0&&!this.state.paymentMethod){xt.error("Seleziona il metodo di pagmento!");return}let r;if(n.fullPrice>0&&ns((t=this.state.paymentMethod)===null||t===void 0?void 0:t.type)&&Va.isAvailableForPayments()){const m=yield Va.createOrder(n.fullPrice,this.props.user.email);if(Va.PaymentOk(m))r=m.transactionRef;else{this.setState({loading:!1});return}}var o=null;n.paymentMethod==4&&(o=this.state.clientIntegrationPaymentId);var d=this.props.okPath,u=this.props.koPath;d||(d=we(D.SubscriptionReservationResultServerPath(s.id))),u||(u=we(D.SubscriptionReservationResultServerPath(s.id)));const c=yield Li.Issue({reservationId:n.reservationId,subscriptionId:s.id,useWallet:this.state.useWallet,okUrl:d,koUrl:u,addressData:void 0,email:"",transactionCode:r,clientIntegrationPaymentId:o??void 0});let l=!0;if(c.redirect&&(l=yield st(c.redirect,this.props.history)),l)this.props.history(D.getSubscriptionDetail(s.id));else throw"unexpected error"}),this.onSelectSolution=t=>aa(this,void 0,void 0,function*(){var s,n,r,o,d;const{subscription:u,reservation:c}=this.props;if(!u)return;const l={trips:t.trips,calculatedPrice:(o=(s=t.priceInfo)===null||s===void 0?void 0:s.totalPrice)!==null&&o!==void 0?o:0,fullPrice:void 0,returnPriceDaysConfigured:void 0,returnPrice:(n=t.priceInfo)===null||n===void 0?void 0:n.returnPrice,limitations:[],remainingSeats:t.remainingSeats,customMessageIds:[],returnPriceAvailable:!1,oneWayPrice:(r=t.priceInfo)===null||r===void 0?void 0:r.onWayPrice,timezone:""},h=ei((d=c==null?void 0:c.passengerReservations.map(g=>g.tickets))!==null&&d!==void 0?d:[]).map(g=>({trips:g.segments.map(v=>{var x,S,y,b;return{routeCustomersDescription:"",departureDateTime:v.departureTime,arrivalDateTime:v.arrivalTime,departureStopId:v.departureId,arrivalStopId:v.arrivalId,arrivalLocality:(y=(x=ua.get(v.arrivalId))===null||x===void 0?void 0:x.localityId)!==null&&y!==void 0?y:"",departureLocality:(b=(S=ua.get(v.departureId))===null||S===void 0?void 0:S.localityId)!==null&&b!==void 0?b:"",tripDepartureDateTime:v.departureTime,excludedRoute:!1,excludedTrip:!1,trip:{blocked:!1,canSelectSeat:!1,carrierId:v.carrierId,luggagesSlots:[],lineId:v.lineId,routeId:void 0,travelMode:0,tripId:v.tripId,canceled:!1,vehicleDescription:"",lineType:void 0}}}),calculatedPrice:0,customMessageIds:[],fullPrice:0,limitations:[],oneWayPrice:0,remainingSeats:0,returnPrice:0,returnPriceAvailable:!1,returnPriceDaysConfigured:0,timezone:""})),f=this.props.subscriptionTypes[u.subscriptionTypeId],p=yield Lu.getNewSelection(u,f,[...h,l],Ci,ai);this.createOrUpdateReservation(p)}),this.onChangePaymentMethod=(t,s)=>aa(this,[t,s],void 0,function*([n,r],o){var d,u;yield Li.SelectPaymentMethod((u=(d=this.props.reservation)===null||d===void 0?void 0:d.reservationId)!==null&&u!==void 0?u:"",(n==null?void 0:n.type)||0,o.paymentDataId||"",o.savePaymentData),this.state.useWallet!=r&&this.setState({useWallet:r}),(!Dr(o,this.state.additionalData)||n!=this.state.paymentMethod)&&this.setState({paymentMethod:n,additionalData:o})}),this.state={date:null,loading:!1,paymentMethod:null,additionalData:_t,useWallet:!1,clientIntegrationPaymentId:null}}static getDerivedStateFromProps(a,t){return t.date==null&&a.subscription!=null?{date:ji.getMinMaxDate(a.subscription,a.roles,a.user).from}:null}componentDidMount(){ft().subscriptionId=this.props.params.id,Et.SUBSCRIPTION_DETAIL_REQUESTED(this.props.params.id)}createOrUpdateReservation(a){return aa(this,void 0,void 0,function*(){var t,s,n;this.setState({loading:!0}),ft().solutions=a;let r=null;return a.length===0&&(!((t=this.props.reservation)===null||t===void 0)&&t.reservationId)?Li.Delete((s=this.props.reservation)===null||s===void 0?void 0:s.reservationId):r=yield Li.Reserve({subscriptionId:this.props.subscription.id,useReservedSeatsIfNeeded:!1,reservationId:((n=this.props.reservation)===null||n===void 0?void 0:n.reservationId)||"",salesChannel:1,solutions:a.map(o=>({trips:o.trips.map(d=>{var u,c;const l=(c=(u=ft().getSelectedSeatsForSolution(o.trips))===null||u===void 0?void 0:u.find(h=>h.tripId==d.trip.tripId))===null||c===void 0?void 0:c.passengers,m=l!=null?ei(l.map(h=>h.seats)):void 0;return{id:d.trip.tripId,departureTime:d.departureDateTime,arrivalTime:d.arrivalDateTime,departureStopId:d.departureStopId,arrivalStopId:d.arrivalStopId,carrierId:d.trip.carrierId,seatNumbers:m&&m.length>0?m:void 0}}),ticketId:void 0,ticketCode:void 0}))}),this.setState({loading:!1}),r==null?void 0:r.data})}render(){var a,t,s,n,r,o;const{subscription:d,reservation:u,roles:c,subscriptionTypes:l}=this.props;if(!l)return e.jsx(X,{});if(!d||!this.state.date)return e.jsx("div",{});const m=ji.getMinMaxDate(d,c,this.props.user),{formatMessage:h}=this.props.i18n.get(Xe),{date:f,paymentMethod:p}=this.state,g=ii(f&&ei((u==null?void 0:u.passengerReservations.map(b=>b.tickets))||[]),b=>{var j;return(j=b.segments[0])===null||j===void 0?void 0:j.departureTime}),v=ii(d.reservations.filter(b=>
18!b.isCanceled).filter(b=>b.departureDate>k.Today()),b=>b.departureDate),x=v.filter(b=>k.ToDate(b.departureDate).valueOf()==k.PlainDateToDate(f).valueOf());var S=kt.canProceedReservation(u,this.state.clientIntegrationPaymentId);const y=l[d.subscriptionTypeId];return e.jsxs(re,{fullWidth:!0,title:e.jsxs(e.Fragment,{children:[h(b=>b.PrenotaSu)," ",e.jsx(Ca,{id:d.subscriptionTypeId})]}),children:[e.jsx(Te,{}),e.jsx("div",{className:"row mb-4",children:e.jsxs("div",{className:"col-12 font-medium fw-bold fontsize-10u",children:[e.jsx(Br,{typeId:d.subscriptionTypeId})," ",d.code," ",d.passenger.name," ",d.passenger.surname,e.jsx($c,{id:d.subscriptionTypeId})]})}),e.jsxs("div",{className:"row",children:[e.jsxs("div",{className:"col-12 col-sm-12 col-lg-4 col-xl-3",children:[e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(md,{label:h(b=>b.DataDelViaggio),value:(s=this.state.date)!==null&&s!==void 0?s:void 0,onSelectDate:this.onChangeDate,dateRange:m,enableDates:m.dates(),inline:!0,dayComponent:(b,j)=>{var I;if(!j)return e.jsx("span",{children:b});const N=k.PlainDateToDate(j).valueOf(),w=ei((((I=this.props.reservation)===null||I===void 0?void 0:I.passengerReservations)||[]).map(C=>C.tickets)).find(C=>k.ToDate(C.segments[0].departureTime).valueOf()==N),T=v.find(C=>k.ToDate(C.departureDate).valueOf()==N);return w!=null?e.jsx("span",{className:"text-info",children:b}):T!=null?e.jsx("strong",{className:"text-success",children:b}):e.jsx("span",{children:b})}})}),e.jsxs("div",{style:{marginTop:15},children:[g.length>0&&"Prenotazioni selezionate:",g.map((b,j)=>e.jsx(Wc,{ticket:b,onRemove:()=>{this.createOrUpdateReservation(this.props.solutions.filter(I=>!Ee.matchTripByDateTicketReservation(I,b)))}},j)),x.length>0&&e.jsx("strong",{children:`Prenotazioni del ${k.getReadableDateString(k.PlainDateToDate(f))} confermate`}),x.map(b=>e.jsx(Uc,{getTicketDetailPath:D.GetTicketDetail,reservation:b},b.code))]})]}),e.jsxs("div",{className:"col-12 col-sm-12 col-lg-8 col-xl-9",children:[e.jsxs(ja,{justified:!0,children:[e.jsx(lt,{name:"outbound",caption:e.jsxs("span",{className:"text-primary",style:{fontSize:"1.2em"},children:[h(b=>b.PrenotaCorsaAndata_UCase)," ",k.getReadableDateString(k.PlainDateToDate(this.state.date))]}),children:e.jsx(ls,{skipPrice:!0,departure:d.departureStopOrPool,arrival:d.arrivalPool,travelSolutionTemplate:this.TravelSolutionTemplate,selectedDate:this.state.date,onChangeDate:b=>this.setState({date:b}),selectedPassengers:[Fe.Default],onSelectSolution:this.onSelectSolution,selectedSolution:b=>{var j,I;return(I=(j=u==null?void 0:u.passengerReservations[0])===null||j===void 0?void 0:j.tickets.some(N=>Ee.matchSolutionTicketReservation(b,N)))!==null&&I!==void 0?I:!1},ticketIndex:b=>{var j,I;return(I=(j=u==null?void 0:u.passengerReservations[0])===null||j===void 0?void 0:j.tickets.findIndex(N=>Ee.matchSolutionTicketReservation(b,N)))!==null&&I!==void 0?I:0},channel:1,minimumDate:m.from,reservationId:u==null?void 0:u.reservationId,isReturn:!1,changeDate:!1,hideCarousel:!0,subscriptionTypeId:d.subscriptionTypeId,locale:this.props.hl,useReservedSeats:!1})}),!(y!=null&&y.oneWay)&&e.jsx(lt,{name:"return",caption:e.jsxs("span",{className:"text-primary",style:{fontSize:"1.2em"},children:[h(b=>b.PrenotaCorsaRitorno_UCase)," ",k.getReadableDateString(k.PlainDateToDate(this.state.date))]}),children:e.jsx(ls,{skipPrice:!0,departure:d.arrivalPool,arrival:d.departureStopOrPool,travelSolutionTemplate:this.TravelSolutionTemplate,selectedDate:this.state.date,onChangeDate:b=>this.setState({date:b}),selectedPassengers:[Fe.Default],onSelectSolution:this.onSelectSolution,selectedSolution:b=>{var j,I;return(I=(j=u==null?void 0:u.passengerReservations[0])===null||j===void 0?void 0:j.tickets.some(N=>Ee.matchSolutionTicketReservation(b,N)))!==null&&I!==void 0?I:!1},ticketIndex:b=>{var j,I;return(I=(j=u==null?void 0:u.passengerReservations[0])===null||j===void 0?void 0:j.tickets.findIndex(N=>Ee.matchSolutionTicketReservation(b,N)))!==null&&I!==void 0?I:0},channel:1,minimumDate:m.from,reservationId:u==null?void 0:u.reservationId,isReturn:!0,changeDate:!1,hideCarousel:!0,subscriptionTypeId:d.subscriptionTypeId,locale:this.props.hl,useReservedSeats:!1})})]}),(u==null?void 0:u.fullPrice)&&((n=u==null?void 0:u.fullPrice)!==null&&n!==void 0?n:0)>0&&e.jsxs("div",{style:{paddingTop:10,paddingBottom:10},children:[e.jsx(Tr,{selectedPaymentMethod:[p,this.state.useWallet],onChangePaymentMethod:this.onChangePaymentMethod,price:(r=u==null?void 0:u.fullPrice)!==null&&r!==void 0?r:0,additionalData:this.state.additionalData,walletRechargeLink:"#",saleChannel:1,payPalProceed:b=>this.setState({clientIntegrationPaymentId:b}),payPalRequest:{issue:{reservationId:u.reservationId,useWallet:this.state.useWallet,paymentMethod:u.paymentMethod}},clientIntegrationPaymentId:this.state.clientIntegrationPaymentId,hasCommissionKept:((o=u==null?void 0:u.commissionsKept)!==null&&o!==void 0?o:0)>0,vatNumber:((t=(a=d.invoiceRequest)===null||a===void 0?void 0:a.invoiceData)===null||t===void 0?void 0:t.vatNumber)||null}),ns(p==null?void 0:p.type)&&e.jsx("div",{className:"bg-white container p-3",children:e.jsx("div",{style:{maxWidth:400},children:e.jsx(_r,{})})}),e.jsx("div",{className:"text-end",style:{paddingTop:10},children:e.jsxs("strong",{className:"me-2",style:{fontSize:"2em"},children:["TOTALE DA PAGARE: ⬠",V.toDecimalString(u.fullPrice)]})})]})]})]}),e.jsx(Fg,{canProceed:S,onProceed:this.issue}),e.jsx("div",{className:u!=null&&u.reservationId?"float-end":"d-none",style:{minWidth:380,width:"35%",marginTop:20},children:e.jsxs("button",{className:"btn btn-primary float-end",role:"button",onClick:this.issue,disabled:this.state.loading,style:{borderBottom:0,position:"relative",minWidth:310,maxWidth:420,height:60,fontSize:"1.3em"},children:["PRENOTA",e.jsx("i",{style:{marginRight:10},className:this.state.loading?"fas fa-circle-notch fa-spin fa-fw":"fa fa-arrow-circle-right","aria-hidden":"true"})]})}),e.jsx("div",{className:"clearfix"})]})}}const Vg=Be(Ug),Gg=Aa(pt(fe(_(Vg),ft(),({subscription:i,reservation:a,solutions:t})=>({subscription:i,reservation:a,solutions:t})))),qg=Gr(Gg)(i=>i.allByKey(),"subscriptionTypes"),Hg=Object.freeze(Object.defineProperty({__proto__:null,default:qg},Symbol.toStringTag,{value:"Module"}));
18class Kg extends P.Component{constructor(a){super(a),this.state={tickets:null,urlPdf:null}}componentDidMount(){const{subscriptionId:a,groupId:t}=this.props.params;ft().subscriptionId=a,Et.SUBSCRIPTION_DETAIL_REQUESTED(a),xe.ticketGroup(t).then(s=>this.setState({tickets:s.tickets}))}render(){const{formatMessage:a}=this.props.i18n.get(Xe),{subscription:t}=this.props,{tickets:s}=this.state;if(!s||!t)return e.jsx(X,{});const n=ji.getRemainingTrips(t);return e.jsxs(re,{fullWidth:!0,title:e.jsxs(e.Fragment,{children:[s.length," ",s.length>1?` ${a(r=>r.PrenotazioniEffettuata)}`:` ${a(r=>r.PrenotazioneEffettuata)}`]}),children:[e.jsxs("div",{className:"d-flex justify-content-between align-items-center",children:[e.jsx(Te,{customLink:D.getSubscriptionDetail(t.id),customLabel:a(r=>r.TornaAllAbbonamento)}),e.jsxs("div",{className:"mb-2",children:[e.jsxs("a",{className:"btn btn-gray py-2 px-4",href:this.state.urlPdf?this.state.urlPdf:"#",role:"button",target:"_blank",children:[e.jsx("i",{className:"fa-solid fa-file-pdf me-2"}),a(r=>r.Stampa)]}),n!=null&&n>0&&e.jsx(ke,{to:D.SubscriptionReservation(t.id),className:"btn btn-primary btn-highlight ms-3 py-2 px-4",role:"button",children:a(r=>r.PrenotaAncora)})]})]}),s.map(r=>e.jsx($t,{ticket:r},r.id))]})}}const Qg=fe(_(Be(Kg)),ft(),({subscription:i})=>({subscription:i})),Jg=Object.freeze(Object.defineProperty({__proto__:null,default:Qg},Symbol.toStringTag,{value:"Module"})),Yg=()=>js()+"broker",Zg=()=>js()+"login",Xg=_(i=>{const{formatMessage:a}=i.i18n.get(Ra);return dt.environmentName=="giunta"||dt.environmentName=="atm"?null:e.jsxs("div",{className:"bg-primary bg-opacity-10 border border-primary border-opacity-25 rounded-4 p-3 p-sm-4",children:[e.jsxs("div",{className:"d-flex align-items-center mb-3",children:[e.jsx("span",{className:"d-inline-flex align-items-center justify-content-center bg-body rounded-3 shadow-sm flex-shrink-0 me-3",style:{width:44,height:44},children:e.jsx("i",{className:"fa-solid fa-briefcase text-body-emphasis fa-lg","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("h5",{className:"fw-bold mb-1",children:a(t=>t.InviteTitle)}),e.jsx("p",{className:"mb-0 text-secondary small",children:a(t=>t.BannerText)})]})]}),e.jsxs("div",{className:"d-grid gap-2 d-sm-flex",children:[e.jsx("a",{href:Yg(),className:"btn btn-primary fw-bold flex-fill",children:a(t=>t.InviteRegister)}),e.jsx("a",{href:Zg(),className:"btn btn-outline-primary fw-bold flex-fill",children:a(t=>t.InviteLogin)})]})]})}),Xt=i=>e.jsxs("li",{className:"d-flex align-items-start py-2",children:[e.jsx("i",{className:"fa-solid fa-circle-check text-success fa-lg me-3 mt-1 flex-shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"fw-semibold",children:i.label})]}),ef=_(i=>{var a;const{formatMessage:t}=i.i18n.get(ne),s=(a=i.reservation)===null||a===void 0?void 0:a.reservationId,n=It(()=>s?new Eu().getValidForReservation(s):Promise.resolve([]),[s]);return!n||n.length==0?null:e.jsx(e.Fragment,{children:n.map(r=>e.jsx(Xt,{label:e.jsxs(e.Fragment,{children:[t(o=>o.FidelityAdvantage),": ",Vc(r,i.hl)]})},r.id))})}),tf=fe(ef,J(),i=>({reservation:i.get()})),af=Be(_(pt(ui(class extends P.Component{componentDidMount(){this.props.user!=null&&this.props.history(D.TicketPaymentMethodPath,{replace:!0})}render(){var a,t,s,n,{formatMessage:r}=this.props.i18n.get(ne),{formatMessage:o}=this.props.i18n.get(Ft);const d={pathname:Na,search:"?returnUrl="+encodeURIComponent(we(D.TicketPaymentMethodPath))},u=[...(s=(a=K.getSolution())===null||a===void 0?void 0:a.trips)!==null&&s!==void 0?s:[],...(n=(t=K.getReturnSolution())===null||t===void 0?void 0:t.trips)!==null&&n!==void 0?n:[]].some(c=>Ea(c))&&!this.props.roles.some(c=>Xi.piantinebus.read.name==c);return e.jsx("div",{className:"flexbox-container",children:e.jsx("div",{className:"card border-0 shadow rounded-4 w-100 mx-auto",style:{maxWidth:560},children:e.jsxs("div",{className:"card-body p-4 p-sm-5",children:[e.jsx("h4",{className:"fw-bolder text-medium mb-1",children:r(c=>c.RegisterOrNot)}),e.jsx("p",{className:"text-secondary",children:r(c=>c.RegistrationAdvantages)}),e.jsxs("ul",{className:"list-unstyled mb-4",children:[u&&e.jsx(Xt,{label:r(c=>c.SeatsChoice)}),e.jsx(ze,{role:ce.canusewallet,children:e.jsx(Xt,{label:r(c=>c.PagamentoConBorsellino)})}),e.jsx(Xt,{label:r(c=>c.ReservedAreaShort)}
18),e.jsx(Xt,{label:r(c=>c.TicketManage)}),e.jsx(Xt,{label:r(c=>c.Notifications)}),e.jsx(Xt,{label:r(c=>c.AllPaymentMethods)}),e.jsx(tf,{})]}),e.jsxs("div",{className:"d-grid gap-2 d-sm-flex",children:[e.jsx(ke,{className:"btn btn-primary btn-highlight btn-lg fw-bolder text-medium flex-fill",to:d,children:o(c=>c.SignIn)}),e.jsx(ke,{className:"btn btn-primary-light btn-lg fw-bolder text-medium flex-fill",to:D.UserRegisterPath,children:o(c=>c.SignUp)})]}),e.jsx(ze,{role:ce.canissue,children:e.jsxs("div",{className:"text-center mt-4",children:[e.jsx("div",{className:"text-secondary small mb-2",children:r(c=>c.NotIterestedToRegister)}),e.jsx(ke,{className:"btn btn-outline-secondary btn-lg fw-bold px-4 w-100",to:D.TicketPaymentMethodPath,children:o(c=>c.NoSignIn)})]})}),e.jsx("hr",{className:"my-4"}),e.jsx(Xg,{})]})})})}})))),sf=Object.freeze(Object.defineProperty({__proto__:null,default:af},Symbol.toStringTag,{value:"Module"}));var rr=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const bl=(i,a)=>{let t=i.find(n=>n.nominal);if(a&&t){var s=i.filter(n=>n!=t);s.forEach(n=>{n.nominal&&(n.nominal=!1,n.fareCategoryId=void 0),n.excludedCategoriesIds=[t.fareCategoryId]}),i=[t].concat(s)}else i.forEach(n=>n.excludedCategoriesIds=[])},nf=bt(yt(_(pt(class extends P.Component{constructor(a){super(a),this.onPassengerChange=t=>rr(this,void 0,void 0,function*(){bl(t,this.props.user);const s=J();let n=!0;for(const r of t){const o=s.getExtraParams(r),d=ri.extraParamsErrors(this.props.extraData,o,r.extraData,this.props.i18n.get(Lt).formatMessage);d&&Object.keys(d).length>0&&(n=!1)}n?yield this.reserve(t):s.applyPassengers(t)}),this.personsSelectorTemplate=this.props.user!=null&&this.props.roles.indexOf(ce.caninsertpassengercard.name)!=-1?t=>e.jsx(zo,Object.assign({},t,{allowNull:!0,selectionFilter:s=>t.selectionFilter(s)})):void 0,this.state={showValidationError:!1}}reserve(a){return rr(this,void 0,void 0,function*(){const t=K.getSolution();a.length>0&&t&&Me.setPassengersForIssue(a,{isFamily:this.props.reservation.isFamily})})}render(){var a;const{reservation:t,passengers:s}=this.props;return t?e.jsx(Gc,{passengers:s,returnSelected:t.passengerReservations[0].tickets.length==2,onChange:this.onPassengerChange,showValidationErrors:this.state.showValidationError,maxPassengers:te.maxEndUserPassengers,lines:J().getLines(),showNotes:this.props.roles.find(n=>n===ce.caninsertpassengernotes.name)!=null,personsSelector:this.personsSelectorTemplate,isFamily:t.isFamily,departureDate:k.PlainDateToDate(K.getSolution().date),returnDate:!((a=K.getSolution())===null||a===void 0)&&a.date?k.PlainDateToDate(K.getSolution().date):null,saleChannel:1,selectedCategoriesIds:s.map(n=>{var r;return(r=n.fareCategoryId)!==null&&r!==void 0?r:null}),navigate:this.props.navigate,allowedTypes:[0]}):null}})))(i=>i.getall(),"allCategories"))(i=>i.allByKey(),"extraData"),rf=ui(fe(nf,J(),(i,a)=>{const t=i.get(),s=i.passengers;return bl(s,a.user),{reservation:t,passengers:s}}));class of extends P.PureComponent{constructor(a){super(a),this.blablaCarriers=["ouibus","alsa","blablabus","comuto pro (blablacar bus)","LOSIO"],this.isVisible=()=>J().getLines().length==0,this.isVisible()||this.props.onCheck(!0)}getBlaBlaCarriersTermsLinks(){const a=J().getSolutions(),t=Gt(ei(a.map(n=>n.map(r=>r.carrierId))));var s=[];return t.map(n=>{this.blablaCarriers.find(r=>r.toLowerCase()==n.toLowerCase())&&s.length==0&&s.push(e.jsx("a",{href:"https://blog.blablacar.it/about-us/terms-and-conditions",target:"_blank",children:n.toUpperCase()}))}),s}render(){var{formatMessage:a}=this.props.i18n.get(Ft);return this.isVisible()?e.jsxs("div",{className:"alert alert-primary-light",children:[e.jsx(ct,{className:"border-highlighted",onChange:t=>this.props.onCheck(t),checked:this.props.checked,label:e.jsxs("span",{className:"text-primary",style:{fontWeight:"bold",textTransform:"uppercase",textAlign:"left"},children:[" ",a(t=>t.PrivacyLabelOthers)]})}),e.jsxs("div",{children:[e.jsx("small",{children:a(t=>t.AcceptPrivacyAndTravelRulesExternal)}),e.jsx("br",{}),this.getBlaBlaCarriersTermsLinks()]})]}):null}}const lf=_(of),df=i=>{const{reservation:a,solutions:t}=i;if(a==null)return null;const s=r=>{Me.setLuggages(r)},{formatMessage:n}=i.i18n.get(He);return e.jsx(Wr,{reservationId:a.reservationId,solutions:t,onChange:s,children:(r,o)=>e.jsxs("div",{children:[o!=null&&e.jsx(Ie,{title:n(d=>d.AdditionalVehicles),icon:e.jsx("i",{className:"fas fa-car"}),children:o}),r!=null&&e.jsx(Ie,{title:n(d=>d.AdditionalLuggages),icon:e.jsx("i",{className:"fa fa-suitcase-rolling"}),children:r})]})})},cf=_(fe(df,J(),i=>({reservation:i.get()}))),uf=i=>{const{reservation:a,solutions:t}=i;if(a==null)return null;const s=r=>{Me.setLuggages(r)},{formatMessage:n}=i.i18n.get(He);return e.jsx(Wr,{reservationId:a.reservationId,solutions:t,onChange:s,fromCard:!0,children:(r,o)=>e.jsxs("div",{children:[o!=null&&e.jsx(Ie,{title:n(d=>d.AdditionalVehiclesFromCard),icon:e.jsx("i",{className:"fas fa-car"}),children:o}),r!=null&&e.jsx(Ie,{title:n(d=>d.AdditionalLuggagesFromCard),icon:e.jsx("i",{className:"fa fa-suitcase-rolling"}),children:r})]})})},mf=_(fe(uf,J(),i=>({reservation:i.get()})));var or=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const hf=i=>{var{formatMessage:a}=i.i18n.get(ne);if(!i.user)return null;const t=It(()=>Ws.forReservation(i.reservation.reservationId),[i.reservation]);if(!t||t.length==0)return null;const s=o=>or(void 0,void 0,void 0,function*(){yield Me.applyFidelity(o)}),n=()=>or(void 0,void 0,void 0,function*(){yield Me.removeFidelity()});if(!t||t.length==0)return null;let r=null;return i.reservation.fidelityId&&t.find(o=>o.fidelityId==i.reservation.fidelityId)&&i.reservation.fidelityPoints&&i.reservation.fidelityPoints>0&&(r=i.reservation.fidelityPoints),t.map((o,d)=>{const u=i.reservation.fidelityId==o.fidelityId,c=i.reservation.fidelityId!==void 0&&i.reservation.fidelityId!=o.fidelityId;return e.jsx(Ie,{title:e.jsx(qc,{id:o.fidelityId,hl:i.hl}),icon:e.jsx("i",{className:"fa-solid fa-gift"}),children:e.jsx("div",{children:e.jsx("div",{className:u&&r&&" border border-primary border-2 bg-primary-light rounded p-2"||"border border-1 rounded p-2",children:e.jsxs("div",{className:"d-flex flex-row justify-content-between align-items-center",children:[e.jsxs("div",{children:[e.jsxs("div",{children:["Hai maturato ",e.jsxs("strong",{children:[o.value," punti"]})]}),o.threshold>o.value&&e.jsxs("div",{children:["Ti mancano ancora ",e.jsxs("strong",{children:[o.threshold-o.value," punti"]})," per avere il tuo premio"]}),u&&r&&e.jsxs("div",{children:["Hai utilizzato ",e.jsxs("strong",{children:[r," punti"]}
18)," su questo acquisto, il nuovo saldo sarà di ",e.jsxs("strong",{children:[o.value-r," punti"]})]})]}),c==!1&&o.threshold<=o.value&&e.jsx("button",{type:"button",className:"btn btn-info text-white fw-bold rounded ",onClick:()=>u?n():s(o.fidelityId),children:a(u?l=>l.DismissFidelity:l=>l.UseFidelity)})]})})})},d)})},pf=_(ci(hf)),vf=fe(pf,J(),i=>({reservation:i.get()}));var sa=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const yl=bt(class extends P.Component{constructor(i){var a,t,s,n,r,o,d,u;super(i),this.errorDiv=P.createRef(),this.onChangeInvoiceData=fr((l,m)=>sa(this,void 0,void 0,function*(){var h;this.setState({invoice:l}),l?(new fi(this.props.i18n).validate(m).isValid?yield Me.applyInvoiceData(m):!((h=this.props.reservation)===null||h===void 0)&&h.invoiceData&&Me.applyInvoiceData(null),this.setState({invoiceData:m})):(this.setState({invoiceData:new oi(this.props.roles.indexOf(ce.canrequestinvoice.name)!=-1)}),yield Me.applyInvoiceData(null))}),500),this.passengersAreValids=l=>{var m,h;const f=new Fu;for(const p of l){const g=J().getExtraParams(p);if(!f.validate(p,this.props.extraParamsData,g,l,this.props.fareCategories,this.props.i18n.get(Lt).formatMessage,(h=(m=this.props.reservation)===null||m===void 0?void 0:m.isShipping)!==null&&h!==void 0?h:!1).isValid)return!1}return!0},this.vehiclesAreValids=l=>{var m;const h=this.props.i18n.get(Lt).formatMessage;for(const f of l)for(const p of f.tickets)for(const g of(m=p.luggages)!==null&&m!==void 0?m:[]){const v=this.props.fareCategories.find(S=>S.id==g.luggageId);if(!v)throw"luggage not found";if(ri.extraParamsErrors(this.props.extraParamsData,v.extraParams,g.extraData,h)!=null)return!1}return!0},this.completeAndValidate=()=>sa(this,void 0,void 0,function*(){var l,m,h;const f=((m=(l=this.props.reservation)===null||l===void 0?void 0:l.paymentMethodMetadata)===null||m===void 0?void 0:m.type)=="creditCard"&&((h=this.props.reservation.paymentMethodMetadata)===null||h===void 0?void 0:h.clientIntegration),{formatMessage:p}=this.props.i18n.get(Q),g=J().get(),v=J().passengers;yield Me.setPassengersForIssue(v,{isFamily:g.isFamily,force:!0});const x=K.getSolution();if(this.sendPassengersAddedEvent(g,v,x,K.getReturnSolution()),!this.state.email||!V.isValidEmail(this.state.email))return this.setState({emailError:p(S=>S.Obbligatorio)}),this.setError(p(S=>S.EmailObbligatoria)),!1;if(!this.state.callingCode||!this.state.phone)return this.setState({phoneError:p(S=>S.Obbligatorio)}),this.setError(p(S=>S.TelefonoObbligatorio)),!1;if(!this.passengersAreValids(v))return this.setError(p(S=>S.PasseggeriNonValidi)),!1;if(!this.vehiclesAreValids(g.passengerReservations))return this.setError(p(S=>S.VeicoliNonValidi)),!1;if(!this.props.paymentMethod&&J().GetAmountToShow(void 0)>0)return this.setError(p(S=>S.PaymentMethodRequired)),!1;if(this.props.paymentMethod==3&&!f&&this.state.billingAddress==null&&!Pe.IsApplePay(this.props.reservation)&&!Pe.IsGooglePay(this.props.reservation))return this.setError(p(S=>S.BillingAddressRequired)),!1;if(!this.state.rulesAccepted)return this.setError(p(S=>S.Errore_TermsAndConditions)),!1;if(this.state.invoice&&this.state.invoiceData){const S=new fi(this.props.i18n).validate(this.state.invoiceData);if(this.setState({invoiceDataErrors:S.errors}),S.isValid)yield Me.applyInvoiceData(this.state.invoiceData);else return this.setError(p(y=>y.InvoiceDataRequired)),!1}return this.props.user==null&&(this.state.directMarketing==null||this.state.indirectMarketing==null)?(this.setState({marketingErrors:p(S=>S.MarketingFlags)}),!1):g.paymentMethod==12?((yield Ci(e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{children:"PagoPA"}),e.jsx("p",{className:"fontsize-2u",children:"PagoPA richiede una commissione extra di 1.50â¬. Sei sicuro di voler continuare?"})]})))&&(yield new Pi().confirmPagoPA(),yield ai(e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{children:"PagoPA temporaneamene non disponibile"}),e.jsx("p",{className:"fontsize-2u",children:"Selezionare un'altra modalità di pagamento"})]}))),!1):!0}),this.proceed=l=>sa(this,void 0,void 0,function*(){var m;if(!(yield this.completeAndValidate()))return;const h=J().get();this.setState({redirectingForInternalPayments:!0});var f=null,p=void 0;h.paymentMethod==4&&(f=this.state.paypalClientIntegrationPaymentId),h.paymentMethod==3&&(f=this.state.nexiBuildClientIntegrationPaymentId,p=h.savePaymentData&&this.state.nexiNumContratto||void 0);const g={email:this.state.email,phone:this.state.phone,callingCode:this.state.callingCode,okUrl:we(D.TicketResultRedirectPath),koUrl:we(D.TicketResultRedirectPathKo),sendSms:!1,useWallet:this.state.useWallet,user:this.props.user,requestedExpiration:this.state.expirationDate,addressData:(m=this.state.billingAddress)!==null&&m!==void 0?m:void 0,hidePrice
18:!1,clientIntegrationPaymentId:f,autoCheckin:!1,payByLinkUrl:"",numContratto:p,nexiApmResponse:l,directMarketing:this.state.directMarketing,indirectMarketing:this.state.indirectMarketing},v=yield us.ISSUE(g);this.sendReservationCheckedoutEvent(h);let x=!0;if(v.redirect&&(li.clear(),x=yield st(v.redirect,this.props.history)),x){li.clear();let S=D.TicketResultRedirectPath+"/"+v.result.groupId;v.result.coupon&&(S+=`/${v.result.coupon}`),this.props.history(S)}this.setState({redirectingForInternalPayments:!1})}),this.onAcceptRules=l=>sa(this,void 0,void 0,function*(){this.setState({rulesAccepted:l})}),this.onCheckSolutionCarriersTerms=l=>this.setState({carriersTermsAccepted:l}),this.onChangeMarketingFlags=(l,m)=>{this.setState({directMarketing:m,indirectMarketing:l,marketingErrors:""})},this.setError=l=>{this.setState({submitError:l},()=>{var m,h;return(h=(m=this.errorDiv)===null||m===void 0?void 0:m.current)===null||h===void 0?void 0:h.scrollIntoView({behavior:"smooth"})})};const c=(n=K.getCallingCode())!==null&&n!==void 0?n:(a=i.user)===null||a===void 0?void 0:a.callingCode;this.state={loading:!1,redirectingForExternalPayments:!1,redirectingForInternalPayments:!1,email:(o=(r=K.getEmail())!==null&&r!==void 0?r:(t=this.props.user)===null||t===void 0?void 0:t.email)!==null&&o!==void 0?o:"",phone:(u=(d=K.getPhone())!==null&&d!==void 0?d:(s=this.props.user)===null||s===void 0?void 0:s.phoneNumber)!==null&&u!==void 0?u:"",callingCode:c||"+39",expiryDate:null,summaryVisible:!1,useWallet:!1,invoice:!1,invoiceData:null,invoiceDataErrors:null,expirationDate:void 0,billingAddress:null,phoneError:"",emailError:"",submitError:"",rulesAccepted:!1,carriersTermsAccepted:!1,paypalClientIntegrationPaymentId:null,nexiBuildClientIntegrationPaymentId:null,nexiNumContratto:null,directMarketing:void 0,indirectMarketing:void 0,marketingErrors:"",callingCodeFlagAccepted:!1}}componentDidMount(){if(!this.props.reservation){this.props.history(D.TravelSelection());return}if(!K.getSolution()){this.props.history(D.TravelSelection());return}}sendPassengersAddedEvent(i,a,t,s){var n;if(!(t!=null&&t.priceInfo)||s!=null&&s.priceInfo==null)return;const r={reservationId:i.reservationId,reservationType:s!=null?"AR":"CS",passengersQuantity:a.length,totalPrice:i.price,inboundSolution:s!=null?{solutionId:Ee.getSolutionId(s),departureId:s.departureStopId,departureDate:s.trips[0].departureDateTime,arrivalId:s.arrivalStopId,arrivalDate:s.trips[s.trips.length-1].arrivalDateTime,price:(n=s.priceInfo)===null||n===void 0?void 0:n.totalPrice}:void 0,outboundSolution:t!=null?{solutionId:Ee.getSolutionId(t),departureId:t.departureStopId,departureDate:t.trips[0].departureDateTime,arrivalId:t.arrivalStopId,arrivalDate:t.trips[t.trips.length-1].arrivalDateTime,price:t.priceInfo.totalPrice}:void 0};qe.send(new hd(r))}sendReservationCheckedoutEvent(i){var a,t;const s=ye(ei(i.passengerReservations.map(p=>p.tickets)),p=>p.segments.length),n=(i.price||0)/s,r=Pt.getSolutionId(i);let o=ei(i.passengerReservations.map(p=>p.tickets)).map(p=>({id:r,departureId:p.segments[0].departureId,departureDate:p.segments[0].departureTime,arrivalId:p.segments[p.segments.length-1].arrivalId,arrivalDate:p.segments[p.segments.length-1].arrivalTime,name:p.ticketCode||"",price:n,quantity:1})),d=i.passengerReservations[0];const u=d.tickets[0].segments[0].departureTime,c=!((a=d.tickets[1])===null||a===void 0)&&a.segments[0]?(t=d.tickets[1])===null||t===void 0?void 0:t.segments[0].departureTime:void 0,l=Pt.ToLuggageSelection(i,this.props.fareCategories),m=Fe.getCategories(i.passengerReservations.map(p=>p.passenger),this.props.fareCategories,l),h=Fe.getOccupation(m),f={id:i.reservationId,details:o,grandtotal:i.price,paymentMethod:Pe.getPaymentMethodStringDescription(i.paymentMethod),couponCode:i.couponCode,checkinDate:u,checkoutDate:c,adults:h.adults,children:h.children};qe.send(new pd(f))}buildInvoiceData(){var i,a;if(this.state.invoiceData)return this.state.invoiceData;let t=new oi(this.props.roles.indexOf(ce.canrequestinvoice.name)!=-1);return t.email=(a=(i=this.props.user)===null||i===void 0?void 0:i.email)!==null&&a!==void 0?a:this.state.email,t}render(){var i,a,t,s,n,r;if(!this.props.reservation)return e.jsx("div",{});const{reservation:o,i18n:d}=this.props,{formatMessage:u}=d.get(ne),c=d.get(Q).formatMessage,l=this.props.i18n.get(He).formatMessage;if(this.state.redirectingForExternalPayments)return e.jsx(X,{label:c(v=>v.WaitForRedirectToPayment)});if(this.state.redirectingForInternalPayments)return e.jsx(X,{label:c(v=>v.WaitForInternalPayment)});const m=this.props.roles.indexOf(ce.canchoosepaymentexpiration.name)!=-1,h=J().getSolutions(),f=J().GetAmountToShow(void 0),p=["+1","+44"].indexOf(this.state.callingCode)!=-1;var g=kt.canProceedReservationAndPrice(f,o,this.state.paypalClientIntegrationPaymentId,this.state.nexiBuildClientIntegrationPaymentId);return e.jsx(Ii,{showNavigation:!0,proceed:v=>this.proceed(v),canProceed:g,canProceedWithApm:this.state.rulesAccepted&&!this.state.submitError,useWallet:this.state.useWallet,children:e.jsx("div",{className:"row",children:e.jsxs("div",{className:"col-12",children:[e.jsxs(Ie,{icon:e.jsx("i",{className:"fa-solid fa-users"}),title:u(v=>v.Passengers),children:[e.jsx(rf,{navigate:this.props.history}),e.jsx("div",{className:"container-lg",children:e.jsxs("div",{className:"row border-top border-2 mt-4 pt-5",children:[e.jsx("div",{className:"col-12 mb-3",children:e.jsx("div",{className:"fontsize-6u fw-bolder text-medium",children:u(v=>v.ContactForAdvisories)})}),e.jsx("div",{className:"col-12 col-md-6",children:e.jsx(Nr,{onChange:(v,x)=>{K.setEmail(x),this.setState({email:x})},label:c(v=>v.Email),disabled:this.props.user!=null&&!V.isNullOrWhiteSpace(this.props.user.email),value:this.state.email,error:this.state.emailError,required:!0,viewAddon:!0})}),e.jsxs("div",{className:"col-12 col-md-6",children:[e.jsx(xs,{name:"phone",onChange:(v,x,S)=>{K.setCallingCode(x),K.setPhone(S),this.setState({callingCode:x,phone:S})},label:c(v=>v.IssuePhone),disabled:this.props.user!=null&&!V.isNullOrWhiteSpace(this.props.user.phoneNumber)&&!V.isNullOrWhiteSpace(this.props.user.callingCode),phoneNumber:this.state.phone,callingCode:this.state.callingCode,required:!0}
18),this.state.phoneError&&e.jsx(ot,{error:this.state.phoneError})]}),this.props.user==null&&e.jsxs("div",{className:`alert alert-warning ${!this.state.email&&!this.state.phone?"pulse":""}`,children:[e.jsx("strong",{children:u(v=>v.InformationWarning)}),p&&e.jsx("div",{children:e.jsx("strong",{children:u(v=>v.CanadaUsUkSmsAlert)})})]})]})})]}),e.jsx(ll,{outboud:K.getSolution(),inbound:K.getReturnSolution(),redirectUrl:this.props.location.pathname}),e.jsxs(ze,{role:ce.canissueluggages,children:[e.jsx(mf,{solutions:[K.getSolution(),K.getReturnSolution()].filter(v=>v)}),e.jsx(cf,{solutions:[K.getSolution(),K.getReturnSolution()].filter(v=>v)})]}),e.jsx("div",{className:"d-block d-xl-none",children:e.jsx("div",{className:"bg-white shadow p-3 mb-3",children:e.jsx(rn,{saleChannel:1})})}),(f>0||this.props.reservation.fidelityId)&&e.jsx(vf,{}),f>0&&e.jsxs(Ie,{title:u(v=>v.PaymentMethod),icon:e.jsx("i",{className:"fa-solid fa-wallet"}),children:[e.jsx(ol,{onChangeUseWallet:v=>this.setState({useWallet:v}),useWallet:this.state.useWallet,changeDate:!1,expirationDate:this.state.expirationDate||null,onChooseExpirationDate:v=>{this.setState({expirationDate:v||void 0})},canChooseExpiration:m,payPalProceed:v=>this.setState({paypalClientIntegrationPaymentId:v}),payPalRequest:{issue:{reservationId:o.reservationId,useWallet:this.state.useWallet,paymentMethod:o.paymentMethod}},payPalClientIntegrationPaymentId:this.state.paypalClientIntegrationPaymentId,nexiBuildProceed:(v,x)=>{this.setState({nexiBuildClientIntegrationPaymentId:v,nexiNumContratto:x})},nexiBuildRequest:{issue:{reservationId:o.reservationId,useWallet:this.state.useWallet,paymentMethod:o.paymentMethod}},addressData:this.state.billingAddress,billingAddressSelector:e.jsx("div",{children:e.jsx(ds,{label:l(v=>v.BillingAddress),onSelect:v=>this.setState({billingAddress:v}),selectedItem:(s=(i=this.state.billingAddress)===null||i===void 0?void 0:i.id)!==null&&s!==void 0?s:null})}),nexiClientIntegrationPaymentId:this.state.nexiBuildClientIntegrationPaymentId}),this.props.reservation.paymentMethod==3&&!Pe.IsApplePay(this.props.reservation)&&!Pe.IsGooglePay(this.props.reservation)&&(!(!((a=this.props.reservation.paymentMethodMetadata)===null||a===void 0)&&a.clientIntegration)||this.props.reservation.paymentMethodMetadata.type=="gestPay")&&e.jsx("div",{className:"my-3",children:e.jsx(ds,{label:l(v=>v.BillingAddress),onSelect:v=>this.setState({billingAddress:v}),selectedItem:(n=(t=this.state.billingAddress)===null||t===void 0?void 0:t.id)!==null&&n!==void 0?n:null})})]}),this.props.paymentMethod==2&&e.jsx("div",{className:"alert alert-warning",children:o.expiryDate&&u(v=>v.NonFarScaderePrenotazione(o.expiryDate))}),this.props.paymentMethod==16&&e.jsx("div",{className:"alert alert-warning",children:o.expiryDate&&u(v=>v.NonFarScaderePrenotazioneViaCash(o.expiryDate))}),e.jsx(zr,{tripsCarrierIds:Gt(h[0].map(v=>v.carrierId)),lines:Gt(h[0].map(v=>v.lineId).filter(v=>v))}),e.jsx(lf,{checked:this.state.carriersTermsAccepted,onCheck:this.onCheckSolutionCarriersTerms}),e.jsx(ze,{role:[ce.canrequestinvoice,ce.canrequestinvoiceforprivateusers],mode:"some",children:e.jsxs("div",{className:`my-2 border ${this.state.invoice?"bg-primary-light rounded p-3 border-primary":"alert alert-warning border-warning"}`,children:[e.jsx("div",{className:"fs-4 fw-bold mb-2",children:c(v=>v.InvoiceTitle)}),e.jsx(Ps,{invoice:this.state.invoice,invoiceData:this.buildInvoiceData(),onChange:this.onChangeInvoiceData,errors:(r=this.state.invoiceDataErrors)!==null&&r!==void 0?r:new Ia,searchBar:!1}),e.jsx("div",{className:"mt-2 fw-bold text-danger",children:c(v=>v.InvoiceRequestDisclaimer)}),te.environmentName==="marinobus"&&e.jsx("div",{className:"fontsize-2d mt-2 fw-bold",children:c(v=>v.InvoiceRequestDisclaimerMarinoBus)})]})}),p&&e.jsx(ct,{label:u(v=>v.CanadaUsUkSmsAlertFlag),className:"border-highlighted my-1",name:"rulesAccepted",checked:this.state.callingCodeFlagAccepted,onChange:v=>this.setState({callingCodeFlagAccepted:v})}),e.jsxs("div",{className:`alert ${this.state.rulesAccepted?"alert-success":"alert-primary-light"}`,children:[e.jsx("div",{className:"fs-4 fw-bold mb-2",children:c(v=>v.PrivacyAndTermConditions)}),e.jsx(ct,{className:"border-highlighted",name:"rulesAccepted",checked:this.state.rulesAccepted,onChange:this.onAcceptRules,label:e.jsx(wa,{})})]}),this.props.user==null&&e.jsxs("div",{className:"mb-2",children:[" ",e.jsx(kr,{directMarketing:this.state.directMarketing,indirectMarketing:this.state.indirectMarketing,errors:this.state.marketingErrors,onChange:this.onChangeMarketingFlags})]}),this.state.submitError&&e.jsxs("div",{ref:this.errorDiv,className:"alert bg-danger text-white",children:[e.jsx("span",{className:"badge bg-light me-2 fontsize-1u text-danger",children:l(v=>v.Attenzione)}),e.jsx("span",{className:"me-2",children:this.state.submitError})]})]})})})}})(i=>i.allByKey(),"extraParamsData"),gf=fe(_(pt(ui(yt(Be(yl))(i=>i.getall(),"fareCategories")))),J(),i=>{var a,t,s,n,r,o;return{paymentMethod:(n=(a=i.get())===null||a===void 0?void 0:a.paymentMethod)!==null&&n!==void 0?n:null,paymentDataId:(r=(t=i.get())===null||t===void 0?void 0:t.paymentDataId)!==null&&r!==void 0?r:null,savePaymentData:(o=(s=i.get())===null||s===void 0?void 0:s.savePaymentData)!==null&&o!==void 0?o:!1,reservation:i.get()}}),ff=Object.freeze(Object.defineProperty({__proto__:null,PaymentMethodSelectionInternal:yl,default:gf},Symbol.toStringTag,{value:"Module"}));var xf=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const bf=i=>{if(!i.reservation)return null;const a=o=>xf(void 0,void 0,void 0,function*(){i.reservation||i.onReservationExpired(),yield Me.selectSeats(o)}),t=ni(i.solution.trips,o=>o.departureDateTime.valueOf()),s=t.map((o,d)=>so(o,d!=0,d!=t.length-1)),n=J().getSelectedSeats(),r=J().passengers;return e.jsx($r,{reservationId:i.reservation&&i.reservation.reservationId,occupation:s,selectedSeats:n,onSeatsChanged:a,passengers:r,reservedSeats:i.reservedSeats,ticketIndex:i.ticketIndex})},yf=_(fe(bf,J(),i=>({reservation:i.get()})));var jf=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Sf=i=>{const{i18n:a,roles:t,reservation:s}=i,n=Kt(),r=_e(),o=decodeURIComponent(new URLSearchParams(n.search).get("redirectUrl")),d=new URLSearchParams(n.search).get("isreturn")=="true",u=d?K.getReturnSolution():K.get
18Solution(),{formatMessage:c}=a.get(ne);if(!s||!u)return null;const l=()=>{const f=u.trips.filter(g=>Ea(g)).map(g=>g.trip.tripId);return s.passengerReservations.some(g=>g.tickets.some(v=>v.segments.filter(x=>f.indexOf(x.tripId)!=-1).some(x=>x.seatChosen==!1)))==!1},m=()=>jf(void 0,void 0,void 0,function*(){var f;const p=J().get();if(!p){r(D.TravelSelection(),{replace:!0});return}const g=((f=p.passengerReservations[0].tickets[1])===null||f===void 0?void 0:f.segments.length)>0;if(l())r(g&&!d?D.GetSeatSelectionPath(!0,o):o);else{var{formatMessage:v}=i.i18n.get(ne),x=v(S=>S.PostiNonSelezionati);xt.warning(x)}}),h=l();return e.jsx(Ii,{proceed:m,canProceed:h,showNavigation:!0,title:c(d?f=>f.ReturnSeatSelection:f=>f.SeatSelection),canProceedWithApm:!0,useWallet:!1,children:e.jsx(yf,{proceed:m,caption:c(f=>f.SeatSelection),solution:u,onReservationExpired:()=>r(D.TravelSelection(),{replace:!0}),reservedSeats:os(t),ticketIndex:d?1:0})})},Nf=_(pt(Sf)),wf=fe(Nf,J(),i=>({reservation:i.get()})),Cf=Object.freeze(Object.defineProperty({__proto__:null,default:wf},Symbol.toStringTag,{value:"Module"}));var Ya=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};let jl=class Sl extends P.Component{constructor(a){super(a),this.state={tickets:[],urlPdf:"",coupon:null}}componentDidMount(){return Ya(this,void 0,void 0,function*(){xi.isInitialized()&&(yield xi.clear());const{tickets:a,urlPdf:t}=yield xe.ticketGroup(this.props.params.groupId);let s=null;this.props.params.coupon&&this.props.params.coupon!="null"&&(s=yield Sl.couponService.get(this.props.params.coupon));const n=Math.max(...a.map(o=>Math.ceil(o.issueDate.valueOf()/6e4))),r=a.filter(o=>Math.ceil(o.issueDate.valueOf()/6e4)===n);this.setState({tickets:r,urlPdf:t,coupon:s}),yield this.sendTransactionEvent(r)})}sendTransactionEvent(a){return Ya(this,void 0,void 0,function*(){const t=a[0].groupid,s=yield Promise.all(a.map(o=>Ya(this,void 0,void 0,function*(){var d,u,c,l,m,h,f;const p=(h=(d=yield bi.get(o.parts[0].departureId))===null||d===void 0?void 0:d.shortDescription)!==null&&h!==void 0?h:"",g=(f=(u=yield bi.get(o.parts[o.parts.length-1].arrivalId))===null||u===void 0?void 0:u.shortDescription)!==null&&f!==void 0?f:"";return{id:`${o.parts[0].departureId.substr(0,18)}-${o.parts[o.parts.length-1].arrivalId.substr(0,18)}`,name:`${p}-${g}`,departureName:p,departureId:(c=o.parts[0])===null||c===void 0?void 0:c.departureId,departureDate:(l=o.parts[0])===null||l===void 0?void 0:l.departureDate,arrivalName:g,arrivalId:(m=o.parts[o.parts.length-1])===null||m===void 0?void 0:m.arrivalId,arrivalDate:o.parts[o.parts.length-1].arrivalDate,price:o.price,discount:o.discount,quantity:1}})));let n="Unknown";switch(a[0].paymentMethod){case 0:n="None";break;case 1:n="Cash";break;case 2:n="Sisal";break;case 3:n="CreditCard";break;case 4:n="PayPal";break;case 6:n="Wallet";break;case 7:n="OnBoard";break;case 8:n="External";break;case 9:n="Pos";break;case 10:n="Later";break;case 11:n="AgencyPos";break;case 12:n="PagoPa";break;case 13:n="ScalaPay";break;case 20:n="HeyLight";break;case 14:n="SatisPay";break;case 15:n="BankTransfer";break}const r={id:t,date:a[0].issueDate,grandtotal:a[0].paymentMethod==2?ye(a,o=>o.toPay):ye(a,o=>o.payedAmount),paymentMethod:n,details:s,email:a[0].email};qe.send(new Ns(r))})}componentWillUnmount(){K.clear(),J().clear()}render(){if(!this.state.tickets||this.state.tickets.length===0)return e.jsx(X,{});const{formatMessage:a}=this.props.i18n.get(ne),{formatMessage:t}=this.props.i18n.get(Q),s=this.state.urlPdf?ea(this.state.urlPdf,this.props.hl):"#",n=ye(this.state.tickets,d=>d.price+d.penaltiesAmount-d.payedAmount-d.discount-d.reliefAmount),r=this.state.tickets[0].paymentMethod===2;let o;return n>0&&!r?o=e.jsxs("span",{children:[e.jsx("i",{className:"fa fa-exclamation-triangle text-danger"})," ",a(d=>d.AcquistoKo)]}):o=e.jsxs("span",{children:[e.jsx("i",{className:"fa fa-thumbs-up fa-lg",style:{marginRight:10}}),a(d=>r?d.AcquistoOkSisal:d.AcquistoOk)]}),e.jsxs(re,{title:o,fullWidth:!0,children:[e.jsx("div",{className:"d-flex justify-content-end",children:e.jsx(Te,{customLink:"/",customLabel:t(d=>d.Prenota)})}),e.jsx(cn,{pdfUrl:s,tickets:this.state.tickets})]})}};jl.couponService=new Ta;const Pf=_(Be(jl)),Df=Object.freeze(Object.defineProperty({__proto__:null,default:Pf},Symbol.toStringTag,{value:"Module"}));var lr=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const If=i=>{const a=Se(),t=_e(),[s,n]=P.useState(null);P.useEffect(()=>{},[]),P.useEffect(()=>{r(a.groupId)},[a.groupId]);const r=c=>lr(void 0,void 0,void 0,function*(){const{tickets:l}=yield xe.ticketGroup(c);n(l)}),o=()=>lr(void 0,void 0,void 0,function*(){const c=yield xe.ticketGroup(a.groupId);if(!Oe.canPayToBePayed(c.tickets,i.roles)){Re.fire(d(m=>m.RetryPaymentExpired));return}yield xe.ensurepayToBePayed(a.groupId),t(D.GetPayToBePayedUrl(c.tickets[0].groupid),{replace:!0})}),{formatMessage:d}=i.i18n.get(ne);if(!s)return e.jsx(X,{});const u=Oe.canPayToBePayed(s,i.roles);return e.jsxs(re,{fullWidth:!0,title:d(c=>c.AcquistoKo),children:[e.jsx(Te,{customLink:"/"}),s.map(c=>e.jsx($t,{ticket:c},"tkt_"+c.id)),u&&e.jsxs("button",{className:"btn btn-primary btn-highlight text-uppercase mt-3 px-5 btn-lg my-3",onClick:o,children:[e.jsx("i",{className:"fas fa-refresh me-2"})," ",d(c=>c.RetryPayment)]})]})},Tf=et(_(If)),_f=Object.freeze(Object.defineProperty({__proto__:null,default:Tf},Symbol.toStringTag,{value:"Module"}));var kf=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const dr=new Bu,Af=()=>{const{ticketid:i}=Se(),[a]=di(),t=a.get("passType")||"",[s,n]=P.useState("downloading");P.useEffect(()=>{kf(void 0,void 0,void 0,function*(){try{n("downloading"),yield t=="subscription"?dr.getSubscription(i):dr.getTicket(i),n("idle")}catch{n("error")}})},[i,t]);const r=()=>{switch(s){case"downloading":return e.jsx("div",{className:"alert alert-info",children:"Download in corso..."});case"error":return e.jsx("div",{className:"alert alert-danger",children:"Si è verificato un errore durante il download."});case"idle":return e.jsx("div",{className:"alert alert-success",children:"Download effettuato"})}};return e.jsx(re,{fullWidth:!0,children:r()})},Rf=Object.freeze(Object.defineProperty({__proto__:null,default:Af},Symbol.toStringTag,{value:"Module"}));var Mf=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const cr=new $u,Of=()=>{const{ticketid:i}=Se(),[a]=di(),t=a.get("passType")||"",[s,n]=P.useState("downloading");P.useEffect(()=>{Mf(void 0,void 0,void 0,function*(){try{n("downloading");const d=t=="subscription"?yield cr.getSubscription(i):yield cr.getTicket(i);window.location.href=d}catch{n("error")}})},[i,t]);const r=()=>{switch(s){case"downloading":return e.jsx("div",{className:"alert alert-info",children:"Reindirizzamento a Google Wallet..."});case"error":return e.jsx("div",{className:"alert alert-danger",children:"Si è verificato un errore durante il reindirizzamento a Google Wallet."});default:return e.jsx("div",{className:"alert alert-danger",children:"Si è verificato un errore"})}};return e.jsx(re,{fullWidth:!0,children:r()})},zf=Object.freeze(Object.defineProperty({__proto__:null,default:Of},Symbol.toStringTag,{value:"Module"}));var ur=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Mi=new Wu,Lf=({readonly:i,invoiceData:a,i18n:t})=>{const{formatMessage:s}=t.get(ne),{ticketGroupId:n}=Se(),[r,o]=P.useState(a??new oi(!0)),[d,u]=P.useState("loading"),[c,l]=P.useState(!1);P.useEffect(()=>{ur(void 0,void 0,void 0,function*(){u("loading");try{const g=yield Mi.anonymousCanRequestInvoice(n);if(!g||g.Status===0){u("notFound");return}if(g.Expired)if(g.Status===1){console.log("fatturato");const v=yield Mi.getByTicketGroupId(n);o(v.invoiceData),u("expiredWithData")}else u("expiredNoData");else if(g.Status===1){console.log("INVOICED!!!!");const v=yield Mi.getByTicketGroupId(n);o(v.invoiceData),u("invoiced")}else u("readyToEdit")}catch(g){console.error("Errore durante il caricamento del ticket:",g),u("error")}})},[n]);const m=(p,g)=>ur(void 0,void 0,void 0,function*(){if(!p){try{yield Mi.anonymousRemoveInvoiceData(n),u("removed"),o(new oi(!0))}catch(v){console.error("Errore durante la rimozione:",v),alert(s(x=>x.InvoiceErrorSaving))}return}try{l(!0),o(g),yield Mi.anonymousAddInvoiceData({ticketIds:[n],invoiceData:g}),u("invoiced")}catch(v){console.error("Errore durante il salvataggio:",v),alert(s(x=>x.InvoiceErrorSaving))}finally{l(!1)}}),h=({icon:p,children:g,variant:v="danger"})=>e.jsxs("div",{className:`alert alert-${v} d-flex align-items-center`,role:"alert",children:[e.jsx("i",{className:`fa-solid ${p} me-2`}),e.jsx("div",{children:g})]}),f=()=>{switch(d){case"loading":return e.jsx(X,{});case"notFound":case"error":return e.jsx(h,{icon:"fa-triangle-exclamation",children:s(p=>p.InvoiceErrorTicketNotFound)});case"expiredNoData":return e.jsx(h,{icon:"fa-triangle-exclamation",children:s(p=>p.InvoiceElapsedDate)});case"expiredWithData":return e.jsxs(e.Fragment,{children:[e.jsx(h,{icon:"fa-triangle-exclamation",variant:"info",children:s(p=>p.InvoiceRequestOKButElapsed)}),e.jsx(yn,{onChange:()=>{},readonly:!0,searchbar:!1,invoiceData:r,canConfirm:!0})]});case"invoiced":case"readyToEdit":case"removed":return e.jsxs(e.Fragment,{children:[d==="removed"&&e.jsx(h,{icon:"fa-thumbs-up",variant:"primary",children:s(p=>p.InvoiceRemoved)}),c&&e.jsx(h,{icon:"fa-spinner",variant:"primary",children:s(p=>p.InvoiceSaving)}),d==="invoiced"&&e.jsx(h,{icon:"fa-thumbs-up",variant:"primary",children:s(p=>p.InvoiceRequestOK)}),e.jsx(yn,{onChange:m,readonly:d!=="readyToEdit"&&d!=="removed",searchbar:!1,invoiceData:d!=="readyToEdit"&&d!=="removed"?r:void 0,canConfirm:d==="invoiced"})]});default:return null}};return e.jsx(re,{fullWidth:!0,children:f()})},Ef=_(Lf),Ff=Object.freeze(Object.defineProperty({__proto__:null,default:Ef},Symbol.toStringTag,{value:"Module"}));class Bf extends P.Component{constructor(){super(...arguments),this.errorDiv=P.createRef()}render(){const a=this.props.i18n.get(As).formatMessage;return e.jsx(re,{title:a(t=>t.Ricarica),children:e.jsx(Hc,{rechargePath:D.RechargePath,walletPath:D.WalletPath,returnKoUrl:D.WalletRechargeKo,returnUrl:D.WalletRechargeOk,saleChannel:1})})}}const $f=_(Be(Bf)),Wf=Object.freeze(Object.defineProperty({__proto__:null,default:$f},Symbol.toStringTag,{value:"Module"}));var Uf=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Vf=_(i=>{const{id:a}=Se(),{formatMessage:t}=i.i18n.get(As),[s,n]=P.useState(null);return P.useEffect(()=>{Uf(void 0,void 0,void 0,function*(){const d=yield new Yr().getReceiptUrl(a);n(d)})},[]),s==null?e.jsx(X,{}):e.jsx(re,{title:t(r=>r.RicaricaEseguita),children:e.jsx(Kc,{walletPath:D.WalletPath})})}),Gf=_(i=>{const{formatMessage:a}=i.i18n.get(As);return e.jsx(re,{title:a(t=>t.PagamentoKoTitle),children:e.jsx(Qc,{walletRechargePath:D.RechargePath})})}),mr=Object.freeze(Object.defineProperty({__proto__:null,RechargeKoBooking:Gf,RechargeOkBooking:Vf},Symbol.toStringTag,{value:"Module"})),qf=_(({i18n:i})=>{const a=qi();if(!a.dep||!a.arr)return null;var{formatMessage:t}=i.get(ie);const s=qr.use(a.dep,a.arr);if(!s)return e.jsx(X,{});let n=null;return te.environmentName=="mediterranea"&&(n=e.jsx("a",{href:"https://www.x-system.tech/viaggia/nwhome.aspx?azienda=dfed",children:e.jsxs("div",{className:"m-2",children:[e.jsx("div",{children:e.jsx("i",{className:"fa-solid fa-cart-shopping fa-3x text-primary"})}),e.jsx("div",{children:t(r=>r.Acquista)})]})})),e.jsxs(re,{fullWidth:!0,title:"Tabellone orari",children:[e.jsx(Te,{}),e.jsxs("h2",{className:"fw-bold text-medium",children:["Da ",a.dep," a ",a.arr]}),s.map((r,o)=>e.jsx(Oo,{solution:r,purchaseLink:n},o))]})}),Hf=Object.freeze(Object.defineProperty({__proto__:null,default:qf},Symbol.toStringTag,{value:"Module"}));var Rt=vd.GetTable();
18class Kf extends P.Component{constructor(a){super(a),this.emailDiv=P.createRef(),this.getLocalities=n=>{var r=[];return n.map(o=>r.push({province:o.province,provinceDescription:o.provinceDescription,locality:o.localitydescription})),ii(Hi(r,o=>o.locality),o=>o.locality)},this.listener=()=>{const n=Ai.getall(),r=this.getLocalities(n);this.setState({items:n,allLocalities:r,selectedProvince:null,localities:r.map(o=>o.locality),loading:!1})},this.onSelectProvince=n=>{var r=n?$l(this.state.allLocalities,o=>{var d;return((d=o.provinceDescription)===null||d===void 0?void 0:d.toUpperCase())==(n==null?void 0:n.toUpperCase())}).map(o=>o.locality):this.state.allLocalities.map(o=>o.locality);this.setState({selectedProvince:n,localities:r,selectedLocality:null})};const t=Ai.getall(),s=this.getLocalities(t);this.state={items:t,allLocalities:s,localities:s.map(n=>n.locality),loading:!1,selectedLocality:null,selectedProvince:null}}componentDidMount(){Ai.Changed.register(this.listener),Ai.isInitialized()||(this.setState({loading:!0}),Uu.getPublic())}componentWillUnmount(){Ai.Changed.unregister(this.listener)}render(){var{formatMessage:a}=this.props.i18n.get(Q);const{items:t,allLocalities:s,localities:n}=this.state,r=ii(Gt(s.map(d=>d.provinceDescription)),d=>d);var o=[];return this.state.selectedLocality&&(o=ii(t.filter(d=>{var u,c;return((u=d.localitydescription)===null||u===void 0?void 0:u.toLowerCase())==((c=this.state.selectedLocality)===null||c===void 0?void 0:c.toLowerCase())}),d=>d.businessname)),e.jsx(re,{title:a(d=>d.AgenciesList),fullWidth:!0,children:e.jsxs("div",{className:"bg-white shadow p-3",children:[e.jsx("div",{className:"fontsize-3u fw-bold mb-2",children:a(d=>d.FindAgencies)}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-12 col-lg-4",children:e.jsx(Wi.ResponsiveDropdown,{data:r,onSelect:this.onSelectProvince,idSelector:d=>d,textField:d=>d==null?void 0:d.toUpperCase(),value:this.state.selectedProvince,placeholder:"Seleziona la provincia",itemComponent:d=>{var u;return e.jsx("div",{children:(u=d.item)===null||u===void 0?void 0:u.toUpperCase()})},allowNull:!0})}),e.jsx("div",{className:"col-12 col-lg-3",children:e.jsx(Wi.ResponsiveDropdown,{data:n,onSelect:d=>this.setState({selectedLocality:d}),idSelector:d=>d,textField:d=>{var u;return((u=s.find(c=>c.provinceDescription==(c==null?void 0:c.provinceDescription)))===null||u===void 0?void 0:u.province)||""},value:this.state.selectedLocality,placeholder:"Seleziona la città ",itemComponent:d=>{var u;return e.jsxs("div",{children:[e.jsx("i",{className:"fa fa-city",style:{marginRight:15}}),(u=d.item)===null||u===void 0?void 0:u.toUpperCase()]})}})})]}),e.jsx(Sa,{isLoading:this.state.loading,children:e.jsxs(Rt,{data:o,keySelector:d=>d.id,storagekey:"bookingagencies",children:[e.jsx(Rt.Column,{header:"Ragione Sociale",template:d=>d.businessname,groupable:!1,orderable:!0}),e.jsx(Rt.Column,{header:"Indirizzo",template:d=>d.address,groupable:!1,orderable:!1}),e.jsx(Rt.Column,{header:"Cap",template:d=>d.postalCode,groupable:!1,orderable:!1}),e.jsx(Rt.Column,{header:"Città ",template:d=>d.localitydescription,groupable:!1,orderable:!1}),e.jsx(Rt.Column,{header:"Provincia",template:d=>d.provinceDescription,groupable:!1,orderable:!1}),e.jsx(Rt.Column,{header:"Regione",template:d=>d.regionName,groupable:!1,orderable:!1}),te.environmentName!="salemi"&&e.jsx(Rt.Column,{header:"Telefono",template:d=>(d.phones||[]).map(u=>u.phonenumber).join(","),orderable:!1,groupable:!1}),te.environmentName!="salemi"&&e.jsx(Rt.Column,{header:"Email",template:d=>(d.emails.filter(u=>u.description!=="pec")||[]).map(u=>u.email).join(","),orderable:!1,groupable:!1})]})})]})})}}const Qf=_(Kf),Jf=Object.freeze(Object.defineProperty({__proto__:null,default:Qf},Symbol.toStringTag,{value:"Module"})),Yf=_(i=>{const[a,t]=P.useState(new Date);return P.useEffect(()=>{const s=setInterval(()=>{t(new Date)},6e4);return()=>clearInterval(s)},[]),e.jsxs("div",{className:"clock",children:[e.jsx("div",{className:"date",children:k.getShortFriendlyDate(a,i.hl)}),e.jsx("div",{className:"time",children:k.getReadableTimeString(a)})]})}),Zt=i=>{const{itaLabel:a,enLabel:t,className:s}=i,n=e.jsx("span",{children:a});return t==null?n:e.jsxs("div",{className:`text-nowrap d-flex align-items-center ${s||""}`,children:[n,e.jsx("span",{className:"fontsize-5u",children:" / "}),e.jsx("span",{children:t})]})},Zf=i=>{const{stopId:a,liveStatus:t}=i,s=te.environmentName=="libertylines"||te.environmentName=="blunavy"||te.environmentName=="ichnusa";return e.jsxs("div",{className:`stop-live-status-page ${te.environmentName=="libertylines"?"light":"dark"}`,children:[e.jsxs("nav",{className:"p-2",children:[e.jsx("img",{src:`/images/${te.environmentName=="libertylines"?"header-logo-light":"header-logo"}.svg`}),e.jsxs("div",{className:"title",children:[e.jsx("h1",{className:"main-title",children:e.jsx(Zt,{itaLabel:"Partenze",enLabel:"Departures"})}),e.jsx("div",{className:"sub-title",children:e.jsx(Ge,{id:a})})]}),e.jsx(Yf,{})]}),e.jsx("div",{className:"trips-container-header",children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-2",children:e.jsx(Zt,{itaLabel:"Orario",enLabel:"Time"})}),e.jsx("div",{className:"col-4",children:e.jsx(Zt,{itaLabel:"Destinazione",enLabel:"To"})}),e.jsx("div",{className:"col-4",children:e.jsx(Zt,{itaLabel:s?"Imbarcazione":"Bus",enLabel:s?"Boat":null})}),e.jsx("div",{className:"col-2",children:e.jsx(Zt,{itaLabel:"Ritardo",enLabel:"Delayed"})})]})}),e.jsx("div",{className:"trips-container",children:t.map(n=>{const r=n.isCanceled?" text-decoration-line-through":"";return e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"card-body",children:e.jsxs("div",{className:"trip-data row",children:[e.jsx("div",{className:"col-2 fw-bold"+r,children:k.getReadableTimeString(n.stopTime)}),e.jsx("div",{className:"col-4"+r,children:e.jsx(Ge,{id:n.lastArrivalStopId})}),e.jsx("div",{className:"col-5",children:n.isCanceled?e.jsx("span",{className:"ms-3",children:"*ANNULLATA/CANCELED*"}):n.vehicleSerialNumber}),e.jsxs("div",{className:"col-1",children:[" ",!n.isCanceled&&n.delay&&n.delay>0&&e.jsxs("span",{className:"ms-3 badge bg-danger",children:["+",Math.round(n.delay),"'"]})]})]})}),!n.isCanceled&&n.nextStops.length>0&&e.jsx("div",{className:"card-footer stops-data",children:e.jsx("div",{className:"scroll-text-container",children:e.jsxs("div",{className:"scroll-text d-flex align-items-center",children:[e.jsx(Zt,{itaLabel:"Fermate",enLabel:"Next stops:",className:"mx-3"}),n.nextStops.map(o=>e.jsxs("div",{className:"mx-5 text-nowrap",children:[k.getTimeString(o.stopTime)," - ",s?e.jsx(Ge,{id:o.stopId}):e.jsx(Vt,{id:o.stopId})," ",o.withChange?e.jsx(Zt,{itaLabel:"(Con cambio)",enLabel:"(With change)"}):null]},n.tripId+o.stopId+o.stopTime.toISOString()))]})})})]},n.tripId)})})]})},Xf=()=>{const i=Se();return e.jsx(tl,{stopId:i.stopId,template:Zf})},ex=Object.freeze(Object.defineProperty({__proto__:null,default:Xf},Symbol.toStringTag,{value:"Module"}));class tx extends Ki{constructor(){super(a=>a.tripId),this.useAll=a=>this.useAllWithAction(()=>
18At.getStopLiveStatusForArrival(a)),Si.onfunction(At.getStopLiveStatusForArrival,a=>this.setAll(a))}}const ix=new tx,ax=i=>{const a=i.stopId;if(!a)return null;P.useEffect(()=>{At.getStopLiveStatusForArrival(a);const n=setInterval(()=>{At.getStopLiveStatusForArrival(a)},60*1e3);return()=>clearInterval(n)},[]);const t=i.liveStatus;if(!t)return e.jsx(X,{});const s=i.template;return e.jsx(s,{liveStatus:t,stopId:a})},Nl=fe(ax,ix,(i,a)=>{var t;return{liveStatus:a.stopId&&(t=i.getall())!==null&&t!==void 0?t:null}}),sx=_(i=>{const[a,t]=P.useState(new Date);return P.useEffect(()=>{const s=setInterval(()=>{t(new Date)},6e4);return()=>clearInterval(s)},[]),e.jsxs("div",{className:"clock",children:[e.jsx("div",{className:"date",children:k.getShortFriendlyDate(a,i.hl)}),e.jsx("div",{className:"time",children:k.getReadableTimeString(a)})]})}),pi=i=>{const{itaLabel:a,enLabel:t,className:s}=i,n=e.jsx("span",{children:a});return t==null?n:e.jsxs("div",{className:`text-nowrap d-flex align-items-center ${s||""}`,children:[n,e.jsx("span",{className:"fontsize-5u",children:" / "}),e.jsx("span",{children:t})]})},nx=i=>{const{stopId:a,liveStatus:t}=i,s=te.environmentName=="libertylines"||te.environmentName=="blunavy"||te.environmentName=="ichnusa";return e.jsxs("div",{className:`stop-live-status-page ${te.environmentName=="libertylines"?"light":"dark"}`,children:[e.jsxs("nav",{className:"p-2",children:[e.jsx("img",{src:`/images/${te.environmentName=="libertylines"?"header-logo-light":"header-logo"}.svg`}),e.jsxs("div",{className:"title",children:[e.jsx("h1",{className:"main-title",children:e.jsx(pi,{itaLabel:"Arrivi",enLabel:"Arrivals"})}),e.jsx("div",{className:"sub-title",children:e.jsx(Ge,{id:a})})]}),e.jsx(sx,{})]}),e.jsx("div",{className:"trips-container-header",children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-2",children:e.jsx(pi,{itaLabel:"Orario",enLabel:"Time"})}),e.jsx("div",{className:"col-4",children:e.jsx(pi,{itaLabel:"Da",enLabel:"From"})}),e.jsx("div",{className:"col-4",children:e.jsx(pi,{itaLabel:s?"Imbarcazione":"Bus",enLabel:s?"Boat":null})}),e.jsx("div",{className:"col-2",children:e.jsx(pi,{itaLabel:"Ritardo",enLabel:"Delayed"})})]})}),e.jsx("div",{className:"trips-container",children:t.map(n=>e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"card-body",children:e.jsxs("div",{className:"trip-data row",children:[e.jsx("div",{className:"col-2 fw-bold",children:k.getReadableTimeString(n.stopTime)}),e.jsx("div",{className:"col-4",children:e.jsx(Ge,{id:n.originStopId})}),e.jsx("div",{className:"col-5",children:n.vehicleSerialNumber}),e.jsxs("div",{className:"col-1",children:[" ",n.delay&&n.delay>0&&e.jsxs("span",{className:"ms-3 badge bg-danger",children:["+",Math.round(n.delay),"'"]})]})]})}),n.previousStops.length>0&&e.jsx("div",{className:"card-footer stops-data",children:e.jsx("div",{className:"scroll-text-container",children:e.jsxs("div",{className:"scroll-text d-flex align-items-center",children:[e.jsx(pi,{itaLabel:"Fermate",enLabel:"Previous stops:",className:"mx-3"}),mt(it(n.previousStops,r=>r.localityId),(r,o)=>{const d=k.getMinDate(Gt(r.map(u=>u.stopTime)));return e.jsxs("div",{className:"mx-5 text-nowrap",children:[k.getTimeString(d)," - ",e.jsx(Jc,{id:o})]},n.tripId+o+d.toISOString())})]})})})]},n.tripId))})]})},rx=()=>{const i=Se();return e.jsx(Nl,{template:nx,stopId:i.stopId})},ox=Object.freeze(Object.defineProperty({__proto__:null,default:rx},Symbol.toStringTag,{value:"Module"})),lx=_(i=>{const{highlighted:a,trip:t,isOpen:s}=i,n=t,{formatMessage:r}=i.i18n.get(Q);return e.jsx("div",{className:`p-3 ${s?"mt-2":"my-2"} ${a?"bg-primary text-white":"bg-white"} shadow`,children:e.jsxs("div",{className:"row align-items-center",children:[e.jsx("div",{className:"col-11",children:e.jsxs("div",{className:"row align-items-center",children:[e.jsxs("div",{className:"col-4 col-lg-2",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:r(o=>o.Departure)}),e.jsx("div",{className:"fontsize-10u fw-bold",children:k.getReadableTimeString(n.stopTime)})]}),e.jsxs("div",{className:"col-8 col-lg-4 d-lg-block d-flex flex-column align-items-end",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:r(o=>o.Origine)}),e.jsxs("div",{className:"text-uppercase fontsize-10u text-nowrap",children:[" ",e.jsx(Ge,{id:n.originStopId})]})]}),e.jsx("div",{className:"col-10 col-lg-5",children:n.vehicleSerialNumber&&e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:r(o=>o.Mezzo)}),e.jsxs("div",{className:"text-uppercase fontsize-10u",children:[" ",n.vehicleSerialNumber]})]})}),e.jsx("div",{className:"col-2 col-lg-1 d-lg-block d-flex flex-column align-items-end",children:n.delay&&n.delay>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:r(o=>o.Ritardo)}),e.jsxs("div",{className:"text-uppercase fontsize-5u badge bg-danger",children:["+",Math.round(n.delay),"'"]})]})})]})}),n.previousStops.length>0&&e.jsx("div",{className:"col-1 d-flex justify-content-center",children:e.jsx("i",{className:`${s?"fas fa-chevron-up":"fas fa-chevron-down"} fa-2x`})})]})})}),dx=_(i=>{const{trip:a,isOpen:t}=i,{formatMessage:s}=i.i18n.get(Q);return e.jsx("div",{className:`p-3 ${t?"mt-2":"my-2"} bg-danger text-white shadow`,children:e.jsxs("div",{className:"row align-items-center",children:[e.jsx("div",{className:"col-11",children:e.jsxs("div",{className:"row align-items-center",children:[e.jsxs("div",{className:"col-4 col-lg-2",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:s(n=>n.Departure)}),e.jsx("div",{className:"fontsize-10u fw-bold text-decoration-line-through",children:k.getReadableTimeString(a.stopTime)})]}),e.jsxs("div",{className:"col-8 col-lg-4 d-lg-block d-flex flex-column align-items-end",children:[e.jsx("div",{className:"text-uppercase fontsize-3d",children:s(n=>n.Origine)}),e.jsxs("div",{className:"text-uppercase fontsize-10u text-decoration-line-through",children:[" ",e.jsx(Ge,{id:a.originStopId})]})]}),e.jsx("div",{className:"col-12 col-lg-4 d-flex justify-content-center",children:e.jsxs("div",{className:"text-uppercase fontsize-10u text-center w-100",children:[e.jsx("i",{className:"fa-solid fa-triangle-exclamation me-2"})," ",s(n=>n.CorsaAnnullata)]})})]})}),a.previousStops.length>0&&e.jsx("div",{className:"col-1 d-flex justify-content-center",children:e.jsx("i",{className:`${t?"fas fa-chevron-up":"fas fa-chevron-down"} fa-2x`})})]})})}),cx=_(i=>{const{liveStatus:a,stopId:t}=i,{formatMessage:s}=i.i18n.get(Q);return e.jsx(re,{title:e.jsx(Vt,{id:t}),fullWidth:!0,children:e.jsx("div",{children:a.length>0&&a.map((n,r)=>e.jsx(wi,{heading:o=>n.isCanceled?e.jsx(dx,{trip:n,isOpen:o}):e.jsx(lx,{highlighted:r==0,trip:n,isOpen:o}),children:n.previousStops.length>0&&e.jsxs("div",{className:"bg-white mb-2 shadow p-3",children:[e.jsxs("div",{className:"mb-2 text-uppercase",children:[s(o=>o.Trip)," ",n.tripCode]}),e.jsx("div",{className:"fw-bold fontsize-2u text-uppercase",children:s(o=>o.ProssimePartenze)}
18),e.jsx(ws,{segments:[{tripId:n.tripId,tripCode:n.tripCode,stops:n.previousStops.map(o=>({stop:{stopId:o.stopId,stopTimeDeparture:o.stopTime,stopTimeArrival:o.stopTime},type:3}))}]})]})},n.tripId))||e.jsxs("div",{className:"h-100 mt-3 p-5 bg-white shadow border rounded-3",children:[e.jsx("h2",{className:"fw-bold text-medium",children:s(n=>n.NessunArrivo)}),e.jsx("p",{children:s(n=>n.NessunArrivoExtended)})]})})})}),ux=i=>{const{liveStatus:a,stopId:t}=i;return e.jsx(cx,{liveStatus:a,stopId:t})},mx=()=>{const i=Se();return e.jsx(Nl,{stopId:i.stopId,template:ux})},hx=Object.freeze(Object.defineProperty({__proto__:null,default:mx},Symbol.toStringTag,{value:"Module"}));var px=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const vx=()=>{var a=qi().ticketId;if(!a)return null;const[t,s]=P.useState(null),n=()=>px(void 0,void 0,void 0,function*(){if(!a)return;const r=yield At.getStopLiveStatusForTicket(a);s(r)});return P.useEffect(()=>{n();const r=setInterval(()=>{n()},60*1e3);return()=>clearInterval(r)},[]),!t||t.length==0?null:e.jsx("div",{children:t.map(r=>e.jsx("div",{children:r.lastPosition!=null&&e.jsx(wr,{markers:[r.lastPosition],centerMap:r.lastPosition})},r.tripId))})},gx=Object.freeze(Object.defineProperty({__proto__:null,default:vx},Symbol.toStringTag,{value:"Module"}));var hr=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Oi=new Vu,fx=_(i=>{const a=Se(),t=n=>{switch(n){case"it":return"it_IT";case"en":return"en_GB";case"de":return"de_DE";case"es":return"es_ES";default:return}},s=()=>hr(void 0,void 0,void 0,function*(){const n=JSON.parse(a.requestAsJson);if(n.issue)return Oi.createPaypalOrder(n.issue);if(n.subscription)return Oi.createPaypalOrderSubscription(n.subscription);if(n.changeDate)return Oi.createPaypalOrderChangeDate(n.changeDate);if(n.walletCharge)return Oi.createPaypalOrderWalletCharge(n.walletCharge);if(n.payToBePayed)return Oi.createPaypalOrderPayToBePayed(n.payToBePayed);throw"not supported"});return e.jsx(Wl,{options:{clientId:a.clientId,currency:"EUR",locale:t(i.hl)},children:e.jsx("div",{className:"p-2",children:e.jsx(Ul,{createOrder:()=>s(),onApprove:(n,r)=>hr(void 0,void 0,void 0,function*(){var o;n.orderID&&((o=window.ReactNativeWebView)===null||o===void 0||o.postMessage(JSON.stringify({command:"onApprove",orderID:n.orderID})))})})})})}),xx=Object.freeze(Object.defineProperty({__proto__:null,default:fx},Symbol.toStringTag,{value:"Module"})),bx=_(i=>{var a;const t=Se(),{formatMessage:s}=i.i18n.get(Cs),{formatMessage:n}=i.i18n.get(He),r=t.clientId,o=t.advanced=="true",d=JSON.parse(t.requestAsJson),[u,c]=P.useState(null);var l=e.jsx(Yc,{clientId:r,proceed:m=>{var h;return(h=window.ReactNativeWebView)===null||h===void 0?void 0:h.postMessage(JSON.stringify({command:"onApprove",orderID:m}))},request:d});return o&&(l=e.jsx("div",{className:"pe-2 ps-2",children:e.jsx(Zc,{clientId:r,proceed:m=>{var h;return(h=window.ReactNativeWebView)===null||h===void 0?void 0:h.postMessage(JSON.stringify({command:"onApprove",orderID:m,addressData:u}))},request:d,addressData:u,children:e.jsxs("div",{className:"m-2",children:[e.jsx(ds,{label:n(m=>m.BillingAddress),onSelect:c,selectedItem:(a=u==null?void 0:u.id)!==null&&a!==void 0?a:null}),e.jsx("div",{className:"fw-bold fontsize-2u",children:"Dati della carta di pagamento:"})]}),formatMessage:s})})),l}),yx=Object.freeze(Object.defineProperty({__proto__:null,default:bx},Symbol.toStringTag,{value:"Module"})),jx=()=>{var i;const a=Kt(),s=(i=new URLSearchParams(a.search).get("lines"))!==null&&i!==void 0?i:"",n=It(()=>new Es().getTimeTables(s,new Date),[]);if(n==null)return e.jsx(X,{});const o=n.flatMap(u=>{const c=no.factory({Color:u.color,CustomersDescription:u.customersDescription,Description:u.description,Direction:u.direction,LineId:u.lineId,IsShuttle:u.isShuttle});
18return u.tripTemplates.map(l=>{var m;const h={DailyCode:l.dailyCode,CarrierId:l.carrierId,OperatingCalendarId:l.operatingCalendarId,Validities:((m=l.validities)!==null&&m!==void 0?m:[]).map(p=>ro.fromDto(p)),Tags:l.tags},f=l.stops.map(p=>new lo(oo.factory(p.stopId),new Dt(p.stopTime),new Dt(p.stopTime),new Dt(p.timeFromPrevious)));return new co(c,l.templateId,u.routeCode,h,f,u.timeTable)})}).filter(u=>u.Stops.length>0),d=mt(it(o,u=>{var c;return(c=u.TimeTable)!==null&&c!==void 0?c:"Predefinito"}),(u,c)=>{var l;return{timeTable:(l=u[0].TimeTable)!==null&&l!==void 0?l:"Predefinito",timeTables:uo.Factory(u,u[0].Route.Direction)}});return e.jsx(re,{title:"Quadri orari",fullWidth:!0,children:e.jsx("div",{children:d.map((u,c)=>e.jsxs("div",{className:"mb-8",children:[e.jsx("h2",{children:u.timeTable}),u.timeTables.map((l,m)=>e.jsx(Lo,{timeTable:l,refLineIds:s.split(","),departureId:null},"table"+m))]},"timetable"+c))})})},Sx=Object.freeze(Object.defineProperty({__proto__:null,default:jx},Symbol.toStringTag,{value:"Module"}));var pr=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const zi=new Gu,Nx=i=>{const a=Se(),t=()=>pr(void 0,void 0,void 0,function*(){const s=JSON.parse(a.requestAsJson);if(console.log(s),s.issue)return zi.createOrderTickets(s.issue);if(s.subscription)return zi.createOrderSubscription(s.subscription);if(s.changeDate)return zi.createOrderChangeDate(s.changeDate);if(s.walletCharge)return zi.createOrderWalletCharge(s.walletCharge);if(s.payToBePayed)return zi.createOrderPayToBePayed(s.payToBePayed);throw"not supported"});return P.useEffect(()=>{const s=window.ReactNativeWebView;pr(void 0,void 0,void 0,function*(){const r=yield t();if(r.type!="gestpayLightBoxPayment")throw"should be gestpayLightBoxPayment";try{const o=yield new po(r).beginPayment();console.log(o),s?s==null||s.postMessage(JSON.stringify({command:"onApprove",returnUri:o})):window.location.href=o}catch(o){s?s==null||s.postMessage(JSON.stringify({command:"onDecline",returnUri:JSON.stringify(o)})):window.location.href=JSON.stringify(o)}})},[]),e.jsx("div",{})},wx=Object.freeze(Object.defineProperty({__proto__:null,default:Nx},Symbol.toStringTag,{value:"Module"}));var Cx=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Px=()=>{const i=Se(),a=new URLSearchParams(window.location.search),t=a.get("koUrl"),s=a.get("okUrl");return s?t?(P.useEffect(()=>{Cx(void 0,void 0,void 0,function*(){try{yield new po({okUrl:s,koUrl:t,live:i.live=="true",merchantId:i.merchantId,paymenyId:i.paymenyId,paymenyToken:i.paymenyToken,type:"gestpayLightBoxPayment"}).beginPayment(),console.log(s),window.location.href=s}catch{console.log(t),window.location.href=t}})},[]),e.jsx("div",{className:"align-items-center justify-content-center p-3",children:e.jsx("a",{className:"d-block btn btn-success p-3",href:s,children:"Torna all'app"})})):e.jsx("div",{children:"invalid okUrl"}):e.jsx("div",{children:"invalid okUrl"})},Dx=Object.freeze(Object.defineProperty({__proto__:null,default:Px},Symbol.toStringTag,{value:"Module"}));var Za=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Ix=new Pi;class Tx extends P.Component{constructor(a){super(a),this.errorDiv=P.createRef(),this.getReservation=t=>Za(this,void 0,void 0,function*(){this.setState({loading:!0});const s=yield xe.getReservationToPay(t);let n=null;const r=s.data&&s.data.reservationExpiryDate||null;let o=s.errorCode;if(s.data){const d=s.data.passengerReservations.flatMap(u=>u.tickets).map(u=>{var c;return(c=u.ticketId)!==null&&c!==void 0?c:""}).filter(u=>u.length>0);n=yield Ix.payByLinkDetailByTicketIds(d.join(",")),n.ErrorCode&&!o&&(o=22)}this.setState({errorCode:o,expiryDate:r,tickets:(n==null?void 0:n.tickets)||null,forcedPenalty:s.forcedPenalty,loading:!1}),s.data?J().applyReservationData(s.data):J().clear()}),this.onChangePaymentMethod=(t,s)=>Za(this,[t,s],void 0,function*([n,r],o){var d,u,c,l,m;(o.paymentDataId!=((d=this.props.reservation)===null||d===void 0?void 0:d.paymentDataId)||o.savePaymentData!=((u=this.props.reservation)===null||u===void 0?void 0:u.savePaymentData)||(n==null?void 0:n.type)!=this.props.reservation.paymentMethod)&&(yield Me.selectPaymentMethod((c=n==null?void 0:n.type)!==null&&c!==void 0?c:0,(l=o.paymentDataId)!==null&&l!==void 0?l:void 0,o.savePaymentData,(m=o.subPaymentMethod)!==null&&m!==void 0?m:void 0)),this.setState({useWallet:r,selectedPaymentMethod:n,payPalClientIntegrationPaymentId:null,additionalData:o,nexiBuildClientIntegrationPaymentId:null,nexiNumContratto:null})}),this.pay=t=>Za(this,void 0,void 0,function*(){var s,n,r,o,d;if(!this.props.reservation||!this.state.tickets||!this.state.selectedPaymentMethod)return;this.setState({loading:!0});let u=null;var c=void 0;this.state.selectedPaymentMethod.type==4&&(u=this.state.payPalClientIntegrationPaymentId),this.state.selectedPaymentMethod.type==3&&(u=this.state.nexiBuildClientIntegrationPaymentId,c=!((s=this.state.additionalData)===null||s===void 0)&&s.savePaymentData&&this.state.nexiNumContratto||void 0);const l=J().GetAmountToShow(this.state.forcedPenalty),m=yield xe.PAY_CHANGE_DATE_RESERVATION({expectedPayment:l,okUrl:we(D.GetChangeDateResult(this.state.tickets.map(f=>f.id))),koUrl:we(D.GetChangeDateMultiKo(this.state.tickets.map(f=>f.id))),email:this.state.tickets[0].email,callingcode:this.state.tickets[0].callingcode,ph
18one:this.state.tickets[0].phone,clientIntegrationPaymentId:u||void 0,reservationId:this.props.reservation.reservationId,addressData:void 0,paymentMethod:this.state.selectedPaymentMethod.type,paymentDataId:(o=(n=this.state.additionalData)===null||n===void 0?void 0:n.paymentDataId)!==null&&o!==void 0?o:void 0,savePaymentData:(d=(r=this.state.additionalData)===null||r===void 0?void 0:r.savePaymentData)!==null&&d!==void 0?d:!1,useWallet:this.state.useWallet,numContratto:c,nexiApmResponse:t});this.setState({loading:!1});let h=!0;if(m.redirect&&(h=yield st(m.redirect,this.props.history)),h){let f=D.GetChangeDateResult(this.state.tickets.map(p=>p.id));this.props.history(f)}else throw"unexpected error"}),this.getErrorMessage=()=>Xc({code:this.state.errorCode},this.props.i18n),this.state={errorCode:void 0,loading:!1,expiryDate:null,tickets:null,useWallet:!1,expirationDate:null,payPalClientIntegrationPaymentId:null,selectedPaymentMethod:null,transactionCode:null,forcedPenalty:void 0,nexiBuildClientIntegrationPaymentId:null,nexiNumContratto:null,additionalData:null}}componentDidMount(){this.props.params.reservationid&&this.getReservation(this.props.params.reservationid)}render(){var a,t,s,n,r;const o=this.props.i18n.get(Q).formatMessage,d=this.props.i18n.get(He).formatMessage,{formatMessage:u}=this.props.i18n.get(ne);let{tickets:c,errorCode:l,forcedPenalty:m}=this.state,{reservation:h}=this.props;const f=h&&h.reservationExpiryDate&&h.reservationExpiryDate.valueOf()<new Date().valueOf()||!1;let p=kt.canProceed(this.state.selectedPaymentMethod,this.state.payPalClientIntegrationPaymentId,this.state.nexiBuildClientIntegrationPaymentId,(t=h==null?void 0:h.subPaymentMethod)!==null&&t!==void 0?t:null,(s=h==null?void 0:h.paymentDataId)!==null&&s!==void 0?s:null);const g=J().GetAmountToShow(m),v=x=>Pe.IsGooglePay({subPaymentMethod:x})?"gpay":Pe.IsApplePay({subPaymentMethod:x})?"applepay":null;return e.jsxs(Ii,{proceed:x=>this.pay(x),canProceed:p,showNavigation:!0,canProceedWithApm:!0,useWallet:this.state.useWallet,children:[e.jsxs(Ie,{icon:e.jsx("i",{className:"fa-solid fa-users"}),title:o(x=>x.PayByLinkReservation),children:[this.state.loading&&e.jsx(Je,{}),g>0&&!f&&!l&&h&&c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"form-label mb-2",children:u(x=>x.SelectedTickets)}),e.jsx("div",{className:"row align-items-center",style:{gap:15},children:e.jsx(wl,{tickets:c})})]})]}),g>0&&!f&&!l&&h&&c&&e.jsx(e.Fragment,{children:e.jsxs(Ie,{title:u(x=>x.PaymentMethod),icon:e.jsx("i",{className:"fa-solid fa-wallet"}),children:[e.jsx(Rs,{price:g,groupId:this.props.params.reservationid,onChangePaymentMethod:this.onChangePaymentMethod,additionalData:{paymentDataId:(n=h.paymentDataId)!==null&&n!==void 0?n:null,savePaymentData:(r=(a=this.props.reservation)===null||a===void 0?void 0:a.savePaymentData)!==null&&r!==void 0?r:!1,expirationDate:null,subPaymentMethod:v(h.subPaymentMethod)},selectedPaymentMethod:[this.state.selectedPaymentMethod,this.state.useWallet],walletRechargeLink:"#",i18n:this.props.i18n,saleChannel:0,payPalProceed:x=>this.setState({payPalClientIntegrationPaymentId:x}),payPalRequest:{changeDate:{reservationId:h.reservationId,useWallet:this.state.useWallet,forcedPenalty:m,ticketIds:c.map(x=>x.id),paymentMethod:h.paymentMethod}},clientIntegrationPaymentId:this.state.payPalClientIntegrationPaymentId,payPalFullWidth:!0,hasCommissionKept:!1,nexiBuildProceed:(x,S)=>{this.setState({nexiBuildClientIntegrationPaymentId:x,nexiNumContratto:S})},nexiBuildRequest:{payToBePayed:h.paymentMethod&&{ticketIds:c.map(x=>x.id),useWallet:this.state.useWallet,billingOperator:void 0,isLuggage:!1,paymentMethod:h.paymentMethod,isSubscription:!1,isChangeDate:!0,reservationId:h.reservationId,toPay:g}||void 0},nexiClientIntegrationPaymentId:this.state.nexiBuildClientIntegrationPaymentId}),h.reservationExpiryDate&&e.jsx("div",{className:"alert alert-warning",children:h.reservationExpiryDate&&u(x=>x.NonFarScaderePrenotazionePayByLink(h.reservationExpiryDate))})]})}),l!==void 0&&!this.state.loading&&e.jsxs("div",{ref:this.errorDiv,className:"alert bg-danger text-white",children:[e.jsx("span",{className:"badge bg-light me-2 fontsize-1u text-danger",children:d(x=>x.Attenzione)}),e.jsx("span",{className:"me-2",children:this.getErrorMessage()})]}),f&&!this.state.loading&&e.jsxs("div",{ref:this.errorDiv,className:"alert bg-danger text-white",children:[e.jsx("span",{className:"badge bg-light me-2 fontsize-1u text-danger",children:d(x=>x.Attenzione)}),e.jsx("span",{className:"me-2",children:u(x=>x.PayByLinkExpired)})]}),h==null&&!this.state.loading&&e.jsxs("div",{ref:this.errorDiv,className:"alert bg-danger text-white",children:[e.jsx("span",{className:"badge bg-light me-2 fontsize-1u text-danger",children:d(x=>x.Attenzione)}),e.jsx("span",{className:"me-2",children:u(x=>x.PayByLinkNotValid)})]})]})}}const _x=Be(Tx),kx=fe(_x,J(),i=>({reservation:i.get()})),Ax=_(kx),wl=i=>i.tickets.length<=0?null:i.tickets.map(a=>e.jsx(La,{ticket:a,selected:!0,showDirection:!0}
18,a.id)),Rx=Object.freeze(Object.defineProperty({__proto__:null,TicketItem:wl,default:Ax},Symbol.toStringTag,{value:"Module"}));var Xa=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Cl=i=>{var a;const t=Se(),s=_e(),[n,r]=P.useState(null),[o,d]=P.useState(null),[u,c]=P.useState(!1),[l,m]=P.useState(_t),[h,f]=P.useState(null),[p,g]=P.useState(null),[v,x]=P.useState(null),[S,y]=P.useState(!1);P.useEffect(()=>{t.groupid&&b(t.groupid)},[t.groupid]);const b=F=>Xa(void 0,void 0,void 0,function*(){const L=yield Et.getByGroupId(F);r(L.items)}),j=(F,L)=>Xa(void 0,[F,L],void 0,function*([U,Y],W){u!=Y&&(c(Y),d(null),m(_t),f(null),g(null),x(null)),(l.paymentDataId!=W.paymentDataId||W.savePaymentData!=l.savePaymentData||U!=o)&&(d(U),m(W),f(null),g(null),x(null))}),I=F=>Xa(void 0,void 0,void 0,function*(){y(!0);const L=Ui(D.subscriptionokPath),U=Ui(D.subscriptionkoPath);var Y=null,W=void 0;(o==null?void 0:o.type)==4&&(Y=h),(o==null?void 0:o.type)==3&&(Y=p,W=l.savePaymentData&&v||void 0);var E={groupId:t.groupid,okUrl:L,koUrl:U,paymentData:{paymentDataId:l.paymentDataId||void 0,paymentMethod:o.type,savePaymentData:l.savePaymentData,useWallet:u,addressData:void 0,transactionCode:void 0,clientIntegrationPaymentId:Y||void 0,numContratto:W,nexiApmResponse:F},reliefData:void 0},Z=yield Et.payPaymentLink(E);y(!1);let de=!0;if(Z.redirect&&(de=yield st(Z.redirect,s)),de){let ue=`${D.subscriptionokPath}/${Z.result.groupId}`;s(ue)}else throw"unexpected error"}),N=i.i18n.get(Q).formatMessage,w=i.i18n.get(He).formatMessage,{formatMessage:T}=i.i18n.get(ne);var{formatCurrency:C}=i.i18n;if(!n)return e.jsx(X,{});const A=ye(n,F=>F.yetToBePayed),H=n.filter(F=>F.expiryDate&&F.expiryDate<new Date).length>0;var z=kt.canProceed(o,h,p,l.subPaymentMethod,l.paymentDataId);const R=Pe.IsGooglePay(l),M=Pe.IsApplePay(l);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white border-primary border-top shadow mb-3",children:e.jsx("div",{className:"container py-4",children:e.jsxs("div",{className:"fontsize-10u text-medium fw-bolder",children:[N(F=>F.PayByLink)," "]})})}),e.jsxs("div",{className:"container",children:[A>0&&!H&&e.jsxs(e.Fragment,{children:[n.map(F=>e.jsx(Gi,{subscription:F,showPrice:!0,disableOpacity:!0},F.id)),e.jsx(Ie,{title:T(F=>F.PaymentMethod),icon:e.jsx("i",{className:"fa-solid fa-wallet"}),children:e.jsx(Rs,{price:A,groupId:t.groupid,onChangePaymentMethod:j,additionalData:l,selectedPaymentMethod:[o,u],walletRechargeLink:"#",i18n:i.i18n,saleChannel:0,payPalProceed:F=>f(F),payPalRequest:{subscription:o&&{subscriptionType:n[0].subscriptionTypeId,useWallet:u,departure:n[0].departureStopOrPool,arrival:n[0].arrivalPool,paymentMethod:o.type,price:A,validity:n[0].validity,addressData:void 0}||void 0},clientIntegrationPaymentId:h,payPalFullWidth:!0,hasCommissionKept:!1,nexiBuildProceed:(F,L)=>{g(F),x(L)},nexiBuildRequest:{subscription:o&&{subscriptionType:n[0].subscriptionTypeId,useWallet:u,departure:n[0].departureStopOrPool,arrival:n[0].arrivalPool,paymentMethod:o.type,price:A,validity:n[0].validity,addressData:void 0}||void 0},nexiClientIntegrationPaymentId:p})}),(R||M)&&o&&n.length>0&&z&&e.jsx(Ts,{type:Pe.GetSubPaymentType(l.subPaymentMethod),request:{subscription:o&&{subscriptionType:n[0].subscriptionTypeId,useWallet:u,departure:n[0].departureStopOrPool,arrival:n[0].arrivalPool,paymentMethod:o.type,price:A,validity:n[0].validity,addressData:void 0}||void 0},metadata:((a=o==null?void 0:o.metadata)===null||a===void 0?void 0:a.type)=="creditCard"&&o.metadata||void 0,apmProceed:F=>I(F),clientIntegrationPaymentId:void 0,onChangePaymentMethod:()=>{},isSelectedPaymentMethod:o.type==3&&(R||M),savePaymentData:!1,paymentDataId:null})||e.jsxs(Pa,{className:"btn btn-primary btn-lg btn-highlight d-flex align-items-center justify-content-center fw-bold fontsize-5u py-3 w-100 mb-3",onClick:()=>I(),disabled:!z||S==!0,children:["Paga ",C(A)]})]}),A<=0&&e.jsx(Ie,{title:w(F=>F.Attenzione),icon:e.jsx("i",{className:"fa-solid fa-lg fa-exclamation-triangle text-warning"}),children:e.jsx("h3",{children:"I biglietti sono stati già pagati!"})}),H&&e.jsx(Ie,{title:w(F=>F.Attenzione),icon:e.jsx("i",{className:"fa-solid fa-lg fa-exclamation-triangle text-warning"}),children:e.jsx("h3",{children:"Il link di pagamento è scaduto."})})]})]})},Mx=_(Cl),Ox=Object.freeze(Object.defineProperty({__proto__:null,PayByLinkSubscriptions:Cl,default:Mx},Symbol.toStringTag,{value:"Module"})),zx=i=>{var{formatMessage:a}=i.i18n.get(Q),{formatMessage:t}=i.i18n.get(ie);const s=i.tickets[0],n=s.parts[0],r=s.parts[s.parts.length-1],o=s.isCanceled||s.expired;return e.jsxs(Bt,{className:o?"opacity-50":"",children:[e.jsxs("div",{className:"d-flex flex-row",children:[e.jsx("div",{className:"d-flex align-items-center pe-5",children:e.jsxs("div",{className:"d-flex align-items-baseline",children:[e.jsx("span",{className:"fw-bold fs-3",children:i.tickets.length})," ",e.jsx("i",{className:"fa fa-times ms-2"})]})}),e.jsx("div",{className:"d-flex w-100",children:e.jsxs("div",{className:"row position-relative w-100",children:[!
18o&&e.jsx(ke,{to:D.GetTicketDetail(s.id),className:"stretched-link"}),e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(Ze,{stopId:n.departureId,label:t(d=>d.Partenza),showTimeDay:!0,departureDateTime:n.departureDate})}),e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(Ze,{stopId:r.arrivalId,label:t(d=>d.Arrival),showTimeDay:!0,departureDateTime:r.arrivalDate})}),e.jsxs("div",{className:"col-12 col-lg-4 my-1",children:[e.jsx(qt,{price:ye(i.tickets,d=>d.price)-ye(i.tickets,d=>d.reliefAmount),fullPrice:ye(i.tickets,d=>d.price),toPay:ye(i.tickets,d=>d.toPay),pnr:s.pnr}),s.isPayed&&e.jsx("div",{children:e.jsx("div",{className:"fw-bold text-success",children:a(d=>d.Pagato)})}),s.expiryDate!=null&&e.jsxs("div",{children:[e.jsx("div",{className:"fw-bolder text-medium",children:a(d=>d.DataDiScadenza)}),e.jsx("div",{children:k.getReadableDateTimeString(s.expiryDate)})]})]})]})})]}),i.children&&e.jsx("div",{className:"py-2",children:i.children})]})},Lx=_(ui(pt(zx))),Pl=i=>{const{tickets:a}=i,{formatMessage:t}=i.i18n.get(ne);if(!a)return e.jsx(Je,{});const s=a.map(r=>r.isCanceled||r.expired).indexOf(!1)==-1,n=br(it(a,r=>Oe.GetTicketTravelKey(r)));return e.jsx(e.Fragment,{children:e.jsx("div",{className:s?"opacity-50":"",children:n.map(r=>e.jsx(Lx,{tickets:r,children:e.jsx(Tt,{header:e.jsx("h4",{className:"modal-title",children:t(o=>o.SelectedTickets)}),className:"btn btn-primary-light border-0 fw-bold px-5 py-3 me-2",text:e.jsxs("div",{className:"d-flex justify-content-between align-items-center text-nowrap",children:[e.jsx("span",{children:e.jsx("i",{className:"fa-solid fa-info-circle me-2"})}),e.jsx("span",{children:t(o=>o.SelectedTickets)})]}),children:a.map(o=>e.jsx($t,{ticket:o,hideActionButtons:!0,displayServices:!0}))})}))})})};var es=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Ex=new Pi,Dl=i=>{var a;const t=_e(),s=Se(),[n,r]=P.useState(null),[o,d]=P.useState(null),[u,c]=P.useState(!1),[l,m]=P.useState(_t),[h,f]=P.useState(null),[p,g]=P.useState(null),[v,x]=P.useState(null),[S,y]=P.useState(!1),[b,j]=P.useState(void 0);P.useEffect(()=>{s.groupid&&N(s.groupid)},[s.groupid]);const I=E=>{switch(E){case 0:return H(Z=>Z.PayByLinkNotValid);case 2:return H(Z=>Z.PayByLinkCanceled);case 1:return H(Z=>Z.PayByLinkExpired);default:return""}},N=E=>es(void 0,void 0,void 0,function*(){const Z=yield Ex.payByLinkDetailByGroupId(E);if(Z.ErrorCode){var de=I(Z.ErrorCode);j(de),r([])}else j(void 0),r(Z.tickets.filter(ue=>!ue.isPayed))}),w=(E,Z)=>es(void 0,[E,Z],void 0,function*([de,ue],O){u!=ue&&(c(ue),d(null),m(_t),f(null),g(null),x(null)),(l.paymentDataId!=O.paymentDataId||O.savePaymentData!=l.savePaymentData||de!=o)&&(d(de),m(O),f(null),f(null),g(null),x(null))}),T=E=>es(void 0,void 0,void 0,function*(){y(!0);const Z=Ui(We.TicketPayByLinkResultRedirectPath),de=Ui(We.TicketResultRedirectPathKo);let ue=null;var O=void 0;(o==null?void 0:o.type)==4&&(ue=h),(o==null?void 0:o.type)==3&&(ue=p,O=l.savePaymentData&&v||void 0);const se={groupId:s.groupid,okUrl:Z,koUrl:de,paymentData:{paymentDataId:l.paymentDataId||void 0,paymentMethod:o.type,savePaymentData:l.savePaymentData,useWallet:u,addressData:void 0,transactionCode:void 0,clientIntegrationPaymentId:ue||void 0,numContratto:O,nexiApmResponse:E},reliefData:void 0},ae=yield xe.payPaymentLink(se);y(!1);let be=!0;if(ae.redirect&&(be=yield st(ae.redirect,t)),be){let pe=`${We.TicketPayByLinkResultRedirectPath}/${ae.result.groupId}`;ae.result.coupon&&(pe+=`/${ae.result.coupon}`),t(pe)}else throw"unexpected error"}),C=i.i18n.get(Q).formatMessage,A=i.i18n.get(He).formatMessage,{formatMessage:H}=i.i18n.get(ne),{formatCurrency:z}=i.i18n;if(!n)return e.jsx(X,{});const R=ye(n,E=>E.toPay),M=n.some(E=>E.expired),F=n.some(E=>E.isCanceled),L=kt.canProceed(o,h,p,l.subPaymentMethod,l.paymentDataId),U=()=>Pe.IsGooglePay(l)?"GOOGLEPAY":Pe.IsApplePay(l)?"APPLEPAY":null,Y=Pe.IsGooglePay(l),W=Pe.IsApplePay(l);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white border-primary border-top shadow mb-3",children:e.jsx("div",{className:"container py-4",children:e.jsxs("div",{className:"fontsize-10u text-medium fw-bolder",children:[C(E=>E.PayByLink)," "]})})}),e.jsxs("div",{className:"container",children:[R>0&&!F&&!M&&e.jsxs(e.Fragment,{children:[e.jsx(Pl,{i18n:i.i18n,tickets:n}),e.jsx(Ie,{title:H(E=>E.PaymentMethod),icon:e.jsx("i",{className:"fa-solid fa-wallet"}),children:e.jsx(Rs,{price:R,groupId:s.groupid,onChangePaymentMethod:w,additionalData:l,selectedPaymentMethod:[o,u],walletRechargeLink:"#",i18n:i.i18n,saleChannel:0,payPalProceed:E=>f(E),payPalRequest:{payToBePayed:o&&{ticketIds:n.map(E=>E.id),useWallet:u,billingOperator:void 0,isLuggage:!1,paymentMethod:o.type,isSubscription:!1,isChangeDate:!1}||void 0},clientIntegrationPaymentId:h,payPalFullWidth:!0,hasCommissionKept:!1,nexiBuildProceed:(E,Z)=>{g(E),x(Z)},nexiBuildRequest:{payToBePayed:o&&{ticketIds:n.map(E=>E.id),useWallet:u,billingOperator:void 0,isLuggage:!1,paymentMethod:o.type,isSubscription:!1,isChangeDate:!1}||void 0},nexiClientIntegrationPaymentId:p})}),(Y||W)&&L&&e.jsx(Ts,{type:U(),request:{payToBePayed:o&&{ticketIds:n.map(E=>E.id),useWallet:u,billingOperator:void 0,isLuggage:!1,paymentMethod:o.type,isSubscription:!1,isChangeDate:!1}||void 0},metadata:((a=o==null?void 0:o.metadata)===null||a===void 0?void 0:a.type)=="creditCard"?o==null?void 0:o.metadata:void 0,apmProceed:E=>T(E),clientIntegrationPaymentId:void 0,onChangePaymentMethod:()=>{},isSelectedPaymentMethod:(o==null?void 0:o.type)===3&&(Y||W),savePaymentData:!1,paymentDataId:null})||e.jsxs(Pa,{className:"btn btn-primary btn-lg btn-highlight d-flex align-items-center justify-content-center fw-bold fontsize-5u py-3 w-100 mb-3",onClick:()=>T(void 0),disabled:!L||S==!0,children:["Paga ",z(R)]})]}),((b==null?void 0:b.length)||0)>0?e.jsx(Ie,{title:A(E=>E.Attenzione),icon:e.jsx("i",{className:"fa-solid fa-lg fa-exclamation-triangle text-warning"}),children:e.jsx("h3",{children:b})}):e.jsx(e.Fragment,{children:R<=0&&e.jsx(Ie,{title:A(E=>E.Attenzione),icon:e.jsx("i",{className:"fa-solid fa-lg fa-exclamation-triangle text-warning"}),children:e.jsx("h3",{children:H(E=>
18E.TicketsAlreadyPaid)})})})]})]})},Fx=_(Dl),Bx=Object.freeze(Object.defineProperty({__proto__:null,PayByLink:Dl,default:Fx},Symbol.toStringTag,{value:"Module"}));var ts=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const $x=new Pi;class Fa extends P.Component{constructor(a){super(a),this.state={tickets:[],urlPdf:"",coupon:null}}componentDidMount(){return ts(this,void 0,void 0,function*(){const a=yield $x.payByLinkDetailByGroupId(this.props.params.groupId);let t=null;this.props.params.coupon&&this.props.params.coupon!="null"&&(t=yield Fa.couponService.get(this.props.params.coupon)),this.setState({tickets:a.tickets,urlPdf:a.tickets[0].urlPdf,coupon:t}),yield this.sendTransactionEvent(a.tickets)})}sendTransactionEvent(a){return ts(this,void 0,void 0,function*(){const t=a[0].groupid,s=yield Promise.all(a.map(o=>ts(this,void 0,void 0,function*(){var d,u,c,l,m,h,f;const p=(h=(d=yield bi.get(o.parts[0].departureId))===null||d===void 0?void 0:d.shortDescription)!==null&&h!==void 0?h:"",g=(f=(u=yield bi.get(o.parts[o.parts.length-1].arrivalId))===null||u===void 0?void 0:u.shortDescription)!==null&&f!==void 0?f:"";return{id:`${o.parts[0].departureId.substr(0,18)}-${o.parts[o.parts.length-1].arrivalId.substr(0,18)}`,name:`${p}-${g}`,departureName:p,departureId:(c=o.parts[0])===null||c===void 0?void 0:c.departureId,departureDate:(l=o.parts[0])===null||l===void 0?void 0:l.departureDate,arrivalName:g,arrivalId:(m=o.parts[o.parts.length-1])===null||m===void 0?void 0:m.arrivalId,arrivalDate:o.parts[o.parts.length-1].arrivalDate,price:o.price,discount:o.discount,quantity:1}})));let n="Unknown";switch(a[0].paymentMethod){case 0:n="None";break;case 1:n="Cash";break;case 2:n="Sisal";break;case 3:n="CreditCard";break;case 4:n="PayPal";break;case 6:n="Wallet";break;case 7:n="OnBoard";break;case 8:n="External";break;case 9:n="Pos";break;case 10:n="Later";break;case 11:n="AgencyPos";break;case 12:n="PagoPa";break;case 13:n="ScalaPay";break;case 20:n="HeyLight";break;case 14:n="SatisPay";break;case 15:n="BankTransfer";break}const r={id:t,date:a[0].issueDate,grandtotal:ye(a,o=>o.payedAmount),paymentMethod:n,details:s,email:a[0].email};qe.send(new Ns(r))})}componentWillUnmount(){K.clear(),J().clear()}render(){if(!this.state.tickets||this.state.tickets.length===0)return e.jsx(X,{});const{formatMessage:a}=this.props.i18n.get(ne),t=this.state.urlPdf?ea(this.state.urlPdf,this.props.hl):"#",s=ye(this.state.tickets,o=>o.price+o.penaltiesAmount-o.payedAmount-o.discount-o.reliefAmount),n=this.state.tickets[0].paymentMethod===2;let r;return s>0&&!n?r=e.jsxs("span",{children:[e.jsx("i",{className:"fa fa-exclamation-triangle text-danger"})," ",a(o=>o.AcquistoKo)]}):r=e.jsxs("span",{children:[e.jsx("i",{className:"fa fa-thumbs-up fa-lg",style:{marginRight:10}}),a(o=>n?o.AcquistoOkSisal:o.AcquistoOk)]}),e.jsx(re,{title:r,fullWidth:!0,children:e.jsx(cn,{pdfUrl:t,tickets:this.state.tickets})})}}Fa.couponService=new Ta;const Wx=_(Be(Fa)),Ux=Object.freeze(Object.defineProperty({__proto__:null,default:Wx},Symbol.toStringTag,{value:"Module"})),gs=i=>{var a,t,s,n;const{value:r,onChange:o,dateLabel:d,textLabel:u,sameLine:c,dateRange:l,isReturn:m,error:h,saveButton:f}=i,[p,g]=P.useState(!1),v=(b,j)=>{var I,N,w,T,C,A;if(!b)return;let H=b;H.setHours((T=(w=j==null?void 0:j.hours)!==null&&w!==void 0?w:(I=r==null?void 0:r.date)===null||I===void 0?void 0:I.getHours())!==null&&T!==void 0?T:12),H.setMinutes((A=(C=j==null?void 0:j.minutes)!==null&&C!==void 0?C:(N=r==null?void 0:r.date)===null||N===void 0?void 0:N.getMinutes())!==null&&A!==void 0?A:30),o(Object.assign(Object.assign({},r),{place:r.place,date:b}))},x=()=>{let b=Object.assign({},r);b.arrivalWithin=!b.arrivalWithin,o(Object.assign(Object.assign({},b),{place:b.place}))},S=()=>{g(!p),p&&o(Object.assign(Object.assign({},r),{date:void 0,place:r.place}))},y=b=>{let j=Object.assign({},r);j.place=b,o(Object.assign({},j))};return e.jsxs("div",{className:"rental-time-input-wrapper",children:[e.jsxs("div",{className:`rental-time-card ${c?"row g-3":""}`,children:[d&&e.jsxs("div",{className:"rental-label-with-icon mb-2",children:[e.jsx("i",{className:`bi ${m?"bi-calendar-event":"bi-calendar-check"} me-2`}),e.jsx("label",{className:"fw-semibold text-primary",children:u})]}),e.jsxs("div",{className:"rental-date-section col-lg-12",children:[e.jsx(Ct,{onChange:(b,j)=>y(j??""),value:r==null?void 0:r.place}),e.jsx(ot,{error:h==null?void 0:h.place})]}),e.jsxs("div",{className:`rental-date-section ${c?"col-lg-7":""}`,children:[d&&e.jsxs("div",{className:"rental-label-with-icon mb-2",children:[e.jsx("i",{className:`bi ${m?"bi-calendar-event":"bi-calendar-check"} me-2`}),e.jsx("label",{className:"fw-semibold text-primary",children:d})]}),e.jsxs("div",{className:"date-picker-container position-relative",children:[e.jsx(gd,{childrenPosition:"before",className:"p-2",children:m&&e.jsx("div",{className:"return-date-checkbox mb-0 p-2 bg-light rounded",children:e.jsx(ct,{className:"d-flex align-items-center",onChange:()=>S(),checked:p,label:e.jsxs("span",{className:"ms-2 fw-medium",children:[e.jsx("i",{className:"bi bi-arrow-return-left me-1"}),"Ritorno?"]})})}),onSelectDate:b=>v(b),readOnly:!(p||!m),value:r==null?void 0:r.date,dateRange:{from:(s=l==null?void 0:l.from)!==null&&s!==void 0?s:k.AddDays(new Date,1),to:(n=l==null?void 0:l.to)!==null&&n!==void 0?n:k.AddYears(new Date,3)}}),e.jsx(ot,{error:h==null?void 0:h.startDate})]})]}),e.jsx("div",{className:`rental-time-section ${c?"col-lg-5":"mt-3"}`,children:e.jsxs("div",{className:"time-input-container",children:[d&&e.jsxs("div",{className:"rental-label-with-icon mb-2",children:[e.jsx("i",{className:"bi bi-clock me-2"}),e.jsx("label",{className:"fw-semibold text-primary",children:"A che ora?"})]}),e.jsx(fd,{name:"time-input",disabled:!(p||!m),hours:(a=r==null?void 0:r.date)===null||a===void 0?void 0:a.getHours(),minutes:(t=r==null?void 0:r.date)===null||t===void 0?void 0:t.getMinutes(),onChange:b=>v(r==null?void 0:r.date,b),additionalClass:"time-input-modern"})]})}),(r==null?void 0:r.arrivalWithin)!=null&&(p||!m)&&e.jsx("div",{className:"col-12 mt-3",children:e.jsxs("div",{className:"mode-toggle-container p-3 bg-light rounded shadow-sm",children:[e.jsxs("div",{className:"d-flex align-items-center justify-content-between flex-wrap",children:[e.jsxs("div",{className:"mode-label mb-2 mb-md-0",children:[e.jsx("i",{className:"bi bi-toggles2 me-2 text-primary"}),e.jsx("strong",{className:"text-primary",children:"Modalità di viaggio"})]}),e.jsx(xd,{onChange:x,className:"mode-radio-switch",items:[{checked:!r.arrivalWithin,description:"Partenza alle"},{checked:r.arrivalWithin,description:"Arrivo entro le"}]})]}),e.jsxs("small",{className:"text-muted d-block mt-2",children:[e.jsx("i",{className:"bi bi-info-circle me-1"}),r.arrivalWithin?"Arriverai a destinazione entro l'orario specificato":"Partirai all'orario specificato"]})]})}),f]}),e.jsx("style",{children:` 19 .rental-time-input-wrapper { 20 margin: 1rem 0; 21 } 22 23 .rental-time-card { 24 background: white; 25 border-radius: 12px; 26 padding: 1.25rem; 27 box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); 28 transition: box-shadow 0.3s ease; 29 } 30 31 .rental-time-card:hover { 32 box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); 33 } 34 35 .rental-label-with-icon { 36 display: flex; 37 align-items: center; 38 } 39 40 .rental-label-with-icon i { 41 font-size: 1.1rem; 42 color: var(--bs-primary, #0d6efd); 43 } 44 45 .date-picker-container { 46 border-radius: 8px; 47 } 48 49 .return-date-checkbox { 50 border-left: 3px solid var(--bs-primary, #0d6efd); 51 transition: all 0.2s ease; 52 } 53 54 .return-date-checkbox:hover { 55 background-color: var(--bs-primary-bg-subtle, #e7f1ff) !important; 56 } 57 58 .time-input-modern { 59 border-radius: 8px; 60 border: 2px solid #e9ecef; 61 transition: border-color 0.2s ease; 62 } 63 64 .time-input-modern:focus-within { 65 border-color: var(--bs-primary, #0d6efd); 66 box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15); 67 } 68 69 .mode-toggle-container { 70 border: 2px solid #e9ecef; 71 transition: all 0.3s ease; 72 } 73 74 .mode-toggle-container:hover { 75 border-color: var(--bs-primary, #0d6efd); 76 background-color: #f8f9fa !important; 77 } 78 79 .mode-radio-switch { 80 background: white; 81 padding: 0.5rem; 82 border-radius: 8px; 83 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); 84 } 85 86 .mode-label { 87 font-size: 1.05rem; 88 } 89
90 /* Responsive adjustments */ 91 @media (max-width: 991px) { 92 .rental-time-card { 93 padding: 1rem; 94 } 95 96 .mode-toggle-container .d-flex { 97 flex-direction: column; 98 align-items: flex-start !important; 99 } 100 101 .mode-radio-switch { 102 width: 100%; 103 margin-top: 0.5rem; 104 } 105 } 106 107 /* Animation for mode description */ 108 .mode-toggle-container small { 109 animation: fadeIn 0.3s ease; 110 } 111 112 @keyframes fadeIn { 113 from { 114 opacity: 0; 115 transform: translateY(-5px); 116 } 117 to { 118 opacity: 1; 119 transform: translateY(0); 120 } 121 } 122 123 /* Icon animations */ 124 .rental-label-with-icon i { 125 transition: transform 0.2s ease; 126 } 127 128 .rental-time-card:hover .rental-label-with-icon i { 129 transform: scale(1.1); 130 } 131 132 /* Improve checkbox styling */ 133 .return-date-checkbox .form-check-input:checked { 134 background-color: var(--bs-success, #198754); 135 border-color: var(--bs-success, #198754); 136 } 137 `})]})},Vx=i=>{var a,t;const[s,n]=P.useState({date:"",location:""}),[r,o]=P.useState({date:new Date,location:"",arrivalWhitin:!0}),{onChange:d,value:u,dateRange:c,accent:l="#6f42c1"}=i,m=p=>{let g=[...u];g.splice(p,1),d(g)},h=()=>{if(r.date==null&&n(Object.assign(Object.assign({},s),{date:"seleziona una Data"})),r.location==""&&n(Object.assign(Object.assign({},s),{location:"scrivi una località "})),r.date==null||r.location=="")return;let p=u;p.push(r),d(p),o({date:new Date,location:"",arrivalWhitin:!0}),n({date:"",location:""})};if(i.hidden)return null;const f=[...u].sort((p,g)=>p.date.getTime()-g.date.getTime());return e.jsxs(e.Fragment,{children:[f.length>0?e.jsx("div",{style:{marginBottom:16},children:f.map((p,g)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",background:g%2===0?"#faf8ff":"#fff",border:"1px solid #e8e2f5",borderRadius:8,marginBottom:6},children:[e.jsx("div",{style:{width:26,height:26,borderRadius:"50%",background:l,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:800,flexShrink:0},children:g+1}),e.jsxs("span",{style:{fontWeight:600,fontSize:14,flex:1,color:"#1a1d23"},children:[e.jsx("i",{className:"bi bi-geo-alt-fill me-1",style:{color:l,fontSize:12}}),p.location]}),e.jsx("span",{style:{fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:20,background:p.arrivalWhitin?"#e8f5e9":"#fff3e0",color:p.arrivalWhitin?"#2e7d32":"#e65100",whiteSpace:"nowrap",border:`1px solid ${p.arrivalWhitin?"#a5d6a7":"#ffcc80"}`},children:p.arrivalWhitin?"Arrivo entro le":"Partenza alle"}),e.jsxs("span",{style:{fontSize:13,color:"#495057",whiteSpace:"nowrap"},children:[e.jsx("i",{className:"bi bi-clock me-1",style:{color:"#adb5bd"}}),k.getReadableDateTimeString(p.date)]}),e.jsx("button",{onClick:v=>{v.preventDefault(),m(g)},style:{background:"none",border:"1px solid #dee2e6",borderRadius:6,padding:"3px 8px",cursor:"pointer",color:"#adb5bd",fontSize:13,flexShrink:0,lineHeight:1},title:"Rimuovi tappa",children:e.jsx("i",{className:"bi bi-x-lg"})})]},g))}):e.jsxs("div",{style:{padding:"16px 20px",borderRadius:8,border:"1px dashed #d0c4ef",background:"#faf8ff",textAlign:"center",color:"#9e8fc4",fontSize:13,marginBottom:16},children:[e.jsx("i",{className:"bi bi-signpost-split me-2"}),"Nessuna tappa intermedia aggiunta"]}),e.jsxs("div",{style:{paddingTop:16,borderTop:"1px solid #e8e2f5"},children:[e.jsxs("p",{style:{fontSize:12,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.07em",color:l,marginBottom:8},children:[e.jsx("i",{className:"bi bi-plus-circle-fill me-1"}),"Aggiungi una tappa"]}),e.jsx(gs,{sameLine:!0,dateLabel:"Quando?",dateRange:c&&Object.assign({},c),textLabel:"Tappa",value:{arrivalWithin:r.arrivalWhitin,date:(t=r==null?void 0:r.date)!==null&&t!==void 0?t:(a=i.dateRange)===null||a===void 0?void 0:a.from,place:r.location},onChange:p=>{var g;return o({date:(g=p.date)!==null&&g!==void 0?g:new Date,location:p.place,arrivalWhitin:p.arrivalWithin})},error:{place:s.location,startDate:s.date},saveButton:e.jsxs("button",{onClick:p=>{p.preventDefault(),h()},style:{marginTop:12,float:"right",background:l,color:"#fff",border:"none",borderRadius:8,padding:"8px 18px",fontWeight:700,fontSize:14,cursor:"pointer",display:"flex",alignItems:"center",gap:6},children:[e.jsx("i",{className:"bi bi-plus-lg"}),"Aggiungi Tappa"]})}),e.jsx(ot,{error:s.date})]})]})};var Gx=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};class Il{constructor(){this.contact="",this.name="",this.departure="",this.arrival="",this.passengerNumber="",this.returnDate="",this.privacyFlag="",this.itinerary="",this.recaptcha="",this.startDate="",this.invoiceData="",this.invoiceValidation=new Ia}}class qx{constructor(){this.invoiceRequested=!1,this.user=qu.getUser(),this.carRental=!1,this.returnArrivalWithin=!1,this.name=this.user!=null?this.user.n
137ame+" "+this.user.surname:"",this.email=this.user!=null?this.user.email:"",this.phoneNumber=this.user!=null?this.user.phoneNumber:"",this.callingCode=this.user!=null?this.user.callingCode:"+39",this.itinerary=[],this.arrivalWithin=!0}}class Hx{constructor(a){this.i18nObject=a}validateRequest(a,t,s){return Gx(this,void 0,void 0,function*(){let n=new Ql(Il);if((!a.phoneNumber||!a.email||a.phoneNumber==""||a.email=="")&&(n.errors.contact="Inserire telefono o email",n.isValid=!1),a.name||(n.errors.name="Inserire Nome e Cognome o Ragione Sociale",n.isValid=!1),a.passengerNumbers==null&&(n.errors.passengerNumber="metti almeno 1 passegero",n.isValid=!1),a.startDate==null&&(n.errors.startDate="inserisci una Data di partenza",n.isValid=!1),(a.startPlace==""||a.startPlace==null)&&(n.errors.departure="inserisci un luogo di partenza",n.isValid=!1),(a.destinationPlace==""||a.destinationPlace==null)&&(n.errors.arrival="inserisci un luogo di destinazione",n.isValid=!1),t||(n.errors.privacyFlag="Devi accettare le condizioni dell'informativa",n.isValid=!1),s&&a.itinerary.length==0&&(n.errors.itinerary="Inserisci almeno una tappa o togli la spunta",n.isValid=!1),a.invoiceRequested&&a.invoiceData==null&&(n.errors.invoiceData="Inserisci i dati della fattura",n.isValid=!1),a.invoiceRequested&&a.invoiceData!=null){const r=new fi(this.i18nObject).validate(a.invoiceData);r.isValid||(n.errors.invoiceData="Dati di fatturazione non validi",n.errors.invoiceValidation=r.errors,n.isValid=!1)}return n})}}const na=i=>{const{step:a,title:t,icon:s,children:n,accent:r="#0d6efd"}=i,o=e.jsxs("div",{className:"d-flex align-items-center gap-2",children:[e.jsx("div",{className:"d-flex align-items-center justify-content-center rounded-circle flex-shrink-0 text-white fw-bold",style:{width:30,height:30,background:r,fontSize:13,letterSpacing:"-0.5px"},children:a}),e.jsxs("span",{className:"fw-bold",style:{fontSize:15,color:"#1a1d23"},children:[e.jsx("i",{className:`bi ${s} me-2`,style:{color:r}}),t]})]});return e.jsx(bd,{header:o,style:{marginBottom:20},children:n})},Kx=Wi.DropDown(),Qx=i=>{const{busRanges:a,onChange:t,value:s}=i;return e.jsx(Kx,{data:a,label:"Numero Passeggeri",onSelect:n=>t(n),value:s,textField:n=>`da ${n.minPassenger} ${n.maxPassenger?"a "+n.maxPassenger:"in su"}`})},Jx=Wi.DropDown(),Yx=({busFleet:i})=>e.jsx("div",{className:"card mt-2",children:e.jsxs("div",{className:"card-body",children:[e.jsxs("h6",{className:"card-title d-flex align-items-center gap-2 mb-2",children:[e.jsx("i",{className:"fa-solid fa-bus"}),i.name,i.capacity.map(a=>e.jsxs("span",{className:"badge bg-primary",children:[e.jsx("i",{className:"fa-solid fa-users me-1"}),`da ${a.minPassenger} ${a.maxPassenger?"a "+a.maxPassenger:"in su "} `]})),i.link&&e.jsxs(at,{to:i.link,target:"_blank",rel:"noreferrer",className:"small",children:[e.jsx("i",{className:"fa-solid fa-link me-1"}),"Scheda mezzo"]})]}),i.description&&e.jsx("p",{className:"card-text text-muted mb-2",children:i.description}),i.busServices.length>0&&e.jsxs("div",{className:"d-flex flex-wrap align-items-center gap-2 mb-2",children:[e.jsx("h6",{className:"card-title d-flex align-items-center gap-2 mb-2",children:"Servizi offerti: "}),i.busServices.map(a=>e.jsx("span",{className:"badge bg-secondary",children:a},a))]})]})}),Zx=i=>{var a,t;const{busFleet:s,busRange:n,value:r,onChange:o,label:d,placeHolder:u}=i,c=n?`${n.minPassenger}-${(a=n.maxPassenger)!==null&&a!==void 0?a:""}`:null,l=P.useRef(c);if(P.useEffect(()=>{l.current!==c&&(l.current=c,o(void 0))},[c]),s.length===0||!n)return null;const m=s.filter(f=>f.capacity.some(p=>p.minPassenger==n.minPassenger&&p.maxPassenger==n.maxPassenger));if(m.length===0)return null;const h=(t=m.find(f=>f.id===r))!==null&&t!==void 0?t:null;return e.jsxs(e.Fragment,{children:[e.jsx(Jx,{data:m,label:d,onSelect:f=>o(f==null?void 0:f.id),value:h,textField:f=>f.name,allowNull:!0,placeholder:u}),h&&e.jsx(Yx,{busFleet:h})]})};var is=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const Xx=i=>{var a,t,s,n,r,o,d;const[u,c]=P.useState({emailFlag:!1,itineraryStep:!1,privacyFlag:!1,isLoading:!1}),[l,m]=P.useState(new Il),[h,f]=P.useState(null),[p,g]=P.useState(new qx),v=_e(),{i18n:x,roles:S}=i,{privacyFlag:y,emailFlag:b,isLoading:j,itineraryStep:I}=Object.assign({},u),{formatMessage:N}=x.get(Q),{formatMessage:w}=x.get(eu),T=P.useRef({reset:()=>null,execute:()=>Promise.resolve("")});let C=It(()=>is(void 0,void 0,void 0,function*(){return yield Ga.getConfig()}),[]),A=It(()=>is(void 0,void 0,void 0,function*(){return yield Ga.getFleet()}),[]);if(C==null||A==null)return e.jsx(Je,{});const H=R=>is(void 0,void 0,void 0,function*(){R.preventDefault();const M=p.invoiceRequested?p:Object.assign(Object.assign({},p),{invoiceData:void 0});try{let F=yield new Hx(x).validateRequest(M,y,I);if(!F.isValid){m(Object.assign({},F.errors));return}M.recaptchaResponse=yield T.current.execute(),c(Object.assign(Object.assign({},u),{isLoading:!0})),yield Ga.save(h,M).then(()=>{Sd("/rentalRequestSent",v)}).catch(L=>c(Object.assign(Object.assign({},u),{isLoading:!1})))}catch{T.current.reset(),c(Object.assign(Object.assign({},u),{isLoading:!1}))}}),z=R=>{const M=R&&R.length&&R[0]||null;f(M)};return j?e.jsx(Je,{}):e.jsx(re,{title:N(R=>R.RentalRequest),fullWidth:!0,children:e.jsxs("div",{style:{paddingTop:8},children:[e.jsxs(na,{step:1,title:"Dati di contatto",icon:"bi-person-fill",children:[e.jsx(Ct,{onChange:(R,M)=>g(Object.assign(Object.assign({},p),{name:M})),label:"Nome e Cognome o Ragione Sociale",value:(a=p.name)!==null&&a!==void 0?a:"",error:l==null?void 0:l.name}),e.jsxs("div",{className:"row g-3 mt-0",children:[e.jsxs("div",{className:"col-12 col-md-6",children:[e.jsx(xs,{onChange:(R,M,F)=>g(Object.assign(Object.assign({},p),{phoneNumber:F,callingCode:M})),phoneNumber:(t=p.phoneNumber)!==null&&t!==void 0?t:"",callingCode:(s=p.callingCode)!==null&&s!==void 0?s:"",name:"phone",label:"Numero di telefono"}),e.jsx(ot,{error:l==null?void 0:l.contact})]}),e.jsx("div",{className:"col-12 col-md-6",children:e.jsx(Ct,{error:l==null?void 0:l.contact,onChange:(R,M)=>g(Object.assign(Object.assign({},p),{email:M})),label:"Email",value:(n=p.email)!==null&&n!==void 0?n:""})}),e.jsx(Ps,{invoiceData:(r=p.invoiceData)!==null&&r!==void 0?r:new oi(S.indexOf(ce.canrequestinvoice.name)!=-1),onChange:(R,M)=>g(Object.assign(Object.assign({},p),{invoiceData:M??p.invoiceData,invoiceRequested:R})),invoice:p.invoiceRequested,errors:l.invoiceValidation,searchBar:!1})]})]}),e.jsx(na,{step:2,title:"Il tuo viaggio",icon:"bi-bus-front-fill",accent:"#198754",children:e.jsxs("div",{className:"row g-0",children:[e.jsxs("div",{style:{marginBottom:20,paddingBottom:16,borderBottom:"1px solid #f0f2f5"}
137,children:[e.jsx(Qx,{busRanges:C.busRanges,value:p.passengerNumbers,onChange:R=>g(Object.assign(Object.assign({},p),{passengerNumbers:R}))}),e.jsx(Zx,{busFleet:A,busRange:p.passengerNumbers,value:p.selectedFleet,onChange:R=>g(Object.assign(Object.assign({},p),{selectedFleet:R})),label:N(R=>R.BusPreference),placeHolder:N(R=>R.NoBusSelected)}),C.carRental&&e.jsx(ct,{label:"Senza Conducente ?",checked:p.carRental,onChange:R=>g(Object.assign(Object.assign({},p),{carRental:R}))}),e.jsx(ot,{error:l==null?void 0:l.passengerNumber})]}),e.jsxs("div",{className:"col-12 col-lg-6 pe-lg-3",style:{borderRight:"1px solid #e4e8ef"},children:[e.jsxs("p",{className:"text-muted mb-2",style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em"},children:[e.jsx("i",{className:"bi bi-geo-alt-fill me-1 text-success"})," Partenza"]}),e.jsx(gs,{onChange:R=>g(Object.assign(Object.assign({},p),{startDate:R.date,arrivalWithin:R.arrivalWithin,startPlace:R.place})),dateLabel:"Quando vuoi partire?",textLabel:"Da dove vuoi partire?",value:{arrivalWithin:p.arrivalWithin,date:p.startDate,place:(o=p.startPlace)!==null&&o!==void 0?o:""},error:{place:l==null?void 0:l.departure,startDate:l==null?void 0:l.startDate},sameLine:!0})]}),e.jsxs("div",{className:"col-12 col-lg-6 ps-lg-3 mt-3 mt-lg-0",children:[e.jsxs("p",{className:"text-muted mb-2",style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em"},children:[e.jsx("i",{className:"bi bi-geo-fill me-1 text-danger"})," Arrivo"]}),e.jsx(gs,{onChange:R=>{var M;g(Object.assign(Object.assign({},p),{returnDate:R.date,destinationPlace:R.place,returnArrivalWithin:(M=R.arrivalWithin)!==null&&M!==void 0?M:p.returnArrivalWithin}))},dateRange:{from:p.startDate,to:la.MaxDate},value:{date:p.returnDate,place:p.destinationPlace,arrivalWithin:p.returnArrivalWithin},textLabel:"Dove vuoi andare?",dateLabel:"Quando vuoi tornare?",isReturn:!0,error:{place:l==null?void 0:l.arrival},sameLine:!0})]})]})}),e.jsxs(na,{step:3,title:"Tappe intermedie",icon:"bi-signpost-split-fill",accent:"#6f42c1",children:[e.jsx(ct,{label:e.jsx("span",{style:{fontWeight:600},children:"Il percorso include fermate intermedie"}),checked:I,onChange:()=>c(Object.assign(Object.assign({},u),{itineraryStep:!I}))}),I&&e.jsxs("div",{style:{marginTop:16},children:[e.jsx(Vx,{onChange:R=>g(Object.assign(Object.assign({},p),{itinerary:R})),dateRange:{from:p.startDate,to:p.returnDate},hidden:!1,value:p.itinerary}),e.jsx(ot,{error:l==null?void 0:l.itinerary})]})]}),e.jsxs(na,{step:4,title:"Note e documenti",icon:"bi-card-text",accent:"#fd7e14",children:[e.jsx(yd,{label:"Itinerario e note aggiuntive",placeholder:"Descrivi l'itinerario del viaggio includendo eventuali note e richieste aggiuntive",onChange:(R,M)=>g(Object.assign(Object.assign({},p),{notes:M})),value:(d=p.notes)!==null&&d!==void 0?d:"",name:"notes",rows:4}),e.jsx("div",{style:{marginTop:12},children:e.jsx(Cr,{onChange:R=>{z(R)},accept:[".pdf"]})})]}),e.jsxs("div",{style:{background:"#f8f9fa",border:"1px solid #e4e8ef",borderRadius:14,padding:"20px 26px",marginBottom:20},children:[e.jsx(ct,{name:"privacyOk",label:e.jsxs(e.Fragment,{children:[w(R=>R.PrivacyLabel1)," ",e.jsx(tu,{linkLabel:w(R=>R.PrivacyLabel2)})," ",w(R=>R.PrivacyLabel3)]}),checked:y,onChange:R=>c(Object.assign(Object.assign({},u),{privacyFlag:R}))}),e.jsx(ot,{error:l==null?void 0:l.privacyFlag}),e.jsx("div",{style:{marginTop:12},children:e.jsx(ct,{label:e.jsx("span",{className:"text-muted",style:{fontSize:13},children:"Vorrei ricevere materiale informativo e promozionale, anche mediante mezzi automatizzati di comunicazione (ad esempio e-mail, SMS, ecc)"}),onChange:()=>c(Object.assign(Object.assign({},u),{emailFlag:!b})),checked:b})})]}),e.jsxs(Pa,{className:"btn btn-primary fw-bold my-3 w-100 py-3",onClick:R=>H(R),children:[e.jsx("i",{className:"bi bi-send-fill me-2"}),"Invia Richiesta"]}),e.jsx(ot,{error:l==null?void 0:l.recaptcha}),e.jsx(ot,{error:l==null?void 0:l.invoiceData}),te.recaptchaSiteKey&&e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-lg-12",children:e.jsx(jd,{sitekey:te.recaptchaSiteKey,size:"invisible",controller:T.current})})})]})})},eb=_(et(Xx)),tb=Object.freeze(Object.defineProperty({__proto__:null,default:eb},Symbol.toStringTag,{value:"Module"}));var Ba=function(i,a,t,s){var n=arguments.length,r=n<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,t):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,a,t,s);else for(var d=i.length-1;d>=0;d--)(o=i[d])&&(r=(n<3?o(r):n>3?o(a,t,r):o(a,t))||r);return n>3&&r&&Object.defineProperty(a,t,r),r},ut=function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},ra=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};class tt{getAnonymousLinkList(a){return ra(this,void 0,void 0,function*(){return yield tt.service.getReservationPassengerFareCategories(a)})}getAnonymousLinkListCsv(a){return ra(this,void 0,void 0,function*(){return yield tt.service.getReservationPassengerFareCategoriesCsv(a)})}putPassengerName(a,t){return ra(this,void 0,void 0,function*(){return yield tt.service.putPassengerName(t),tt.service.getReservationPassengerFareCategories(a)})}toText(a){return new Promise((t,s)=>{const n=new FileReader;n.readAsArrayBuffer(a),n.onload=r=>{var o,d;if(!(!((o=r.target)===null||o===void 0)&&o.result))throw"invalid buffer";const u=new Uint8Array(r.target.result),c=new TextDecoder("latin1").decode(u),l=(d=Vl.detect(c))===null||d===void 0?void 0:d.encoding,h=new TextDecoder(l||void 0).decode(u);t({text:h,encoding:l})},n.onerror=()=>s(n.error)})}putPassengerNameCsv(a,t){return ra(this,void 0,void 0,function*(){const s=yield this.toText(t),n={fileName:t.name,content:s.text,encoding:s.encoding};return yield tt.service.import(a,n),tt.service.getReservationPassengerFareCategories(a)})}}tt.service=new Hu;Ba([Qt,ut("design:type",Function),ut("design:paramtypes",[String]),ut("design:returntype",Promise)],tt.prototype,"getAnonymousLinkList",null);Ba([Qt,ut("design:type",Function),ut("design:paramtypes",[String]),ut("design:returntype",Promise)],tt.prototype,"getAnonymousLinkListCsv",null);Ba([Qt,ut("design:type",Function),ut("design:paramtypes",[String,Array]),ut("design:returntype",Promise)],tt.prototype,"putPassengerName",null);Ba([Qt,ut("design:type",Function),ut("design:paramtypes",[String,File]),ut("design:returntype",Promise)],tt.prototype,"putPassengerNameCsv",null);const ti=new tt;class ib extends Ki{constructor(){super(a=>a.passengerIndex.toString()),this.useAll=a=>this.useAllWithAction(()=>ti.getAnonymousLinkList(a)),Si.onfunction(ti.getAnonymousLinkList,a=>this.setAll(a)).onfunction(ti.putPassengerName,a=>this.setAll(a)).onfunction(ti.putPassengerNameCsv,a=>this.setAll(a))}}const ab=new ib;var vr=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const sb=()=>{const{id:i}=qi();if(i==null)return null;const a=ab.useAll(i);return a==null?e.jsx(Je,{}):e.jsx(nb,{items:a,groupId:i})},nb=bt(_(i=>{var a;const{items:t}=i,[s,n]=P.useState([]),[r,o]=P.useState(!1),[d,u]=P.useState([]),{formatMessage:c}=i.i18n.get(Ft),{formatMessage:l}=i.i18n.get(Lt);jr(()=>{u(t.map(g=>{var v,x;return{passengerIndex:g.passengerIndex,extraData:g.extraData,name:(v=g.name)!==null&&v!==void 0?v:"",surname:(x=g.surname)!==null&&x!==void 0?x:"",ticketIds:g.ticketIds}}))},[t]);const m=(g,v,x,S)=>{const y=d.findIndex(j=>j.passengerIndex==S),b=[...d.slice(0,y),Object.assign(Object.assign({},d[y]),{name:g,surname:v,extraData:x}),...d.slice(y+1)];u(b)},h=()=>vr(void 0,void 0,void 0,function*(){o(!0);let g=[];for(const v of d){const x=t.find(y=>y.passengerIndex==v.passengerIndex);let S={passengerIndex:v.passengerIndex};if(x.type==0&&(V.isNullOrWhiteSpace(v.name)&&(S.name=l(y=>y.InsertName)),V.isNullOrWhiteSpace(v.surname)&&(S.surname=l(y=>y.InsertSurname))),x.extraParams!=null&&Object.keys(x.extraParams).length>0){const y=ri.extraParamsErrors(i.extraParamsData,x.extraParams,v.extraData,l);S.extraData=y}(S.name||S.surname||S.extraData)&&g.push(S)}if(g.length>0){n(g),o(!1);return}try{yield ti.putPassengerName(i.groupId,d),xt.success(l(v=>v.OperationCompleted)),n([]),o(!1)}catch{xt.error(l(x=>x.ErrorOccurredContactCallCenter)),o(!1)}}),f=(a=xr(t,g=>g.departureDate))===null||a===void 0?void 0:a.departureDate,p=P.useRef(null);return e.jsx(re,{title:"Modifica gruppo",fullWidth:!0,children:e.jsx(Sa,{isLoading:r,children:d.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-lg-8"}),e.jsxs("div",{className:"col-12 col-lg-4 d-flex justify-content-end",children:[e.jsx(Tt,{className:"btn btn-secondary",icon:"fa-solid fa-upload",text:"Import file",ref:p,children:e.jsx(Cr,{label:l(g=>g.SelectCsvToImport),onChange:g=>vr(void 0,void 0,void 0,function*(){var v;o(!0),yield ti.putPassengerNameCsv(i.groupId,g[0]),(v=p==null?void 0:p.current)===null||v===void 0||v.close(),o(!1)})})}),e.jsxs("button",{className:"btn btn-secondary",onClick:()=>ti.getAnonymousLinkListCsv(i.groupId),children:[e.jsx("i",{className:"fa-solid fa-download me-2"})," Export file"]})]})]}),d.map(g=>{var v,x,S;const y=t.find(I=>I.passengerIndex==g.passengerIndex),b=(v=y.extraParams)===null||v===void 0?void 0:v.map(I=>Object.assign(Object.assign({},I),{additionalJsonData:{}})),j=s.find(I=>I.passengerIndex==g.passengerIndex);return e.jsxs("div",{className:"card shadow my-3",children:[e.jsxs("div",{className:"card-header bg-primary text-white fontsize-5u",children:[e.jsx(Ji,{id:y.fareCategory})," Categoria: ",e.jsx(Ye,{id:y.fareCategory})]}),e.jsx("div",{className:"card-body",children:e.jsxs("div",{className:"row",children:[y.type==0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"col-12 col-lg-6",children:e.jsx(Ct,{label:c(I=>I.Name),error:j==null?void 0:j.name,value:(x=g.name)!==null&&x!==void 0?x:"",onCh
137ange:(I,N)=>{var w;return m(N,(w=g.surname)!==null&&w!==void 0?w:"",g.extraData,g.passengerIndex)},maxLength:150})}),e.jsx("div",{className:"col-12 col-lg-6",children:e.jsx(Ct,{label:c(I=>I.Surname),value:(S=g.surname)!==null&&S!==void 0?S:"",onChange:(I,N)=>{var w;return m((w=g.name)!==null&&w!==void 0?w:"",N,g.extraData,g.passengerIndex)},maxLength:150,error:j==null?void 0:j.surname})})]}),b!=null&&e.jsx("div",{className:"col-12",children:e.jsx(em,{extraData:g.extraData,extraParams:b,onChange:I=>{var N,w;return m((N=g.name)!==null&&N!==void 0?N:"",(w=g.surname)!==null&&w!==void 0?w:"",I,g.passengerIndex)},maxDepartureDate:f,errors:j==null?void 0:j.extraData,onTypedChange:I=>{var N,w;return m((N=g.name)!==null&&N!==void 0?N:"",(w=g.surname)!==null&&w!==void 0?w:"",I,g.passengerIndex)}})})]})})]},g.ticketIds.join(","))}),e.jsx("button",{className:"btn btn-primary btn-highlight px-5 my-3",onClick:h,children:l(g=>g.ConfirmNames)})]})||e.jsxs("div",{className:"h-100 mt-3 p-5 bg-white shadow border rounded-3",children:[e.jsx("h2",{className:"fw-bold text-medium",children:l(g=>g.OperationNotPermetted)}),e.jsx("p",{children:l(g=>g.NamesNotEditable)})]})})})}))(i=>i.allByKey(),"extraParamsData"),rb=Object.freeze(Object.defineProperty({__proto__:null,default:sb},Symbol.toStringTag,{value:"Module"}));var as=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const ob=i=>{var a,t,s,n;const r=Se(),o=_e(),[d,u]=P.useState(null),[c,l]=P.useState({data:null,loading:!1,clientIntegrationPaymentId:null,email:"",phone:"",callingCode:"",billingOperator:void 0});P.useEffect(()=>{m(r.groupId)},[r.groupId]);const m=y=>as(void 0,void 0,void 0,function*(){const{tickets:b}=yield xe.ticketGroup(y);u(b)}),h=y=>as(void 0,void 0,void 0,function*(){l(Object.assign(Object.assign({},c),{data:y}))}),f=y=>as(void 0,void 0,void 0,function*(){var b,j,I,N,w,T;const{data:C,email:A,callingCode:H,phone:z}=c;let R;const M=Ur.PassengerContactIsValidTemp(H,z,A,((b=C==null?void 0:C.paymentData)===null||b===void 0?void 0:b.type)||0,dt.environmentName);if(!M.ok){xt.error(M.error);return}var F=null;((I=(j=c.data)===null||j===void 0?void 0:j.paymentData)===null||I===void 0?void 0:I.type)==4&&(F=c.clientIntegrationPaymentId);var L={groupId:r.groupId,okUrl:we(D.TicketResultRedirectPath),koUrl:we(D.TicketResultRedirectPathKo),paymentData:(C==null?void 0:C.paymentData)!=null?{paymentDataId:((N=C.paymentData.additionalData)===null||N===void 0?void 0:N.paymentDataId)||void 0,paymentMethod:C.paymentData.type,savePaymentData:(w=C.paymentData.additionalData)===null||w===void 0?void 0:w.savePaymentData,useWallet:C.useWallet,addressData:void 0,transactionCode:R,clientIntegrationPaymentId:F||void 0}:void 0,reliefData:(T=C==null?void 0:C.reliefData)!==null&&T!==void 0?T:void 0,email:A,callingCode:H,phoneNumber:z},U=yield xe.payToBePayed(L);let Y=!0;if(U.redirect&&(Y=yield st(U.redirect,o)),Y)o(D.TicketsPathTemplate,{replace:!0});else throw"unexpected error"}),p=y=>{var b,j;const I=(b=c.data)===null||b===void 0?void 0:b.paymentData,N=(j=c.data)===null||j===void 0?void 0:j.reliefData;return I==null&&N==null?!1:N!=null&&N.amountToUse==y?!0:N!=null&&N.amountToUse<y&&(I==null||!kt.canProceed(I,c.clientIntegrationPaymentId,null,null,null))?!1:I!=null&&kt.canProceed(I,c.clientIntegrationPaymentId,null,null,null)},{formatMessage:g}=i.i18n.get(ne);if(!d||c.loading)return e.jsx(X,{});const v=d.filter(y=>y.toPay>0&&!y.expired&&!y.isCanceled),x=Jl.Round(ye(v,y=>y.toPay),2),S=(a=c.data)===null||a===void 0?void 0:a.paymentData;return e.jsxs(re,{fullWidth:!0,title:g(y=>y.RetryPayment),children:[e.jsx("div",{className:"d-flex justify-content-end",children:e.jsx(Te,{customLink:"/"})}),e.jsx(Pl,{i18n:i.i18n,tickets:d}),e.jsxs(Ie,{title:g(y=>y.PaymentMethod),children:[e.jsx(iu,{price:x,itemIds:d.map(y=>y.id),isSubscription:!1,onChangePaymentMethod:h,additionalData:(s=S==null?void 0:S.additionalData)!==null&&s!==void 0?s:_t,selectedPaymentMethod:c.data,walletRechargeLink:D.WalletPath,i18n:i.i18n,saleChannel:1,payPalProceed:y=>l(Object.assign(Object.assign({},c),{clientIntegrationPaymentId:y})),payPalRequest:{payToBePayed:(S==null?void 0:S.type)&&{ticketIds:d.map(y=>y.id),useWallet:(n=(t=c.data)===null||t===void 0?void 0:t.useWallet)!==null&&n!==void 0?n:!1,billingOperator:void 0,isLuggage:!1,paymentMethod:S.type,isSubscription:!1,isChangeDate:!1}||void 0},clientIntegrationPaymentId:c.clientIntegrationPaymentId,payPalFullWidth:!0,hasCommissionKept:!1}),e.jsxs("button",{className:"btn btn-primary btn-highlight text-uppercase mt-3 px-5 btn-lg my-3",onClick:()=>f(),disabled:!p(x),children:["Paga ⬠",V.toDecimalString(x)]})]})]})},lb=_(ob),db=Object.freeze(Object.defineProperty({__proto__:null,default:lb},Symbol.toStringTag,{value:"Module"})),cb=i=>{const{formatMessage:a}=i.i18n.get(Q);return e.jsx(re,{title:a(t=>t.RentalRequest),children:e.jsxs("div",{className:"h-100 mt-3 p-5 bg-white shadow border rounded-3",children:[e.jsx("h2",{className:"fw-bold text-medium",children:a(t=>t.RentalRequestSent)}),e.jsx("p",{children:a(t=>t.RentalRequestSentDescription)})]})})},ub=_(i=>e.jsx(cb,Object.assign({},i))),mb=Object.freeze(Object.defineProperty({__proto__:null,default:ub},Symbol.toStringTag,{value:"Module"})),hb=i=>{const a=i.ticketIds,t=n=>{var r=void 0;return i.specifiedDate&&(r=k.ToDateTimeDto(i.specifiedDate)),wn.cancelPreview(i.refundByLinkId,{ticketIds:n,ignoreOneWayPriceDiff:!1,specifiedDate:r,forcedPenalty:i.forcedPenalty})},s=n=>wn.bookingCancel(i.refundByLinkId,n);return e.jsx(el,Object.assign({},i,{ids:a,cancelPreviewAction:t,cancelAction:s,isAnonymous:!0,showTicketSummary:i.showTicketSummary,isRefundOnly:i.isRefundOnly,onRefundComplete:i.onRefundComplete}))},pb=_(hb),vb=i=>{const{ticketIds:a}=i,{formatMessage:t}=i.i18n.get(ne),{formatMessage:s}=i.i18n.get(Q),{formatMessage:n}=i.i18n.get(ie),r=a.map(u=>yi.useBooking(u)).filter(u=>u!=null);if(r.length===0)return e.jsx(X,{});const o=r.every(u=>u.isCanceled&&u.yetToBePayedOrRefunded>=0||u.expired),d=br(it(r,u=>Oe.GetTicketTravelKey(u)));return e.jsx(e.Fragment,{children:e.jsx("div",{className:o?"opacity-50":"",children:d.map((u,c)=>{const l=u[0],m=l.parts[0],h=l.parts[l.parts.length-1],f=l.isCanceled&&l.yetToBePayedOrRefunded>=0||l.expired;return e.jsxs(Bt,{className:f?"opacity-50 mb-3":"mb-3",children:[e.jsxs("div",{className:"d-flex flex-row",children:[e.jsx("div",{className:"d-flex align-items-center pe-5",children:e.jsxs("div",{className:"d-flex align-items-baseline",children:[e.jsx("span",{className:"fw-bold fs-3",children:u.length}),u.length>1&&e.jsx("i",{className:"fa fa-times ms-2"})]})}),e.jsx("div",{className:"d-flex w-100",children:e.jsxs("div",{className:"row position-relative w-100",children:[e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(Ze,{stopId:m.departureId,label:n(p=>p.Partenza),showTimeDay:!0,departureDateTime:m.departureDate})}),e.jsx("div",{className:"col-12 col-lg-4 my-1",children:e.jsx(Ze,{stopId:h.arrivalId,label:n(p=>p.Arrival),showTimeDay:!0,departureDateTime:h.arrivalDate})}),e.jsxs("div",{className:"col-12 col-lg-4 my-1",children:[Oe.isCancelledAndRefundable(l)?e.jsx(qt,{price:ye(u,p=>Math.abs(p.yetToBePayedOrRefunded)),pnr:l.pnr}):e.jsx(qt,{price:ye(u,p=>p.price)-ye(u,p=>p.reliefAmount),fullPrice:ye(u,p=>p.price),toPay:ye(u,p=>p.toPay),pnr:l.pnr}),l.isPayed&&e.jsx("div",{children:e.jsx("div",{className:"fw-bold text-success",children:s(p=>p.Pagato)})}),l.isCanceled&&e.jsx("div",{children:e.jsx("div",{className:"fw-bold text-danger",children:s(p=>p.Annullato)})}),l.expiryDate!=null&&e.jsxs("div",{children:[e.jsx("div",{className:"fw-bolder text-medium",children:s(p=>p.DataDiScadenza)}),e.jsx("div",{children:k.getReadableDateTimeString(l.expiryDate)})]})]})]})})]}),u.length>1&&e.jsx("div",{className:"py-2",children:e.jsx(Tt,{header:e.jsx("h4",{className:"modal-title",children:t(p=>p.SelectedTickets)}),className:"btn btn-primary-light border-0 fw-bold px-5 py-3 me-2",text:e.jsxs("div",{className:"d-flex justify-content-between align-items-center text-nowrap",children:[e.jsx("span",{children:e.jsx("i",{className:"fa-solid fa-info-circle me-2"})}),e.jsx("span",{children:t(p=>p.SelectedTickets)})]}),children:u.map(p=>e.jsx($t,{ticket:p,hideActionButtons:!0,displayServices:!0},p.id))})})]},c)})})})};var gb=function(i,a,t,s){function n(r){return r instanceof t?r:new t(function(o){o(r)})}return new(t||(t=Promise))(function(r,o){function d(l){try{c(s.next(l))}catch(m){o(m)}}function u(l){try{c(s.throw(l))}catch(m){o(m)}}function c(l){l.done?r(l.value):n(l.value).then(d,u)}c((s=s.apply(i,a||[])).next())})};const fb=new Ku,xb=i=>{const a=Se(),[t,s]=P.useState(null),[n,r]=P.useState(!0),[o,d]=P.useState(void 0),[u,c]=P.useState(null),l=P.useCallback(()=>gb(void 0,void 0,void 0,function*(){try{r(!0);const v=yield fb.getById(a.id);s(v),d(void 0)}catch(v){d(v.message||"Failed to load refund data"),s(null)}finally{r(!1)}}),[a.id]);P.useEffect(()=>{l()},[l]);const{formatMessage:m}=i.i18n.get(Q),{formatMessage:h}=i.i18n.get(ne),f=P.useCallback(v=>{c(v)},[]);if(n)return e.jsx(X,{});if(o||!t)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white border-primary border-top shadow mb-3",children:e.jsx("div",{className:"container py-4",children:e.jsx("div",{className:"fontsize-10u text-medium fw-bolder",children:m(v=>v.Annullamento)})})}),e.jsx("div",{className:"container",children:e.jsx("div",{className:"alert alert-danger",children:o||m(v=>v.Errore_annullamento)})})]});const p=new Date(t.Expiration)<new Date,g=t.IsCancelledNotRefunded?m(v=>v.Rimborso):m(v=>v.Annullamento);return u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white border-primary border-top shadow mb-3",children:e.jsx("div",{className:"container py-4",children:e.jsx("div",{className:"fontsize-10u text-medium fw-bolder",children:t.IsCancelledNotRefunded?m(v=>v.RimborsoEffettuato):m(v=>v.AnnullamentoEffettuato)})})}),e.jsx("div",{className:"container",children:e.jsxs("div",{className:"alert alert-success",children:[e.jsxs("div",{className:"my-2",children:[e.jsx("div",{className:"text-uppercase",children:m(v=>v.TotaleOperazione)}),e.jsxs("div",{className:"fontsize-5u fw-bold",children:[V.toDecimalString(u.refundedAmount)," â¬"]})]}),u.coupon&&e.jsxs("div",{className:"my-1",children:[e.jsxs("div",{className:"my-2",children:[e.jsx("div",{className:"text-uppercase",children:h(v=>v.RemainderCoupon)}),e.jsx("div",{className:"fontsize-5u fw-bold text-uppercase",children:u.coupon})]}),e.jsxs("div",{className:"my-2",children:[e.jsx("div",{className:"text-uppercase",children:h(v=>v.DataDiScadenza)}),e.jsx("div",{className:"fontsize-5u fw-bold text-uppercase",children:k.getReadableDateTimeString(u.expiration)})]})]}),u.Message&&e.jsx("div",{className:"alert alert-info mt-3",children:u.Message})]})})]}):p?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white border-primary border-top shadow mb-3",children:e.jsx("div",{className:"container py-4",children:e.jsx("div",{className:"fontsize-10u text-medium fw-bolder",children:g})})}),e.jsx("div",{className:"container",children:e.jsx("div",{className:"alert alert-danger",children:m(v=>v.RefundByLinkExpired)})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white border-primary border-top shadow mb-3",children:e.jsxs("div",{className:"container py-4",children:[e.jsx("div",{className:"fontsize-10u text-medium fw-bolder",children:g}),e.jsxs("div",{className:"text-muted fontsize-2u mt-2",children:[e.jsx("i",{className:"fa-solid fa-clock me-2"}),"Link valido fino al: ",k.getReadableDateTimeString(t.Expiration)]})]})}),e.jsxs("div",{className:"container",children:[e.jsx(vb,{i18n:i.i18n,ticketIds:t.TicketIds}),e.jsx(pb,Object.assign({},i,{refundByLinkId:a.id,ticketIds:t.TicketIds,showTicketSummary:!1,forcedPenalty:t.ForcedPenalty,specifiedDate:t.CreationDate,isRefundOnly:t.IsCancelledNotRefunded,onRefundComplete:f}))]})]})},bb=_(xb),yb=Object.freeze(Object.defineProperty({__proto__:null,default:bb},Symbol.toStringTag,{value:"Module"}));
137export{q as _}; 138function __vite__mapDeps(indexes) { 139 if (!__vite__mapDeps.viteFileDeps) { 140 __vite__mapDeps.viteFileDeps = ["OKWQlYh6.js","8Yht-gTw.js","assets/3dYzkm0E.css","D06Tu0vu.js","WuHAdAb1.js","assets/hS-CqCom.css","eoMzmDS_.js","DkAH6N0u.js"] 141 } 142 return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) 143}
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.