text: "use strict";
  import * as tslib_1 from "tslib";
  import Chainable from '../chainable';
  import createObserver from '../observer';
  var Action = (function (_super) {
      tslib_1.__extends(Action, _super);
      function Action() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      Action.prototype.create = function (props) {
          return new Action(props);
      };
      Action.prototype.start = function (observerCandidate) {
          if (observerCandidate === void 0) { observerCandidate = {}; }
          var isComplete = false;
          var subscription = {
              stop: function () { return undefined; }
          };
          var _a = this.props, init = _a.init, observerProps = tslib_1.__rest(_a, ["init"]);
          var observer = createObserver(observerCandidate, observerProps, function () {
              isComplete = true;
              subscription.stop();
          });
          var api = init(observer);
          subscription = api
              ? tslib_1.__assign({}, subscription, api) : subscription;
          if (observerCandidate.registerParent) {
              observerCandidate.registerParent(subscription);
          }
          if (isComplete)
              subscription.stop();
          return subscription;
      };
      return Action;
  }(Chainable));
  export { Action };
  export default function (init) { return new Action({ init: init }); };
  //# sourceMappingURL=index.js.map