text: "use strict";
  var data_1 = require('../data');
  var spec_1 = require('../spec');
  var util_1 = require('../util');
  var common_1 = require('./common');
  function compile(inputSpec) {
      var spec = spec_1.normalize(inputSpec);
      var model = common_1.buildModel(spec, null, '');
      model.parse();
      return assemble(model);
  }
  exports.compile = compile;
  function assemble(model) {
      var config = model.config();
      var output = util_1.extend({
          width: 1,
          height: 1,
          padding: 'auto'
      }, config.viewport ? { viewport: config.viewport } : {}, config.background ? { background: config.background } : {}, {
          data: [].concat(model.assembleData([]), model.assembleLayout([])),
          marks: [assembleRootGroup(model)]
      });
      return {
          spec: output
      };
  }
  function assembleRootGroup(model) {
      var rootGroup = util_1.extend({
          name: model.name('root'),
          type: 'group',
      }, model.description() ? { description: model.description() } : {}, {
          from: { data: data_1.LAYOUT },
          properties: {
              update: util_1.extend({
                  width: { field: 'width' },
                  height: { field: 'height' }
              }, model.assembleParentGroupProperties(model.config().cell))
          }
      });
      return util_1.extend(rootGroup, model.assembleGroup());
  }
  exports.assembleRootGroup = assembleRootGroup;
  //# sourceMappingURL=compile.js.map