"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var app_bridge_exports = {};
__export(app_bridge_exports, {
  getAppBridge: () => getAppBridge
});
module.exports = __toCommonJS(app_bridge_exports);
var import_pui_app_bridge = require("@elliemae/pui-app-bridge");
var import_logger = require("../logger.js");
let appBridge = null;
const getAppBridge = async () => {
  if (!appBridge) {
    const logger = (0, import_logger.getLogger)();
    const version = window.emui?.version || "latest";
    appBridge = new import_pui_app_bridge.CAppBridge({
      logger,
      version,
      // eslint-disable-next-line no-underscore-dangle
      appConfigBaseUrl: window?.emui?._ASSET_PATH
    });
    await appBridge.init();
  }
  return appBridge;
};
