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AQC,GACd,MAAM/E,EAAYL,KAAKqF,aAAaC,EAAEC,OAChCjF,GAAGI,IAAI8E,GAAGC,YAAYzF,KAAKqF,aAAcjF,GAA2BC,UAAUiC,KAAIoD,IAAY,CAAGA,eACjG,GACN1F,KAAKsD,kBAAkBqC,MAAM,CAAER,SAAQC,cAAa/E,YAAWuF,WAAY,YAAa,CAACC,EAAQC,KAC9E,OAAXA,GACA9F,KAAKwD,kBAAkBuC,cAAcF,EACzC,GAER,CAIAG,UAAAA,CAAWC,GACPjG,KAAKsC,IAAI2C,QAAQgB,EACrB,CAIA9C,OAAAA,CAAQxB,GACJ,MAAMuE,EAAaC,OAAOC,OAAOzE,GAAO0E,MAAKC,GAAKA,aAAanG,OAAOoG,aACtEvG,KAAKwG,KAAK,UAAW,CACjB5F,EAAYe,EAAM8E,OAAO9D,OACzB/B,EAAYe,EAAM8E,OAAO5D,OACzBqD,EAAWQ,QACXR,EAAWS,SAEnB,CAEAtD,YAAAA,CAAa1B,GACT,MAAMuE,EAAaC,OAAOC,OAAOzE,GAAO0E,MAAKC,GAAKA,aAAanG,OAAOoG,aACtEvG,KAAKwG,KAAK,eAAgB,CACtB5F,EAAYe,EAAM8E,OAAO9D,OACzB/B,EAAYe,EAAM8E,OAAO5D,OACzBqD,EAAWQ,QACXR,EAAWS,SAEnB,EAGWC,EAAAA,EAAO9F,cAAgBA,C","sources":["webpack://google-maps/webpack/bootstrap","webpack://google-maps/./src/index.js","webpack://google-maps/webpack/runtime/global"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","let decimalSeparator, thousandsSeparator;\r\n\r\nconst showRouteActionDataFormat = {\r\n waypoints: [ df.tString ]\r\n};\r\n\r\nfunction stringToNum(string) {\r\n if (typeof string === 'string') {\r\n return df.sys.data.stringToNum(string, decimalSeparator, thousandsSeparator);\r\n }\r\n return string;\r\n}\r\n\r\nfunction numToString(num) {\r\n return df.sys.data.numToString(num, decimalSeparator);\r\n}\r\n\r\nclass WebGoogleMaps extends df.WebBaseControl {\r\n constructor(sName, oParent) {\r\n super(sName, oParent);\r\n\r\n decimalSeparator = this.getWebApp().psDecimalSeparator;\r\n thousandsSeparator = this.getWebApp().psThousandsSeparator;\r\n\r\n // Server-side defined by cWebBaseControl, but client-side not so much...\r\n this.prop(df.tInt, \"piMinHeight\", 0);\r\n\r\n this.prop(df.tNumber, 'pnInitialCenterLat'); // will be string, DF bug\r\n this.prop(df.tNumber, 'pnInitialCenterLng'); // will be string, DF bug\r\n this.prop(df.tInt, 'piZoom');\r\n this.addSync('piZoom');\r\n\r\n this.event('OnClick');\r\n this.event('OnRightClick');\r\n }\r\n\r\n openHtml(aHtml) {\r\n super.openHtml(aHtml);\r\n aHtml.push(`
`);\r\n aHtml.push('
');\r\n }\r\n\r\n afterRender() {\r\n this._eControl = df.dom.query(this._eElem, `#${this._sControlId}`);\r\n super.afterRender();\r\n this.initializeMap();\r\n }\r\n\r\n initializeMap() {\r\n this.map = new google.maps.Map(this._eControl, {\r\n center: {\r\n lat: this.pnInitialCenterLat,\r\n lng: this.pnInitialCenterLng\r\n },\r\n zoom: this.piZoom\r\n });\r\n this.map.addListener('zoom_changed', () => {\r\n this.piZoom = this.map.getZoom();\r\n });\r\n this.map.addListener('click', this.onClick.bind(this));\r\n this.map.addListener('rightclick', this.onRightClick.bind(this));\r\n\r\n this.directionsService = new google.maps.DirectionsService();\r\n this.directionsDisplay = new google.maps.DirectionsRenderer();\r\n this.directionsDisplay.setMap(this.map);\r\n }\r\n\r\n panTo(lat, lng) {\r\n this.map.panTo({ lat: stringToNum(lat), lng: stringToNum(lng) });\r\n }\r\n\r\n setCenter(lat, lng) {\r\n this.map.setCenter({ lat: stringToNum(lat), lng: stringToNum(lng) });\r\n }\r\n\r\n addMarker(lat, lng, title, infoText, iconUrl) {\r\n const marker = new google.maps.Marker({\r\n position: {\r\n lat: stringToNum(lat),\r\n lng: stringToNum(lng)\r\n },\r\n title,\r\n icon: iconUrl,\r\n map: this.map\r\n });\r\n\r\n if (infoText) {\r\n const infoWindow = new google.maps.InfoWindow({\r\n content: infoText\r\n });\r\n marker.addListener('click', () => {\r\n infoWindow.open(this.map, marker);\r\n });\r\n }\r\n }\r\n\r\n geolocate() {\r\n if (navigator.geolocation) {\r\n navigator.geolocation.getCurrentPosition(pos => {\r\n this.map.setCenter({\r\n lat: pos.coords.latitude,\r\n lng: pos.coords.longitude\r\n });\r\n this.map.setZoom(17);\r\n });\r\n }\r\n }\r\n\r\n showRoute(origin, destination) {\r\n const waypoints = this._tActionData.c.length\r\n ? df.sys.vt.deserialize(this._tActionData, showRouteActionDataFormat).waypoints.map(location => ({ location }))\r\n : [];\r\n this.directionsService.route({ origin, destination, waypoints, travelMode: 'DRIVING' }, (result, status) => {\r\n if (status === 'OK') {\r\n this.directionsDisplay.setDirections(result);\r\n }\r\n });\r\n }\r\n\r\n // Setters\r\n\r\n set_piZoom(value) {\r\n this.map.setZoom(value);\r\n }\r\n\r\n // Events\r\n\r\n onClick(event) {\r\n const mouseEvent = Object.values(event).find(p => p instanceof window.MouseEvent);\r\n this.fire('OnClick', [\r\n numToString(event.latLng.lat()),\r\n numToString(event.latLng.lng()),\r\n mouseEvent.clientX,\r\n mouseEvent.clientY\r\n ]);\r\n }\r\n\r\n onRightClick(event) {\r\n const mouseEvent = Object.values(event).find(p => p instanceof window.MouseEvent);\r\n this.fire('OnRightClick', [\r\n numToString(event.latLng.lat()),\r\n numToString(event.latLng.lng()),\r\n mouseEvent.clientX,\r\n mouseEvent.clientY\r\n ]);\r\n }\r\n}\r\n\r\nexport default global.WebGoogleMaps = WebGoogleMaps;","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();"],"names":["__webpack_require__","decimalSeparator","thousandsSeparator","g","globalThis","this","Function","e","window","showRouteActionDataFormat","waypoints","df","tString","stringToNum","string","sys","data","numToString","num","WebGoogleMaps","WebBaseControl","constructor","sName","oParent","super","getWebApp","psDecimalSeparator","psThousandsSeparator","prop","tInt","tNumber","addSync","event","openHtml","aHtml","push","_sControlId","afterRender","_eControl","dom","query","_eElem","initializeMap","map","google","maps","Map","center","lat","pnInitialCenterLat","lng","pnInitialCenterLng","zoom","piZoom","addListener","getZoom","onClick","bind","onRightClick","directionsService","DirectionsService","directionsDisplay","DirectionsRenderer","setMap","panTo","setCenter","addMarker","title","infoText","iconUrl","marker","Marker","position","icon","infoWindow","InfoWindow","content","open","geolocate","navigator","geolocation","getCurrentPosition","pos","coords","latitude","longitude","setZoom","showRoute","origin","destination","_tActionData","c","length","vt","deserialize","location","route","travelMode","result","status","setDirections","set_piZoom","value","mouseEvent","Object","values","find","p","MouseEvent","fire","latLng","clientX","clientY","global"],"sourceRoot":""}