"use strict";
const auth = {
  storageTokenKeyName: "_tid",
  storageUserKeyName: "_u_data",
  storageRolePermissionKeyName: "role-permission"
};
let apiConfig = null;
const subscribers = [];
function onApiConfigReady(callback) {
  if (apiConfig) {
    callback(apiConfig);
  } else {
    subscribers.push(callback);
  }
}
function initializeApiConfig(config) {
  if (apiConfig) {
    console.warn("API configuration is already initialized. Overwriting with new values.");
  }
  if (!config.backendBaseUrl) {
    throw new Error("backendBaseUrl is required in API configuration");
  }
  apiConfig = { ...config };
  subscribers.forEach((callback) => {
    try {
      callback(apiConfig);
    } catch (error) {
      console.error("Error in API config subscriber:", error);
    }
  });
}
function getApiConfig() {
  if (!apiConfig) {
    throw new Error(
      "API configuration not initialized. Please call initializeApiConfig() before using API features. See documentation: https://github.com/erpforce/common#api-configuration"
    );
  }
  return apiConfig;
}
function getApiConfigSafe() {
  return apiConfig;
}
function isApiConfigInitialized() {
  return apiConfig !== null;
}
function resetApiConfig() {
  apiConfig = null;
}
exports.auth = auth;
exports.getApiConfig = getApiConfig;
exports.getApiConfigSafe = getApiConfigSafe;
exports.initializeApiConfig = initializeApiConfig;
exports.isApiConfigInitialized = isApiConfigInitialized;
exports.onApiConfigReady = onApiConfigReady;
exports.resetApiConfig = resetApiConfig;
//# sourceMappingURL=api-config-DXwDMFn-.js.map
