import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
import _createClass from '@babel/runtime/helpers/createClass';
import _regeneratorRuntime from '@babel/runtime/regenerator';
import { _ as __awaiter } from '../../tslib.es6-848120af.js';
import { initAegis } from './core.mjs';
import '../env.mjs';
import '../gamelet.mjs';

var AegisReportInPixui = /*#__PURE__*/function () {
  function AegisReportInPixui() {
    _classCallCheck(this, AegisReportInPixui);
  }
  return _createClass(AegisReportInPixui, null, [{
    key: "init",
    value: function init(options) {
      return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
        var aegis;
        return _regeneratorRuntime.wrap(function (_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              if (!this.aegis) {
                _context.next = 1;
                break;
              }
              return _context.abrupt("return", this.aegis);
            case 1:
              this.options = options;
              _context.prev = 2;
              _context.next = 3;
              return initAegis(options);
            case 3:
              aegis = _context.sent;
              _context.next = 5;
              break;
            case 4:
              _context.prev = 4;
              _context["catch"](2);
            case 5:
              if (aegis) {
                this.aegis = aegis;
              }
              return _context.abrupt("return", aegis);
            case 6:
            case "end":
              return _context.stop();
          }
        }, _callee, this, [[2, 4]]);
      }));
    }
  }, {
    key: "report",
    value: function report(info) {
      var _a;
      return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
        var aegis;
        return _regeneratorRuntime.wrap(function (_context2) {
          while (1) switch (_context2.prev = _context2.next) {
            case 0:
              _context2.prev = 0;
              _context2.next = 1;
              return this.init(this.options);
            case 1:
              aegis = _context2.sent;
              _context2.next = 2;
              return (_a = aegis.report) === null || _a === void 0 ? void 0 : _a.call(aegis, Object.assign({}, info));
            case 2:
              _context2.next = 4;
              break;
            case 3:
              _context2.prev = 3;
              _context2["catch"](0);
            case 4:
            case "end":
              return _context2.stop();
          }
        }, _callee2, this, [[0, 3]]);
      }));
    }
  }, {
    key: "info",
    value: function info(_info) {
      var _a;
      return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
        var aegis;
        return _regeneratorRuntime.wrap(function (_context3) {
          while (1) switch (_context3.prev = _context3.next) {
            case 0:
              _context3.prev = 0;
              _context3.next = 1;
              return this.init(this.options);
            case 1:
              aegis = _context3.sent;
              _context3.next = 2;
              return (_a = aegis.info) === null || _a === void 0 ? void 0 : _a.call(aegis, Object.assign({}, _info));
            case 2:
              _context3.next = 4;
              break;
            case 3:
              _context3.prev = 3;
              _context3["catch"](0);
            case 4:
            case "end":
              return _context3.stop();
          }
        }, _callee3, this, [[0, 3]]);
      }));
    }
  }]);
}();

export { AegisReportInPixui };
