tryRemoveLibrary(options = {}) {
    if (!Formio.libraries[this.getLibraryName()]) {
      return;
    }

    const existingScript = document.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
    if (existingScript && options.params?.key && !existingScript.attributes.src.value.endsWith(options.params.key)) {
        const googleMapsScripts = document.querySelectorAll(`script[src^="${GOOGLE_MAPS_BASE_URL}"]`) ?? [];
        googleMapsScripts.forEach(script => script.parentNode.removeChild(script));
        delete Formio.libraries[this.getLibraryName()];
        delete global?.google?.maps;
        delete global[`${this.getLibraryName()}Callback`];
    }
  }
Tries to remove the library if api key for loaded script is different.
@param {ProviderOptions} options - The options for the provider.