1function GoogleMapsApp(){return{ensureSafariDialogCompat(){function e(){}void 0===window.HTMLDialogElement&&((e.prototype=window.HTMLElement&&window.HTMLElement.prototype||{}).show||(e.prototype.show=function(){}),e.prototype.showModal||(e.prototype.showModal=function(){}),e.prototype.close||(e.prototype.close=function(){}),window.HTMLDialogElement=e)},mapCtrl:null,directionsService:null,directionsDisplay:null,currentPosition:{},startLocation:"",endLocation:"",departOrArival:"Depart",routeOptions:"",mapPanelOpen:!0,adaSearchTried:!1,showLoading:!1,showGeoMessage:!1,startAutoComplete:null,endAutoComplete:null,placeService:null,date:"",time:"",timeRequired:!1,tripOnDifferentDate:!1,tripOnDifferentDateMessage:"",noTripsFound:!1,noTripsFound2:!1,wheelChair:!1,routes:[],backButton:!1,proxyApi:"https://www.cata.org/DesktopModules/Cata.Endpoint/GTFSProxy.ashx?method=",rootEl:null,async init(e=null){this.ensureSafariDialogCompat(),this.rootEl=e;var{}=await google.maps.importLibrary("maps"),{}=await google.maps.importLibrary("places"),e="function"==typeof window.cataMapsTouchPrimaryZoom&&window.cataMapsTouchPrimaryZoom(),t={gestureHandling:e?"cooperative":"greedy",center:new google.maps.LatLng(42.73386,-84.555363),zoom:12,scrollwheel:e,disableDefaultUI:!0,zoomControl:!0,zoomControlOptions:{position:google.maps.ControlPosition.RIGHT_CENTER}},i=this.rootEl&&this.rootEl.querySelector("[data-map-canvas]")||document.getElementById("map");this.mapCtrl=new google.maps.Map(i,t),!e&&i&&i.addEventListener("wheel",e=>{e.ctrlKey?this.mapCtrl.setOptions({scrollwheel:!0}):this.mapCtrl.setOptions({scrollwheel:!1})},{passive:!0}),this.directionsService=new google.maps.DirectionsService,this.directionsDisplay=new google.maps.DirectionsRenderer,this.directionsDisplay.setMap(this.mapCtrl),this.initializeControls(),this.readHashParams(),this.setTodaysDate(),this.renderHeadingMarkers()},toggleMapPanel(){this.mapPanelOpen=!this.mapPanelOpen},readHashParams(){var e=window.location.hash.substring(1),e=new URLSearchParams(e),t=document.getElementById("start"),i=document.getElementById("end");e.get("start")&&e.get("end")&&t&&i?(this.showLoading=!0,t.value=e.get("start"),i.value=e.get("end"),"true"===e.get("startIsPlace")&&(this.startLocation={place_id:e.get("startId")}
1),"true"===e.get("endIsPlace")&&(this.endLocation={place_id:e.get("endId")}),e.get("date")&&e.get("time")&&e.get("departOrArival")?(t=e.get("date").split("-"),i=e.get("time").split("-"),this.date=t[0]+"/"+t[1]+"/"+t[2],this.time=i[0]+":"+i[1]+" "+i[2],this.departOrArival=e.get("departOrArival")):this.setTodaysDate(),this.planTrip()):this.setTodaysDate()},updateHashParams(){var e=new URLSearchParams,t=document.getElementById("start"),i=document.getElementById("end");e.set("start",t&&t.value||""),e.set("end",i&&i.value||""),e.set("startIsPlace",this.startLocation.place_id?"true":"false"),e.set("endIsPlace",this.endLocation.place_id?"true":"false"),e.set("startId",this.startLocation.place_id||""),e.set("endId",this.endLocation.place_id||""),e.set("date",this.date||""),e.set("time",this.time||""),e.set("departOrArival",this.departOrArival||""),window.location.hash=e.toString()},setTodaysDate(){var e=new Date,t=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),e=e.getFullYear();this.date=t+`/${i}/`+e},initializeControls(){var e,t=document.getElementById("directions-panel"),t=(t&&(i={childList:!0},new MutationObserver(e=>{document.querySelectorAll(".adp-placemark").forEach(e=>e.setAttribute("tabindex","0")),document.querySelectorAll("ol li").forEach(t=>{t.setAttribute("tabindex","0"),t.addEventListener("keydown",e=>{32==e.keyCode&&t.click()})}),document.querySelectorAll(".adp-directions tr").forEach(e=>e.setAttribute("tabindex","0"))}).observe(t,i)),new MutationObserver(e=>{document.querySelectorAll("img[src='https://maps.gstatic.com/mapfiles/api-3/images/mapcnt6.png']").forEach(e=>{e=e.parentElement;e&&e.setAttribute("tabindex","0")})})),i=this.rootEl&&this.rootEl.querySelector("[data-map-canvas]")||document.getElementById("map"),t=(i&&t.observe(i,{childList:!0,attributes:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["class","style"]}),this.rootEl?this.rootEl.querySelector("#start"):document.getElementById("start")),i=this.rootEl?this.rootEl.querySelector("#end"):document.getElementById("end");t&&i&&(e={componentRestrictions:{country:"us"},bounds:new google.maps.LatLngBounds(new google.maps.LatLng(42.55149,-84.843212),new google.maps.LatLng(42.859113,-84.269351))},this.startAutoComplete=new google.maps.places.Autocomplete(t,e),this.endAutoComplete=new google.maps.places.Autocomplete(i,e),google.maps.event.addListener(this.startAutoComplete,"place_changed",this.setStartFromAutoComplete.bind(this)),google.maps.event.addListener(this.endAutoComplete,"place_changed",this.setEndFromAutoComplete.bind(this))),this.placeService=new google.maps.places.PlacesService(this.mapCtrl)},renderHeadingMarkers(){if(this.rootEl&&"true"===this.rootEl.dataset.mapGeocodeHeadings&&this.mapCtrl&&google.maps&&google.maps.Geocoder){var t=Array.from(this.rootEl.querySelectorAll(".map-card-sub-heading")).map(e=>(e.textContent||"").trim()).filter((e,t,i)=>""!==e&&i.indexOf(e)===t);if(t.length){let e=new google.maps.Geocoder,r=new google.maps.LatLngBounds,a=0;t.forEach(i=>{e.geocode({address:i},(t,e)=>{if("OK"===e&&t&&t[0]){let e=new google.maps.Marker({map:this.mapCtrl,position:t[0].geometry.location,title:i});e.addListener("click",()=>{new google.maps.InfoWindow({content:`<div>${i}</div>`}).open(this.mapCtrl,e)}),r.extend(t[0].geometry.location),1===(a+=1)?(this.mapCtrl.setCenter(t[0].geometry.location),this.mapCtrl.setZoom(13)):this.mapCtrl.fitBounds(r)}})})}}},setStartFromAutoComplete(){this.startLocation=this.startAutoComplete.getPlace()},setEndFromAutoComplete(){this.endLocation=this.endAutoComplete.getPlace()},setStartFromCurrentLocation(e){this.startLocation=e,document.getElementById("start").value=e,this.startLocation={}},setEndFromCurrentLocation(e){this.endLocation=e,document.getElementById("end").value=e,this.endLocation={}},clearStartLocation(){this.startLocation={}},clearEndLocation(){this.endLocation={}},getCurrentPosition(r){navigator.geolocation?navigator.geolocation.getCurrentPosition(i=>{var e={query:(this.currentPosition=i).coords.latitude+", "+i.coords.longitude};this.placeService.textSearch(e,(e,t)=>{t==google.maps.places.PlacesServiceStatus.OK?r(e[0].formatted_address):r(i.coords.latitude+", "+i.coords.longitude)})},()=>{this.showLoading=!1,this.showGeoMessage=!0}):(this.showLoading=!1,this.showGeoMessage=!0)},validateTime(){var e,t;(!this.time||""===this.time)&&(e=new Date,(t=new Date(this.date)).toDateString)&&t.toDateString()!=e.toDateString()?this.timeRequired=!0:this.timeRequired=!1},planTrip(){if(!this.timeRequired){var e=document.getElementById("start"),t=document.getElementById("end");if(e&&t){let i=e.value,r=t.value,a=(this.startLocation.place_id&&(i={placeId:this.startLocation.place_id}),this.endLocation.place_id&&(r={placeId:this.endLocation.place_id}),this.startLocation),o=this.endLocation;i.placeId&&r.placeId?(this.trackTrip(a,o),this.getDirections(i,r)):i.placeId?(e={location:new google.maps.LatLng(42.73386,-84.555363),radius:"50000",keyword:r},this.placeService.nearbySearch(e,(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&(r={placeId:e[0].place_id},o=e[0]),this.trackTrip(a,o),this.getDirections(i,r)})):(t={location:new google.maps.LatLng(42.73386,-84.555363),radius:"50000",keyword:i},this.placeService.nearbySearch(t,(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&(i={placeId:e[0].place_id},a=e[0]),r.placeId?(this.trackTrip(a,o),this.getDirections(i,r)):(t={location:new google.maps.LatLng(42.73386,-84.555363),radius:"50000",keyword:r},this.placeService.nearbySearch(t,(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&(r={placeId:e[0].place_id},o=e[0]),this.trackTrip(a,o),this.getDirections(i,r)}))}))}}},getDirections(t,i){this.showLoading=!0;t={origin:t,destination:i,travelMode:google.maps.TravelMode.TRANSIT,provideRouteAlternatives:!this.wheelChair};if(this.date&&""!==this.date&&this.time&&""!==this.time){let e={};var r=new Date(this.date+" "+this.time);e="Arrive"==this.departOrArival?{arrivalTime:r}:{departureTime:r},0<Object.keys(e).length&&(t.transitOptions=e)}""!==this.routeOptions&&(t.transitOptions?t.transitOptions.routingPreference=this.routeOptions:t.transitOptions={routingPreference:this.routeOptions}),this.directionsService.route(t,(r,e)=>{if(this.tripOnDifferentDate=!1,this.tripOnDifferentDateMessage="",e==google.maps.DirectionsStatus.OK){if(this.date&&this.time&&""!==this.date&&""!==this.time&&r.routes[0].legs[0].departure_time&&new Date(this.date).getDate()!==r.routes[0].legs[0].departure_time.value.getDate()&&(this.tripOnDifferentDateMessage="This trip departs on "+r.routes[0].legs[0].departure_time.value.toDateString(),this.tripOnDifferentDate=!0),this.wheelChair){let t;
1r.routes[0].legs[0].steps.forEach(e=>{e.transit&&!t&&(t=e.transit)}),this.checkADACompliance(t,i,r)}else this.adaSearchTried=!1,this.noTripsFound=!1,this.showLoading=!1;for(let i=0;i<r.routes.length;i++){let t=r.routes[i].legs[0].departure_time.value;var a=[];for(let e=0;e<r.routes[i].legs[0].steps.length;e++){var o=r.routes[i].legs[0].steps[e],s=new Date(t.getTime()+1e3*o.duration.value);a.push({travelMode:o.travel_mode,duration:o.duration.text,departure:t.toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0,timeZone:"America/Los_Angeles"}),arrival:s.toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0,timeZone:"America/Los_Angeles"}),distance:o.distance.text,description:o.instructions,transitType:("WALKING"===o.travel_mode?o.travel_mode:o.transit.line.vehicle.type).toLowerCase(),transitName:"TRANSIT"==o.travel_mode?o.transit.line.short_name:"",transitColor:"TRANSIT"==o.travel_mode?o.transit.line.color:"",index:e}),t=s}var n={departureTime:r.routes[i].legs[0].departure_time.text,arrivalTime:r.routes[i].legs[0].arrival_time.text,totalTime:r.routes[i].legs[0].duration.text,destination:r.routes[i].legs[0].end_address,steps:a,isActive:0===i,isOpen:!1,index:i};this.noTripsFound2=!0,this.routes.push(n)}console.log(this.routes,"kapil")}else this.noTripsFound2=!1,this.noTripsFound=!0,console.log(this.noTripsFound2,"kapil")})},async checkADACompliance(e,r,t){var a,e=`${this.proxyApi}getbestadamatch&stopname=${encodeURIComponent(e.departure_stop.name)}&routeid=${e.line.short_name}&d=`+e.headsign;try{let i=await(await fetch(e)).json();i.IsADA?(this.adaSearchTried=!1,this.noTripsFound=!1,t&&(this.directionsDisplay.setDirections(t),this.directionsDisplay.setMap(this.mapCtrl)),this.showLoading=!1):this.adaSearchTried||!i.Stop?(this.adaSearchTried=!1,this.noTripsFound=!0,this.directionsDisplay.setDirections({routes:[]}),this.directionsDisplay.setMap(this.mapCtrl),this.mapCtrl.setZoom(12),this.showLoading=!1):(this.adaSearchTried=!0,a={query:i.Stop.Latitude+", "+i.Stop.Longitude},this.placeService.textSearch(a,(e,t)=>{t==google.maps.places.PlacesServiceStatus.OK?(this.startLocation=e[0],(t=document.getElementById("start"))&&(t.value=e[0].name),this.getDirections({query:i.Stop.Latitude+", "+i.Stop.Longitude},r)):this.getDirections(i.Stop.Latitude+", "+i.Stop.Longitude,r)}))}catch(e){console.error("Error checking ADA compliance:",e),this.showLoading=!1}},trackTrip(e,t){},reverseDirection(){var e,t,i,r,a=document.getElementById("start"),o=document.getElementById("end");a&&o&&(e=a.value,t=o.value,i=this.startLocation,r=this.endLocation,a.value=t,o.value=e,this.startLocation=r,this.endLocation=i,""!=e)&&""!=t&&this.planTrip()},getShowLoading(){return this.showLoading}}}function PlannerApp(){let i={Accept:"application/json","X-API-KEY":"sk_live_SOdoS2lNrADb82dOIDtRcz_t33L3Zx0t"},a="__cataRoutesIndexCache_v1";return{ensureSafariDialogCompat(){function e(){}void 0===window.HTMLDialogElement&&((e.prototype=window.HTMLElement&&window.HTMLElement.prototype||{}).show||(e.prototype.show=function(){}),e.prototype.showModal||(e.prototype.showModal=function(){}),e.prototype.close||(e.prototype.close=function(){}),window.HTMLDialogElement=e)},_didInit:!1,currentPosition:{},startLocation:"",endLocation:"",departOrArival:"Depart",mapPanelOpen:!0,showLoading:!1,showGeoMessage:!1,date:"",time:"",timeRequired:!1,selectedScheduleRoute:null,selectedScheduleRouteCode:"",selectedScheduleDirection:"0",routeSearchTerm:"",routeSearchResults:[],isRouteSearchOpen:!1,routeSearchActiveIndex:-1,scheduleRoutes:[],scheduleRouteDetailsCache:{},scheduleDirections:[{value:"0",label:"Outbound"},{value:"1",label:"Inbound"}],async init(){this.ensureSafariDialogCompat(),this._didInit||(this._didInit=!0,await google.maps.importLibrary("maps"),await google.maps.importLibrary("places"),this.initializeControls(),this.date||this.setTodaysDate(),this.syncDateInputBounds(),await this.loadScheduleRoutes())},toggleMapPanel(){this.mapPanelOpen=!this.mapPanelOpen},getDetroitNowParts(){let e=new Intl.DateTimeFormat("en-US",{timeZone:"America/Detroit",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date);var t=t=>Number(e.find(e=>e.type===t)?.value||0);return{year:t("year"),month:t("month"),day:t("day"),hour:t("hour"),minute:t("minute")}},getDetroitTodayIso(){var e=this.getDetroitNowParts();return`${String(e.year).padStart(4,"0")}-${String(e.month).padStart(2,"0")}-`+String(e.day).padStart(2,"0")},setTodaysDate(){this.date=this.getDetroitTodayIso()},normalizeDateToIso(e){var t,i,r;return e?(r=(e=String(e).trim()).match(/^(\d{4})-(\d{2})-(\d{2})$/))?`${r[1]}-${r[2]}-`+r[3]:(r=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/))?(t=r[1].padStart(2,"0"),i=r[2].padStart(2,"0"),r[3]+`-${t}-`+i):(r=e.match(/^(\d{4})\/(\d{2})\/(\d{2})$/))?`${r[1]}-${r[2]}-`+r[3]:e:""},syncDateInputBounds(e=null){e=e||("undefined"!=typeof document?document.getElementById("select-trip-date"):null);e&&(e.removeAttribute("min"),e.removeAttribute("max"))},async loadScheduleRoutes(){try{window[a]||(window[a]=fetch("https://cata.alerts.api.exemplifi.io/api/v1/routes",{headers:i}).then(e=>e.json()).catch(()=>[]));var e=await window[a],t=Array.isArray(e)?e:[];let r=new Map;
1t.forEach(e=>{var t,i;e&&e.shortName&&!1!==e.isActive&&(t=String(e.shortName).trim().toLowerCase())&&(!r.has(t)||(i=r.get(t),String(i?.longName||"").trim().length<String(e?.longName||"").trim().length))&&r.set(t,e)}),this.scheduleRoutes=Array.from(r.values()).sort((e,t)=>String(e.shortName).localeCompare(String(t.shortName),void 0,{numeric:!0})),this.routeSearchResults=this.scheduleRoutes.slice(0,20),this.isRouteSearchOpen=!1,this.routeSearchActiveIndex=-1}catch(e){this.scheduleRoutes=[],this.routeSearchResults=[],this.isRouteSearchOpen=!1,this.routeSearchActiveIndex=-1}},filterRouteResults(){let i=String(this.routeSearchTerm||"").trim().toLowerCase();i?this.routeSearchResults=this.scheduleRoutes.filter(e=>{var t=String(e.shortName||"").toLowerCase(),e=String(e.longName||"").toLowerCase();return t.includes(i)||e.includes(i)}).slice(0,50):this.routeSearchResults=this.scheduleRoutes.slice(0,50),this.isRouteSearchOpen=0<this.routeSearchResults.length,this.routeSearchActiveIndex=0<this.routeSearchResults.length?0:-1},openRouteSearch(){let i=String(this.routeSearchTerm||"").trim().toLowerCase();i?this.routeSearchResults=this.scheduleRoutes.filter(e=>{var t=String(e.shortName||"").toLowerCase(),e=String(e.longName||"").toLowerCase();return t.includes(i)||e.includes(i)}).slice(0,50):this.routeSearchResults=this.scheduleRoutes.slice(0,50),this.isRouteSearchOpen=0<this.routeSearchResults.length,this.routeSearchActiveIndex=0<this.routeSearchResults.length?0:-1},closeRouteSearch(){this.isRouteSearchOpen=!1,this.routeSearchActiveIndex=-1},handleRouteSearchKeydown(e){var t;0<this.routeSearchResults.length&&("ArrowDown"===e.key?(e.preventDefault(),this.isRouteSearchOpen=!0,this.routeSearchActiveIndex=(this.routeSearchActiveIndex+1)%this.routeSearchResults.length):"ArrowUp"===e.key?(e.preventDefault(),this.isRouteSearchOpen=!0,this.routeSearchActiveIndex=(this.routeSearchActiveIndex-1+this.routeSearchResults.length)%this.routeSearchResults.length):"Enter"===e.key&&this.isRouteSearchOpen?(e.preventDefault(),(t=this.routeSearchResults[this.routeSearchActiveIndex])&&this.selectScheduleRoute(t)):"Escape"===e.key&&this.closeRouteSearch())},async selectScheduleRoute(e){e&&(this.selectedScheduleRoute=e,this.selectedScheduleRouteCode=String(e.shortName||""),this.routeSearchTerm=e.shortName+" - "+(e.longName||""),this.routeSearchResults=[],this.selectedScheduleDirection="0",this.isRouteSearchOpen=!1,this.routeSearchActiveIndex=-1)},validateDateInput(){this.date&&(this.date=this.normalizeDateToIso(this.date)),this.syncDateInputBounds()},goToScheduleSearch(){var e;this.selectedScheduleRoute&&(e=String(this.selectedScheduleRoute.shortName||"").trim())&&(e="route="+encodeURIComponent(e),window.location.href="/find-bus-by-schedule#"+e)},goToPopularRoute(t){var e=this.scheduleRoutes.find(e=>String(e.shortName)===String(t));e&&(this.selectedScheduleRoute=e,this.selectedScheduleRouteCode=String(e.shortName||""),this.routeSearchTerm=e.shortName+" - "+(e.longName||""),e=String(e.shortName||"").trim())&&(e="route="+encodeURIComponent(e),window.location.href="/find-bus-by-schedule#"+e)},getPopularRouteHref(t){var e=this.scheduleRoutes.find(e=>String(e.shortName)===String(t));return(e=e&&String(e.shortName||"").trim())?"/find-bus-by-schedule#"+("route="+encodeURIComponent(e)):"#"},initializeControls(){let b=new google.maps.places.AutocompleteService;let w={bounds:new google.maps.LatLngBounds(new google.maps.LatLng(42.55149,-84.843212),new google.maps.LatLng(42.859113,-84.269351)),componentRestrictions:{country:"us"}};var e=(a,t)=>{let o=document.getElementById(a);if(!o)return;let i=o.closest(".select-container")||o.parentElement||document.body;var e=a+"-places-listbox",r=a+"-places-status";let s=document.getElementById(e),n=(s||((s=document.createElement("div")).id=e,s.setAttribute("role","listbox"),s.setAttribute("aria-label","start"===a?"From address suggestions":"To address suggestions"),s.className="places-suggestions-listbox",s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="100%",s.style.zIndex="9999",s.style.display="none",i.style.position=i.style.position||"relative",i.appendChild(s)),document.getElementById(r)),l=(n||((n=document.createElement("div")).id=r,n.className="visually-hidden",n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),i.appendChild(n)),o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-controls",e),o.setAttribute("aria-expanded","fal
1se"),o.setAttribute("aria-haspopup","listbox"),o.setAttribute("aria-describedby",[o.getAttribute("aria-describedby"),r].filter(Boolean).join(" ")),[]),d=-1,c=0,u=!1,h=!1,p=()=>{l=[],d=-1,s.innerHTML="",s.style.display="none",o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant")},m=()=>{l.length&&(s.style.display="block",o.setAttribute("aria-expanded","true"))},g=()=>{s.innerHTML="",l.forEach((e,t)=>{var i=document.createElement("div");i.id=a+"-places-option-"+t,i.setAttribute("role","option"),i.setAttribute("aria-selected",t===d?"true":"false"),i.className="places-suggestion-option",i.style.cursor="pointer",i.textContent=e.description||"",t===d&&(i.style.backgroundColor="#f2f4f7"),i.addEventListener("mousedown",e=>{h=!0,e.preventDefault()}),i.addEventListener("click",()=>{v(t)}),s.appendChild(i)})},f=()=>{0<=d?(o.setAttribute("aria-activedescendant",a+"-places-option-"+d),(r=l[d])&&n&&(n.textContent=`${d+1} of ${l.length}: `+r.description)):(o.removeAttribute("aria-activedescendant"),l.length&&"none"!==s.style.display&&n&&(n.textContent=l.length+" suggestions available. Use Down Arrow to review."));var e,t,i,r=document.getElementById(a+"-places-option-"+d);r&&"none"!==s.style.display&&(r=(e=r.offsetTop)+r.offsetHeight,i=(t=s.scrollTop)+s.clientHeight,e<t&&(s.scrollTop=e),i<r)&&(s.scrollTop=r-s.clientHeight)},v=e=>{e=l[e];e&&(u=!0,o.value=e.description||o.value,t(e.place_id,e.description||""),n.textContent=`Selected: ${e.description||"location"}.`,p(),queueMicrotask(()=>{u=!1}))},y=null,S=()=>{var e=(o.value||"").trim();if(e.length<2)p();else{let i=++c;e={...w,input:e};google?.maps?.places?.AutocompleteSessionToken&&(e.sessionToken=new google.maps.places.AutocompleteSessionToken),b.getPlacePredictions(e,(e,t)=>{i===c&&(t===google.maps.places.PlacesServiceStatus.OK&&Array.isArray(e)&&(l=e.slice(0,8),d=-1,g(),l.length)?(n.textContent=l.length+" suggestions available. Use Down Arrow to review.",m):p)()})}};o.addEventListener("input",()=>{u?u=!1:("start"===a?this.startLocation={}:"end"===a&&(this.endLocation={}),clearTimeout(y),y=setTimeout(S,150))}),o.addEventListener("keydown",e=>{var t=e.key;return"ArrowDown"===t?l.length?(e.preventDefault(),m(),d=Math.min(l.length-1,d+1),g(),void f()):void S():"ArrowUp"===t?l.length?(e.preventDefault(),m(),d<=0?d=-1:d-=1,g(),void f()):void 0:void("Enter"===t?0<=d&&(e.preventDefault(),v(d)):"Escape"===t?"none"!==s.style.display&&(e.preventDefault(),p()):"Tab"===t&&p())}),o.addEventListener("blur",()=>{h?h=!1:setTimeout(()=>{var e=document.activeElement;e&&i.contains(e)||p()},120)}),document.addEventListener("mousedown",e=>{e=e.target;e instanceof Element&&(i.contains(e)||p())})};e("start",e=>{this.startLocation={place_id:e}}),e("end",e=>{this.endLocation={place_id:e}})},setStartFromCurrentLocation(e){this.startLocation=e,document.getElementById("start").value=e,this.startLocation={}},setEndFromCurrentLocation(e){this.endLocation=e,document.getElementById("end").value=e,this.endLocation={}},clearStartLocation(){this.startLocation={}},clearEndLocation(){this.endLocation={}},getCurrentPosition(r){navigator.geolocation?navigator.geolocation.getCurrentPosition(i=>{this.currentPosition=i,(new google.maps.Geocoder).geocode({location:{lat:i.coords.latitude,lng:i.coords.longitude}},(e,t)=>{"OK"===t&&e&&e[0]?r(e[0].formatted_address):r(i.coords.latitude+", "+i.coords.longitude)})},()=>{this.showLoading=!1,this.showGeoMessage=!0}):(this.showLoading=!1,this.showGeoMessage=!0)},validateTime(){var e,t;this.time&&""!==this.time?this.timeRequired=!1:(e=this.normalizeDateToIso(this.date),t=this.getDetroitTodayIso(),this.timeRequired=!(!e||e===t))},updateRouteOptions(){var e=document.getElementById("start"),t=document.getElementById("end");e&&t&&e.value&&t.value&&this.goToTripPlanner()},planTrip(){this.timeRequired||this.goToTripPlanner()},goToTripPlanner(){var e=document.getElementById("select-trip-date"),t=document.getElementById("transitTime"),e=(e&&e.value?this.date=this.normalizeDateToIso(e.value):this.date&&(this.date=this.normalizeDateToIso(this.date)),t&&t.value&&(this.time=t.value),this.saveTripFormToLocalStorage(),document.getElementById("start")?document.getElementById("start").value:""),t=document.getElementById("end")?document.getElementById("end").value:"",i=new URLSearchParams,e=(e&&i.set("start",e),t&&i.set("end",t),this.startLocation&&this.startLocation.place_id&&(i.set("startIsPlace","true"),i.set("startId",this.startLocation.place_id)),this.endLocation&&this.endLocation.place_id&&(i.set("endIsPlace","true"),i.set("endId",this.endLocation.place_id)),this.date&&i.set("date",this.date),this.time&&i.set("time",this.time),this.departOrArival&&i.set("departOrArival",this.departOrArival),i.toString());window.location.href="/rider-tools/trip-planner"+(e?"#"+e:"")},reverseDirection(e=!1){var t=document.getElementById("start").value,i=document.getElementById("end").value,r=this.startLocation,a=this.endLocation;document.getElementById("start").value=i,document.getElementById("end").value=t,this.startLocation=a,this.endLocation=r,e&&""!=t&&""!=i&&this.goToTripPlanner()},getShowLoading(){return this.showLoading},saveTripFormToLocalStorage(){try{var e={leavingFrom:document.getElementById("start")?document.getElementById("start").value:"",directionTo:document.getElementById("end")?document.getElementById("end").value:"",fromDate:this.normalizeDateToIso(this.date||""),time:this.time||"",departOrArival:this.departOrArival||"Depart"};window.localStorage.setItem("cataTripPlannerForm",JSON.stringify(e))}catch(e){console.error("Error saving trip form to localStorage",e)}}}}((e,t)=>{"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exp
1orts.AOS=t():e.AOS=t()})(this,function(){return r=[function(e,t,i){function r(e){return e&&e.__esModule?e:{default:e}}function a(){m=(0,p.default)(),y()}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},s=(r(i(1)),i(6)),n=r(s),l=r(i(7)),d=r(i(8)),c=r(i(9)),u=r(i(10)),h=r(i(11)),p=r(i(14)),m=[],g=!1,f=document.all&&!window.atob,v={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,startEvent:"DOMContentLoaded",throttleDelay:99,debounceDelay:50,disableMutationObserver:!1},y=function(){if(g=0<arguments.length&&void 0!==arguments[0]&&arguments[0]?!0:g)return m=(0,h.default)(m,v),(0,u.default)(m,v.once),m};e.exports={init:function(e){return v=o(v,e),m=(0,p.default)(),!0===(e=v.disable)||"mobile"===e&&c.default.mobile()||"phone"===e&&c.default.phone()||"tablet"===e&&c.default.tablet()||"function"==typeof e&&!0===e()||f?void m.forEach(function(e,t){e.node.removeAttribute("data-aos"),e.node.removeAttribute("data-aos-easing"),e.node.removeAttribute("data-aos-duration"),e.node.removeAttribute("data-aos-delay")}):(document.querySelector("body").setAttribute("data-aos-easing",v.easing),document.querySelector("body").setAttribute("data-aos-duration",v.duration),document.querySelector("body").setAttribute("data-aos-delay",v.delay),"DOMContentLoaded"===v.startEvent&&-1<["complete","interactive"].indexOf(document.readyState)?y(!0):("load"===v.startEvent?window:document).addEventListener(v.startEvent,function(){y(!0)}),window.addEventListener("resize",(0,l.default)(y,v.debounceDelay,!0)),window.addEventListener("orientationchange",(0,l.default)(y,v.debounceDelay,!0)),window.addEventListener("scroll",(0,n.default)(function(){(0,u.default)(m,v.once)},v.throttleDelay)),v.disableMutationObserver||(0,d.default)("[data-aos]",a),m)},refresh:y,refreshHard:a}},function(e,t){},,,,,function(m,e){!function(e){function o(r,i,e){function a(e){var t=l,i=d;return l=d=void 0,m=e,u=r.apply(i,t)}function o(e){var t=e-p;return void 0===p||i<=t||t<0||f&&c<=e-m}function s(){var e,t=T();return o(t)?n(t):void(h=setTimeout(s,(e=i-((t=t)-p),f?_(e,c-(t-m)):e)))}function n(e){return h=void 0,v&&l?a(e):(l=d=void 0,u)}function t(){var e=T(),t=o(e);if(l=arguments,d=this,p=e,t){if(void 0===h)return m=e=p,h=setTimeout(s,i),g?a(e):u;if(f)return h=setTimeout(s,i),a(p)}return void 0===h&&(h=setTimeout(s,i)),u}var l,d,c,u,h,p,m=0,g=!1,f=!1,v=!0;if("function"!=typeof r)throw new TypeError(b);return i=S(i)||0,y(e)&&(g=!!e.leading,f="maxWait"in e,c=f?w(S(e.maxWait)||0,i):c,v="trailing"in e?!!e.trailing:v),t.cancel=function(){void 0!==h&&clearTimeout(h),l=p=d=h=void(m=0)},t.flush=function(){return void 0===h?u:n(T())},t}function y(e){var t=void 0===e?"undefined":r(e);return e&&("object"==t||"function"==t)}function i(e){return"symbol"==(void 0===e?"undefined":r(e))||!!(t=e)&&"object"==(void 0===t?"undefined":r(t))&&p.call(e)==s;var t}function S(e){if("number"==typeof e)return e;if(i(e))return a;if("string"!=typeof(e=y(e)?y(t="function"==typeof e.valueOf?e.valueOf():e)?t+"":t:e))return 0===e?e:+e;e=e.replace(n,"");var t=d.test(e);return t||c.test(e)?u(e.slice(2),t?2:8):l.test(e)?a:+e}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b="Expected a function",a=NaN,s="[object Symbol]",n=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt,e="object"==(void 0===e?"undefined":r(e))&&e&&e.Object===Object&&e,t="object"==("undefined"==typeof self?"undefined":r(self))&&self&&self.Object===Object&&self,h=e||t||Function("return this")(),p=Object.prototype.toString,w=Math.max,_=Math.min,T=function(){return h.Date.now()};m.exports=function(e,t,i){var r=!0,a=!0;if("function"!=typeof e)throw new TypeError(b);return y(i)&&(r="leading"in i?!!i.leading:r,a="trailing"in i?!!i.trailing:a),o(e,t,{leading:r,maxWait:t,trailing:a})}}.call(e,function(){return this}())},function(p,e){!function(e){function y(e){var t=void 0===e?"undefined":r(e);return e&&("object"==t||"function"==t)}
1function i(e){return"symbol"==(void 0===e?"undefined":r(e))||!!(t=e)&&"object"==(void 0===t?"undefined":r(t))&&h.call(e)==o;var t}function S(e){if("number"==typeof e)return e;if(i(e))return a;if("string"!=typeof(e=y(e)?y(t="function"==typeof e.valueOf?e.valueOf():e)?t+"":t:e))return 0===e?e:+e;e=e.replace(s,"");var t=l.test(e);return t||d.test(e)?c(e.slice(2),t?2:8):n.test(e)?a:+e}function b(){return u.Date.now()}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=NaN,o="[object Symbol]",s=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,d=/^0o[0-7]+$/i,c=parseInt,e="object"==(void 0===e?"undefined":r(e))&&e&&e.Object===Object&&e,t="object"==("undefined"==typeof self?"undefined":r(self))&&self&&self.Object===Object&&self,u=e||t||Function("return this")(),h=Object.prototype.toString,w=Math.max,_=Math.min;p.exports=function(r,i,e){function a(e){var t=l,i=d;return l=d=void 0,m=e,u=r.apply(i,t)}function o(e){var t=e-p;return void 0===p||i<=t||t<0||f&&c<=e-m}function s(){var e,t=b();return o(t)?n(t):void(h=setTimeout(s,(e=i-((t=t)-p),f?_(e,c-(t-m)):e)))}function n(e){return h=void 0,v&&l?a(e):(l=d=void 0,u)}function t(){var e=b(),t=o(e);if(l=arguments,d=this,p=e,t){if(void 0===h)return m=e=p,h=setTimeout(s,i),g?a(e):u;if(f)return h=setTimeout(s,i),a(p)}return void 0===h&&(h=setTimeout(s,i)),u}var l,d,c,u,h,p,m=0,g=!1,f=!1,v=!0;if("function"!=typeof r)throw new TypeError("Expected a function");return i=S(i)||0,y(e)&&(g=!!e.leading,f="maxWait"in e,c=f?w(S(e.maxWait)||0,i):c,v="trailing"in e?!!e.trailing:v),t.cancel=function(){void 0!==h&&clearTimeout(h),l=p=d=h=void(m=0)},t.flush=function(){return void 0===h?u:n(b())},t}}.call(e,function(){return this}())},function(e,t){function r(e){e&&e.forEach(function(e){var t=Array.prototype.slice.call(e.addedNodes),e=Array.prototype.slice.call(e.removedNodes);t.concat(e).filter(function(e){return e.hasAttribute&&e.hasAttribute("data-aos")}).length&&s()})}Object.defineProperty(t,"__esModule",{value:!0});var a=window.document,o=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,s=function(){};t.default=function(e,t){var i=new o(r);s=t,i.observe(a.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}},function(e,t){function i(){return navigator.userAgent||navigator.vendor||window.opera||""}Object.defineProperty(t,"__esModule",{value:!0});var r=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,a=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
1sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,o=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,s=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,n=(function(e,t,i){return t&&d(e.prototype,t),i&&d(e,i),e}(l,[{key:"phone",value:function(){var e=i();return!(!r.test(e)&&!a.test(e.substr(0,4)))}},{key:"mobile",value:function(){var e=i();return!(!o.test(e)&&!s.test(e.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}}]),l);function l(){if(!(this instanceof l))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}t.default=new n},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e,o){var s=window.pageYOffset,n=window.innerHeight;e.forEach(function(e,t){var i,r,a;i=n+s,r=o,a=(e=e).node.getAttribute("data-aos-once"),i>e.position?e.node.classList.add("aos-animate"):void 0===a||"false"!==a&&(r||"true"===a)||e.node.classList.remove("aos-animate")})}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});var i=i(12),r=(i=i)&&i.__esModule?i:{default:i};t.default=function(e,i){return e.forEach(function(e,t){e.node.classList.add("aos-init"),e.position=(0,r.default)(e.node,i.offset)}),e}},function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});var i=i(13),s=(i=i)&&i.__esModule?i:{default:i};t.default=function(e,t){var i=0,r=0,a=window.innerHeight,o={offset:e.getAttribute("data-aos-offset"),anchor:e.getAttribute("data-aos-anchor"),anchorPlacement:e.getAttribute("data-aos-anchor-placement")};switch(o.offset&&!isNaN(o.offset)&&(r=parseInt(o.offset)),o.anchor&&document.querySelectorAll(o.anchor)&&(e=document.querySelectorAll(o.anchor)[0]),i=(0,s.default)(e).top,o.anchorPlacement){case"top-bottom":break;case"center-bottom":i+=e.offsetHeight/2;break;case"bottom-bottom":i+=e.offsetHeight;break;case"top-center":i+=a/2;break;case"bottom-center":i+=a/2+e.offsetHeight;break;case"center-center":i+=a/2+e.offsetHeight/2;break;case"top-top":i+=a;break;case"bottom-top":i+=e.offsetHeight+a;break;case"center-top":i+=e.offsetHeight/2+a}return i+(r=o.anchorPlacement||o.offset||isNaN(t)?r:t)}}
1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e){for(var t=0,i=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-("BODY"!=e.tagName?e.scrollLeft:0),i+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:i,left:t}}},function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e){return e=e||document.querySelectorAll("[data-aos]"),Array.prototype.map.call(e,function(e){return{node:e}})}}],a={},i.m=r,i.c=a,i.p="dist/",i(0);function i(e){var t;return(a[e]||(t=a[e]={exports:{},id:e,loaded:!1},r[e].call(t.exports,t,t.exports,i),t.loaded=!0,t)).exports}var r,a}),window.cataMapsTouchPrimaryZoom=function(){try{if(window.matchMedia("(pointer: coarse)").matches)return!0}catch(e){}if(!("undefined"!=typeof navigator&&navigator.maxTouchPoints||0))return!1;try{if(window.matchMedia("(hover: hover) and (pointer: fine)").matches)return!1}catch(e){}return!0},((e,t)=>{e.behaviors.cataContentSearchLayout={attach(e){t("cata-content-search-move-results",".view-id-content_search .js-content-search-main-slot",e).forEach(e=>{var t=e.closest(".view-id-content_search");t&&(t=t.querySelector(".js-content-search-results-source"))&&!e.contains(t)&&e.appendChild(t)})}}})(Drupal,once),((L,i,l)=>{var x="Slide navigation dots";function I(e){var t=e.find(".right-button-wrap").first();return t.length?{$prev:t.find(".prev-arrow").first(),$next:t.find(".next-arrow").first()}:{$prev:e.find(".prev-arrow").filter(function(){return!L(this).closest(".slick-dots, .slick-dots-wrapper").length}).first(),$next:e.find(".next-arrow").filter(function(){return!L(this).closest(".slick-dots, .slick-dots-wrapper").length}).first()}}function C(e,t){t=t&&t.length?t.find("ul.slick-dots").first():L();return t=!t.length&&e&&e.length?e.find("ul.slick-dots").first():t}var M=6;function k(e,t,i,r,a){a="number"==typeof a&&0<a?a:M;var o,s,e=C(e,t);!e.length||r<1||(t=e.find("li"),r<=a?t.each(function(e){var t=L(this),i=t.find("button");t.removeClass("cata-dots-window-hidden"),r<=e?(t.addClass("cata-dots-window-hidden"),i.length&&(i.attr("aria-hidden","true"),i.attr("tabindex","-1"))):i.length&&i.removeAttr("aria-hidden")}):(o=Math.floor(i/a)*a,(s=Math.min(o+a-1,r-1))-o+1<a&&(o=Math.max(0,s-a+1)),t.each(function(e){var t=L(this),i=t.find("button");r<=e?(t.addClass("cata-dots-window-hidden"),i.length&&(i.attr("aria-hidden","true"),i.attr("tabindex","-1"))):(e=e<o||s<e,t.toggleClass("cata-dots-window-hidden",e),i.length&&(e?(i.attr("aria-hidden","true"),i.attr("tabindex","-1")):i.removeAttr("aria-hidden")))})))}var t="a, button, input, select, textarea, summary, [tabindex], [contenteditable='true'], [contenteditable='']";function r(e){"complete"===document.readyState?e():L(window).one("load",e)}function E(e){e.each(function(){var e=L(this);e.removeAttr("tabindex"),"inert"in document.documentElement&&e.prop("inert",!0),e.find(t).each(function(){var e,t=L(this);t.is("a")?(e=t.attr("href"))&&(t.attr("data-cata-orig-href",e),t.removeAttr("href")):t.is("button")&&t.prop("disabled",!0),t.attr("tabindex","-1")}
1),e.find(".home-carousel-card").removeAttr("tabindex role aria-label")})}function R(e){"inert"in document.documentElement?e.prop("inert",!1):e.removeAttr("inert"),e.removeAttr("tabindex"),e.find(t).each(function(){var e,t=L(this);t.is("a")&&((e=t.attr("data-cata-orig-href"))&&(t.attr("href",e),t.removeAttr("data-cata-orig-href")),t.removeAttr("tabindex")),t.is("button")&&(t.prop("disabled",!1),t.removeAttr("tabindex")),"-1"===t.attr("tabindex")&&t.removeAttr("tabindex")})}i.behaviors.lucideInit={attach:function(e,t){"undefined"!=typeof lucide&&lucide.createIcons()}},i.behaviors.jqueryReady={attach:function(e,t){"undefined"!=typeof jQuery&&jQuery(document).ready(function(){})}},i.behaviors.userLoginFormHeading={attach:function(e){l("userLoginFormHeading","#user-login-form",e).forEach(function(e){var t=document.createElement("h1");t.className="user-login-form__title",t.textContent=i.t("CATA Website Admin Login"),e.insertBefore(t,e.firstChild)})}},i.behaviors.successStoriesSlider={attach:function(e,t){r(function(){l("successStoriesSlider",".success-stories",e).forEach(function(e){var v,y,S,b,w,_,T,D=L(e);function A(e,t){e=(e.find("h1,h2,h3,h4,h5,h6").first().text()||"").trim()||(e.find(".btn-text_heading").first().text()||"").trim();return e||"Slide "+(t+1)}function r(e,t,i){i=void 0!==i&&i;var a,r,o,s,n,l,d,c,u,h,p,m=D.find(".item"),g=m.not(".slick-cloned"),f=g.length||D.find(".item").not(".slick-cloned").length||b;f&&(u=g.filter(".slick-current").first(),(a=u.length?g.index(u):-1)<0&&(u=(e&&"number"==typeof e.slideCount&&0<e.slideCount?e.slideCount:f)||f,f<=(a="number"==typeof t&&u?(t%u+u)%u:0))&&(a%=f),e=a,a=!(t=f)||t<1?0:(e=((e="number"==typeof e&&isFinite(e)?Math.floor(e):0)%t+t)%t,Math.min(Math.max(e,0),t-1)),m.filter(".slick-cloned").each(function(){var e=L(this);e.attr("aria-hidden","true"),e.attr("role","presentation"),e.removeAttr("aria-label"),e.removeAttr("aria-roledescription"),e.removeAttr("aria-setsize"),e.removeAttr("aria-posinset"),E(e)}),g.each(function(e){var t=L(this),i=e===a,r=A(t,e);t.attr("aria-label","Slide "+(e+1)+" "+T+" "+r),t.attr("aria-hidden",i?"false":"true"),t.removeAttr("aria-setsize"),t.removeAttr("aria-posinset"),t.removeAttr("tabindex"),i?(R(t),(e=t.find(".home-carou
1sel-card")).attr("tabindex","0"),e.attr("role","article"),e.attr("aria-label","Slide "+(a+1)+" "+T+" "+r)):E(t)}),u=f?(a-1+f)%f:0,e=f?(a+1)%f:0,t=A(g.eq(u),u),m=A(g.eq(e),e),r=g.eq(u).attr("id")||"",o=g.eq(e).attr("id")||"",h=(s=I(v)).$prev,s=s.$next,h.length&&(h.attr("aria-label","Go to previous slide "+T+" "+t+" (slide "+(1+u)+" of "+f+")"),r)&&h.attr("aria-controls",r),s.length&&(s.attr("aria-label","Go to next slide "+T+" "+m+" (slide "+(1+e)+" of "+f+")"),o)&&s.attr("aria-controls",o),n=a,l=g,d=f,S&&S.nodeType&&((c=L(S)).attr("role","region"),c.attr("aria-labelledby")||c.attr("aria-label",x)),(c=C(v,D)).length&&((t=c.closest(".slick-dots-wrapper")).length&&!t.attr("aria-labelledby")&&(t.attr("role","region"),t.attr("aria-label",x)),c.attr("role","tablist"),c.attr("aria-labelledby")||c.attr("aria-label",x)),c.find("li").each(function(e){var t,i,r=L(this),a=r.find("button");!a.length||d<=e||(t=(i=l.eq(e)).length?A(i,e):"Slide "+(e+1),i=i.attr("id")||"",r.attr("role","presentation"),a.attr("role","tab"),a.attr("aria-label",(r=e===n)?"Current slide "+T+" "+t+" (slide "+(e+1)+" of "+d+")":"Go to slide "+T+" "+t+" (slide "+(e+1)+" of "+d+")"),i?a.attr("aria-controls",i):a.removeAttr("aria-controls"),a.attr("aria-selected",r?"true":"false"),a.attr("aria-current",r?"true":"false"),a.attr("tabindex",r?"0":"-1"))}),k(v,D,a,f,M),u=!!(v&&v.length&&v.get(0)&&v.get(0).contains(document.activeElement)),y&&y.length&&u&&!document.body.classList.contains("modal-overlay-open")?(y.attr("aria-live","polite"),h=A(g.eq(a),a),y.text("Slide "+(a+1)+" of "+f+" "+T+" "+h)):y&&y.length&&y.attr("aria-live","off"),i)&&w&&"keyboard"===_&&(p=D.find(".slick-current .home-carou
1sel-card")).length&&setTimeout(function(){var t=p.get(0);if(t)try{t.focus({preventScroll:!0})}catch(e){t.focus()}},100)}D.length&&!D.hasClass("slick-initialized")&&(E(D.find(".item").filter("[aria-hidden='true']")),v=D.closest("section, .home-slider-wrapper, .full-image-slider-section").first(),(y=v.find(".carousel-live-region").first())&&y.length&&y.attr("aria-live","off"),(S=v.find("[id^='slick-dots-wrapper-'].slick-dots-wrapper").get(0)||v.find(".slick-dots-wrapper").get(0)||D.parent().find(".slick-dots-wrapper").get(0))&&L(S).empty(),b=D.find(".item").not(".slick-cloned").length||D.find(".item").length,w=!1,_=null,T="â",D.on("init reInit breakpoint",function(e,t){r(t,t&&"number"==typeof t.currentSlide?t.currentSlide:0,!1)}),D.slick({centerMode:!0,centerPadding:"220px",slidesToShow:1,autoplay:!1,autoplaySpeed:4e3,variableWidth:!1,speed:2e3,arrows:!1,infinite:!0,dots:!0,adaptiveHeight:!0,appendDots:S,accessibility:!1,responsive:[{breakpoint:768,settings:{arrows:!1,centerMode:!0,centerPadding:"40px",slidesToShow:1,dots:!0,infinite:!0,appendDots:S}},{breakpoint:480,settings:{arrows:!1,centerPadding:"0px",centerMode:!0,slidesToShow:1,dots:!0,infinite:!0,appendDots:S}}]}),setTimeout(function(){var e=D.slick("getSlick");r(e,"number"==typeof e.currentSlide?e.currentSlide:0,!1)},100),(e=I(v)).$prev.on("click",function(){w=!0,_="pointer",D.slick("slickPrev")}),e.$next.on("click",function(){w=!0,_="pointer",D.slick("slickNext")}),v.on("click",".slick-dots-wrapper button, .slick-dots-wrapper li",function(){w=!0,_="pointer"}),D.on("afterChange",function(e,t,i){r(t,i,!1)}),D.on("keydown",".home-carousel-card",function(e){if(L(this).closest(".item").hasClass("slick-active"))switch(w=!0,_="keyboard",e.key){case"ArrowLeft":e.preventDefault(),D.slick("slickPrev");break;case"ArrowRight":e.preventDefault(),D.slick("slickNext");break;case"Home":e.preventDefault(),D.slick("slickGoTo",0);break;case"End":e.preventDefault(),D.slick("slickGoTo",b-1)}}))})})}},i.behaviors.fullImageSlider={attach:function(e,t){r(function(){l("fullImageSlider",".full-image-slider",e).forEach(function(e){var v,y,S,b,w,_,T,D=L(e);function A(e,t){e=(e.find("h1,h2,h3,h4,h5,h6").first().text()||"").trim()||(e.find(".btn-text_heading").first().text()||"").trim();return e||"Slide "+(t+1)}function r(e,t,i){i=void 0!==i&&i;var a,r,o,s,n,l,d,c,u,h,p,m=D.find(".item"),g=m.not(".slick-cloned"),f=g.length||D.find(".item").not(".slick-cloned").length||b;f&&(u=g.filter(".slick-current").first(),(a=u.length?g.index(u):-1)<0&&(u=(e&&"number"==typeof e.slideCount&&0<e.slideCount?e.slideCount:f)||f,f<=(a="number"==typeof t&&u?(t%u+u)%u:0))&&(a%=f),e=a,a=!(t=f)||t<1?0:(e=((e="number"==typeof e&&isFinite(e)?Math.floor(e):0)%t+t)%t,Math.min(Math.max(e,0),t-1)),m.filter(".slick-cloned").each(function(){var e=L(this);e.attr("aria-hidden","true"),e.attr("role","presentation"),e.removeAttr("aria-label"),e.removeAttr("aria-roledescription"),e.removeAttr("aria-setsize"),e.removeAttr("aria-posinset"),E(e)}),g.each(function(e){var t=L(this),i=e===a,r=A(t,e);t.attr("aria-label","Slide "+(e+1)+" "+T+" "+r),t.attr("aria-hidden",i?"false":"true"),t.removeAttr("aria-setsize"),t.removeAttr("aria-posinset"),t.removeAttr("tabindex"),i?(R(t),(e=t.find(".home-carou
1sel-card")).attr("tabindex","0"),e.attr("role","article"),e.attr("aria-label","Slide "+(a+1)+" "+T+" "+r)):E(t)}),u=f?(a-1+f)%f:0,e=f?(a+1)%f:0,t=A(g.eq(u),u),m=A(g.eq(e),e),r=g.eq(u).attr("id")||"",o=g.eq(e).attr("id")||"",h=(s=I(v)).$prev,s=s.$next,h.length&&(h.attr("aria-label","Go to previous slide "+T+" "+t+" (slide "+(1+u)+" of "+f+")"),r)&&h.attr("aria-controls",r),s.length&&(s.attr("aria-label","Go to next slide "+T+" "+m+" (slide "+(1+e)+" of "+f+")"),o)&&s.attr("aria-controls",o),n=a,l=g,d=f,S&&S.nodeType&&((c=L(S)).attr("role","region"),c.attr("aria-labelledby")||c.attr("aria-label",x)),(c=C(v,D)).length&&((t=c.closest(".slick-dots-wrapper")).length&&!t.attr("aria-labelledby")&&(t.attr("role","region"),t.attr("aria-label",x)),c.attr("role","tablist"),c.attr("aria-labelledby")||c.attr("aria-label",x)),c.find("li").each(function(e){var t,i,r=L(this),a=r.find("button");!a.length||d<=e||(t=(i=l.eq(e)).length?A(i,e):"Slide "+(e+1),i=i.attr("id")||"",r.attr("role","presentation"),a.attr("role","tab"),a.attr("aria-label",(r=e===n)?"Current slide "+T+" "+t+" (slide "+(e+1)+" of "+d+")":"Go to slide "+T+" "+t+" (slide "+(e+1)+" of "+d+")"),i?a.attr("aria-controls",i):a.removeAttr("aria-controls"),a.attr("aria-selected",r?"true":"false"),a.attr("aria-current",r?"true":"false"),a.attr("tabindex",r?"0":"-1"))}),k(v,D,a,f,M),u=!!(v&&v.length&&v.get(0)&&v.get(0).contains(document.activeElement)),y&&y.length&&u&&!document.body.classList.contains("modal-overlay-open")?(y.attr("aria-live","polite"),h=A(g.eq(a),a),y.text("Slide "+(a+1)+" of "+f+" "+T+" "+h)):y&&y.length&&y.attr("aria-live","off"),i)&&w&&"keyboard"===_&&(p=D.find(".slick-current .home-carou
1sel-card")).length&&setTimeout(function(){var t=p.get(0);if(t)try{t.focus({preventScroll:!0})}catch(e){t.focus()}},100)}D.length&&!D.hasClass("slick-initialized")&&(E(D.find(".item").filter("[aria-hidden='true']")),v=D.closest("section, .home-slider-wrapper, .full-image-slider-section").first(),(y=v.find(".carousel-live-region").first())&&y.length&&y.attr("aria-live","off"),(S=v.find("[id^='slick-dots-wrapper-'].slick-dots-wrapper").get(0)||v.find(".slick-dots-wrapper").get(0)||D.parent().find(".slick-dots-wrapper").get(0))&&L(S).empty(),b=D.find(".item").not(".slick-cloned").length||D.find(".item").length,w=!1,_=null,T="â",D.on("init reInit breakpoint",function(e,t){r(t,t&&"number"==typeof t.currentSlide?t.currentSlide:0,!1)}),D.slick({centerMode:!0,centerPadding:"220px",slidesToShow:2,autoplay:!1,autoplaySpeed:4e3,variableWidth:!1,speed:2e3,arrows:!1,infinite:!0,dots:!0,adaptiveHeight:!0,appendDots:S,accessibility:!1,responsive:[{breakpoint:768,settings:{arrows:!1,centerMode:!0,centerPadding:"40px",slidesToShow:1,dots:!0,infinite:!0,appendDots:S}},{breakpoint:480,settings:{arrows:!1,centerPadding:"0px",centerMode:!0,slidesToShow:1,dots:!0,infinite:!0,appendDots:S}}]}),setTimeout(function(){var e=D.slick("getSlick");r(e,"number"==typeof e.currentSlide?e.currentSlide:0,!1)},100),(e=I(v)).$prev.on("click",function(){w=!0,_="pointer",D.slick("slickPrev")}),e.$next.on("click",function(){w=!0,_="pointer",D.slick("slickNext")}),v.on("click",".slick-dots-wrapper button, .slick-dots-wrapper li",function(){w=!0,_="pointer"}),D.on("afterChange",function(e,t,i){r(t,i,!0)}),D.on("keydown",".home-carousel-card",function(e){if(L(this).closest(".item").hasClass("slick-active"))switch(w=!0,_="keyboard",e.key){case"ArrowLeft":e.preventDefault(),D.slick("slickPrev");break;case"ArrowRight":e.preventDefault(),D.slick("slickNext");break;case"Home":e.preventDefault(),D.slick("slickGoTo",0);break;case"End":e.preventDefault(),D.slick("slickGoTo",b-1)}}))})})}},i.behaviors.programStoriesSlider={attach:function(e,t){L(window).on("load",function(){l("programStoriesSlider",".success-stories-programs",e).forEach(function(e){var l,d=L(e);function c(e,t){e=(e.find("h1,h2,h3,h4,h5,h6").first().text()||"").trim()||(e.find(".btn-text_heading").first().text()||"").trim();return e||"Slide "+(t+1)}function u(e,t){return!t||t<1?0:(e=((e="number"==typeof e&&isFinite(e)?Math.floor(e):0)%t+t)%t,Math.min(Math.max(e,0),t-1))}function i(e){var t,i,r,a,o,s=d.find(".item").not(".slick-cloned"),n=s.length;n&&e&&(e=u(e.currentSlide,n),t=n?(e+1)%n:0,i=c(s.eq(e=n?(e-1+n)%n:0),e),r=c(s.eq(t),t),a=s.eq(e).attr("id")||"",s=s.eq(t).attr("id")||"",(o=I(l)).$prev.length&&(o.$prev.attr("aria-label","Go to previous slide â "+i+" (slide "+(1+e)+" of "+n+")"),a)&&o.$prev.attr("aria-controls",a),o.$next.length)&&(o.$next.attr("aria-label","Go to next slide â "+r+" (slide "+(1+t)+" of "+n+")"),s)&&o.$next.attr("aria-controls",s)}function r(e){var a,t,o=d.find(".item").not(".slick-cloned"),s=o.length;s&&e&&(a=u(e.currentSlide,s),(e=C(l,d)).length&&((t=e.closest(".slick-dots-wrapper")).length&&!t.attr("aria-labelledby")&&(t.attr("role","region"),t.attr("aria-label",x)),e.attr("role","tablist"),e.attr("aria-labelledby")||e.attr("aria-label",x)),e.find("li").each(function(e){var t,i=L(this),r=i.find("button");!r.length||s<=e||(t=c(o.eq(e),e),i.attr("role","presentation"),r.attr("role","tab"),r.attr("aria-label",(i=e===a)?"Current slide â "+t+" (slide "+(e+1)+" of "+s+")":"Go to slide â "+t+" (slide "+(e+1)+" of "+s+")"),r.attr("aria-selected",i?"true":"false"),r.attr("aria-current",i?"true":"false"),r.attr("tabindex",i?"0":"-1"))}),k(l,d,a,s,M))}d.length&&!d.hasClass("slick-initialized")&&(l=d.closest("section, .section-wrapper, .container").first(),d.on("init reInit breakpoint",function(e,t){r(t),i(t)}),d.slick({centerMode:!1,centerPadding:"110px",slidesToShow:2,variableWidth:!1,arrows:!1,infinite:!0,dots:!0,accessibility:!1,responsive:[{breakpoint:768,settings:{arrows:!1,centerMode:!0,centerPadding:"41px",slidesToShow:1}},{breakpoint:480,settings:{arrows:!1,centerPadding:"0px",centerMode:!0,slidesToShow:1}}]}),d.on("afterChange",function(e,t){r(t),i(t)}),setTimeout(function(){var e=d.slick("getSlick");e&&(r(e),i(e))},100),(e=I(l)).$prev.off("click.programStories").on("click.programStories",function(){d.slick("slickPrev")}),e.$next.off("click.programStories").on("click.programStories",function(){d.slick("slickNext")}))})})}},i.behaviors.aboutSlider={attach:function(e,t){L(".about-side",e).each(function(){var l=L(this),e=l.closest(".slide-img-text"),d=L("#about-carousel-announcement",e),c=L(".prev-arrow-side",e),u=L(".next-arrow-side",e),a=L(".timeline-nav__item",e),i=6;function o(e){var t=Math.floor(e/i),e=(a.removeClass("last-group-item"),a.filter(function(e){return Math.floor(e/i)===t}));a.hide(),e.show(),e.last().addClass("last-group-item")}l.data("initialized")||L(window).on("load",function(){function r(e,t){var i,r,a,o=l.find(".
1item"),s=o.not(".slick-cloned"),n=s.length;n&&(a=s.filter(".slick-current").first(),(i=a.length?s.index(a):-1)<0&&(a=e&&"number"==typeof e.slideCount&&0<e.slideCount?e.slideCount:n,n<=(i="number"==typeof t&&a?(t%a+a)%a:0))&&(i%=n),i=Math.min(Math.max(i,0),n-1),o.filter(".slick-cloned").each(function(){var e=L(this);e.attr("aria-hidden","true"),e.attr("role","presentation"),e.removeAttr("aria-label"),e.removeAttr("aria-roledescription"),e.removeAttr("tabindex"),e.find("a, button, input, select, textarea, [tabindex]").each(function(){var e,t=L(this);t.is("a")?(e=t.attr("href"))&&(t.attr("data-cata-orig-href",e),t.removeAttr("href")):t.is("button")&&t.prop("disabled",!0),t.attr("tabindex","-1")})}),s.each(function(e){var t=L(this),e=e===i,t=(t.attr("aria-hidden",e?"false":"true").toggleClass("is-current",e),t.removeAttr("tabindex"),t.find("a, button, [tabindex], input, select, textarea"));e?t.each(function(){var e,t=L(this);t.is("a")&&((e=t.attr("data-cata-orig-href"))&&(t.attr("href",e),t.removeAttr("data-cata-orig-href")),t.removeAttr("tabindex")),t.is("button")&&(t.prop("disabled",!1),t.removeAttr("tabindex")),"-1"===t.attr("tabindex")&&t.removeAttr("tabindex")}):t.each(function(){var e,t=L(this);t.is("a")?((e=t.attr("href"))&&(t.attr("data-cata-orig-href",e),t.removeAttr("href")),t.removeAttr("tabindex")):t.is("button")?(t.prop("disabled",!0),t.removeAttr("tabindex")):void 0!==t.attr("tabindex")&&t.removeAttr("tabindex")})}),d&&d.length&&(e=s.eq(i),t=L.trim(e.find("h3, .h5, .h4, .h3").first().text()),r=t?"Slide "+(i+1)+" of "+n+": "+t+".":"Slide "+(i+1)+" of "+n+".",d.text(""),window.requestAnimationFrame(function(){d.text(r)})),o=0===(a=i),a=a===n-1,c.toggleClass("disabled",o).prop("disabled",o).attr("aria-disabled",o?"true":"false"),u.toggleClass("disabled",a).prop("disabled",a).attr("aria-disabled",a?"true":"false"))}l.hasClass("slick-initialized")||(l.slick({centerMode:!0,centerPadding:"0px",slidesToShow:1,variableWidth:!1,arrows:!1,infinite:!0,dots:!1,adaptiveHeight:!0,accessibility:!1,responsive:[{breakpoint:768,settings:{arrows:!1,centerMode:!0,centerPadding:"0px",slidesToShow:1}},{breakpoint:480,settings:{arrows:!1,centerPadding:"0px",centerMode:!0,slidesToShow:1}}]}),l.on("afterChange",function(e,t,i){a.removeClass("active"),a.eq(i).addClass("active"),o(i),r(t,i)}),l.on("reInit breakpoint",function(e,t){r(t,t&&"number"==typeof t.currentSlide?t.currentSlide:0)}),a.first().addClass("active"),o(0),c.off("click.aboutSlider").on("click.aboutSlider",function(e){e.preventDefault(),l.slick("slickPrev")}),u.off("click.aboutSlider").on("click.aboutSlider",function(e){e.preventDefault(),l.slick("slickNext")}),setTimeout(function(){var e=l.slick("getSlick");r(e,e&&"number"==typeof e.currentSlide?e.currentSlide:0)},100)),l.data("initialized",!0)})})}},i.behaviors.textOnlyV313LoadMore={attach:function(e,t){l("loadmore-init",".PDF-component",e).forEach(function(e){let t=L(e);var e=t.find(".pdf-item"),i=t.find(".load-more-btn");(e.length<=10?i:(i.show().css("visibility","visible"),e.slice(10))).hide(),i.on("click",function(e){e.preventDefault(),t.find(".pdf-item:hidden").slideDown(),L(this).fadeOut()})})}},i.behaviors.toggleTables={attach:function(e,t){l("toggleTables-delegate","html",e).forEach(function(){document.addEventListener("click",function(e){var t,i,r=e.target&&e.target.closest?e.target.closest("#toggleButton"):null;r&&(e.preventDefault(),r=(e=r.closest("#schedulePrintMain")||r.closest(".schedule-block")||document).querySelector(".table-wrap"),t=e.querySelector(".table-wrap2"),e=e.querySelector("#toggleButtonText"),r&&t?(i=!r.classList.contains("d-none"),r.classList.toggle("d-none",i),t.classList.toggle("d-none",!i),e&&(e.textContent=i?"Switch to Table View":"Switch to Accessible List View"),i&&t.scrollIntoView({behavior:"smooth",block:"start"})):console.warn("[toggleTables] Missing .table-wrap or .table-wrap2",{hasTableWrap:!!r,hasAccordionWrap:!!t}))},!0)})}},i.behaviors.cataHeaderSearchHelperText={attach:function(e){l("cataHeaderSearchHelperText","#header-search-container",e).forEach(function(e){let t=e.querySelector("[data-header-search-input]")||e.querySelector('input[name="keys"]'),i=e.querySelector("[data-header-search-helper]")||e.querySelector(".placeholder-search-text");t&&i&&(e=()=>{var e=0<(t.value||"").trim().length;i.hidden=e,i.setAttribute("aria-hidden",e?"true":"false")},t.addEventListener("input",e,{passive:!0}),t.addEventListener("change",e,{passive:!0}),e())})}},i.behaviors.cataDialogAccessibleNames={attach:function(e){function r(e){if(e&&"dialog"===e.getAttribute("role")){var t=e.querySelector(".modal-title, .modal-header h1, .modal
1-header h2, .modal-header h3, .modal-header h4, .modal-header h5");if(t)t.id||(t.id="cata-dlg-title-"+String(Math.random()).slice(2,11)),e.setAttribute("aria-labelledby",t.id),"Message"!==(t=e.getAttribute("aria-label"))&&"Dialog"!==t||e.removeAttribute("aria-label");else if(!e.hasAttribute("aria-label")||!(e.getAttribute("aria-label")||"").trim()){t=e.getAttribute("aria-labelledby");if(t)for(var i=t.trim().split(/\s+/),r=0;r<i.length;r++){var a=document.getElementById(i[r]);if(a&&(a.textContent||"").trim().length)return}e.setAttribute("aria-label","js-modal-page-show-modal"===e.id?"Message":"Dialog")}}}function t(e){if(e&&e.querySelectorAll){1===e.nodeType&&e.getAttribute&&"dialog"===e.getAttribute("role")&&r(e);for(var t=e.querySelectorAll('[role="dialog"]'),i=0;i<t.length;i++)r(t[i])}}l("cataDialogAccessibleNamesObserve","body",e).forEach(function(){var e;t(document),"undefined"!=typeof MutationObserver&&new MutationObserver(function(){clearTimeout(e),e=setTimeout(function(){t(document)},0)}).observe(document.body,{childList:!0,subtree:!0})}),e&&e!==document&&t(e)}},i.behaviors.cataStatusMessageAnnouncer={attach:function(e){var t,i="cata-status-live-region",r=document.getElementById(i);function a(e){var t,i=(e||"").replace(/\s+/g," ").trim();i&&(t=r.querySelector(".cata-status-live-region__text"))&&(t.textContent="",window.requestAnimationFrame(function(){t.textContent=i}))}function o(e){if(e&&e.querySelectorAll)for(var t=e.querySelectorAll(".messages--status"),i=0;i<t.length;i++){var r=t[i],r=(r.removeAttribute("hidden"),r.setAttribute("aria-live","off"),r.removeAttribute("role"),r.removeAttribute("aria-atomic"),r.textContent||"");r.trim()&&a(r)}}r?r.querySelector(".cata-status-live-region__text")||((t=document.createElement("span")).className="cata-status-live-region__text",t.textContent=(r.textContent||"").trim()||"Â ",r.textContent="",r.appendChild(t)):((r=document.createElement("div")).id=i,r.className="visually-hidden",r.setAttribute("role","status"),r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),(t=document.createElement("span")).className="cata-status-live-region__text",t.textContent="Â ",r.appendChild(t),document.body.appendChild(r)),o(document),e&&e!==document&&o(e),l("cataStatusMessageAnnouncerObserver","body",e).forEach(function(){new MutationObserver(function(e){for(var t=0;t<e.length;t++)for(var i=e[t],r=0;r<i.addedNodes.length;r++){var a=i.addedNodes[r];a&&1===a.nodeType&&(a.matches&&a.matches(".messages--status")?o(a.parentNode||document):a.querySelector&&a.querySelector(".messages--status")&&o(a))}}).observe(document.body,{childList:!0,subtree:!0})})}},i.behaviors.pdfLinks={attach:function(e,t){e.querySelectorAll('a[href$=".pdf"]').forEach(function(e){e.hasAttribute("target")||(e.target="_blank",e.rel="noopener noreferrer")})}},i.behaviors.tabNavigation={attach:function(t,e){let i=L(".left-btn",t);var r=L(".right-btn",t);let a=L(".Board_list",t),o=L(".Board-filter",t),s=L(".tab-pane",t);i.on("click",function(){a[0].scrollBy({left:-200,behavior:"smooth"})}),r.on("click",function(){a[0].scrollBy({left:200,behavior:"smooth"})}),o.each(function(){L(this).on("click",function(e){e.preventDefault();e=this;o.removeClass("active"),L(e).addClass("active"),L(e)[0].scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"}),s.removeClass("active"),e=L(e).data("bs-target"),L(e).addClass("active"),e=(e=L(".Board-filter.active",t)).is(o.first()),i.toggle(!e)})})}},i.behaviors.tabAndAccordionScroll={attach:function(e){e.querySelectorAll(".Board_list").forEach(function(n){let l=n.closest(".bors-section");if(l){let r=l.querySelector(".scroll-btn-left.left-btn"),a=l.querySelector(".scroll-btn-right.right-btn"),o=l.querySelector(".list-section-menu-list"),s=l.querySelectorAll(".Board-filter");if("true"!==n.dataset.scrollAttached){n.dataset.scrollAttached="true";function i(){var e=n.scrollLeft,e=n.scrollWidth-1<=e+n.clientWidth,t=l.querySelector(".Board-filter.active"),i=s.length?s[0]:null,t=!!t&&!!i&&t===i;8<=s.length?(o&&(o.classList.remove("newitem"),o.classList.remove("newitem-left")),r&&(t?(r.style.display="none",o&&o.classList.add("newitem-left")):(r.style.display="block",o&&o.classList.remove("newitem-left"))),a&&(e?(a.style.display="none",o&&o.classList.add("newitem")):(a.style.display="block",o&&o.classList.remove("newitem")))):(r&&(r.style.display="none"),a&&(a.style.display="none"),o&&(o.classList.add("newitem"),o.classList.add("newitem-left")))}r&&r.addEventListener("click",function(){n.scrollBy({left:-200,behavior:"smooth"})}),a&&a.addEventListener("click",function(){n.scrollBy({left:200,behavior:"smooth"})}
1),s.forEach(function(t){t.addEventListener("click",function(e){e.preventDefault(),e.stopImmediatePropagation(),"A"===t.tagName&&"#"===(e=t.getAttribute("href")||"").charAt(0)&&location.hash===e&&history.replaceState(null,"",location.pathname+location.search),setTimeout(i,50)})}),n.addEventListener("scroll",i),window.addEventListener("resize",i),i(),setTimeout(i,100),setTimeout(i,400)}}})}},i.behaviors.customInteraction={attach:function(t){t.querySelectorAll(".check-input").forEach(function(e){e.dataset.customBound||(e.dataset.customBound=!0,e.addEventListener("change",function(){t.querySelectorAll(".form-check").forEach(function(e){e.classList.remove("active")}),this.checked&&this.closest(".form-check")&&this.closest(".form-check").classList.add("active")}))}),l("cataTripPlannerRoutesToggleDelegated","html",t).forEach(function(){document.addEventListener("click",function(e){var t,i,e=e.target.closest(".icon-change-btn .btn");e&&(t=e.getAttribute("aria-controls"),i=e.closest(".trip-planner-section")||document,t=t&&document.getElementById(t)||i.querySelector(".routes-section"))&&(i=t.hidden||t.classList.contains("icon-hide")||"true"===t.getAttribute("aria-hidden"),e=e,i=!i,(t=t).classList.toggle("icon-hide",i),t.hidden=i,t.setAttribute("aria-hidden",String(i)),e.setAttribute("aria-expanded",String(!i)),e.setAttribute("aria-label",i?"Show route options":"Hide route options"),e.setAttribute("title",i?"Show route options":"Hide route options"),t=e.querySelector(".btn-icon"))&&(t.alt="")})})}},i.behaviors.myScrollingHeaderBehavior={attach:function(e,t){let n=L("header",e);if(0!==n.length){let a="scrolling-header",o="header-hidden",s=0;function i(){var e,t,i,r;s=window.matchMedia&&window.matchMedia("(max-width: 991px)").matches?(n.removeClass(a),n.removeClass(o),window.pageYOffset||document.documentElement.scrollTop):(e=window.pageYOffset||document.documentElement.scrollTop,t=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-window.innerHeight-10<=e,i=e>s,r=e<s,e<=0?(n.removeClass(a),n.removeClass(o),L(".dropdown-menu").removeClass("show"),L(".parent-dropdown-menu").removeClass("show"),L(".nav-item.menu-item--expanded.dropdown > a").attr("aria-expanded","false"),L('.dropdown-item > a[data-bs-toggle="dropdown"]').attr("aria-expanded","false"),L("body").removeClass("is-header-dropdown-open")):(t||i||r)&&n.addClass(a),e)}console.log("header",n),i(),window.addEventListener("scroll",i),L(document).ajaxComplete(function(){i()})}}},i.behaviors.cataNavbarToggleIcons={attach:function(e){function o(e,t){var i=document.getElementById(e);i&&i.hasAttribute("data-cata-mainmenu-panel")&&(i.classList.toggle("show",t),document.querySelectorAll(r+'[aria-controls="'+e+'"]').forEach(function(e){e.setAttribute("aria-expanded",t?"true":"false")}),document.body.classList.toggle("downmenu-toggle",t))}let r="[data-cata-mainmenu-toggle]";l("cataNavbarToggleNav",r,e).forEach(function(r){let a=r.getAttribute("aria-controls");var e;a&&!r.dataset.cataNavbarToggleNavBound&&(r.dataset.cataNavbarToggleNavBound="1",r.addEventListener("click",function(e){var t,i=document.getElementById(a);i&&i.hasAttribute("data-cata-mainmenu-panel")&&((t=Date.now())-parseInt(r.dataset.cataMainmenuLastToggleAt||"0",10)<380?(e.preventDefault(),e.stopPropagation()):(r.dataset.cataMainmenuLastToggleAt=String(t),e=!i.classList.contains("show"),o(a,e)))}),e=document.getElementById(a))&&e.hasAttribute("data-cata-mainmenu-panel")&&(e=e.classList.contains("show"),r.setAttribute("aria-expanded",e?"true":"false"))}),document.documentElement.dataset.cataNavbarEscapeBound||(document.documentElement.dataset.cataNavbarEscapeBound="1",document.addEventListener("keydown",function(e){"Escape"===e.key&&(e=document.querySelector("[data-cata-mainmenu-panel].show"))&&e.id&&o(e.id,!1)}))}},i.behaviors.cataDropdownToggleIcon={attach:function(e,t){let a=991;function i(e){var t,i,r;window.innerWidth<=a&&(e.preventDefault(),e.stopPropagation(),i=(t=(e=L(e.currentTarget).closest("a")).closest(".nav-item.menu-item--expanded.dropdown")).children(".dropdown-menu"),console.log("[cataNav] parent icon click",{linkText:L.trim(e.text()),navItemFound:0<t.length,dropdownFound:0<i.length,menuOpenClass:t.hasClass("menu-open")}),i.length)&&(r=t.hasClass("menu-open"),L(".nav-item.menu-item--expanded.dropdown").not(t).each(function(){L(this).removeClass("menu-open"),L(this).children(".dropdown-menu").removeClass("show parent-dropdown-menu"),L(this).children("a").attr("aria-expanded","fal
1se"),L(this).children("a").removeClass("show")}),r?(t.removeClass("menu-open"),i.removeClass("show parent-dropdown-menu"),e.attr("aria-expanded","false"),console.log("dropdown-toggle-icon: mega menu closed"),e.removeClass("show")):(t.addClass("menu-open"),i.addClass("show parent-dropdown-menu"),e.attr("aria-expanded","true"),console.log("dropdown-toggle-icon: mega menu opened"),e.addClass("show")))}L(".nav-item.menu-item--expanded.dropdown > a",e).each(function(){var e=L(this);let t=e.find(".dropdown-toggle-icon").first();t.length||(t=L('<span class="dropdown-toggle-icon d-inline-flex d-lg-none" role="button" tabindex="0" aria-label="Toggle menu"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M18 9L12 15L6 9" stroke="#475467" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></span>'),e.append(t)),t.off(".cataNavIcon"),t.on("click.cataNavIcon",i),t.on("keydown.cataNavIcon",function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i(e))})})}},i.behaviors.cataParentDropdown={attach:function(e,t){function d(){return window.innerWidth<=991}let s='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M18 9L12 15L6 9" stroke="#475467" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';function m(e){return e.children("li").children("a").filter(function(){return"-1"!==L(this).attr("tabindex")||L(this).is(":visible")}).filter(":visible")}function g(t){if(t&&t.length){t=t.get(0);if(t&&"function"==typeof t.focus)try{t.focus({preventScroll:!0})}catch(e){t.focus()}}}function f(e,t){r=(i=e).key||"",i=i.code||"";var i,r,a=r||("Space"===i?" ":0!==i.indexOf("Arrow")&&"Escape"===i?"Escape":i),o=e.code||"";for(let e=0;e<t.length;e++){var s=t[e];if(a===s||o===s)return 1;if("ArrowDown"===s&&("Down"===a||"ArrowDown"===o))return 1;if("ArrowUp"===s&&("Up"===a||"ArrowUp"===o))return 1;if("ArrowLeft"===s&&("Left"===a||"ArrowLeft"===o))return 1;if("ArrowRight"===s&&("Right"===a||"ArrowRight"===o))return 1;if(" "===s&&("Spacebar"===a||"Space"===o))return 1;if("Escape"===s&&("Esc"===a||"Escape"===o))return 1}}function v(e,t,i){e.length&&((t=e.index(t))<0?g(e.first()):(t=(t+i+e.length)%e.length,g(e.eq(t))))}function y(e,t){e.attr("aria-hidden",t?"false":"true"),e.children("li").children("a").attr("tabindex",t?"0":"-1"),t||(e.find(".dropdown-menu").attr("aria-hidden","true"),e.find(".dropdown-menu a").attr("tabindex","-1"))}L("a.nav-link.dropdown-toggle, .nav-item.menu-item--expanded.dropdown > a",e).each(function(){let t=L(this),i=t.attr("href");!i||"#"===i||""===i||0<t.closest(".dropdown-item").length&&"dropdown"===String(t.attr("data-bs-toggle")||"")||(t.removeAttr("data-bs-toggle"),t.off(".cataNav"),t.on("click.cataNav",function(e){d()?(t.closest(".
1nav-item.menu-item--expanded.dropdown").find("> .dropdown-menu, > ul.dropdown-menu").removeClass("show parent-dropdown-menu").css("display",""),t.attr("aria-expanded","false")):(e.preventDefault(),e.stopPropagation(),(e=t.closest(".nav-item.menu-item--expanded.dropdown")).length&&(e.children(".dropdown-menu").removeClass("show parent-dropdown-menu"),e.children("a").first().attr("aria-expanded","false")),window.location.href=i)}))}),L('[data-bs-toggle="dropdown"]',e).each(function(){var e;"undefined"!=typeof bootstrap&&bootstrap.Dropdown&&(e=bootstrap.Dropdown.getInstance(this))&&e.dispose()}),L('.nav-item.menu-item--expanded.dropdown > a[data-bs-toggle="dropdown"]',e).off(".cataNav").on("click.cataNav",function(e){var t;d()?(e.preventDefault(),e.stopPropagation(),(t=L(this)).closest(".nav-item.menu-item--expanded.dropdown").find("> .dropdown-menu, > ul.dropdown-menu").removeClass("show parent-dropdown-menu").css("display",""),t.attr("aria-expanded","false")):(e.preventDefault(),e.stopPropagation())}),L(".dropdown-item > a.dropdown-toggle",e).each(function(){let a=L(this),t=a.attr("href"),i=a.find(".dropdown-toggle-icon").first();var e=a.next(".dropdown-menu"),r=a.attr("data-bs-toggle"),o="data-cata-child-init";d()?(a.removeAttr("data-bs-toggle"),d()&&e.length&&!a.attr(o)&&(e.removeClass("show"),a.attr("aria-expanded","false"),a.removeClass("show"),a.attr(o,"1")),i.length||(i=L('<span class="dropdown-toggle-icon d-inline-flex d-lg-none" role="button" tabindex="0" aria-label="Toggle submenu">'+s+"</span>"),a.append(i)),i.off(".cataNavChildIcon"),i.on("click.cataNavChildIcon",function(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();var t,e=a,i=e.parent(),r=e.next(".dropdown-menu");console.log("[cataNav] child icon click",{linkText:L.trim(e.text()),containerFound:0<i.length,submenuFound:0<r.length,isOpenBeforeToggle:r.hasClass("show")}),r.length&&(t="true"===e.attr("aria-expanded"),i.siblings().children(".dropdown-menu").removeClass("show"),i.siblings().children("a.dropdown-toggle").attr("aria-expanded","false"),t?(r.removeClass("show"),e.attr("aria-expanded","false"),e.removeClass("show")):(r.addClass("show"),e.attr("aria-expanded","true"),e.addClass("show")),console.log("[cataNav] child icon toggle complete",{isOpenAfterToggle:r.hasClass("show"),ariaExpanded:e.attr("aria-expanded")}))}),i.on("keydown.cataNavChildIcon",function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.trigger("click"))}),a.off(".cataNavChildLink").on("click.cataNavChildLink",function(e){return L(e.target).closest(".dropdown-toggle-icon").length?(e.preventDefault(),e.stopPropagation(),!1):(console.log("[cataNav] child text link click",{href:t,linkText:L.trim(a.text())}),a.parent().children(".dropdown-menu").removeClass("show"),a.attr("aria-expanded","false"),t&&"#"!==t&&""!==t?(window.location.href=t,!1):void 0)})):(i.length||(i=L('<span class="dropdown-toggle-icon d-inline-flex d-lg-none" role="button" tabindex="0" aria-label="Toggle submenu">'+s+"</span>"),a.append(i)),i.off(".cataNavChildIcon"),"dropdown"!==r&&a.attr("data-bs-toggle","dropdown"),a.off(".cataNavChildLink").on("click.cataNavChildLink",function(e){return!L(e.target).closest(".dropdown-toggle-icon").length&&t&&"#"!==t&&""!==t?(window.location.href=t,!1):void 0}))}),L(".nav-item.menu-item--expanded.dropdown",e).each(function(){let r=L(this),h=r.children("a").first(),a=r.children(".dropdown-menu"),e;function o(){clearTimeout(e),L(".nav-item.menu-item--expanded.dropdown").not(r).each(function(){var e=L(this),t=e.children("a").first(),e=e.children(".dropdown-menu");e.removeClass("show parent-dropdown-menu"),t.attr("aria-expanded","false"),t.removeClass("line-hover-opened"),y(e,!1)}),a.addClass("show parent-dropdown-menu"),h.addClass("line-hover-opened"),h.attr("aria-expanded","true"),y(a,!0)}function t(){e=setTimeout(function(){a.removeClass("show parent-dropdown-menu"),h.removeClass("line-hover-opened"),h.attr("aria-expanded","false"),y(a,!1)},150)}function p(){clearTimeout(e),a.removeClass("show parent-dropdown-menu"),h.removeClass("line-hover-opened"),h.attr("aria-expanded","fal
1se"),y(a,!1)}var i,s,n,l;r.off(".cataHover"),h.off(".cataHover"),a.off(".cataHover"),d()||(i=r,s=h,n=a,(l=i.closest(".navbar-nav, ul.nav")).length&&(l.attr("role","menu"),l.children("li.nav-item").attr("role","none").children("a").each(function(){var e=L(this);e.attr("role")||e.attr("role","menuitem")})),i.attr("role","none"),n.attr("id")||n.attr("id","cata-submenu-"+Math.random().toString(36).slice(2,10)),s.attr({role:"menuitem","aria-haspopup":"true","aria-controls":n.attr("id")}),s.attr("aria-expanded")||s.attr("aria-expanded","false"),n.attr("role","menu"),n.children("li").attr("role","none").children("a").each(function(){var e=L(this),t=e.parent().children(".dropdown-menu");e.attr("role","menuitem"),t.length&&(t.attr("id")||t.attr("id","cata-submenu-"+Math.random().toString(36).slice(2,10)),e.attr({"aria-haspopup":"true","aria-controls":t.attr("id")}),e.attr("aria-expanded")||e.attr("aria-expanded","false"),t.attr("role","menu"),t.children("li").attr("role","none").children("a").attr("role","menuitem"),y(t,t.hasClass("show")))}),y(a,a.hasClass("show")),r.on("mouseenter.cataHover",o).on("mouseleave.cataHover",t),r.on("focusout.cataHover",function(){setTimeout(function(){var e=document.activeElement;e&&r[0].contains(e)||t()},0)}),h.on("keydown.cataHover",function(e){var t,i;L(e.target).closest(".dropdown-toggle-icon").length||(t=a.hasClass("show"),i=r.closest(".
1navbar-nav, ul.nav").children("li.nav-item").children("a").filter(":visible"),f(e,["ArrowDown"," "])?(e.preventDefault(),e.stopPropagation(),o(),g(m(a).first())):f(e,["ArrowUp"])?(e.preventDefault(),e.stopPropagation(),o(),g(m(a).last())):f(e,["ArrowRight"])?(e.preventDefault(),e.stopPropagation(),p(),v(i,h,1)):f(e,["ArrowLeft"])?(e.preventDefault(),e.stopPropagation(),p(),v(i,h,-1)):f(e,["Escape"])&&t&&(e.preventDefault(),e.stopPropagation(),p(),g(h)))}),a.on("keydown.cataHover","a",function(e){var t=L(this);if(t.parent().parent().is(a)){var i=t.parent().children(".dropdown-menu"),n=m(a),r=0<i.length;if(f(e,["ArrowDown"]))e.preventDefault(),e.stopPropagation(),v(n,t,1);else if(f(e,["ArrowUp"]))e.preventDefault(),e.stopPropagation(),v(n,t,-1);else if(f(e,["ArrowRight"]))if(e.preventDefault(),e.stopPropagation(),r)i.addClass("show"),t.attr("aria-expanded","true"),y(i,!0),g(m(i).first());else{var l=n,d=t,c=1;if(l.length&&d.length){let i=d[0];var u=i.getBoundingClientRect();let r=u.left+u.width/2,a=u.top+u.height/2,o=null,s=1/0;l.each(function(){var e,t;this===i||(t=(e=this.getBoundingClientRect()).left+e.width/2,e=e.top+e.height/2,t=t-r,0<c&&t<=4)||c<0&&-4<=t||(t=Math.abs(t)+2*Math.abs(e-a))<s&&(s=t,o=this)}),o?g(L(o)):v(l,d,c)}}else if(f(e,["ArrowLeft"]))if(e.preventDefault(),e.stopPropagation(),r&&i.hasClass("show"))y(i,!1),i.removeClass("show"),t.attr("aria-expanded","false"),g(t);else{let i=t[0];u=i.getBoundingClientRect();let r=u.left+u.width/2,a=u.top+u.height/2,o=null,s=1/0;n.each(function(){var e,t;this===i||-4<=(t=(e=this.getBoundingClientRect()).left+e.width/2-r)||(e=e.top+e.height/2,(t=Math.abs(t)+2*Math.abs(e-a))<s&&(s=t,o=this))}),o?g(L(o)):(p(),g(h))}else f(e,["Escape"])?(e.preventDefault(),e.stopPropagation(),p(),g(h)):f(e,[" "])&&r&&(e.preventDefault(),e.stopPropagation(),l=!i.hasClass("show"),t.parent().siblings().children(".dropdown-menu").each(function(){y(L(this),!1),L(this).removeClass("show")}),t.parent().siblings().children("a").attr("aria-expanded","false"),i.toggleClass("show",l),t.attr("aria-expanded",l?"true":"false"),y(i,l),l)&&g(m(i).first())}}))}),L('.dropdown-item > a[data-bs-toggle="dropdown"]',e).each(function(){let r=L(this),t=r.parent(),a=r.next(".dropdown-menu"),e;function i(){clearTimeout(e),t.siblings().children(".dropdown-menu").each(function(){y(L(this),!1),L(this).removeClass("show")}),t.siblings().children('a[data-bs-toggle="dropdown"]').attr("aria-expanded","false"),a.addClass("show"),r.attr("aria-expanded","true"),y(a,!0)}function o(){e=setTimeout(function(){a.removeClass("show"),r.attr("aria-expanded","false"),y(a,!1)},150)}function s(){clearTimeout(e),a.removeClass("show"),r.attr("aria-expanded","false"),y(a,!1)}t.off(".cataHoverChild"),r.off(".cataHoverChild"),a.off(".cataHoverChild"),d()||(t.on("mouseenter.cataHoverChild",i).on("mouseleave.cataHoverChild",o),t.on("focusout.cataHoverChild",function(){setTimeout(function(){var e=document.activeElement;e&&t[0].contains(e)||o()},0)}),r.on("keydown.cataHoverChild",function(e){var t;L(e.target).closest(".dropdown-toggle-icon").length||(t=a.hasClass("show"),f(e,["ArrowRight","ArrowDown"," "])?(e.preventDefault(),e.stopPropagation(),i(),g(m(a).first())):(f(e,["ArrowLeft"])&&t||f(e,["Escape"])&&t)&&(e.preventDefault(),e.stopPropagation(),s(),g(r)))}),a.on("keydown.cataHoverChild","a",function(e){var t=L(this),i=m(a);f(e,["ArrowDown"])?(e.preventDefault(),e.stopPropagation(),v(i,t,1)):f(e,["ArrowUp"])?(e.preventDefault(),e.stopPropagation(),v(i,t,-1)):f(e,["ArrowLeft","Escape"])?(e.preventDefault(),e.stopPropagation(),s(),g(r)):f(e,["ArrowRight"])&&(e.preventDefault(),e.stopPropagation())}))})}},i.behaviors.modifyClassesBasedOnCondition={attach:function(e,t){function i(){document.querySelectorAll(".gt_switcher").forEach(n)}let r="new-class-to-a",a="new-class-to-gt-option",o="data-cata-gt-class-init",s=e=>{var t,i;e&&(t=e.querySelector(".gt_selected a"))&&(e=e.querySelector(".gt_option"))&&(i=e.classList.contains("active"),t.classList.toggle(r,i),e.classList.toggle(a,i))},n=e=>{if(e&&!e.hasAttribute(o)){e.setAttribute(o,"true"),s(e);let t=function(){setTimeout(function(){s(e)},50)};e.addEventListener("click",t),e.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||t()}),new MutationObserver(function(){s(e)}).observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class"],characterData:!0}
1)}};i(),setTimeout(i,100),setTimeout(i,500),setTimeout(i,1e3),l("modifyClassesBasedOnCondition-observer","body",e).forEach(function(e){new MutationObserver(function(){i()}).observe(e,{childList:!0,subtree:!0})})}},i.behaviors.footerAccordionClass={attach:function(e,t){var i=document.querySelector("footer.cata--footer"),r=document.querySelector(".section-wrapper.accordion-section.bg-blue");i&&r&&i.classList.add("has-accordion-section")}},i.behaviors.eventClass={attach:function(e,t){var i=document.querySelector(".sto-events-wrapper.section-wrapper.event-section.home-page-component.bg-blue"),r=document.querySelector(".section-wrapper.pt-0.event-section.board-of-directors-component.home-page-component.bg-blue");i&&r&&i.classList.add("has-events-section")}},i.behaviors.reinitAccordion={attach:function(e,t){"undefined"!=typeof bootstrap&&(e=l("ajax-accordion-fix",".accordion-collapse",e),L(e).each(function(){new bootstrap.Collapse(this,{toggle:!1})}))}},i.behaviors.howConnectLoadMore={attach:function(e,t){e=l("howConnectLoadMore",".tab-pane .load-more-btn",e);L(e).on("click",function(e){e.preventDefault();var e=L(this),t=e.closest(".Load-More");e.closest(".tab-pane").find(".resource-item-card.d-none").removeClass("d-none"),t.fadeOut(400,function(){L(this).remove()})})}},i.behaviors.banBookPaginationFocus={attach:function(e,t){l("ban-book-pager-link",".ban-book-page .js-ban-book-pager .js-ban-book-pager-link",e).forEach(function(t){t.addEventListener("click",function(){L(document).one("ajaxComplete.banBookPager",function(){setTimeout(function(){var e=L(".ban-book-page .view-content .column-content h3").first();e.length?(e.attr("tabindex")||e.attr("tabindex","-1"),e.trigger("focus")):t.focus()},50)})},{once:!1})})}},i.behaviors.accordionV2LoadMore={attach:function(e,t){L(".accordion-v2",e).each(function(){var e=L(this);if(!e.data("loadmore-initialized")){e.data("loadmore-initialized",!0);let t=e.find(".accordion-item"),i=e.find(".Load-More");e=e.find(".load-more-btn");5<t.length?(t.slice(5).hide(),i.show()):i.hide(),e.on("click",function(e){e.preventDefault();e=t.filter(":hidden");e.slice(0,5).slideDown({start:function(){L(this).css("display","block")}}),e.length<=5&&i.fadeOut()})}})}},i.behaviors.textV2SectionHeight={attach:function(e,t){function i(e){var e=e||document,a=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth||0,s=1024<=o?1:1.8,n=a*s,e=e.querySelectorAll(".section-wrapper.text-v2-section, .section-wrapper.text-v2-1-section, .section-wrapper.text-v2-2-section, .Transit-App, .two-column-section");Array.prototype.forEach.call(e,function(e){var r,t=e.querySelector(".description-wrapper, .text-section, .column-content")||e,i=((i=t)?(r=0,Array.prototype.forEach.call(i.children,function(e){var t=e.getBoundingClientRect(),e=window.getComputedStyle(e),i=parseFloat(e.marginTop)||0,e=parseFloat(e.marginBottom)||0;r+=t.height+i+e}),r):0)||t.scrollHeight||0,t=n<i;console.log("textV2SectionHeight:",{contentHeight:i,viewportHeight100vh:a,viewportWidth:o,vhMultiplier:s,targetHeight:n,isLarge:t,section:e}),e.classList.toggle("text-v2-section--large",t)})}var r=null;function a(e){r=r||window.requestAnimationFrame(function(){r=null,i(e||document)})}a(e),l("textV2SectionHeightResize","body",e).forEach(function(){window.addEventListener("resize",function(){a(document)},{passive:!0}),window.addEventListener("orientationchange",function(){a(document)},{passive:!0}),window.addEventListener("load",function(){a(document)},{passive:!0})}),"function"==typeof window.ResizeObserver&&(window.__cataTextV2SectionHeightRO||(window.__cataTextV2SectionHeightRO=new window.ResizeObserver(function(){a(document)})),e=(e||document).querySelectorAll(".section-wrapper.text-v2-section, .section-wrapper.text-v2-1-section, .section-wrapper.text-v2-2-section, .Transit-App, .two-column-section"),Array.prototype.forEach.call(e,function(e){e&&e.dataset&&"1"===e.dataset.textV2HeightObserved||(e&&e.dataset&&(e.dataset.textV2HeightObserved="1"),window.__cataTextV2SectionHeightRO.observe(e))}))}},i.behaviors.accordionFix={attach:function(e){l("accordionFix",".accordion-button",e).forEach(function(e){e.addEventListener("click",function(e){let t=window.scrollY;setTimeout(function(){window.scrollTo(0,t)},10)})})}},i.behaviors.cartDiscountFormTabActive={attach:function(e,i){i.cata&&"verified"===i.cata.activeTab&&l("cartDiscountFormTabActive","body",e).forEach(function(e){var t=document.querySelector("#tab-2");t&&"undefined"!=typeof bootstrap&&(new bootstrap.Tab(t).show(),i.cata)&&delete i.cata.activeTab})}},i.behaviors.cataBlogYearDropdown={attach:function(e,t){l("cataBlogYearDropdown","#yearDropdown",e).forEach(function(t){var i=t.querySelector(".dropdown-selected"),r=t.querySelector(".dropdown-list"),a=t.querySelectorAll(".option"),o=document.getElementById("year-filter");function s(){r.classList.remove("show"),i.classList.remove("open"),i.setAttribute("aria-expanded","fal
1se")}i&&r&&(i.hasAttribute("role")||(i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-haspopup","listbox")),i.setAttribute("aria-expanded","false"),r.setAttribute("role","listbox"),i.addEventListener("click",function(e){e.stopPropagation();e=r.classList.toggle("show");i.classList.toggle("open",e),i.setAttribute("aria-expanded",e?"true":"false")}),i.addEventListener("keydown",function(e){"Enter"===e.key||" "===e.key?(e.preventDefault(),i.click()):"Escape"===e.key&&s()}),a.forEach(function(t){t.setAttribute("role","option"),t.addEventListener("click",function(e){e.stopPropagation(),i.innerHTML=t.innerHTML,a.forEach(function(e){e.classList.remove("active")}),t.classList.add("active"),o&&(o.value=t.dataset.value||"",o.dispatchEvent(new Event("change",{bubbles:!0}))),s()})}),document.addEventListener("click",function(e){t.contains(e.target)||s()}),document.addEventListener("keydown",function(e){"Escape"===e.key&&r.classList.contains("show")&&s()}))})}},i.behaviors.accessibleFileErrors={attach:function(e){let t=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){e&&1===e.nodeType&&L(e).find(".file-upload-js-error").addBack(".file-upload-js-error").attr({role:"alert","aria-live":"assertive"})})})});L(l("a11y-file",".js-form-managed-file",e)).each(function(){t.observe(this,{childList:!0,subtree:!0})})}},i.behaviors.befAriaCurrent={attach:function(e){function t(e){var t;(t=(t=e[0])&&t.nodeType?t:null)&&(t.removeAttribute("required"),t.removeAttribute("aria-required"),t.classList.remove("required")),e.find(".bef-link").removeAttr("aria-current"),e.find(".bef-link--selected").attr("aria-current","page")}L(l("befAriaCurrent",".bef-links",e)).each(function(){t(L(this))}),i.behaviors.befAriaCurrent._ajaxBound||(L(document).on("ajaxComplete.befAriaCurrent",function(){L(".bef-links").each(function(){t(L(this))})}),i.behaviors.befAriaCurrent._ajaxBound=!0)}},i.behaviors.blogFilters={attach:function(e,t){l("customDropdown",".custom-dropdown-wrapper",e).forEach(function(e){e=L(e);let i=e.find(".custom-dropdown"),r=e.find("#selected-value"),a=e.find(".option"),o=e.find("select");var t=o.val();t&&"All"!==t&&(e=e.find(`.option[data-value="${t}"]`).text().replace("â",""),r.text(e)),i.on("click",function(e){e.stopPropagation(),L(this).attr("aria-expanded","false"===L(this).attr("aria-expanded"))}),a.on("click",function(e){e.stopPropagation();var e=L(this).data("value"),t=L(this).contents().get(0).nodeValue;r.text(t),a.removeClass("active"),L(this).addClass("active"),o.val(e).trigger("change"),i.attr("aria-expanded","false")})}),L(document).on("click",function(){L(".custom-dropdown").attr("aria-expanded","false")})}},i.behaviors.pdfLanguageFilter={attach:function(t){l("pdf-language-filter","#pdf-language-select",t).forEach(function(e){L(e).on("change",function(){var e=L(this).val();L(".js-language-group",t).hide(),L('.js-language-group[data-language="'+e+'"]',t).show()})})}},i.behaviors.productReadMoreBehavior={attach:function(e,t){l("productReadMore",".read-more-btn",e).forEach(function(e){L(e).on("click",function(e){e.preventDefault();var e=L(this).data("target");e&&""!==e?0<(e=L("#"+e)).length&&(e.find(".full-content").slideToggle(),e.find(".teaser-text").toggle(),e="Read More"===L(this).text().trim()?"Read Less":"Read More",L(this).text(e)):console.warn("Read More: Target ID missing for this element.")})})}},i.behaviors.videoBannerControls={attach:function(e,t){l("videoBannerControls",".video-section",e).forEach(function(e){let o=e.querySelector(".video-banner"),s=e.querySelector(".video-play-pause"),n=e.querySelector(".video-mute-unmute"),l=e.querySelector(".video-progress"),d=e.querySelector(".video-time");e=e.querySelector(".video-fullscreen");if(o&&s){let t=s.querySelector(".video-icon--play"),i=s.querySelector(".video-icon--pause"),r=n?n.querySelector(".video-icon--mute"):null,a=n?n.querySelector(".video-icon--unmute"):null;function c(e,t){e&&(t?e.setAttribute("hidden",""):e.removeAttribute("hidden"))}function u(e,t){e=e.querySelector(".visually-hidden");e&&(e.textContent=t)}function h(){var e=o.paused?"Play":"Pause";
1s.setAttribute("aria-label",e),u(s,e),c(t,!o.paused),c(i,o.paused)}function p(){var e;n&&(e=o.muted?"Unmute":"Mute",n.setAttribute("aria-label",e),u(n,e),c(r,o.muted),c(a,!o.muted))}function m(e){o.dataset.userPaused=e?"1":"0"}function g(){var e;"1"!==o.dataset.userPaused&&(e=o.play())&&"function"==typeof e.catch&&e.catch(function(){})}function f(){o.paused||o.pause()}function v(e){var t=Math.floor(e/60),e=Math.floor(e%60);return t+":"+(e<10?"0":"")+e}function y(){var e,t;d&&(e=v(o.currentTime||0),t=v(o.duration||0),d.textContent=e+" / "+t)}o.loop=!0,o.dataset.userPaused=o.dataset.userPaused||"0",o.dataset.wasPlayingBeforeHide="0",s.addEventListener("click",function(){o.paused?(m(!1),g()):(m(!0),o.pause()),h()}),n&&n.addEventListener("click",function(){o.muted=!o.muted,p()}),(l||d)&&o.addEventListener("timeupdate",function(){var e=o.currentTime/o.duration*100;l&&(l.value=e||0),y()}),l&&l.addEventListener("input",function(){var e=l.value/100*o.duration;o.currentTime=e}),e&&e.addEventListener("click",function(){o.requestFullscreen?o.requestFullscreen():o.webkitRequestFullscreen?o.webkitRequestFullscreen():o.msRequestFullscreen&&o.msRequestFullscreen()}),d&&(o.addEventListener("loadedmetadata",y),o.addEventListener("pause",y),o.addEventListener("play",y)),o.addEventListener("pause",h),o.addEventListener("play",h),n&&o.addEventListener("volumechange",p),o.addEventListener("pause",function(){}),o.addEventListener("ended",function(){"1"!==o.dataset.userPaused&&g()}),document.addEventListener("visibilitychange",function(){document.hidden?(o.dataset.wasPlayingBeforeHide=(!o.paused).toString(),f()):("true"!==o.dataset.wasPlayingBeforeHide&&"1"!==o.dataset.wasPlayingBeforeHide||g(),o.dataset.wasPlayingBeforeHide="0")}),"IntersectionObserver"in window&&new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting?o.hasAttribute("autoplay")&&g():f()})},{threshold:.25}).observe(o),h(),p()}})}}})(jQuery,Drupal,once),(e=>{e.behaviors.aosInit={attach:function(e,t){"undefined"!=typeof AOS&&e.querySelectorAll("[data-aos]").length&&(window.__cataAOSInitialized?"function"==typeof AOS.refreshHard?AOS.refreshHard():"function"==typeof AOS.refresh&&AOS.refresh():(AOS.init({duration:1e3,once:!0}),window.__cataAOSInitialized=!0,window.addEventListener("load",function(){setTimeout(function(){"function"==typeof AOS.refreshHard?AOS.refreshHard():"function"==typeof AOS.refresh&&AOS.refresh()},600)})))}},e.behaviors.cataVisuallyHiddenH1Hotfix={attach:function(e){var o=[],s="data-cata-visually-hidden-h1",n="data-cata-heading-hierarchy-fixed";once("cata-visually-hidden-h1-hotfix","body",e).forEach(function(){var e,t=document.querySelector("body.node--type-route #main-content");if(!t)for(e=0;e<o.length&&!(t=document.querySelector("body.page-node-"+o[e]+" #main-content"));e++);if(t){t.querySelector("["+s+"]")||document.querySelector("h1")||((i=document.createElement("h1")).className="visually-hidden",i.setAttribute(s,""),i.textContent=(document.title||"").split("|")[0].trim()||"Page heading",t.prepend(i));var i,r=t;if(r&&!r.hasAttribute(n)&&document.querySelector("h1")&&!r.querySelector("h2")&&r.querySelector("h3")){for(var a=6;3<=a;a--)r.querySelectorAll("h"+a).forEach(function(e){var t=document.createElement("h"+(a-1));for(Array.prototype.forEach.call(e.attributes,function(e){t.setAttribute(e.name,e.value)});e.firstChild;)t.appendChild(e.firstChild);e.parentNode.replaceChild(t,e)});r.setAttribute(n,"1")}}})}},e.behaviors.accessibleSelectLabel={attach:function(e){e=e.querySelector("#edit-field-start-date-value");e&&!e.hasAttribute("data-accessibility-processed")&&(e.setAttribute("data-accessibility-processed","true"),e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||e.setAttribute("aria-label","Year"))}},e.behaviors.cataSelect2SelectionSearchLabel={attach:function(e){function i(e){e&&e.querySelectorAll&&(e=e.querySelectorAll(".select2-selection .select2-search__field"),Array.prototype.forEach.call(e,function(e){var t,i,r,a,o=e.closest(".select2-selection");o&&(t=(e=>{if(!(e=e.closest(".select2-container")))return null;for(var t=e.previousElementSibling;t;){if("SELECT"===t.tagName)return t;t=t.previousElementSibling}return(e=e.parentElement)?e.querySelector("select.select2-hidden-accessible, select"):null})(o),i=(t=>{if(!t)return null;var e,i=null;if(t.id)try{i=document.querySelector('label[for="'+(window.CSS&&CSS.escape?CSS.escape(t.id):t.id.replace(/"/g,'\\"'))+'"]')}
1catch(e){i=document.querySelector('label[for="'+t.id+'"]')}return i||(e=t.getAttribute("aria-labelledby"))&&(i=document.getElementById(e.trim().split(/\s+/)[0])),i||(e=t.closest(".form-item, .js-form-item, .form-group"))&&(i=e.querySelector("label")),!i||!i.isConnected||"none"===(t=window.getComputedStyle(i)).display||"hidden"===t.visibility||"true"===i.getAttribute("aria-hidden")?null:i})(t),o=o,a=t,r=(r=(r=i)?(r.textContent||"").trim():"")||(o&&o.getAttribute("title")||a&&(a.getAttribute("aria-label")||a.getAttribute("title"))||"Search").toString().trim(),e.id||(e.id="cata-s2-search-"+(t&&t.id?t.id:Math.random().toString(36).slice(2,9))),i?(i.id||(i.id="cata-s2-lbl-"+(t&&t.id?t.id:Math.random().toString(36).slice(2,9))),e.setAttribute("aria-labelledby",i.id),e.removeAttribute("aria-label")):(e.removeAttribute("aria-labelledby"),e.setAttribute("aria-label",r)),e.setAttribute("data-cata-select2-labelled","1"))}))}i(e instanceof Document||e&&1===e.nodeType?e:document),once("cataSelect2SelectionSearchLabelObserve","body",e).forEach(function(e){var t;"undefined"!=typeof MutationObserver&&(t=null,new MutationObserver(function(){t=t||window.setTimeout(function(){t=null,i(document)},50)}).observe(e,{childList:!0,subtree:!0}))})}}})(Drupal),(i=>{let r,a,o,s="The Google Maps JavaScript API",n="google",l="importLibrary",d=document,e=window,c=(e=e[n]||(e[n]={})).maps||(e.maps={}),u=new Set,h=new URLSearchParams;c[l]?console.warn(s+" only loads once. Ignoring:",i):c[l]=(e,...t)=>u.add(e)&&(r=r||new Promise(async(e,t)=>{for(o in await(a=d.createElement("script")),h.set("libraries",[...u]+""),i)h.set(o.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),i[o]);h.set("callback",n+".maps.__ib__"),a.src=`https://maps.${n}apis.com/maps/api/js?`+h,c.__ib__=e,a.onerror=()=>r=t(Error(s+" could not load."));e=d.querySelector("script[nonce]");a.nonce=e&&e.nonce||"",d.head.append(a)})).then(()=>c[l](e,...t))})({key:"AIzaSyBL0Am9Y4d_UV-JPwJDJpicRJP_Y9bZJwU",v:"weekly"}),((e,t)=>{e.behaviors.cataHeaderAlertTicker={attach(e){t("cataHeaderAlertTicker",".cata-alerts-banner",e).forEach(t=>{let i=t.querySelector(".cata-alerts-banner__left"),r=t.querySelector(".cata-alerts-banner__text");var e;i&&r&&((e=()=>{t.classList.remove("is-overflow"),r.removeAttribute("title");var e=Math.max(0,i.clientWidth-32);8<r.scrollWidth-e&&(t.classList.add("is-overflow"),r.setAttribute("title",r.textContent||""))})(),window.addEventListener("resize",e,{passive:!0}))})}}})(Drupal,once),(e=>{var t;document.getElementById("cata-hide-flags-style")||((t=document.createElement("style")).id="cata-hide-flags-style",t.textContent=` 2 /* Hide all flag images in gtranslate (except default-flag) */ 3 .gtranslate_wrapper .gt_selected a img:not(.default-flag), 4 .gtranslate_wrapper .gt_option a img:not(.default-flag) { 5 display: none !important; 6 visibility: hidden !important; 7 opacity: 0 !important; 8 } 9 `,document.head.appendChild(t));let b=()=>{document.querySelectorAll(".gtranslate_wrapper").forEach(e=>{var t,i=e.querySelector(".gt_selected a"),e=e.querySelector(".gt_option");!i||(i.querySelectorAll("img:not(.default-flag)").forEach(e=>{e.remove()}),t=i.querySelector("img.default-flag"))||((t=document.createElement("img")).src="/themes/custom/cata/html/src/assets/img/translate.png",t.alt="Language selector",t.className="default-flag",t.style.width="24px",t.style.height="24px",t.style.marginRight="8px",i.insertBefore(t,i.firstChild)),e&&(e.querySelectorAll("img:not(.default-flag)").forEach(e=>{e.remove()}),e.querySelectorAll("a").forEach(e=>{var t=e.querySelector("img.default-flag");t||((t=document.createElement("img")).src="/themes/custom/cata/html/src/assets/img/translate.png",t.alt=e.getAttribute("title")||"Language selector",t.className="default-flag",t.style.width="24px",t.style.height="24px",t.setAttribute("width","24"),t.setAttribute("height","24"),e.insertBefore(t,e.firstChild))}))})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{b(),setTimeout(b,100),setTimeout(b,300),setTimeout(b,500),setTimeout(b,1e3),setTimeout(b,2e3)}):(b(),setTimeout(b,100),setTimeout(b,300),setTimeout(b,500),setTimeout(b,1e3),setTimeout(b,2e3)),new MutationObserver(()=>{b()}).observe(document.body,{childList:!0,subtree:!0}),e.behaviors.cataHeader={attach:function(e,t){function i(){var e,t=document.querySelector("#header-search-container");t&&(e=!t.classList.contains("show"),t.classList.toggle("show"),r({announce:!0}
9),e)&&(t=s().container)&&((e=n(t)).length?e[0]:(t.setAttribute("tabindex","-1"),t)).focus()}let o="modal-overlay-open",s=()=>({container:document.querySelector("#header-search-container"),toggle:document.querySelector("#header-search-toggle"),modalOverlay:document.querySelector(".modal-overlay")}),r=e=>{e=e||{};var t,{container:i,toggle:r,modalOverlay:a}=s();i&&r&&(t=i.classList.contains("show"),r.setAttribute("aria-expanded",t?"true":"false"),i.setAttribute("aria-hidden",t?"false":"true"),r=t,(i=a)&&(i.classList.toggle("show",r),i.setAttribute("aria-hidden",r?"false":"true")),document.body.classList.toggle(o,r),e.announce)&&t&&(()=>{let e=document.getElementById("header-search-state-announce");e&&(e.textContent="",window.requestAnimationFrame(function(){e.textContent="Site search area expanded."}))})()},n=e=>e?Array.from(e.querySelectorAll(["a[href]","area[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","iframe","object","embed","[contenteditable='true']","[tabindex]:not([tabindex='-1'])"].join(","))).filter(e=>!(e.hidden||"true"===e.getAttribute("aria-hidden")||"object"==typeof e.offsetParent&&null===e.offsetParent)):[],a=(r(),!1),S=(once("cataHeaderSearchA11yObserver","body",e).forEach(function(){var e=s().container;e&&new MutationObserver(()=>r()).observe(e,{attributes:!0,attributeFilter:["class"]})}),once("cataHeaderSearchFocusTrap","body",e).forEach(function(){document.addEventListener("keydown",function(e){var t,i,r,a,o;"Tab"===e.key&&(t=s().container)&&t.classList.contains("show")&&({container:t,toggle:i}=s(),t)&&((o=n(t)).length?(r=document.activeElement,a=o[0],o=o[o.length-1],r&&!t.contains(r)&&i!==r?(e.preventDefault(),(e.shiftKey?o:a).focus()):e.shiftKey?r!==a&&r!==t||(e.preventDefault(),o.focus()):r===o&&(e.preventDefault(),a.focus())):(e.preventDefault(),t.setAttribute("tabindex","-1"),t.focus()))})}),once("cataHeaderSearchToggleKeydown","#header-search-toggle",e).forEach(function(e){e.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),a=!0,i(),setTimeout(function(){a=!1},0))})}),once("cataHeaderSearchIcon",".search-icon__header",e).forEach(function(e){e.addEventListener("click",function(e){a?(e.preventDefault(),e.stopImmediatePropagation()):i()})}),once("cataCloseIcon",".close-icon__header",e).forEach(function(e){e.addEventListener("click",function(){var e=document.querySelector("#header-search-container"),t=document.querySelector("#header-search-toggle");e&&e.classList.remove("show"),r({announce:!0}),t&&t.focus()})}),once("cataHeaderEscKey","body",e).forEach(function(){document.addEventListener("keydown",function(e){var t;"Escape"!==e.key&&27!==e.keyCode||(e=document.querySelector("#header-search-container"),t=document.querySelector("#header-search-toggle"),e&&e.classList.contains("show")&&(e.classList.remove("show"),r({announce:!0}),t)&&t.focus())})}),once("cataHeaderOverlayClick",".modal-overlay",e).forEach(function(i){i.addEventListener("click",function(){var e,t;i.classList.contains("show")&&(e=document.querySelector("#header-search-container"),t=document.querySelector("#header-search-toggle"),e&&e.classList.remove("show"),r({announce:!0}),t)&&t.focus()})}),()=>{document.querySelectorAll(".gtranslate_wrapper").forEach(e=>{var t=e.querySelector(".gt_selected a"),e=e.querySelector(".gt_option");t&&t.querySelectorAll("img:not(.default-flag)").forEach(e=>{e.remove()}),e&&e.querySelectorAll("img:not(.default-flag)").forEach(e=>{e.remove()})})});S(),b(),once("cataGtranslate",".gtranslate_wrapper",e).forEach(function(t){let r=t.querySelector(".gt_selected a"),i=t.querySelector(".gt_option");if(!r||!i)return;let a=Array.from(i.querySelectorAll("a")),o=0,s=()=>{var e=Array.from(r.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE&&e.textContent.trim()).map(e=>e.textContent.trim()).join(" ").trim();r.querySelectorAll("img").forEach(e=>{e.classList.contains("default-flag")||e.remove()}),S();let t=r.querySelector("img.default-flag"),i=(t?t.src=
9"/themes/custom/cata/html/src/assets/img/translate.png":((t=document.createElement("img")).src="/themes/custom/cata/html/src/assets/img/translate.png",t.alt="Language selector",t.className="default-flag",t.style.width="24px",t.style.height="24px",t.style.marginRight="8px",r.insertBefore(t,r.firstChild)),r.querySelector("span.translation-text"));e&&(i||(Array.from(r.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).forEach(e=>{r.removeChild(e)}),(i=document.createElement("span")).className="translation-text",r.appendChild(i)),i.textContent=e),n()},n=()=>{var e=r.querySelector("span.translation-text"),e=(e||r).textContent.trim();if(e){let t=document.body;Array.from(t.classList).filter(e=>e.startsWith("lang-")||e.startsWith("language-")).forEach(e=>t.classList.remove(e));e=e.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");e&&t.classList.add("lang-"+e)}},l=()=>{var e=Array.from(i.querySelectorAll("a"));(a=e).forEach(i=>{var r=i.querySelector("img:not(.default-flag)");if(r){var a=Array.from(i.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE&&e.textContent.trim()).map(e=>e.textContent.trim()).join(" ").trim();r.remove();let e=i.querySelector("img.default-flag"),t=(e?e.src=
9"/themes/custom/cata/html/src/assets/img/translate.png":((e=document.createElement("img")).src="/themes/custom/cata/html/src/assets/img/translate.png",e.alt=i.getAttribute("title")||"Language selector",e.className="default-flag",e.style.width="24px",e.style.height="24px",e.setAttribute("width","24"),e.setAttribute("height","24"),i.insertBefore(e,i.firstChild))
9,i.querySelector("span.translation-text"));a&&(t||(Array.from(i.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).forEach(e=>{i.removeChild(e)}),(t=document.createElement("span")).className="translation-text",i.appendChild(t)),t.textContent=a)}})};s(),l(),n();var e=new MutationObserver(()=>{s(),l(),n(),a.forEach(e=>{e.hasAttribute("data-gt-updated")||(e.setAttribute("data-gt-updated","true"),e.addEventListener("click",()=>{setTimeout(()=>{s(),l(),n(),i.classList.remove("active")},100)}))})});e.observe(r,{childList:!0,subtree:!0,characterData:!0}),e.observe(i,{childList:!0,subtree:!0});let d=()=>{S(),void 0!==b&&b(),s(),l()},c=(setTimeout(d,50),setTimeout(d,100),setTimeout(d,300),setTimeout(d,500),setTimeout(d,1e3),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{setTimeout(d,100),setTimeout(d,500)}):setTimeout(d,100),new MutationObserver(()=>{S(),void 0!==b&&b()}).observe(document.body,{childList:!0,subtree:!0}),a.forEach(e=>{e.setAttribute("data-gt-updated","true"),e.addEventListener("click",()=>{setTimeout(()=>{s(),l(),n(),i.classList.remove("active")},100)})}),e=>{e?(t.style.outline="1px solid transparent",t.style.outlineOffset="4px"):(t.style.outline="",t.style.outlineOffset="")}),u=()=>"block"===i.style.display||"0px"!==i.style.height,h=()=>{t.click()},p=e=>{a.length&&(o=(e+a.length)%a.length,a[o].focus())},m=(i.id||(i.id="gtranslate-listbox-"+Math.random().toString(36).substr(2,9)),t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-label","Select language for translation "),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls",i.id),r.setAttribute("role","button"),r.setAttribute("aria-haspopup","listbox"),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-controls",i.id),i.setAttribute("role","listbox"),a.forEach(e=>e.setAttribute("role","option")),[r,...a].forEach(e=>{e.addEventListener("focus",()=>c(!0)),e.addEventListener("blur",()=>c(!1))}),()=>{var e=u();t.setAttribute("aria-expanded",e?"true":"false"),r.setAttribute("aria-expanded",e?"true":"false")}),g=()=>{i.classList.contains("active")?r.classList.remove("open"):r.classList.add("open")},f=()=>{var e="new-class-to-a";i.classList.contains("active")?r.classList.remove(e):r.classList.add(e)},v=(e=!1)=>{u()?e&&a.length?a[0].focus():m():(h(),i.classList.add("active"),g(),f(),setTimeout(()=>{m(),e&&a.length&&(o=0,a[o].focus())},50))},y=()=>{u()?(h(),i.classList.remove("active"),g(),f(),setTimeout(m,50)):(i.classList.remove("active"),g(),f(),m())};r.addEventListener("click",e=>{e.preventDefault(),h(),i.classList.toggle("active"),g(),f(),setTimeout(m,50)}),r.addEventListener("keydown",e=>{var t=e.key;"Enter"===t||" "===t||"Spacebar"===t||"ArrowDown"===t||"Down"===t?(e.preventDefault(),v(!0)):"ArrowUp"!==t&&"Up"!==t||(e.preventDefault(),v(!0),p(a.length-1))}),i.addEventListener("keydown",e=>{var t=e.key;"ArrowDown"===t||"Down"===t?(e.preventDefault(),p(o+1)):"ArrowUp"===t||"Up"===t?(e.preventDefault(),p(o-1)):"Escape"===t||"Esc"===t?(e.preventDefault(),y(),r.focus()):"Tab"===t?y():" "!==t&&"Spacebar"!==t||(e.preventDefault(),a[o].click())});document.addEventListener("click",e=>{var e=e.target;t.contains(e)||(e=e.closest(".dropdown-menu")||e.closest('[data-bs-toggle="dropdown"]')||e.closest(".
9nav-item.menu-item--expanded.dropdown"))&&!e.closest(".gtranslate_wrapper")||(u()||i.classList.contains("active"))&&y()}),setTimeout(m,100),g(),f(),setTimeout(()=>{g(),f(),m()},200),setTimeout(()=>{g(),f(),m()},500),new MutationObserver(()=>{g(),f(),m()}).observe(i,{attributes:!0,attributeFilter:["class"]})}),once("cataHeaderDropdownScrollLock","body",e).forEach(function(){let e=()=>{var e=document.querySelector("header"),e=!(!e||!e.querySelector(".dropdown-menu.show, .parent-dropdown-menu.show, .gt_option.active"));document.body.classList.toggle("is-header-dropdown-open",e)};document.addEventListener("shown.bs.dropdown",e,!0),document.addEventListener("hidden.bs.dropdown",e,!0),document.addEventListener("click",()=>setTimeout(e,0),!0),window.addEventListener("resize",e),e()})},detach:function(e,t,i){}}})((jQuery,Drupal)),(i=>{let r,a,o,s="The Google Maps JavaScript API",n="google",l="importLibrary",d=document,e=window,c=(e=e[n]||(e[n]={})).maps||(e.maps={}),u=new Set,h=new URLSearchParams;c[l]?console.warn(s+" only loads once. Ignoring:",i):c[l]=(e,...t)=>u.add(e)&&(r=r||new Promise(async(e,t)=>{for(o in await(a=d.createElement("script")),h.set("libraries",[...u]+""),i)h.set(o.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),i[o]);h.set("callback",n+".maps.__ib__"),a.src=`https://maps.${n}apis.com/maps/api/js?`+h,c.__ib__=e,a.onerror=()=>r=t(Error(s+" could not load.")),a.nonce=d.querySelector("script[nonce]")?.nonce||"",d.head.append(a)})).then(()=>c[l](e,...t))})({key:"AIzaSyBL0Am9Y4d_UV-JPwJDJpicRJP_Y9bZJwU",v:"weekly"}),((e,t,r)=>{e.behaviors.cataRiderAlertsCount={attach(e){let i=Number(r?.cata?.riderAlertsCount||0);!Number.isFinite(i)||i<1||t("cataRiderAlertsCount",".navbarNav .nav-item .nav-link.nav-link--rider-alerts",e).forEach(e=>{var t;e.querySelector(".rider-alerts-count-badge")||((t=document.createElement("span")).className="rider-alerts-count-badge",t.setAttribute("aria-label",i+" rider alerts"),t.textContent=String(i),e.appendChild(t))})}}})(Drupal,once,drupalSettings),(i=>{let r,a,o,s="google",n="importLibrary",l=document,e=window,d=(e=e[s]||(e[s]={})).maps||(e.maps={}),c=new Set,u=new URLSearchParams;d[n]||(d[n]=(e,...t)=>c.add(e)&&(r=r||new Promise(async(e,t)=>{for(o in await(a=l.createElement("script")),u.set("libraries",[...c]+""),i)u.set(o.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),i[o]);u.set("callback",s+".maps.__ib__"),a.src=`https://maps.${s}apis.com/maps/api/js?`+u,d.__ib__=e,a.onerror=()=>r=t(Error("The Google Maps JavaScript API could not load."));e=l.querySelector("script[nonce]");a.nonce=e&&e.nonce||"",l.head.append(a)})).then(()=>d[n](e,...t)))})({key:"AIzaSyBL0Am9Y4d_UV-JPwJDJpicRJP_Y9bZJwU",v:"weekly"});let CATA_GTFS_CALENDAR_DATE_EXCEPTIONS=[{service_id:"23",date:"20260525",exception_type:1},{service_id:"16",date:"20260525",exception_type:2},{service_id:"24",date:"20260704",exception_type:1},{service_id:"3",date:"20260704",exception_type:2}];function cataGtfsDateToIso(e){e=String(e??"").trim();return/^\d{8}$/.test(e)?`${e.slice(0,4)}-${e.slice(4,6)}-`+e.slice(6,8):""}function cataFormatHolidayLabelFromIso(t){var e=String(t).trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!e)return t;var i=Number(e[1]),r=Number(e[2])-1,e=Number(e[3]),i=new Date(i,r,e);if(Number.isNaN(i.getTime()))return t;try{return i.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}catch(e){return t}}let __cataGtfsHolidayIsoMap=null;function getCataGtfsHolidayIsoMap(){if(__cataGtfsHolidayIsoMap)return __cataGtfsHolidayIsoMap;let t=new Map;return CATA_GTFS_CALENDAR_DATE_EXCEPTIONS.forEach(e=>{e=cataGtfsDateToIso(e.date);e&&!t.has(e)&&t.set(e,cataFormatHolidayLabelFromIso(e))}),__cataGtfsHolidayIsoMap=t}function schedulesApp(){let o="https://cata.alerts.api.exemplifi.io/api/v1",s={Accept:"application/json","X-API-KEY":"sk_live_SOdoS2lNrADb82dOIDtRcz_t33L3Zx0t"},n="__cataRoutesIndexCache_v1",r=new Map,t=new Map;return{_didInit:!1,busRoutes:[],selectedRoute:null,serviceDirections:[{Value:"__loading__",Text:"Loading..."}],selectedDirection:{Value:"__loading__",Text:"Loading..."},stops:[],selectedFirstStop:null,firstStops:[],selectedEndStop:null,endStops:[],showBetweenStops:!0,schedule:[],filteredSchedule:[],displaySchedule:[],scheduleAnnouncement:"",scheduleAnnouncementSeq:0,searchValidationMessage:"",noTripsForSearch:!1,suppressStopAnnouncements:!1,isFiltered:!1,startTime:"",endTime:"",startTimeHour:"",startTimeMinute:"",startTimeMeridiem:"AM",endTimeHour:"",endTimeMinute:"",endTimeMeridiem:"AM",routeInfo:{},selectedServiceDay:"",selectedServiceDate:"",selectedServiceDayType:"",selectedHolidayName:"",noHolidayServiceForRoute:!1,directionCanonicalStartId:"",directionCanonicalEndId:"",invalidDate:!1,invalidDateMessage:"There are currently no schedules available for the selected date.",noRoutes:!1,noRoutesMessage:"There are no routes scheduled for this date.",showLoading:!0,showLocations:!1,showDirections:!1,showDetours:!1,showSnowRoute:!1,showCtrlScrollMessage:!1,ctrlScrollMessageTimeout:null,ctrlScrollHintText:"Use Ctrl + scroll to zoom the map",stopsLoaded:!1,hideTopRowsNext:!0,route126Link:"",routeServices:[],selectedService:null,selectedRouteId:"",selectedDirectionId:"__loading__",selectedFirstStopRowIndex:null,selectedEndStopRowIndex:null,date:"",time:"",mapCtrl:null,stopMarkers:[],routePolyline:null,routeNodeAssetCache:{},routeBrochureClickHandler:null,routeAlerts:[],routeAlertsLoading:!1,routeAlertsError:"",routeAlertsAccordionOpen:!1,routeAlertsReady:!1,isRouteLoading:!0,loadingMessage:"Loading Schedules",scheduleDebugEnabled:!0,stopTracker:e=>e?e.stop_id:"",normalizeHtmlTimeModel(t){t=String(t??"").trim().replace(/^(AM|PM)\s+/i,"").replace(/\s+(AM|PM)$/i,"").trim();if(t){var i=t.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);if(i)return r=Number(i[1]),i=Number(i[2]),!Number.isFinite(r)||!Number.isFinite(i)||r<0||23<r||i<0||59<i?"":String(r).padStart(2,"0")+":"+String(i).padStart(2,"0");var r=t.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(r){let e=parseInt(r[1],10);i=parseInt(r[2],10),t=r[3].toUpperCase();return Number.isNaN(e)||Number.isNaN(i)||59<i||e<1||12<e?"":("PM"===t&&e<12&&(e+=12),"AM"===t&&12===e&&(e=0),String(e).padStart(2,"0")+":"+String(i).padStart(2,"0"))}}return""},logScheduleDebug(t,e={}){if(this.scheduleDebugEnabled)try{let i=Array.isArray(this.stops)?this.stops:[];var a=Array.isArray(this.schedule)?this.schedule:[];let r=Array.isArray(a?.[0]?.Value)?a[0].Value:[];var o={stage:t,route:this.selectedRoute?.route_short_name||"",direction:this.selectedDirectionId,dayType:this.selectedServiceDayType,selectedFirstStopRowIndex:this.selectedFirstStopRowIndex,selectedEndStopRowIndex:this.selectedEndStopRowIndex,selectedFirstStopId:this.selectedFirstStop?.stop_id||"",selectedEndStopId:this.selectedEndStop?.stop_id||"",stopsCount:i.length,scheduleTripsCount:a.length,stopsTop10:i.slice(0,10).map((e,t)=>({i:t,stop_id:e?.stop_id,stop_name:e?.stop_name,row_sequence:e?.row_sequence})),stopsBottom10:i.slice(-10).map((e,t)=>({i:i.length-Math.min(10,i.length)+t,stop_id:e?.stop_id,stop_name:e?.stop_name,row_sequence:e?.row_sequence})),firstTripTop10:r.slice(0,10).map((e,t)=>({i:t,stop_id:e?.stop_id,stop_name:e?.stop_name,sequence:e?.sequence,departure_time:e?.departure_time})),firstTripBottom10:r.slice(-10).map((e,t)=>({i:r.length-Math.min(10,r.length)+t,stop_id:e?.stop_id,stop_name:e?.stop_name,sequence:e?.sequence,departure_time:e?.departure_time})),...e};console.log("[schedules-debug]",o)}catch(e){console.log("[schedules-debug]",t,"log-error",e)}},getTimeHourOptions(){return Array.from({length:12},(e,t)=>String(t+1).padStart(2,"0"))},getTimeMinuteOptions(){return Array.from({length:60},(e,t)=>String(t).padStart(2,"0"))},getTimeMeridiemOptions(){return["AM","PM"]},parseModelToTimeParts(e){var t,i,e=this.normalizeHtmlTimeModel(e);return e?([e,t]=e.split(":"),e=Number(e),t=String(t??"00").padStart(2,"0"),i=12<=e?"PM":"AM",{hour:String(e%12||12).padStart(2,"0"),minute:t,meridiem:i}):{hour:"",minute:"",meridiem:"AM"}},composeModelFromTimeParts(e,t,i){if(!e||!t||!i)return"";e=Number(e),t=Number(t);if(!Number.isFinite(e)||!Number.isFinite(t)||e<1||12<e||t<0||59<t)return"";let r=e%12;return"PM"===String(i).toUpperCase()&&(r+=12),String(r).padStart(2,"0")+":"+String(t).padStart(2,"0")},syncTimePartsFromModels(){var e=this.parseModelToTimeParts(this.startTime),e=(this.startTimeHour=e.hour,this.startTimeMinute=e.minute,this.startTimeMeridiem=e.meridiem,this.parseModelToTimeParts(this.endTime));this.endTimeHour=e.hour,this.endTimeMinute=e.minute,this.endTimeMeridiem=e.meridiem},syncModelsFromTimeParts(){this.startTime=this.composeModelFromTimeParts(this.startTimeHour,this.startTimeMinute,this.startTimeMeridiem),this.endTime=this.composeModelFromTimeParts(this.endTimeHour,this.endTimeMinute,this.endTimeMeridiem)}
9,async init(){this._didInit||(this._didInit=!0,this.setScheduleSectionsVisibility(!1),await this.initializeMap(),await this.getDateRange(),this.readHashParams(),this.setDefaultServiceDate(),this.selectedServiceDayType||this.setDefaultDayType(),await this.setDayType(),this.startTime=this.normalizeHtmlTimeModel(this.startTime),this.endTime=this.normalizeHtmlTimeModel(this.endTime),this.syncTimePartsFromModels(),this.setupStickyHeader())},async initializeMap(){if("undefined"!=typeof google&&google.maps&&google.maps.importLibrary){let t=()=>{var e=document.getElementById("routeMap");!e||null===e.offsetParent?setTimeout(t,200):this.initMapInstance(e)};t()}else setTimeout(()=>this.initializeMap(),100)},async initMapInstance(e){try{var t,i,r;this.mapCtrl||(t=(await google.maps.importLibrary("maps")).Map,"function"==typeof window.cataMapsTouchPrimaryZoom&&window.cataMapsTouchPrimaryZoom(),i={gestureHandling:"cooperative",center:new google.maps.LatLng(42.73386,-84.555363),zoom:12,scrollwheel:!1,disableDefaultUI:!0,zoomControl:!0,zoomControlOptions:{position:google.maps.ControlPosition.RIGHT_CENTER}},(r=e||document.getElementById("map"))&&(this.mapCtrl=new google.maps.Map(r,i),this.ensureCtrlScrollHintElement(r),r)&&r.addEventListener("wheel",e=>{e.ctrlKey?(this.mapCtrl.setOptions({scrollwheel:!0}),this.toggleCtrlScrollHint(!1),this.ctrlScrollMessageTimeout&&(clearTimeout(this.ctrlScrollMessageTimeout),this.ctrlScrollMessageTimeout=null)):(this.mapCtrl.setOptions({scrollwheel:!1}),this.toggleCtrlScrollHint(!0),this.ctrlScrollMessageTimeout&&clearTimeout(this.ctrlScrollMessageTimeout),this.ctrlScrollMessageTimeout=setTimeout(()=>{this.toggleCtrlScrollHint(!1),this.ctrlScrollMessageTimeout=null},2500))},{passive:!0}))}catch(e){}},ensureCtrlScrollHintElement(e){var t,i;e&&"1"!==e.dataset.ctrlScrollHintAttached&&((t=document.createElement("div")).className="ctrl-scroll-hint",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.style.position="absolute",t.style.bottom="12px",t.style.left="12px",t.style.padding="8px 12px",t.style.background="rgba(17, 24, 39, 0.88)",t.style.color="#fff",t.style.fontSize="13px",t.style.borderRadius="6px",t.style.zIndex="10",t.style.display="none",t.textContent=this.ctrlScrollHintText,i=e.parentElement)&&(i.style.position||(i.style.position="relative"),i.appendChild(t),e.dataset.ctrlScrollHintAttached="1",e._ctrlScrollHintEl=t)},toggleCtrlScrollHint(e){this.showCtrlScrollMessage=Boolean(e);e=document.getElementById("routeMap")||document.getElementById("map"),e=e&&e._ctrlScrollHintEl?e._ctrlScrollHintEl:null;e&&(e.style.display=this.showCtrlScrollMessage?"block":"none")},displayStopsOnMap(){if(this.mapCtrl&&this.stops&&0!==this.stops.length){this.stopMarkers.forEach(e=>e.setMap(null)),this.stopMarkers=[],this.routePolyline&&(this.routePolyline.setMap(null),this.routePolyline=null);let o=new google.maps.LatLngBounds,s=[];if(this.stops.forEach((i,r)=>{if(this.setShowStop(i,r)&&i.Latitude&&i.Longitude){var a=new google.maps.LatLng(parseFloat(i.Latitude),parseFloat(i.Longitude));s.push(a),o.extend(a);let e=new google.maps.Marker({position:a,map:this.mapCtrl,title:`Stop #${i.stop_id}: `+i.stop_name,label:{text:i.stop_id.toString(),color:"white",fontSize:"11px",fontWeight:"bold"},icon:{path:google.maps.SymbolPath.CIRCLE,scale:8,fillColor:"#003DA6",fillOpacity:1,strokeColor:"#ffffff",strokeWeight:2}}),t=(r!==this.selectedFirstStopRowIndex&&r!==this.selectedEndStopRowIndex||e.setIcon({path:google.maps.SymbolPath.CIRCLE,scale:12,fillColor:"#671E65",fillOpacity:1,strokeColor:"#ffffff",strokeWeight:3}),new google.maps.InfoWindow({content:`<div><strong>Stop #${i.stop_id}</strong><br>${i.stop_name}</div>`}));e.addListener("click",()=>{t.open(this.mapCtrl,e)}),this.stopMarkers.push(e)}}),1<s.length&&(this.routePolyline=new google.maps.Polyline({path:s,geodesic:!0,strokeColor:"#003DA6",strokeOpacity:.8,strokeWeight:4}),this.routePolyline.setMap(this.mapCtrl)),0<s.length){this.mapCtrl.fitBounds(o);let e=google.maps.event.addListener(this.mapCtrl,"bounds_changed",()=>{15<this.mapCtrl.getZoom()&&this.mapCtrl.setZoom(15),google.maps.event.removeListener(e)})}}},readHashParams(){var e=window.location.hash.replace("#",""),e=new URLSearchParams(e);e.has("route")?(e=String(e.get("route")??"").trim(),this.selectedRouteId=e||""):this.selectedRouteId=""},updateHashParams(){var e=new URLSearchParams;this.selectedRouteId&&String(this.selectedRouteId).trim()&&e.set("route",String(this.selectedRouteId).trim()),window.location.hash=e.toString()},toDateInputValue(e){var t;return e instanceof Date&&!Number.isNaN(e.getTime())?(t=e=>String(e).padStart(2,"0"),`${e.getFullYear()}-${t(e.getMonth()+1)}-`+t(e.getDate())):""},normalizeGtfsDateToIso(e){var e=String(e??"").trim();return e?/^\d{4}-\d{2}-\d{2}$/.test(e)?e:8===(e=e.replace(/[^\d]/g,"")).length?`${e.slice(0,4)}-${e.slice(4,6)}-`+e.slice(6,8):"":""},toGtfsDateValue(e){e=e instanceof Date?this.toDateInputValue(e):this.normalizeGtfsDateToIso(e)||String(e||"").trim();return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.replace(/-/g,""):""},parseIsoDateLocal(e){var e=this.normalizeGtfsDateToIso(e).match(/^(\d{4})-(\d{2})-(\d{2})$/);return!e||(e=new Date(Number(e[1]),Number(e[2])-1,Number(e[3])),Number.isNaN(e.getTime()))?null:e},getDayTypeForIsoDate(e){var t=this.parseIsoDateLocal(e);return t?this.getHolidayNameForServiceDate(this.normalizeGtfsDateToIso(e))?"holiday":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.getDay()]||"":""},timeCoversSelectedDate(e){var t,i=this.normalizeGtfsDateToIso(this.selectedServiceDate);
9return!!i&&!(!(i=this.toGtfsDateValue(i))||(t=this.toGtfsDateValue(e?.start_date??e?.startDate??""),e=this.toGtfsDateValue(e?.end_date??e?.endDate??""),t&&i<t)||e&&e<i)},timeMatchesSelectedService(e){return this.matchesSelectedDayType(e?.day_type)&&this.timeCoversSelectedDate(e)},collectServiceDateBoundsFromRouteData(e){let i=this.normalizeGtfsDateToIso(e?.schedule_start_date??e?.scheduleStartDate??""),r=this.normalizeGtfsDateToIso(e?.schedule_end_date??e?.scheduleEndDate??"");return(Array.isArray(e?.stops)?e.stops:[]).forEach(e=>{(Array.isArray(e?.times)?e.times:[]).forEach(e=>{var t=this.normalizeGtfsDateToIso(e?.start_date??e?.startDate??""),e=this.normalizeGtfsDateToIso(e?.end_date??e?.endDate??"");t&&(!i||t<i)&&(i=t),e&&(!r||e>r)&&(r=e)})}),{minIso:i||"",maxIso:r||""}},routeHasStopTimesOnDate(e,t,i=""){t=this.normalizeGtfsDateToIso(t);if(t){var r=this.toGtfsDateValue(t),a=this.parseIsoDateLocal(t);if(a){var o,a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][a.getDay()]||"",t=this.getHolidayNameForServiceDate(t),s=[],n=(i?s.push(i):(t&&s.push("holiday"),a&&s.push(a)),Array.isArray(e?.stops)?e.stops:[]);for(o of s){var l=this.selectedServiceDayType;this.selectedServiceDayType=o;let t=!1;for(let e=0;e<n.length&&!t;e+=1){var d=Array.isArray(n[e]?.times)?n[e].times:[];for(let e=0;e<d.length;e+=1){var c=d[e];if(this.matchesSelectedDayType(c?.day_type)){var u=this.toGtfsDateValue(c?.start_date??c?.startDate??""),c=this.toGtfsDateValue(c?.end_date??c?.endDate??"");if(!(u&&r<u||c&&c<r)){t=!0;break}}}}if(this.selectedServiceDayType=l,t)return!0}}}return!1},updateServiceDateBoundsFromRouteData(e){return this.syncServiceDayTypeFromDate(e),this.syncServiceDateInputBounds(),this.refreshInvalidDateFlag(e),!1},syncServiceDateInputBounds(e=null){var t,e=e||("undefined"!=typeof document?document.getElementById("select-service-datetime"):null);e&&(e.removeAttribute("min"),e.removeAttribute("max"),t=this.normalizeGtfsDateToIso(this.selectedServiceDate))&&e.value!==t&&(e.value=t)},getSelectedRouteDataForDateValidation(){var e=String(this.selectedRoute?.route_short_name||this.selectedRouteId||"").trim();return e&&r.get(e)||null},getNoScheduleForRouteMessage(){return"There are currently no schedules available for the selected date."},refreshInvalidDateFlag(e=null){var e=e||this.getSelectedRouteDataForDateValidation(),t=this.normalizeGtfsDateToIso(this.selectedServiceDate);return t&&e?(e=this.routeHasStopTimesOnDate(e,t),this.invalidDate=!e,this.invalidDate&&(this.invalidDateMessage=this.getNoScheduleForRouteMessage()),this.invalidDate):this.invalidDate=!1},setDefaultServiceDate(){var e=this.toDateInputValue(new Date);this.selectedServiceDate=e,this.syncServiceDayTypeFromDate(),this.syncServiceDateInputBounds()},clampSelectedServiceDateToBounds(){var e=this.normalizeGtfsDateToIso(this.selectedServiceDate);return e&&(this.selectedServiceDate=e,this.syncServiceDateInputBounds()),!1},isSelectedServiceDateWithinBounds(){return!!this.normalizeGtfsDateToIso(this.selectedServiceDate)},syncServiceDayTypeFromDate(e=null){var t=String(this.selectedServiceDate||"").trim();if(t){var t=this.normalizeGtfsDateToIso(t),i=this.parseIsoDateLocal(t);if(i){var r=this.getHolidayNameForServiceDate(t);if(r)if(!e||this.routeHasStopTimesOnDate(e,t,"holiday"))return this.selectedServiceDayType="holiday",void(this.selectedHolidayName=r);this.selectedHolidayName="";this.selectedServiceDayType=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][i.getDay()]||"Mon"}else this.setDefaultDayType()}else this.setDefaultDayType()},openServiceDatePicker(e){var t=e?.currentTarget;if(t&&!t.disabled&&"function"==typeof t.showPicker){var i=t.getBoundingClientRect();if(!(Number.isFinite(e.clientX)&&e.clientX>i.right-28))try{t.showPicker()}catch(e){}}},onServiceDateInput(){var e=this.normalizeGtfsDateToIso(this.selectedServiceDate),e=(e&&(this.selectedServiceDate=e),this.getSelectedRouteDataForDateValidation());this.syncServiceDayTypeFromDate(e),this.refreshInvalidDateFlag(e)},onServiceDateChange(){this.rebuildForSelectedServiceDate()},async rebuildForSelectedServiceDate(){var i=this.normalizeGtfsDateToIso(this.selectedServiceDate);if(i&&(this.selectedServiceDate=i),this.syncServiceDateInputBounds(),this.selectedRoute||this.selectedRouteId){this.showLoading=!0,this.loadingMessage="Loading Schedules",this.stopsLoaded=!1,this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.noHolidayServiceForRoute=!1,this.noTripsForSearch=!1;var i=String(this.selectedRoute?.route_short_name||this.selectedRouteId||"").trim();let e=this.getSelectedRouteDataForDateValidation();if(!e&&i&&(e=await this.fetchRouteData(i)),this.syncServiceDayTypeFromDate(e),e)if(this.refreshInvali
9dDateFlag(e))this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.stops=[],this.firstStops=[],this.endStops=[],this.stopsLoaded=!0,this.serviceDirections=[{Value:"__no_directions__",Text:"No directions available"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__no_directions__",this.setScheduleSectionsVisibility(!1),this.showLoading=!1,this.announceScheduleUpdate(this.invalidDateMessage);else{this.invalidDate=!1;let t=this.selectedDirectionId;this.serviceDirections=this.extractDirections(e),this.applyDerivedRouteDisplayName(e),0<this.serviceDirections.length?(i=this.serviceDirections.find(e=>String(e.Value)===String(t)),this.selectedDirection=i||this.serviceDirections[0],this.selectedDirectionId=this.selectedDirection?this.selectedDirection.Value:null):(this.serviceDirections=[{Value:"__no_directions__",Text:"No directions available"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__no_directions__"),await this.setDirection(),this.setScheduleSectionsVisibility("__no_directions__"!==String(this.selectedDirectionId))}else this.invalidDate=!1,this.showLoading=!1}else this.invalidDate=!1},setDate(){this.onServiceDateChange()},setTodaysDate(){this.setDefaultServiceDate(),this.rebuildForSelectedServiceDate()},setDefaultDayType(){var e=this.toDateInputValue(new Date),e=this.getHolidayNameForServiceDate(e);e?(this.selectedServiceDayType="holiday",this.selectedHolidayName=e):(this.selectedHolidayName="",this.selectedServiceDayType=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][(new Date).getDay()]||"Mon")},getHolidayNameForServiceDate(e){return e&&/^\d{4}-\d{2}-\d{2}$/.test(String(e).trim())&&getCataGtfsHolidayIsoMap().get(String(e).trim())||""},updateNoHolidayServiceFlag(){var e="__loading__"!==String(this.selectedDirectionId)&&"__no_directions__"!==String(this.selectedDirectionId);this.noHolidayServiceForRoute=!!this.selectedHolidayName&&!this.isFiltered&&!this.noRoutes&&e&&this.stopsLoaded&&Array.isArray(this.displaySchedule)&&0===this.displaySchedule.length},stripRouteNumberPrefixFromHeadsign(e){let t=String(e||"").trim();t=(t=(t=t.replace(/^to\s+/i,"").trim()).replace(/^\d+\s*[-â:]\s*/i,"").trim()).replace(/^route\s*\d+\s*[-â:]\s*/i,"").trim();var e=String(this.selectedRoute?.route_short_name??"").trim();return e&&(e=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=t.replace(new RegExp(`^${e}(?:\\s*[-â:]\\s*|\\s+)`,"i"),"").trim()),t=t.replace(/^(?:\d\s+|0\d\s+)/,"").trim()},isGenericDirectionHeadsign(e){e=String(e||"").trim();return!e||/^direction\s*\d+\b/i.test(e)},async setDayType(){r.clear(),t.clear(),this.showLoading=!0,this.loadingMessage="Loading routes...",this.invalidDate=!1,this.noRoutes=!1,this.noHolidayServiceForRoute=!1,this.noTripsForSearch=!1,this.noRoutesMessage="There are no routes scheduled for this date.",this.busRoutes=[],this.selectedRoute=null,this.isRouteLoading=!0,this.serviceDirections=[{Value:"__loading__",Text:"Loading..."}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__loading__","function"==typeof this.$nextTick?this.$nextTick(()=>this.setDirectionsLoadingState(!0)):this.setDirectionsLoadingState(!0),this.stops=[],this.selectedFirstStopRowIndex=null,this.selectedFirstStop=null,this.firstStops=[],this.selectedEndStopRowIndex=null,this.selectedEndStop=null,this.endStops=[],this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.routeInfo={},this.stopsLoaded=!1,await this.getRoutes()},routeRowMatchesSelectionId(e,t){t=String(t??"").trim();return!!t&&(String(e.route_short_name)===t||String(e.route_id)===t)},async getDateRange(){this.syncServiceDateInputBounds()},async getRoutes(){this.showLoading=!0,this.loadingMessage="Loading routes...";try{window[n]||(window[n]=fetch(o+"/routes",{headers:s}).then(e=>e.json()).catch(()=>[]));var e,i,r,t=await window[n],a=Array.isArray(t)?t:Array.isArray(t?.routes)?t.routes:[];let l=this.selectedRouteId?String(this.selectedRouteId).trim():null,d=new Map,c=e=>String(e?.shortName??e?.route_short_name??"").trim(),u=e=>String(e?.longName??e?.route_long_name??"").trim(),h=e=>String(e?.routeId??e?.route_id??e?.id??"").trim();
9if(a.forEach(e=>{var t,i,r,a,o,s,n=c(e);e&&n&&!1!==(t=e)?.isActive&&!1!==t?.is_active&&(t=n.toLowerCase())&&(!d.has(t)||(n=d.get(t),i=u(n).length,r=u(e).length,a=h(n),o=h(e),a=l&&a===l,o=l&&o===l,n=l&&String(c(n)).toLowerCase()===String(l).toLowerCase(),s=l&&String(c(e)).toLowerCase()===String(l).toLowerCase(),o&&!a)||s&&!n||!a&&!n&&i<r)&&d.set(t,e)}),this.busRoutes=Array.from(d.values()).sort((e,t)=>c(e).localeCompare(c(t),void 0,{numeric:!0})).map(e=>({route_id:h(e),route_short_name:c(e),route_long_name:u(e),route_display_long_name:null,route_color:e?.routeColor??e?.route_color??"",route_text_color:e?.textColor??e?.route_text_color??"",agency:e?.agencyId??e?.agency??e?.agency_id??""})),0===this.busRoutes.length)this.noRoutes=!0,this.noRoutesMessage="There are no routes scheduled for this date.",this.showLoading=!1,this.stopsLoaded=!0,this.isRouteLoading=!1,this.serviceDirections=[{Value:"__no_directions__",Text:"No directions available"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__no_directions__",this.setDirectionsLoadingState(!1),this.setDirectionsDisabledState(!0,"No routes available for this day");else{let t=String(this.selectedRouteId??"").trim();t?(e=this.busRoutes.find(e=>this.routeRowMatchesSelectionId(e,t)),this.selectedRoute=e||null,e||(this.selectedRouteId="",this.selectedRoute=null)):this.selectedRoute=null,this.selectedRoute?(this.selectedRouteId=String(this.selectedRoute.route_short_name),"function"==typeof this.$nextTick&&await this.$nextTick(),(r=document.getElementById("ddlRoutes"))&&(r.value=String(this.selectedRouteId)),await this.setRoute()):(this.selectedRouteId="",this.showLoading=!1,this.isRouteLoading=!1,this.stopsLoaded=!1,this.stops=[],this.firstStops=[],this.endStops=[],this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.routeInfo={},this.noRoutes=!1,this.syncServiceDateInputBounds(),this.serviceDirections=[{Value:"__await_route__",Text:"Select direction"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__await_route__",this.setDirectionsLoadingState(!1),this.setDirectionsDisabledState(!0,"Select route"),"function"==typeof this.$nextTick&&await this.$nextTick(),(i=document.getElementById("ddlRoutes"))&&(i.value=""),this.setScheduleSectionsVisibility(!1),this.updateHashParams(),this.applyRouteMapSectionAwaitingSelection())}}catch(e){this.noRoutes=!0,this.showLoading=!1,this.isRouteLoading=!1,this.serviceDirections=[{Value:"__no_directions__",Text:"No directions available"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__no_directions__",this.setDirectionsLoadingState(!1),this.setDirectionsDisabledState(!0,"Unable to load routes. Try again later.")}},async getRouteInfo(){var e;this.selectedRoute&&(e=await this.fetchRouteNodeAssets(this.selectedRoute.route_short_name),this.applyRouteAssetsToDom(e),this.setRouteAssetsLoadingState(!1))},clearRouteMapSectionAwaitingSelection(){var e,t=document.querySelector(".Board-component.route-map-text");t&&((e=t.querySelector("[data-cata-route-map-await='1']"))&&e.remove(),e=t.querySelector("a.btn--block"))&&(e.style.display="",e.removeAttribute("aria-hidden"),e.removeAttribute("hidden"),e.removeAttribute("tabindex"))},applyRouteMapSectionAwaitingSelection(){var e=document.querySelector(".Board-component.route-map-text");if(e){var t=e.querySelector(".map-lis"),i=e.querySelector(".map-lis img"),e=e.querySelector("a.btn--block"),r=t?.querySelector("[data-route-assets-loading='1']");if(r&&(r.textContent=""),t){let e=t.querySelector("[data-cata-route-map-await='1']");e||((e=document.createElement("p")).setAttribute("data-cata-route-map-await","1"),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.className="body-style-b2 cata-route-map-await-msg",e.style.marginTop="0",e.style.marginBottom="0",t.insertBefore(e,t.firstChild)),e.textContent="Select a route to view the route map and download the map."}i&&(i.style.display="none",i.removeAttribute("src"),i.setAttribute("aria-hidden","true")),e&&(e.dataset.defaultText||(e.dataset.defaultText=(e.textContent||"").trim()||"Download Map"),e.style.display="none",e.removeAttribute("href"),e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex","-1"))}},setRouteAssetsLoadingState(t){var e=document.querySelector(".Board-component.route-map-text");if(e){var i=e.querySelector(".map-lis"),r=e.querySelector(".map-lis img"),e=e.querySelector("a.btn--block");if(i){let e=i.querySelector("[data-route-assets-loading='1']");e||((e=document.createElement("div")).setAttribute("data-route-assets-loading","1"),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.style.marginTop="8px",i.appendChild(e)),e.textContent=t?"Loading map...":""}r&&(r.style.display=t?"none":"",t)&&r.removeAttribute("src"),e&&(e.dataset.defaultText||(e.dataset.defaultText=e.textContent||""),e.textContent=t?"Loading download...":e.dataset.defaultText,e.style.pointerEvents=t?"none":"",e.setAttribute("aria-disabled",t?"true":"false"),t)&&e.removeAttribute("href")}},normalizePublicFileUrl(e){return e&&"string"==typeof e?!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("/")&&e.startsWith("public://")?"/sites/default/files/"+e.replace("public://",""):e:""},getIncludedEntity(e,t){return t&&t.data&&e[t.data.type+"--"+t.data.id]||null},getFileUrlFromEntity(e){return e?e.attributes?.uri?.url?this.normalizePublicFileUrl(e.attributes.uri.url):e.attributes?.url?this.normalizePublicFileUrl(e.attributes.url):"":""},extractRouteNodeAssetsFromJsonApi(e){var t=(Array.isArray(e?.data)?e.data:[])[0];if(!t)return null;e=Array.isArray(e?.included)?e.included:[];let i={}
9,r=(e.forEach(e=>{i[e.type+"--"+e.id]=e}),""),a="";var e=this.getIncludedEntity(i,t.relationships?.field_image),e=(e&&(r="file--file"===e.type?this.getFileUrlFromEntity(e):(e=this.getIncludedEntity(i,e.relationships?.field_media_image),this.getFileUrlFromEntity(e))),this.getIncludedEntity(i,t.relationships?.field_pdf));return e&&(a="file--file"===e.type?this.getFileUrlFromEntity(e):(t=this.getIncludedEntity(i,e.relationships?.field_media_document||e.relationships?.field_media_file),this.getFileUrlFromEntity(t))),{imageUrl:r,pdfUrl:a}},async fetchRouteNodeAssets(t){t=String(t||"").trim();if(!t)return null;if(this.routeNodeAssetCache[t])return this.routeNodeAssetCache[t];try{var e,i,r=await fetch("/cata-route-assets/"+encodeURIComponent(t),{headers:{Accept:"application/json"}});return r.ok?(e=await r.json(),i={imageUrl:this.normalizePublicFileUrl(e?.image_url||""),pdfUrl:this.normalizePublicFileUrl(e?.pdf_url||""),audioSummaryUrl:this.normalizePublicFileUrl(e?.audio_summary_url||""),locationsServed:String(e?.locations_served||""),turnByTurnDirections:String(e?.turn_by_turn_directions||""),routeDetours:String(e?.route_detours||""),snowRoute:String(e?.snow_route||""),serviceSummary:String(e?.service_summary||"")},this.routeNodeAssetCache[t]=i):this.routeNodeAssetCache[t]=null}catch(e){return this.routeNodeAssetCache[t]=null}},applyRouteAssetsToDom(t){var e,i;t&&(e=document.querySelector(".Board-component.route-map-text"))&&(t.imageUrl&&((i=e.querySelector(".map-lis img"))&&(i.removeAttribute("aria-hidden"),i.style.display="",i.src=t.imageUrl),i=e.querySelector("a.btn--block"))&&(i.style.display="",i.removeAttribute("aria-hidden"),i.removeAttribute("tabindex"),i.style.pointerEvents="",i.setAttribute("aria-disabled","false"),i.href=t.imageUrl),t.pdfUrl&&(i=e.querySelector(".primary-btn"))&&("a"===i.tagName.toLowerCase()?(i.href=t.pdfUrl,i.target="_blank",i.rel="noopener noreferrer"):(this.routeBrochureClickHandler&&i.removeEventListener("click",this.routeBrochureClickHandler),this.routeBrochureClickHandler=e=>{e.preventDefault(),window.open(t.pdfUrl,"_blank","noopener,noreferrer")},i.addEventListener("click",this.routeBrochureClickHandler))),this.applyRouteAccordionContent(t))},applyRouteAccordionContent(e){let r=document.getElementById("cata-route-dynamic-accordion");var t,i;r&&(t={service_summary:String(e?.serviceSummary||"").trim(),locations_served:String(e?.locationsServed||"").trim(),turn_by_turn_directions:String(e?.turnByTurnDirections||"").trim(),route_detours:String(e?.routeDetours||"").trim(),snow_route:String(e?.snowRoute||"").trim()},Object.entries(t).forEach(([e,t])=>{var i=r.querySelector(`[data-cata-accordion-item="${e}"]`),e=r.querySelector(`[data-cata-accordion-content="${e}"]`);i&&e&&(e.innerHTML=t,i.hidden=!(""!==t),e=i.querySelector(".accordion-button"),t=i.querySelector(".accordion-collapse"),e)&&t&&(e.classList.add("collapsed"),e.setAttribute("aria-expanded","false"),t.classList.remove("show"))}),t=r.querySelector("#cataRouteAudioSummaryWrap"),i=r.querySelector("#cataRouteAudioSummaryLink"),e=String(e?.audioSummaryUrl||"").trim(),t)&&i&&(e?(i.setAttribute("href",e),t.hidden=!1):(i.setAttribute("href","#"),t.hidden=!0))},toggleRouteAlertsAccordion(){this.routeAlertsAccordionOpen=!this.routeAlertsAccordionOpen},buildRouteAlertRoutesLine(e){var t=Array.isArray(e?.routeNames)?e.routeNames:[];return t.length?t.join(", "):(t=String(e?.descriptionText||""))?140<t.length?t.slice(0,137)+"...":t:""},truncateAlertDescription(e,t=200){e=String(e||"");return e?e.length<=t?e:e.slice(0,Math.max(0,t-3))+"...":""},async fetchRouteAlertsForSelectedRoute(){var e=String(this.selectedRoute?.route_short_name||"").trim();if(this.routeAlerts=[],this.routeAlertsError="",this.routeAlertsReady=!1,e){this.routeAlertsLoading=!0;try{var t=await fetch("/cata-service-alerts/route/"+encodeURIComponent(e),{headers:{Accept:"application/json"}});if(!t.ok)return this.routeAlertsError="Unable to load rider alerts.",this.routeAlertsLoading=!1,void(this.routeAlertsReady=!0);var i=await t.json(),r=Array.isArray(i?.alerts)?i.alerts:[];this.routeAlerts=r.map(e=>({...e,routesLine:this.buildRouteAlertRoutesLine(e)}))}catch(e){this.routeAlertsError="Unable to load rider alerts."}this.routeAlertsLoading=!1,this.routeAlertsReady=!0}else this.routeAlertsLoading=!1},async setRoute(){if(this.updateHashParams(),this.selectedRoute){this.clearRouteMapSectionAwaitingSelection(),this.noRoutes=!1,this.noRoutesMessage="There are no routes scheduled for this date.",this.setScheduleSectionsVisibility(!1),this.showLoading=!0,this.loadingMessage="Loading Schedules",this.isRouteLoading=!0,this.serviceDirections=[{Value:"__loading__",Text:"Loading..."}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__loading__",this.setDirectionsLoadingState(!0),this.setRouteAssetsLoadingState(!0),this.routeAlerts=[],this.routeAlertsError="",this.routeAlertsReady=!1,await this.fetchRouteAlertsForSelectedRoute(),await this.getRouteInfo();try{var e,t=await this.fetchRouteData(this.selectedRoute.route_short_name),i=(this.updateServiceDateBoundsFromRouteData(t),Array.isArray(t?.stops)&&0<t.stops.length);
9i?this.refreshInvalidDateFlag(t)?(this.serviceDirections=[{Value:"__no_directions__",Text:"No directions available"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__no_directions__",this.stops=[],this.firstStops=[],this.endStops=[],this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.stopsLoaded=!0,this.showLoading=!1,this.noRoutes=!1,this.setScheduleSectionsVisibility(!1),this.announceScheduleUpdate(this.invalidDateMessage),this.isRouteLoading=!1,this.setDirectionsLoadingState(!1)):(this.serviceDirections=this.extractDirections(t),this.applyDerivedRouteDisplayName(t),0<this.serviceDirections.length?(this.selectedDirectionId?(e=this.serviceDirections.find(e=>e.Value==this.selectedDirectionId),this.selectedDirection=e||this.serviceDirections[0]):this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId=this.selectedDirection?this.selectedDirection.Value:null):(this.serviceDirections=[{Value:"__no_directions__",Text:"No directions available"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__no_directions__"),await this.setDirection(),this.setScheduleSectionsVisibility(!0),126==this.selectedRoute.route_id?this.route126Link="https://www.cata.org/Portals/0/Routes-Schedules/RoutePDF/261.pdf":this.route126Link=""):(this.setScheduleSectionsVisibility(!1),this.serviceDirections=[{Value:"__no_directions__",Text:"No directions available"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__no_directions__",this.stops=[],this.firstStops=[],this.endStops=[],this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.stopsLoaded=!0,this.showLoading=!1,this.noRoutes=!0,this.invalidDate=!1,this.noRoutesMessage=`Route ${this.selectedRoute.route_short_name||""} is not currently running, so schedule data is unavailable right now.`,this.announceScheduleUpdate(this.noRoutesMessage),this.isRouteLoading=!1,this.setDirectionsLoadingState(!1))}catch(e){this.setScheduleSectionsVisibility(!1),this.serviceDirections=[{Value:"__no_directions__",Text:"No directions available"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__no_directions__"}finally{this.isRouteLoading=!1,this.setDirectionsLoadingState(!1);i="__no_directions__"===String(this.selectedDirectionId);this.setDirectionsDisabledState(i,i?"No directions available":"")}}},directionsDropdownDisabled(){var e=this.serviceDirections;return!e||0===e.length||"__await_route__"===(e=String(this.selectedDirectionId??""))||"__loading__"===e||!!this.isRouteLoading||"__no_directions__"===e},setDirectionsLoadingState(e){var t=document.getElementById("ddlDirections");t&&(t.setAttribute("aria-busy",e?"true":"false"),e?t.setAttribute("aria-label","Loading directions"):"Loading directions"===t.getAttribute("aria-label")&&t.removeAttribute("aria-label"))},setDirectionsDisabledState(e,t=""){var i=document.getElementById("ddlDirections");i&&(e&&t?i.setAttribute("aria-label",t):"true"!==i.getAttribute("aria-busy")&&i.removeAttribute("aria-label"))},setScheduleSectionsVisibility(e){let t=Boolean(e);document.querySelectorAll(".panel, .pane.route-text, .schedule-block").forEach(e=>{e.style.display=t?"":"none",e.setAttribute("aria-hidden",t?"false":"true")})},buildOrderedStopsForDirection(e,i){e=Array.isArray(e?.stops)?e.stops:[];let o=new Map,s=new Map,n=new Map,l=new Map;e.forEach(r=>{let a=String(r?.stop_id??r?.stopId??r?.id??"").trim();var e,t;a&&(t=r?.Latitude??r?.stop_lat??r?.stopLat??r?.lat??r?.latitude,e=r?.Longitude??r?.stop_lon??r?.stopLon??r?.lon??r?.longitude,o.set(a,{stop_id:a,stop_name:r?.stop_name??r?.stopName??r?.name??"",Latitude:null!=t&&""!==t?t:null,Longitude:null!=e&&""!==e?e:null}),(t=(Array.isArray(r?.times)?r.times:[]).filter(e=>Number(e?.direction)===Number(i)&&this.timeMatchesSelectedService(e))).length)&&(n.set(a,t),t.forEach(e=>{var t=Number(e?.sequence),i=(Number.isFinite(t)&&(i=s.get(a),!Number.isFinite(i)||t<i)&&s.set(a,t),String(e?.trip_id||""));i&&(l.has(i)||l.set(i,[]),l.get(i).push({stop_id:r.stop_id,sequence:t}))}))});e=Array.from(l.values()).map(e=>{e=e.filter(e=>Number.isFinite(e.sequence)).sort((e,t)=>
9e.sequence-t.sequence);let i=new Set,r=[];return e.forEach(e=>{var t=String(e.stop_id??"");t&&!i.has(t)&&(i.add(t),r.push(e))}),r.length?{stops:r,stopCount:r.length,seqSpan:r[r.length-1].sequence-r[0].sequence,firstStopId:String(r[0].stop_id??""),lastStopId:String(r[r.length-1].stop_id??"")}:null}).filter(Boolean);let t=new Map,r=new Map;e.forEach(e=>{e.firstStopId&&t.set(e.firstStopId,(t.get(e.firstStopId)||0)+1),e.lastStopId&&r.set(e.lastStopId,(r.get(e.lastStopId)||0)+1)});var a=e=>{e=Array.from(e.entries());return e.length?(e.sort((e,t)=>t[1]-e[1]),String(e[0][0]??"")):""};let d=a(t),c=a(r);this.directionCanonicalStartId=d,this.directionCanonicalEndId=c,e.sort((e,t)=>{var i=Number(e.firstStopId===d)+Number(e.lastStopId===c),r=Number(t.firstStopId===d)+Number(t.lastStopId===c);return r!==i?r-i:t.stopCount!==e.stopCount?t.stopCount-e.stopCount:t.seqSpan-e.seqSpan});var u,a=Array.from(s.entries()).map(([e,t])=>({id:String(e),seq:Number.isFinite(t)?t:Number.POSITIVE_INFINITY})).sort((e,t)=>{if(e.seq!==t.seq)return e.seq-t.seq;if(d){var i=Number(e.id===d),r=Number(t.id===d);if(r!==i)return r-i}return e.id.localeCompare(t.id,void 0,{numeric:!0})});return 2<=a.length&&d&&c&&(e=String(a[0]?.id??""),u=String(a[a.length-1]?.id??""),e===c)&&u===d&&a.reverse(),a.map(e=>{var t=o.get(e.id);return t?{...t,times:n.get(e.id)||[],row_sequence:Number.isFinite(e.seq)?e.seq:null}:null}).filter(Boolean)},syncScheduleFromForm(){this.searchValidationMessage="",this.noTripsForSearch=!1,this.noHolidayServiceForRoute=!1,this.startTime=this.normalizeHtmlTimeModel(this.startTime),this.endTime=this.normalizeHtmlTimeModel(this.endTime),this.syncTimePartsFromModels();var e=Array.isArray(this.stops)?this.stops:[],t=(this.firstStops=e.slice(),this.endStops=e.slice(),this.selectedFirstStopRowIndex),i=this.selectedEndStopRowIndex,t=(this.selectedFirstStop=null!=t&&Number.isFinite(Number(t))&&null!=e[Number(t)]?e[Number(t)]:null,this.selectedEndStop=null!=i&&Number.isFinite(Number(i))&&null!=e[Number(i)]?e[Number(i)]:null,this.startTime&&""!==String(this.startTime).trim()),e=this.endTime&&""!==String(this.endTime).trim(),i=t||e,t=!!this.selectedFirstStop&&!!this.selectedEndStop;Array.isArray(this.schedule)&&this.schedule.length?t&&i&&!this.suppressStopAnnouncements?this.searchTrips():t?(this.isFiltered=!1,this.filteredSchedule=[],this.displaySchedule=this.finalizeDisplaySchedule(this.schedule),this.updateNoHolidayServiceFlag(),setTimeout(()=>this.displayStopsOnMap(),50),this.suppressStopAnnouncements||(e=this.getVisibleStopsForCurrentFilters().length,this.announceScheduleUpdate(`Schedule view updated: ${e} stops shown.`))):(this.isFiltered=!1,this.filteredSchedule=[],this.displaySchedule=this.finalizeDisplaySchedule(this.schedule),this.updateNoHolidayServiceFlag(),setTimeout(()=>this.displayStopsOnMap(),50)):(this.updateNoHolidayServiceFlag(),setTimeout(()=>this.displayStopsOnMap(),50))},applyTerminalDefaultsFromSchedule(){var e=(Array.isArray(this.stops)?this.stops:[]).length;0===e?(this.selectedFirstStopRowIndex=null,this.selectedEndStopRowIndex=null):(this.selectedFirstStopRowIndex=0,this.selectedEndStopRowIndex=e-1,this.prefillTimeRangeFromSchedule()),this.syncScheduleFromForm()},toMinutes(e){if(!e)return NaN;e=String(e).trim();if(!e)return NaN;var i=e.match(/^(\d{1,2}):(\d{2})(?::\d{2})?(?:\s*)(AM|PM)$/i);if(i){let e=parseInt(i[1],10),t=parseInt(i[2],10);i=i[3].toUpperCase();return"PM"===i&&e<12&&(e+=12),60*(e="AM"===i&&12===e?0:e)+t}i=e.split(":"),e=parseInt(i[0],10);let t=parseInt(i[1],10)||0;return Number.isNaN(e)||Number.isNaN(t)?NaN:60*e+t},toHtmlTime(e){if(!Number.isFinite(e))return"";let t=Math.floor(e)%1440;t<0&&(t+=1440);var e=Math.floor(t/60),i=t%60;return String(e).padStart(2,"0")+":"+String(i).padStart(2,"0")},getTripStopForRow(e,t){e=Array.isArray(e)?e:[];if(!t)return null;let i=String(t?.stop_id??""),r=Number(t?.row_sequence);t=e.filter(e=>e&&String(e.stop_id)===i);if(!t.length)return null;if(!Number.isFinite(r))return t[0];let a=t[0],o=Number.POSITIVE_INFINITY;return t.forEach(e=>{var t=Number(e?.sequence);Number.isFinite(t)&&(t=Math.abs(t-r))<o&&(a=e,o=t)}),a},getTripDepartureMinutesAtRow(e,t){e=this.getTripStopForRow(e,t),t=e?.departure_time||e?.DepartureTime12HourFormat||"";return this.toMinutes(t)},getTripDepartureMinutesForFilter(e,t){e=Array.isArray(e)?e:[];if(t){t=this.getTripDepartureMinutesAtRow(e,t);if(Number.isFinite(t))return t}t=e[0],e=t?.departure_time||t?.DepartureTime12HourFormat||"";return this.toMinutes(e)},getTripOriginDepartureRaw(e){e=(Array.isArray(e)?e:[])[0];return e?.departure_time||e?.DepartureTime12HourFormat||""},getTripOriginDepartureMinutes(e){return this.toMinutes(this.getTripOriginDepartureRaw(e))},getScheduleReferenceStop(){return this.selectedFirstStop||(Array.isArray(this.stops)?this.stops:[])[0]||null},getTripColumnHeader(e){e=Array.isArray(e?.Value)?e.Value:[];return this.formatDepartureTime(this.getTripOriginDepartureRaw(e))},getTripColumnKeySuffix(e,t){var i=Array.isArray(e?.Value)?e.Value:[],i=this.getTripOriginDepartureRaw(i);return`${e?.trip_id||t}-${i}-`+t},finalizeDisplaySchedule(e){return(Array.isArray(e)?e.slice():[]).sort((e,t)=>
9{var i=this.getTripOriginDepartureMinutes(e?.Value||[]),r=this.getTripOriginDepartureMinutes(t?.Value||[]),a=Number.isNaN(i),o=Number.isNaN(r);return a&&o?0:a?1:o?-1:i!==r?i-r:String(e?.trip_id||"").localeCompare(String(t?.trip_id||""),void 0,{numeric:!0})})},prefillTimeRangeFromSchedule(){if(Array.isArray(this.schedule)&&this.schedule.length){var e=Array.isArray(this.stops)?this.stops:[],r=Number(this.selectedFirstStopRowIndex);let i=Number.isFinite(r)&&e[r]?e[r]:null;if(i){let t=[];this.schedule.forEach(e=>{e=this.getTripDepartureMinutesForFilter(e?.Value||[],i);Number.isFinite(e)&&t.push(e)}),t.length&&(e=Math.min(...t),r=Math.max(...t),this.startTime=this.toHtmlTime(e),this.endTime=this.toHtmlTime(r),this.syncTimePartsFromModels())}}},async getStopsForRoute(e=null){if(this.selectedRoute&&this.selectedDirection)try{var t=e||await this.fetchRouteData(this.selectedRoute.route_short_name),i=Number(this.selectedDirection.Value),r=this.buildOrderedStopsForDirection(t,i),a=(this.stopsLoaded=!0,r.map(e=>({...e,departure_time:this.getDepartureTimeForStop(e)})));this.stops=a,this.firstStops=a.slice(),this.endStops=a.slice(),setTimeout(()=>this.displayStopsOnMap(),100)}catch(e){this.stops=[],this.firstStops=[],this.endStops=[],this.stopsLoaded=!0}},getDepartureTimeForStop(e){return e.departure_time||"5.00 AM"},normalizeSchedule(e){e=null!=e?e:[];return(Array.isArray(e)?e:Object.values(e||{})).map(e=>e&&Array.isArray(e.Value)?e:Array.isArray(e)?{Value:e}:{Value:e&&e.Value?[].concat(e.Value):[]})},async setDirection(){if(this.updateHashParams(),this.selectedRoute&&this.selectedDirection&&"__loading__"!==String(this.selectedDirection.Value)&&"__await_route__"!==String(this.selectedDirection.Value)&&"__no_directions__"!==String(this.selectedDirection.Value)){this.showLoading=!0,this.loadingMessage="Loading Schedules",this.stopsLoaded=!1,this.schedule=[],this.displaySchedule=[],this.suppressStopAnnouncements=!0,this.noHolidayServiceForRoute=!1,this.noTripsForSearch=!1;try{var t,i=String(this.selectedRoute.route_short_name||this.selectedRouteId||"").trim();let e=this.getSelectedRouteDataForDateValidation();e=e||await this.fetchRouteData(i),this.syncServiceDayTypeFromDate(e),await this.get
9StopsForRoute(e),this.schedule=this.buildScheduleFromRouteData(e,this.selectedDirection.Value),this.refreshInvalidDateFlag(e)?(this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.showLoading=!1,this.suppressStopAnnouncements=!1,this.noTripsForSearch=!1,this.updateNoHolidayServiceFlag(),this.announceScheduleUpdate(this.invalidDateMessage)):(this.logScheduleDebug("after-build-schedule"),this.alignStopsToScheduleOrder(),this.logScheduleDebug("after-align-stops"),this.filteredSchedule=[],this.displaySchedule=this.finalizeDisplaySchedule(this.schedule),this.isFiltered=!1,this.routeInfo=e||{},this.showLoading=!1,this.suppressStopAnnouncements=!0,this.applyTerminalDefaultsFromSchedule(),this.logScheduleDebug("after-apply-defaults"),this.suppressStopAnnouncements=!1,this.noTripsForSearch=!1,this.updateNoHolidayServiceFlag(),t=this.getVisibleStopsForCurrentFilters().length,this.announceScheduleUpdate(`Schedule updated for ${this.selectedDirection?.Text||"direction"}: ${this.displaySchedule.length} departures, ${t} stops shown.`),setTimeout(()=>this.displayStopsOnMap(),200))}catch(e){this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.routeInfo={},this.showLoading=!1,this.suppressStopAnnouncements=!1,this.noHolidayServiceForRoute=!1,this.noTripsForSearch=!1}}},alignStopsToScheduleOrder(){var e=Array.isArray(this.stops)?this.stops:[],t=Array.isArray(this.schedule)?this.schedule:[];if(e.length&&t.length){t=t.map(e=>(e=>{e=(Array.isArray(e?.Value)?e.Value:[]).slice().sort((e,t)=>Number(e?.sequence||0)-Number(t?.sequence||0));let i=new Set,r=[];return e.forEach(e=>{var t=String(e?.stop_id??""),e=Number(e?.sequence||0);t&&!i.has(t)&&Number.isFinite(e)&&(i.add(t),r.push({stop_id:t,sequence:e}))}),r})(e)).filter(e=>0<e.length);if(t.length){var r=t.slice().sort((e,t)=>t.length!==e.length?t.length-e.length:(t[t.length-1]?.sequence||0)-(e[e.length-1]?.sequence||0))[0];if(r&&r.length){let o=new Map,i=(r.forEach(e=>o.set(String(e.stop_id),Number(e.sequence))),new Map),s=(t.forEach(e=>{e.forEach(e=>{var t=String(e.stop_id);i.has(t)||i.set(t,[]),i.get(t).push(Number(e.sequence))})}),new Map),n=(i.forEach((e,t)=>{e.length&&(e=e.reduce((e,t)=>e+t,0)/e.length,s.set(t,e))}),String(this.directionCanonicalStartId||""));r=e.slice().map((e,t)=>{var i=String(e?.stop_id??""),r=o.has(i),a=o.get(i)??s.get(i)??Number(e?.row_sequence??Number.POSITIVE_INFINITY);return{...e,row_sequence:Number.isFinite(a)?a:null,_order_seq:Number.isFinite(a)?a:Number.POSITIVE_INFINITY,_initial_idx:t,_in_best_trip:r,_is_canonical_start:n&&i===n}}).sort((e,t)=>e._order_seq!==t._order_seq?e._order_seq-t._order_seq:e._is_canonical_start!==t._is_canonical_start?Number(t._is_canonical_start)-Number(e._is_canonical_start):e._in_best_trip!==t._in_best_trip?Number(t._in_best_trip)-Number(e._in_best_trip):e._initial_idx-t._initial_idx).map(e=>(delete e._order_seq,delete e._initial_idx,delete e._in_best_trip,delete e._is_canonical_start,e));this.stops=r,this.firstStops=r.slice(),this.endStops=r.slice()}}}},getEarliestDepartureMinutesForRow(t){var e=Array.isArray(this.schedule)?this.schedule:[];let i=Number.POSITIVE_INFINITY;return e.forEach(e=>{e=this.getTripStopForRow(e?.Value||[],t),e=e?.departure_time||e?.DepartureTime12HourFormat||"",e=this.toMinutes(e);Number.isFinite(e)&&e<i&&(i=e)}),i},async fetchRouteVariantsByShortName(e){var e=String(e||"").trim();return e&&(e=o+"/maps/routes/short-name/"+encodeURIComponent(e),(e=await fetch(e,{headers:s})).ok)?(e=await e.json(),Array.isArray(e?.routes)?e.routes:Array.isArray(e)?e:[]):[]},async fetchStopsByRouteId(e){var e=String(e??"").trim();return e&&(e=o+"/maps/stops/"+encodeURIComponent(e),(e=await fetch(e,{headers:s})).ok)?e.json():null},pickPreferredRouteVariant(e){e=Array.isArray(e)?e.filter(Boolean):[];if(!e.length)return null;let i=this.toGtfsDateValue(this.selectedServiceDate);if(i){var t=e.find(e=>{var t=this.toGtfsDateValue(e?.schedule_start_date??e?.scheduleStartDate??""),e=this.toGtfsDateValue(e?.schedule_end_date??e?.scheduleEndDate??"");return!(t&&i<t||e&&i>e)});if(t)return t}return e[0]},mergeRouteStopsPayloads(e,t,i=[]){e=(Array.isArray(e)?e:[]).filter(e=>e&&"object"==typeof e);if(!e.length)return null;let r="",a="",h=(e,t)=>{e=String(e||"").trim(),t=String(t||"").trim();e&&(!r||e<r)&&(r=e),t&&(!a||t>a)&&(a=t)}
9,p=((Array.isArray(i)?i:[]).forEach(e=>{h(e?.schedule_start_date??e?.scheduleStartDate,e?.schedule_end_date??e?.scheduleEndDate)}),new Map),m=new Map;e.forEach(e=>{let c=e?.schedule_start_date??e?.scheduleStartDate??"",u=e?.schedule_end_date??e?.scheduleEndDate??"";h(c,u);var t=e?.stops,t=((Array.isArray(t)?t:t&&"object"==typeof t?Object.values(t):[]).forEach(e=>{var t=String(e?.stop_id??e?.stopId??e?.id??"").trim();if(t){p.has(t)||(i=e?.stop_lat??e?.stopLat??e?.lat??e?.latitude??null,r=e?.stop_lon??e?.stopLon??e?.lon??e?.longitude??null,p.set(t,{...e,stop_id:t,stop_name:e?.stop_name??e?.stopName??e?.name??"",stop_lat:i,stop_lon:r,Latitude:i,Longitude:r,times:[]}),m.set(t,new Set));let a=p.get(t),o=m.get(t);var i=e?.times,r=((Array.isArray(i)?i:i&&"object"==typeof i?Object.values(i):[]).forEach(e=>{var t=e?.start_date??e?.startDate??c,i=e?.end_date??e?.endDate??u,r=(h(t,i),[String(e?.trip_id??e?.tripId??""),String(e?.sequence??""),String(e?.departure_time??e?.departureTime??""),String(e?.arrival_time??e?.arrivalTime??""),String(e?.day_type??e?.dayType??""),String(t),String(i),String(e?.service_id??e?.serviceId??""),String(e?.direction??e?.directionId??"")].join("|"));o.has(r)||(o.add(r),a.times.push({...e,trip_id:e?.trip_id??e?.tripId??"",sequence:Number(e?.sequence||0),departure_time:e?.departure_time??e?.departureTime??"",arrival_time:e?.arrival_time??e?.arrivalTime??"",day_type:e?.day_type??e?.dayType??"",direction:Number(e?.direction??e?.directionId??0),headsign:e?.headsign??e?.trip_headsign??"",start_date:t,end_date:i}))}),!a.stop_name&&(e?.stop_name||e?.stopName||e?.name)&&(a.stop_name=e?.stop_name??e?.stopName??e?.name),e?.stop_lat??e?.stopLat??e?.lat??e?.latitude),t=(null!=a.stop_lat&&""!==a.stop_lat||null==r||""===r||(a.stop_lat=r,a.lat=r,a.Latitude=r),e?.stop_lon??e?.stopLon??e?.lon??e?.longitude);null!=a.stop_lon&&""!==a.stop_lon||null==t||""===t||(a.stop_lon=t,a.lon=t,a.Longitude=t)}}),e?.trips);Array.isArray(t)&&t.forEach(e=>{let a=String(e?.trip_id??e?.tripId??e?.id??"").trim(),o=Number(e?.direction??e?.direction_id??e?.directionId??0),s=e?.day_type??e?.dayType??"",n=e?.headsign??e?.trip_headsign??"",l=e?.start_date??e?.startDate??c,d=e?.end_date??e?.endDate??u;h(l,d);e=e?.stop_times??e?.stopTimes??e?.times;(Array.isArray(e)?e:e&&"object"==typeof e?Object.values(e):[]).forEach(e=>{var t,i,r=String(e?.stop_id??e?.stopId??e?.id??"").trim();r&&(p.has(r)||(t=e?.stop_lat??e?.stopLat??e?.lat??e?.latitude??null,i=e?.stop_lon??e?.stopLon??e?.lon??e?.longitude??null,p.set(r,{stop_id:r,stop_name:e?.stop_name??e?.stopName??e?.name??"",stop_lat:t,stop_lon:i,Latitude:t,Longitude:i,times:[]}),m.set(r,new Set)),t=p.get(r),i=m.get(r),r=[a,String(e?.sequence??""),String(e?.departure_time??e?.departureTime??""),String(e?.arrival_time??e?.arrivalTime??""),String(s),String(l),String(d),String(o)].join("|"),i.has(r)||(i.add(r),t.times.push({trip_id:a,sequence:Number(e?.sequence??0),departure_time:e?.departure_time??e?.departureTime??"",arrival_time:e?.arrival_time??e?.arrivalTime??"",day_type:s,direction:o,headsign:n,start_date:l,end_date:d})))})})});var o=this.pickPreferredRouteVariant(i)||e.find(e=>e?.route_id)||e[0],t=String(t||o?.route_short_name||"").trim()||String(e[0]?.route_short_name||"").trim();return{...o,route_id:o?.route_id??o?.routeId??null,route_short_name:t,route_long_name:o?.route_long_name??o?.routeLongName??e[0]?.route_long_name??"",route_color:o?.route_color??o?.routeColor??e[0]?.route_color??"",route_text_color:o?.route_text_color??o?.routeTextColor??e[0]?.route_text_color??"",schedule_start_date:r||o?.schedule_start_date||e[0]?.schedule_start_date||"",schedule_end_date:a||o?.schedule_end_date||e[0]?.schedule_end_date||"",stops:Array.from(p.values()),_routeVariants:Array.isArray(i)?i:[],_sourceRouteIds:e.map(e=>String(e?.route_id??e?.routeId??"").trim()).filter(Boolean)}},async fetchRouteData(e){let i=String(e||"").trim();return i?r.has(i)?r.get(i):t.has(i)?t.get(i):(e=(async()=>{var e=await this.fetchRouteVariantsByShortName(i),t=[...new Set(e.map(e=>String(e?.route_id??e?.routeId??"").trim()).filter(Boolean))];return t.length&&(t=await Promise.all(t.map(e=>this.fetchStopsByRouteId(e))),t=this.mergeRouteStopsPayloads(t,i,e))?(r.set(i,t),t):null})().finally(()=>{t.delete(i)}),t.set(i,e),e):null},isCorridorSlugLongName(e){e=String(e??"").trim().replace(/\s+/g,"");return!(e.length<3)&&/^[A-Z0-9]+(?:-[A-Z0-9]+)+$/.test(e)},titleCasePlaceToken(e){return String(e||"").trim().toLowerCase().split(/\s+/).filter(
9Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")},shortenStopNameForLabel(e){let t=String(e??"").trim();return t?t=52<(t=t.split(/\s+by\s+/i)[0].split(/\s+@\s+/i)[0].trim()).length?t.slice(0,49)+"â¦":t:""},parseHeadsignSegments(e){let t=String(e??"").trim();return(t=t&&t.replace(/^\d+\s+/,"").trim())?t.split(/\s*-\s*/).map(e=>e.trim()).filter(Boolean):[]},collectHeadsignPlaceEndpoints(e){e=Array.isArray(e?.stops)?e.stops:[];let i=new Map;var t,r=e=>{var t,e=String(e??"").trim();e.length<2||(t=e.toUpperCase(),/^LOOP$/i.test(e))||i.has(t)||i.set(t,this.titleCasePlaceToken(e))};for(t of e)for(var a of t?.times??[]){a=this.parseHeadsignSegments(a?.headsign);2<=a.length?(r(a[0]),r(a[a.length-1])):1===a.length&&r(a[0])}return i},computeTripEndpointsByDirection(e){var t,e=Array.isArray(e?.stops)?e.stops:[],i=new Map;for(t of e){var r,a=String(t?.stop_name??"").trim();for(r of t?.times??[]){var o,s,n,l=String(r?.trip_id??"").trim();l&&(o=Number(r?.direction),Number.isNaN(o)||(s=Number(r?.sequence??0),i.has(l)?(s<(n=i.get(l)).minS&&(n.minS=s,n.first=a),n.maxS<s&&(n.maxS=s,n.last=a)):i.set(l,{dir:o,minS:s,maxS:s,first:a,last:a})))}}return i},modalTripTerminalLabelByDirection(e){var t,e=this.computeTripEndpointsByDirection(e),i=new Map;for(t of e.values()){var r,a=this.shortenStopNameForLabel(t.last);a&&(i.has(t.dir)||i.set(t.dir,new Map),(r=i.get(t.dir)).set(a,(r.get(a)||0)+1))}var o,s,n=new Map;for([o,s]of i){var l=Array.from(s.entries()).sort((e,t)=>t[1]-e[1]);l[0]&&n.set(o,l[0][0])}return n},deriveCorridorDisplayLongName(e){var i=this.collectHeadsignPlaceEndpoints(e);if(2<=i.size)return Array.from(i.values()).sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:"base"})).join(" â ");var t,r=this.modalTripTerminalLabelByDirection(e),e=[...r.keys()].sort((e,t)=>e-t),a=[],o=new Set;for(t of e){var s,n=r.get(t);n&&(s=n.toUpperCase(),o.has(s)||(o.add(s),a.push(this.titleCasePlaceToken(n))))}if(2<=a.length)return a.sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:"base"})).join(" â ");if(1===i.size&&1<=a.length){let t=Array.from(i.values())[0];e=a.find(e=>0!==e.localeCompare(t,void 0,{sensitivity:"base"}));if(e)return[t,e].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:"base"})).join(" â ")}return 1===i.size?Array.from(i.values())[0]:null},applyDerivedRouteDisplayName(e){let t=String(e?.route_short_name??"").trim();var i;t&&(e=this.deriveCorridorDisplayLongName(e),i=this.busRoutes.find(e=>String(e.route_short_name)===t))&&e&&this.isCorridorSlugLongName(i.route_long_name)&&(i.route_display_long_name=e,this.selectedRoute)&&String(this.selectedRoute.route_short_name)===t&&(this.selectedRoute.route_display_long_name=e)},formatScheduleRoutePill(e){var t;return e?(t=String(e.route_short_name??"").trim())?/^\d+$/.test(t)?String(parseInt(t,10)).padStart(2,"0"):t:String(e.route_id??"").trim():""},formatRouteDropdownLabel(e){return e?(e.route_short_name?String(e.route_short_name)+" - ":"")+(e.route_long_name||e.RouteDisplayName||"Route"):"Route"},extractDirections(e){var t=Array.isArray(e?.stops)?e.stops:[];let a=new Map,o=new Map,r=(t.forEach(e=>{(Array.isArray(e?.times)?e.times:[]).forEach(e=>{var t,i,r=Number(e?.direction);Number.isNaN(r)||this.timeMatchesSelectedService(e)&&((t=String(e?.headsign||"").trim())&&(o.has(r)||o.set(r,new Map),(i=o.get(r)).set(t,(i.get(t)||0)+1)),a.has(r)||a.set(r,{Value:r,Text:e?.headsign||"Direction "+r}))})}),a.forEach((e,t)=>{var t=o.get(t);t&&0!==t.size&&(t=(t=Array.from(t.entries()).sort((e,t)=>t[1]-e[1])).find(([e])=>!this.isGenericDirectionHeadsign(e))?.[0]||t[0]?.[0])&&(e.Text=t)}),this.modalTripTerminalLabelByDirection(e));return a.forEach((e,t)=>{var i=o.get(t);i&&0<i.size||(i=r.get(t))&&(e.Text=i)}),Array.from(a.values()).sort((e,t)=>Number(e.Value)-Number(t.Value))},buildScheduleFromRouteData(e,t){e=Array.isArray(e?.stops)?e.stops:[];let a=Number(t),o=new Map,s=new Map;return e.forEach(r=>{(Array.isArray(r?.times)?r.times:[]).forEach(e=>{var t,i=Number(e?.direction);Number.isNaN(i)||i!==a||this.timeMatchesSelectedService(e)&&(i=String(e.trip_id||""))&&(o.has(i)||o.set(i,[]),s.has(i)||s.set(i,new Set),t=[r.stop_id,String(e.sequence??""),String(e.departure_time||""),String(e.arrival_time||"")].join("|"),s.get(i).has(t)||(s.get(i).add(t),o.get(i).push({stop_id:r.stop_id,stop_name:r.stop_name,departure_time:e.departure_time,arrival_time:e.arrival_time,sequence:Number(e.sequence||0)})))})}),Array.from(o.entries()).map(([e,t])=>({trip_id:e,Value:t.sort((e,t)=>
9(e.sequence||0)-(t.sequence||0))})).sort((e,t)=>{e=e.Value?.[0]?.departure_time||"",t=t.Value?.[0]?.departure_time||"";return e.localeCompare(t,void 0,{numeric:!0})})},normalizeDayType(e){e=String(e||"").trim().toLowerCase().replace(/\s+/g,"").replace(/â/g,"-");return{mon:"mon",tue:"tue",wed:"wed",thu:"thu",fri:"fri",sat:"sat",sun:"sun",monday:"mon",tuesday:"tue",wednesday:"wed",thursday:"thu",friday:"fri",saturday:"sat",sunday:"sun",holiday:"holiday",holidays:"holiday",weekdays:"mon-fri",weekday:"mon-fri",weekend:"sat-sun",weekends:"sat-sun"}[e]||e},matchesSelectedDayType(e){var t,i=this.normalizeDayType(this.selectedServiceDayType);return!i||!e||(t=(e=Array.isArray(e)?e.join(","):String(e)).split(/[,;]+/).map(e=>this.normalizeDayType(e)).filter(Boolean),!!(t=new Set(t)).has(i))||("holiday"===i?t.has("holiday")||/holiday|observed/i.test(e):"sat-sun"===i?t.has("sat-sun")||t.has("sat")||t.has("sun"):"mon-fri"===i?t.has("mon-fri")||t.has("mon")||t.has("tue")||t.has("wed")||t.has("thu")||t.has("fri"):"sat"===i?t.has("sat"):"sun"===i&&t.has("sun"))},getDirectionHeadsignPlain(){var e=this.selectedDirection;if(!e)return"";var t=String(e.Value??"");if("__loading__"===t)return String(e.Text||"Loading...").trim();if("__await_route__"===t)return String(e.Text||"Select route").trim();if("__no_directions__"===t)return String(e.Text||"No directions available").trim();t=String(e.Text||"").trim();let i=this.stripRouteNumberPrefixFromHeadsign(t);return(i=i.replace(/\s*\((outbound|inbound)\)\s*$/i,"").trim())||(Number.isFinite(Number(e.Value))?"Direction "+e.Value:t)},getDirectionLabel(e,t=0){if(!e)return"";var i=String(e.Value??"");if("__loading__"===i)return String(e.Text||"Loading...");if("__await_route__"===i)return String(e.Text||"Select route").trim();if("__no_directions__"===i)return String(e.Text||"No directions available");var i=String(e.Text||"").trim();let r=this.stripRouteNumberPrefixFromHeadsign(i);return(r=r.replace(/\s*\((outbound|inbound)\)\s*$/i,"").trim())?(i=Number(e.Value),i=Number.isFinite(i)?0===i||1!==i&&0===t?"Outbound":"Inbound":0===t?"Outbound":"Inbound",`To ${r} (${i})`):Number.isFinite(Number(e.Value))?"Direction "+e.Value:""},getDirectionSubheaderLabel(){return this.getDirectionHeadsignPlain()},reverseStops(){var e;null!=this.selectedFirstStopRowIndex&&null!=this.selectedEndStopRowIndex&&(this.suppressStopAnnouncements=!0,e=this.selectedFirstStopRowIndex,this.selectedFirstStopRowIndex=this.selectedEndStopRowIndex,this.selectedEndStopRowIndex=e,this.syncScheduleFromForm(),this.suppressStopAnnouncements=!1,e=this.getVisibleStopsForCurrentFilters().length,this.announceScheduleUpdate(`Start/end reversed: ${e} stops shown.`))},showRoute126Link(){return this.selectedRoute&&126==this.selectedRoute.route_id},toggleLocations(){this.showLocations=!this.showLocations,this.showDirections=!1,this.showDetours=!1,this.showSnowRoute=!1},toggleDirections(){this.showDirections=!this.showDirections,this.showLocations=!1,this.showDetours=!1,this.showSnowRoute=!1},toggleDetours(){this.showDetours=!this.showDetours,this.showLocations=!1,this.showDirections=!1,this.showSnowRoute=!1},toggleSnowRoute(){this.showSnowRoute=!this.showSnowRoute,this.showLocations=!1,this.showDirections=!1,this.showDetours=!1},isStopSelected(e){return this.selectedFirstStopRowIndex===e?"first-stop":this.selectedEndStopRowIndex===e?"end-stop":""},setShowStop(t,e){if(Boolean(null!=this.selectedFirstStop&&null!=this.selectedEndStop)){var i=Number(this.selectedFirstStopRowIndex),r=Number(this.selectedEndStopRowIndex);if(Number.isFinite(i)&&Number.isFinite(r))if(this.showBetweenStops){var a=Math.min(i,r),o=Math.max(i,r);if(e<a||o<e)return!1}else if(e!==i&&e!==r)return!1}return!this.isFiltered||!Array.isArray(this.displaySchedule)||this.displaySchedule.some(e=>{e=this.getTripStopForRow(e?.Value||[],t);return Boolean(e&&(e.departure_time||e.DepartureTime12HourFormat))})},isStartTrip(e){return this.schedule.length&&e===this.schedule[0]},isEndTrip(e){return this.schedule.length&&e===this.schedule[this.schedule.length-1]},setShowRow(e){return!0},getStopTime(e,t){t=Array.isArray(t)?t:[],t=this.getTripStopForRow(t,e);return t&&(e=t.departure_time||t.DepartureTime12HourFormat||"",this.formatDepartureTime(e))||"-"},formatDepartureTime(e){if(!e)return"";let t=String(e).trim();var i,r;return t?/\b[AP]M\b/i.test(t)?(t=t.replace(/^(\d{1,2}[:.]\d{2})[:.]\d{2}(?=\s*[AP]M\b)/i,"$1")).trim():(e=t.match(/^(\d{1,2})[:.](\d{2})(?:[:.](\d{2}))?$/))&&(e=60*parseInt(e[1],10)+parseInt(e[2],10),Number.isFinite(e))?(e=(e%1440+1440)%1440,r=12<=(i=Math.floor(e/60))?"PM":"AM",`${i%12||12}:${String(e%60).padStart(2,"0")} `+r):t:""},showAllRows(){this.hideTopRowsNext=!0},isRowLimitSelected(){return!1},limitRows(e){this.hideTopRowsNext=!this.hideTopRowsNext},onRouteChange(){this.setScheduleSectionsVisibility(!1),this.showLoading=!0,this.loadingMessage="Loading Schedules",this.stopsLoaded=!1,this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[];let t=String(this.selectedRouteId??"").trim();t?(this.selectedRoute=this.busRoutes.find(e=>this.routeRowMatchesSelectionId(e,t)),this.selectedRoute?(this.startTime="",this.endTime="",this.syncTimePartsFromModels(),this.isRouteLoading=!0,this.serviceDirections=[{Value:"__loading__",Text:"Loading..."}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__loading__",this.selectedFirstStopRowIndex=null,this.selectedEndStopRowIndex=null,this.selectedFirstStop=null,this.selectedEndStop=null,this.firstStops=[],this.endStops=[],this.setRoute()):(this.selectedRouteId="",this.isRouteLoading=!1,this.showLoading=!1,this.stopsLoaded=!1,this.stops=[],this.firstStops=[],this.endStops=[],this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.routeInfo={},this.serviceDirections=[{Value:"__await_route__",Text:"Select route"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__await_route__",this.startTime="",this.endTime="",this.syncTimePartsFromModels(),this.selectedFirstStopRowIndex=null,this.selectedEndStopRowIndex=null,this.selectedFirstStop=null,this.selectedEndStop=null,this.setDirectionsLoadingState(!1),this.setDirectionsDisabledState(!0,"Select route"),this.updateHashParams(),this.setScheduleSectionsVisibility(!1),this.applyRouteMapSectionAwaitingSelection(),"function"==typeof this.$nextTick&&this.$nextTick(()=>{var e=document.getElementById("ddlRoutes");e&&(e.value="")}
9))):(this.selectedRoute=null,this.isRouteLoading=!1,this.showLoading=!1,this.stopsLoaded=!1,this.stops=[],this.firstStops=[],this.endStops=[],this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.routeInfo={},this.serviceDirections=[{Value:"__await_route__",Text:"Select route"}],this.selectedDirection=this.serviceDirections[0],this.selectedDirectionId="__await_route__",this.startTime="",this.endTime="",this.syncTimePartsFromModels(),this.selectedFirstStopRowIndex=null,this.selectedEndStopRowIndex=null,this.selectedFirstStop=null,this.selectedEndStop=null,this.setDirectionsLoadingState(!1),this.setDirectionsDisabledState(!0,"Select route"),this.updateHashParams(),this.setScheduleSectionsVisibility(!1),this.applyRouteMapSectionAwaitingSelection(),"function"==typeof this.$nextTick&&this.$nextTick(()=>{var e=document.getElementById("ddlRoutes");e&&(e.value="")}))},onDirectionChange(){this.isRouteLoading||"__loading__"===String(this.selectedDirectionId)||"__await_route__"===String(this.selectedDirectionId)||"__no_directions__"===String(this.selectedDirectionId)||(this.showLoading=!0,this.loadingMessage="Loading Schedules",this.stopsLoaded=!1,this.schedule=[],this.filteredSchedule=[],this.displaySchedule=[],this.selectedDirection=this.serviceDirections.find(e=>String(e.Value)===String(this.selectedDirectionId)),this.startTime="",this.endTime="",this.syncTimePartsFromModels(),this.selectedFirstStopRowIndex=null,this.selectedEndStopRowIndex=null,this.selectedFirstStop=null,this.selectedEndStop=null,this.firstStops=[],this.endStops=[],this.setDirection())},onFirstStopChange(){this.prefillTimeRangeFromSchedule(),this.syncScheduleFromForm()},onEndStopChange(){this.prefillTimeRangeFromSchedule(),this.syncScheduleFromForm()},onScheduleTimeInput(){this.syncModelsFromTimeParts(),this.syncScheduleFromForm()},searchTrips(){this.searchValidationMessage="",this.noTripsForSearch=!1,this.startTime=this.normalizeHtmlTimeModel(this.startTime),this.endTime=this.normalizeHtmlTimeModel(this.endTime);var e=!!this.selectedFirstStop,t=!!this.selectedEndStop;let r=this.startTime&&""!==String(this.startTime).trim(),a=this.endTime&&""!==String(this.endTime).trim(),o=r||a;e&&t?(e=Number(this.selectedFirstStopRowIndex),t=Number(this.selectedEndStopRowIndex),!Number.isFinite(e)||e<0||!Number.isFinite(t)||t<0?(this.isFiltered=!1,this.filteredSchedule=[],this.displaySchedule=this.finalizeDisplaySchedule(this.schedule),this.noHolidayServiceForRoute=!1):(this.filteredSchedule=this.schedule.filter(e=>{e=e.Value||[];if(o){e=this.getTripDepartureMinutesForFilter(e,this.selectedFirstStop);if(Number.isNaN(e))return!1;var e=(e%1440+1440)%1440,t=r?this.toMinutes(this.startTime):NaN,i=a?this.toMinutes(this.endTime):NaN;if(r&&a){if(!Number.isNaN(t)&&!Number.isNaN(i))if(!(i<t?t<=e||e<=i:t<=e&&e<=i))return!1}else{if(!Number.isNaN(t)&&e<t)return!1;if(!Number.isNaN(i)&&i<e)return!1}}return!0}),this.isFiltered=!0,this.displaySchedule=this.finalizeDisplaySchedule(this.filteredSchedule),this.noTripsForSearch=0===this.displaySchedule.length,this.noHolidayServiceForRoute=!1,e=this.getVisibleStopsForCurrentFilters().length,this.noTripsForSearch?this.announceScheduleUpdate("No trips found for the selected stops and time range."):this.announceScheduleUpdate(`Time filter applied: ${this.displaySchedule.length} departures, ${e} stops shown.`),this.focusResultsRegion(),setTimeout(()=>this.displayStopsOnMap(),100))):(this.searchValidationMessage="Please select both start and end stops to search.",this.announceScheduleUpdate(this.searchValidationMessage))},getDisplaySchedule(){return this.isFiltered?this.filteredSchedule:this.schedule},announceScheduleUpdate(e){e=e?String(e):"Schedule updated.";this.scheduleAnnouncementSeq=(this.scheduleAnnouncementSeq||0)+1;let t=`${e} Update ${this.scheduleAnnouncementSeq}.`;this.scheduleAnnouncement="",requestAnimationFrame(()=>{this.scheduleAnnouncement=t})},focusResultsRegion(){var t=document.getElementById("schedulePrintMain");if(t)try{t.focus({preventScroll:!0})}catch(e){try{t.focus()}catch(e){}}},getVisibleStopsForCurrentFilters(){return(this.stops||[]).filter((e,t)=>
9this.setShowStop(e,t))},escapeHtml(e){return String(e??"").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")},getPrintScheduleTitle(){var e="function"==typeof this.formatScheduleRoutePill&&this.selectedRoute?this.formatScheduleRoutePill(this.selectedRoute):this.selectedRoute?.route_short_name||this.selectedRouteId||"",t="function"==typeof this.getDirectionHeadsignPlain?this.getDirectionHeadsignPlain():"";return e&&t?`Route ${e} - `+t:e?"Route "+e:"Route Schedule"},getPrintPageMetrics(e=0,t=0){var i=Math.round(96/25.4*179.6),r=Math.round(96/25.4*266.6),a=Math.max(1,Math.floor((r-28-22)/16)),t=Math.max(1,Math.ceil(Math.max(t,1)/a)),a=Math.max(1,Math.floor(6/t)),t=Math.max(1,Math.ceil(Math.max(e,1)/a)),e=Math.max(1,Math.floor((i-110)/40)),t=Math.min(t,e),a=Math.max(40,Math.floor((i-110)/t)),e=Math.min(140,Math.max(110,i-a*t));return{pageWidthMm:210,pageHeightMm:297,marginMm:12.7,safetyMm:5,contentWidthMm:179.6,contentHeightMm:266.6,maxPages:6,stopColPx:e,tripColPx:a,stopColPct:Number((e/i*100).toFixed(3)),tripsPerPage:t,rowPx:16,titleBlockPx:28,headerRowPx:22,iframeWidthPx:i,iframeHeightPx:r}},buildPrintTableChunkHtml(r,e,t={}){var{title:t="Route Schedule",stopCount:i=e.length,pageIndex:a=0,pageCount:o=1,tripStart:s=1,tripEnd:n=r.length,totalTrips:l=r.length}=t,d=r.map(e=>{e=this.getTripColumnHeader(e)||"";return`<th scope="col" class="col-trip"> 10 <div class="gap-text"> 11 <span class="trip-time">${this.escapeHtml(e)}</span> 12 </div> 13 </th>`}).join(""),e=e.map((t,e)=>{var i=r.map(e=>{e=this.getStopTime(t,e?.Value||[]);return`<td class="col-trip"><span>${this.escapeHtml(e)}</span></td>`}).join("");return`<tr class="${e%2==0?"row-odd":"row-even"}"> 14 <th scope="row" class="col-stop">#${this.escapeHtml(t.stop_id)}-${this.escapeHtml(t.stop_name)}</th> 15 ${i} 16 </tr>`}).join(""),s=1<o?`<p class="print-page-meta">Departures ${s}â${n} of ${l} · Sheet ${a+1} of ${o}</p>`:"";return` 17 <section class="print-page"> 18 <header class="print-page-header"> 19 <h1>${this.escapeHtml(t)}</h1> 20 ${s} 21 </header> 22 <div class="print-table-wrap"> 23 <table class="schedules-table"> 24 <thead> 25 <tr class="table-bg"> 26 <th scope="col" class="col-stop"> 27 <div class="step-text"> 28 Stop Location 29 <span class="stop-count">${i} stops</span> 30 </div> 31 </th> 32 ${d} 33 </tr> 34 </thead> 35 <tbody> 36 ${e} 37 </tbody> 38 </table> 39 </div> 40 </section> 41 `},buildPrintableScheduleHtml(){var t=Array.isArray(this.displaySchedule)?this.displaySchedule:[],i=this.getVisibleStopsForCurrentFilters(),e=this.getPrintPageMetrics(t.length,i.length),r=this.getPrintScheduleTitle(),a=e.tripsPerPage,o=Math.max(1,Math.ceil(t.length/a)||1);if(!t.length)return` 42 <div class="print-schedule"> 43 ${this.buildPrintTableChunkHtml([],i,{title:r,stopCount:i.length,pageIndex:0,pageCount:1,tripStart:0,tripEnd:0,totalTrips:0})} 44 </div> 45 `;var s=[];for(let e=0;e<t.length;e+=a){var n=t.slice(e,e+a),l=Math.floor(e/a);s.push(this.buildPrintTableChunkHtml(n,i,{title:r,stopCount:i.length,pageIndex:l,pageCount:o,tripStart:e+1,tripEnd:e+n.length,totalTrips:t.length}))}return`<div class="print-schedule">${s.join("")}</div>`},getPrintStyles(e=0,t=0){e=this.getPrintPageMetrics(e,t);return` 46 @page { size: A4 portrait; margin: ${e.marginMm}mm; } 47 *, *::before, *::after { box-sizing: border-box; } 48 html, body { 49 margin: 0; 50 padding: 0; 51 width: 100%; 52 max-width: 100%; 53 background: #fff; 54 color: #475467; 55 font-family: "Geist", Arial, Helvetica, sans-serif; 56 -webkit-print-color-adjust: exact; 57 print-color-adjust: exact; 58 } 59 .print-schedule { 60 width: 100%; 61 max-width: 100%; 62 } 63 .print-page { 64 width: 100%; 65 max-width: 100%; 66 page-break-after: always; 67 break-after: page; 68 } 69 .print-page:last-child { 70 page-break-after: auto; 71 break-after: auto; 72 } 73 .print-page-header { 74 margin: 0 0 6px; 75 } 76 .print-page-header h1 { 77 margin: 0; 78 color: #003DA6; 79 font-size: 13px; 80 line-height: 1.2; 81 font-weight: 600; 82 } 83 .print-page-meta { 84 margin: 2px 0 0; 85 font-size: 9px; 86 line-height: 1.2; 87 color: #475467; 88 } 89 /* Chrome print autofit can clip 1px on wide tables; Adobe PDF uses larger 90 non-printable margins than Save as PDF. Keep content inside both. */ 91 .print-table-wrap { 92 display: table; 93 width: 100%; 94 max-width: 100%; 95 padding-right: 1pt; 96 } 97 .schedules-table { 98 width: 100%; 99 max-width: 100%; 100 border-collapse: collapse; 101 table-layout: fixed; 102 border: 1px solid #475467; 103 } 104 .schedules-table thead { display: table-header-group; } 105 .schedules-table tbody { display: table-row-group; } 106 .schedules-table tr { 107 break-inside: avoid; 108 page-break-inside: avoid; 109 } 110 .schedules-table th, 111 .schedules-table td { 112 border: 1px solid #475467; 113 padding: 2px 3px; 114 vertical-align: middle;
115 overflow-wrap: anywhere; 116 } 117 .schedules-table thead th { 118 border-color: #003DA6; 119 color: #fff; 120 background: #003DA6; 121 font-size: 9px; 122 line-height: 1.15; 123 font-weight: 600; 124 } 125 .schedules-table .col-stop { 126 width: ${e.stopColPct}%; 127 text-align: left; 128 white-space: normal; 129 overflow-wrap: anywhere; 130 word-break: break-word; 131 } 132 .schedules-table thead .col-stop { 133 background: #003DA6; 134 color: #fff; 135 } 136 .schedules-table .step-text { 137 display: flex; 138 flex-direction: column; 139 gap: 1px; 140 color: #fff; 141 font-size: 9px; 142 line-height: 1.15; 143 font-weight: 600; 144 } 145 .schedules-table .stop-count { 146 font-size: 8px; 147 line-height: 1.2; 148 font-weight: 500; 149 } 150 .schedules-table .col-trip { 151 text-align: center; 152 } 153 .schedules-table .gap-text { 154 display: flex; 155 flex-direction: column; 156 gap: 0; 157 align-items: center; 158 white-space: nowrap; 159 } 160 .schedules-table thead .gap-text { 161 color: #fff; 162 } 163 .schedules-table .trip-time { 164 font-size: 9px; 165 line-height: 1.15; 166 font-weight: 600; 167 } 168 .schedules-table tbody .col-stop { 169 color: #475467; 170 background: #fff; 171 font-size: 8px; 172 line-height: 1.2; 173 font-weight: 600; 174 } 175 .schedules-table tbody .col-trip { 176 color: #475467; 177 background: #fff; 178 font-size: 8px; 179 line-height: 1.2; 180 font-weight: 400; 181 white-space: nowrap; 182 } 183 .schedules-table tbody tr.row-even th, 184 .schedules-table tbody tr.row-even td { 185 background: #f6f6f7; 186 } 187 .schedules-table tbody tr.row-odd th, 188 .schedules-table tbody tr.row-odd td { 189 background: #fff; 190 } 191 @media print { 192 html, body, .print-schedule, .print-page, .print-table-wrap, .schedules-table { 193 width: 100% !important; 194 max-width: 100% !important; 195 } 196 } 197 `},printMinimalSchedule(){var e=Array.isArray(this.displaySchedule)?this.displaySchedule:[],t=this.getVisibleStopsForCurrentFilters(),i=this.buildPrintableScheduleHtml(),r=this.getPrintPageMetrics(e.length,t.length);let a=document.createElement("iframe");a.setAttribute("title","Schedule print frame"),a.setAttribute("aria-hidden","true"),a.style.position="fixed",a.style.left="0",a.style.top="0",a.style.width=r.iframeWidthPx+"px",a.style.height=r.iframeHeightPx+"px",a.style.border="0",a.style.opacity="0",a.style.pointerEvents="none",document.body.appendChild(a);r=a.contentWindow&&a.contentWindow.document;r?(r.open(),r.write(`<!doctype html> 198<html> 199<head> 200 <meta charset="utf-8"> 201 <title>${this.escapeHtml(this.getPrintScheduleTitle())}</title> 202 <style>${this.getPrintStyles(e.length,t.length)}</style> 203</head> 204<body>${i}</body> 205</html>`),r.close(),setTimeout(()=>{var e=a.contentWindow;e?(e.onafterprint=()=>{setTimeout(()=>a.remove(),300)},e.focus(),e.print()):a.remove()},150)):a.remove()},setupStickyHeader(){window.addEventListener("scroll",()=>{var e,t=document.getElementById("schedulesTable"),i=document.getElementById("tableHeader");t&&i&&(e=t.offsetTop+t.offsetHeight,t.offsetTop<=(t=window.scrollY)&&t<=e?i.classList.add("fixed"):i.classList.remove("fixed"))})}}}function serviceOverviewApp(){let a="https://cata.alerts.api.exemplifi.io/api/v1",o={Accept:"application/json","X-API-KEY":"sk_live_SOdoS2lNrADb82dOIDtRcz_t33L3Zx0t"};return{_didInit:!1,mapCtrl:null,infoWindow:null,bounds:null,routes:[],routeDetailsCache:{},routeDetailsPromiseCache:{},routeOverlays:{},failedRoutes:[],activeRouteId:null,showLoading:!1,markerFractions:[.08,.18,.28,.38,.48,.58,.68,.78,.88,.96],markerFractionIndex:0,minMapZoom:12,placedMarkerPositions:[],showCtrlScrollMessage:!1,ctrlScrollMessageTimeoutId:null,async init(){if(!this._didInit){this._didInit=!0;try{this.showLoading=!0;var e=(await google.maps.importLibrary("maps")).Map,t="function"==typeof window.cataMapsTouchPrimaryZoom&&window.cataMapsTouchPrimaryZoom(),i={center:{lat:42.73386,lng:-84.555363},zoom:this.minMapZoom,mapId:"cata-service-map",zoomControl:!0,scrollwheel:t,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,gestureHandling:t?"cooperative":"greedy"},r=(this.mapCtrl=new e(document.getElementById("service-map"),i),document.getElementById("service-map"));r&&!t&&r.addEventListener("wheel",e=>{this.mapCtrl&&(e=!!e.ctrlKey,this.mapCtrl.setOptions({scrollwheel:e}),e?(this.showCtrlScrollMessage=!1,this.ctrlScrollMessageTimeoutId&&(clearTimeout(this.ctrlScrollMessageTimeoutId),this.ctrlScrollMessageTimeoutId=null)):(this.showCtrlScrollMessage=!0,this.ctrlScrollMessageTimeoutId&&clearTimeout(this.ctrlScrollMessageTimeoutId),this.ctrlScrollMessageTimeoutId=setTimeout(()=>{this.showCtrlScrollMessage=!1,this.ctrlScrollMessageTimeoutId=null},4e3)))},{passive:!0}),this.infoWindow=new google.maps.InfoWindow,await this.loadRoutes()}catch(e){console.error("Failed to initialize service overview map",e),this.failedRoutes=["Map initialization failed. Please refresh the page to try again."]}finally{this.showLoading=!1}}},async loadRoutes(){a;try{var t=await(await fetch("https://cata.alerts.api.exemplifi.io/api/v1/routes",{headers:o})).json(),i=Array.isArray(t)?t:[];
205let a=new Map,e=(i.forEach(e=>{var t,i,r;e&&e.shortName&&!1!==e.isActive&&(t=String(e.shortName).trim().toLowerCase(),a.has(t)&&(i=!(!(i=a.get(t))||!i.routeId&&!i.id),r=!(!e||!e.routeId&&!e.id),i||!r)||a.set(t,e))}),this.routes=Array.from(a.values()).sort((e,t)=>String(e.shortName).localeCompare(String(t.shortName),void 0,{numeric:!0})),this.markerFractionIndex=0,this.placedMarkerPositions=[],[...this.routes]);var r=Array.from({length:5},()=>this.processRouteQueue(e));await Promise.all(r),this.bounds&&!this.bounds.isEmpty()&&(this.mapCtrl.fitBounds(this.bounds),this.enforceMinimumZoom())}catch(e){console.error("Unable to retrieve routes",e),this.failedRoutes=[]}},async processRouteQueue(e){for(;0<e.length;){var t=e.shift();if(t)try{await this.plotRoute(t)}catch(e){console.error("Failed to plot route "+t.shortName,e)}}},async plotRoute(e){let i=String(e.routeId||e.id||e.shortName);if(!this.routeOverlays[i]){var r=this.toColor(e&&e.routeColor)||"#6A1B9A",a=await this.fetchRouteDetails(e),o=this.extractPath(a);if(o.length){var s=new google.maps.Polyline({path:o,strokeColor:r,strokeOpacity:.85,strokeWeight:6,map:this.mapCtrl,zIndex:1}),n=this.buildBounds(o),a=(this.extendGlobalBounds(o),this.extractDirectionSummary(a)),l=this.getNextMarkerFraction(),{position:o,fraction:l}=this.calculateAdjustedMarkerPlacement(o,l);let t=this.createRouteMarker({route:e,position:o||n.getCenter(),directionSummary:a});this.storeMarkerPosition(o),this.routeOverlays[i]={route:e,color:r,polyline:s,marker:t,bounds:n,directionSummary:a,markerFraction:l},s.addListener("click",e=>{this.openRouteInfo(i,e.latLng||t.position)}),s.addListener("mouseover",()=>this.setActiveRoute(i)),s.addListener("mouseout",()=>{this.activeRouteId===i&&this.clearRouteHoverHighlight()}),t.addListener("click",()=>this.openRouteInfo(i))}else console.error("No path for route "+e.shortName)}},async fetchRouteDetails(e){let t=String(e&&e.shortName||"").trim().toLowerCase();return t?this.routeDetailsCache[t]||(this.routeDetailsPromiseCache[t]||(e=a+"/maps/routes/"+encodeURIComponent(t),this.routeDetailsPromiseCache[t]=fetch(e,{headers:o}).then(async e=>e.ok?e.json():null).then(e=>(e&&(this.routeDetailsCache[t]=e),e)).finally(()=>{delete this.routeDetailsPromiseCache[t]})),this.routeDetailsPromiseCache[t]):null},extractPath(e){var t;return e&&e.shapes&&"object"==typeof e.shapes&&(e=(t=Object.keys(e.shapes)[0])?e.shapes[t]:[],Array.isArray(e))?e.filter(e=>e&&void 0!==e.lat&&void 0!==e.lon).sort((e,t)=>(e.sequence||0)-(t.sequence||0)).map(e=>({lat:Number(e.lat),lng:Number(e.lon)})):[]},extractDirectionSummary(e){e=Array.isArray(e&&e.stops)?e.stops:[];if(!e.length)return"";let t=new Set;return e.forEach(e=>{(Array.isArray(e&&e.times)?e.times:[]).forEach(e=>{e&&e.headsign&&t.add(e.headsign)})}),Array.from(t).slice(0,3).join(" / ")},buildBounds(e){let t=new google.maps.LatLngBounds;return e.forEach(e=>t.extend(e)),t},extendGlobalBounds(e){this.bounds||(this.bounds=new google.maps.LatLngBounds),e.forEach(e=>this.bounds.extend(e))},createRouteMarker({route:e,position:t,directionSummary:i}){var r=(e.shortName||e.route_short_name||"").toString(),e=this.buildMarkerTitle(e,i);return new google.maps.Marker({map:this.mapCtrl,position:t,title:e,icon:this.buildBadgeIcon(r),optimized:!1})},buildMarkerTitle(e,t){e=e&&(e.RouteDisplayName||e.longName)||"Route";return t?e+" â Directions: "+t:e},openRouteInfo(e,t=null){var i,r,a,o=this.routeOverlays[e];o&&({route:i,directionSummary:r,color:a}=o,t=t||o.marker.position,o=i&&(i.shortName||i.route_short_name)||e,o=(e=encodeURIComponent(String(o||"").trim()))?"/find-bus-by-schedule#route="+e:"/find-bus-by-schedule",e=` 206 <div class="map-popup"> 207 <div class="map-popup__wrap"> 208 <h6 class="map-popup__title" style="color:#003da6"> 209 <span class="icon-bus" aria-hidden="true"></span> 210 Route ${this.escapeHtml(i.shortName||"")} 211 </h6> 212 <p class="body-style-b2"> 213 ${this.escapeHtml(i.longName||"Route information unavailable")} 214 </p> 215 <div> 216 <a href="${o}" style="color:#902a8d" target="_blank" rel="noopener noreferrer">
217 <span class="btn-text">${this.escapeHtml(r||"Find Route Schedules")}</span> 218 </a> 219 </p> 220 </div> 221 </div> 222 `,this.infoWindow.setContent(e),this.infoWindow.setPosition(t),this.infoWindow.open({map:this.mapCtrl}))},setActiveRoute(i){this.activeRouteId=i,Object.entries(this.routeOverlays).forEach(([e,t])=>{e=e===String(i);t.polyline.setOptions({strokeOpacity:e?1:.35,strokeWeight:e?6:3,zIndex:e?10:1})})},clearRouteHoverHighlight(){this.activeRouteId=null,Object.values(this.routeOverlays).forEach(e=>{e.polyline.setOptions({strokeOpacity:.85,strokeWeight:6,zIndex:1})})},resetView(){this.bounds&&!this.bounds.isEmpty()&&(this.mapCtrl.fitBounds(this.bounds),this.enforceMinimumZoom()),this.clearRouteHoverHighlight(),this.infoWindow.close()},toColor(e){return e&&(e=e.startsWith("#")?e:"#"+e,/^#[0-9A-Fa-f]{6}$/.test(e))?e:null},escapeHtml(e){if("string"!=typeof e)return e;let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,e=>t[e])},buildBadgeIcon(e){return{url:this.buildBadgeDataUrl(e),size:new google.maps.Size(120,48),scaledSize:new google.maps.Size(60,28),origin:new google.maps.Point(0,0),anchor:new google.maps.Point(30,28)}},buildBadgeDataUrl(e){e=(e||"").toString().trim().replace(/[^0-9A-Za-z]/g,"").toUpperCase()||"â",e=` 223 <svg xmlns="http://www.w3.org/2000/svg" width="108" height="48" viewBox="0 0 120 48"> 224 <g fill="none" fill-rule="evenodd"> 225 <rect width="108" height="48" rx="4" fill="#90118D"/> 226 <g transform="translate(12,10) scale(2)"> 227 ${this.buildBusSvgPath()} 228 </g> 229 <text x="72" y="30" fill="#FFFFFF" font-size="26" font-family="Arial, Helvetica, sans-serif" font-weight="700" text-anchor="middle" dominant-baseline="middle">${e}</text> 230 </g> 231 </svg>`;return"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(e)},getNextMarkerFraction(){var e=this.markerFractions[this.markerFractionIndex%this.markerFractions.length]||.5;return this.markerFractionIndex+=1,e},getMarkerPosition(t,e=.5){if(!Array.isArray(t)||0===t.length)return null;if(1===t.length)return t[0];var i=this.getPathLength(t);if(0===i)return t[0];var r=i*e;let a=0;for(let e=1;e<t.length;e++){var o,s=t[e-1],n=t[e],l=this.calculateDistance(s,n);if(a+l>=r)return o=0===l?0:(r-a)/l,{lat:s.lat+(n.lat-s.lat)*o,lng:s.lng+(n.lng-s.lng)*o};a+=l}return t[t.length-1]},getPathLength(t){let i=0;for(let e=1;e<t.length;e++)i+=this.calculateDistance(t[e-1],t[e]);return i},calculateDistance(e,t){var i=e=>e*Math.PI/180,r=i(e.lat),a=i(t.lat),o=i(t.lat-e.lat),i=i(t.lng-e.lng),t=Math.sin(o/2)*Math.sin(o/2)+Math.cos(r)*Math.cos(a)*Math.sin(i/2)*Math.sin(i/2);return 6371e3*(2*Math.atan2(Math.sqrt(t),Math.sqrt(1-t)))},calculateAdjustedMarkerPlacement(t,e){var i=e=>Math.min(.95,Math.max(.05,e)),r=i(e),a=[0,.06,-.06,.12,-.12,.18,-.18,.24,-.24];for(let e=0;e<a.length;e++){var o=i(r+a[e]),s=this.getMarkerPosition(t,o);if(s&&!this.isTooCloseToExisting(s))return{position:s,fraction:o}}return{position:this.getMarkerPosition(t,r)||t[t.length-1],fraction:r}},isTooCloseToExisting(t,i=250){return!!t&&this.placedMarkerPositions.some(e=>this.calculateDistance(e,t)<i)},storeMarkerPosition(e){e&&this.placedMarkerPositions.push(e)},enforceMinimumZoom(){this.mapCtrl&&"function"==typeof this.mapCtrl.getZoom&&this.mapCtrl.getZoom()<this.minMapZoom&&this.mapCtrl.setZoom(this.minMapZoom)},buildBusSvgPath(){return` 232 <path fill-rule="evenodd" clip-rule="evenodd" d="M6.66667 0C4.15267 0 2.89533 -7.94729e-08 2.11467 0.781333C1.40533 1.49 1.34 2.59067 1.33333 4.66667H0.666667C0.489856 4.66667 0.320286 4.7369 0.195262 4.86193C0.0702379 4.98695 0 5.15652 0 5.33333V6C0 6.1035 0.0240967 6.20557 0.0703818 6.29814C0.116667 6.39071 0.183869 6.47124 0.266667 6.53333L1.33333 7.33333C1.34 9.40933 1.40533 10.51 2.11467 11.2187C2.276 11.3807 2.45733 11.5087 2.66667 11.61V12.6667C2.66667 12.8435 2.7369 13.013 2.86193 13.1381C2.98695 13.2631 3.15652 13.3333 3.33333 13.3333H4.33333C4.51014 13.3333 4.67971 13.2631 4.80474 13.1381C4.92976 13.013 5 12.8435 5 12.6667V11.988C5.48467 12 6.036 12 6.66667 12C7.29733 12 7.84867 12 8.33333 11.988V12.6667C8.33333 12.8435 8.40357 13.013 8.52859 13.1381C8.65362 13.2631 8.82319 13.3333 9 13.3333H10C10.1768 13.3333 10.3464 13.2631 10.4714 13.1381C10.5964 13.013 10.6667 12.8435 10.6667 12.6667V11.61C10.8716 11.5119 11.0582 11.3795 11.2187 11.2187C11.928 10.51 11.994 9.40933 12 7.33333L13.0667 6.53333C13.1495 6.47124 13.2167 6.39071 13.2629 6.29814C13.3092 6.20557 13.3333 6.1035 13.3333 6V5.33333C13.3333 5.15652 13.2631 4.98695 13.1381 4.86193C13.013 4.7369 12.8435 4.66667 12.6667 4.66667H12C11.9933 2.59067 11.928 1.49 11.2187 0.781333C10.438 -7.94729e-08 9.18067 0 6.66667 0ZM2.33333 5C2.33333 5.94267 2.33333 6.414 2.62667 6.70667C2.91933 7 3.39067 7 4.33333 7H9C9.94267 7 10.414 7 10.7067 6.70667C11 6.414 11 5.94267 11 5V3.33333C11 2.39067 11 1.91933 10.7067 1.6266
2327C10.4147 1.33333 9.94333 1.33333 9 1.33333H4.33333C3.39067 1.33333 2.91933 1.33333 2.62667 1.62667C2.33333 1.91867 2.33333 2.39 2.33333 3.33333V5ZM2.83333 9.33333C2.83333 9.20072 2.88601 9.07355 2.97978 8.97978C3.07355 8.88601 3.20072 8.83333 3.33333 8.83333H4.33333C4.46594 8.83333 4.59312 8.88601 4.68689 8.97978C4.78065 9.07355 4.83333 9.20072 4.83333 9.33333C4.83333 9.46594 4.78065 9.59312 4.68689 9.68689C4.59312 9.78065 4.46594 9.83333 4.33333 9.83333H3.33333C3.20072 9.83333 3.07355 9.78065 2.97978 9.68689C2.88601 9.59312 2.83333 9.46594 2.83333 9.33333ZM10.5 9.33333C10.5 9.20072 10.4473 9.07355 10.3536 8.97978C10.2598 8.88601 10.1326 8.83333 10 8.83333H9C8.86739 8.83333 8.74021 8.88601 8.64645 8.97978C8.55268 9.07355 8.5 9.20072 8.5 9.33333C8.5 9.46594 8.55268 9.59312 8.64645 9.68689C8.74021 9.78065 8.86739 9.83333 9 9.83333H10C10.1326 9.83333 10.2598 9.78065 10.3536 9.68689C10.4473 9.59312 10.5 9.46594 10.5 9.33333Z" fill="white"/> 233 `}}}function stopsDeparturesApp(){let u={offlineLoaded:!1,offlineLoading:null,offlineData:null,stopIndexReady:!1,stopIndex:Object.create(null),stopList:[],routesShortNames:[],routesLongNames:[],routeShortNameToIdx:Object.create(null),routePathsByIdx:[],trips:[],headsigns:[],departuresByStop:Object.create(null),tripServiceByIdx:[],serviceCalendars:Object.create(null),calendarDateExceptions:Object.create(null),activeServicesCache:{date:"",set:null},activeStopIdsCache:{date:"",set:null}};return{ensureSafariDialogCompat(){function e(){}void 0===window.HTMLDialogElement&&((e.prototype=window.HTMLElement&&window.HTMLElement.prototype||{}).show||(e.prototype.show=function(){}),e.prototype.showModal||(e.prototype.showModal=function(){}),e.prototype.close||(e.prototype.close=function(){}),window.HTMLDialogElement=e)},mapCtrl:null,currentPosition:{},location:"",stopId:"",noStopResultsMessage:"",autocomplete:null,stopMarkers:[],stops:[],departures:[],buses:[],busMarkers:[],noTimesFoundMessage:"",tripId:0,showLoading:!1,showGeoMessage:!1,showCtrlScrollMessage:!1,ctrlScrollMessageTimeout:null,ctrlScrollHintText:"Use Ctrl + scroll to zoom the map",mapPanelOpen:!0,locationPlace:{},currentDeparturesStopId:0,selectedStopId:0,searchRequestSeq:0,activeSearchRequest:0,pinMarker:{},numberOfStops:3,loadingDepartures:!1,offlineIndexReady:!1,async init(){this.ensureSafariDialogCompat();var{}=await google.maps.importLibrary("maps"),{}=await google.maps.importLibrary("places"),e=("function"==typeof window.cataMapsTouchPrimaryZoom&&window.cataMapsTouchPrimaryZoom(),{gestureHandling:"cooperative",center:new google.maps.LatLng(42.73386,-84.555363),zoom:12,scrollwheel:!1,disableDefaultUI:!0,zoomControl:!0,zoomControlOptions:{position:google.maps.ControlPosition.RIGHT_CENTER}}),t=document.getElementById("map");this.mapCtrl=new google.maps.Map(document.getElementById("map"),e),this.ensureCtrlScrollHintElement(t),t&&t.addEventListener("wheel",e=>{e.ctrlKey?(this.mapCtrl.setOptions({scrollwheel:!0}),this.toggleCtrlScrollHint(!1),this.ctrlScrollMessageTimeout&&(clearTimeout(this.ctrlScrollMessageTimeout),this.ctrlScrollMessageTimeout=null)):(this.mapCtrl.setOptions({scrollwheel:!1}),this.toggleCtrlScrollHint(!0),this.ctrlScrollMessageTimeout&&clearTimeout(this.ctrlScrollMessageTimeout),this.ctrlScrollMessageTimeout=setTimeout(()=>{this.toggleCtrlScrollHint(!1),this.ctrlScrollMessageTimeout=null},2500))},{passive:!0}),this.initializeControls(),this.ensureStopIndex().catch(e=>console.error("Failed to load offline stops dataset",e))},ensureCtrlScrollHintElement(e){var t,i;e&&"1"!==e.dataset.ctrlScrollHintAttached&&((t=document.createElement("div")).className="ctrl-scroll-hint",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.style.position="absolute",t.style.bottom="12px",t.style.left="12px",t.style.padding="8px 12px",t.style.background="rgba(17, 24, 39, 0.88)",t.style.color="#fff",t.style.fontSize="13px",t.style.borderRadius="6px",t.style.zIndex="10",t.style.display="none",t.textContent=this.ctrlScrollHintText,i=e.parentElement)&&(i.style.position||(i.style.position="relative"),i.appendChild(t),e.dataset.ctrlScrollHintAttached="1",e._ctrlScrollHintEl=t)},toggleCtrlScrollHint(e){this.showCtrlScrollMessage=Boolean(e);e=document.getElementById("map"),e=e&&e._ctrlScrollHintEl?e._ctrlScrollHintEl:null;e&&(e.style.display=this.showCtrlScrollMessage?"block":"none")},toggleMapPanel(){this.mapPanelOpen=!this.mapPanelOpen},sanatize(e){return e}
233,async initializeControls(){var e={componentRestrictions:{country:"us"},bounds:new google.maps.LatLngBounds(new google.maps.LatLng(42.55149,-84.843212),new google.maps.LatLng(42.859113,-84.269351))};this.autocomplete=new google.maps.places.Autocomplete(document.getElementById("location"),e),google.maps.event.addListener(this.autocomplete,"place_changed",this.setLocationFromAutoComplete.bind(this)),this.mapCtrl.addListener("click",this.mapClick.bind(this))},mapClick(e){this.clearData(),this.clearMapOverlays({clearPin:!0});let i=this.startSearchRequest(),r={lat:e.latLng.lat(),lng:e.latLng.lng()};new google.maps.places.PlacesService(this.mapCtrl).textSearch({query:r.lat+", "+r.lng},(e,t)=>{t==google.maps.places.PlacesServiceStatus.OK?this.location=e[0].formatted_address:this.location=r.lat+", "+r.lng,document.getElementById("location").value=this.location,this.getStopByLatLong(r.lat,r.lng,i)})},clearMapOverlays({clearPin:e=!1}={}){var t=this.stopMarkers.slice(),t=(this.stopMarkers=[],t.forEach(e=>{try{e&&e.infoWindow&&e.infoWindow.close(),e&&"function"==typeof e.setMap&&e.setMap(null)}catch(e){console.warn("[stops-departures] clear stop marker",e)}}),this.busMarkers.slice());if(this.busMarkers=[],t.forEach(e=>{try{e&&e.infoWindow&&e.infoWindow.close(),e&&"function"==typeof e.setMap&&e.setMap(null)}catch(e){console.warn("[stops-departures] clear bus marker",e)}}),this.routePath){try{this.routePath.setMap(null)}catch(e){console.warn("[stops-departures] clear route polyline",e)}this.routePath=null}if(e&&this.pinMarker&&"function"==typeof this.pinMarker.setMap){try{this.pinMarker.setMap(null)}catch(e){console.warn("[stops-departures] clear pin marker",e)}this.pinMarker={}}},setLocationFromAutoComplete(){var e=this.autocomplete.getPlace();e.geometry?(this.locationPlace=e,this.location=e.formatted_address||e.name||this.location,this.noStopResultsMessage=""):this.noStopResultsMessage="No active stops were found for this location. Service may not be running right now."},getCurrentLocation(){this.showGeoMessage=!1,this.location="",this.stopId="",this.clearData(),this.clearMapOverlays({clearPin:!0}),navigator.geolocation?navigator.geolocation.getCurrentPosition(i=>{let r=this.startSearchRequest();this.currentPosition=i,new google.maps.places.PlacesService(this.mapCtrl).textSearch({query:i.coords.latitude+", "+i.coords.longitude},(e,t)=>{t==google.maps.places.PlacesServiceStatus.OK?this.location=e[0].formatted_address:this.location=i.coords.latitude+", "+i.coords.longitude,document.getElementById("location").value=this.location,this.getStopByLatLong(i.coords.latitude,i.coords.longitude,r)})},()=>{this.showLoading=!1,this.showGeoMessage=!0}):(this.showLoading=!1,this.showGeoMessage=!0)},clearLocation(){this.location="",this.showGeoMessage=!1},clearStopId(){this.locationPlace={},this.stopId="",this.showGeoMessage=!1},startSearchRequest(e=!0){return this.searchRequestSeq+=1,this.activeSearchRequest=this.searchRequestSeq,e&&(this.clearMapOverlays({clearPin:!0}),this.stops=[],this.departures=[],this.buses=[],this.currentDeparturesStopId=0,this.selectedStopId=0),this.activeSearchRequest},isSearchRequestActive(e){return Number(e)===Number(this.activeSearchRequest)},async getStops(){var e,t=this.location,r=this.stopId;if(console.log("[stops-departures] getStops input:",{location:t,stopId:r,numberOfStops:this.numberOfStops,locationPlace:this.locationPlace}),r&&""!==r||t&&""!==t){this.showLoading=!0,this.clearData(),this.clearMapOverlays({clearPin:!0});let i=this.startSearchRequest();
233""!==r?await this.getStopById(r,i):this.locationPlace.geometry?(r=this.locationPlace.geometry.location.lat(),e=this.locationPlace.geometry.location.lng(),await this.getStopByLatLong(r,e,i)):""!==t&&new google.maps.places.PlacesService(this.mapCtrl).nearbySearch({location:this.mapCtrl.getCenter(),radius:"30000",keyword:t},(e,t)=>this.getStopByLocation(e,t,i))}},async onNumberOfStopsChange(){var e=Number(this.numberOfStops),e=(this.numberOfStops=Number.isFinite(e)&&0<e?Math.min(Math.floor(e),15):3,this.pinMarker&&"function"==typeof this.pinMarker.getPosition&&this.pinMarker.getPosition()),t=this.startSearchRequest();e?(e=this.pinMarker.getPosition(),await this.getStopByLatLong(e.lat(),e.lng(),t)):this.stopId&&await this.getStopById(this.stopId,t)},async getStopById(e,t=this.activeSearchRequest){var i,r;await this.ensureStopIndex(),this.isSearchRequestActive(t)&&(this.clearMapOverlays({clearPin:!0}),i=(r=(r=u.stopIndex[String(e)])?[r]:[]).filter(e=>this.hasActiveServiceForStop(e.StopId)),console.log("[stops-departures] getStopById result:",{id:e,count:i.length,stopList:i}),0===i.length?(this.noStopResultsMessage=0<r.length?"This stop has no active service right now.":"No active stops were found for this location. Service may not be running right now.",this.showLoading=!1):(r=i.map(e=>({...e,departures:[],loadingDepartures:!1,showDepartures:!1})),this.isSearchRequestActive(t)&&(this.processPoints(r,t),this.stops=r,await this.getNextDepartures(e),this.showLoading=!1)))},getStopByLocation(e,t,i=this.activeSearchRequest){this.isSearchRequestActive(i)&&(t==google.maps.places.PlacesServiceStatus.OK?(this.location=e[0].name,this.getStopByLatLong(e[0].geometry.location.lat(),e[0].geometry.location.lng(),i)):this.noStopResultsMessage="No active stops were found for this location. Service may not be running right now.")},async getStopByLatLong(e,t,i=this.activeSearchRequest){this.isSearchRequestActive(i)&&(console.log("[stops-departures] getStopByLatLong request:",{lat:e,long:t,numberOfStops:this.numberOfStops}),this.showLoading=!0,this.clearMapOverlays({clearPin:!0}),this.pinMarker=new google.maps.Marker({position:{lat:e,lng:t},map:this.mapCtrl}),await this.ensureStopIndex(),this.isSearchRequestActive(i))&&(e=this.findNearestActiveStops(e,t,this.numberOfStops),console.log("[stops-departures] nearest stops result:",{count:e.length,stops:e}),0===e.length?(this.noStopResultsMessage="No active stops were found for this location. Service may not be running right now.",this.showLoading=!1):this.isSearchRequestActive(i)&&(this.processPoints(e,i),this.stops=e,this.showLoading=!1))},findNearestActiveStops(t,i,e){var e=Math.max(1,Number(e)||3),r=(this.ensureActiveStopIdsCache(),u.activeStopIdsCache.set),a=[],o=u.stopList;for(let e=0;e<o.length;e+=1){var s=o[e];r&&!r.has(String(s.StopId))||a.push({stop:s,d:this.calculateDistanceMeters(t,i,Number(s.Latitude||0),Number(s.Longitude||0))})}return a.sort((e,t)=>e.d-t.d),a.slice(0,e).map(({stop:e})=>({...e,departures:[],loadingDepartures:!1,showDepartures:!1}))},async processPoints(t,i=this.activeSearchRequest){if(this.isSearchRequestActive(i)&&(this.clearMapOverlays({clearPin:!1}),this.isSearchRequestActive(i))){this.mapCtrl.setCenter(new google.maps.LatLng(t[0].Latitude,t[0].Longitude)),this.mapCtrl.setZoom(15);for(let e=0;e<t.length;e++){if(!this.isSearchRequestActive(i))return;var r=this.buildMarkerHTMLForStop(t[e]),a=new google.maps.LatLng(t[e].Latitude,t[e].Longitude),r=new google.maps.InfoWindow({content:r}),a=new google.maps.Marker({position:a,icon:this.buildStopMarkerIcon(),draggable:!1,map:this.mapCtrl,stopId:t[e].StopId,infoWindow:r});google.maps.event.addListener(a,"click",(e=>()=>{this.onStopSelect(e.stopId,!1)})(a)),this.stopMarkers.push(a)}}},onStopSelect(e,t=!0){let i=String(e||"");i&&(e=String(this.selectedStopId||"")===i,t&&e?(this.selectedStopId=0,this.stops.forEach(e=>{e.showDepartures=!1,e.loadingDepartures=!1}),this.stopMarkers.forEach(e=>{e.infoWindow&&e.infoWindow.close()})):(this.selectedStopId=i,this.stops.forEach(e=>{e.showDepartures=String(e.StopId)===i,e.showDepartures||(e.loadingDepartures=!1)}),this.openStopInfoWindow(i)))},buildMarkerHTMLForStop(e){var t=this.buildAmenitiesHTML(e,"infowindow");let r="";if(r=(r+='<div class="map-popup"><div class="map-popup__wrap">')+('<div class="text-center"><h6 class="map-popup__title"><span class="icon-left icon-stop-icon"></span>#'+e.StopId+"</h6></div>"),e.AmenitiesString&&(r+='<div class="map-popup__subtitle body-style-b1">Amenities</div><div class="body-style-b2 Add-text">'+e.AmenitiesString+"</div>"),r+=t,e.Routes&&0<e.Routes.length){let i=[];
233e.Routes.forEach(function(t){0===i.filter(function(e){return e.RouteId==t.RouteId}).length&&i.push(t)}),i=i.sort((e,t)=>+e.RouteId>+t.RouteId?1:-1),r=r+('<div class="map-popup__subtitle bot-top body-style-b1">'+i.length+" route(s) on this stop:</div>")+'<ul class="map-popup__list">';for(let e=0;e<i.length;e++){var a=encodeURIComponent(String(i[e].RouteId||"").trim());r+="<li><a href='/node/503#route="+a+"' target='_blank'><span class='body-style-b2'>"+i[e].Name+" - "+i[e].RouteFullName+"</span></a></li>"}r+="</ul>"}return e.HasImage&&(r+='<img class="map-popup__thumbnail" src="'+e.StopImage+'"/>'),r+="</div></div>"},buildAmenitiesHTML(e,t=0){return""},buildAmenityIcon(e,t){var i="#003DA6",r='width="18" height="18" viewBox="0 0 24 24" aria-hidden="true" focusable="false"';return"wheelchair"===e?`<span class="stop-amenity-icon-wrap"><svg class="stop-amenity-icon" ${r} xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="5" r="2" fill="${i}"/><path fill="${i}" d="M10.2 8.1h3.5c.6 0 1 .4 1 1v3.1h-1.6v-2.3h-1l-.2 2.3 2.3 2.8-1.3 1-2.6-3.1h-1.6c-.5 0-1-.4-1-.9V9.3c0-.7.5-1.2 1.1-1.2z"/><path fill="${i}" d="M11.2 14.6a4.4 4.4 0 1 0 4.3 5.2h-1.7a2.8 2.8 0 1 1-2.6-3.6z"/></svg></span>`:"bicycle"===e?`<span class="stop-amenity-icon-wrap"><svg class="stop-amenity-icon" ${r} xmlns="http://www.w3.org/2000/svg"><circle cx="6" cy="17" r="3" fill="none" stroke="${i}" stroke-width="2"/><circle cx="18" cy="17" r="3" fill="none" stroke="${i}" stroke-width="2"/><path d="M6 17l4-7h3l2 3h3" fill="none" stroke="${i}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 10l2 7" fill="none" stroke="${i}" stroke-width="2" stroke-linecap="round"/></svg></span>`:`<span class="stop-amenity-icon-wrap"><svg class="stop-amenity-icon" ${r} xmlns="http://www.w3.org/2000/svg"><path fill="${i}" d="M4 11h16v9H4z"/><path fill="${i}" d="M7 7h10v4H7z"/><rect x="9" y="14" width="2" height="2" fill="#fff"/><rect x="13" y="14" width="2" height="2" fill="#fff"/></svg></span>`},getAmenityStatuses(e){return[{type:"wheelchair",label:"Wheelchair",available:this.resolveAmenityAvailability(e,{explicitKeys:["Wheelchair","WheelChair","WheelchairAccessible","wheelchair","wheelchair_accessible","wc","wa"],positive:[/wheelchair accessible/i,/\bwheelchair\b/i],negative:[/no wheelchair/i,/wheelchair not available/i,/not wheelchair accessible/i]})},{type:"bicycle",label:"Bicycle",available:this.resolveAmenityAvailability(e,{explicitKeys:["Bicycle","Bike","BikesAllowed","bicycle","bike","bicycle_allowed","bikes_allowed","ba"],positive:[/bicycle allowed/i,/bike allowed/i,/\bbicycle\b/i,/\bbike\b/i],negative:[/no bicycle/i,/bicycle not allowed/i,/bike not allowed/i]})},{type:"parking",label:"Parking",available:this.resolveAmenityAvailability(e,{explicitKeys:["Parking","ParkAndRide","parking","parking_available","park_and_ride","pr"],positive:[/parking available/i,/park and ride/i,/\bparking\b/i],negative:[/no parking/i,/parking not available/i]})}]},resolveAmenityAvailability(t,e){var i=Array.isArray(e.explicitKeys)?e.explicitKeys:[];for(let e=0;e<i.length;e++)if(Object.prototype.hasOwnProperty.call(t,i[e])){var r=this.parseBooleanLike(t[i[e]]);if(null!==r)return r}var a=String(t.AmenitiesString||"");if(a){var o=Array.isArray(e.negative)?e.negative:[];for(let e=0;e<o.length;e++)if(o[e].test(a))return!1;var s=Array.isArray(e.positive)?e.positive:[];for(let e=0;e<s.length;e++)if(s[e].test(a))return!0}return!1},parseBooleanLike(e){if("boolean"==typeof e)return e;if("number"==typeof e)return 1===e||0!==e&&null;if("string"==typeof e){e=e.trim().toLowerCase();if(["1","yes","y","true","available","allowed"].includes(e))return!0;if(["0","no","n","false","not available","not allowed"].includes(e))return!1}return null},escapeHtml(e){if("string"!=typeof e)return String(e??"");let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,e=>t[e])},openStopInfoWindow(t){console.log("[stops-departures] openStopInfoWindow stopId:",t),window.innerWidth<600&&(this.mapPanelOpen=!1),this.routePath&&this.routePath.setMap(null),this.mapCtrl.setZoom(15),this.busMarkers.forEac
233h(e=>{e.infoWindow&&e.infoWindow.close()}),this.stopMarkers.forEach(e=>{e.infoWindow&&e.infoWindow.close(),e.stopId==t&&(e.infoWindow.open(this.mapCtrl,e),this.mapCtrl.setCenter(e.position))}),this.getNextDepartures(t)},async getNextDepartures(t){console.log("[stops-departures] getNextDepartures request stopId:",t);var e=this.stops.find(e=>e.StopId==t),i=e&&Array.isArray(e.departures)&&0<e.departures.length&&!e.loadingDepartures;if(this.currentDeparturesStopId==t&&i)e.showDepartures=!0;else{this.currentDeparturesStopId=t,this.loadingDepartures=!0,console.log("[stops-departures] matched stop object:",e),e&&(e.loadingDepartures=!0,e.departures=[]),this.noTimesFoundMessage="",this.departures=[],this.buses=[];for(let e=0,t=this.busMarkers.length;e<t;e++)this.busMarkers[e].setMap(null);this.busMarkers=[];i=await this.buildDeparturesForStop(t);console.log("[stops-departures] departures result:",i),e&&(e.departures=i,e.loadingDepartures=!1,0<i.length)&&(e.showDepartures=!0),this.departures=i,this.loadingDepartures=!1,0==i.length&&(this.noTimesFoundMessage="No Times Found"),this.loadingDepartures=!1}},async buildDeparturesForStop(e){await this.ensureStopIndex();var t=u.departuresByStop[String(e)]||[],i=(console.log("[stops-departures] raw events for stop:",e,t),this.getCurrentServiceMinutes()),r=[],a=new Set;for(let e=0;e<t.length;e++){var o=t[e];if(o&&!(o.length<4)){var s=o[0];if("number"==typeof s){var n=o[1],l=o[2],o=o[3];if(this.isTripActiveToday(l)){s=(s%1440+1440)%1440;let e=s-i;e<0&&(e+=1440);var d=u.routesShortNames[n]||"",d=this.normalizeRouteShortName(d),n=u.routesLongNames[n]||"",l=u.trips[l]||"",o=u.headsigns[o]||"",o=this.normalizeHeadsign(o),c=s+`|${d}|`+o.toLowerCase();a.has(c)||(a.add(c),r.push({RouteId:d,RouteName:n,DirectionNoRoute:o,TimeType:"Departs",Time:this.formatMinutes(s),TripId:l,departure_time:this.formatMinutesHHMMSS(s),Bus:{vehicle:{label:String(l||"")}},_minuteDelta:e,_depDayMinute:s}))}}}}return r.sort((e,t)=>e._minuteDelta!==t._minuteDelta?e._minuteDelta-t._minuteDelta:e._depDayMinute-t._depDayMinute),r.slice(0,12).map(e=>(delete e._minuteDelta,delete e._depDayMinute,e))},getCurrentServiceMinutes(){var t=new Date;try{var e=new Intl.DateTimeFormat("en-US",{timeZone:"America/Detroit",hour12:!1,hour:"2-digit",minute:"2-digit"}).formatToParts(t);return 60*Number(e.find(e=>"hour"===e.type)?.value||0)+Number(e.find(e=>"minute"===e.type)?.value||0)}catch(e){return 60*t.getHours()+t.getMinutes()}},timeToMinutes(e){return e&&"string"==typeof e?60*((e=e.split(":").map(Number))[0]||0)+(e[1]||0):Number.MAX_SAFE_INTEGER},formatTime(e){var t,i;return e&&"string"==typeof e?(t=12<=(i=(e=e.split(":").map(Number))[0]||0)?"PM":"AM",`${i=i%12||12}:${String(e[1]||0).padStart(2,"0")} `+t):""},formatMinutes(e){var t,i;return"number"!=typeof e?"":(e=e,t=12<=(i=(Math.floor(e/60)%24+24)%24)?"PM":"AM",`${i=0==(i=i%12)?12:i}:${String(e%60).padStart(2,"0")} `+t)},formatMinutesHHMMSS(e){var t;return"number"!=typeof e?"":(e=e,t=(Math.floor(e/60)%24+24)%24,e=e%60,`${String(t).padStart(2,"0")}:${String(e).padStart(2,"0")}:00`)},normalizeRouteShortName(e){e=String(e||"").trim();return e?/^\d+$/.test(e)?String(Number(e)):e:""},formatRouteIdForDisplay(e){e=String(e??"").trim();return e?/^\d+$/.test(e)?String(parseInt(e,10)).padStart(2,"0"):e:""},normalizeHeadsign(e){e=String(e||"").replace(/\s+/g," ").trim();if(!e)return"";let t=e.replace(/^to\s+\d+\s*-\s*/i,"To ");var e=t.match(/\((outbound|inbound)\)\s*$/i),i=e?` (${e[1][0].toUpperCase()}${e[1].slice(1).toLowerCase()})`:"";return e&&(t=t.slice(0,e.index).trim()),((/^to\s+/i.test(t)?t:"To "+t).replace(/\b([a-z])/gi,e=>e.toUpperCase())+i).trim()},getDetroitServiceDateInfo(){var t=new Date;try{var i=new Intl.DateTimeFormat("en-US",{timeZone:"America/Detroit",year:"numeric",month:"2-digit",day:"2-digit",weekday:"short"}).formatToParts(t);return{yyyymmdd:""+(i.find(e=>"year"===e.type)?.value||"1970")+(i.find(e=>"month"===e.type)?.value||"01")+(i.find(e=>"day"===e.type)?.value||"01"),weekdayIdx:{Mon:0,Tue:1,Wed:2,Thu:3,Fri:4,Sat:5,Sun:6}[(i.find(e=>"weekday"===e.type)?.value||"Mon").slice(0,3)]??0}}catch(e){i=(t.getDay()+6)%7;return{yyyymmdd:""+t.getFullYear()+String(t.getMonth()+1).padStart(2,"0")+String(t.getDate()).padStart(2,"0"),weekdayIdx:i}}},getActiveServiceSetForToday(){let{yyyymmdd:a,weekdayIdx:o}=this.getDetroitServiceDateInfo();if(u.activeServicesCache.date===a&&u.activeServicesCache.set)return u.activeServicesCache.set;let s=new Set;var e=u.serviceCalendars||{},e=(Object.entries(e).forEach(([e,t])=>{var i,r;!Array.isArray(t)||t.length<9||(i=1===Number(t[o]||0),r=String(t[7]||""),t=String(t[8]||""),r=(!r||a>=r)&&(!t||a<=t),i&&r&&s.add(String(e)))}),(u.calendarDateExceptions||{})[a]);
233return e&&Array.isArray(e.r)&&e.r.forEach(e=>s.delete(String(e))),e&&Array.isArray(e.a)&&e.a.forEach(e=>s.add(String(e))),u.activeServicesCache={date:a,set:s},u.activeStopIdsCache={date:"",set:null},s},isTripActiveToday(e){var t,e=Number(e);return!Number.isFinite(e)||e<0||!(e=(u.tripServiceByIdx||[])[e])||!(t=this.getActiveServiceSetForToday())||0===t.size||t.has(String(e))},ensureActiveStopIdsCache(){var e=this.getDetroitServiceDateInfo().yyyymmdd;if(u.activeStopIdsCache.date===e&&u.activeStopIdsCache.set)return u.activeStopIdsCache.set;let a=this.getActiveServiceSetForToday(),o=new Set,s=u.tripServiceByIdx||[],n=!a||0===a.size,l=u.departuresByStop||{};return Object.keys(l).forEach(t=>{var i=l[t];if(Array.isArray(i)&&0!==i.length)if(n)o.add(String(t));else for(let e=0;e<i.length;e+=1){var r=i[e];if(Array.isArray(r)&&!(r.length<4)){r=s[r[2]];if(!r||a.has(String(r)))return void o.add(String(t))}}}),u.activeStopIdsCache={date:e,set:o},o},hasActiveServiceForStop(e){return this.ensureActiveStopIdsCache().has(String(e))},processBuses(t){for(let e=0;e<t.length;e++){var i=this.buildMarkerHTMLForBus(t[e]),r=new google.maps.LatLng(t[e].position.latitude,t[e].position.longitude),a=new google.maps.InfoWindow({content:i}),r=new google.maps.Marker({position:r,icon:this.buildBusMarkerIcon(),draggable:!1,map:this.mapCtrl,html:i,busId:t[e].vehicle.label,infoWindow:a});google.maps.event.addListener(r,"click",(e=>()=>{this.openBusInfoWindow(e.busId)})(r)),this.busMarkers.push(r)}},buildMarkerHTMLForBus(t){var e=this.departures.filter(e=>e.Bus.vehicle.label==t.vehicle.label)[0],i="";return i+'<div class="map-popup"><div class="map-popup__wrap">'+('<h6 class="map-popup__title"><span class="icon-bus"></span> Bus #'+t.vehicle.label+"</h6>")+('<div><span class="depart-label">Route: # '+e.RouteId+"</span>"+e.DirectionNoRoute+"</div>")+('<div><span class="depart-label">'+e.TimeType+"</span>"+e.Time+"</div>")+"</div></div>"},buildStopMarkerIcon(){return{url:"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(` 234<svg xmlns="http://www.w3.org/2000/svg" width="44" height="56" viewBox="0 0 44 56" fill="none"> 235 <path d="M22 54C22 54 40 35.8 40 22C40 11.5 31.6 3 22 3C12.4 3 4 11.5 4 22C4 35.8 22 54 22 54Z" fill="#90118D" stroke="#FFFFFF" stroke-width="2"/> 236 <circle cx="22" cy="22" r="8.5" fill="#FFFFFF"/> 237 <path d="M18.7 21.8C18.7 20 20.1 18.6 21.9 18.6H22.1C23.9 18.6 25.3 20 25.3 21.8V24.8H18.7V21.8Z" fill="#003DA6"/> 238 <circle cx="20.3" cy="25.8" r="1.2" fill="#003DA6"/> 239 <circle cx="23.7" cy="25.8" r="1.2" fill="#003DA6"/> 240</svg>`),scaledSize:new google.maps.Size(44,56),anchor:new google.maps.Point(22,54)}},buildBusMarkerIcon(){return{url:"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(` 241<svg xmlns="http://www.w3.org/2000/svg" width="60" height="34" viewBox="0 0 60 34" fill="none"> 242 <rect x="2" y="4" width="56" height="24" rx="7" fill="#003DA6" stroke="#FFFFFF" stroke-width="2"/> 243 <rect x="7" y="9" width="20" height="8" rx="2" fill="#FFFFFF" fill-opacity="0.95"/> 244 <rect x="31" y="9" width="22" height="8" rx="2" fill="#FFFFFF" fill-opacity="0.95"/> 245 <circle cx="17" cy="27.5" r="3.5" fill="#90118D" stroke="#FFFFFF" stroke-width="1.5"/> 246 <circle cx="43" cy="27.5" r="3.5" fill="#90118D" stroke="#FFFFFF" stroke-width="1.5"/> 247</svg>`),scaledSize:new google.maps.Size(60,34),anchor:new google.maps.Point(30,30)}},openBusInfoWindow(i){window.innerWidth<600&&(this.mapPanelOpen=!1),this.mapCtrl.setZoom(13),this.stopMarkers.forEach(e=>{e.infoWindow&&e.infoWindow.close()}),this.busMarkers.forEach(t=>{var e;t.infoWindow&&t.infoWindow.close(),t.busId==i&&(t.infoWindow.open(this.mapCtrl,t),this.mapCtrl.setCenter(t.position),e=this.departures.filter(e=>e.Bus.vehicle.label==t.busId)[0].TripId,this.mapRoute(e))})},async mapRoute(t){var e=this.departures.find(e=>String(e.TripId)===String(t)),e=e?String(e.RouteId||""):"";e&&null!=(e=u.routeShortNameToIdx[e])&&(e=u.routePathsByIdx[e]||[],Array.isArray(e))&&0!==e.length&&(e=e.filter(e=>Array.isArray(e)&&2<=e.length).map(e=>({lat:Number(e[0]),lng:Number(e[1])}))).length&&(e=new google.maps.Polyline({path:e,strokeColor:"#003DA6",strokeOpacity:1,strokeWeight:4,map:this.mapCtrl}),this.routePath&&this.routePath.setMap(null),this.routePath=e)},clearData(){this.clearMapOverlays({clearPin:!0}),this.stops=[],this.selectedStopId=0,this.noStopResultsMessage="",this.noTimesFoundMessage="",this.departures=[],this.buses=[],this.currentDeparturesStopId=0},async ensureStopIndex(){if(u.stopIndexReady&&u.stopList.length)this.offlineIndexReady=!0;else{await this.loadOfflineData();var e=u.offlineData;if(e&&e.stopsIndex){u.routesShortNames=e.routesShortNames||[],u.routesLongNames=e.routesLongNames||[],u.routePathsByIdx=e.routePaths||[],u.trips=e.trips||[],u.headsigns=e.headsigns||[],u.departuresByStop=e.departuresByStop||Object.create(null),u.tripServiceByIdx=e.tripServiceByIdx||[],u.serviceCalendars=e.serviceCalendars||Object.create(null),u.calendarDateExceptions=e.calendarDateExceptions||Object.create(null),u.routeShortNameToIdx=Object.create(null),(u.routesShortNames||[]).forEac
247h((e,t)=>{var e=String(e||"").trim(),i=this.normalizeRouteShortName(e);e&&(u.routeShortNameToIdx[e]=t),i&&(u.routeShortNameToIdx[i]=t)});e=e.stopsIndex||{};let s=Object.create(null),n=[];Object.entries(e).forEach(([e,t])=>{var i=Array.isArray(t.r)?t.r:[],r=[];for(let e=0;e<i.length;e+=1){var a=i[e],o=u.routesShortNames[a];o&&r.push({RouteId:o,Name:o,RouteFullName:u.routesLongNames[a]||""})}t={StopId:e,Latitude:t.la,Longitude:t.lo,Name:t.n,stop_name:t.n,Routes:r,Wheelchair:t.Wheelchair??t.wc??!1,Bicycle:t.Bicycle??t.ba??!1,Parking:t.Parking??t.pr??!1,AmenityHtml:"",departures:[],loadingDepartures:!1,showDepartures:!1};s[e]=t,n.push(t)}),u.stopIndex=s,u.stopList=n,u.activeStopIdsCache={date:"",set:null},this.ensureActiveStopIdsCache(),u.stopIndexReady=!0,this.offlineIndexReady=!0,console.log("[stops-departures] stopIndex ready:",{stopCount:n.length,activeStopCount:u.activeStopIdsCache.set?u.activeStopIdsCache.set.size:0,routeCount:u.routesShortNames.length,tripCount:u.trips.length,headsignCount:u.headsigns.length})}}},async loadOfflineData(){return u.offlineLoaded?u.offlineData:(u.offlineLoading||(u.offlineLoading=(async()=>{var e,t="undefined"!=typeof DecompressionStream&&"DecompressionStream"in window,i=t?"/themes/custom/cata/json/stops_departures_min.json.gz":"/themes/custom/cata/json/stops_departures_min.json",r=await fetch(i);if(r.ok)return i.endsWith(".gz")&&t?(t=await r.arrayBuffer(),e=new DecompressionStream("gzip"),t=new Blob([t]).stream().pipeThrough(e),e=await new Response(t).text(),u.offlineData=JSON.parse(e)):u.offlineData=await r.json(),u.offlineLoaded=!0,console.log("[stops-departures] offline data loaded:",{keys:Object.keys(u.offlineData||{}),stopsIndexCount:Object.keys(u.offlineData?.stopsIndex||{}).length,departuresByStopCount:Object.keys(u.offlineData?.departuresByStop||{}).length}),u.offlineData;throw new Error("Failed to fetch offline data: "+i)})()),u.offlineLoading)},calculateDistanceMeters(e,t,i,r){var a=e=>e*Math.PI/180,o=a(i-e),r=a(r-t),t=Math.sin(o/2)*Math.sin(o/2)+Math.cos(a(e))*Math.cos(a(i))*Math.sin(r/2)*Math.sin(r/2);return 12742e3*Math.atan2(Math.sqrt(t),Math.sqrt(1-t))}}}function tripPlannerCataBusTransitModes(){return"undefined"!=typeof google&&google.maps?.TransitMode?.BUS?[google.maps.TransitMode.BUS]:["BUS"]}function tripPlannerMergeCataTransitOptions(e){return{...e||{},modes:tripPlannerCataBusTransitModes()}}function tripPlannerAgencyIsCata(e){var t=String(e?.name||"").trim(),e=String(e?.url||"").trim();return/capital area transportation/i.test(t)||/\bcata\b/i.test(t)||/cata\.org/i.test(e)}function tripPlannerTransitStepIsCataBus(e){return!e||"TRANSIT"!==e.travel_mode||!e.transit||!(!(e=e.transit.line)?.vehicle||"BUS"!==e.vehicle.type)&&(e=e.agencies,!Array.isArray(e)||!e.length||e.some(tripPlannerAgencyIsCata))}function tripPlannerRouteIsCataBusOnly(e){var t=e?.legs;if(!Array.isArray(t)||!t.length)return!1;for(let e=0;e<t.length;e+=1){var i=t[e]?.steps||[];for(let e=0;e<i.length;e+=1){var r=i[e];if("TRANSIT"===r.travel_mode&&!tripPlannerTransitStepIsCataBus(r))return!1}}return!0}function tripPlannerFilterDirectionsForCataBuses(e){var t;return!e?.routes?.length||(t=e.routes.filter(tripPlannerRouteIsCataBusOnly)).length===e.routes.length?e:{...e,routes:t}}function tripPlannerStripHtml(e){var t;return e?("undefined"!=typeof document?((t=document.createElement("div")).innerHTML=String(e),t.textContent||t.innerText||""):String(e).replace(/<[^>]+>/g," ")).replace(/\s+/g," ").trim():""}function tripPlannerWalkingEndLabel(e){var e=tripPlannerStripHtml(e),t=e.match(/\bto\s+(.+)$/i);return t?t[1].trim():e}function tripPlannerBuildStepStopLabels(e,t,i,r){var a=0<i?t[i-1]:null,o=i<t.length-1?t[i+1]:null;let s="",n="";return"TRANSIT"===e.travel_mode&&e.transit?(s=e.transit.departure_stop?.name||"",n=e.transit.arrival_stop?.name||""):"WALKING"===e.travel_mode&&(s="TRANSIT"===a?.travel_mode&&a.transit?.arrival_stop?.name?a.transit.arrival_stop.name:0===i?r.start_address||tripPlannerWalkingEndLabel(e.instructions):"WALKING"===a?.travel_mode?tripPlannerWalkingEndLabel(a.instructions):tripPlannerWalkingEndLabel(e.instructions),n="TRANSIT"===o?.travel_mode&&o.transit?.departure_stop?.name?o.transit.departure_stop.name:i===t.length-1&&r.end_address||tripPlannerWalkingEndLabel(e.instructions)),{departureStopLabel:s,arrivalStopLabel:n}}function tripPlannerStopLabelsMatch(e,t){e=String(e||"").trim().toLowerCase(),t=String(t||"").trim().toLowerCase();return 0<e.length&&e===t}function tripPlannerCollapseTransferStops(t){if(Array.isArray(t)&&t.length){t.forEach(e
247=>{e.hideStart=!1,e.hasTransferWait=!1,e.transferDepartureTime=""});for(let e=0;e<t.length-1;e+=1){var i=t[e],r=t[e+1];tripPlannerStopLabelsMatch(i.arrivalStopLabel,r.departureStopLabel)&&(i.hasTransferWait=!0,i.transferDepartureTime=r.departure||"",r.hideStart=!0)}}return t}function tripPlannerApp(){return{ensureSafariDialogCompat(){function e(){}void 0===window.HTMLDialogElement&&((e.prototype=window.HTMLElement&&window.HTMLElement.prototype||{}).show||(e.prototype.show=function(){}),e.prototype.showModal||(e.prototype.showModal=function(){}),e.prototype.close||(e.prototype.close=function(){}),window.HTMLDialogElement=e)},mapCtrl:null,directionsService:null,directionsDisplay:null,currentPosition:{},startLocation:"",endLocation:"",departOrArival:"Depart",routeOptions:"",mapPanelOpen:!0,adaSearchTried:!1,showLoading:!1,showGeoMessage:!1,showCtrlScrollMessage:!1,ctrlScrollMessageTimeout:null,ctrlScrollHintText:"Use Ctrl + scroll to zoom the map",startAutoComplete:null,endAutoComplete:null,placeService:null,date:"",time:"",timeUserEdited:!1,timeRequired:!1,tripOnDifferentDate:!1,tripOnDifferentDateMessage:"",noTripsFound:!1,noTripsFoundMessage:"No Trips Found",noTripsFound2:!1,wheelChair:!1,routes:[],backButton:!1,proxyApi:"https://www.cata.org/DesktopModules/Cata.Endpoint/GTFSProxy.ashx?method=",lastDirectionsResponse:null,tripLegMarker:null,tripLegInfoWindow:null,directionsRequestSeq:0,get minDate(){return""},syncDateInputBounds(e=null){e=e||("undefined"!=typeof document?document.getElementById("select-trip-date"):null);e&&(e.removeAttribute("min"),e.removeAttribute("max"))},get maxDate(){return""},async init(){this.ensureSafariDialogCompat();var{}=await google.maps.importLibrary("maps"),{}=await google.maps.importLibrary("places"),e=("function"==typeof window.cataMapsTouchPrimaryZoom&&window.cataMapsTouchPrimaryZoom(),{gestureHandling:"cooperative",center:new google.maps.LatLng(42.73386,-84.555363),zoom:12,scrollwheel:!1,disableDefaultUI:!0,zoomControl:!0,zoomControlOptions:{position:google.maps.ControlPosition.RIGHT_CENTER}}),t=document.getElementById("map");this.mapCtrl=new google.maps.Map(document.getElementById("map"),e),this.ensureCtrlScrollHintElement(t),t&&t.addEventListener("wheel",e=>{e.ctrlKey?(this.mapCtrl.setOptions({scrollwheel:!0}),this.toggleCtrlScrollHint(!1),this.ctrlScrollMessageTimeout&&(clearTimeout(this.ctrlScrollMessageTimeout),this.ctrlScrollMessageTimeout=null)):(this.mapCtrl.setOptions({scrollwheel:!1}),this.toggleCtrlScrollHint(!0),this.ctrlScrollMessageTimeout&&clearTimeout(this.ctrlScrollMessageTimeout),this.ctrlScrollMessageTimeout=setTimeout(()=>{this.toggleCtrlScrollHint(!1),this.ctrlScrollMessageTimeout=null},2500))},{passive:!0}),this.directionsService=new google.maps.DirectionsService,this.directionsDisplay=new google.maps.DirectionsRenderer,this.directionsDisplay.setMap(this.mapCtrl),this.initializeControls(),this.readHashParams(),this.date||this.setTodaysDate(),this.loadTripFormFromLocalStorage(),this.ensureDefaultTime(),this.syncDateInputBounds()},ensureCtrlScrollHintElement(e){var t,i;e&&"1"!==e.dataset.ctrlScrollHintAttached&&((t=document.createElement("div")).className="ctrl-scroll-hint",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.style.position="absolute",t.style.bottom="12px",t.style.left="12px",t.style.padding="8px 12px",t.style.background="rgba(17, 24, 39, 0.88)",t.style.color="#fff",t.style.fontSize="13px",t.style.borderRadius="6px",t.style.zIndex="10",t.style.display="none",t.textContent=this.ctrlScrollHintText,i=e.parentElement)&&(i.style.position||(i.style.position="relative"),i.appendChild(t),e.dataset.ctrlScrollHintAttached="1",e._ctrlScrollHintEl=t)},toggleCtrlScrollHint(e){this.showCtrlScrollMessage=Boolean(e);e=document.getElementById("map"),e=e&&e._ctrlScrollHintEl?e._ctrlScrollHintEl:null;e&&(e.style.display=this.showCtrlScrollMessage?"block":"none")},toggleMapPanel(){this.mapPanelOpen=!this.mapPanelOpen},readHashParams(){var e,t,i=window.location.hash.substring(1),i=new URLSearchParams(i);i.get("start")&&i.get("end")?(this.showLoading=!0,e=document.getElementById("start"),t=document.getElementById("end"),e&&(e.value=i.get("start")),t&&(t.value=i.get("end")),"true"===i.get("startIsPlace")&&(this.startLocation={place_id:i.get("startId")}
247),"true"===i.get("endIsPlace")&&(this.endLocation={place_id:i.get("endId")}),i.get("date")?(this.date=this.normalizeDateToIso(i.get("date")),(e=document.getElementById("select-trip-date"))&&(e.value=this.date)):this.setTodaysDate(),i.get("time")&&(t=i.get("time"),this.time=this.normalizeTimeString(t),this.timeUserEdited=!0,e=document.getElementById("transitTime"))&&(e.value=this.time),i.get("departOrArival")&&(this.departOrArival=i.get("departOrArival")),this.planTrip()):i.get("date")?(this.date=this.normalizeDateToIso(i.get("date")),(t=document.getElementById("select-trip-date"))&&(t.value=this.date)):this.setTodaysDate()},updateHashParams(){var e=new URLSearchParams;e.set("start",document.getElementById("start").value||""),e.set("end",document.getElementById("end").value||""),e.set("startIsPlace",this.startLocation.place_id?"true":"false"),e.set("endIsPlace",this.endLocation.place_id?"true":"false"),e.set("startId",this.startLocation.place_id||""),e.set("endId",this.endLocation.place_id||""),e.set("date",this.date||""),e.set("time",this.time||""),e.set("departOrArival",this.departOrArival||""),window.location.hash=e.toString()},setTodaysDate(){this.date=this.getDetroitTodayIso()},getDetroitNowParts(){let e=new Intl.DateTimeFormat("en-US",{timeZone:"America/Detroit",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date);var t=t=>Number(e.find(e=>e.type===t)?.value||0);return{year:t("year"),month:t("month"),day:t("day"),hour:t("hour"),minute:t("minute")}},getDetroitTodayIso(){var e=this.getDetroitNowParts();return`${String(e.year).padStart(4,"0")}-${String(e.month).padStart(2,"0")}-`+String(e.day).padStart(2,"0")},getTimeZoneOffsetMinutes(e,t){e=(new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"}).formatToParts(t).find(e=>"timeZoneName"===e.type)?.value||"GMT").match(/^GMT([+-])(\d{1,2})(?::?(\d{2}))?$/i);return e?("-"===e[1]?-1:1)*(60*(parseInt(e[2],10)||0)+(parseInt(e[3]||"0",10)||0)):0},detroitDateTimeToDate(e,t,i,r,a){e=new Date(Date.UTC(e,t-1,i,r,a,0,0)),t=this.getTimeZoneOffsetMinutes("America/Detroit",e);return new Date(e.getTime()-60*t*1e3)},getCurrentTimeHHMM(){var e=this.getDetroitNowParts();return String(e.hour).padStart(2,"0")+":"+String(e.minute).padStart(2,"0")},ensureDefaultTime(){var e,t;this.time&&""!==String(this.time).trim()||(e=this.getCurrentTimeHHMM(),this.time=e,(t=document.getElementById("transitTime"))&&(t.value=e))},markTimeUserEdited(){this.timeUserEdited=!0},isDepartMode(){return"arrive"!==String(this.departOrArival).trim().toLowerCase()},syncDepartTimeBeforePlan(){var e,t=this.normalizeDateToIso(this.date)===this.getDetroitTodayIso();this.isDepartMode()&&t&&!this.timeUserEdited&&(t=this.getCurrentTimeHHMM(),this.time=t,e=document.getElementById("transitTime"))&&(e.value=t)},normalizeDateToIso(e){var t,i,r;return e?(r=(e=String(e).trim()).match(/^(\d{4})-(\d{2})-(\d{2})$/))?`${r[1]}-${r[2]}-`+r[3]:(r=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/))?(t=r[1].padStart(2,"0"),i=r[2].padStart(2,"0"),r[3]+`-${t}-`+i):(r=e.match(/^(\d{4})\/(\d{2})\/(\d{2})$/))?`${r[1]}-${r[2]}-`+r[3]:e:""},normalizeTimeString(e){var t;return e?(t=(e=String(e).trim()).match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i))?`${parseInt(t[1],10)}:${t[2]} `+t[3].toUpperCase():(t=e.match(/^(\d{1,2}):(\d{2})$/))?String(parseInt(t[1],10)).padStart(2,"0")+":"+t[2]:e:""},buildTransitDateTime(){if(!this.date||!this.time||""===this.date||""===this.time)return null;var e=this.normalizeDateToIso(this.date).match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!e)return null;var t=parseInt(e[1],10),i=parseInt(e[2],10),e=parseInt(e[3],10),r=String(this.time).trim();let a,o;var s=r.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);if(s){a=parseInt(s[1],10),o=parseInt(s[2],10);s=s[3].toUpperCase();"PM"===s&&12!==a&&(a+=12),"AM"===s&&12===a&&(a=0)}else{s=r.match(/^(\d{1,2}):(\d{2})$/);if(!s)return null;a=parseInt(s[1],10),o=parseInt(s[2],10)}r=this.detroitDateTimeToDate(t,i,e,a,o);return isNaN(r.getTime())?null:r},getRequestedTransitDateTime(){var e=this.buildTransitDateTime();return e||new Date},getDetroitNowDate(){var e=this.getDetroitNowParts();return this.detroitDateTimeToDate(e.year,e.month,e.day,e.hour,e.minute)},showNoTripsMessage(e){this.routes=[],this.noTripsFound2=!1,this.noTripsFound=!0,this.noTripsFoundMessage=`<strong>${e}</strong>`,this.lastDirectionsResponse=null,this.clearDirectionsRouteFromMap(),this.showLoading=!1},clearDirectionsRouteFromMap(){this.clearTripLegMapOverlay();try{this.directionsDisplay&&this.mapCtrl&&(this.directionsDisplay.setDirections({routes:[]}),this.directionsDisplay.setMap(this.mapCtrl))}catch(e){console.warn("[trip-planner] clearDirectionsRouteFromMap",e)}},formatStepTime(e,t=""){return e instanceof Date&&!isNaN(e.getTime())?this.formatDetroitTime(e):this.normalizeDisplayTimeText(t)}
247,formatDetroitTime(e){return e instanceof Date&&!isNaN(e.getTime())?(e=e.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/Detroit"}),this.normalizeDisplayTimeText(e)):""},normalizeDisplayTimeText(e){var t,e=String(e||"").trim();return e?(t=e.match(/^(\d{1,2}):(\d{2})\s*([AaPp][Mm])$/))?`${parseInt(t[1],10)}:${t[2]} `+t[3].toUpperCase():e:""},initializeControls(){new MutationObserver(e=>{document.querySelectorAll(".adp-placemark").forEach(e=>e.setAttribute("tabindex","0")),document.querySelectorAll("ol li").forEach(t=>{t.setAttribute("tabindex","0"),t.addEventListener("keydown",e=>{32==e.keyCode&&t.click()})}),document.querySelectorAll(".adp-directions tr").forEach(e=>e.setAttribute("tabindex","0"))}).observe(document.getElementById("directions-panel"),{childList:!0});new MutationObserver(e=>{document.querySelectorAll("img[src='https://maps.gstatic.com/mapfiles/api-3/images/mapcnt6.png']").forEach(e=>{e=e.parentElement;e&&e.setAttribute("tabindex","0")})}).observe(document.getElementById("map"),{childList:!0,attributes:!0,subtree:!0,attributeOldValue:!0,attributeFilter:["class","style"]}),this.placeService=new google.maps.places.PlacesService(this.mapCtrl);let S=new google.maps.places.AutocompleteService,b={bounds:new google.maps.LatLngBounds(new google.maps.LatLng(42.55149,-84.843212),new google.maps.LatLng(42.859113,-84.269351)),componentRestrictions:{country:"us"}},w=this;var e=(a,t)=>{let o=document.getElementById(a);if(!o)return;var e=o.closest(".select-container")||o.parentElement||document.body,i=a+"-places-listbox",r=a+"-places-status";let s=document.getElementById(i),n=(s||((s=document.createElement("div")).id=i,s.setAttribute("role","listbox"),s.setAttribute("aria-label","start"===a?"From address suggestions":"To address suggestions"),s.className="places-suggestions-listbox",s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="100%",s.style.zIndex="9999",s.style.background="#fff",s.style.border="1px solid #D0D5DD",s.style.borderTop="0",s.style.maxHeight="240px",s.style.overflowY="auto",s.style.display="none",e.style.position=e.style.position||"relative",e.appendChild(s)),document.getElementById(r)),l=(n||((n=document.createElement("div")).id=r,n.className="visually-hidden",n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),e.appendChild(n)),o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-controls",i),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-haspopup","listbox"),o.setAttribute("aria-describedby",[o.getAttribute("aria-describedby"),r].filter(Boolean).join(" ")),[]),d=-1,c=0,u=!1,h=()=>{l=[],d=-1,s.innerHTML="",s.style.display="none",o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant")},p=()=>{l.length&&(s.style.display="block",o.setAttribute("aria-expanded","true"))},m=()=>{s.innerHTML="",l.forEach((e,t)=>{var i=document.createElement("div");i.id=a+"-places-option-"+t,i.setAttribute("role","option"),i.setAttribute("aria-selected",t===d?"true":"false"),i.className="places-suggestion-option",i.style.padding="10px 12px",i.style.cursor="pointer",i.textContent=e.description||"",t===d&&(i.style.backgroundColor="#f2f4f7"),i.addEventListener("mousedown",e=>{e.preventDefault()}),i.addEventListener("click",()=>{f(t)}),s.appendChild(i)})},g=()=>{0<=d?(o.setAttribute("aria-activedescendant",a+"-places-option-"+d),(r=l[d])&&n&&(n.textContent=`${d+1} of ${l.length}: `+r.description)):(o.removeAttribute("aria-activedescendant"),l.length&&"none"!==s.style.display&&n&&(n.textContent=l.length+" suggestions available. Use Down Arrow to review."));var e,t,i,r=document.getElementById(a+"-places-option-"+d);r&&"none"!==s.style.display&&(r=(e=r.offsetTop)+r.offsetHeight,i=(t=s.scrollTop)+s.clientHeight,e<t&&(s.scrollTop=e),i<r)&&(s.scrollTop=r-s.clientHeight)},f=e=>{e=l[e];e&&(u=!0,o.value=e.description||o.value,t(e.place_id,e.description||""),n.textContent=`Selected: ${e.description||"location"}.`,h(),queueMicrotask(()=>{u=!1}))},v=null,y=()=>{var e=(o.value||"").trim();if(e.length<2)h();else{let i=++c;e=Object.assign({}
247,b,{input:e});google&&google.maps&&google.maps.places&&google.maps.places.AutocompleteSessionToken&&(e.sessionToken=new google.maps.places.AutocompleteSessionToken),S.getPlacePredictions(e,(e,t)=>{i===c&&(t===google.maps.places.PlacesServiceStatus.OK&&Array.isArray(e)&&(l=e.slice(0,8),d=-1,m(),l.length)?(n.textContent=l.length+" suggestions available. Use Down Arrow to review.",p):h)()})}};o.addEventListener("input",()=>{u?u=!1:("start"===a?w.startLocation={}:"end"===a&&(w.endLocation={}),clearTimeout(v),v=setTimeout(y,150))}),o.addEventListener("keydown",e=>{var t=e.key;return"ArrowDown"===t?l.length?(e.preventDefault(),p(),d=Math.min(l.length-1,d+1),m(),void g()):void y():"ArrowUp"===t?l.length?(e.preventDefault(),p(),d<=0?d=-1:d-=1,m(),void g()):void 0:void("Enter"===t?0<=d&&(e.preventDefault(),f(d)):"Escape"===t?"none"!==s.style.display&&(e.preventDefault(),h()):"Tab"===t&&h())}),o.addEventListener("blur",()=>{setTimeout(()=>h(),150)})};e("start",e=>{this.startLocation={place_id:e}}),e("end",e=>{this.endLocation={place_id:e}})},setStartFromAutoComplete(){this.startAutoComplete&&(this.startLocation=this.startAutoComplete.getPlace())},setEndFromAutoComplete(){this.endAutoComplete&&(this.endLocation=this.endAutoComplete.getPlace())},setStartFromCurrentLocation(e){this.startLocation=e,document.getElementById("start").value=e,this.startLocation={}},setEndFromCurrentLocation(e){this.endLocation=e,document.getElementById("end").value=e,this.endLocation={}},clearStartLocation(){this.startLocation={}},clearEndLocation(){this.endLocation={}},getCurrentPosition(r){navigator.geolocation?navigator.geolocation.getCurrentPosition(i=>{var e={query:(this.currentPosition=i).coords.latitude+", "+i.coords.longitude};this.placeService.textSearch(e,(e,t)=>{t==google.maps.places.PlacesServiceStatus.OK?r(e[0].formatted_address):r(i.coords.latitude+", "+i.coords.longitude)})},()=>{this.showLoading=!1,this.showGeoMessage=!0}):(this.showLoading=!1,this.showGeoMessage=!0)},validateTime(){var e,t;this.time&&""!==this.time?this.timeRequired=!1:(e=this.normalizeDateToIso(this.date),t=this.getDetroitTodayIso(),this.timeRequired=!(!e||e===t))},validateDateInput(){this.date&&this.syncDateInputBounds()},updateRouteOptions(){var e=document.getElementById("start"),t=document.getElementById("end");e&&t&&e.value&&t.value&&this.planTrip()},buildRoutesFromResponse(t){var i=[];for(let e=0;e<t.routes.length;e++){var r=t.routes[e];if(tripPlannerRouteIsCataBusOnly(r)){var a=r.legs[0];let t=a&&a.departure_time&&a.departure_time.value instanceof Date?new Date(a.departure_time.value.getTime()):this.getRequestedTransitDateTime();var o=[],s=a.steps;for(let e=0;e<s.length;e++){var n=s[e],l=Boolean("TRANSIT"===n.travel_mode&&n.transit&&n.transit.departure_time&&n.transit.departure_time.value instanceof Date&&n.transit.arrival_time&&n.transit.arrival_time.value instanceof Date),d=l?new Date(n.transit.departure_time.value.getTime()):new Date(t.getTime()),l=l?new Date(n.transit.arrival_time.value.getTime()):new Date(d.getTime()+1e3*n.duration.value),{departureStopLabel:c,arrivalStopLabel:u}=tripPlannerBuildStepStopLabels(n,s,e,a);o.push({travelMode:n.travel_mode,duration:n.duration.text,departure:this.formatStepTime(d,"TRANSIT"===n.travel_mode&&n.transit&&n.transit.departure_time?n.transit.departure_time.text:""),arrival:this.formatStepTime(l,"TRANSIT"===n.travel_mode&&n.transit&&n.transit.arrival_time?n.transit.arrival_time.text:""),distance:n.distance.text,description:n.instructions,departureStopLabel:c,arrivalStopLabel:u,departureStopName:c,arrivalStopName:u,transitType:("WALKING"===n.travel_mode?n.travel_mode:n.transit.line.vehicle.type).toLowerCase(),transitName:"TRANSIT"==n.travel_mode?n.transit.line.short_name:"",routeLineName:"TRANSIT"===n.travel_mode&&n.transit&&(n.transit.line?.name||n.transit.headsign)||"",busStops:"TRANSIT"==n.travel_mode&&n.transit&&n.transit.line?n.transit.num_stops:"",routeNumber:n.transit&&n.transit.line&&n.transit.line.vehicle&&"BUS"===n.transit.line.vehicle.type?n.transit.line.short_name:"",departureStopId:"TRANSIT"===n.travel_mode&&n.transit?.departure_stop?String(n.transit.departure_stop.stop_id||""):"",transitColor:"TRANSIT"==n.travel_mode?n.transit.line.color:"",index:e}),t=l}tripPlannerCollapseTransferStops(o);r={departureTime:this.formatStepTime(a?.departure_time?.value,a?.departure_time?.text||""),arrivalTime:this.formatStepTime(a?.arrival_time?.value,a?.arr
247ival_time?.text||""),totalTime:a.duration?a.duration.text:"",destination:a.end_address,destinationstart:a.start_address,steps:o,isActive:0===e,isOpen:!1,index:e};i.push(r)}}this.routes=i,this.noTripsFound2=0<i.length},planTrip(){if(!this.timeRequired){var e=document.getElementById("select-trip-date"),t=document.getElementById("transitTime");e&&(this.date?e.value=this.date:e.value&&(this.date=this.normalizeDateToIso(e.value))),t&&(this.time?t.value=this.time:t.value?this.time=this.normalizeTimeString(t.value):this.ensureDefaultTime()),this.syncDepartTimeBeforePlan();let i=document.getElementById("start").value,r=document.getElementById("end").value,a=(this.startLocation.place_id&&(i={placeId:this.startLocation.place_id}),this.endLocation.place_id&&(r={placeId:this.endLocation.place_id}),this.startLocation),o=this.endLocation;i.placeId&&r.placeId?(this.trackTrip(a,o),this.getDirections(i,r)):i.placeId?(e={location:new google.maps.LatLng(42.73386,-84.555363),radius:"50000",keyword:r},this.placeService.nearbySearch(e,(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&(r={placeId:e[0].place_id},o=e[0]),this.trackTrip(a,o),this.getDirections(i,r)})):(t={location:new google.maps.LatLng(42.73386,-84.555363),radius:"50000",keyword:i},this.placeService.nearbySearch(t,(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&(i={placeId:e[0].place_id},a=e[0]),r.placeId?(this.trackTrip(a,o),this.getDirections(i,r)):(t={location:new google.maps.LatLng(42.73386,-84.555363),radius:"50000",keyword:r},this.placeService.nearbySearch(t,(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&(r={placeId:e[0].place_id},o=e[0]),this.trackTrip(a,o),this.getDirections(i,r)}))}))}},getDirections(t,a){this.directionsRequestSeq+=1;let o=this.directionsRequestSeq;this.showLoading=!0,this.routes=[],this.noTripsFound=!1,this.noTripsFoundMessage="<strong>No Trips Found</strong>",this.noTripsFound2=!1,this.lastDirectionsResponse=null,this.clearDirectionsRouteFromMap();var i,t={origin:t,destination:a,travelMode:google.maps.TravelMode.TRANSIT,provideRouteAlternatives:!this.wheelChair};let s="arrive"===String(this.departOrArival).trim().toLowerCase(),n=this.getRequestedTransitDateTime(),l=this.getDetroitNowDate();if(this.timeUserEdited&&n instanceof Date&&!Number.isNaN(n.getTime())&&n.getTime()<l.getTime())this.showNoTripsMessage("The selected time has already passed, so trips are no longer available. Please choose a different time or date to view upcoming trips.");else{if(s?t.transitOptions=tripPlannerMergeCataTransitOptions({arrivalTime:n}):(i=this.buildTransitDateTime(),t.transitOptions=tripPlannerMergeCataTransitOptions(i?{departureTime:i}:{})),this.routeOptions&&""!==this.routeOptions&&"bestRoute"!==this.routeOptions){let e=null;google.maps.TransitOptions&&google.maps.TransitOptions.RoutingPreference&&(i={LESS_WALKING:google.maps.TransitOptions.RoutingPreference.LESS_WALKING,FEWER_TRANSFERS:google.maps.TransitOptions.RoutingPreference.FEWER_TRANSFERS},e=i[this.routeOptions]),(e=e||"LESS_WALKING"!==this.routeOptions&&"FEWER_TRANSFERS"!==this.routeOptions?e:this.routeOptions)&&(t.transitOptions=tripPlannerMergeCataTransitOptions(t.transitOptions||{}),t.transitOptions.routingPreference=e)}t.transitOptions?t.transitOptions.modes?.length||(t.transitOptions=tripPlannerMergeCataTransitOptions(t.transitOptions)):t.transitOptions=tripPlannerMergeCataTransitOptions({}),this.directionsService.route(t,(e,i)=>{if(o===this.directionsRequestSeq)if(this.tripOnDifferentDate=!1,this.tripOnDifferentDateMessage="",i==google.maps.DirectionsStatus.OK){var t,r,i=tripPlannerFilterDirectionsForCataBuses(e);if(i.routes?.length){if(s&&n&&i.routes&&i.routes.length){var e=i.routes.map(e=>e&&e.legs&&e.legs[0]&&e.legs[0].duration?Number(e.legs[0].duration.value):Number.POSITIVE_INFINITY).reduce((e,t)=>Math.min(e,t),Number.POSITIVE_INFINITY);if(Number.isFinite(e)){e=l.getTime()+1e3*e;if(n.getTime()<=e)return void this.showNoTripsMessage("Trips cannot be planned for the selected time as arrival is not feasible. Please choose a later time or a different date.")}}if(this.lastDirectionsResponse=i,this.date&&this.time&&""!==this.date&&""!==this.time&&i.routes[0].legs[0].departure_time&&(e=this.normalizeDateToIso(this.date),r=(t=i.routes[0].legs[0].departure_time.value).getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0"),e.match(/^\d{4}-\d{2}-\d{2}$/))&&e!==r&&(this.tripOnDifferentDateMessage="This trip departs on "+t.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"}),this.tripOnDifferentDate=!0),this.wheelChair){let t;
247i.routes[0].legs[0].steps.forEach(e=>{e.transit&&!t&&(t=e.transit)}),this.checkADACompliance(t,a,i,o)}else this.adaSearchTried=!1,this.noTripsFound=!1,this.directionsDisplay.setDirections(i),this.directionsDisplay.setMap(this.mapCtrl),this.showLoading=!1;this.buildRoutesFromResponse(i)}else this.showNoTripsMessage('<strong>No fixed route trips found for the selected departure time or location.</strong> Based upon your location, alternative solutions may be available. Please refer to the <a href="/services">Services webpage</a> for additional demand response service options.')}else this.clearDirectionsRouteFromMap(),this.noTripsFound2=!1,this.noTripsFound=!0,this.noTripsFoundMessage="arrive"===String(this.departOrArival).trim().toLowerCase()?"<strong>No trips can arrive by the selected time. Try a later arrival time or switch to Depart.</strong>":'<strong>No fixed route trips found for the selected departure time or location.</strong> Based upon your location, alternative solutions may be available. Please refer to the <a href="/services">Services webpage</a> for additional demand response service options.',this.lastDirectionsResponse=null,this.showLoading=!1})}},async checkADACompliance(e,r,t,a){if(a===this.directionsRequestSeq){var o,e=`${this.proxyApi}getbestadamatch&stopname=${encodeURIComponent(e.departure_stop.name)}&routeid=${e.line.short_name}&d=`+e.headsign;try{let i=await(await fetch(e)).json();a===this.directionsRequestSeq&&(i.IsADA?(this.adaSearchTried=!1,this.noTripsFound=!1,this.directionsDisplay.setDirections(t),this.directionsDisplay.setMap(this.mapCtrl),this.buildRoutesFromResponse(t),this.showLoading=!1):this.adaSearchTried||!i.Stop?(this.adaSearchTried=!1,this.noTripsFound=!0,this.lastDirectionsResponse=null,this.clearDirectionsRouteFromMap(),this.mapCtrl.setZoom(12),this.showLoading=!1):(this.adaSearchTried=!0,o={query:i.Stop.Latitude+", "+i.Stop.Longitude},this.placeService.textSearch(o,(e,t)=>{a===this.directionsRequestSeq&&(t==google.maps.places.PlacesServiceStatus.OK?(this.startLocation=e[0],document.getElementById("start").value=e[0].name,this.getDirections({query:i.Stop.Latitude+", "+i.Stop.Longitude},r)):this.getDirections(i.Stop.Latitude+", "+i.Stop.Longitude,r))})))}catch(e){console.error("Error checking ADA compliance:",e),a===this.directionsRequestSeq&&(this.showLoading=!1)}}},trackTrip(e,t){},escapeHtml(e){return String(null==e?"":e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},clearTripLegMapOverlay(){this.tripLegInfoWindow&&this.tripLegInfoWindow.close(),this.tripLegMarker&&(this.tripLegMarker.setMap(null),this.tripLegMarker=null)},buildTripLegInfoWindowHtml(e){return'<div style="font-family:Roboto,Arial,sans-serif;font-size:14px;line-height:1.45;color:#3c4043;padding:10px 14px 12px;max-width:280px;border-radius:8px;">'+this.escapeHtml(e)+"</div>"},showRouteLegOnMap(a,o){if(this.mapCtrl&&this.lastDirectionsResponse&&null!=a&&"number"==typeof a.index){var s=this.lastDirectionsResponse.routes[a.index];if(s&&s.legs&&s.legs[0]){var n=s.legs[0],o="start"===o;let t=o?n.start_location:n.end_location,e=o?n.start_address:n.end_address,i=o?"A":"B";this.setRoute(a.index),this.clearTripLegMapOverlay(),this.tripLegInfoWindow||(this.tripLegInfoWindow=new google.maps.InfoWindow({maxWidth:320}));n=document.getElementById("map");n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"nearest"});let r=()=>{this.mapCtrl.panTo(t);var e=this.mapCtrl.getZoom();"number"==typeof e&&e<14&&this.mapCtrl.setZoom(14)};o=()=>{this.tripLegMarker=new google.maps.Marker({map:this.mapCtrl,position:t,icon:{path:google.maps.SymbolPath.CIRCLE,fillColor:"#EA4335",fillOpacity:1,strokeColor:"#ffffff",strokeWeight:2,scale:12},label:{text:i,color:"#ffffff",fontSize:"11px",fontWeight:"700"},zIndex:"number"==typeof google.maps.Marker.MAX_ZINDEX?google.maps.Marker.MAX_ZINDEX+1:1e3}),this.tripLegInfoWindow.setContent(this.buildTripLegInfoWindowHtml(e)),this.tripLegInfoWindow.open(this.mapCtrl,this.tripLegMarker),google.maps.event.addListenerOnce(this.tripLegInfoWindow,"closeclick",()=>{this.tripLegMarker&&(this.tripLegMarker.setMap(null),this.tripLegMarker=null)}),r()};s.bounds&&"function"==typeof s.bounds.isEmpty&&!s.bounds.isEmpty()?(this.mapCtrl.fitBounds(s.bounds,{top:72,right:48,bottom:100,left:48}),google.maps.event.addListenerOnce(this.mapCtrl,"idle",o)):(this.mapCtrl.panTo(t),this.mapCtrl.setZoom(15),o())}}}
247,setRoute(t){this.routes.forEach(e=>e.isActive=e.index===t),this.directionsDisplay&&this.directionsDisplay.setRouteIndex(t)},reverseDirection(e=!0){var t=document.getElementById("start").value,i=document.getElementById("end").value,r=this.startLocation,a=this.endLocation;document.getElementById("start").value=i,document.getElementById("end").value=t,this.startLocation=a,this.endLocation=r,e&&""!=t&&""!=i&&this.planTrip()},getShowLoading(){return this.showLoading},loadTripFormFromLocalStorage(){try{var e,t,i,r,a,o,s,n,l,d,c,u=window.localStorage.getItem("cataTripPlannerForm");u&&(window.localStorage.removeItem("cataTripPlannerForm"),t=(e=JSON.parse(u)).leavingFrom||"",i=e.directionTo||"",r=e.fromDate||"",a=e.time||"",o=e.departOrArival||"Depart",s=document.getElementById("start"),n=document.getElementById("end"),l=document.getElementById("select-trip-date"),d=document.getElementById("transitTime"),s&&t&&(s.value=t),n&&i&&(n.value=i),r&&(c=this.normalizeDateToIso(r),this.date=c,l)&&(l.value=c),a&&(this.time=a,this.timeUserEdited=!0,d)&&(d.value=a),"Arrive"!==o&&"Depart"!==o||(this.departOrArival=o),t)&&i&&this.planTrip()}catch(e){console.error("Error loading trip form from localStorage",e)}}}}(()=>{function e(){var e=document.getElementById("toggleButton"),t=document.getElementById("printScheduleButton"),i=document.querySelector(".table-wrap"),r=document.querySelector(".table-wrap2"),a=document.getElementById("toggleButtonText"),o=!!document.getElementById("schedulePrintMain")&&!!document.getElementById("schedulePrintOnly");e&&i&&r&&e.addEventListener("click",function(e){e.preventDefault(),i.classList.contains("d-none")?(i.classList.remove("d-none"),r.classList.add("d-none"),a&&(a.textContent="Switch to Accessible List View")):(r.classList.remove("d-none"),i.classList.add("d-none"),a&&(a.textContent="Switch to Table View"))}),t&&!o&&t.addEventListener("click",function(){window.print()})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()})(),((e,t)=>{e.behaviors.cataServiceAlertsList={attach(e){t("cataServiceAlertsList",".cata-service-alerts-list",e).forEach(e=>{let t=e.querySelector(".cata-service-alerts-list__search-input"),i=e.querySelectorAll(".cata-service-alerts-list__filter"),r=e.querySelectorAll(".cata-service-alerts-list__item"),o=e.querySelector(".cata-service-alerts-list__empty"),s=e.querySelector("#cata-alerts-results-live"),n="all",l="",d=-1,c=e=>(e||"").toLowerCase().trim(),a=e=>String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),u=e=>String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=(e,t=120)=>{var i=String(e||"").trim().split(/\s+/).filter(Boolean);return i.length<=t?String(e||"").trim():i.slice(0,t).join(" ")+"..."},p=(e,t)=>{e=a(e);return t?(t=new RegExp(`(${u(t)})`,"ig"),e.replace(t,'<span class="cata-service-alerts-list__search-hit">$1</span>')):e},m=()=>Array.from(r).filter(e=>!e.hidden),g=()=>{r.forEach(e=>{e.classList.remove("is-keyboard-active")})},f=()=>{var e=m();g(),t&&(!e.length||d<0||d>=e.length?(d=-1,t.removeAttribute("aria-activedescendant")):((e=e[d]).id||(e.id="cata-alert-item-"+String(Array.prototype.indexOf.call(r,e))),e.classList.add("is-keyboard-active"),t.setAttribute("aria-activedescendant",e.id)))},v=()=>{let a=0;var e;r.forEach(e=>{var t,i=c(e.getAttribute("data-cata-search")),r=e.getAttribute("data-cata-effect")||"general",i=!l||i.includes(l),r="all"===n||r===n,i=i&&r;e.hidden=!i,r=e,e=l,t=r.querySelector(".cata-service-alerts-list__card-title"),r=r.querySelector(".cata-service-alerts-list__card-meta"),t&&(t.dataset.originalText||(t.dataset.originalText=t.textContent||""),t.innerHTML=p(t.dataset.originalText,e)),r&&(r.dataset.originalText||(r.dataset.originalText=h(r.textContent||"",40)),r.innerHTML=p(r.dataset.originalText,e)),i&&(a+=1)}),o&&(o.hidden=0<a),d=-1,f(),e=a,s&&(s.textContent=1===e?"1 result found":e+" results found")};t?.addEventListener("input",e=>{l=c(e.target.value),v()}),t?.addEventListener("keydown",e=>{var t=m();t.length&&("ArrowDown"===e.key?(e.preventDefault(),d=Math.min(d+1,t.length-1),f()):"ArrowUp"===e.key?(e.preventDefault(),d=d<=0?0:d-1,f()):"Enter"===e.key&&0<=d&&d<t.length&&(t=t[d].querySelector("a"))&&(e.preventDefault(),t.click()))}
247),i.forEach(e=>{e.addEventListener("click",()=>{i.forEach(e=>{e.classList.remove("is-active"),e.setAttribute("aria-pressed","false")}),e.classList.add("is-active"),e.setAttribute("aria-pressed","true"),n=e.getAttribute("data-cata-filter-value")||"all",v()})}),v()})}}})(Drupal,once),(i=>{let r,a,o,s="The Google Maps JavaScript API",n="google",l="importLibrary",d=document,e=window,c=(e=e[n]||(e[n]={})).maps||(e.maps={}),u=new Set,h=new URLSearchParams;c[l]?console.warn(s+" only loads once. Ignoring:",i):c[l]=(e,...t)=>u.add(e)&&(r=r||new Promise(async(e,t)=>{for(o in await(a=d.createElement("script")),h.set("libraries",[...u]+""),i)h.set(o.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),i[o]);h.set("callback",n+".maps.__ib__"),a.src=`https://maps.${n}apis.com/maps/api/js?`+h,c.__ib__=e,a.onerror=()=>r=t(Error(s+" could not load.")),a.nonce=d.querySelector("script[nonce]")&&d.querySelector("script[nonce]").nonce||"",d.head.append(a)})).then(()=>c[l](e,...t))})({key:"AIzaSyBL0Am9Y4d_UV-JPwJDJpicRJP_Y9bZJwU",v:"weekly"});
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.