System.register(['src/client/reactive/utils/annotations.js'], function (_export, _context) {
  "use strict";

  var Annotations;
  return {
    setters: [function (_srcClientReactiveUtilsAnnotationsJs) {
      Annotations = _srcClientReactiveUtilsAnnotationsJs.default;
    }],
    execute: function () {
      const __SystemJSRewritingHack = {};
      _recorder_._src_client_vivide_vivideobject_js = _recorder_._src_client_vivide_vivideobject_js || {};
      Object.defineProperty(_recorder_._src_client_vivide_vivideobject_js, 'Annotations', {
        get() {
          return Annotations;
        },

        set(thisIsVererySecretVariableName) {
          Annotations = thisIsVererySecretVariableName;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      class VivideObject {
        static forestToData(forest) {
          return forest.map(model => model.object);
        }

        static dataToForest(data) {
          return data.map(d => new VivideObject(d));
        }

        constructor(data) {
          this._data = data;
          this._properties = new Annotations();
          this._descentStep = null;
        }

        get object() {
          return this._data;
        }
        get data() {
          return this._data;
        }

        get properties() {
          return this._properties;
        }

        get descentStep() {
          return this._descentStep;
        }
        set descentStep(descentStep) {
          return this._descentStep = descentStep;
        }

        async hasChildren() {
          const children = await this.getChildren();

          return children && children.length > 0;
        }

        async computeChildren() {
          if (!this.descentStep) {
            // #TODO: better: undefined? (to signal the absense of a descent script)
            return [];
          }

          const forest = await this.descentStep.descentObject(this.object);
          return forest;
        }

        async getChildren() {
          return this._children = this._children || (await this.computeChildren());
        }
      }

      _export('default', VivideObject);

      Object.defineProperty(_recorder_._src_client_vivide_vivideobject_js, 'VivideObject', {
        get() {
          return VivideObject;
        },

        set(thisIsVererySecretVariableName) {
          _export('default', VivideObject = thisIsVererySecretVariableName);

          return true;
        },

        enumerable: true,
        configurable: true
      });
    }
  };
});