"use strict";
const common_vendor = require("../../common/vendor.js");
const uni_modules_uviewPro_libs_index = require("./libs/index.js");
const uni_modules_uviewPro_libs_util_logger = require("./libs/util/logger.js");
const uni_modules_uviewPro_libs_config_themeTokens = require("./libs/config/theme-tokens.js");
const uni_modules_uviewPro_libs_hooks_useTheme = require("./libs/hooks/useTheme.js");
const uni_modules_uviewPro_libs_util_configProvider = require("./libs/util/config-provider.js");
const install = (app, options) => {
  var _a, _b, _c;
  try {
    if (options) {
      if (options == null ? void 0 : options.theme) {
        const optTheme = options.theme;
        if (Array.isArray(optTheme)) {
          uni_modules_uviewPro_libs_hooks_useTheme.initTheme(optTheme);
        } else if (typeof optTheme === "object" && optTheme.themes) {
          uni_modules_uviewPro_libs_hooks_useTheme.initTheme(
            optTheme.themes,
            {
              defaultTheme: optTheme.defaultTheme,
              defaultDarkMode: optTheme.defaultDarkMode
            },
            optTheme.isForce
          );
        } else {
          const defaultTheme = uni_modules_uviewPro_libs_config_themeTokens.defaultThemes[0];
          if (defaultTheme) {
            const mergedTheme = {
              ...defaultTheme,
              color: {
                ...defaultTheme.color,
                ...optTheme
              }
            };
            uni_modules_uviewPro_libs_hooks_useTheme.initTheme([mergedTheme], defaultTheme.name);
          }
        }
      } else {
        uni_modules_uviewPro_libs_hooks_useTheme.initTheme();
      }
      try {
        if (options == null ? void 0 : options.locale) {
          const optLocale = options.locale;
          if (typeof optLocale === "string") {
            uni_modules_uviewPro_libs_util_configProvider.configProvider.initLocales(void 0, optLocale);
          } else if (Array.isArray(optLocale)) {
            uni_modules_uviewPro_libs_util_configProvider.configProvider.initLocales(optLocale);
          } else if (optLocale && typeof optLocale === "object") {
            uni_modules_uviewPro_libs_util_configProvider.configProvider.initLocales(optLocale.locales, optLocale.defaultLocale, optLocale.isForce);
          } else {
            uni_modules_uviewPro_libs_util_configProvider.configProvider.initLocales();
          }
        } else {
          uni_modules_uviewPro_libs_util_configProvider.configProvider.initLocales();
        }
      } catch (e) {
        common_vendor.index.__f__("error", "at uni_modules/uview-pro/index.ts:74", "[install locales] Error:", e);
      }
      uni_modules_uviewPro_libs_util_logger.logger.setDebugMode(((_a = options == null ? void 0 : options.log) == null ? void 0 : _a.debug) ?? false).setPrefix(((_b = options == null ? void 0 : options.log) == null ? void 0 : _b.prefix) || "").setShowCallerInfo(((_c = options == null ? void 0 : options.log) == null ? void 0 : _c.showCallerInfo) ?? true);
    } else {
      uni_modules_uviewPro_libs_hooks_useTheme.initTheme();
      uni_modules_uviewPro_libs_util_configProvider.configProvider.initLocales();
    }
  } catch (error) {
    common_vendor.index.__f__("error", "at uni_modules/uview-pro/index.ts:88", "[install options] Error:", error);
  }
  common_vendor.index.$u = uni_modules_uviewPro_libs_index.$u;
  app.config.globalProperties.$u = uni_modules_uviewPro_libs_index.$u;
};
const uViewPro = {
  install
};
exports.uViewPro = uViewPro;
//# sourceMappingURL=../../../.sourcemap/mp-weixin/uni_modules/uview-pro/index.js.map
