import { visualMapActionInfo, visualMapActionHander } from './visualMapAction.mjs';
import { visualMapEncodingHandlers } from './visualEncoding.mjs';
import { each } from '../../../../../../zrender@6.0.0/node_modules/zrender/lib/core/util.mjs';
import visualMapPreprocessor from './preprocessor.mjs';

var installed = false;
function installCommon(registers) {
  if (installed) {
    return;
  }
  installed = true;
  registers.registerSubTypeDefaulter('visualMap', function (option) {
    // Compatible with ec2, when splitNumber === 0, continuous visualMap will be used.
    return !option.categories && (!(option.pieces ? option.pieces.length > 0 : option.splitNumber > 0) || option.calculable) ? 'continuous' : 'piecewise';
  });
  registers.registerAction(visualMapActionInfo, visualMapActionHander);
  each(visualMapEncodingHandlers, function (handler) {
    registers.registerVisual(registers.PRIORITY.VISUAL.COMPONENT, handler);
  });
  registers.registerPreprocessor(visualMapPreprocessor);
}

export { installCommon as default };
