<commit_before>define(["elaiJS/helper", "elaiJS/binder", "elaiJS/cascadeCaller",
        "elaiJS/multicallback", "elaiJS/propertiesManagerFactory",
        "elaiJS/configuration", "elaiJS/ressources", "elaiJS/mode",
        "elaiJS/navigator", "elaiJS/webservice",
        "elaiJS/defaultWebservices","elaiJS/defaultConfiguration",
        "elaiJS/theme", "elaiJS/language", "elaiJS/localisation"],
        function(helper, a, b, multicallback, c, config, d, e, navigator,
          f, defaultWebservices, defaultConfig, themeManager, lang, loc) {
  
	function initialize() {
	  loadWidgetModules();
	  
    defaultWebservices.addDefaultWebservices();
	  defaultConfig.setDefaultConfiguration(function() {
	    launchDebugMode();
	    initalizeModules(start);
	  });
	}
	
	function loadWidgetModules() {
    require([ "elaiJS/plugin", "elaiJS/widget", "elaiJS/primaryWidget",
              "elaiJS/mustacherend", "elaiJS/polymerend"]);
	}
	
	function initalizeModules(callback) {
    if(config.elaiJS.skipNavigatorInitialization !== true)
      navigator.initializeCurrentPage();
    
    var multiCallBackFunction = multicallback(3, callback);
    initializeModule(themeManager, multiCallBackFunction);
    initializeModule(lang, multiCallBackFunction, config.elaiJS.skipLanguageInitialization);
    initializeModule(loc, multiCallBackFunction, config.elaiJS.skipLocalisationInitialization);
	}
	
	function initializeModule(module, callback, skipInit) {
	  if(skipInit === true)
      callback();
    else
      module.initialize(callback);
	}
	
	function start() {
	  if(config.elaiJS.requireElaiJS)
      config.elaiJS.requireElaiJS.setConfig(config);
    
    if(console && console.timeEnd && config.elaiJS.isDebug)
      console.timeEnd("ElaiJS Start in");
	  
    if(document.dispatchEvent && CustomEvent)
      document.dispatchEvent(new CustomEvent("ElaiJSReady"));
      
    loadAppMain();
	}
	
	function loadAppMain() {
    var appModuleName = helper.getElaiJSAttribute("app");
    if(!appModuleName)
      return;
    
    require([appModuleName], function(appMain) {
      if(appMain && helper.isFunction(appMain.start))
        appMain.start();
    });
  }
  
  function launchDebugMode() {
    if(config.elaiJS.isDebug) {
      require(["elaiJS/debugManager"], function(debugManager) {
        debugManager.startDebugMode();
      });
    }
  }
  
  initialize();
  
  return {};
});

/*
  TODO:
*/

/*
  name
    Events - beforeName
    PluginsCall - nameBeforeWidget
    WidgetCall  - _name
    PluginsCall - nameAfterWidget
    ChildrenCallIsNeeded - name
    Events - afterName
*/<commit_msg>Skipinit for navigator like others<commit_after>define(["elaiJS/helper", "elaiJS/binder", "elaiJS/cascadeCaller",
        "elaiJS/multicallback", "elaiJS/propertiesManagerFactory",
        "elaiJS/configuration", "elaiJS/ressources", "elaiJS/mode",
        "elaiJS/navigator", "elaiJS/webservice",
        "elaiJS/defaultWebservices","elaiJS/defaultConfiguration",
        "elaiJS/theme", "elaiJS/language", "elaiJS/localisation"],
        function(helper, a, b, multicallback, c, config, d, e, navigator,
          f, defaultWebservices, defaultConfig, themeManager, lang, loc) {
  
	function initialize() {
	  loadWidgetModules();
	  
    defaultWebservices.addDefaultWebservices();
	  defaultConfig.setDefaultConfiguration(function() {
	    launchDebugMode();
	    initalizeModules(start);
	  });
	}
	
	function loadWidgetModules() {
    require([ "elaiJS/plugin", "elaiJS/widget", "elaiJS/primaryWidget",
              "elaiJS/mustacherend", "elaiJS/polymerend"]);
	}
	
	function initalizeModules(callback) {
	  initializeModule(navigator, undefined, config.elaiJS.skipNavigatorInitialization);
    
    var multiCallBackFunction = multicallback(3, callback);
    initializeModule(themeManager, multiCallBackFunction);
    initializeModule(lang, multiCallBackFunction, config.elaiJS.skipLanguageInitialization);
    initializeModule(loc, multiCallBackFunction, config.elaiJS.skipLocalisationInitialization);
	}
	
	function initializeModule(module, callback, skipInit) {
	  if(skipInit === true) {
	    if(helper.isFunction(callback))
	      callback();
      return;
	  }
	  
    module.initialize(callback);
	}
	
	function start() {
	  if(config.elaiJS.requireElaiJS)
      config.elaiJS.requireElaiJS.setConfig(config);
    
    if(console && console.timeEnd && config.elaiJS.isDebug)
      console.timeEnd("ElaiJS Start in");
	  
    if(document.dispatchEvent && CustomEvent)
      document.dispatchEvent(new CustomEvent("ElaiJSReady"));
      
    loadAppMain();
	}
	
	function loadAppMain() {
    var appModuleName = helper.getElaiJSAttribute("app");
    if(!appModuleName)
      return;
    
    require([appModuleName], function(appMain) {
      if(appMain && helper.isFunction(appMain.start))
        appMain.start();
    });
  }
  
  function launchDebugMode() {
    if(config.elaiJS.isDebug) {
      require(["elaiJS/debugManager"], function(debugManager) {
        debugManager.startDebugMode();
      });
    }
  }
  
  initialize();
  
  return {};
});

/*
  TODO:
  Promise pour webservice
  Ajouter catch Error pour les webservices
  Ajouter 'on' for binder
*/

/*
  name
    Events - beforeName
    PluginsCall - nameBeforeWidget
    WidgetCall  - _name
    PluginsCall - nameAfterWidget
    ChildrenCallIsNeeded - name
    Events - afterName
*/
{'fraction_non_alphanumeric': 0.12202380952380952, 'fraction_numerical': 0.0003720238095238095, 'mean_word_length': 3.62736660929432, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5735594', 'n_tokens_mistral': 1691, 'n_tokens_neox': 1656, 'n_words': 256}