'use strict';

var util = require('../../../../../zrender@6.0.0/node_modules/zrender/lib/core/util.js');
var model = require('../util/model.js');

var internalOptionCreatorMap = util.createHashMap();
function registerInternalOptionCreator(mainType, creator) {
  util.assert(internalOptionCreatorMap.get(mainType) == null && creator);
  internalOptionCreatorMap.set(mainType, creator);
}
function concatInternalOptions(ecModel, mainType, newCmptOptionList) {
  var internalOptionCreator = internalOptionCreatorMap.get(mainType);
  if (!internalOptionCreator) {
    return newCmptOptionList;
  }
  var internalOptions = internalOptionCreator(ecModel);
  if (!internalOptions) {
    return newCmptOptionList;
  }
  if (process.env.NODE_ENV !== 'production') {
    for (var i = 0; i < internalOptions.length; i++) {
      util.assert(model.isComponentIdInternal(internalOptions[i]));
    }
  }
  return newCmptOptionList.concat(internalOptions);
}

exports.concatInternalOptions = concatInternalOptions;
exports.registerInternalOptionCreator = registerInternalOptionCreator;
