text: "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  const Manifest_1 = require("./Manifest");
  const META_APPLICATION_ID = 'com.google.android.gms.ads.APPLICATION_ID';
  const META_DELAY_APP_MEASUREMENT_INIT = 'com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT';
  function getGoogleMobileAdsAppId(config) {
      var _a, _b, _c;
      return (_c = (_b = (_a = config.android) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.googleMobileAdsAppId) !== null && _c !== void 0 ? _c : null;
  }
  exports.getGoogleMobileAdsAppId = getGoogleMobileAdsAppId;
  function getGoogleMobileAdsAutoInit(config) {
      var _a, _b, _c;
      return (_c = (_b = (_a = config.android) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.googleMobileAdsAutoInit) !== null && _c !== void 0 ? _c : false;
  }
  exports.getGoogleMobileAdsAutoInit = getGoogleMobileAdsAutoInit;
  function setGoogleMobileAdsConfig(config, androidManifest) {
      const appId = getGoogleMobileAdsAppId(config);
      const autoInit = getGoogleMobileAdsAutoInit(config);
      const mainApplication = Manifest_1.getMainApplicationOrThrow(androidManifest);
      if (appId) {
          Manifest_1.addMetaDataItemToMainApplication(mainApplication, META_APPLICATION_ID, appId);
          Manifest_1.addMetaDataItemToMainApplication(mainApplication, META_DELAY_APP_MEASUREMENT_INIT, String(!autoInit));
      }
      else {
          Manifest_1.removeMetaDataItemFromMainApplication(mainApplication, META_APPLICATION_ID);
          Manifest_1.removeMetaDataItemFromMainApplication(mainApplication, META_DELAY_APP_MEASUREMENT_INIT);
      }
      return androidManifest;
  }
  exports.setGoogleMobileAdsConfig = setGoogleMobileAdsConfig;
  //# sourceMappingURL=GoogleMobileAds.js.map