import { Container as r } from "unstated";
import { Iam as i } from "@accelbyte/sdk-iam";
const e = {
  isFetchingCountries: !1,
  countries: [],
  error: null
};
class c extends r {
  constructor(s) {
    super(), this.sdk = s, this.state = e;
  }
  async fetchCountries() {
    const s = i.CountryApi(this.sdk);
    if (!this.state.isFetchingCountries)
      try {
        this.setState({ isFetchingCountries: !this.state.countries });
        const t = await s.getCountries();
        return this.setState({ countries: t, error: null }), t;
      } catch (t) {
        throw this.setState({ error: t }), t;
      } finally {
        this.setState({ isFetchingCountries: !1 });
      }
  }
  clear() {
    this.setState(e);
  }
}
export {
  c as MiscAppManager
};
