-
Notifications
You must be signed in to change notification settings - Fork 0
/
663.e54b0dd5a18621f4.js
1 lines (1 loc) · 8.75 KB
/
663.e54b0dd5a18621f4.js
1
"use strict";(self.webpackChunkmanniwatch=self.webpackChunkmanniwatch||[]).push([[663],{5663:(st,h,i)=>{i.r(h),i.d(h,{TripPassagesModule:()=>tt});var c=i(9462),d=i(3141),u=i(764),M=i(7980),C=i(8312),l=i(4918),t=i(2093),E=i(6949),L=i(1625),N=i(4991),b=i(6333),y=i(6966),P=i(5473),f=i(8412),D=i(2809),x=i(4104),O=i(2835),F=i(3581),T=i(9627),G=i(488),p=function(e){return e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e[e.ERROR=3]="ERROR",e[e.PAUSED=4]="PAUSED",e[e.UNKNOWN=5]="UNKNOWN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.SERVER_ERROR=500]="SERVER_ERROR",e}(p||{});class m{static convertResponse(o){return(0,f.U)(s=>({failures:0,status:p.LOADED,timestamp:Date.now(),tripId:s.tripId,tripInfo:s}))}static handleError(o){return(0,G.K)(s=>(0,T.of)(s&&s.status?{failures:1,passages:void 0,status:s.status>=500&&s.status<600?p.SERVER_ERROR:s.status,timestamp:Date.now(),tripId:o}:{failures:1,passages:void 0,status:p.ERROR,timestamp:Date.now(),tripId:o}))}}var g=i(3769);let v=(()=>{class e{route;apiService;vehicleService;appRef;statusObservable;statusSubject;constructor(s,a,n,r){this.route=s,this.apiService=a,this.vehicleService=n,this.appRef=r,this.statusSubject=new L.X(s.snapshot.data.tripPassages),this.statusObservable=this.createStatusObservable(this.statusSubject)}createStatusObservable(s){const a=this.createRefreshPollObservable(s);return this.appRef.isStable.pipe((0,y.P)(),(0,P.z)(()=>(0,N.T)(this.route.data.pipe((0,f.U)(n=>n.tripPassages)),a).pipe((0,D.R)((n,r,et)=>{if(r.failures>0){const R=Object.assign({},r);return R.failures=r.failures+n.failures,R}return r}),(0,x.b)(n=>s.next(n)))))}createRefreshPollObservable(s){return s.pipe((0,O.w)(a=>this.createDelayedPassageRequest(a.tripId,a.status===p.LOADED?1e4:2e4)))}createDelayedPassageRequest(s,a){return(0,b.H)(a).pipe((0,F.q)(1),(0,P.z)(()=>this.apiService.getTripPassages(s)),m.convertResponse(s),m.handleError(s))}createStopLocationObservable(){return this.route.data.pipe((0,f.U)(s=>s.tripPassages),(0,O.w)(s=>this.vehicleService.getVehicleByTripId(s.tripId)))}static \u0275fac=function(a){return new(a||e)(t.LFG(l.gz),t.LFG(g.sM),t.LFG(g.fi),t.LFG(t.z2F))};static \u0275prov=t.Yz7({token:e,factory:e.\u0275fac})}return e})();var Z=i(243),z=i(8639),S=i(7038),B=i(3225),U=i(9938),Q=i(9258),$=i(4701);const j=e=>["/stop",e];let J=(()=>{class e{passage;get departed(){return!!this.passage&&this.passage.status===S.F.DEPARTED}get stopping(){return!!this.passage&&this.passage.status===S.F.STOPPING}get passageTime(){if(this.passage){const s=this.passage.actualTime||this.passage.plannedTime;if(s){const a=(0,B.Qc)(s,"HH:mm",new Date),n=(0,U.X)(a,new Date);return Math.abs(n)<15?(0,Q.Q)(a,{addSuffix:!0}):(0,$.WU)(a,"p")}}return"No departure time"}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=t.Xpm({type:e,selectors:[["app-trip-passages-list-item"]],hostVars:4,hostBindings:function(a,n){2&a&&t.ekj("departed",n.departed)("stopping",n.stopping)},inputs:{passage:"passage"},decls:9,vars:6,consts:()=>{let s,a;return s=$localize`:@@busStopIcon␟c5b9c1505998539fbe7799f39d5599f65afb24cb␟2554385076132608454:Bus stop icon`,a=$localize`:@@stopName␟cda036c397ca09cd2a0a308899f03908182f5e6b␟6695271591602705899:Stop name`,[["mat-list-item","","role","listitem",3,"routerLink"],["matListIcon","","role","figure","aria-label",s],["matLine","","aria-label",a,1,"title"],["matLine","",1,"subtitle"],["role","timer"],["role","status",1,"demo-2"]]},template:function(a,n){1&a&&(t.TgZ(0,"a",0),t._UZ(1,"mat-icon",1),t.TgZ(2,"h4",2),t._uU(3),t.qZA(),t.TgZ(4,"p",3)(5,"span",4),t._uU(6),t.TgZ(7,"span",5),t._uU(8),t.qZA()()()()),2&a&&(t.Q6J("routerLink",t.VKq(4,j,null==n.passage||null==n.passage.stop?null:n.passage.stop.shortName)),t.xp6(3),t.Oqu(null==n.passage||null==n.passage.stop?null:n.passage.stop.name),t.xp6(3),t.hij(" ",n.passageTime,""),t.xp6(2),t.hij("\xa0-- ",null==n.passage?null:n.passage.status,""))},dependencies:[d.Hw,u.Tg,l.rH],styles:['mat-icon[matListIcon][_ngcontent-%COMP%]:after{content:"directions_bus"}.departed[_nghost-%COMP%] a[_ngcontent-%COMP%], .departed [_nghost-%COMP%] a[_ngcontent-%COMP%]{opacity:.75!important;background-color:#0000001a}.departed[_nghost-%COMP%] mat-icon[matListIcon][_ngcontent-%COMP%]:after, .departed [_nghost-%COMP%] mat-icon[matListIcon][_ngcontent-%COMP%]:after{content:"transfer_within_a_station"}.stopping[_nghost-%COMP%] a[_ngcontent-%COMP%], .stopping [_nghost-%COMP%] a[_ngcontent-%COMP%]{background-color:#00ff001a}.stopping[_nghost-%COMP%] mat-icon[matListIcon][_ngcontent-%COMP%]:after, .stopping [_nghost-%COMP%] mat-icon[matListIcon][_ngcontent-%COMP%]:after{content:"place"}h4.title[_ngcontent-%COMP%]{font-size:16px!important;font-family:Roboto,sans-serif;font-weight:700!important;opacity:.87}p.subtitle[_ngcontent-%COMP%]{font-size:12px!important;font-family:Roboto,sans-serif;line-height:20px;font-weight:600!important;opacity:.6}'],changeDetection:0})}return e})();function X(e,o){1&e&&t._UZ(0,"app-trip-passages-list-item",4),2&e&&t.Q6J("passage",o.$implicit)}function Y(e,o){if(1&e&&(t.TgZ(0,"mat-nav-list",2),t.YNc(1,X,1,1,"app-trip-passages-list-item",3),t.qZA()),2&e){const s=t.oxw();t.xp6(1),t.Q6J("ngForOf",s.passages)}}function H(e,o){1&e&&(t.TgZ(0,"h3"),t._uU(1,"No Passages"),t.qZA())}let V=(()=>{class e{set tripInfo(s){if(s){const a=[];return s.actual&&a.push(...s.actual),s.old&&s.old.length>0&&a.push(...s.old),a.sort((n,r)=>parseInt(n.stop_seq_num,10)-parseInt(r.stop_seq_num,10)),void(this.passages=a)}this.passages=[]}passages=[];hasPassages(){return Array.isArray(this.passages)&&this.passages.length>0}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=t.Xpm({type:e,selectors:[["app-trip-passages-list"]],inputs:{tripInfo:"tripInfo"},decls:3,vars:2,consts:[["role","list",4,"ngIf","ngIfElse"],["noPassagesBlock",""],["role","list"],[3,"passage",4,"ngFor","ngForOf"],[3,"passage"]],template:function(a,n){if(1&a&&t.YNc(0,Y,2,1,"mat-nav-list",0)(1,H,2,0,"ng-template",null,1,t.W1O),2&a){const r=t.MAs(2);t.Q6J("ngIf",n.hasPassages())("ngIfElse",r)}},dependencies:[c.sg,c.O5,u.Hk,J],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}return e})();function K(e,o){1&e&&(t.TgZ(0,"div",5)(1,"h4"),t._uU(2,"not found"),t.qZA()())}function W(e,o){if(1&e&&(t.ynx(0),t.TgZ(1,"app-header-box",1),t._UZ(2,"map",2),t.qZA(),t.YNc(3,K,3,0,"div",3),t._UZ(4,"app-trip-passages-list",4),t.BQk()),2&e){const s=o.ngIf,a=t.oxw();t.xp6(1),t.hYB("title","",null==s?null:s.tripInfo.routeName," - ",null==s?null:s.tripInfo.directionText,""),t.xp6(1),t.Q6J("mapData",a.headerMapData),t.xp6(1),t.Q6J("ngIf",s.status===a.STATUS_OPS.NOT_FOUND),t.xp6(1),t.Q6J("tripInfo",s.tripInfo)}}let w=(()=>{class e{zone;passageService;subscriptions=[];headerMapData;STATUS_OPS=p;constructor(s,a){this.zone=s,this.passageService=a}ngOnInit(){this.subscriptions.push(this.passageService.createStopLocationObservable().pipe(function A(e){return o=>new E.y(s=>o.subscribe({complete(){s.complete()},error(a){s.error(a)},next(a){t.R0b.isInAngularZone()?s.next(a):e.run(()=>{s.next(a)})}}))}(this.zone)).subscribe({next:s=>{this.headerMapData=s?{map:{center:s},stops:void 0,vehicles:[s]}:{map:{blur:!0,center:void 0}}}}))}ngOnDestroy(){this.subscriptions.forEach(s=>{s.unsubscribe()}),this.subscriptions=[]}static \u0275fac=function(a){return new(a||e)(t.Y36(t.R0b),t.Y36(v))};static \u0275cmp=t.Xpm({type:e,selectors:[["app-trip-passages"]],features:[t._Bn([v])],decls:2,vars:3,consts:[[4,"ngIf"],[3,"title"],["appOlStatic","",3,"mapData"],["class","not-found",4,"ngIf"],[3,"tripInfo"],[1,"not-found"]],template:function(a,n){1&a&&(t.YNc(0,W,5,5,"ng-container",0),t.ALo(1,"async")),2&a&&t.Q6J("ngIf",t.lcZ(1,1,n.passageService.statusObservable))},dependencies:[c.O5,Z.c,z.C,V,c.Ov],styles:["h3.route-title[_ngcontent-%COMP%]{padding:24px}div.error-box[_ngcontent-%COMP%]{background:#f44336;padding:16px;flex:0 0 auto}div.error-box[_ngcontent-%COMP%] span.title[_ngcontent-%COMP%]{text-transform:capitalize;font-weight:700;display:block;font-size:16px}div.error-box[_ngcontent-%COMP%] span.text[_ngcontent-%COMP%]{font-size:12px}mat-nav-list[_ngcontent-%COMP%]{flex-grow:1}"]})}return e})();var _=i(6723);let I=(()=>{class e extends _.Z{api;constructor(s,a,n){super(a,n),this.api=s}createLoader(s,a){const n=s.params.tripId;return this.api.getTripPassages(n).pipe(m.convertResponse(n))}static \u0275fac=function(a){return new(a||e)(t.LFG(g.sM),t.LFG(l.F0),t.LFG(g.jn))};static \u0275prov=t.Yz7({token:e,factory:e.\u0275fac})}return e})();const k=[{component:w,data:{openSidebar:!0},path:":tripId",resolve:{tripPassages:I}}];let q=(()=>{class e{static \u0275fac=function(a){return new(a||e)};static \u0275mod=t.oAB({type:e});static \u0275inj=t.cJS({imports:[l.Bz.forChild(k),l.Bz]})}return e})(),tt=(()=>{class e{static \u0275fac=function(a){return new(a||e)};static \u0275mod=t.oAB({type:e});static \u0275inj=t.cJS({providers:[I],imports:[c.ez,d.Ps,u.ie,q,M.D,C.qe]})}return e})()}}]);