1import{a as m,b as V,c as v}from"./chunk-OCPEJOYU.js";import{b as Z}from"./chunk-J3XN2YRB.js";import{a as X}from"./chunk-UNHUUWFF.js";import{d as Q}from"./chunk-N4SAKXVX.js";import{B as Y,G as b,P as G,T as W}from"./chunk-SU7S3GV3.js";import{e as J}from"./chunk-OT5BIL5I.js";import{d as H}from"./chunk-DL3JVWPO.js";import{k as R,l as U}from"./chunk-XERX3YYW.js";import"./chunk-AUTQTPL7.js";import{a as ie}from"./chunk-4Z5MUJO3.js";import{a as z}from"./chunk-A3QLZGQA.js";import"./chunk-LJH5OBMW.js";import{$e as x,Ca as w,D as k,F as h,Fd as M,J as L,L as $,Sf as K,Uf as q,V as a,Z as f,a as O,ca as l,ga as u,gg as B,ka as N,lf as P,ma as T,o as n,pb as A,qa as S,ra as y,u as c,ua as s,v as C,zf as _}from"./chunk-PMSJWPYZ.js";import{a as F,b as D,h as re}from"./chunk-NIF3MU5U.js";var E=(()=>{class r{logger=s(x);http=s(M);occEndpoints=s(P);converter=s(_);activeCartService=s(b);injector=s(w);applyFlightDetails(e,t,o,p,g){let d=this.occEndpoints.buildUrl(`/users/${e}/carts/${t}/applyFlightDetails`,{queryParams:{fields:"DEFAULT",airport:o,flightDirection:p,terminalType:g}});return this.http.post(d,{}).pipe(this.converter.pipeable(W),N(()=>this.activeCartService.reloadActiveCart()))}getShop(e){return this.http.get(this.occEndpoints.buildUrl("/stores/setup",{queryParams:{fields:"DEFAULT",lang:e}})).pipe(U({key:"stores:setup:"+e,injector:this.injector}),R({key:"stores:setup:"+e,ttl:1e3*60*60,injector:this.injector}))}getUsersClosestAirport(e,t){let o=this.occEndpoints.buildUrl("/location/airports",{queryParams:{lat:e,lon:t}});return this.http.get(o).pipe($(p=>{throw K(p,this.logger)}))}getStore(e,t){return this.http.get(this.occEndpoints.buildUrl(`/stores/${e}`,{queryParams:{fields:"FULL",lang:t}})).pipe(U({key:`stores:store:${e}:${t}`,injector:this.injector}),R({key:`stores:store:${e}:${t}`,ttl:1e3*60*60,injector:this.injector}))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=S({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var ee=(()=>{class r{static \u0275fac=function(t){return new(t||r)};static \u0275mod=A({type:r});static \u0275inj=y({providers:[E]})}return r})();var j=(()=>{class r{shopAdapter=s(E);applyFlightDetails(e,t,o,p,g){return this.shopAdapter.applyFlightDetails(e,t,o,p,g)}getShop(e){return this.shopAdapter.getShop(e)}getUsersClosestAirport(e,t){return this.shopAdapter.getUsersClosestAirport(e,t)}getStore(e,t){return this.shopAdapter.getStore(e,t)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=S({token:r,factory:r.\u0275fac})}return r})();var i=re(ie());var te=(()=>{class r{shopConnector=s(j);activeCartFacade=s(b);multiCartFacade=s(Y);warehouseContextService=s(J);userIdService=s(q);cookieService=s(Z);transferStateService=s(X);userService=s(Q);languageService=s(B);storeValuesKeys=["airport","direction","terminal","storeCode"];defaultStoreValues={airport:z.defaultAirport,direction:null,terminal:null,storeCode:null};activeCart$=this.userIdService.getUserId().pipe(u(()=>this.multiCartFacade.getCartIdByType(G.ACTIVE)),h(e=>!(0,i.isNull)(e)),c(e=>e!==""),a(),u(e=>C([this.activeCartFacade.getActive(),this.activeCartFacade.getLoading()]).pipe(h(([,t])=>!t),h(([t])=>!((0,i.isEmpty)(t)&&e)),c(([t])=>t))),a(i.isEqual),l(1));activeCartId$=this.activeCartFacade.getActiveCartId().pipe(a(),l({bufferSize:1,refCount:!0}));fetchedStoreValues$=this.activeCart$.pipe(c(e=>e?.flightDetails),c(e=>Object.entries(e||{}).reduce((t,[o,p])=>Object.assign({},t,{[o]:p.code}),{})),c(e=>(0,i.isEmpty)(e)?null:e),a(i.isEqual));storedStoreValues$=this.cookieService.get$(v).pipe(c(e=>this.parseStoreValues(e)),a(i.isEqual));closestStore$=this.userService.getGeoPosition().pipe(u(({coords:e})=>this.shopConnector.getUsersClosestAirport(e.latitude,e.longitude)),c(({code:e})=>D(F({},this.defaultStoreValues),{airport:e})),f(),l(1),$(()=>n(this.defaultStoreValues)));subscription=new O;cachedStoreValues$=C([this.fetchedStoreValues$,this.storedStoreValues$]).pipe(c(([e,t])=>t||e||this.defaultStoreValues));transferStoreValues$=this.transferStateService.withTransfer$("shopStoreValues",k(n(null),this.cachedStoreValues$)).pipe(h(Boolean),a(i.isEqual),l(1));shop$=this.languageService.getActive().pipe(a(),u(e=>this.shopConnector.getShop(e)),l({bufferSize:1,refCount:!0}));cities$=this.shop$.pipe(c(e=>e.cities));storePreselected$=C([this.fetchedStoreValues$,this.storedStoreValues$]).pipe(c(([e,t])=>!!(t||e)),a(),l(1));storeValues$=this.transferStoreValues$.pipe(h(Boolean),a(i.isEqual),l(1));shops$=this.storeValues$.pipe(u(e=>this.getShops$(e)),a(i.isEqual));validStore$=this.storeValues$.pipe(u(e=>this.isValidStore$(e)),a());activePickupDeadlineTime$=this.shops$.pipe(c(e=>e.direction?.pickupDeadlineTime||"60"),a());shopEditAvailable$=this.activeCart$.pipe(c(e=>!e?.editableOrder?.code),a(),l(1));constructor(){this.subscription.add(this.fetchedStoreValues$.subscribe(e=>this.applyStoreValues(e))),this.subscription.add(this.shops$.pipe(T(this.storeValues$,this.validStore$)).subscribe(([e,t])=>{t&&e.direction?.storeCode&&this.warehouseContextService.setActive(e.direction.storeCode)})),this.subscription.add(this.applyFlightDetails$().subscribe())}ngOnDestroy(){this.subscription.unsubscribe()}isValidStore$(e){return n(Object.entries(e).filter(([t])=>this.storeValuesKeys.includes(t)).every(([t,o])=>
1t==="storeCode"?(0,i.isString)(o)||(0,i.isNull)(o):(0,i.isString)(o)))}getIcons$(e){switch(e){case m.ARRIVAL:return n(["flight_land"]);case m.DEPARTURE:return n(["flight_takeoff"]);case m.DOMESTIC_TRANSFER:return n(["custom_transfer"]);case m.ARRIVAL_AND_DEPARTURE:return n(["custom_transfer"]);case m.ARRIVAL_OUTSIDE_EU_EAA:return n(["flight_land"]);case m.TURKEY_ARRIVAL:return n(["flight_land"]);case V.INTERNATIONAL:return n(["language"]);case V.DOMESTIC:return n(["custom_flag_no"]);case V.HOME_DELIVERY:return n(["local_shipping"]);default:return n([""])}}setActiveAirport(e){this.storeValues$.pipe(f()).subscribe(t=>{t.airport!==e&&this.cacheStoreValues({airport:e,terminal:null,direction:null,storeCode:null})})}setActiveTerminal(e){this.storeValues$.pipe(f()).subscribe(t=>{t.terminal!==e&&this.cacheStoreValues({airport:t.airport,terminal:e,direction:null,storeCode:null})})}setActiveDirection(e){this.storeValues$.pipe(f(),u(t=>this.getShops$(D(F({},t),{direction:e}))),f()).subscribe(t=>{this.cacheStoreValues({airport:t.airport,terminal:t.terminal?.code,direction:t.direction?.code,storeCode:t.direction?.storeCode})})}getShops$(e){return this.cities$.pipe(c(t=>{let o=t.find(d=>d.airportCode===e.airport),p=o?.terminals?.find(d=>d.code===e.terminal),g=p?.directions?.find(d=>d.code===e.direction);return{airport:e.airport,cityName:o?.cityName,cities:t,terminal:p,direction:g}}),a(i.isEqual))}getAllCities$(){return this.cities$}getStoreByCode$(e){return this.languageService.getActive().pipe(a(),u(t=>this.shopConnector.getStore(e,t)),l({bufferSize:1,refCount:!0}))}getStoredStoreValues$(){return this.cookieService.get$(v).pipe(c(e=>this.parseStoreValues(e)))}applyFlightDetails$(){return C([this.storeValues$,this.activeCartId$]).pipe(L(1),T(this.validStore$,this.activeCart$,this.userIdService.getUserId()),h(([[,e],t])=>t&&!!e),h(([[e],,t])=>!t.flightDetails||e.airport!==t.flightDetails.airport.code||e.direction!==t.flightDetails.direction.code||e.terminal!==t.flightDetails.terminal.code),u(([[e,t],,,o])=>this.shopConnector.applyFlightDetails(o,t,e.airport,e.direction,e.terminal)))}parseStoreValues(e){let t=null;try{t=JSON.parse(e)}catch(o){}return this.isTrnStoreValues(t)?t:null}isTrnStoreValues(e){return(0,i.isPlainObject)(e)&&this.storeValuesKeys.every(t=>Object.keys(e).includes(t))&&Object.entries(e).filter(([t])=>this.storeValuesKeys.includes(t)).every(([t,o])=>t==="airport"?(0,i.isString)(o):(0,i.isString)(o)||(0,i.isNull)(o))}cacheStoreValues(e){e?this.cookieService.set(v,JSON.stringify(e)):this.cookieService.delete(v)}applyStoreValues(e){e&&this.getShops$(e).pipe(f()).subscribe(t=>{t&&this.cacheStoreValues({airport:t.airport,terminal:t.terminal?.code,direction:t.direction?.code,storeCode:t.direction?.storeCode})})}static \u0275fac=function(t){return new(t||r)};static \u0275prov=S({token:r,factory:r.\u0275fac})}return r})();var we=(()=>{class r{static \u0275fac=function(t){return new(t||r)};static \u0275mod=A({type:r});static \u0275inj=y({providers:[j,{provide:H,useClass:te}],imports:[ee]})}return r})();export{we as ContextCoreModule};
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.