{ "version": 3, "sources": ["../../node_modules/debounce/index.js", "../../src/js/map.js"], "sourcesContent": ["/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing. The function also has a property 'clear' \n * that is a function which will clear the timer to prevent previously scheduled executions. \n *\n * @source underscore.js\n * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n * @param {Function} function to wrap\n * @param {Number} timeout in ms (`100`)\n * @param {Boolean} whether to execute at the beginning (`false`)\n * @api public\n */\nfunction debounce(func, wait, immediate){\n var timeout, args, context, timestamp, result;\n if (null == wait) wait = 100;\n\n function later() {\n var last = Date.now() - timestamp;\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n\n var debounced = function(){\n context = this;\n args = arguments;\n timestamp = Date.now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n\n debounced.clear = function() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n };\n \n debounced.flush = function() {\n if (timeout) {\n result = func.apply(context, args);\n context = args = null;\n \n clearTimeout(timeout);\n timeout = null;\n }\n };\n\n return debounced;\n};\n\n// Adds compatibility for ES modules\ndebounce.debounce = debounce;\n\nmodule.exports = debounce;\n", "import debounce from 'debounce'\n\nconst mapEl = document.getElementById('map')\nif (mapEl) {\n\twindow.addEventListener('load', initMap)\n}\n\nfunction initMap() {\n\tconst markers = _mapMarkers\n\tmarkers.forEach(marker => {\n\t\tlet markerObj = {\n\t\t\tlat: parseFloat(marker.map_marker_location.latitude),\n\t\t\tlng: parseFloat(marker.map_marker_location.longitude),\n\t\t}\n\t\tmarker['markerObj'] = markerObj\n\t})\n\n\t// Find center of multiple markers\n\tfunction findCenter(markers) {\n\t\tif (markers.length <= 1) {\n\t\t\treturn markers[0].markerObj\n\t\t}\n\t\tconst lats = markers.map(m => m.markerObj.lat)\n\t\tconst lngs = markers.map(m => m.markerObj.lng)\n\t\treturn {\n\t\t\tlat: (Math.min(...lats) + Math.max(...lats)) / 2,\n\t\t\tlng: (Math.min(...lngs) + Math.max(...lngs)) / 2,\n\t\t}\n\t}\n\tconst centerPosition = findCenter(markers)\n\n\tvar bounds = new google.maps.LatLngBounds()\n\tmarkers?.forEach(m => {\n\t\tbounds.extend(new google.maps.LatLng(m.markerObj.lat, m.markerObj.lng))\n\t})\n\n\tlet zoomLevel\n\tif (window.innerWidth >= 1200) {\n\t\tzoomLevel = 15\n\t} else if (window.innerWidth >= 992) {\n\t\tzoomLevel = 14\n\t} else {\n\t\tzoomLevel = 13\n\t}\n\n\tconst map = new google.maps.Map(document.getElementById('map'), {\n\t\tcenter: centerPosition,\n\t\tzoom: zoomLevel,\n\t\tmapId: 'f22f4f193b90ef3f',\n\t\tstreetViewControl: false,\n\t\tmapTypeControl: false,\n\t\tfullscreenControl: false,\n\t})\n\n\t// map.setOptions({draggable: false, zoomControl: false, scrollwheel: false, disableDoubleClickZoom: true});\n\tmap.setOptions({ scrollwheel: false })\n\n\tconst image = {\n\t\turl: '/wp-content/themes/custom-theme/assets/img/logo-map-marker.svg',\n\t\tsize: new google.maps.Size(54, 41),\n\t\torigin: new google.maps.Point(0, 0),\n\t\tanchor: new google.maps.Point(27, 20),\n\t}\n\n\tfor (let i = 0; i < markers.length; i++) {\n\t\tlet m = markers[i]\n\t\tconst contentString = `
${m.location_name}