"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Context = void 0; function _xdl() { const data = require("@expo/xdl"); _xdl = function () { return data; }; return data; } function _appleApi() { const data = require("../appleApi"); _appleApi = function () { return data; }; return data; } function _api() { const data = require("./api"); _api = function () { return data; }; return data; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } ; class Context { constructor() { _defineProperty(this, "_hasProjectContext", false); } get user() { return this._user; } get hasProjectContext() { return this._hasProjectContext; } get manifest() { return this._manifest; } get api() { return this._apiClient; } get ios() { return this._iosApiClient; } get appleCtx() { if (!this._appleCtx) { throw new Error('Apple context not initialized.'); } return this._appleCtx; } async ensureAppleCtx() { if (!this._appleCtx) { this._appleCtx = await (0, _appleApi().authenticate)(); } } async init(projectDir) { const status = await _xdl().Doctor.validateLowLatencyAsync(projectDir); if (status !== _xdl().Doctor.FATAL) { /* This manager does not need to work in project context */ const { exp } = await _xdl().ProjectUtils.readConfigJsonAsync(projectDir); this._manifest = exp; this._hasProjectContext = true; } this._user = await _xdl().UserManager.ensureLoggedInAsync(); this._apiClient = _xdl().ApiV2.clientForUser(this.user); this._iosApiClient = new (_api().IosApi)(this._user); } } exports.Context = Context; //# sourceMappingURL=../__sourcemaps__/credentials/context.js.map