import _Object$keys from'babel-runtime/core-js/object/keys';import _typeof from'babel-runtime/helpers/typeof';var loadGoogleMaps=function loadGoogleMaps(apiKey,version){try{if(typeof window==='undefined'||typeof document==='undefined'){return}if(_typeof(window.google)==='object'&&_typeof(window.google.maps)==='object'){if(_typeof(window.google.maps.places)==='object'){return}throw new Error('Google is already loaded, but does not contain the places API.')}if(!window.vgaMapState.initMap){var googleMapScript=document.createElement('SCRIPT');var options={};if(typeof apiKey==='string'){options.key=apiKey}else if((typeof apiKey==='undefined'?'undefined':_typeof(apiKey))==='object'){_Object$keys(apiKey).forEach(function(key){options[key]=apiKey[key]})}else{throw new Error('apiKey should either be a string or an object')}options.libraries='places';options.callback='initVGAMaps';var parameters=_Object$keys(options).map(function(key){return encodeURIComponent(key)+'='+encodeURIComponent(options[key])}).join('&');var url='https://maps.googleapis.com/maps/api/js?'+parameters;if(version){url=url+'&v='+version}googleMapScript.setAttribute('src',url);googleMapScript.setAttribute('async','');googleMapScript.setAttribute('defer','');document.body.appendChild(googleMapScript)}else{throw new Error('Vuetify google autocomplete loaded multiple times.')}}catch(exception){throw new Error('Vuetify google autocomplete load error: ',exception)}};export default loadGoogleMaps;