1/*! For license information please see 223.bundle.js.LICENSE.txt */ 2"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[223],{72223(e,t,n){n.d(t,{default:()=>f});var r=n(92341);function o(e){return o="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},o(e)}function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var s=r&&r.prototype instanceof l?r:l,u=Object.create(s.prototype);return c(u,"_invoke",function(n,r,o){var i,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,s=0,c=e,h.n=n,a}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,i=u[t],p=h.p,m=i[2];n>3?(o=m===r)&&(c=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(s=0,h.v=r,h.n=i[1]):p<m&&(o=n<3||i[0]>r||r>m)&&(i[4]=n,i[5]=r,h.n=m,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,m){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,m),s=u,c=m;(t=s<2?e:c)||!d;){i||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==a)break}catch(t){i=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,i),!0),u}var a={};function l(){}function u(){}function d(){}t=Object.getPrototypeOf;var h=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),p=d.prototype=l.prototype=Object.create(h);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,c(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return u.prototype=d,c(p,"constructor",d),c(d,"constructor",u),u.displayName="GeneratorFunction",c(d,o,"GeneratorFunction"),c(p),c(p,o,"Generator"),c(p,r,function(){return this}),c(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m}})()}function c(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,n,r){function i(t,n){c(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},c(e,t,n,r)}function l(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){l(i,r,o,a,s,"next",e)}function s(e){l(i,r,o,a,s,"throw",e)}a(void 0)})}}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,p(r.key),r)}}function h(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}var m=function(){return e=function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),h(this,"resources",null),h(this,"map",null),h(this,"markers",[]),h(this,"activeMarker",null),h(this,"currentPopup",null),h(this,"locationFilteredData",[]),h(this,"searchedLocation",null),h(this,"searchedMarkers",[]),h(this,"currentItems",10),h(this,"showMoreAmount",10),h(this,"waitTime",null),h(this,"currentLocations",[]),h(this,"desiredTimezone","America/Ne
2w_York"),this.$el=t,document.querySelectorAll("#map").length>0&&this.loadMapLibreGL().then(function(){n.fetchApiData().then(function(e){n.resources=e,n.initMap()})})},t=[{key:"loadMapLibreGL",value:(k=u(s().m(function e(){return s().w(function(e){for(;;)if(0===e.n)return e.a(2,new Promise(function(e,t){if(window.maplibregl)e();else{var n=function(){window.maplibregl?e():setTimeout(n,100)};n()}}))},e)})),function(){return k.apply(this,arguments)})},{key:"initMap",value:function(){var e=this,t=this.resources,n=this.fetchWaitTime(),r=drupalSettings.freshpaintEnvironmentId,o=(t.stylized_map,"standard-light");n.then(function(n){e.waitTime=n,e.map=new maplibregl.Map({container:"map",style:"https://freshpaint-hipaa-maps.com/".concat(r,"/").concat(o,"/style-descriptor"),center:[-73.71801884853465,40.697136558106926],zoom:9}),e.map.addControl(new maplibregl.NavigationControl,"top-left"),e.map.on("load",function(){e.setupMapFeatures(t)})})}},{key:"setupMapFeatures",value:function(e){var t=this,n=document.querySelector(".locations"),r=document.querySelector("#location-button"),o=document.querySelector("#user-address-test"),i=document.querySelector("#change-address"),a=document.querySelector("#filter-button"),s=document.querySelector("#reset-button"),c=document.querySelector("#distance-filter"),l=document.createElement("p"),u=document.querySelector(".search-form"),d=document.querySelector("#region"),h=document.querySelector("#search-input")||document.querySelector('input[type="text"]')||document.querySelector(".search-form input"),p=document.querySelector("#load-more");this.setLocationOpenStatus(e.locations);var m=this.getCurrentLocations();m.length>0&&this.renderLocationCards(m);var f=this.getCurrentTimeInTimezone(),v=(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][f.getDay()].toLowerCase(),f.getDate(),f.getMonth(),f.getHours()<10?"0".concat(f.getHours()):"".concat(f.getHours())),y=f.getMinutes()<10?"0".concat(f.getMinutes()):"".concat(f.getMinutes());"".concat(v,":").concat(y),l.setAttribute("class","results"),l.textContent="Listing ".concat(e.locations.length," locations"),document.querySelector("#filter-wrapper").prepend(l),this.renderRegionList(e.region_list),location.search.includes("?location=")?(h.value=decodeURI(location.search.split("?location=")[1]),""!==h.value&&this.geocodeAddress(h.value).then(function(e){e&&e.length>0?(h.value=e[0].formatted_address,setTimeout(function(){u.querySelector(".button").click()},500)):t.showSearchError()}),c.style.display="block"):(this.globalLocationArray=e.locations,this.renderLocationCards(e.locations.slice(0,this.currentItems)),p.addEventListener("click",function(){t.lazyLoadingLocations(t.globalLocationArray),t.currentItems>=t.globalLocationArray.length&&(p.style.display="none")})),this.setupEventListeners(e,{locationsContainer:n,locationButton:r,userAddress:o,changeAddressButton:i,filterButton:a,resetButton:s,distanceFilter:c,totalResults:l,searchForm:u,regionSelect:d,input:h,loadMoreButton:p})}},{key:"setupEventListeners",value:function(e,t){var n=this,r=t.searchForm,o=t.input,i=t.locationButton,a=t.filterButton,s=t.resetButton,c=t.changeAddressButton,l=t.regionSelect;o&&this.initializePlacesAutocomplete(o),r.addEventListener("submit",function(r){r.preventDefault(),""!==o.value?n.handleSearch(o.value,e,t):n.showSearchError()}),i.addEventListener("click",function(){n.handleCurrentLocation(o,r,t)}),a&&a.addEventListener("click",function(r){r.preventDefault(),n.handleFilter(e,t)}),s.addEventListener("click",function(r){r.preventDefault(),n.handleReset(e,t)}),c.addEventListener("click",function(){n.handleChangeAddress(t)}),this.setupDistanceSlider(),this.setupDistanceFilterValidation(l),this.setupShortestWaitTimeValidation()}},{key:"setupShortestWaitTimeValidation",value:function(){var e=document.querySelector("#shortest-wait-time");e&&(this.searchedLocation||(e.disabled=!0,e.checked=!1))}},{key:"updateShortestWaitTimeFilter",value:function(e){var t=document.querySelector("#shortest-wait-time");t&&(t.disabled=!e,e||(t.checked=!1))}},{key:"initializePlacesAutocomplete",value:(g=u(s().m(function e(t){return s().w(function(e){for(;;)switch(e.n){case 0:this.setupFreshpaintAutocomplete(t);case 1:return e.a(2)}},e,this)})),function(e){return g.apply(this,arguments)})},{key:"setupDistanceSlider",value:function(){var e=document.querySelector("#distance-range"),t=document.querySelector("#distance-label"),n=document.querySelector("#distance-input");e&&t&&n&&e.addEventListener("change",function(e){var r=e.target.value,o=document.createElement("strong");o.textContent="".concat(r," ").concat(r>1?"miles":"mile"),t.replaceChildren("Display locations within ",o),n.value=r})}},{key:"setupDistanceFilterValidation",value:function(e){var t=document.querySelector("#distance-input");t&&e&&(t.addEventListener("change",function(){if(t.checked&&"all-locations"!==e.value){e.value="all-locations";var n=document.querySelector(".filter-error");n&&(n.innerHTML="Distance slider is only available when all locations is selected",n.style.display="block")}}),e.addEventListener("change",function(){if(t.checked){t.checked=!1;var e=document.querySelector(".filter-error");e&&(e.innerHTML="Distance slider is only available when all locations is selected",e.style.display="block")}}))}},{key:"setupFreshpaintAutocomplete",value:function(e){var t=this;if(e&&e.parentNode){var n=null,r=document.createElement("div");r.className="freshpaint-autocomplete-dropdown",r.style.cssText="\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n background: white;\n border: 1px solid #ccc;\n border-top: none;\n max-height: 200px;\n overflow-y: auto;\n z-index: 1000;\n display: none;\n box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n width: 100%;\n min-height: 50px;\n margin-top: 0;\n ",e.style.position="relative";var o=e.closest("form")||e.closest(".search-form")||e.parentNode;o.style.position="relative",o.appendChild(r),e.addEventListener("input",function(o){var i=o.target.value.trim();n&&clearTimeout(n),i.length<2?r.style.display="none":n=setTimeout(function(){t.fetchAutocompleteSuggestions(i,r,e)},300)}),e.addEventListener("keyup",function(e){}),document.addEventListener("click",function(t){e.contains(t.target)||r.contains(t.target)||(r.style.display="none")}),e.addEventListener("focus",function(){r.children.length>0&&(r.style.display="block")})}}},{key:"fetchAutocompleteSuggestions",value:(y=u(s().m(function e(t,n,r){var o,i,a,c;return s().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,o=drupalSettings.freshpaintEnvironmentId,i={QueryText:t,MaxResults:5,Filter:{IncludeCountries:["US"]},Language:"en"},e.n=1,fetch("https://freshpaint-hipaa-maps.com/v2/autocomplete?token=".concat(o),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});case 1:if((a=e.v).ok){e.n=3;break}return e.n=2,a.text();case 2:throw e.v,new Error("HTTP error! status: ".concat(a.status));case 3:return e.n=4,a.json();case 4:c=e.v,this.displayAutocompleteResults(c.ResultItems||[],n,r),e.n=6;break;case 5:e.p=5,e.v,n.style.display="none";case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t,n){return y.apply(this,arguments)})},{key:"displayAutocompleteResults",value:function(e,t,n){t.innerHTML="",0!==e.length?(e.forEach(function(e,r){var o,i,a=document.createElement("div");a.className="autocomplete-item",a.style.cssText="\n padding: 10px;\n cursor: pointer;\n border-bottom: 1px solid #eee;\n font-size: 14px;\n ";var s=document.createElement("div");s.textContent=e.Title||(null===(o=e.Address)||void 0===o?void 0:o.Label)||"Unknown location",s.style.fontWeight="500";var c=document.createElement("div");c.textContent=(null===(i=e.Address)||void 0===i?void 0:i.Label)||"",c.style.color="#666",c.style.fontSize="12px",a.appendChild(s),c.textContent&&a.appendChild(c),a.addEventListener("mouseenter",function(){a.style.backgroundColor="#f5f5f5"}),a.addEventListener("mouseleave",function(){a.style.backgroundColor="white"}),a.addEventListener("click",function(){var r,o=(null===(r=e.Address)||void 0===r?void 0:r.Label)||e.Title;n.value=o,n.selectedResult=e,t.style.display="none",setTimeout(function(){document.querySelector(".search-form .button").click()},100)}),t.appendChild(a)}),t.style.display="block"):t.style.display="none"}},{key:"loadGoogleMapsAPI",value:(v=u(s().m(function e(){var t=this;return s().w(function(e){for(;;)if(0===e.n)return e.a(2,new Promise(function(e,n){if(window.google&&window.google.maps)e();else{var r=document.createElement("script");
2r.src="https://maps.googleapis.com/maps/api/js?key=".concat(t.resources.google_maps_key,"&libraries=places"),r.onload=function(){return e()},r.onerror=function(){return n(new Error("Failed to load Google Maps API"))},document.head.appendChild(r)}}))},e)})),function(){return v.apply(this,arguments)})},{key:"geocodeAddress",value:(f=u(s().m(function e(t){var n,r,o;return s().w(function(e){for(;;)switch(e.n){case 0:if(e.p=0,!t.selectedResult){e.n=4;break}if(!(n=t.selectedResult).PlaceId){e.n=2;break}return e.n=1,this.geocodePlaceId(n.PlaceId,(null===(r=n.Address)||void 0===r?void 0:r.Label)||n.Title);case 1:case 3:case 5:return e.a(2,e.v);case 2:return e.n=3,this.geocodeAddressText((null===(o=n.Address)||void 0===o?void 0:o.Label)||n.Title);case 4:return e.n=5,this.geocodeAddressText(t);case 6:return e.p=6,e.v,e.a(2,[])}},e,this,[[0,6]])})),function(e){return f.apply(this,arguments)})},{key:"geocodePlaceId",value:(m=u(s().m(function e(t,n){var r,o,i,a;return s().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,r=drupalSettings.freshpaintEnvironmentId,e.n=1,fetch("https://freshpaint-hipaa-maps.com/v2/geocode?token=".concat(r),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({PlaceId:t,MaxResults:1,Language:"en"})});case 1:if((o=e.v).ok){e.n=2;break}throw new Error("HTTP error! status: ".concat(o.status));case 2:return e.n=3,o.json();case 3:if(!((i=e.v).ResultItems&&i.ResultItems.length>0)){e.n=4;break}return a=i.ResultItems[0],e.a(2,[{formatted_address:n,geometry:{location:{lat:function(){var e;return(null===(e=a.Position)||void 0===e?void 0:e[1])||0},lng:function(){var e;return(null===(e=a.Position)||void 0===e?void 0:e[0])||0}}}}]);case 4:return e.a(2,[]);case 5:e.n=7;break;case 6:return e.p=6,e.v,e.a(2,[]);case 7:return e.a(2)}},e,null,[[0,6]])})),function(e,t){return m.apply(this,arguments)})},{key:"geocodeAddressText",value:(p=u(s().m(function e(t){var n,r,o,i,a,c;return s().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,n=drupalSettings.freshpaintEnvironmentId,e.n=1,fetch("https://freshpaint-hipaa-maps.com/v2/geocode?token=".concat(n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({QueryText:t,MaxResults:1,Filter:{IncludeCountries:["US"]},Language:"en"})});case 1:if((r=e.v).ok){e.n=2;break}throw new Error("HTTP error! status: ".concat(r.status));case 2:return e.n=3,r.json();case 3:if(!((o=e.v).ResultItems&&o.ResultItems.length>0)){e.n=4;break}return a=o.ResultItems[0],c=(null===(i=a.Address)||void 0===i?void 0:i.Label)||a.Title,e.a(2,[{formatted_address:c,geometry:{location:{lat:function(){var e;return(null===(e=a.Position)||void 0===e?void 0:e[1])||0},lng:function(){var e;return(null===(e=a.Position)||void 0===e?void 0:e[0])||0}}}}]);case 4:return e.a(2,[]);case 5:e.n=7;break;case 6:return e.p=6,e.v,e.a(2,[]);case 7:return e.a(2)}},e,null,[[0,6]])})),function(e){return p.apply(this,arguments)})},{key:"reverseGeocode",value:(l=u(s().m(function e(t,n){var r,o,i,a,c;return s().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,fetch("https://api.bigdatacloud.net/data/reverse-geocode-client?latitude=".concat(t,"&longitude=").concat(n,"&localityLanguage=en&include=localityInfo"));case 1:if(!(r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:if(!(o=e.v).locality||!o.principalSubdivision){e.n=3;break}return i=[],o.streetNumber&&o.streetName?i.push("".concat(o.streetNumber," ").concat(o.streetName)):o.streetName&&i.push(o.streetName),o.locality&&i.push(o.locality),o.principalSubdivision&&i.push(o.principalSubdivision),o.postcode&&i.push(o.postcode),a=i.join(", "),e.a(2,[{formatted_address:a,geometry:{location:{lat:function(){return t},lng:function(){return n}}}}]);case 3:e.n=5;break;case 4:e.p=4,e.v;case 5:return c="Current Location (".concat(t.toFixed(4),", ").concat(n.toFixed(4),")"),e.a(2,[{formatted_address:c,geometry:{location:{lat:function(){return t},lng:function(){return n}}}}])}},e,null,[[0,4]])})),function(e,t){return l.apply(this,arguments)})},{key:"handleSearch",value:(c=u(s().m(function e(t,n,r){var o,i,a,c,l,u,d=this;return s().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.geocodeAddress(t);case 1:(o=e.v)&&o.length>0?(this.globalLocationArray=n.locations,i=o[0].geometry.location.lat(),a=o[0].geometry.location.lng(),c="string"==typeof t?t:t.formatted_address||o[0].formatted_address,this.searchedLocation={lat:i,lng:a,address:c},this.updateShortestWaitTimeFilter(!0),n.locations.forEach(function(e){var t=d.calculateDistance(i,a,e.latitude,e.longitude);e.distance=t.toFixed(2)}),n.locations.sort(function(e,t){return e.distance-t.distance}),l=n.locations.filter(function(e){return e.distance<=100}),this.clearMarkers(),r.userAddress.style.display="flex",r.searchForm.style.display="none",r.locationButton.style.display="none",r.userAddress.firstElementChild.textContent=c,n.locations[0].distance>50?this.showLocationError():((u=document.querySelector(".results"))&&(u.textContent="Listing ".concat(l.length," of ").concat(n.locations.length)),this.globalLocationArray=l,this.currentItems=this.showMoreAmount,this.renderMapMarkers(l.slice(0,this.currentItems)),this.renderLocationCards(l.slice(0,this.currentItems)),r.distanceFilter.style.display="block",l.length>this.currentItems?r.loadMoreButton.style.display="block":r.loadMoreButton.style.display="none")):this.showSearchError();case 2:return e.a(2)}},e,this)})),function(e,t,n){return c.apply(this,arguments)})},{key:"handleCurrentLocation",value:function(e,t,n){var r=this;navigator.geolocation?navigator.geolocation.getCurrentPosition(function(n){var o=n.coords.latitude,i=n.coords.longitude;r.reverseGeocode(o,i).then(function(n){n&&n.length>0?(e.value=n[0].formatted_address,setTimeout(function(){t.querySelector(".button").click()},500)):r.showSearchError()})},function(e){r.showSearchError()},{enableHighAccuracy:!0,maximumAge:6e4,timeout:5e4}):this.showSearchError()}},{key:"handleFilter",value:function(e,t){var n=this.getFilterValues(),r=this.applyFilters(e.locations,n),o=document.querySelector(".results");o&&(o.textContent="Listing ".concat(r.length," locations")),this.clearMarkers(),this.resetCardView(),this.globalLocationArray=r,this.currentItems=this.showMoreAmount,n.shortest_wait_time&&r.s
2ort(function(e,t){var n=e.filters.wait_time_minutes||0,r=t.filters.wait_time_minutes||0;return n!==r?n-r:e.distance&&t.distance?parseFloat(e.distance)-parseFloat(t.distance):0}),this.renderMapMarkers(r.slice(0,this.currentItems)),this.renderLocationCards(r.slice(0,this.currentItems)),r.length>this.currentItems?t.loadMoreButton.style.display="block":t.loadMoreButton.style.display="none",this.closeFilterModal()}},{key:"closeFilterModal",value:function(){var e=document.querySelector(".map-content__filter-options-outer");e&&e.classList.remove("is-open")}},{key:"getFilterValues",value:function(){var e={};document.querySelectorAll(".filter-option").forEach(function(t){t.checked&&("open"===t.name?e[t.name]=!0:e[t.name]=t.value)}),document.querySelectorAll("select.filter-option").forEach(function(t){t.value&&"all-locations"!==t.value&&(e[t.name]=t.value)});var t=document.querySelector("#distance-input");return t&&t.checked&&(e.distance=t.value),e}},{key:"applyFilters",value:function(e,t){var n=this;return e.filter(function(e){for(var r in t)switch(r){case"distance":if(n.searchedLocation&&e.distance&&parseFloat(e.distance)>parseFloat(t[r]))return!1;break;case"region":if("all-locations"!==t[r]&&e.filters&&e.filters[r]!==t[r])return!1;break;case"shortest_wait_time":if(!0===t[r]||"true"===t[r]){var o=n.getWaitTimeMinutes(e);if(!o)return!1;e.filters.wait_time_minutes=o}break;default:if(e.filters&&e.filters[r]!==!!t[r])return!1}return!0})}},{key:"showFilterError",value:function(){var e=document.querySelector(".filter-error");e&&(e.style.display="block")}},{key:"handleReset",value:function(e,t){this.searchedLocation=null,this.clearMarkers(),this.resetCardView(),t.totalResults.textContent="Listing ".concat(e.locations.length," locations"),t.searchForm.style.display="block",t.locationButton.style.display="block",t.loadMoreButton.style.display="block",t.userAddress.style.display="none",t.input.value="",t.distanceFilter.style.display="none",this.resetAllFilters(),this.updateShortestWaitTimeFilter(!1),this.renderMapMarkers(e.locations.slice(0,this.currentItems)),this.renderLocationCards(e.locations.slice(0,this.currentItems))}},{key:"resetAllFilters",value:function(){document.querySelectorAll(".filter-option").forEach(function(e){e.checked=!1,"SELECT"===e.tagName&&(e.value="all-locations")});var e=document.querySelector("#distance-range"),t=document.querySelector("#distance-label"),n=document.querySelector("#distance-input");e&&t&&n&&(e.value=1,t.innerHTML="Display locations within <strong>1 mile</strong>",n.checked=!1);var r=document.querySelector(".filter-error");r&&(r.style.display="none")}},{key:"handleChangeAddress",value:function(e){this.searchedLocation=null,this.clearMarkers(),this.map.setZoom(9),this.map.setCenter([-73.71801884853465,40.697136558106926]),e.searchForm.style.display="block",e.locationButton.style.display="block",e.loadMoreButton.style.display="block",e.userAddress.style.display="none",e.input.value="",e.distanceFilter.style.display="none",e.userAddress.firstElementChild.textContent=" ",this.resetAllFilters()}},{key:"renderMapMarkers",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n||this.clearMarkers(),this.searchedLocation)if(0!==e.length){if(!n&&this.searchedLocation){var r=new maplibregl.LngLatBounds;e.forEach(function(e){r.extend([e.longitude,e.latitude])}),r.isEmpty()||this.map.fitBounds(r,{padding:50})}e.forEach(function(e){t.addLocationMarker(e)})}else n||(this.map.setZoom(9),this.map.setCenter([-73.71801884853465,40.697136558106926]));else n||(this.map.setZoom(9),this.map.setCenter([-73.71801884853465,40.697136558106926]))}},{key:"addLocationMarker",value:function(e){var t=this,n=document.createElement("div");n.className="maplibre-marker",n.style.cssText="\n width: 20px;\n height: 20px;\n background-color: #d80032;\n border: 2px solid white;\n border-radius: 50%;\n cursor: pointer;\n box-shadow: 0 2px 4px rgba(0,0,0,0.3);\n pointer-events: auto;\n ";var r=new maplibregl.Marker({element:n,anchor:"center"}).setLngLat([e.longitude,e.latitude]).addTo(this.map);return r.locationData=e,n.addEventListener("click",function(n){n.stopPropagation(),t.handleMarkerClick(r,e)}),this.markers.push(r),r}},{key:"handleMarkerClick",value:function(e,t){var n=this;this.currentPopup&&this.currentPopup.remove();var r='\n <div class="maplibre-popup">\n <h3>'.concat(t.location_display_name,"</h3>\n ").concat(t.distance?"<p>".concat(t.distance," mi</p>"):"",'\n <a href="').concat(this.locationDetailUrl(t.location_path),'" target="_blank">More info</a>\n </div>\n ');this.currentPopup=new maplibregl.Popup({offset:25,closeButton:!0,closeOnClick:!1,maxWidth:"300px",className:"maplibre-popup"}).setHTML(r).setLngLat([t.longitude,t.latitude]).addTo(this.map).on("close",function(){n.currentPopup=null}),this.activeMarker=e,this.scrollToLocationCard(t.location_id)}},{key:"scrollToLocationCard",value:function(e){var t=document.querySelector('[data-location-id="'.concat(e,'"]'));t&&(t.scrollIntoView({behavior:"smooth",block:"center"}),t.classList.add("highlighted"),setTimeout(function(){t.style.border="0px solid #d80032",setTimeout(function(){t.classList.remove("highlighted"),t.style.border=""},300)},1e3))}}
2,{key:"clearMarkers",value:function(){this.markers.forEach(function(e){return e.remove()}),this.markers=[]}},{key:"renderLocationCards",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=document.querySelector(".locations");if(this.currentLocations=n?[].concat(i(this.currentLocations),i(e)):e,!n)for(;r.firstChild;)r.removeChild(r.firstChild);var o="";if(e.forEach(function(e){if(e.isOpen=t.isLocationOpen(e),t.createLocationCard(e,r),e.pre_registration_link){var n=JSON.stringify(t.vmdWidgetData(e));o+="VMDPublicScheduler.render(".concat(n,"); ")}}),o){var a=document.createElement("script");a.textContent=o,document.body.appendChild(a)}}},{key:"getCurrentLocations",value:function(){return this.currentLocations}},{key:"createLocationCard",value:function(e,t){var n=this,r=document.createElement("div");r.classList.add("location"),r.setAttribute("data-location-id",e.location_id);var o=this.getLocationStatus(e),i=this.getWaitTimeHtml(e,o.isOpen),a=this.getLocationButtons(e);r.innerHTML='\n <div class="inner-location">\n <h3 class="sitename">'.concat(e.location_display_name,"</h3>\n ").concat(i,'\n <div class="address">\n ').concat(e.address.replace(/(\r\n|\r|\n)/g,"<br>").replace("<br>",""),'\n <a href="https://maps.google.com/?q=').concat(encodeURIComponent(e.address),'+citymd" target="_blank" class="direction">Get directions</a>\n ').concat(e.distance?'<div class="distance"><strong>'.concat(e.distance," mi</strong></div>"):"",'\n </div>\n <div class="location-status">\n <p class="status">\n ').concat(o.html,"\n </p>\n </div>\n ").concat(a.outerHTML,"\n </div>\n "),r.addEventListener("click",function(){var t=n.markers.find(function(t){return t.locationData.location_id===e.location_id});t&&n.handleMarkerClick(t,e)}),t.appendChild(r)}},{key:"getLocationButtons",value:function(e){var t=document.createElement("div");if(e.pre_registration_link&&!e.no_vmd)t.setAttribute("id","open-appointments-"+e.location_id),t.setAttribute("class","open-appointments");else{if(t.classList.add("buttons"),e.pre_registration_link){var n=document.createElement("p");n.classList.add("pre-registration");var r=document.createElement("a");r.href=e.pre_registration_link,r.textContent="Pre-register",r.classList.add("button"),r.classList.add("cta"),r.classList.add("cta--red"),n.append(r),t.append(n)}this.renderSelectClinicButton(e,t)}return t}},{key:"renderSelectClinicButton",value:function(e,t){var n=document.createElement("a");n.textContent="See location",n.href=e.location_path,n.setAttribute("class","button cta cta--light"),t.appendChild(n)}},{key:"getLocationStatus",value:function(e){var t=this.isLocationOpen(e),n=this.getCurrentDay(),r=this.getCloseTime(e,n);if(t){if(this.isScheduleToday(e)){var o=this.getTodaySchedule(e);return{html:'<span class="font-bold open">Open</span> until '.concat(this.formatHolidayHours(o.time_end)),isOpen:!0}}return{html:'<span class="font-bold open">Open</span> until '.concat(r),isOpen:!0}}var i=this.getNextOpen(e),a='<span class="font-bold closed">Closed</span>';return i&&(a+=" | Opens ".concat(i)),{html:a,isOpen:!1}}},{key:"isLocationOpen",value:function(e){var t,n,r=this.getCurrentDay(),o=null===(t=e[r])||void 0===t?void 0:t.split(" - ")[0],i=null===(n=e[r])||void 0===n?void 0:n.split(" - ")[1];if(!o||!i)return!1;var a=this.convertHours(o),s=this.convertHours(i);if(this.hasSchedules(e)&&this.isScheduleToday(e)){var c=this.getTodaySchedule(e);return!this.isSchedulerClosed(c)}return!this.isTempClosed(e)&&!!this.checkTimeAgainstCurrentTime(a,s)}},{key:"getCurrentTimeInTimezone",value:function(){var e={timeZone:this.desiredTimezone},t=(new Date).toLocaleString("en-US",e);return new Date(t)}},{key:"getCurrentDay",value:function(){return["sunday","monday","tuesday","wednesday","thursday","friday","saturday"][this.getCurrentTimeInTimezone().getDay()]}},{key:"getCloseTime",value:function(e,t){var n=e[t];return n&&n.split(" - ")[1]||""}},{key:"hasSchedules",value:function(e){return!!e.schedule}},{key:"isScheduleToday",value:function(e){var t=this,n=!1;return this.hasSchedules(e)&&e.schedule.forEach(function(e){var r=t.getCurrentTimeInTimezone(),o=r.getMonth()+1,i=r.getDate();+e.date.split("-")[1]===o&&+e.date.split("-")[2]===i&&(n=!0)}),n}},{key:"isTempClosed",value:function(e){return e.temporarily_closed}},{key:"isSchedulerClosed",value:function(e){var t=this.convertHours(e.time_start),n=this.convertHours(e.time_end);return 0===e.time_start&&0===e.time_end||!(t<=this.getCurrentTimeString()&&this.getCurrentTimeString()<n)}},{key:"getCurrentTimeString",value:function(){var e=this.getCurrentTimeInTimezone(),t=e.getHours()<10?"0".concat(e.getHours()):"".concat(e.getHours()),n=e.getMinutes()<10?"0".concat(e.getMinutes()):"".concat(e.getMinutes());return"".concat(t,":").concat(n)}},{key:"getTodaySchedule",value:function(e){if(!e.schedule)return null;var t=this.getCurrentTimeInTimezone(),n=t.getMonth()+1,r=t.getDate();return e.schedule.find(function(e){var t=e.date.split("-");return+t[1]===n&&+t[2]===r})}},{key:"formatHolidayHours",value:function(e){return 0===e?"12:00AM":e.toUpperCase()}},{key:"convertHours",value:function(e){if(0===e||e.toLowerCase().includes("closed"))return"00:00";if(e.toLowerCase().includes("midnight"))return"24:00";if(e.toLowerCase().includes("noon"))return"12:00";try{var t=e.split(":")[0],n=e.split(":")[1].slice(0,-2),r=e.slice(-2);return"12"===t&&(t="00"),"pm"===r.toLowerCase()&&(t=parseInt(t,10)+12),t<10&&(t="0"+t),"".concat(t,":").concat(n)}catch(t){return e}}},{key:"checkTimeAgainstCurrentTime",value:function(e,t){try{var n=this.getCurrentTimeInTimezone(),r=n.getHours(),o=n.getMinutes(),i=+e.split(":")[0],a=+e.split(":")[1],s=+t.split(":")[0],c=+t.split(":")[1];return(r>i||r===i&&o>=a)&&(r<s||r===s&&o<=c)}catch(e){return!1}}},{key:"getNextOpen",value:function(e){for(var t=this.getCurrentTimeInTimezone(),n=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],r=1;r<=7;r++){var o=new Date(t);o.setDate(t.getDate()+r);var i=n[o.getDay()],a=e[i];if(a&&"CLOSED"!==a){var s=a.split(" - ")[0];return i.charAt(0).toUpperCase()+i.slice(1,3)+" "+s}}return null}},{key:"getWaitTimeHtml",value:function(e,t){var n=this.waitTime&&void 0!==this.waitTime[e.location_id],r=this.isStillOpen(e);if(t&&r&&n){var o=parseInt(this.waitTime[e.location_id],10);return o<=5?o="< 5":o>=45&&(o="> 45"),'<div class="wait-time">Estimated wait: <strong>'.concat(o,' min</strong> <span href="#" class="live">LIVE</span></div>')}if(t&&n){var i=parseInt(this.waitTime[e.location_id],10);return i<=5?i="< 5":i>=45&&(i="> 45"),'<div class="wait-time">Estimated wait: <strong>'.concat(i,' min</strong> <span href="#" class="live">LIVE</span></div>')}return""}},{key:"isStillOpen",value:function(e){var t,n,r=this.getCurrentDay(),o=null===(t=e[r])||void 0===t?void 0:t.split(" - ")[0],i=null===(n=e[r])||void 0===n?void 0:n.split(" - ")[1];if(!o||!i)return!1;var a=this.convertHours(o),s=this.getPreTime(i),c=this.convertHours(s);return this.checkTimeAgainstCurrentTime(a,c)}},{key:"getPreTime",value:function(e){"Midnight"==e?e="12:00AM":"noon"==e&&(e="12:00PM");var t=e.match(/(\d+):(\d+)([APM]+)$/),n="";if(t){var r=parseInt(t[1],10),o=parseInt(t[2],10),i=t[3],a=60*r+o;12===r&&(i="AM"==i?"PM":"AM"),(a-=15)<0&&(a+=1440),r=Math.floor(a/60),o=a%60,n="".concat(r,":").concat(o.toString().padStart(2,"0")).concat(i)}return n}},{key:"getWaitTime",value:function(e){return this.isLocationOpen(e)&&this.isStillOpen(e)&&this.waitTime&&void 0!==this.waitTime[e.location_id]?parseInt(this.waitTime[e.location_id],10):null}},{key:"vmdWidgetData",value:function(e){var t=e.address.replace(/(?:\r\n|\r|\n)/g," ").replace(/\s+/g,"+");return{rootElementId:"open-appointments-"+e.location_id,departmentId:e.location_id,departmentName:e.sitename,imageUrl:window.location.origin+e.image_url,waitTime:parseInt(this.waitTime[e.location_id],10),isOpen:e.isOpen,departmentAddress:(0,r.o)(e.address),type:"citymd",departmentPhone:e.phone,directionsLink:"http://maps.google.com/?q=".concat(t,"+citymd"),locationDetailLink:window.location.origin+e.location_path,page:"location-list",preRegisterLink:e.pre_registration_link}}},{key:"calculateDistance",value:function(e,t,n,r){var o=this.deg2rad(n-e),i=this.deg2rad(r-t),a=Math.sin(o/2)*Math.sin(o/2)+Math.cos(this.deg2rad(e))*Math.cos(this.deg2rad(n))*Math.sin(i/2)*Math.sin(i/2);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*3958.8}},{key:"deg2rad",value:function(e){return e*(Math.PI/180)}},{key:"locationDetailUrl",value:function(e){return window.location.origin.includes("localhost")?"#":window.location.origin.includes("citymd")?e:window.location.origin.includes("main")?"https://citymddev.prod.acquia-sites.com/".concat(e):e}},{key:"showSearchError",value:function(){var e=document.querySelector(".search-error");e&&(e.style.display="block",e.focus());var t=document.querySelector("#search-input");t&&t.classList.add("error")}},{key:"setLocationOpenStatus",value:function(e){var t=this;e.forEach(function(e){e.filters||(e.filters={}),e.filters.open=t.isLocationOpen(e)})}},{key:"getWaitTimeMinutes",value:function(e){var t=this.isLocationOpen(e),n=this.isStillOpen(e);return t&&n&&this.waitTime&&void 0!==this.waitTime[e.location_id]?parseInt(this.waitTime[e.location_id],10):null}},{key:"showLocationError",value:function(){this.clearMarkers(),this.resetCardView();var e=document.querySelector(".locations"),t=document.createElement("div"),n=document.createElement("div"),r=document.createElement("h3"),o=document.createElement("p");t.classList.add("location"),n.classList.add("inner-location"),r.textContent="".concat(this.globalLocationArray.length," locations nationwide"),o.classList.add("error"),o.style.display="block",o.textContent="Sorry, there are currently no CityMD locations that match the current criteria.",n.appendChild(r),n.appendChild(o),t.appendChild(n),e.appendChild(t);var i=document.querySelector(".results");i&&(i.textContent="Listing 0 locations");var a=document.querySelector("#load-more");a&&(a.style.display="none")}},{key:"resetCardView",value:function(){this.markers=[];for(var e=document.querySelector(".locations");e.firstChild;)e.removeChild(e.firstChild)}},{key:"renderRegionList",value:function(e){var t=document.querySelector("#regi
2on");e.forEach(function(e){var n=document.createElement("option");n.value=e,n.textContent=e,t.appendChild(n)})}},{key:"lazyLoadingLocations",value:function(e){var t=e.slice(this.currentItems,this.currentItems+this.showMoreAmount);this.searchedLocation&&(this.renderMapMarkers(t,!0),this.updateMapBounds()),this.renderLocationCards(t,!0),this.currentItems+=this.showMoreAmount}},{key:"updateMapBounds",value:function(){if(0!==this.markers.length&&this.searchedLocation){var e=new maplibregl.LngLatBounds;this.markers.forEach(function(t){t.locationData&&e.extend([t.locationData.longitude,t.locationData.latitude])}),e.isEmpty()||this.map.fitBounds(e,{padding:50})}}},{key:"fetchWaitTime",value:(a=u(s().m(function e(){var t,n,r;return s().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,t=location.href.includes("localhost")||location.href.includes("amplifyapp")?"https://citymddev.prod.acquia-sites.com":location.origin,e.n=1,fetch("".concat(t,"/locations/resource/wait-time?_format=json"));case 1:return n=e.v,e.n=2,n.json();case 2:return r=e.v,e.a(2,r);case 3:e.p=3,e.v;case 4:return e.a(2)}},e,null,[[0,3]])})),function(){return a.apply(this,arguments)})},{key:"fetchApiData",value:(o=u(s().m(function e(){var t,n,r;return s().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,t=location.href.includes("localhost")||location.href.includes("amplifyapp")?"https://citymddev.prod.acquia-sites.com":location.origin,e.n=1,fetch("".concat(t,"/locations/resource?_format=json"),{method:"get",headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"http://localhost:3000"}});case 1:return n=e.v,e.n=2,n.json();case 2:return r=e.v,e.a(2,r);case 3:e.p=3,e.v;case 4:return e.a(2)}},e,null,[[0,3]])})),function(){return o.apply(this,arguments)})}],t&&d(e.prototype,t),n&&d(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,o,a,c,l,p,m,f,v,y,g,k}();const f=m},92341(e,t,n){function r(e){var t=e.split("\n").filter(function(e){return""!==e.trim()}),n=t[0]?t[0].replace(/\r/g,""):"",r=e.match(/(.+?)\s*,?\s*([A-Za-z]+)\s+(\d{5})/),o="",i="",a="";return r?(o=r[1].trim(),i=r[2].trim(),a=r[3]):console.log("Address format not recognized"),{address1:n,address2:"",city:o,state:i,zip:a}}n.d(t,{o:()=>r})}}]);
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.