import "./components/form/form_manager";// declare ASAP for AAForm availability for other scripts

import '../scss/app.scss';

import {entityList} from "./components/entity_list";
import {entityForm} from "./components/entity_form";
import {entityExport} from "./components/entity_export";
import initSidebar from "./components/sidebar";
import mediaLibrary from "./components/media_library/media_library";

import {prevent} from "./components/prevent";
import {flashbagNotification} from "./components/flashbag_notification";
import $ from 'jquery'
// import "startbootstrap-sb-admin-2/js/sb-admin-2";
import "url-search-params-polyfill";

import AAUtils from "./components/util/util";
global.AAUtils = AAUtils;

// import form && tools
import "./components/form/form_config";
// import form type handlers
import "./components/form/handler/collection";
import "./components/form/handler/date_picker";
import "./components/form/handler/rich_select";
import "./components/form/handler/rich_text";
import "./components/form/handler/content_reference";
import "./components/form/handler/json_text";

import initBootstrap from "./_bootstrap";

global.$ = window.$ = window.jQuery = $;// still required?

$(function () {
    prevent();
    flashbagNotification();
    entityList();
    entityForm();
    entityExport();
    initSidebar();
    initBootstrap();
    mediaLibrary();

    var dom_observer = new MutationObserver(function (mutation) {});
    var container = document.documentElement || document.body;
    var config = {
        childList: true,
        attributes: true,
        characterData: true,
        subtree: true,
    };
    dom_observer.observe(container, config);

    // initialize form fields
    AAForm.initialize();
});


