import { inject } from 'vue';
import { createDisplay, VuetifyDisplaySymbol } from "./composables/display.mjs";
import { createTheme, VuetifyThemeSymbol } from "./composables/theme.mjs";
import { defaultSets, VuetifyIconSymbol } from "./composables/icons.mjs";
import { createLocaleAdapter, VuetifyLocaleAdapterSymbol } from "./composables/locale.mjs";
import { createRtl, VuetifyRtlSymbol } from "./composables/rtl.mjs";
import { mergeDeep } from "./util/index.mjs";
import { aliases, mdi } from "./iconsets/mdi.mjs"; // Types

export const VuetifySymbol = Symbol.for('vuetify');
export const useVuetify = () => {
  const vuetify = inject(VuetifySymbol);

  if (!vuetify) {
    throw new Error('Vuetify has not been installed on this app');
  }

  return vuetify;
};
export const createVuetify = (options = {}) => {
  const install = app => {
    const {
      components = {},
      directives = {},
      defaults = {},
      icons = {}
    } = options;

    for (const key in directives) {
      const directive = directives[key];
      app.directive(key, directive);
    }

    for (const key in components) {
      const component = components[key];
      app.component(key, component);
    }

    const vuetify = {
      defaults: {
        global: {},
        ...defaults
      }
    };
    app.provide(VuetifySymbol, vuetify);
    app.provide(VuetifyDisplaySymbol, createDisplay(options.display));
    app.provide(VuetifyThemeSymbol, createTheme(options.theme));
    app.provide(VuetifyIconSymbol, mergeDeep({
      defaultSet: 'mdi',
      sets: { ...defaultSets,
        mdi
      },
      aliases
    }, icons));
    const {
      adapter,
      rootInstance
    } = createLocaleAdapter(app, options == null ? void 0 : options.locale);
    app.provide(VuetifyLocaleAdapterSymbol, adapter);
    app.provide(VuetifyRtlSymbol, createRtl(rootInstance, options == null ? void 0 : options.locale));
    app.config.globalProperties.$vuetify = vuetify;
  };

  return {
    install
  };
};
//# sourceMappingURL=framework.mjs.map