"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

require("core-js/modules/es.array.index-of.js");

require("core-js/modules/es.date.to-string.js");

require("core-js/modules/es.object.to-string.js");

require("core-js/modules/es.regexp.to-string.js");

require("core-js/modules/es.reflect.construct.js");

require("core-js/modules/es.function.bind.js");

require("core-js/modules/es.array.iterator.js");

require("core-js/modules/es.map.js");

require("core-js/modules/es.string.iterator.js");

require("core-js/modules/web.dom-collections.iterator.js");

require("core-js/modules/es.object.create.js");

require("core-js/modules/es.object.define-property.js");

require("core-js/modules/es.symbol.js");

require("core-js/modules/es.symbol.description.js");

require("core-js/modules/es.symbol.iterator.js");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.UpdateIdError = exports.ReduxSerializeError = exports.NotImplementedError = exports.NotAListError = exports.MultipleObjectsReturnedError = exports.DeleteError = exports.APIResponseError = void 0;

require("core-js/modules/es.object.set-prototype-of.js");

require("core-js/modules/es.object.get-prototype-of.js");

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }

function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

var NotImplementedError = /*#__PURE__*/function (_Error) {
  _inherits(NotImplementedError, _Error);

  var _super = _createSuper(NotImplementedError);

  function NotImplementedError() {
    _classCallCheck(this, NotImplementedError);

    return _super.call(this, "Not implemented.");
  }

  return _createClass(NotImplementedError);
}( /*#__PURE__*/_wrapNativeSuper(Error));

exports.NotImplementedError = NotImplementedError;

var MultipleObjectsReturnedError = /*#__PURE__*/function (_Error2) {
  _inherits(MultipleObjectsReturnedError, _Error2);

  var _super2 = _createSuper(MultipleObjectsReturnedError);

  function MultipleObjectsReturnedError(resourceName) {
    var _this;

    _classCallCheck(this, MultipleObjectsReturnedError);

    _this = _super2.call(this, "Expected a single ".concat(resourceName, " resource but got an array."));
    _this.resourceName = resourceName;
    return _this;
  }

  return _createClass(MultipleObjectsReturnedError);
}( /*#__PURE__*/_wrapNativeSuper(Error));

exports.MultipleObjectsReturnedError = MultipleObjectsReturnedError;

var ReduxSerializeError = /*#__PURE__*/function (_Error3) {
  _inherits(ReduxSerializeError, _Error3);

  var _super3 = _createSuper(ReduxSerializeError);

  function ReduxSerializeError() {
    _classCallCheck(this, ReduxSerializeError);

    return _super3.call(this, "Can not Redux serialize a resource without an id. Save it first.");
  }

  return _createClass(ReduxSerializeError);
}( /*#__PURE__*/_wrapNativeSuper(Error));

exports.ReduxSerializeError = ReduxSerializeError;

var UpdateIdError = /*#__PURE__*/function (_Error4) {
  _inherits(UpdateIdError, _Error4);

  var _super4 = _createSuper(UpdateIdError);

  function UpdateIdError(resourceName) {
    var _this2;

    _classCallCheck(this, UpdateIdError);

    _this2 = _super4.call(this, "Can not update ".concat(resourceName, "'s id once it is set."));
    _this2.resourceName = resourceName;
    return _this2;
  }

  return _createClass(UpdateIdError);
}( /*#__PURE__*/_wrapNativeSuper(Error));

exports.UpdateIdError = UpdateIdError;

var NotAListError = /*#__PURE__*/function (_Error5) {
  _inherits(NotAListError, _Error5);

  var _super5 = _createSuper(NotAListError);

  function NotAListError(resourceName) {
    var _this3;

    _classCallCheck(this, NotAListError);

    _this3 = _super5.call(this, "Expected a list but got a single ".concat(resourceName, " resource instead."));
    _this3.resourceName = resourceName;
    return _this3;
  }

  return _createClass(NotAListError);
}( /*#__PURE__*/_wrapNativeSuper(Error));

exports.NotAListError = NotAListError;

var DeleteError = /*#__PURE__*/function (_Error6) {
  _inherits(DeleteError, _Error6);

  var _super6 = _createSuper(DeleteError);

  function DeleteError(resourceName) {
    var _this4;

    _classCallCheck(this, DeleteError);

    _this4 = _super6.call(this, "Can not delete unsaved ".concat(resourceName, "."));
    _this4.resourceName = resourceName;
    return _this4;
  }

  return _createClass(DeleteError);
}( /*#__PURE__*/_wrapNativeSuper(Error));

exports.DeleteError = DeleteError;

var APIResponseError = /*#__PURE__*/function (_Error7) {
  _inherits(APIResponseError, _Error7);

  var _super7 = _createSuper(APIResponseError);

  function APIResponseError(
  /**
   * A short message describing the context when
   * the error occured (resourceClass, HTTP method, etc.)
   */
  message,
  /**
   * The response from the API, containing specific details
   * or probable causes of why the error ocurred
   */
  response) {
    var _this5;

    _classCallCheck(this, APIResponseError);

    _this5 = _super7.call(this, message);
    _this5.message = message;
    _this5.response = response;
    return _this5;
  }

  return _createClass(APIResponseError);
}( /*#__PURE__*/_wrapNativeSuper(Error));

exports.APIResponseError = APIResponseError;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21tb24vZXJyb3JzL2Vycm9ycy50cyJdLCJuYW1lcyI6WyJOb3RJbXBsZW1lbnRlZEVycm9yIiwiRXJyb3IiLCJNdWx0aXBsZU9iamVjdH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