1import{a as li}from"./chunk-DP5EWYNA.js";import{a as ve}from"./chunk-BTRMYONS.js";import{a as ii,b as oi}from"./chunk-KM2UQ4PI.js";import{a as Ke}from"./chunk-3TBEO2CK.js";import{a as ze}from"./chunk-KDO3XLLW.js";import{a as Qe}from"./chunk-YZCXXJBL.js";import{c as ti}from"./chunk-HAY4NPF7.js";import{a as le}from"./chunk-JDPKSM2I.js";import{b as Ge,c as Xe,d as q,f as Ye,h as ue,i as ge,l as Ze,m as Je,s as ne,t as oe,v as ei}from"./chunk-RDT6L5WJ.js";import{a as ni}from"./chunk-IHVBKXBS.js";import"./chunk-2AABOY7O.js";import{c as te,f as Ue,h as He,j as $e,k as We}from"./chunk-X2ONO64N.js";import{a as qe}from"./chunk-GAXUPFN5.js";import{b as Me,d as je,k as F}from"./chunk-V22FKZ2N.js";import"./chunk-PFOT56QO.js";import{Aa as E,Ba as T,Da as I,E as ke,Ea as f,Fa as m,Ia as A,Ib as he,Ja as k,Jb as Pe,K as Ie,Ka as _e,La as Fe,Ma as we,N as R,Na as De,Oa as W,P as Se,Pa as h,Q as b,Qa as S,R as x,Ra as u,Sa as Oe,U as Ce,W as Ve,Wb as M,Yb as j,Za as z,a as w,aa as N,ac as Re,b as D,ba as Ee,bb as s,bc as ee,cb as d,da as o,eb as G,ec as ie,f as B,fb as L,ia as g,ib as X,ic as Q,ka as K,ma as Te,na as Be,o as xe,p as H,pa as _,pb as Y,qb as Z,rb as Ae,sa as me,sb as Ne,ta as p,tb as Le,v as $,va as V,vb as J,w as ye,xa as a,ya as r,z as O,za as v}from"./chunk-LFWSQ7SW.js";var re=(()=>{class i extends je{index(e){let t={};return e?.brand&&(t.brand=e?.brand),e?.filter&&e?.filter.length>0&&(t.filter=e?.filter?.toString()),e?.series&&e?.series.length>0&&(t.series=e?.series?.toString()),e?.vehicle_to_compare_with&&(t.vehicle_to_compare_with=e?.vehicle_to_compare_with),e?.booking_type&&(t.booking_type=e?.booking_type),this.http.get(this.endpoint,{params:t})}getSlots(e,t){return this.http.get(this.endpoint+"/"+e+"/available-consultation-slots",{params:t})}constructor(e,t,n,l,y){super(e,t),this.http=e,this.log=t,this.localeService=n,this.router=l,this.activatedRoute=y,this.endpoint="/vehicle-consultations/vehicles"}static{this.\u0275fac=function(t){return new(t||i)(R(Pe),R(Me),R(Q),R(j),R(M))}}static{this.\u0275prov=Ie({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var gi=F.App.Enums.VehicleConsultations.VehicleIconTypeEnum,fi=F.App.Enums.VehicleConsultations.VehicleBrandEnum,C=F.App.Enums.VehicleConsultations.BookingTypeEnum,bi=F.App.Enums.Settings.BookingQuestionResponseTypeEnum,fe=F.App.Enums.PublicErrorCodeEnum,be=i=>({locale:i}),xi=i=>[i];function yi(i,c){i&1&&v(0,"img",36)}function ki(i,c){i&1&&v(0,"img",37)}function Ii(i,c){if(i&1){let e=I();E(0),a(1,"div",38)(2,"input",39),f("change",function(){b(e);let n=m(2);return x(n.toggleIndividualBooking())}),r(),a(3,"label",40),h(4),s(5,"translate"),r()(),a(6,"div",38),v(7,"input",41),a(8,"label",40),h(9),s(10,"translate"),r()(),T()}if(i&2){let e=m(2);o(2),k("id","",e.vehicle.id,"-on-site-individual-toggle"),p("disabled",!e.vehicle.has_onsite_individual_consultation_capability)("checked",e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ON_SITE_INDIVIDUAL),o(),k("for","",e.vehicle.id,"-on-site-individual-toggle"),o(),u(" ",d(5,13,"pages.vehicles.booking.on_site_individual")," "),o(3),k("id","",e.vehicle.id,"-on-site-comparison-toggle"),p("formControl",e.bookingForm.controls.comparison),o(),k("for","",e.vehicle.id,"-on-site-comparison-toggle"),o(),u(" ",d(10,15,"pages.vehicles.booking.comparison.checkbox")," ")}}function Si(i,c){if(i&1){let e=I();E(0),a(1,"div",38)(2,"input",42),f("click",function(){b(e);let n=m(2);return x(n.toggleIndividualBooking())}),r(),a(3,"label",40),h(4),s(5,"translate"),r()(),a(6,"div",38),v(7,"input",41),a(8,"label",40),h(9),s(10,"translate"),r()(),T()}if(i&2){let e=m(2);o(2),k("id","",e.vehicle.id,"-online-individual-toggle"),p("disabled",!e.vehicle.has_online_individual_consultation_capability)("checked",e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ONLINE_INDIVIDUAL),o(),k("for","",e.vehicle.id,"-online-individual-toggle"),o(),u(" ",d(5,13,"pages.vehicles.booking.online_individual")," "),o(3),k("id","",e.vehicle.id,"-online-comparison-toggle"),p("formControl",e.bookingForm.controls.comparison),o(),k("for","",e.vehicle.id,"-online-comparison-toggle"),o(),u(" ",d(10,15,"pages.vehicles.booking.comparison.checkbox")," ")}}function Ci(i,c){i&1&&(a(0,"div",43)(1,"div",44)(2,"div",45)(3,"p",46),h(4),s(5,"translate"),r(),a(6,"p",47),h(7),s(8,"translate"),r(),a(9,"p",48),h(10),s(11,"translate"),r()(),a(12,"div",49),v(13,"img",50),r()()()),i&2&&(o(4),S(d(5,3,"pages.vehicles.booking.individual_info.headline")),o(3),S(d(8,5,"pages.vehicles.booking.individual_info.description")),o(3),S(d(11,7,"pages.vehicles.booking.individual_info.duration")))}function Vi(i,c){i&1&&v(0,"i",61)}function Ei(i,c){i&1&&(a(0,"p",63),h(1),s(2,"translate"),r()),i&2&&(o(),u(" ",d(2,1,"pages.vehicles.booking.comparison.series_error")," "))}function Ti(i,c){i&1&&(a(0,"p",66),h(1),s(2,"translate"),r()),i&2&&(o(),u(" ",d(2,1,"pages.vehicles.booking.comparison.series_not_found")," "))}function Bi(i,c){if(i&1&&(v(0,"app-form-select-dropdown",67),s(1,"translate")),i&2){let e=m(5);k("name","",e.vehicle.id,"-comparison-series-selector"),p("formControl",e.comparisonSeriesDropdown)("placeholder",d(1,6,"pages.vehicles.booking.comparison.series_label"))("multiselect",!1)("selectOptions",e.comparisonSeriesOptions)}}function Fi(i,c){if(i&1&&_(0,Ti,3,3,"p",64)(1,Bi,2,8,"app-form-select-dropdown",65),i&2){let e=m(4);p("ngIf",e.comparisonSeriesOptions&&e.comparisonSeriesOptions.length<=0),o(),p("ngIf",e.comparisonSeriesOptions&&e.comparisonSeriesOptions.length>0)}}function wi(i,c){if(i&1&&_(0,Ei,3,3,"p",62)(1,Fi,2,2,"ng-template",null,2,L),i&2){let e=W(2),t=m(3);p("ngIf",t.comparisonSeriesError)("ngIfElse",e)}}function Di(i,c){i&1&&v(0,"i",61)}function Oi(i,c){i&1&&(a(0,"p",63),h(1),s(2,"translate"),r()),i&2&&(o(),u(" ",d(2,1,"pages.vehicles.booking.comparison.model_error")," "))}function Ai(i,c){i&1&&(a(0,"p",66),h(1),s(2,"translate"),r()),i&2&&(o(),u(" ",d(2,1,"pages.vehicles.booking.comparison.model_not_found")," "))}function Ni(i,c){if(i&1&&(v(0,"app-form-select-dropdown",69),s(1,"translate")),i&2){let e=m(5);k("name","",e.vehicle.id,"-comparison-model-selector"),p("formControl",e.bookingForm.controls.compare_to_vehicle_id)("placeholder",d(1,7,"pages.vehicles.booking.comparison.model_label"))("multiselect",!1)("selectOptions",e.comparisonVehicleList)("selectOptionValueKey","model_title")}}function Li(i,c){if(i&1&&_(0,Ai,3,3,"p",64)(1,Ni,2,9,"app-form-select-dropdown",68),i&2){let e=m(4);p("ngIf",e.comparisonVehicleList&&e.comparisonVehicleList.length<=0),o(),p("ngIf",e.comparisonVehicleList&&e.comparisonVehicleList.length>0)}}function Pi(i,c){if(i&1&&_(0,Oi,3,3,"p",62)(1,Li,2,2,"ng-template",null,3,L),i&2){let e=W(2),t=m(3);p("ngIf",t.comparisonVehicleListError)("ngIfElse",e)}}function Ri(i,c){if(i&1&&(a(0,"div",51)(1,"div",44)(2,"div",52)(3,"p",53),h(4),s(5,"translate"),r()()(),a(6,"div",54)(7,"div",52)(8,"div",55),_(9,Vi,1,0,"i",56)(10,wi,3,2,"ng-template",null,0,L),r(),a(12,"div",55),_(13,Di,1,0,"i",56)(14,Pi,3,2,"ng-template",null,1,L),r()(),a(16,"div",57),v(17,"i",58),r(),a(18,"div",59),v(19,"img",60),r()()()),i&2){let e,t=W(11),n=W(15),l=m(2);o(4),S(d(5,7,"pages.vehicles.booking.comparison.description")),o(5),p("ngIf",l.comparisonSeriesLoading)("ngIfElse",t),o(4),p("ngIf",l.comparisonVehicleListLoading)("ngIfElse",n),o(6),A("src",(e=l.selectedComparisonVehicle==null||l.selectedComparisonVehicle.detail_image==null?null:l.selectedComparisonVehicle.detail_image.url)!==null&&e!==void 0?e:"/assets/images/detail_default.webp",N),A("alt",l.vehicle.model_title)}}function Mi(i,c){if(i&1){let e=I();a(0,"button",70),f("click",function(){b(e);let n=m(2);return x(n.loadVehicleSlots(n.date.value))}),h(1),s(2,"translate"),r()}if(i&2){let e=m(2);
1V("disabled",e.bookingForm.invalid),p("disabled",e.bookingForm.invalid),o(),u(" ",d(2,4,"pages.vehicles.booking.check_slots_btn")," ")}}function ji(i,c){i&1&&(a(0,"h6",88),h(1),s(2,"translate"),r()),i&2&&(o(),S(d(2,1,"pages.vehicles.slots_headline")))}function Qi(i,c){i&1&&(a(0,"div",89),h(1),s(2,"translate"),r()),i&2&&(o(),u(" ",d(2,1,"pages.vehicles.no_slots_available")," "))}function qi(i,c){i&1&&(a(0,"div",89),v(1,"i",90),r())}function Ui(i,c){if(i&1){let e=I();a(0,"div",93),f("click",function(){let n=b(e).$implicit,l=m(4);return x(l.selectSlot(n))}),a(1,"p"),v(2,"i",94),h(3),s(4,"dfnsParseIso"),s(5,"formatInTimeZone"),r(),a(6,"p"),v(7,"i",95),h(8),s(9,"dfnsParseIso"),s(10,"formatInTimeZone"),s(11,"dfnsParseIso"),s(12,"formatInTimeZone"),r()()}if(i&2){let e=c.$implicit,t=m(4);V("selected",(t.selectedSlot==null?null:t.selectedSlot.generated_start_at)===e.generated_start_at&&(t.selectedSlot==null?null:t.selectedSlot.generated_end_at)===e.generated_end_at),o(3),u(" ",G(5,7,d(4,5,e.generated_start_at),"Europe/Berlin","dd.MM.yyyy",z(26,be,t.localeService.getDfnsLocale()))," "),o(5),Oe(" ",G(10,14,d(9,12,e.generated_start_at),"Europe/Berlin","HH:mm",z(28,be,t.localeService.getDfnsLocale()))," - ",G(12,21,d(11,19,e.generated_end_at),"Europe/Berlin","HH:mm",z(30,be,t.localeService.getDfnsLocale()))," ")}}function Hi(i,c){if(i&1&&(a(0,"div",91),_(1,Ui,13,32,"div",92),s(2,"async"),r()),i&2){let e,t=m(3);o(),p("ngForOf",(e=d(2,1,t.vehicleAvailabilities))==null?null:e.available_slots)}}function $i(i,c){i&1&&(a(0,"p",48),h(1),s(2,"translate"),r()),i&2&&(o(),S(d(2,1,"pages.vehicles.booking.slot_info.online_description")))}function Wi(i,c){i&1&&(a(0,"p",48),h(1),s(2,"translate"),r()),i&2&&(o(),S(d(2,1,"pages.vehicles.booking.slot_info.on_site_description")))}function zi(i,c){i&1&&(a(0,"span"),h(1," *"),r())}function Ki(i,c){if(i&1&&(a(0,"div",103),v(1,"input",104),a(2,"label",40),h(3),r()()),i&2){let e=c.$implicit,t=c.last,n=m(3).$implicit,l=m(3);V("mb-1",t),o(),_e("id","booking-question-",n.value.id,"-option-",e.id,""),k("name","booking-question-",n.value.id,""),p("formControl",l.selectedVehicleBookingQuestionsForm.controls[n.key])("value",z(13,xi,e.id)),o(),_e("for","booking-question-",n.value.id,"-option-",e.id,""),o(),u(" ",e.localized_answer," ")}}function Gi(i,c){i&1&&(a(0,"p",63),h(1),s(2,"translate"),r()),i&2&&(o(),u(" ",d(2,1,"forms.errors.required")," "))}function Xi(i,c){if(i&1&&(E(0),a(1,"div",78)(2,"label"),h(3),_(4,zi,2,0,"span",25),r(),_(5,Ki,4,15,"div",101)(6,Gi,3,3,"p",102),r(),T()),i&2){let e=m(2).$implicit,t=m(3);o(3),u(" ",e.value.localized_question," "),o(),p("ngIf",e.value.is_required),o(),p("ngForOf",e.value.answer_options),o(),p("ngIf",t.selectedVehicleBookingQuestionsForm.controls[e.key].touched&&(t.selectedVehicleBookingQuestionsForm.controls[e.key].errors==null?null:t.selectedVehicleBookingQuestionsForm.controls[e.key].errors.required))}}function Yi(i,c){if(i&1&&(v(0,"app-form-select-dropdown",106),s(1,"translate")),i&2){let e=m(3).$implicit,t=m(3);k("name","booking-question-",e.value.id,""),p("formControl",t.selectedVehicleBookingQuestionsForm.controls[e.key])("label",e.value.localized_question+(e.value.is_required?" *":""))("placeholder",d(1,7,"pages.articles.select_placeholder"))("multiselect",e.value.is_multiselect)("selectOptions",e.value.answer_options)}}function Zi(i,c){if(i&1&&(E(0),a(1,"div",78),_(2,Yi,2,9,"app-form-select-dropdown",105),r(),T()),i&2){let e=m(2).$implicit;o(2),p("ngIf",e.value.answer_options)}}function Ji(i,c){if(i&1&&v(0,"app-form-group",108),i&2){let e=m(3).$implicit,t=m(3);k("name","booking-question-",e.value.id,""),p("label",e.value.localized_question)("labelClass","form-label")("required",e.value.is_required)("control",t.selectedVehicleBookingQuestionsForm.controls[e.key])}}function et(i,c){i&1&&(E(0),a(1,"div",78),_(2,Ji,1,6,"app-form-group",107),r(),T())}function it(i,c){if(i&1&&(a(0,"div",97),E(1,98),_(2,Xi,7,4,"ng-container",99)(3,Zi,3,1,"ng-container",99)(4,et,3,0,"ng-container",100),T(),r()),i&2){let e=m().$implicit,t=m(3);o(),p("ngSwitch",e.value.response_type),o(),p("ngSwitchCase",t.BookingQuestionResponseTypeEnum.RADIO),o(),p("ngSwitchCase",t.BookingQuestionResponseTypeEnum.DROPDOWN)}}function tt(i,c){if(i&1&&(E(0),_(1,it,5,3,"div",96),T()),i&2){let e=c.$implicit,t=m(3);o(),p("ngIf",t.selectedVehicleBookingQuestionsForm.controls[e.key])}}function nt(i,c){i&1&&(a(0,"div",109)(1,"p",110),h(2),s(3,"translate"),r()()),i&2&&(o(2),S(d(3,1,"pages.articles.booking_questions.required")))}function ot(i,c){if(i&1){let e=I();a(0,"div",71)(1,"div",72)(2,"div",44)(3,"div",73),_(4,ji,3,3,"h6",74),s(5,"async"),_(6,Qi,3,3,"div",75),s(7,"async"),_(8,qi,2,0,"div",75)(9,Hi,3,3,"div",76),s(10,"async"),s(11,"async"),a(12,"div",77)(13,"p",78),h(14),s(15,"translate"),r(),_(16,$i,3,3,"p",79)(17,Wi,3,3,"p",79),r(),a(18,"button",8
10),f("click",function(){b(e);let n=m(2);return x(n.dateSelectorShown=!0)}),h(19),s(20,"translate"),r()(),a(21,"div",81)(22,"app-date-picker",82),s(23,"async"),f("dateSelected",function(n){b(e);let l=m(2);return x(l.dateSelectedFromCalendar(n))})("monthChanged",function(n){b(e);let l=m(2);return x(l.monthChanged(n))}),r()()()(),a(24,"div",83)(25,"div",44),_(26,tt,2,1,"ng-container",84),s(27,"transformObjectToKeyValueArray"),_(28,nt,4,3,"div",85),s(29,"transformObjectToKeyValueArray"),r()(),a(30,"div",86)(31,"button",87),f("click",function(){b(e);let n=m(2);return x(n.addToCart())}),h(32),s(33,"translate"),r()()()}if(i&2){let e,t,n,l=m(2);o(3),V("d-none",l.dateSelectorShown),o(),p("ngIf",(e=d(5,20,l.vehicleAvailabilities))==null?null:e.available_slots),o(2),p("ngIf",!l.vehicleSlotsLoading&&((t=d(7,22,l.vehicleAvailabilities))==null||t.available_slots==null?null:t.available_slots.length)===0),o(2),p("ngIf",l.vehicleSlotsLoading),o(),p("ngIf",((n=d(10,24,l.vehicleAvailabilities))==null?null:n.available_slots)&&d(11,26,l.vehicleAvailabilities).available_slots.length>0),o(5),S(d(15,28,"pages.vehicles.booking.slot_info.headline")),o(2),p("ngIf",l.bookingForm.controls.booking_type.value===l.BookingTypeEnum.ONLINE_STANDARD||l.bookingForm.controls.booking_type.value===l.BookingTypeEnum.ONLINE_INDIVIDUAL),o(),p("ngIf",l.bookingForm.controls.booking_type.value===l.BookingTypeEnum.ON_SITE_STANDARD||l.bookingForm.controls.booking_type.value===l.BookingTypeEnum.ON_SITE_INDIVIDUAL),o(2),u(" ",d(20,30,"pages.vehicles.select_other_date")," "),o(2),V("d-none",!l.dateSelectorShown),o(),p("date",d(23,32,l.date))("disabledDates",l.unavailableDates),o(4),p("ngForOf",d(27,34,l.selectedVehicleBookingQuestions)),o(2),p("ngIf",d(29,36,l.selectedVehicleBookingQuestions).length>0),o(3),V("disabled",l.selectedVehicleBookingQuestionsForm.invalid||l.selectedSlot===void 0),p("disabled",l.selectedVehicleBookingQuestionsForm.invalid||l.selectedSlot===void 0),o(),u(" ",d(33,38,"pages.vehicles.add_to_cart")," ")}}function lt(i,c){i&1&&(a(0,"div",111)(1,"div",44)(2,"div",112),v(3,"i",61),r()()())}function at(i,c){if(i&1){let e=I();a(0,"div",5)(1,"button",6),f("click",function(){b(e);let n=m();return x(n.closeDetails())}),v(2,"i",7),r(),a(3,"div",8),v(4,"img",9),r(),a(5,"div",10)(6,"div",11)(7,"div",12)(8,"div",13),_(9,yi,1,0,"img",14)(10,ki,1,0,"img",15),r(),a(11,"h6",16),h(12),r(),a(13,"h6",17),h(14),r()()(),a(15,"div",18)(16,"div",19)(17,"div",20),v(18,"i",21),s(19,"async"),s(20,"async"),r(),a(21,"div",22)(22,"div",23)(23,"button",24),f("click",function(){b(e);let n=m();return x(n.selectOnSiteBooking())}),h(24),s(25,"translate"),r(),_(26,Ii,11,17,"ng-container",25),r()()()(),a(27,"div",26)(28,"div",27)(29,"div",20),v(30,"i",28),r(),a(31,"div",22)(32,"div",29)(33,"button",24),f("click",function(){b(e);let n=m();return x(n.selectOnlineBooking())}),h(34),s(35,"translate"),r(),_(36,Si,11,17,"ng-container",25),r()()()()(),_(37,Ci,14,9,"div",30)(38,Ri,20,9,"div",31),a(39,"div",32),_(40,Mi,3,6,"button",33),s(41,"async"),s(42,"async"),r(),_(43,ot,34,40,"div",34),s(44,"async"),_(45,lt,4,0,"div",35),r()}if(i&2){let e=m();k("id","vehicle-details-",e.vehicle.id,""),o(4),A("src",e.vehicle.detail_image!=null&&e.vehicle.detail_image.url?e.vehicle.detail_image==null?null:e.vehicle.detail_image.url:"/assets/images/detail_default.webp",N),A("alt",e.vehicle.model_title),o(5),p("ngIf",e.vehicle.icons.includes(e.VehicleIconTypeEnum.I_ICON)),o(),p("ngIf",e.vehicle.icons.includes(e.VehicleIconTypeEnum.M_ICON)),o(2),u(" ",e.vehicle.model_title," "),o(2),u(" ",e.vehicle.color[e.localeService.currentLocale]," "),o(4),V("bmwi-car-front",d(19,35,e.vehicleBrandFilter)===e.VehicleBrandEnum.BMW)("bmwi-car-front-mini",d(20,37,e.vehicleBrandFilter)===e.VehicleBrandEnum.MINI),o(5),V("active",e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ON_SITE_STANDARD||e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ON_SITE_INDIVIDUAL)("disabled",!e.vehicle.has_future_onsite_availabilities),p("disabled",!e.vehicle.has_future_onsite_availabilities),me("aria-pressed",e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ON_SITE_STANDARD||e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ON_SITE_INDIVIDUAL)("aria-disabled",!e.vehicle.has_future_onsite_availabilities),o(),u(" ",d(25,39,"pages.vehicles.booking.on_site_standard")," "),o(2),p("ngIf",e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ON_SITE_INDIVIDUAL||e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ON_SITE_STANDARD),o(7),V("active",e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ONLINE_STANDARD||e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ONLINE_INDIVIDUAL)("disabled",!e.vehicle.has_future_online_availabilities),p("disabled",!e.vehicle.has_future_online_availabilities),me("aria-pressed",e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ONLINE_STANDARD||e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ONLINE_INDIVIDUAL)("aria-disabled",!e.vehicle.has_future_online_availabilities),o(),u(" ",d(35,41,"pages.vehicles.booking.online_standard")," "),o(2),p("ngIf",e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ONLINE_STANDARD||e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ONLINE_INDIVIDUAL),o(),p("ngIf",e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ON_SITE_INDIVIDUAL||e.bookingForm.controls.booking_type.value===e.BookingTypeEnum.ONLINE_INDIVIDUAL),o(),p("ngIf",e.bookingForm.controls.comparison.value),o(2),p("ngIf",!e.vehicleSlotsLoading&&(d(41,43,e.vehicleAvailabilities)===null||d(42,45,e.vehicleAvailabilities)===void 0)),o(3),p("ngIf",!e.vehicleSlotsLoading&&d(44,47,e.vehicleAvailabilities)),o(2),p("ngIf",e.vehicleSlotsLoading)}}var ci=(()=>{class i{ngOnInit(){this.subscriptionsToCloseOnDestroy=[this.localeService.localeChanged.subscribe({next:()=>{this.comparisonSeriesOptions&&(this.comparisonSeriesOptions=this.comparisonSeriesOptions.map(e=>({id:e.id,value:this.translateService.instant("enums.vehicle.series."+e.id)})),this.cdr.markForCheck())}}),H([this.bookingForm.controls.comparison.valueChanges,this.bookingForm.controls.booking_type.valueChanges]).pipe($(e=>e[1]!==void 0&&e[0]),O((e,t)=>
1e[0]===t[0]&&e[1]===t[1])).subscribe({next:()=>{this.loadComparisonSeriesOptions()}}),this.bookingForm.controls.comparison.valueChanges.pipe(O()).subscribe({next:e=>{e?this.bookingForm.controls.compare_to_vehicle_id.enable():(this.comparisonSeriesDropdown.reset(null),this.bookingForm.controls.compare_to_vehicle_id.disable()),this.cdr.markForCheck()}}),this.comparisonSeriesDropdown.valueChanges.pipe(O()).subscribe({next:e=>{this.comparisonVehicleList=void 0,this.bookingForm.controls.compare_to_vehicle_id.reset(null),e&&this.loadComparisonVehicleList(),this.cdr.markForCheck()}}),this.bookingForm.controls.compare_to_vehicle_id.valueChanges.pipe(O()).subscribe({next:e=>{e&&e[0]?this.selectedComparisonVehicle=this.comparisonVehicleList?.find(t=>t.id===e[0])?.value??void 0:this.selectedComparisonVehicle=void 0,this.cdr.markForCheck()}}),this.bookingForm.valueChanges.pipe(O()).subscribe({next:()=>{this.selectedSlot=void 0,this.unavailableDates=void 0,this.vehicleAvailabilities.next(void 0),this.cdr.markForCheck()}}),this.vehicleAvailabilities.pipe($(e=>e!==void 0),O((e,t)=>
1e?.article_id===t?.article_id)).subscribe({next:()=>{this.loadBookingQuestion()}})]}ngOnChanges(e){"vehicle"in e&&e.vehicle.currentValue?.id!==e.vehicle.previousValue?.id&&this.bookingForm.controls.vehicle_id.setValue(e.vehicle.currentValue?.id)}ngOnDestroy(){this.bookingForm.reset({vehicle_id:null,booking_type:null,comparison:!1,compare_to_vehicle_id:null}),this.subscriptionsToCloseOnDestroy.forEach(e=>e?.unsubscribe())}selectOnSiteBooking(){this.vehicle.has_future_onsite_availabilities&&(this.bookingForm.controls.booking_type.value===C.ON_SITE_STANDARD||this.bookingForm.controls.booking_type.value===C.ON_SITE_INDIVIDUAL||(this.bookingForm.controls.comparison.setValue(!1),this.bookingForm.controls.booking_type.patchValue(C.ON_SITE_STANDARD),this.bookingForm.updateValueAndValidity(),this.cdr.markForCheck()))}selectOnlineBooking(){this.vehicle.has_future_online_availabilities&&(this.bookingForm.controls.booking_type.value===C.ONLINE_STANDARD||this.bookingForm.controls.booking_type.value===C.ONLINE_INDIVIDUAL||(this.bookingForm.controls.comparison.setValue(!1),this.bookingForm.controls.booking_type.patchValue(C.ONLINE_STANDARD),this.bookingForm.updateValueAndValidity(),this.cdr.markForCheck()))}toggleIndividualBooking(){switch(this.bookingForm.controls.booking_type.value){case C.ON_SITE_STANDARD:this.vehicle.has_onsite_individual_consultation_capability&&this.bookingForm.controls.booking_type.setValue(C.ON_SITE_INDIVIDUAL);break;case C.ON_SITE_INDIVIDUAL:this.bookingForm.controls.booking_type.setValue(C.ON_SITE_STANDARD);break;case C.ONLINE_STANDARD:this.vehicle.has_online_individual_consultation_capability&&this.bookingForm.controls.booking_type.setValue(C.ONLINE_INDIVIDUAL);break;case C.ONLINE_INDIVIDUAL:this.bookingForm.controls.booking_type.setValue(C.ONLINE_STANDARD);break;default:}this.bookingForm.updateValueAndValidity(),this.cdr.markForCheck()}loadVehicleSlots(e){if(this.bookingForm.valid&&e){this.vehicleSlotsLoading=!0,this.cdr.markForCheck();let t={date:te(new Ue(e),"yyyy-MM-dd'T'HH:mm:ssxxx"),booking_type:this.bookingForm.value.booking_type};"compare_to_vehicle_id"in this.bookingForm.value&&this.bookingForm.value.compare_to_vehicle_id&&(t=D(w({},t),{vehicle_to_compare:this.bookingForm.value.compare_to_vehicle_id})),this.vehicleService.getSlots(this.bookingForm.value.vehicle_id,t).subscribe({next:n=>{this.vehicleAvailabilities.next(n.data),this.unavailableDates=n.data.unavailable_dates_remaining_month,this.loadBookingQuestion(),this.vehicleSlotsLoading=!1,this.cdr.markForCheck()}})}}dateSelectedFromCalendar(e){if(this.vehicleAvailabilities.value){let t=this.vehicleAvailabilities.value;t&&this.vehicleAvailabilities.next(D(w({},t),{available_slots:[]}))}this.dateSelectorShown=!1,this.selectSlot(void 0),this.dateSelected.emit(e),this.loadVehicleSlots(e)}selectSlot(e){this.selectedSlot=e,this.cdr.markForCheck()}monthChanged(e){if(this.vehicleAvailabilities.value){let t=this.vehicleAvailabilities.value;t&&this.vehicleAvailabilities.next(D(w({},t),{available_slots:[]}))}else return;this.dateSelectorShown=!1,this.selectSlot(void 0),this.dateSelected.emit(e),this.loadVehicleSlots(e)}closeDetails(){this.router.navigate([this.localeService.localizedPath("/vehicle-consultation/vehicles")],{queryParams:{vehicle:void 0},queryParamsHandling:"merge"}).then()}addToCart(){if(!(this.selectedSlot&&this.selectedVehicleBookingQuestionsForm.valid)){this.selectedVehicleBookingQuestionsForm.markAllAsTouched();return}if(!(this.vehicleAvailabilities.value&&this.vehicleAvailabilities.value?.article_price_id)||this.bookingForm.invalid)return;let e=[{booking_slot_id:this.selectedSlot.id,article_price_id:this.vehicleAvailabilities.value?.article_price_id,quantity:1,discount_reason_id:null,voucher_id:null,vehicle_consultation_data:{vehicle_id:this.vehicle.id,booking_type:this.bookingForm.value.booking_type,comparison_vehicle_id:this.bookingForm.value.compare_to_vehicle_id?.[0]??null}}],t=[];Object.entries(this.selectedVehicleBookingQuestionsForm.value).forEach(n=>{if(n[1]!==null&&n[1].length>0){let l={booking_slot_id:this.selectedSlot.id,question_id:n[0]},y;Array.isArray(n[1])?y=D(w({},l),{answer_ids:n[1]}):y=D(w({},l),{custom_answer:n[1]}),t.push(y)}}),this.addingToCart=!0,this.cartService.addAllToCart(e,[],t,this.selectedSlot.id).pipe(ye(n=>{if(n instanceof he&&n.error?.data?.error?.code===fe.CART_EXPIRED_EXCEPTION)return alert(`${n.error.data.error.message} 2${this.translateService.instant("errors.cart_expired_creating_new_cart_with_new_articles")}`),this.cartService.deleteCartInfo(),this.cartService.addAllToCart(e,[],t,this.selectedSlot.id);throw n})).subscribe({next:()=>{this.addingToCart=!1,this.resetToArticleListOnlyView(),setTimeout(()=>window.scrollTo({top:0,behavior:"smooth"}),100),this.cdr.markForCheck()},error:n=>{if(console.error("error while adding items to cart",n),n instanceof he){let l=n.error?.data?.error;switch(l?.code){case fe.GENERAL_EXCEPTION:case fe.CART_ITEM_GENERAL_EXCEPTION:alert(l.message);return}this.addingToCart=!1,this.resetToArticleListOnlyView(),this.cdr.markForCheck()}}})}resetToArticleListOnlyView(){this.router.navigate([this.localeService.localizedPath("/vehicle-consultation/vehicles")],{queryParams:D(w({},this.activatedRoute.snapshot.queryParams),{vehicle:void 0}),queryParamsHandling:"merge",skipLocationChange:!1,replaceUrl:!0}).then()}loadComparisonSeriesOptions(){this.comparisonSeriesLoading=!0,this.comparisonSeriesError=!1,this.cdr.markForCheck(),this.vehicleBrandFilter.value&&this.bookingForm.controls.booking_type.value&&this.bookingForm.value.vehicle_id?this.vehicleService.index({brand:this.vehicleBrandFilter.value,vehicle_to_compare_with:this.bookingForm.value.vehicle_id,booking_type:this.bookingForm.controls.booking_type.value}).subscribe({next:e=>{this.comparisonSeriesLoading=!1,this.comparisonSeriesError=!1,this.comparisonSeriesOptions=e.available_series.map(t=>({id:t,value:this.translateService.instant("enums.vehicle.series."+t)})),this.cdr.markForCheck()},error:()=>{this.comparisonSeriesLoading=!1,this.comparisonSeriesError=!0,this.cdr.markForCheck()}}):(this.comparisonSeriesLoading=!1,this.comparisonSeriesError=!0,this.cdr.markForCheck())}loadBookingQuestion(){this.selectedVehicleBookingQuestionsForm=new ue({}),this.selectedVehicleBookingQuestions={},this.vehicleAvailabilities.value?.article_id&&this.articleService.getBookingQuestions(this.vehicleAvailabilities.value.article_id).subscribe({next:e=>{e.data.forEach(t=>{this.selectedVehicleBookingQuestions=D(w({},this.selectedVehicleBookingQuestions),{[t.id]:t});let n=new ge(null,t.is_required?[q.required]:[]);this.selectedVehicleBookingQuestionsForm.addControl(t.id,n)}),this.cdr.markForCheck()}})}loadComparisonVehicleList(){this.comparisonVehicleListLoading=!0,this.comparisonVehicleListError=!1,this.cdr.markForCheck(),this.vehicleBrandFilter.value&&this.bookingForm.value.vehicle_id&&this.comparisonSeriesDropdown.value&&this.bookingForm.controls.booking_type.value?this.vehicleService.index({brand:this.vehicleBrandFilter.value,series:[this.comparisonSeriesDropdown.value],vehicle_to_compare_with:this.bookingForm.value.vehicle_id,booking_type:this.bookingForm.controls.booking_type.value}).subscribe({next:e=>{this.comparisonVehicleListError=!1,this.comparisonVehicleListLoading=!1;let t=e.data,n=t.findIndex(l=>l.id===this.bookingForm.value.vehicle_id);n>=0&&t.splice(n,1),this.comparisonVehicleList=t.map(l=>({id:l.id,value:l})),this.comparisonVehicleListLoading=!1,this.cdr.markForCheck()},error:()=>{this.comparisonVehicleListLoading=!1,this.comparisonVehicleListError=!0,this.cdr.markForCheck()}}):(this.comparisonVehicleListLoading=!1,this.comparisonVehicleListError=!0,this.cdr.markForCheck())}constructor(e,t,n,l,y,U,ce,pe,de,_i){this.localeService=e,this.fb=t,this.nfb=n,this.cdr=l,this.translateService=y,this.vehicleService=U,this.articleService=ce,this.cartService=pe,this.activatedRoute=de,this.router=_i,this.dateSelected=new Ce,this.bookingForm=this.fb.group({vehicle_id:this.nfb.control(null,[q.required]),booking_type:this.nfb.control(null,[q.required]),comparison:this.fb.control(!1,[q.required]),compare_to_vehicle_id:this.fb.control({value:null,disabled:!0},[q.required])}),this.comparisonSeriesDropdown=new ge(null,[]),this.comparisonSeriesLoading=!1,this.comparisonSeriesError=!1,this.comparisonVehicleListLoading=!1,this.comparisonVehicleListError=!1,this.vehicleSlotsLoading=!1,this.VehicleIconTypeEnum=gi,this.VehicleBrandEnum=fi,this.BookingTypeEnum=C,this.BookingQuestionResponseTypeEnum=bi,this.vehicleAvailabilities=new B(void 0),this.dateSelectorShown=!1,this.unavailableDates=void 0,this.selectedVehicleBookingQuestionsForm=new ue({}),this.selectedVehicleBookingQuestions={},this.addingToCart=!1,this.subscriptionsToCloseOnDestroy=[]}static{this.\u0275fac=function(t){return new(t||i)(g(Q),g(oe),g(ne),g(X),g(Re),g(re),g(oi),g(ni),g(M),g(j))}}static{this.\u0275cmp=K({type:i,selectors:[["app-vehicle-details"]],inputs:{date:"date",vehicle:"vehicle",vehicleBrandFilter:"vehicleBrandFilter",availableSeries:"availableSeries"},outputs:{dateSelected:"dateSelected"},features:[Se],decls:1,vars:1,consts:[["comparisonSeries",""],["comparisonVehicle",""],["comparisonSeriesField",""],["comparisonVehicleField",""],["class","vehicles-details-item",3,"id",4,"ngIf"],[1,"vehicles-details-item",3,"id"],["type","button",1,"bg-transparent","border-0","float-end",3,"click"],[1,"d-inline-block","bmw-icon","bmwi-close","fs-2"],[1,"detail-image"],[3,"src","alt"],[1,"detail-content"],[1,"information"],[1,"information-inner"],[1,"model-icons","mb-3"],["class","d-inline-block","src","/assets/images/bmw_i_logo.png","alt","BMW i",4,"ngIf"],["class","d-inline-block","src","/assets/images/bmw_m_logo.png","alt","BMW M",4,"ngIf"],[1,"fs-4","fw-light","mb-3"],[1,"fs-4","fw-light"],[1,"on-site-booking"],[1,"on-site-booking-inner"],[1,"text-center","d-none","d-md-block","pb-2"],[1,"bmw-icon","fs-1"],[1,"d-xl-flex"],[1,"mx-xl-auto"],["type","button",1,"btn","px-5","py-2","btn-outline-primary","fw-normal","w-100","fs-5",3,"click","disabled"],[4,"ngIf"],[1,"online-booking"],[1,"online-booking-inner"],[1,"bmw-icon","bmwi-360-camera","fs-1"],[1,"mx-0","mx-xl-auto"],["class","detail-individual-info p-3 p-md-4 px-xl-5",4,"ngIf"],["class","detail-comparison p-3 p-md-4 px-xl-5",4,"ngIf"],[1,"clearfix","py-3"],["type","button","class","btn btn-lg btn-primary float-md-end",3,"disabled","click",4,"ngIf"],["class","detail-slots",4,"ngIf"],["class","detail-slots-loading",4,"ngIf"],["src","/assets/images/bmw_i_logo.png","alt","BMW i",1,"d-inline-block"],["src","/assets/images/bmw_m_logo.png","alt","BMW M",1,"d-inline-block"],[1,"form-check","mt-3"],["type","checkbox",1,"form-check-input",3,"change","id","disabled","checked"],[1,"form-check-label",3,"for"],["type","checkbox",1,"form-check-input",3,"formControl","id"],["type","checkbox",1,"form-check-input",3,"click","id","disabled","checked"],[1,"detail-individual-info","p-3","p-md-4","px-xl-5"],[1,"row"],[1,"col-12","col-xl-6"],[1,"mb-2"],[1,"mb-4"],[1,"mb-0"],[1,"d-none","d-xl-block","col-xl-6"],["src","/assets/images/vehicle_individual_thumbnail.png","alt","BMW Cars",1,"w-100","img-fluid"],[1,"detail-comparison","p-3","p-md-4","px-xl-5"],[1,"col-12","col-md-5"],[1,"mb-2","mb-lg-1"],[1,"row","align-items-center"],[1,"py-2"],["class","fa fa-spinner fa-spin fa-2x text-muted",4,"ngIf","ngIfElse"],[1,"d-none","d-md-block","col-2","text-center","compare-icon"],[1,"bmw-icon","bmwi-car-compare"],[1,"d-none","d-md-block","col-5"],[1,"w-100","img-fluid","compare-image",3,"src","alt"],[1,"fa","fa-spinner","fa-spin","fa-2x","text-muted"],["class","text-danger small",4,"ngIf","ngIfElse"],[1,"text-danger","small"],["class","text-muted small",4,"ngIf"],[3,"formControl","placeholder","multiselect","name","selectOptions",4,"ngIf"],[1,"text-muted","small"],[3,"formControl","placeholder","multiselect","name","selectOptions"],[3,"formControl","placeholder","multiselect","name","selectOptions","selectOptionValueKey",4,"ngIf"],[3,"formControl","placeholder","multiselect","name","selectOptions","selectOptionValueKey"],["type","button",1,"btn","btn-lg","btn-primary","float-md-end",3,"click","disabled"],[1,"detail-slots"],[1,"col-12","border","border-custom-grey","p-4","mb-4"],[1,"col-12","col-md-6","border-md-end","border-1","border-custom-grey","d-md-block"],["class","h3 text-dark",4,"ngIf"],["class","py-4",4,"ngIf"],["class","shop-article-slots-list",4,"ngIf"],[1,""],[1,"mb-3"],["class","mb-0",4,"ngIf"],[1,"btn","btn-full","btn-outline-secondary","w-100","btn-lg","d-md-none","mt-3",3,"click"],[1,"col-12","col-md-6","d-md-block"],[3,"dateSelected","monthChanged","date","disabledDates"],[1,"col-12"],[4,"ngFor","ngForOf"],["class","col-12 offset-lg-8 col-lg-4 pb-3",4,"ngIf"],[1,"col-12","text-end"],["type","button",1,"btn","btn-lg","btn-primary",3,"click","disabled"],[1,"h3","text-dark"],[1,"py-4"],[1,"fa","fa-spinner","fa-spin","text-muted","fa-2x"],[1,"shop-article-slots-list"],["class","shop-article-slot",3,"selected","click",4,"ngFor","ngForOf"],[1,"shop-article-slot",3,"click"],[1,"fa-regular","fa-calendar-days"],[1,"fa-regular","fa-clock"],["class","col-12 offset-lg-8 col-lg-4",4,"ngIf"],[1,"col-12","offset-lg-8","col-lg-4"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],["class","form-check",3,"mb-1",4,"ngFor","ngForOf"],["class","text-danger small",4,"ngIf"],[1,"form-check"],["type","radio",1,"form-check-input",3,"id","name","formControl","value"],[3,"formControl","label","placeholder","multiselect","name","selectOptions",4,"ngIf"],[3,"formControl","label","placeholder","multiselect","name","selectOptions"],["type","text",3,"label","labelClass","name","required","control",4,"ngSwitchDefault"],["type","text",3,"label","labelClass","name","required","control"],[1,"col-12","offset-lg-8","col-lg-4","pb-3"],[1,"mb-0","small","text-muted","text-end"],[1,"detail-slots-loading"],[1,"col-12","text-center"]],template:function(t,n){t&1&&_(0,at,46,49,"div",4),t&2&&p("ngIf",n.vehicle)},dependencies:[ie,Y,Z,Ae,Ne,Le,J,ee,ti,ii,ei,Xe,Ge,Ze,Ye,Je,ze,le,He,We,$e],encapsulation:2,changeDetection:0})}}return i})();var pi=(()=>{class i{constructor(e){this.el=e,this.spyElements=[],this.scrollOffset=0,this.activeIndex=-1}onScroll(){let e=window.scrollY+this.scrollOffset;for(let t=0;t<this.spyElements.length;
2t++){let n=this.spyElements[t],l=document.getElementById(n);if(l){let y=l.offsetTop,U=y+l.offsetHeight;if(e>=y&&e<U){this.activeIndex!==t&&(this.activeIndex=t,this.updateActiveClass());break}}}}updateActiveClass(){this.el.nativeElement.querySelectorAll("a.series-nav").forEach(n=>{n.classList.remove("active")}),this.el.nativeElement.querySelectorAll(`a.series-nav[href="#${this.spyElements[this.activeIndex]}"]`).forEach(n=>{n.classList.add("active")})}static{this.\u0275fac=function(t){return new(t||i)(g(Ve))}}static{this.\u0275dir=Te({type:i,selectors:[["","appScrollSpy",""]],hostBindings:function(t,n){t&1&&f("scroll",function(y){return n.onScroll(y)},!1,Ee)},inputs:{spyElements:"spyElements",scrollOffset:"scrollOffset"}})}}return i})();var di=(()=>{class i{transform(e){return Object.entries(e).map(([t])=>t)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275pipe=Be({name:"transformObjectToKeyArrayPipe",type:i,pure:!0})}}return i})();var mi=F.App.Enums.VehicleConsultations.VehicleBrandEnum,rt=F.App.Enums.VehicleConsultations.VehicleIconTypeEnum,st=F.App.Enums.VehicleConsultations.VehicleSeriesEnum,P=F.App.Enums.VehicleConsultations.VehicleFilterEnum,se=F.App.Enums.VehicleConsultations.VehicleC
2onstructionTypeEnum,ct=["mobileSeriesTemplate"];function pt(i,c){if(i&1){let e=I();a(0,"button",13),s(1,"async"),f("click",function(){let n=b(e).$implicit,l=m(2);return x(l.toggleFilter(n))}),v(2,"i",14),a(3,"span",15),h(4),s(5,"translate"),r()()}if(i&2){let e,t=c.$implicit,n=m(2);V("selected",(e=d(1,3,n.selectedFilters))==null?null:e.includes(t)),o(4),S(d(5,5,"pages.vehicles.filter.options."+t))}}function dt(i,c){if(i&1&&(a(0,"div",7)(1,"div",8)(2,"h1",9),h(3),s(4,"translate"),r()(),a(5,"div",8)(6,"h2",10),h(7),s(8,"translate"),r(),a(9,"div",11),_(10,pt,6,7,"button",12),s(11,"async"),r()()()),i&2){let e=m();o(3),S(d(4,3,"pages.vehicles.headline")),o(4),u(" ",d(8,5,"pages.vehicles.filter.headline")," "),o(3),p("ngForOf",d(11,7,e.availableFilters))}}function mt(i,c){if(i&1){let e=I();E(0),a(1,"a",22),f("click",function(n){let l=b(e).$implicit,y=m(2);return x(y.scrollTo(l.key,n))}),h(2),s(3,"translate"),r(),T()}if(i&2){let e=c.$implicit,t=c.first;o(),V("active",t),k("href","#",e.key,"",N),o(),u(" ",d(3,5,"enums.vehicle.series."+e.key)," ")}}function _t(i,c){if(i&1){let e=I();E(0),a(1,"a",22),f("click",function(n){let l=b(e).$implicit,y=m(4);return x(y.scrollTo(l.key,n))}),h(2),s(3,"translate"),r(),T()}if(i&2){let e=c.$implicit;o(),k("href","#",e.key,"",N),o(),u(" ",d(3,3,"enums.vehicle.series."+e.key)," ")}}function ht(i,c){if(i&1&&(a(0,"div",27),_(1,_t,4,5,"ng-container",18),s(2,"async"),s(3,"transformObjectToKeyValueArray"),r()),i&2){let e=m(3);o(),p("ngForOf",d(3,3,d(2,1,e.groupedVehiclesBySeries)))}}function vt(i,c){if(i&1){let e=I();a(0,"div",23)(1,"button",24),f("click",function(){b(e);let n=m(2);return x(n.mobileSeriesModalRef==null?null:n.mobileSeriesModalRef.hide())}),v(2,"i",25),r()(),_(3,ht,4,5,"div",26),s(4,"async")}if(i&2){let e=m(2);o(3),p("ngIf",d(4,1,e.groupedVehiclesBySeries))}}function ut(i,c){if(i&1){let e=I();E(0),a(1,"a",22),f("click",function(n){let l=b(e).$implicit,y=m(2);return x(y.scrollTo(l.key,n))}),h(2),s(3,"translate"),r(),T()}if(i&2){let e=c.$implicit;o(),k("href","#",e.key,"",N),o(),u(" ",d(3,3,"enums.vehicle.series."+e.key)," ")}}function gt(i,c){if(i&1){let e=I();a(0,"div",16),s(1,"async"),s(2,"transformObjectToKeyArrayPipe"),a(3,"div",17),_(4,mt,4,7,"ng-container",18),s(5,"async"),s(6,"transformObjectToKeyValueArray"),a(7,"button",19),f("click",function(){b(e);let n=m();return x(n.openMobileSeriesModal())}),v(8,"i",20),r(),_(9,vt,5,3,"ng-template",null,0,L),r(),a(11,"div",21),_(12,ut,4,5,"ng-container",18),s(13,"async"),s(14,"transformObjectToKeyValueArray"),r()()}if(i&2){let e=m();p("spyElements",d(2,6,d(1,4,e.groupedVehiclesBySeries)))("scrollOffset",100),o(4),p("ngForOf",d(6,10,d(5,8,e.groupedVehiclesBySeries))),o(8),p("ngForOf",d(14,14,d(13,12,e.groupedVehiclesBySeries)))}}function ft(i,c){i&1&&v(0,"div",28)}function bt(i,c){i&1&&v(0,"img",49)}function xt(i,c){i&1&&v(0,"img",50)}function yt(i,c){i&1&&v(0,"i",51)}function kt(i,c){i&1&&v(0,"img",52)}function It(i,c){i&1&&v(0,"i",53)}function St(i,c){if(i&1){let e=I();a(0,"div",38),f("click",function(){let n=b(e).$implicit,l=m(5);return x(l.selectVehicle(n.id))}),a(1,"div",39),v(2,"img",40),a(3,"div",41),_(4,bt,1,0,"img",42)(5,xt,1,0,"img",43),r(),a(6,"div",44),_(7,yt,1,0,"i",45),s(8,"async"),_(9,kt,1,0,"img",46),s(10,"async"),_(11,It,1,0,"i",47),r()(),a(12,"h6"),h(13),r(),a(14,"p",48),h(15),s(16,"translate"),r()()}if(i&2){let e=c.$implicit,t=m(5);o(2),A("src",e.thumbnail!=null&&e.thumbnail.url?e.thumbnail==null?null:e.thumbnail.url:"/assets/images/overview_default.webp",N),A("alt",e.model_title),o(2),p("ngIf",e.icons.includes(t.VehicleIconTypeEnum.I_ICON)),o(),p("ngIf",e.icons.includes(t.VehicleIconTypeEnum.M_ICON)),o(2),p("ngIf",d(8,9,t.vehicleBrandFilter)===t.VehicleBrandEnum.BMW&&e.icons.includes(t.VehicleIconTypeEnum.ALL_ELECTRIC_ICON)),o(2),p("ngIf",d(10,11,t.vehicleBrandFilter)===t.VehicleBrandEnum.MINI&&e.icons.includes(t.VehicleIconTypeEnum.ALL_ELECTRIC_ICON)),o(2),p("ngIf",e.icons.includes(t.VehicleIconTypeEnum.PLUG_IN_HYBRID_ICON)),o(2),S(e.model_title),o(2),S(d(16,13,"enums.vehicle.fuel_type."+e.fuel_type))}}function Ct(i,c){if(i&1&&(a(0,"div",36),_(1,St,17,15,"div",37),r()),i&2){let e=m().$implicit;o(),p("ngForOf",e.value)}}function Vt(i,c){if(i&1){let e=I();a(0,"app-vehicle-details",56),f("dateSelected",function(n){b(e);let l=m(6);return x(l.dateSelected(n))}),r()}if(i&2){let e=m().$implicit,t=m(5);p("date",t.date)("vehicle",e)("vehicleBrandFilter",t.vehicleBrandFilter)("availableSeries",t.availableVehicleSeries)}}function Et(i,c){if(i&1&&(E(0),_(1,Vt,1,4,"app-vehicle-details",55),s(2,"async"),T()),i&2){let e=c.$implicit,t=m(5);o(),p("ngIf",d(2,1,t.selectedVehicleId)===e.id)}}function Tt(i,c){if(i&1&&(a(0,"div",54),_(1,Et,3,3,"ng-container",18),r()),i&2){let e=m().$implicit;o(),p("ngForOf",e.value)}}function Bt(i,c){i&1&&v(0,"hr")}function Ft(i,c){if(i&1&&(E(0),a(1,"div",31)(2,"h3",32),h(3),s(4,"translate"),r(),_(5,Ct,2,1,"div",33)(6,Tt,2,1,"div",34)(7,Bt,1,0,"hr",35),r(),T(
2)),i&2){let e=c.$implicit,t=c.last;o(),V("pb-5",t)("last-series",t),A("id",e.key),o(2),S(d(4,9,"enums.vehicle.series."+e.key)),o(2),p("ngIf",e.value.length>0),o(),p("ngIf",e.value.length>0),o(),p("ngIf",!t)}}function wt(i,c){if(i&1&&(a(0,"div",30)(1,"div",7),_(2,Ft,8,11,"ng-container",18),s(3,"async"),s(4,"transformObjectToKeyValueArray"),r()()),i&2){let e=m(2);o(2),p("ngForOf",d(4,3,d(3,1,e.groupedVehiclesBySeries)))}}function Dt(i,c){if(i&1&&(a(0,"div",7),_(1,wt,5,5,"div",29),s(2,"async"),r()),i&2){let e=m();o(),p("ngIf",d(2,1,e.groupedVehiclesBySeries))}}var kn=(()=>{class i{ngOnInit(){this.cartHeaderService.nextStepButtonEnabled.next(!0),this.subscriptionsToCloseOnDestroy=[H([this.availableFilters,this.groupedVehiclesBySeries,this.selectedVehicleId,this.vehicles,this.date]).subscribe({next:()=>{this.cdr.detectChanges()}}),H([this.vehicleBrandFilter,this.localeService.localeChanged,this.selectedFilters]).pipe(O((e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]),$(([e])=>e!==void 0),xe(([e])=>e),ke(e=>(this.vehicles.next([]),this.vehiclesLoading.next(!0),this.cdr.markForCheck(),this.vehicleService.index({brand:e,filter:this.selectedFilters.value})))).subscribe({next:e=>{e.data.findIndex(t=>t?.id===this.selectedVehicleId.value)>=0?setTimeout(()=>{let t=document.getElementById("vehicle-details-"+this.selectedVehicleId.value);if(t){let n=t.getBoundingClientRect().top+window.scrollY-70;window.scrollTo({top:n,behavior:"smooth"})}},100):this.selectVehicle(void 0),this.sortVehicleFilters(e.available_filters),this.vehicles.next(e.data),this.availableVehicleSeries.next(e.available_series),this.groupVehiclesIntoSeries(e),this.vehiclesLoading.next(!1)}}),this.activatedRoute.queryParams.subscribe(e=>{this.cdr.detectChanges();let t=ve(e);if(this.vehicleBrandFilter.getValue()===void 0){this.redirectToHome();return}this.vehicleBrandFilter.next(t);let n=Ke(e)??new Date;if(!qe(n)){this.redirectToDateSelection();return}this.date.next(n),this.selectedVehicleId.next(e.vehicle)}),this.selectedVehicleId.pipe(O()).subscribe({next:e=>{if(e===void 0)this.selectVehicle(void 0);else{let t=this.vehicles.value?.findIndex(n=>n?.id===e);t!==void 0&&t>=0&&this.vehicles.value&&(this.selectedVehicleId.next(this.vehicles.value[t].id),setTimeout(()=>{let n=document.getElementById("vehicle-details-"+e);if(n){let l=n.getBoundingClientRect().top+window.scrollY-70;window.scrollTo({top:l,behavior:"smooth"})}},100))}}})],this.changeQueryParams(D(w({},this.activatedRoute.snapshot.queryParams),{brand:this.vehicleBrandFilter.value}))}ngOnDestroy(){this.cartHeaderService.nextStepButtonEnabled.next(!1),this.subscriptionsToCloseOnDestroy.forEach(e=>e?.unsubscribe())}toggleFilter(e){let t=this.selectedFilters.value.indexOf(e),n=[...this.selectedFilters.value];t<0?n.push(e):n.splice(t,1),this.selectedFilters.next(n)}scrollTo(e,t){t.preventDefault();let n=document.getElementById(e);if(n){this.mobileSeriesModalRef?.hide();let l=n.getBoundingClientRect().top+window.scrollY-70;window.scrollTo({top:l,behavior:"smooth"})}}openMobileSeriesModal(){this.mobileSeriesTemplateRef&&(this.mobileSeriesModalRef=this.bsModalService.show(this.mobileSeriesTemplateRef,{id:1,class:"modal-fullscreen"}))}selectVehicle(e){let t;e?t={vehicle:e}:t={vehicle:void 0},this.router.navigate([this.localeService.localizedPath("/vehicle-consultation/vehicles")],{queryParams:t,queryParamsHandling:"merge"}).then()}dateSelected(e){e&&this.changeQueryParams({date:te(e,"yyyy-MM-dd'T'HH:mm:ssxxx")})}changeQueryParams(e){this.router.navigate([this.localeService.localizedPath("/vehicle-consultation/vehicles")],{queryParams:e,queryParamsHandling:"merge",skipLocationChange:!1,replaceUrl:!0}).then()}redirectToHome(){this.router.navigateByUrl(this.localeService.localizedPath("/vehicle-consultation")).then()}redirectToDateSelection(){let e=ve(this.activatedRoute.snapshot.queryParams);e?this.router.navigate([this.localeService.localizedPath("/vehicle-consultation/date")],{queryParams:{type:e}}).then():this.redirectToHome()}sortVehicleFilters(e){let t=[P.ON_SITE_AVAILABLE,P.BMW_M,P.BMW_I,P.BMW_CABRIO,P.BMW_COUPE,se.BMW_GRAN_COUPE,P.BMW_LIMOUSINE,P.BMW_TOURING,se.MINI_ELECTRIC,se.MINI_PETROL,se.MINI_JOHN_COOPER_WORKS],n=[];t.forEach(l=>{e.includes(l)&&n.push(l)}),this.availableFilters.next(n)}groupVehiclesIntoSeries(e){let t={},n={};e.data.forEach(l=>{t[l.series]?t[l.series].push(l):t[l.series]=[l]}),Object.values(st).forEach(l=>{l in t&&(n[l]=t[l])}),this.groupedVehiclesBySeries.next(n)}constructor(e,t,n,l,y,U,ce,pe,de){this.activatedRoute=e,this.cdr=t,this.router=n,this.localeService=l,this.vehicleService=y,this.bsModalService=U,this.fb=ce,this.nfb=pe,this.cartHeaderService=de,this.vehicleBrandFilter=new B(mi.BMW),this.date=new B(void 0),this.subscriptionsToCloseOnDestroy=[],this.vehiclesLoading=new B(!0),this.vehicles=new B(void 0),this.availableVehicleSeries=new B(void 0),this.groupedVehiclesBySeries=new B(void 0),this.availableFilters=new B(void 0),this.selectedFilters=new B([]),this.VehicleIconTypeEnum=rt,this.selectedVehicleId=new B(void 0),this.VehicleBrandEnum=mi}static{this.\u0275fac=function(t){return new(t||i)(g(M),g(X),g(j),g(Q),g(re),g(li),g(oe),g(ne),g(Qe))}}static{this.\u0275cmp=K({type:i,selectors:[["app-vehicles-page"]],viewQuery:function(t,n){if(t&1&&Fe(ct,5),t&2){let l;we(l=De())&&(n.mobileSeriesTemplateRef=l.first)}},decls:12,vars:14,consts:[["mobileSeriesTemplate",""],[1,"container","pt-3","pt-md-5"],["class","row",4,"ngIf"],[1,"container-fluid","series-container","px-0","px-sm-2"],["class","series-container-inner","a
2ppScrollSpy","",3,"spyElements","scrollOffset",4,"ngIf"],["class","series-loader",4,"ngIf"],[1,"container","pt-5","pb-3","pb-md-5"],[1,"row"],[1,"col-12","pb-3","pb-md-5"],[1,"text-uppercase"],[1,"h3","text-uppercase","mb-3"],[1,"d-flex","flex-wrap"],["class","filter-option py-2 px-3 me-3",3,"selected","click",4,"ngFor","ngForOf"],[1,"filter-option","py-2","px-3","me-3",3,"click"],[1,"d-inline-block","bmw-icon","bmwi-close"],[1,"ps-2","m-0"],["appScrollSpy","",1,"series-container-inner",3,"spyElements","scrollOffset"],[1,"d-sm-none","mobile-series-header","position-relative"],[4,"ngFor","ngForOf"],["type","button",1,"bg-transparent","border-0","p-2","position-absolute","position-absolute","top-50","end-0","translate-middle",3,"click"],[1,"fa-solid","fa-chevron-down"],[1,"d-none","d-sm-flex","flex-wrap","container","px-0","px-sm-2"],[1,"series-nav",3,"click","href"],[1,"modal-header"],["type","button",1,"ms-auto","px-2","py-0","bg-transparent","border-0",3,"click"],[1,"fa-solid","fa-chevron-up"],["class","modal-body px-0",4,"ngIf"],[1,"modal-body","px-0"],[1,"series-loader"],["class","col-12",4,"ngIf"],[1,"col-12"],[1,"col-12",3,"id"],[1,"h4"],["class","vehicles-grid",4,"ngIf"],["class","vehicles-details",4,"ngIf"],[4,"ngIf"],[1,"vehicles-grid"],["class","vehicles-item",3,"click",4,"ngFor","ngForOf"],[1,"vehicles-item",3,"click"],[1,"vehicle-item-images"],[1,"thumbnail","w-100","h-auto",3,"src","alt"],[1,"model-icons"],["class","i-icon","src","/assets/images/bmw_i_logo.png","alt","BMW i",4,"ngIf"],["class","m-icon","src","/assets/images/bmw_m_logo.png","alt","BMW M",4,"ngIf"],[1,"thumbnail-icons"],["class","bmw-icon bmwi-fuel-type-bev",4,"ngIf"],["src","/assets/images/mini_electric_logo.svg","class","mini-electric-icon","alt","MINI Electric Icon",4,"ngIf"],["class","bmw-icon bmwi-fuel-type-phev",4,"ngIf"],[1,"small","text-muted","fw-bold","text-uppercase"],["src","/assets/images/bmw_i_logo.png","alt","BMW i",1,"i-icon"],["src","/assets/images/bmw_m_logo.png","alt","BMW M",1,"m-icon"],[1,"bmw-icon","bmwi-fuel-type-bev"],["src","/assets/images/mini_electric_logo.svg","alt","MINI Electric Icon",1,"mini-electric-icon"],[1,"bmw-icon","bmwi-fuel-type-phev"],[1,"vehicles-details"],[3,"date","vehicle","vehicleBrandFilter","availableSeries","dateSelected",4,"ngIf"],[3,"dateSelected","date","vehicle","vehicleBrandFilter","availableSeries"]],template:function(t,n){t&1&&(a(0,"div",1),_(1,dt,12,9,"div",2),s(2,"async"),r(),a(3,"div",3),_(4,gt,15,16,"div",4),s(5,"async"),s(6,"async"),_(7,ft,1,0,"div",5),s(8,"async"),r(),a(9,"div",6),_(10,Dt,3,3,"div",2),s(11,"async"),r()),t&2&&(o(),p("ngIf",d(2,4,n.vehiclesLoading)===!1||n.groupedVehiclesBySeries.getValue()),o(3),p("ngIf",(d(5,6,n.vehiclesLoading)===!1||n.groupedVehiclesBySeries.getValue())&&d(6,8,n.groupedVehiclesBySeries)),o(3),p("ngIf",d(8,10,n.vehiclesLoading)),o(3),p("ngIf",d(11,12,n.vehiclesLoading)===!1||n.groupedVehiclesBySeries.getValue()))},dependencies:[ie,Y,Z,J,ee,le,di,ci,pi],encapsulation:2,changeDetection:0})}}return i})();export{kn as VehiclesPageComponent};
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.