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);

// src/solution/RegisterAndLogin/config.ts
var config_exports = {};
__export(config_exports, {
  ApiCaller: () => ApiCaller,
  channelConfigMap: () => channelConfigMap,
  createApiCaller: () => createApiCaller,
  getChannelConfig: () => getChannelConfig
});
module.exports = __toCommonJS(config_exports);
var onlineStoreConfig = {
  sendEmailVerificationCode: {
    url: "/auth/email/register-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.target
    })
  },
  sendEmailLoginCode: {
    url: "/auth/send-email-code",
    method: "POST",
    transformParams: (params) => ({
      email: params.target,
      purpose: params.purpose,
      type: params.type
    })
  },
  sendSmsRegisterCode: {
    url: "/auth/mobile/sms-register",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendEmailRegisterLink: {
    url: "/auth/email/link/new-send-register-link",
    method: "POST",
    transformParams: (email) => ({
      email
    })
  },
  verifyEmailRegistrationLink: {
    url: "/auth/email/link/new-register",
    method: "POST",
    transformParams: (params) => ({
      code: params.code,
      password: params.password
    })
  },
  emailPasswordLogin: {
    url: "/auth/email/login",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      password: params.password
    }),
    options: {
      withCredentials: true
    }
  },
  emailCodeRegister: {
    url: "/auth/email/register",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      code: params.code,
      password: params.password
    })
  },
  phoneCodeRegister: {
    url: "/auth/mobile/register",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      code: params.code,
      country_calling_code: String(params.country_calling_code)
    })
  },
  resendEmailRegisterLink: {
    url: "/auth/email/link/resend_register_link",
    method: "POST",
    transformParams: (params) => ({
      code: params.code
    })
  },
  checkEmailLinkCode: {
    url: "/auth/email/link/new-register-check-code",
    method: "GET",
    transformParams: (params) => ({
      code: params.code
    })
  },
  sendSmsLoginCode: {
    url: "/auth/send-login-msg",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  phoneCodeLogin: {
    url: "/auth/mobile-login",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code),
      code: params.code
    })
  },
  guestLogin: {
    url: "/auth/guest/login",
    method: "POST",
    transformParams: (params) => ({
      login_channel: params.login_channel,
      guest_code: params.guest_code
    })
  },
  checkEmailExists: {
    url: "/auth/email/check-email",
    method: "GET",
    transformParams: (params) => ({
      email: params.email,
      sales_channel: "online_store"
    })
  },
  checkEmailCode: {
    url: "/auth/email/check-email-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.email,
      code: params.code,
      action: params.action
    })
  },
  checkMobileCode: {
    url: "/auth/mobile/check-mobile-code",
    method: "GET",
    transformParams: (params) => ({
      phone: String(params.phone),
      code: params.code,
      country_calling_code: String(params.country_calling_code),
      action: params.action
    })
  },
  phonePasswordLogin: {
    url: "/auth/mobile/login",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendPasswordResetEmail: {
    url: "/auth/email/reset-password-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.email
    })
  },
  sendPasswordResetSms: {
    url: "/auth/mobile/sms-forget",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendResetPasswordLink: {
    url: "/auth/email/link/send_reset_pwd_link",
    method: "POST",
    transformParams: (params) => ({
      email: params.email
    })
  },
  checkResetPasswordCode: {
    url: "/auth/email/link/check_code",
    method: "GET",
    transformParams: (params) => ({
      code: params.code
    })
  },
  resetPasswordByCode: {
    url: "/auth/email/link/reset_pwd_by_code",
    method: "POST",
    transformParams: (params) => ({
      code: params.code,
      password: params.password
    })
  },
  resetPasswordByEmail: {
    url: "/auth/email/reset-password",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      password: params.password,
      code: params.code
    })
  },
  resetPasswordByPhone: {
    url: "/auth/mobile/reset-password",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      code: params.code,
      country_calling_code: String(params.country_calling_code)
    })
  },
  verifyCode: {
    url: "/auth/verify-code",
    method: "POST",
    transformParams: (params) => params
  },
  register: {
    url: "/auth/register",
    method: "POST",
    transformParams: (params) => params
  },
  login: {
    url: "/auth/login",
    method: "POST",
    transformParams: (params) => params
  },
  oauthLogin: {
    url: "/auth/oauth-login",
    method: "POST",
    transformParams: (params) => params
  },
  validateToken: {
    url: "/auth/validate",
    method: "GET",
    transformParams: (token) => ({}),
    options: {
      headers: (token) => ({
        Authorization: `Bearer ${token}`
      })
    }
  },
  logout: {
    url: "/auth/logout",
    method: "POST",
    transformParams: () => ({})
  },
  getCountries: {
    url: "/area/country",
    method: "GET",
    transformParams: () => ({})
  },
  facebookLogin: {
    url: "/auth/facebook/login",
    method: "POST",
    transformParams: (params) => ({
      token: params.token
    })
  },
  appleLogin: {
    url: "/auth/apple/login",
    method: "POST",
    transformParams: (params) => ({
      code: params.code
    })
  }
};
var defaultConfig = {
  sendEmailVerificationCode: {
    url: "/auth/send-email-code",
    method: "POST",
    transformParams: (params) => ({
      email: params.target,
      purpose: params.purpose,
      type: params.type
    })
  },
  sendEmailLoginCode: {
    url: "/auth/send-email-code",
    method: "POST",
    transformParams: (params) => ({
      email: params.target,
      purpose: params.purpose,
      type: params.type
    })
  },
  sendSmsRegisterCode: {
    url: "/auth/send-sms-register",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendEmailRegisterLink: {
    url: "/auth/send-email-register-link",
    method: "POST",
    transformParams: (email) => ({
      email
    })
  },
  verifyEmailRegistrationLink: {
    url: "/auth/verify-email-registration-link",
    method: "POST",
    transformParams: (code) => ({
      code
    })
  },
  emailPasswordLogin: {
    url: "/auth/email-password-login",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      password: params.password
    })
  },
  emailCodeRegister: {
    url: "/auth/email/register",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      code: params.code,
      password: params.password
    })
  },
  phoneCodeRegister: {
    url: "/auth/mobile/register",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      code: params.code,
      country_calling_code: String(params.country_calling_code)
    })
  },
  resendEmailRegisterLink: {
    url: "/auth/resend-email-register-link",
    method: "POST",
    transformParams: (params) => ({
      code: params.code
    })
  },
  checkEmailLinkCode: {
    url: "/email/link/check_code",
    method: "GET",
    transformParams: (params) => ({
      code: params.code
    })
  },
  sendSmsLoginCode: {
    url: "/auth/send-sms-login-code",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  phoneCodeLogin: {
    url: "/auth/phone-code-login",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code),
      code: params.code
    })
  },
  guestLogin: {
    url: "/auth/guest-login",
    method: "POST",
    transformParams: (channel) => ({
      login_channel: channel
    })
  },
  checkEmailExists: {
    url: "/auth/check-email-exists",
    method: "GET",
    transformParams: (params) => ({
      email: params.email
    })
  },
  checkEmailCode: {
    url: "/auth/check-email-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.email,
      code: params.code
    })
  },
  checkMobileCode: {
    url: "/auth/check-mobile-code",
    method: "GET",
    transformParams: (params) => ({
      phone: String(params.phone),
      code: params.code,
      country_calling_code: String(params.country_calling_code),
      action: params.action
    })
  },
  phonePasswordLogin: {
    url: "/auth/mobile-password-login",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendPasswordResetEmail: {
    url: "/auth/send-password-reset-email",
    method: "GET",
    transformParams: (params) => ({
      email: params.email
    })
  },
  sendPasswordResetSms: {
    url: "/auth/send-password-reset-sms",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendResetPasswordLink: {
    url: "/auth/send-reset-password-link",
    method: "POST",
    transformParams: (params) => ({
      email: params.email
    })
  },
  checkResetPasswordCode: {
    url: "/auth/check-reset-password-code",
    method: "GET",
    transformParams: (params) => ({
      code: params.code
    })
  },
  resetPasswordByCode: {
    url: "/auth/reset-password-by-code",
    method: "GET",
    transformParams: (params) => ({
      code: params.code,
      password: params.password
    })
  },
  resetPasswordByEmail: {
    url: "/auth/reset-password-email",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      password: params.password,
      code: params.code
    })
  },
  resetPasswordByPhone: {
    url: "/auth/reset-password-phone",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      code: params.code,
      country_calling_code: String(params.country_calling_code)
    })
  },
  verifyCode: {
    url: "/auth/verify-code",
    method: "POST",
    transformParams: (params) => params
  },
  register: {
    url: "/auth/register",
    method: "POST",
    transformParams: (params) => params
  },
  login: {
    url: "/auth/login",
    method: "POST",
    transformParams: (params) => params
  },
  oauthLogin: {
    url: "/auth/oauth-login",
    method: "POST",
    transformParams: (params) => params
  },
  validateToken: {
    url: "/auth/validate",
    method: "GET",
    transformParams: (token) => ({}),
    options: {
      headers: (token) => ({
        Authorization: `Bearer ${token}`
      })
    }
  },
  logout: {
    url: "/auth/logout",
    method: "POST",
    transformParams: () => ({})
  },
  getCountries: {
    url: "/auth/countries",
    method: "GET",
    transformParams: () => ({})
  },
  facebookLogin: {
    url: "/auth/facebook/login",
    method: "POST",
    transformParams: (params) => ({
      token: params.token
    })
  },
  appleLogin: {
    url: "/auth/apple/login",
    method: "POST",
    transformParams: (params) => ({
      code: params.code
    })
  }
};
var webposConfig = {
  sendEmailVerificationCode: {
    url: "/auth/email/register-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.target
    })
  },
  sendEmailLoginCode: {
    url: "/auth/send-email-code",
    method: "POST",
    transformParams: (params) => ({
      email: params.target,
      purpose: params.purpose,
      type: params.type
    })
  },
  sendSmsRegisterCode: {
    url: "/auth/mobile/sms-register",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendEmailRegisterLink: {
    url: "/auth/email/link/new-send-register-link",
    method: "POST",
    transformParams: (email) => ({
      email
    })
  },
  verifyEmailRegistrationLink: {
    url: "/auth/email/link/new-register",
    method: "POST",
    transformParams: (params) => ({
      code: params.code,
      password: params.password
    })
  },
  emailPasswordLogin: {
    url: "/tenant/account/login/email",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      password: params.password,
      device: "webpos" + (/* @__PURE__ */ new Date()).getTime()
    }),
    options: (values) => ({
      // withCredentials: true,
      prefix: false,
      isDefaultSaasDomain: true,
      cache: {
        mode: "remote_local",
        type: "indexDB",
        cacheKeyData: values
      }
    })
  },
  emailCodeRegister: {
    url: "/auth/email/register",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      code: params.code,
      password: params.password
    })
  },
  phoneCodeRegister: {
    url: "/auth/mobile/register",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      code: params.code,
      country_calling_code: String(params.country_calling_code)
    })
  },
  resendEmailRegisterLink: {
    url: "/auth/email/link/resend_register_link",
    method: "POST",
    transformParams: (params) => ({
      code: params.code
    })
  },
  checkEmailLinkCode: {
    url: "/auth/email/link/new-register-check-code",
    method: "GET",
    transformParams: (params) => ({
      code: params.code
    })
  },
  sendSmsLoginCode: {
    url: "/auth/send-login-msg",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  phoneCodeLogin: {
    url: "/auth/mobile-login",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code),
      code: params.code
    })
  },
  guestLogin: {
    url: "/auth/guest/login",
    method: "POST",
    transformParams: (params) => ({
      login_channel: params.login_channel,
      guest_code: params.guest_code
    })
  },
  checkEmailExists: {
    url: "/auth/email/check-email",
    method: "GET",
    transformParams: (params) => ({
      email: params.email,
      sales_channel: "online_store"
    })
  },
  checkEmailCode: {
    url: "/auth/email/check-email-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.email,
      code: params.code,
      action: params.action
    })
  },
  checkMobileCode: {
    url: "/auth/mobile/check-mobile-code",
    method: "GET",
    transformParams: (params) => ({
      phone: String(params.phone),
      code: params.code,
      country_calling_code: String(params.country_calling_code),
      action: params.action
    })
  },
  phonePasswordLogin: {
    url: "/auth/mobile/login",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendPasswordResetEmail: {
    url: "/auth/email/reset-password-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.email
    })
  },
  sendPasswordResetSms: {
    url: "/auth/mobile/sms-forget",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendResetPasswordLink: {
    url: "/auth/email/link/send_reset_pwd_link",
    method: "POST",
    transformParams: (params) => ({
      email: params.email
    })
  },
  checkResetPasswordCode: {
    url: "/auth/email/link/check_code",
    method: "GET",
    transformParams: (params) => ({
      code: params.code
    })
  },
  resetPasswordByCode: {
    url: "/auth/email/link/reset_pwd_by_code",
    method: "POST",
    transformParams: (params) => ({
      code: params.code,
      password: params.password
    })
  },
  resetPasswordByEmail: {
    url: "/auth/email/reset-password",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      password: params.password,
      code: params.code
    })
  },
  resetPasswordByPhone: {
    url: "/auth/mobile/reset-password",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      code: params.code,
      country_calling_code: String(params.country_calling_code)
    })
  },
  verifyCode: {
    url: "/auth/verify-code",
    method: "POST",
    transformParams: (params) => params
  },
  register: {
    url: "/auth/register",
    method: "POST",
    transformParams: (params) => params
  },
  login: {
    url: "/auth/login",
    method: "POST",
    transformParams: (params) => params
  },
  oauthLogin: {
    url: "/auth/oauth-login",
    method: "POST",
    transformParams: (params) => params
  },
  validateToken: {
    url: "/auth/validate",
    method: "GET",
    transformParams: (token) => ({}),
    options: {
      headers: (token) => ({
        Authorization: `Bearer ${token}`
      })
    }
  },
  logout: {
    url: "/auth/logout",
    method: "POST",
    transformParams: () => ({})
  },
  getCountries: {
    url: "/area/country",
    method: "GET",
    transformParams: () => ({})
  },
  facebookLogin: {
    url: "/auth/facebook/login",
    method: "POST",
    transformParams: (params) => ({
      token: params.token
    })
  },
  appleLogin: {
    url: "/auth/apple/login",
    method: "POST",
    transformParams: (params) => ({
      code: params.code
    })
  }
};
var shopWebposConfig = {
  sendEmailVerificationCode: {
    url: "/auth/email/register-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.target
    })
  },
  sendEmailLoginCode: {
    url: "/auth/send-email-code",
    method: "POST",
    transformParams: (params) => ({
      email: params.target,
      purpose: params.purpose,
      type: params.type
    })
  },
  sendSmsRegisterCode: {
    url: "/auth/mobile/sms-register",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendEmailRegisterLink: {
    url: "/auth/email/link/new-send-register-link",
    method: "POST",
    transformParams: (email) => ({
      email
    })
  },
  verifyEmailRegistrationLink: {
    url: "/auth/email/link/new-register",
    method: "POST",
    transformParams: (params) => ({
      code: params.code,
      password: params.password
    })
  },
  emailPasswordLogin: {
    url: "/tenant/auth/login/email",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      password: params.password,
      device: "webpos" + (/* @__PURE__ */ new Date()).getTime()
    }),
    options: (values) => ({
      // withCredentials: true,
      prefix: false,
      cache: {
        mode: "remote_local",
        type: "indexDB",
        cacheKeyData: values
      }
    })
  },
  emailCodeRegister: {
    url: "/auth/email/register",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      code: params.code,
      password: params.password
    })
  },
  phoneCodeRegister: {
    url: "/auth/mobile/register",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      code: params.code,
      country_calling_code: String(params.country_calling_code)
    })
  },
  resendEmailRegisterLink: {
    url: "/auth/email/link/resend_register_link",
    method: "POST",
    transformParams: (params) => ({
      code: params.code
    })
  },
  checkEmailLinkCode: {
    url: "/auth/email/link/new-register-check-code",
    method: "GET",
    transformParams: (params) => ({
      code: params.code
    })
  },
  sendSmsLoginCode: {
    url: "/auth/send-login-msg",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  phoneCodeLogin: {
    url: "/auth/mobile-login",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code),
      code: params.code
    })
  },
  guestLogin: {
    url: "/auth/guest/login",
    method: "POST",
    transformParams: (params) => ({
      login_channel: params.login_channel,
      guest_code: params.guest_code
    })
  },
  checkEmailExists: {
    url: "/auth/email/check-email",
    method: "GET",
    transformParams: (params) => ({
      email: params.email,
      sales_channel: "online_store"
    })
  },
  checkEmailCode: {
    url: "/auth/email/check-email-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.email,
      code: params.code,
      action: params.action
    })
  },
  checkMobileCode: {
    url: "/auth/mobile/check-mobile-code",
    method: "GET",
    transformParams: (params) => ({
      phone: String(params.phone),
      code: params.code,
      country_calling_code: String(params.country_calling_code),
      action: params.action
    })
  },
  phonePasswordLogin: {
    url: "/auth/mobile/login",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendPasswordResetEmail: {
    url: "/auth/email/reset-password-code",
    method: "GET",
    transformParams: (params) => ({
      email: params.email
    })
  },
  sendPasswordResetSms: {
    url: "/auth/mobile/sms-forget",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      country_calling_code: String(params.country_calling_code)
    })
  },
  sendResetPasswordLink: {
    url: "/auth/email/link/send_reset_pwd_link",
    method: "POST",
    transformParams: (params) => ({
      email: params.email
    })
  },
  checkResetPasswordCode: {
    url: "/auth/email/link/check_code",
    method: "GET",
    transformParams: (params) => ({
      code: params.code
    })
  },
  resetPasswordByCode: {
    url: "/auth/email/link/reset_pwd_by_code",
    method: "POST",
    transformParams: (params) => ({
      code: params.code,
      password: params.password
    })
  },
  resetPasswordByEmail: {
    url: "/auth/email/reset-password",
    method: "POST",
    transformParams: (params) => ({
      email: params.email,
      password: params.password,
      code: params.code
    })
  },
  resetPasswordByPhone: {
    url: "/auth/mobile/reset-password",
    method: "POST",
    transformParams: (params) => ({
      phone: String(params.phone),
      password: params.password,
      code: params.code,
      country_calling_code: String(params.country_calling_code)
    })
  },
  verifyCode: {
    url: "/auth/verify-code",
    method: "POST",
    transformParams: (params) => params
  },
  register: {
    url: "/auth/register",
    method: "POST",
    transformParams: (params) => params
  },
  login: {
    url: "/auth/login",
    method: "POST",
    transformParams: (params) => params
  },
  oauthLogin: {
    url: "/auth/oauth-login",
    method: "POST",
    transformParams: (params) => params
  },
  validateToken: {
    url: "/auth/validate",
    method: "GET",
    transformParams: (token) => ({}),
    options: {
      headers: (token) => ({
        Authorization: `Bearer ${token}`
      })
    }
  },
  logout: {
    url: "/auth/logout",
    method: "POST",
    transformParams: () => ({})
  },
  getCountries: {
    url: "/area/country",
    method: "GET",
    transformParams: () => ({})
  },
  facebookLogin: {
    url: "/auth/facebook/login",
    method: "POST",
    transformParams: (params) => ({
      token: params.token
    })
  },
  appleLogin: {
    url: "/auth/apple/login",
    method: "POST",
    transformParams: (params) => ({
      code: params.code
    })
  }
};
var channelConfigMap = {
  "online-store": onlineStoreConfig,
  "default": defaultConfig,
  "webpos": webposConfig,
  "shop.webpos": shopWebposConfig
};
function getChannelConfig(channel) {
  return channelConfigMap[channel] || channelConfigMap["default"];
}
var ApiCaller = class {
  constructor(request, config) {
    this.request = request;
    this.config = config;
  }
  /**
   * 执行 API 调用
   */
  async call(apiName, params, additionalOptions) {
    const apiConfig = this.config[apiName];
    if (!apiConfig) {
      throw new Error(`API 配置未找到: ${String(apiName)}`);
    }
    const transformedParams = apiConfig.transformParams ? apiConfig.transformParams(params) : params;
    let options = {};
    if (typeof apiConfig.options === "function") {
      options = apiConfig.options(params);
    } else {
      options = (apiConfig == null ? void 0 : apiConfig.options) || {};
    }
    let requestOptions = { ...options, ...additionalOptions };
    if (requestOptions.headers && typeof requestOptions.headers === "function") {
      requestOptions.headers = requestOptions.headers(params);
    }
    requestOptions.customToast = () => {
    };
    let response;
    switch (apiConfig.method) {
      case "GET":
        if (transformedParams && Object.keys(transformedParams).length > 0) {
          response = await this.request.get(apiConfig.url, transformedParams, requestOptions);
        } else {
          response = await this.request.get(apiConfig.url, void 0, requestOptions);
        }
        break;
      case "POST":
        response = await this.request.post(apiConfig.url, transformedParams, requestOptions);
        break;
      case "PUT":
        response = await this.request.put(apiConfig.url, transformedParams, requestOptions);
        break;
      case "DELETE":
        response = await this.request.delete(apiConfig.url, requestOptions);
        break;
      default:
        throw new Error(`不支持的 HTTP 方法: ${apiConfig.method}`);
    }
    return apiConfig.transformResponse ? apiConfig.transformResponse(response) : response;
  }
};
function createApiCaller(request, channel) {
  const config = getChannelConfig(channel);
  return new ApiCaller(request, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ApiCaller,
  channelConfigMap,
  createApiCaller,
  getChannelConfig
});
