@visitscotland/component-library
Version:
VisitScotland Component Library
1 lines • 1.72 kB
JavaScript
;(self.webpackChunk_visitscotland_component_library=self.webpackChunk_visitscotland_component_library||[]).push([[3750],{83750:function(o,e,n){n.d(e,{hn:function(){return d},lB:function(){return g}});var i=n(96763);const t=o=>{var e,n,t,r="The Google Maps JavaScript API",a="google",s="importLibrary",l="__ib__",c=document,p=window,d=p[a]||(p[a]={}),g=d.maps||(d.maps={}),m=new Set,u=new URLSearchParams;g[s]?i.warn(r+" only loads once. Ignoring:",o):g[s]=(i,...p)=>m.add(i)&&(e||(e=new Promise((async(i,s)=>{for(t in await(n=c.createElement("script")),u.set("libraries",[...m]+""),o)u.set(t.replace(/[A-Z]/g,(o=>"_"+o[0].toLowerCase())),o[t]);u.set("callback",a+".maps."+l),function(o,e){o.src=e}(n,"https://maps.googleapis.com/maps/api/js?"+u),g[l]=i,n.onerror=()=>e=s(Error(r+" could not load.")),n.nonce=c.querySelector("script[nonce]")?.nonce||"",c.head.append(n)})))).then((()=>g[s](i,...p)))},r=o=>`The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(o)}) will be ignored.`,a=o=>`The google.maps.importLibrary() function is already defined, and @googlemaps/js-api-loader will use the existing function instead of overwriting it. The options passed to setOptions (${JSON.stringify(o)}) will be ignored.`,s="No options were set before calling importLibrary. Make sure to configure the loader using setOptions().",l=()=>{},c=()=>{};let p=!1;function d(o){p?l(r(o)):(function(o){const e=Boolean(window.google?.maps?.importLibrary);e&&c(a(o)),e||t(o)}(o),p=!0)}async function g(o){if(p||l(s),!window?.google?.maps?.importLibrary)throw new Error("google.maps.importLibrary is not installed.");return await google.maps.importLibrary(o)}}}]);