text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[5],{"3a69":function(t,e,r){},"58f6":function(t,e,r){"use strict";var i=r("3a69"),a=r.n(i);a.a},"5c65":function(t,e,r){"use strict";r.r(e);var i=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("q-page",{staticClass:"row flex flex-center bg-blue-grey-1"},[r("div",{staticClass:"col-7 q-gutter-md",staticStyle:{"margin-top":"0rem","margin-bottom":"1rem"}},[0==t.departures.length?r("q-spinner-bars",{staticClass:"fixed-center",attrs:{color:"primary",size:"2em"}}):t._e(),t._l(t.departures,(function(e){return r("q-card",{key:e.id},[r("q-card-section",[r("div",{staticClass:"row text justify-between",staticStyle:{width:"100%","padding-right":"3rem"}},[r("div",{staticClass:"col-5"},["Greyhound"===e.operator_name?r("img",{staticStyle:{height:"2rem"},attrs:{src:"statics/greyhound.jpg"}}):t._e(),"Adirondack Trailways"===e.operator_name?r("img",{staticStyle:{height:"1.5rem"},attrs:{src:"statics/trailways.png"}}):t._e()]),r("div",{staticClass:"col-1 text-blue text-h6"},[r("strong",[t._v(t._s(t.formatPrice(e.price)))])])]),r("div",{staticClass:"row text",staticStyle:{width:"100%"}},[r("q-icon",{staticStyle:{"margin-left":"0.5rem","margin-right":"0.5rem"},attrs:{name:"trip_origin",size:"xs"}}),t._v("\n            "+t._s(t.formatTime(e.departure_time))+" New York - "+t._s(e.origin_name)+"\n        ")],1),r("div",{staticClass:"row text text-grey",staticStyle:{width:"100%"}},[r("q-icon",{staticStyle:{"margin-left":"0.5rem","margin-right":"0.5rem"},attrs:{name:"place",size:"xs"}}),t._v("\n            "+t._s(t.formatTime(e.arrival_time))+" Montreal - "+t._s(e.destination_name)+"\n        ")],1),r("div",{staticClass:"row text justify-between",staticStyle:{width:"100%","padding-right":"3rem"}},[r("div",{staticClass:"col-8"},[r("q-icon",{staticStyle:{"margin-left":"0.5rem"},attrs:{name:"directions_bus",size:"xs"}}),t._v("\n            "+t._s(t.formatTripDuration(e.departure_time,e.arrival_time))+"\n          ")],1),r("div",{staticClass:"col-1"},[r("q-btn",{attrs:{color:"orange",label:"Select","no-caps":""}})],1)])])],1)}))],2)])},a=[],n=(r("7f7f"),r("7514"),r("ac4d"),r("8a81"),r("ac6a"),r("28a5"),{name:"search",data:function(){return{date:"2020-08-02",operators:{},locations:{},departures:[]}},methods:{formatPrice:function(t){var e=String(t).split("");return e.pop(),e.pop(),"US$"+e.join("")},formatTime:function(t){var e=" am",r=String(t).split("");r=r.slice(11,16);var i=r.join("").split(":")[0];return i>12&&(e=" pm",r[0]=r[0]-1,r[1]=r[1]-2,r[1]<0&&(r[1]+=10,r[0]=0)),r.join("")+e},formatTripDuration:function(t,e){var r=String(t).split("");r=r.slice(11,16);var i=String(e).split("");i=i.slice(11,16);var a=i.join("").split(":")[0]-r.join("").split(":")[0];a<0&&(a+=24);var n=i.join("").split(":")[1]-r.join("").split(":")[1];return n<0&&(n+=60),a+"h "+n+"m"},poll:function(){var t=this;this.complete||this.$axios.get("/x-departures/dr5reg/f25dvk/"+this.date+"/poll?index="+this.departures.length).then((function(e){t.operators=e.data.operators;var r=t.departures,i=!0,a=!1,n=void 0;try{for(var o,s=function(){var e=o.value;r.push({id:e.id,operator_name:t.operators.find((function(t){return t.id===e.operator_id})).display_name,departure_time:e.departure_time,arrival_time:e.arrival_time,origin_name:t.locations.find((function(t){return t.id===e.origin_location_id})).name,destination_name:t.locations.find((function(t){return t.id===e.destination_location_id})).name,price:e.prices.total})},c=e.data.departures[Symbol.iterator]();!(i=(o=c.next()).done);i=!0)s()}catch(l){a=!0,n=l}finally{try{i||null==c.return||c.return()}finally{if(a)throw n}}t.departures=r,t.complete=e.data.complete})).catch((function(t){console.error(t)}))}},mounted:function(){var t=this;this.$axios.get("/x-departures/dr5reg/f25dvk/"+this.date).then((function(e){t.operators=e.data.operators,t.locations=e.data.locations;var r=[],i=!0,a=!1,n=void 0;try{for(var o,s=function(){var e=o.value;r.push({id:e.id,operator_name:t.operators.find((function(t){return t.id===e.operator_id})).display_name,departure_time:e.departure_time,arrival_time:e.arrival_time,origin_name:t.locations.find((function(t){return t.id===e.origin_location_id})).name,destination_name:t.locations.find((function(t){return t.id===e.destination_location_id})).name,price:e.prices.total})},c=e.data.departures[Symbol.iterator]();!(i=(o=c.next()).done);i=!0)s()}catch(l){a=!0,n=l}finally{try{i||null==c.return||c.return()}finally{if(a)throw n}}t.departures=r,t.complete=e.data.complete,t.complete||setInterval(function(){this.poll()}.bind(t),2e3)})).catch((function(t){console.error(t)}))}}),o=n,s=(r("58f6"),r("2877")),c=r("eebe"),l=r.n(c),d=r("9989"),p=r("a154"),m=r("f09f"),u=r("a370"),f=r("0016"),_=r("9c40"),g=Object(s["a"])(o,i,a,!1,null,"54f50808",null);e["default"]=g.exports;l()(g,"components",{QPage:d["a"],QSpinnerBars:p["a"],QCard:m["a"],QCardSection:u["a"],QIcon:f["a"],QBtn:_["a"]})}}]);