/* Automatically generated by './build/bin/build-entry.js' */

import './libs';

import TimeViewer from './components/timeViewer/index.js';
import Card from './components/card/index.js';
import Container from './components/container/index.js';
import Dashboard from './components/dashboard/index.js';
import Loading from './components/loading/index.js';
import TimeControl from './components/timeControl/index.js';
import RunningCircleValue from './components/runningCircleValue/index.js';
import Legend from './components/legend/index.js';
import Table from './components/table/index.js';
import RunningLine from './components/runningLine/index.js';
import Decoration1 from './components/decoration1/index.js';
import CoreIndex from './components/coreIndex/index.js';
import PieChart from './components/pieChart/index.js';
import LineBarChart from './components/lineBarChart/index.js';
import RateChart from './components/rateChart/index.js';
import ValueChart from './components/valueChart/index.js';
import SectionParameterSelect from './components/sectionParameterSelect/index.js';
import IndexIndicator from './components/indexIndicator/index.js';
import ScrollRankingBoard from './components/scrollRankingBoard/index.js';
import FeatureLayerSwitch from './components/featureLayerSwitch/index.js';
import IndexSwitch from './components/indexSwitch/index.js';
import LiquidChart from './components/liquidChart/index.js';
import IndicatorSelect from './components/indicatorSelect/index.js';
import IndexTable from './components/indexTable/index.js';
import DashboardHeader from './components/dashboardHeader/index.js';
import TopToolbar from './components/topToolbar/index.js';
import DropdownMenu from './components/dropdownMenu/index.js';
import BorderBox from './components/borderBox/index.js';
import DataCalendar from './components/dataCalendar/index.js';
import BorderBox1 from './components/borderBox1/index.js';
import BorderBox2 from './components/borderBox2/index.js';
import BorderBox3 from './components/borderBox3/index.js';
import BorderBox6 from './components/borderBox6/index.js';
import BorderBox7 from './components/borderBox7/index.js';
import CoreIndex1 from './components/coreIndex1/index.js';
import Map from './components/map/index.js';
import filters from './filters/index';
import container from './container';

const components = {
  TimeViewer,
  Card,
  Container,
  Dashboard,
  Loading,
  TimeControl,
  RunningCircleValue,
  Legend,
  Table,
  RunningLine,
  Decoration1,
  CoreIndex,
  PieChart,
  LineBarChart,
  RateChart,
  ValueChart,
  SectionParameterSelect,
  IndexIndicator,
  ScrollRankingBoard,
  FeatureLayerSwitch,
  IndexSwitch,
  LiquidChart,
  IndicatorSelect,
  IndexTable,
  DashboardHeader,
  TopToolbar,
  DropdownMenu,
  BorderBox,
  DataCalendar,
  BorderBox1,
  BorderBox2,
  BorderBox3,
  BorderBox6,
  BorderBox7,
  CoreIndex1,
  Map
};

const install = function(Vue, options = {}) {
    if (install.installed)
        return;

    for(let key in components) {
        const component = components[key];
        if (component instanceof Array) {
            component[0].install(Vue);
        }
        else {
            component.install(Vue);
        }
    }

    if (options.config) {
        Object.assign(container.config, options.config);
    }

    Object.keys(filters).forEach(key => {
        Vue.filter(key, filters[key])
    });
};

// auto install
if (typeof window !== 'undefined' && window.Vue) {
    install(window.Vue);
}

const API = {
    ...components,
    version: process.env.VERSION,
    install,
};

Object.assign(container, API);

export default container;
