(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{"99Un":function(t,e,i){"use strict";i.r(e),i.d(e,"HomeModule",function(){return K});var o=i("s7LF"),s=i("SVse"),a=i("iInd"),n=i("mrSG"),r=i("fmbZ"),c=i("8Y7J"),l=i("4sFX"),h=i("2hsb"),u=i("AALx"),d=i("4ZJM"),p=i("hpHm"),b=i("jlze"),g=i("m3Ap"),m=i("9vmj"),v=i("CFJW"),f=i("IheW"),R=i("cUpR"),y=i("hBim"),S=i("GsoD");const _=["addresspicker_map"],k=["collection_lat"],w=["collection_lng"];function x(t,e){if(1&t){const t=c.Tb();c.Sb(0,"button",30),c.ac("click",function(){return c.wc(t),c.dc().scrollToTop([0,0])}),c.Nb(1,"i",31),c.Dc(2,"TO TOP "),c.Rb()}}function M(t,e){1&t&&(c.Sb(0,"div",32),c.Sb(1,"div",33),c.Sb(2,"button",34),c.Nb(3,"i",35),c.Dc(4,"Back "),c.Rb(),c.Rb(),c.Rb())}function T(t,e){if(1&t&&(c.Sb(0,"div",36),c.Sb(1,"a",39),c.Nb(2,"i",40),c.Dc(3),c.Rb(),c.Rb()),2&t){const t=c.dc(2);c.zb(1),c.lc("href","tel://",t.trackingPhone,"",c.yc),c.zb(2),c.Fc(" ",t.trackingPhone," ")}}function P(t,e){if(1&t&&(c.Sb(0,"div",41),c.Sb(1,"a",39),c.Nb(2,"i",42),c.Dc(3),c.Rb(),c.Rb()),2&t){const t=c.dc(2);c.zb(1),c.lc("href","mailto://",t.trackingEmail,"",c.yc),c.zb(2),c.Fc(" ",t.trackingEmail," ")}}function C(t,e){if(1&t&&(c.Sb(0,"div",19),c.Sb(1,"div",20),c.Sb(2,"h2",36),c.Sb(3,"strong"),c.Dc(4,"Contact Us"),c.Rb(),c.Rb(),c.Bc(5,T,4,2,"div",37),c.Bc(6,P,4,2,"div",38),c.Rb(),c.Rb()),2&t){const t=c.dc();c.zb(5),c.jc("ngIf",""!=t.trackingPhone),c.zb(1),c.jc("ngIf",""!=t.trackingEmail)}}function L(t,e){if(1&t&&(c.Sb(0,"span",55),c.Dc(1),c.Rb()),2&t){const t=c.dc(2);c.zb(1),c.Ec(t.util.stripslashes(t.setting.setting.account_detail[0].name))}}function j(t,e){if(1&t){const t=c.Tb();c.Sb(0,"button",56),c.ac("click",function(){return c.wc(t),c.dc(2).selectperiod("AM")}),c.Dc(1,"AM ROUTES "),c.Rb()}if(2&t){const t=c.dc(2);c.Eb("btn-primary","AM"==t.period)("btn-ghost-secondary","PM"==t.period)}}function O(t,e){if(1&t){const t=c.Tb();c.Sb(0,"button",57),c.ac("click",function(){return c.wc(t),c.dc(2).selectperiod("PM")}),c.Dc(1,"PM ROUTES "),c.Rb()}if(2&t){const t=c.dc(2);c.Eb("btn-primary","PM"==t.period)("btn-ghost-secondary","AM"==t.period)}}function I(t,e){if(1&t){const t=c.Tb();c.Sb(0,"span"),c.Sb(1,"span",58),c.ac("click",function(){c.wc(t);const e=c.dc(2);return e.minusPage(e.period)}),c.Dc(2," << See previous routes |"),c.Rb(),c.Rb()}}function N(t,e){if(1&t){const t=c.Tb();c.Sb(0,"span"),c.Sb(1,"span",58),c.ac("click",function(){c.wc(t);const e=c.dc(2);return e.plusPage(e.period)}),c.Dc(2," See more routes >> "),c.Rb(),c.Rb()}}function B(t,e){if(1&t){const t=c.Tb();c.Sb(0,"div",59),c.Sb(1,"div",60),c.Sb(2,"div",61),c.Dc(3),c.Rb(),c.Nb(4,"div",62),c.Sb(5,"div"),c.Sb(6,"button",63),c.ac("click",function(){c.wc(t);const i=e.$implicit;return c.dc(2).viewRoute(i.value.jobID)}),c.Dc(7,"View Route"),c.Rb(),c.Rb(),c.Rb(),c.Rb()}if(2&t){const t=e.$implicit,i=c.dc(2);c.zb(3),c.Ec(t.value.job_name),c.zb(1),c.mc("id","map-busStop",i.page,"",t.key,"")}}function D(t,e){if(1&t&&(c.Sb(0,"div",43),c.Sb(1,"div",44),c.Sb(2,"div",45),c.Sb(3,"div",46),c.Sb(4,"h4"),c.Bc(5,L,2,1,"span",47),c.Dc(6),c.Rb(),c.Bc(7,j,2,4,"button",48),c.Bc(8,O,2,4,"button",49),c.Rb(),c.Sb(9,"div",50),c.Bc(10,I,3,0,"span",51),c.Bc(11,N,3,0,"span",51),c.Rb(),c.Nb(12,"div",52),c.Sb(13,"div",53),c.Bc(14,B,8,3,"div",54),c.ec(15,"keyvalue"),c.Rb(),c.Rb(),c.Rb(),c.Rb()),2&t){const t=c.dc();c.zb(5),c.jc("ngIf",t.setting&&!!t.setting.setting),c.zb(1),c.Fc(" ",t.routeCounting," Bus Routes "),c.zb(1),c.jc("ngIf",1==t.hide_route_tab.am),c.zb(1),c.jc("ngIf",1==t.hide_route_tab.pm),c.zb(2),c.jc("ngIf",t.page>1),c.zb(1),c.jc("ngIf",t.countBusRoute),c.zb(3),c.jc("ngForOf",c.fc(15,7,t.busStopListResult[t.page]))}}function A(t,e){if(1&t&&(c.Sb(0,"span",55),c.Dc(1),c.Rb()),2&t){const t=c.dc(2);c.zb(1),c.Ec(t.util.stripslashes(t.setting.setting.account_detail[0].name))}}function E(t,e){if(1&t){const t=c.Tb();c.Sb(0,"div",68),c.Sb(1,"div",60),c.Sb(2,"div",69),c.Dc(3),c.Rb(),c.Sb(4,"div"),c.Sb(5,"button",70),c.ac("click",function(){c.wc(t);const i=e.$implicit;return c.dc(2).viewRoute(i.value.jobID)}),c.Dc(6,"View Route"),c.Rb(),c.Rb(),c.Rb(),c.Rb()}if(2&t){const t=e.$implicit;c.zb(3),c.Ec(t.value.job_name)}}function z(t,e){if(1&t){const t=c.Tb();c.Sb(0,"div",43),c.Sb(1,"div",44),c.Sb(2,"div",45),c.Sb(3,"div",64),c.Sb(4,"h4"),c.Bc(5,A,2,1,"span",47),c.Dc(6),c.Rb(),c.Sb(7,"button",56),c.ac("click",function(){return c.wc(t),c.dc().selectperiod("AM")}),c.Dc(8,"AM ROUTES "),c.Rb(),c.Sb(9,"button",57),c.ac("click",function(){return c.wc(t),c.dc().selectperiod("PM")}),c.Dc(10,"PM ROUTES "),c.Rb(),c.Rb(),c.Nb(11,"div",52),c.Sb(12,"div",65),c.Sb(13,"div",66),c.Bc(14,E,7,1,"div",67),c.ec(15,"keyvalue"),c.Rb(),c.Rb(),c.Rb(),c.Rb(),c.Rb()}if(2&t){const t=c.dc();c.zb(5),c.jc("ngIf",t.setting&&!!t.setting.setting),c.zb(1),c.Fc(" ",t.routeCounting," Bus Routes "),c.zb(1),c.Eb("btn-primary","AM"==t.period)("btn-ghost-secondary","PM"==t.period),c.zb(2),c.Eb("btn-primary","PM"==t.period)("btn-ghost-secondary","AM"==t.period),c.zb(5),c.jc("ngForOf",c.fc(15,11,t.busStopListResult[t.page]))}}const J=function(t,e){return{"background-color":"#fff",border:t,color:e}};function F(t,e){if(1&t){const t=c.Tb();c.Sb(0,"button",71),c.ac("mouseenter",function(){c.wc(t);const i=e.index,o=e.$implicit,s=c.dc();return s.termSelectContainer.btnTermHover(i,!0,o.value.term_colour,"home"),s.ishover=!0})("mouseleave",function(){c.wc(t);const i=e.index,o=e.$implicit,s=c.dc();return s.termSelectContainer.btnTermHover(i,!1,o.value.term_colour,"home"),s.ishover=!1})("click",function(){c.wc(t);const i=e.$implicit;return c.dc().changTermFunc(i.value.contractID,i.value.open_booking,""==i.value.term_name?i.value.contractName:i.value.term_name,i.value.term_colour)}),c.Sb(1,"span"),c.Dc(2),c.Rb(),c.Rb()}if(2&t){const t=e.$implicit;c.lc("id","btn-hover-term-home",e.index,""),c.jc("ngStyle",c.pc(4,J,"2px solid"+t.value.term_colour,t.value.term_colour)),c.Ab("data-color",t.value.term_colour),c.zb(2),c.Fc(" ",""==t.value.term_name?t.value.contractName:t.value.term_name," ")}}const q=[{path:"",component:(()=>{class t{constructor(t,e,i,o,s,a,r,l,h,u,d,p,b){this.util=t,this.router=e,this.requestService=i,this.storageService=o,this.mapboxService=s,this.shareDataService=a,this.scroll=r,this.appService=l,this._sanitizer=h,this.activatedRoute=u,this.customModalService=d,this.defaultLayoutComponent=p,this.termSelectContainer=b,this.pageYoffset=0,this.busStopListResult={},this.countBusRoute=!1,this.parentPortalText="",this.collectionName="",this.trackingPhone="",this.trackingEmail="",this.parentPortalLat="",this.parentPortalLng="",this.bus_route_template="1",this.enable_template={status:!1,template:"1",function:()=>this.setRouteResult()},this.loginError=new c.n,this.keyword="live search",this.requireToken=!1,this.displayRoute={},this.stackResult={},this.stackResultRenderMapNextPage={am:{},pm:{}},this.routeCounting="",this.htmlContent="",this.mobileMode=!1,this.useStorageDirectionMap=!1,this.job_name="",this.storeJobIds=[],this.hide_route_tab={am:1,pm:1},this.paymentAvailable=!1,this.regularEnabled=!1,this.contract_id="",this.changeTermReloadMapbox=!1,this.payment_id=0,this.checkShowModalTermSelect=!1,this.mapRouteDrawStyleSync=(t,e)=>new Promise((i,o)=>Object(n.a)(this,void 0,void 0,function*(){try{i({id:"route"+t,type:"line",source:{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}}},paint:{"line-color":"#a900c7","line-width":3}})}catch(s){console.error(s),o({error:!0,message:s})}})),this.period="AM",this.page=1,void 0!==this.router.getCurrentNavigation().extras.state&&this.router.getCurrentNavigation().extras.state&&void 0!==this.router.getCurrentNavigation().extras.state.requireToken&&(this.requireToken=this.router.getCurrentNavigation().extras.state.requireToken),null!=this.router.getCurrentNavigation().extras.state&&(this.checkShowModalTermSelect=this.router.getCurrentNavigation().extras.state.showModal),this.configModalConfirm={title:"",content:"",type:"danger",backdrop:"static"},this.configModalShowTermSelect={title:"",content:"",type:"danger",backdrop:"static"}}onScroll(t){this.pageYoffset=window.pageYOffset}ngOnInit(){return Object(n.a)(this,void 0,void 0,function*(){this.mobileMode=yield this.storageService.getStorage("mobileMode"),this.mobileMode?(yield p.c.documentElement.style.setProperty("--toTopMobileMode","0px"),yield p.c.documentElement.style.setProperty("--backBtnMobileMode","block")):(yield p.c.documentElement.style.setProperty("--toTopMobileMode","36px"),yield p.c.documentElement.style.setProperty("--backBtnMobileMode","none")),this.busStopListResult[this.page]={},this.displayRoute[this.page]={},this.displayRoute[this.page][this.period]={},this.env=this.util.getEnv(),this.page=1,this.period="AM",mapboxgl.accessToken=this.env.mapboxKey,this.controllNavIcon(),this.user=yield this.storageService.getStorage("user");let t=yield this.storageService.getStorage("listJobs");if(t=JSON.parse(t),console.log("listJobs",t),!this.user)for(let i in t)yield this.storageService.removeStorage("routeJob_"+t[i]);this.initLiveSearch(),yield this.activeSetting(),this.activatedRoute.queryParams.subscribe(t=>Object(n.a)(this,void 0,void 0,function*(){console.log("params :: ",t),this.payment_id=t.payment_id;let e=t.status;if(this.payment_id){let t=this.URLdecryptionYmd(this.payment_id);if(parseInt(e)&&t){let e={payment_id:t};yield this.bookingContract(e)}console.log("payment_id",t)}}));let e=!1;this.checkShowModalTermSelect||this.payment_id?(this.checkShowModalTermSelect&&!this.payment_id||!this.checkShowModalTermSelect&&this.payment_id||this.checkShowModalTermSelect||this.payment_id)&&(e=!1):e=!0,e&&(yield this.storageService.removeStorage("term_active")),this.payment_id=0,this.getAllDataTermContract(e),this.getRawData().subscribe(t=>this.htmlContent=this._sanitizer.bypassSecurityTrustHtml(t),t=>console.log(t)),this.router.events.subscribe(t=>Object(n.a)(this,void 0,void 0,function*(){if("popstate"===t.navigationTrigger){const t=yield this.storageService.getStorage("term_active");let e=JSON.parse(t);this.defaultLayoutComponent.setTermNameColorActive(e.term_name,""!=e.term_colour?e.term_colour:"#000")}})),this.selecTionTerm=this.termSelectContainer.changeTermActive.subscribe(t=>Object(n.a)(this,void 0,void 0,function*(){return this.setSubscribe(t)}))})}ngOnDestroy(){this.selecTionTerm.unsubscribe()}setSubscribe(t){this.contract_id=t.contract_id,this.changeTermReloadMapbox=!1,this.page=1,this.displayRoute[this.page].AM={},this.displayRoute[this.page].PM={},this.countBusRoute=!1,this.stackResultRenderMapNextPage={am:{},pm:{}},this.updateBusStop(this.page,!0)}bookingContract(t){return Object(n.a)(this,void 0,void 0,function*(){let e=this.requestService.getParentAPI();this.configModalConfirm={title:"",content:' Processing, Please wait ',type:"warning",backdrop:"static",showOkButton:!1},this.customModalService.open("confirm-model");let i=yield e.post(e.route.insertPassengerToRouteTemp,t,e.requestHeaderUser());this.modalAction(i,t),console.log("submitPassengers",i)})}modalAction(t,e){return t.result.status&&204==t.result.status?(console.log("submitPassenger if",t),this.customModalService.close("confirm-model"),!1):t.result.status&&102==t.result.status?(console.log("submitPassengers else",t),setTimeout(()=>{e.isFinish=!0,this.bookingContract(e)},3e3),!1):void(this.configModalConfirm=t.result.status?{title:"Success",content:"Thank you, Your Booking is now complete and you will receive an email confirmation.",type:"success",backdrop:"static",OkButtonText:"Click here to review your booking",alignButton:"center",showOkButton:!0,OkButtonStyle:{width:"100%","background-color":"var(--green)",color:"white"}}:{title:"Warning",content:t.result.msg,type:"warning",backdrop:"static",OkButtonText:"OK",alignButton:"center",showOkButton:!0,OkButtonStyle:{width:"100%","background-color":"var(--yellow)",color:"white"}})}cancelconfirmation(){this.customModalService.close("confirm-model"),this.router.navigate(["children"])}URLdecryptionYmd(t){let e=atob(t),i=btoa("||YLCSP01"),o=e.split(i),s=atob(o[0]);return s=atob(s),(new Date).getTime()<=new Date(s.replace(/-/g,"/")+" 23:59:59").getTime()&&atob(o[1])}ngAfterViewChecked(){return Object(n.a)(this,void 0,void 0,function*(){})}ngAfterViewInit(){this.controllNavIcon()}controllNavIcon(){var t;let e=null===(t=this.activatedRoute.data._value)||void 0===t?void 0:t.isShowLateRoute;this.util.controlNavIcon(!0,e);let i=JSON.parse(this.storageService.getStorage("lateRoute"));this.job_name=i.job_name}activeSetting(){var t,e;return Object(n.a)(this,void 0,void 0,function*(){let i=this.requestService.getParentAPI();switch(yield i.checkRequestSecretFirst(),this.setting=yield i.get(i.route.setting,"",yield i.requestSecret()),this.parentPortalText=this.setting.setting.parentPortalText,this.collectionName=this.setting.setting.account_detail[0].collection_name,this.trackingPhone=this.setting.setting.account_detail[0].tracking_phone,this.trackingEmail=this.setting.setting.account_detail[0].tracking_email,this.parentPortalLat=this.setting.setting.account_detail[0].lat,this.parentPortalLng=this.setting.setting.account_detail[0].lng,this.setting.setting.bus_route_template&&(this.bus_route_template=this.setting.setting.bus_route_template,console.log("this.bus_route_template",this.bus_route_template)),this.bus_route_template){case"1":this.enable_template.template=this.bus_route_template,this.enable_template.function=()=>this.setRouteResult(this.busStopListResult.result),this.enable_template.headerTitle="Ready to Book?";break;case"2":this.enable_template.template=this.bus_route_template,this.enable_template.function=()=>this.setRouteResult_template2(this.busStopListResult.result),this.enable_template.headerTitle="Find my stop";break;default:this.enable_template.template="1",this.enable_template.function=()=>this.setRouteResult(this.busStopListResult.result)}yield this.storageService.setStorage("temporarily",JSON.stringify(this.enable_template)),parseInt(null===(t=this.setting.setting)||void 0===t?void 0:t.paymentEnabled)&&(this.paymentAvailable=!0),parseInt(null===(e=this.setting.setting)||void 0===e?void 0:e.regularEnabled)&&(this.regularEnabled=!0),this.buildMap()})}updateBusStop(t="",e=!1){var i,o;return Object(n.a)(this,void 0,void 0,function*(){""==t&&(t=this.page);let s=this.requestService.getParentAPI();yield s.checkRequestSecretFirst();let a="";this.stackResultRenderMapNextPage[this.period.toLowerCase()]&&this.stackResultRenderMapNextPage[this.period.toLowerCase()][t]&&!this.changeTermReloadMapbox&&(a=this.stackResultRenderMapNextPage[this.period.toLowerCase()][t],this.busStopListResult=a?JSON.parse(a):""),a&&!e||(this.busStopListRoute=s.route.busLateRoute.replace(":page",t).replace(":ampm",this.period.toLowerCase()).replace(":job_name",this.job_name.toLowerCase()),this.busStopListRoute+="?contract_id="+this.contract_id,this.busStopListResult=yield s.get(this.busStopListRoute,"",s.requestSecret()),this.stackResultRenderMapNextPage[this.period.toLowerCase()][t]=JSON.stringify(this.busStopListResult),this.setStorageListJobs(this.busStopListResult)),this.routeCounting=this.busStopListResult.count,console.log("function : ",this.enable_template.function),yield this.enable_template.function(),"0"==this.routeCounting&&(null===(i=this.env[window.location.host])||void 0===i?void 0:i.hide_route)&&(this.hide_route_tab[this.period.toLowerCase()]=(null===(o=this.env[window.location.host])||void 0===o?void 0:o.hide_route[this.period.toLowerCase()])?0:1,console.log("this.hide_route_tab[this.period.toLowerCase()]",this.hide_route_tab[this.period.toLowerCase()]),0==this.hide_route_tab[this.period.toLowerCase()]&&"pm"!=this.period.toLowerCase()&&this.selectperiod("PM"))})}setRouteResult_template2(t=[]){return Object(n.a)(this,void 0,void 0,function*(){this.busStopListResult[this.page]=t;let e=this.busStopListResult[this.page];void 0===this.displayRoute[this.page]&&(this.displayRoute[this.page]={}),void 0===this.displayRoute[this.page][this.period]&&(this.displayRoute[this.page][this.period]={});for(let t in e){if(this.displayRoute[this.page][this.period][t]){this.displayRoute[this.page][this.period][t].map=!1;continue}this.displayRoute[this.page][this.period][t]={},this.displayRoute[this.page][this.period][t].daysTxt=e[t].exception&&e[t].exception.length>0?this.util.daysOfWeek(e[t].exception[0].except_day,!1).daysTxt:"Everydays";let i=e[t].route,o=[];for(let t in i){let e=i[t];o.push([e.lng,e.lat])}this.displayRoute[this.page][this.period][t].jobID=e[t].jobID,this.displayRoute[this.page][this.period][t].route=o}this.busStopListResult[this.page+1]?this.countBusRoute=!0:yield this.loadNextPage_template2(),clearTimeout(this.timeout),this.timeout=setTimeout(()=>Object(n.a)(this,void 0,void 0,function*(){}),100)})}loadNextPage_template2(){return Object(n.a)(this,void 0,void 0,function*(){if(this.routeCounting>this.busStopListResult[this.page].length){this.page=this.page+1;let t="",e={};if(this.stackResultRenderMapNextPage[this.period.toLowerCase()]&&!this.stackResultRenderMapNextPage[this.period.toLowerCase()][this.page]){let t=this.requestService.getParentAPI(),i=t.route.busRoute.replace(":page",this.page).replace(":ampm",this.period.toLowerCase());e=yield t.get(i,"",t.requestSecret()),this.stackResultRenderMapNextPage[this.period.toLowerCase()][this.page]=JSON.stringify(e)}if(t||(t=this.stackResultRenderMapNextPage[this.period.toLowerCase()][this.page],e=t?JSON.parse(t):""),e.result&&e.result.length>0){const t=this.busStopListResult[this.page-1].concat(e.result);this.busStopListResult[this.page]=t,yield this.loadNextPage_template2()}}})}setRouteResult(t=[]){return Object(n.a)(this,void 0,void 0,function*(){this.busStopListResult[this.page]=t;let e=this.busStopListResult[this.page];void 0===this.displayRoute[this.page]&&(this.displayRoute[this.page]={}),void 0===this.displayRoute[this.page][this.period]&&(this.displayRoute[this.page][this.period]={});for(let t in e){if(this.changeTermReloadMapbox&&this.displayRoute[this.page][this.period][t]){this.displayRoute[this.page][this.period][t].map=!1;continue}this.displayRoute[this.page][this.period][t]={},this.displayRoute[this.page][this.period][t].daysTxt=e[t].exception&&e[t].exception.length>0?this.util.daysOfWeek(e[t].exception[0].except_day,!1).daysTxt:"Everydays";let i=e[t].route,o=[];for(let t in i){let e=i[t];o.push([e.lng,e.lat])}this.displayRoute[this.page][this.period][t].jobID=e[t].jobID,this.displayRoute[this.page][this.period][t].route=o}this.busStopListResult[this.page+1]?this.countBusRoute=!0:yield this.loadNextPage(),clearTimeout(this.timeout),this.timeout=setTimeout(()=>Object(n.a)(this,void 0,void 0,function*(){this.displayRoute[this.page]&&this.displayRoute[this.page][this.period]&&this.displayRoute[this.page][this.period][0]&&(yield this.mapRender())}),100)})}loadNextPage(){return Object(n.a)(this,void 0,void 0,function*(){let t="",e={};if(this.stackResultRenderMapNextPage[this.period.toLowerCase()]&&!this.stackResultRenderMapNextPage[this.period.toLowerCase()][this.page+1]){let t=this.requestService.getParentAPI(),i=t.route.busLateRoute.replace(":page",this.page+1).replace(":ampm",this.period.toLowerCase()).replace(":job_name",this.job_name.toLowerCase());i+="?contract_id="+this.contract_id,e=yield t.get(i,"",t.requestSecret()),this.stackResultRenderMapNextPage[this.period.toLowerCase()][this.page+1]=JSON.stringify(e),this.setStorageListJobs(e)}t||(t=this.stackResultRenderMapNextPage[this.period.toLowerCase()][this.page+1],e=t?JSON.parse(t):""),e.result&&e.result.length>0?(this.stackResult[this.page+1]=e.result,this.countBusRoute=!0):this.countBusRoute=!1})}setStorageListJobs(t){return Object(n.a)(this,void 0,void 0,function*(){if(t&&t.count>0){for(let e in t.result){let i=t.result[e].jobID;this.storeJobIds.includes(i)||this.storeJobIds.push(i)}yield this.storageService.setStorage("listJobs",JSON.stringify(this.storeJobIds))}})}mapRender(t=!0){return Object(n.a)(this,void 0,void 0,function*(){let e=Object.keys(this.displayRoute[this.page][this.period]);console.log("obKey",e),e.forEach((e,i)=>Object(n.a)(this,void 0,void 0,function*(){if(!this.displayRoute[this.page][this.period][e].map&&t&&this.displayRoute[this.page][this.period][e].route&&p.c.getElementById("map-busStop"+this.page+e)){let t=0;this.displayRoute[this.page][this.period][e]&&this.displayRoute[this.page][this.period][e].route&&(t=Math.ceil(this.displayRoute[this.page][this.period][e].route.length/2));let i={container:"map-busStop"+this.page+e,style:"mapbox://styles/mapbox/streets-v11",center:this.displayRoute[this.page][this.period][e].route[t],zoom:9};this.displayRoute[this.page][this.period][e].map=yield new d.Map(i),this.displayRoute[this.page][this.period][e].map.on("load",()=>Object(n.a)(this,void 0,void 0,function*(){if(this.displayRoute[this.page][this.period][e]&&void 0!==this.displayRoute[this.page][this.period][e]){let t={},i={},o=yield this.storageService.getStorage("routeJob_"+this.displayRoute[this.page][this.period][e].jobID);if(o&&this.useStorageDirectionMap?i=JSON.parse(o):(t=yield this.mapboxService.getRouteDirection(this.displayRoute[this.page][this.period][e].route,"mapbox/driving"),i=t.routes[0].geometry.coordinates),i){let t=i;if(this.displayRoute[this.page][this.period][e].geometry=t,yield this.storageService.setStorage("routeJob_"+this.displayRoute[this.page][this.period][e].jobID,JSON.stringify(t)),this.displayRoute[this.page][this.period][e].map){this.displayRoute[this.page][this.period][e].markers=[],this.displayRoute[this.page][this.period][e].route.forEach(t=>{let i=this.customMarker("pin-bule.png"),o=new mapboxgl.Marker(i).setLngLat(t).addTo(this.displayRoute[this.page][this.period][e].map);this.displayRoute[this.page][this.period][e].markers.push(o)});let t=this.displayRoute[this.page][this.period][e].geometry,i=yield this.mapRouteDrawStyleSync(this.displayRoute[this.page][this.period][e].jobID+this.period,t);void 0!==this.displayRoute[this.page][this.period][e].map.getLayer(i)?this.displayRoute[this.page][this.period][e].map.getSource(i.id)&&(this.displayRoute[this.page][this.period][e].map.removeLayer(i),this.displayRoute[this.page][this.period][e].map.removeSource(i)):void 0===this.displayRoute[this.page][this.period][e].map.getLayer(i)&&this.displayRoute[this.page][this.period][e].map.loaded()&&void 0===this.displayRoute[this.page][this.period][e].map.getSource(i.id)&&this.displayRoute[this.page][this.period][e].map.addLayer(i)}}}}))}}))})}selectperiod(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>{t!=this.period&&(this.busStopListResult={},this.stackResult={},this.period=t,this.displayRoute[this.page]&&!this.displayRoute[this.page][this.period]&&(this.displayRoute[this.page][this.period]={})),this.page=1,this.changeTermReloadMapbox=!0,this.updateBusStop(this.page)},400)}minusPage(){this.page=this.page-1,this.useStorageDirectionMap=!0,this.changeTermReloadMapbox=!0,this.updateBusStop()}plusPage(){this.page=this.page+1,this.countBusRoute=!1,this.useStorageDirectionMap=!0,this.changeTermReloadMapbox=!0,this.updateBusStop()}getSearchvalue(t){setTimeout(()=>{this.addresspicker_map.nativeElement.value=t.target.defaultValue,t.target.defaultValue&&this.onSubmitSearchBus()},300)}onSubmitSearchBus(){return Object(n.a)(this,void 0,void 0,function*(){const t=this.addresspicker_map.nativeElement.value,e=this.collection_lat.nativeElement.value,i=this.collection_lng.nativeElement.value;let o=yield this.storageService.getStorage("term_active");o=JSON.parse(o);let s=o?o.contract_id:"0";""===t?alert("please enter address"):this.router.navigate(["searchbus"],{state:{searchData:{address:t,lat:e,lng:i,job_name:this.job_name},paymentAvailable:this.paymentAvailable,template:this.enable_template.template,contractData:s}})})}initLiveSearch(){let t=this.env.live_search,e="&t=address";e+="&mode=admin",e+="&id=",e+="&site_id="+this.env.site_id,e+="&q=",t+=e,$("#addresspicker_map").liveSearch({url:t})}sendKeySearch(){this.requestService.getLivesearchAPI().search(this.keyword,"livesearch").then(t=>{this.livesearchEcmScript=t}).catch(t=>{})}buildMap(){return Object(n.a)(this,void 0,void 0,function*(){})}makerPopUp(t=""){return new mapboxgl.Popup({offset:25}).setHTML(t)}viewRoute(t){this.router.navigate(["searchbus"],{state:{jobID:[t],read_only:!0}})}scrollToTop(t){this.scroll.scrollToPosition(t)}formatAMPM(t){return(t=t.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[t]).length>1&&((t=t.slice(1))[5]=+t[0]<12?" AM":" PM",t[0]=+t[0]%12||12),t.join("")}displayTime(t,e){let i=t.value[e].substr(t.value[e].indexOf("-")-10,5);return i=i&&this.formatAMPM(i)?this.formatAMPM(i):"",i}customMarker(t){const e=p.c.createElement("div");return e.style.width="22px",e.style.height="22px",e.style.background="url(assets/img/images/"+t+") no-repeat",e.style.backgroundSize="contain",e}getRawData(){let t=location.origin+"/page/welcome.php";return this.appService.get(t,{responseType:"text"})}getAllDataTermContract(t){return Object(n.a)(this,void 0,void 0,function*(){const e=yield Object(m.b)(this.requestService);if(this.AllContractResult=JSON.parse(e),0==this.AllContractResult.length)this.contract_id="0",this.updateBusStop(this.page,!0);else if(this.AllContractResult.length>1)if(t)yield this.openModalShowTermSelect();else{let t=yield this.storageService.getStorage("term_active");console.log(t),t=JSON.parse(t),this.contract_id=null==t?void 0:t.contract_id,this.updateBusStop(this.page,!0)}else this.changTermFunc(this.AllContractResult[0].contractID,this.AllContractResult[0].open_booking,this.AllContractResult[0].term_name,this.AllContractResult[0].term_colour)})}openModalShowTermSelect(){return Object(n.a)(this,void 0,void 0,function*(){this.configModalShowTermSelect={title:"Please select the term you would like to manage.",content:"",type:"info",backdrop:"static",showOkButton:!1},this.customModalService.open("show-term-select")})}cancelshowtermselect(){this.customModalService.close("show-term-select")}changTermFunc(t,e,i,o){return Object(n.a)(this,void 0,void 0,function*(){this.contract_id=t,this.cancelshowtermselect(),this.defaultLayoutComponent.setTermNameColorActive(i,o=""!=o?o:"#000"),this.termSelectContainer.changeActive(t,e,i,o)})}}return t.\u0275fac=function(e){return new(e||t)(c.Mb(r.a),c.Mb(a.c),c.Mb(l.a),c.Mb(h.a),c.Mb(u.a),c.Mb(b.a),c.Mb(s.u),c.Mb(f.a),c.Mb(R.b),c.Mb(a.a),c.Mb(g.a),c.Mb(v.a),c.Mb(m.a))},t.\u0275cmp=c.Gb({type:t,selectors:[["app-home"]],viewQuery:function(t,e){if(1&t&&(c.Ic(_,1),c.Ic(k,1),c.Ic(w,1)),2&t){let t;c.tc(t=c.bc())&&(e.addresspicker_map=t.first),c.tc(t=c.bc())&&(e.collection_lat=t.first),c.tc(t=c.bc())&&(e.collection_lng=t.first)}},hostBindings:function(t,e){1&t&&c.ac("scroll",function(t){return e.onScroll(t)},!1,c.vc)},inputs:{backButton:"backButton"},outputs:{loginError:"loginError"},decls:36,vars:14,consts:[[1,"row","pl-2","py-2",2,"margin-right","-1.4rem"],[1,"col-12","d-lg-none","stricky-button"],[1,"col-12"],["class","btn_on_top btn btn-block btn-warning active col-4 font-weight-bold text-white",3,"click",4,"ngIf"],["class","col-12 no-padding d-md-none stricky-button",4,"ngIf"],[1,"row","col-12",2,"padding-right","0"],[1,"col-12","col-lg-12","col-xl-3","col-md-12","col-sm-12","col-xs-12","px-2","py-2","flex-xl-1"],[1,"card","search-bus","text-center","bg-light","height_auto","py-4"],[1,"mb-0"],["src","assets/img/images/bus.png",1,"img-fluid","img-bus",2,"max-width","230px","margin","0 auto"],["type","text","name","livesearch","id","addresspicker_map","placeholder","Enter your address or postcode","autocomplete","off",1,"form-control",3,"hidden","change"],["addresspicker_map",""],["type","hidden","name","collection_lat","id","collection_lat","value","",1,"collection_lat"],["collection_lat",""],["type","hidden","name","collection_lng","id","collection_lng","value","",1,"collection_lng"],["collection_lng",""],[1,"col-12","col-lg-12","col-xl-9","col-md-12","col-sm-12","col-xs-12","px-2","py-2","flex-xl-1"],[1,"card",2,"height","100%","overflow","auto",3,"innerHtml"],[1,"col-12","col-sm-12","col-md-12","col-lg-12","col-xl-3","px-2","py-2"],[1,"col-12","col-md-12","col-lg-12","col-xl-12","px-0","py-0"],[1,"card","height_auto","mb-3"],[1,"card-body","bg-white"],[1,"text-center",3,"innerHTML"],["class","col-12 col-md-12 col-lg-12 col-xl-12 px-0 py-0",4,"ngIf"],["class","col-12 col-md-12 col-lg-12 col-xl-9 px-2 py-2 mb-3",4,"ngIf"],["id","confirm-model",3,"config","okButtonCallback","closeModalButtonCallback"],["id","show-term-select",3,"config"],[1,"modal-body","pb-2","mb-1","mt-1","d-inline-flex"],[1,"d-flex","flex-wrap","mb-2","show-all-term"],["class","btn btn-term-select m-1",3,"ngStyle","id","mouseenter","mouseleave","click",4,"ngFor","ngForOf"],[1,"btn_on_top","btn","btn-block","btn-warning","active","col-4","font-weight-bold","text-white",3,"click"],[1,"fa","fa-chevron-circle-up","fa-lg","mr-1"],[1,"col-12","no-padding","d-md-none","stricky-button"],[1,"col-12","no-padding"],[1,"btn_back_bussearch","btn_book_bussearch","btn","btn-block","btn-success","active","col-3","pull-right","font-weight-bold","text-white","mr-2",3,"backButton"],[1,"fa","fa-chevron-left","fa-lg","mr-1"],[1,"text-center","mt-3"],["class","text-center mt-3",4,"ngIf"],["class","text-center mt-3 mb-3",4,"ngIf"],["rel","","title","",3,"href"],[1,"fa","fa-phone-square"],[1,"text-center","mt-3","mb-3"],[1,"fa","fa-envelope"],[1,"col-12","col-md-12","col-lg-12","col-xl-9","px-2","py-2","mb-3"],[1,"card","height_auto"],[1,"card-body","bg-light"],[1,"float-left","bar-gird"],["class","text-info",4,"ngIf"],["class","btn active","value","AM",3,"btn-primary","btn-ghost-secondary","click",4,"ngIf"],["class","btn active","value","PM",3,"btn-primary","btn-ghost-secondary","click",4,"ngIf"],[1,"float-right","action-icon"],[4,"ngIf"],[1,"col-md-12",2,"clear","both"],[1,"row"],["class","col-12 col-md-6 col-lg-4 mt-3",4,"ngFor","ngForOf"],[1,"text-info"],["value","AM",1,"btn","active",3,"click"],["value","PM",1,"btn","active",3,"click"],[1,"text-info","h5","hand",3,"click"],[1,"col-12","col-md-6","col-lg-4","mt-3"],[1,"bg-white","card-body","p-3"],[1,"h5"],[1,"map-route",3,"id"],[1,"btn","btn-block","btn-primary","active","col-lg-6","col-md-6","col-sm-12","col-xs-12","mt-1",3,"click"],[1,"float-left","bar-gird","col-12","col-md-12","col-lg-12","px-2","py-2","text-center"],[1,"scroll-bar-route"],[1,"row","w-100"],["class","col-12 col-md-6 col-lg-3 mt-3",4,"ngFor","ngForOf"],[1,"col-12","col-md-6","col-lg-3","mt-3"],[1,"h5","route-name-box"],[1,"btn","btn-block","btn-primary","active",3,"click"],[1,"btn","btn-term-select","m-1",3,"ngStyle","id","mouseenter","mouseleave","click"]],template:function(t,e){1&t&&(c.Sb(0,"div",0),c.Sb(1,"div",1),c.Sb(2,"div",2),c.Bc(3,x,3,0,"button",3),c.Rb(),c.Rb(),c.Bc(4,M,5,0,"div",4),c.Sb(5,"div",5),c.Sb(6,"div",6),c.Sb(7,"div",7),c.Sb(8,"h2",8),c.Dc(9),c.Rb(),c.Sb(10,"h5",8),c.Dc(11," find your closest stop/bus route"),c.Rb(),c.Nb(12,"img",9),c.Sb(13,"input",10,11),c.ac("change",function(t){return e.getSearchvalue(t)}),c.Rb(),c.Nb(15,"input",12,13),c.Nb(17,"input",14,15),c.Rb(),c.Rb(),c.Sb(19,"div",16),c.Nb(20,"div",17),c.Rb(),c.Rb(),c.Sb(21,"div",5),c.Sb(22,"div",18),c.Sb(23,"div",19),c.Sb(24,"div",20),c.Sb(25,"div",21),c.Nb(26,"div",22),c.Rb(),c.Rb(),c.Rb(),c.Bc(27,C,7,2,"div",23),c.Rb(),c.Bc(28,D,16,9,"div",24),c.Bc(29,z,16,13,"div",24),c.Rb(),c.Rb(),c.Sb(30,"custom-modal",25),c.ac("okButtonCallback",function(){return e.cancelconfirmation()})("closeModalButtonCallback",function(){return e.cancelconfirmation()}),c.Rb(),c.Sb(31,"custom-modal",26),c.Sb(32,"div",27),c.Sb(33,"div",28),c.Bc(34,F,3,7,"button",29),c.ec(35,"keyvalue"),c.Rb(),c.Rb(),c.Rb()),2&t&&(c.zb(3),c.jc("ngIf",e.pageYoffset>0),c.zb(1),c.jc("ngIf",e.mobileMode),c.zb(5),c.Ec(e.enable_template.headerTitle),c.zb(4),c.jc("hidden",!e.regularEnabled),c.zb(7),c.jc("innerHtml",e.htmlContent,c.xc),c.zb(6),c.jc("innerHTML",e.parentPortalText,c.xc),c.zb(1),c.jc("ngIf",""!=e.trackingPhone||""!=e.trackingEmail),c.zb(1),c.jc("ngIf","1"==e.enable_template.template),c.zb(1),c.jc("ngIf","2"==e.enable_template.template),c.zb(1),c.jc("config",e.configModalConfirm),c.zb(1),c.jc("config",e.configModalShowTermSelect),c.zb(3),c.jc("ngForOf",c.fc(35,12,e.AllContractResult)))},directives:[s.m,y.a,s.l,S.a,s.n],pipes:[s.g],styles:["[_ngcontent-%COMP%]:root{--primary-color:#fffff}#map-header-mapbox[_ngcontent-%COMP%]{position:relative;top:0;bottom:0;width:100%;min-height:260px;transition:all .3s;margin-bottom:0}@media only screen and (min-width:1600px){#map-header-mapbox[_ngcontent-%COMP%]{min-height:320px}}.cut-text[_ngcontent-%COMP%]{text-overflow:ellipsis;overflow:hidden;width:100%;height:1.2em;white-space:nowrap}.assign-day[_ngcontent-%COMP%], .time-show[_ngcontent-%COMP%]{padding-right:5px;padding-left:5px}@media (min-width:1200px){.flex-xl-1[_ngcontent-%COMP%]{flex:1!important}}"]}),t})(),data:{title:"Home"}}];let H=(()=>{class t{}return t.\u0275fac=function(e){return new(e||t)},t.\u0275mod=c.Kb({type:t}),t.\u0275inj=c.Jb({imports:[[a.g.forChild(q)],a.g]}),t})();var U=i("LqlI"),Y=i("WEGI"),V=i("ot1H");let K=(()=>{class t{}return t.\u0275fac=function(e){return new(e||t)},t.\u0275mod=c.Kb({type:t}),t.\u0275inj=c.Jb({imports:[[o.j,s.c,Y.a,H,U.b.forRoot(),V.a]]}),t})()}}]);