<commit_before>/// <reference path="../lib2/types/angular.d.ts"/>
/// <reference path="../lib2/types/lodash.d.ts"/>
/// <reference path="../lib2/types/moment.d.ts"/>
/// <reference path="../lib2/types/leaflet.d.ts"/>
/// <reference path="./_all.d.ts"/>

import * as angular from "angular";

import * as angularAnimate from "angularAnimate";  if (angularAnimate) { ; };
import * as angularAria from "angularAria";  if (angularAria) { ; };
import * as angularMessages from "angularMessages";  if (angularMessages) { ; };
import * as angularCache from "angularCache";  if (angularCache) { ; };
import * as angularTranslate from "angularTranslate";  if (angularTranslate) { ; };
import * as angularTranslateLoader from "angularTranslateLoader";  if (angularTranslateLoader) { ; };
import * as angularElastic from "angularElastic";  if (angularElastic) { ; };
import * as angularFlow from "angularFlow";  if (angularFlow) { ; };

import * as modernizr from "modernizr";
import * as moment from "moment";
import * as webshim from "polyfiller";
import * as leaflet from "leaflet";
import * as leafletMarkerCluster from "leafletMarkerCluster";  if (leafletMarkerCluster) { ; };
import * as markdownit from "markdownit";

import * as AdhAbuseModule from "./Packages/Abuse/Module";
import * as AdhBadgeModule from "./Packages/Badge/Module";
import * as AdhCommentModule from "./Packages/Comment/Module";
import * as AdhConfigModule from "./Packages/Config/Module";
import * as AdhCrossWindowMessagingModule from "./Packages/CrossWindowMessaging/Module";
import * as AdhDateTimeModule from "./Packages/DateTime/Module";
import * as AdhDoneModule from "./Packages/Done/Module";
import * as AdhEmbedModule from "./Packages/Embed/Module";
import * as AdhEventManagerModule from "./Packages/EventManager/Module";
import * as AdhHttpModule from "./Packages/Http/Module";
import * as AdhImageModule from "./Packages/Image/Module";
import * as AdhInjectModule from "./Packages/Inject/Module";
import * as AdhListingModule from "./Packages/Listing/Module";
import * as AdhLocaleModule from "./Packages/Locale/Module";
import * as AdhMarkdownModule from "./Packages/Markdown/Module";
import * as AdhMappingModule from "./Packages/Mapping/Module";
import * as AdhMetaApiModule from "./Packages/MetaApi/Module";
import * as AdhMovingColumnsModule from "./Packages/MovingColumns/Module";
import * as AdhPermissionsModule from "./Packages/Permissions/Module";
import * as AdhPreliminaryNamesModule from "./Packages/PreliminaryNames/Module";
import * as AdhProcessModule from "./Packages/Process/Module";
import * as AdhRateModule from "./Packages/Rate/Module";
import * as AdhAngularHelpersModule from "./Packages/AngularHelpers/Module";
import * as AdhResourceAreaModule from "./Packages/ResourceArea/Module";
import * as AdhResourceWidgetsModule from "./Packages/ResourceWidgets/Module";
import * as AdhS1Module from "./Packages/S1/Module";
import * as AdhShareSocialModule from "./Packages/ShareSocial/Module";
import * as AdhStickyModule from "./Packages/Sticky/Module";
import * as AdhTopLevelStateModule from "./Packages/TopLevelState/Module";
import * as AdhTrackingModule from "./Packages/Tracking/Module";
import * as AdhUserModule from "./Packages/User/Module";
import * as AdhUserViewsModule from "./Packages/User/ViewsModule";
import * as AdhWebSocketModule from "./Packages/WebSocket/Module";

import * as AdhConfig from "./Packages/Config/Config";
import * as AdhTopLevelState from "./Packages/TopLevelState/TopLevelState";

import * as AdhTemplates from "adhTemplates";  if (AdhTemplates) { ; };

webshim.setOptions("basePath", "/static/lib/webshim/js-webshim/minified/shims/");
webshim.setOptions("forms-ext", {"replaceUI": true});
webshim.setOptions({"waitReady": false});
webshim.polyfill("forms forms-ext");

var loadComplete = () : void => {
    var w = (<any>window);
    w.adhocracy = w.adhocracy || {};
    w.adhocracy.loadState = "complete";
};


export var init = (config : AdhConfig.IService, metaApi) => {
    "use strict";

    // detect wheter we are running in iframe
    config.embedded = (window !== top);
    if (config.embedded) {
        window.document.body.className += " is-embedded";
    }

    var appDependencies = [
        "monospaced.elastic",
        "pascalprecht.translate",
        "ngAnimate",
        "ngAria",
        "ngMessages",
        "flow",
        AdhCommentModule.moduleName,
        AdhConfigModule.moduleName,
        AdhDoneModule.moduleName,
        AdhCrossWindowMessagingModule.moduleName,
        AdhEmbedModule.moduleName,
        AdhResourceAreaModule.moduleName,
        AdhStickyModule.moduleName,
        AdhTrackingModule.moduleName,
        AdhUserViewsModule.moduleName,
        AdhMarkdownModule.moduleName,
        AdhS1Module.moduleName
    ];

    if (config.cachebust) {
        appDependencies.push("templates");
    }

    var app = angular.module("a3", appDependencies);

    app.config(["adhTopLevelStateProvider", (adhTopLevelStateProvider : AdhTopLevelState.Provider) => {
        adhTopLevelStateProvider
            .when("", ["$location", ($location) : AdhTopLevelState.IAreaInput => {
                if (config.redirect_url !== "/") {
                    $location.replace();
                    $location.path(config.redirect_url);
                }
                return {
                    skip: true
                };
            }])
            .otherwise(() : AdhTopLevelState.IAreaInput => {
                return {
                    template: "<adh-header></adh-header><div class=\"l-content\"><h1>404 - Not Found</h1></div>"
                };
            });
    }]);
    app.config(["$compileProvider", ($compileProvider) => {
        $compileProvider.debugInfoEnabled(config.debug);
    }]);
    app.config(["$locationProvider", ($locationProvider) => {
        // Make sure HTML5 history API works.  (If support for older
        // browsers is required, we may have to study angular support
        // for conversion between history API and #!-URLs.  See
        // angular documentation for details.)
        $locationProvider.html5Mode(true);
    }]);
    app.config(["$translateProvider", ($translateProvider) => {
         $translateProvider.useStaticFilesLoader({
            files: [{
                prefix: "/static/i18n/core_",
                suffix: config.cachebust ? ".json?" + config.cachebust_suffix : ".json"
            }, {
                prefix: "/static/i18n/countries_",
                suffix: config.cachebust ? ".json?" + config.cachebust_suffix : ".json"
            }, {
                prefix: "/static/i18n/s1_",
                suffix: config.cachebust ? ".json?" + config.cachebust_suffix : ".json"
            }]
        });
        $translateProvider.useSanitizeValueStrategy("escape");
        $translateProvider.preferredLanguage(config.locale);
        $translateProvider.fallbackLanguage("en");
    }]);
    app.config(["$ariaProvider", ($ariaProvider) => {
        $ariaProvider.config({
            tabindex: false
        });
    }]);

    app.value("angular", angular);
    app.value("modernizr", modernizr);
    app.value("moment", moment);
    app.value("leaflet", leaflet);
    app.value("markdownit", markdownit);
    app.value("angularFlow", angularFlow);

    // register our modules
    AdhAbuseModule.register(angular);
    AdhBadgeModule.register(angular);
    AdhCommentModule.register(angular);
    AdhConfigModule.register(angular, config);
    AdhCrossWindowMessagingModule.register(angular);
    AdhDateTimeModule.register(angular);
    AdhDoneModule.register(angular);
    AdhEmbedModule.register(angular);
    AdhEventManagerModule.register(angular);
    AdhHttpModule.register(angular, config);
    AdhImageModule.register(angular);
    AdhInjectModule.register(angular);
    AdhListingModule.register(angular);
    AdhLocaleModule.register(angular);
    AdhMappingModule.register(angular);
    AdhMarkdownModule.register(angular);
    AdhMetaApiModule.register(angular, metaApi);
    AdhMovingColumnsModule.register(angular);
    AdhPermissionsModule.register(angular);
    AdhPreliminaryNamesModule.register(angular);
    AdhProcessModule.register(angular);
    AdhRateModule.register(angular);
    AdhAngularHelpersModule.register(angular);
    AdhResourceAreaModule.register(angular);
    AdhResourceWidgetsModule.register(angular);
    AdhS1Module.register(angular);
    AdhShareSocialModule.register(angular);
    AdhStickyModule.register(angular);
    AdhTopLevelStateModule.register(angular);
    AdhTrackingModule.register(angular);
    AdhUserModule.register(angular);
    AdhUserViewsModule.register(angular);
    AdhWebSocketModule.register(angular);

    // force-load some services
    var injector = angular.bootstrap(document.body, ["a3"], {strictDi: true});
    injector.get("adhCrossWindowMessaging");

    loadComplete();
};<commit_msg>register ResourceActions in s1<commit_after>/// <reference path="../lib2/types/angular.d.ts"/>
/// <reference path="../lib2/types/lodash.d.ts"/>
/// <reference path="../lib2/types/moment.d.ts"/>
/// <reference path="../lib2/types/leaflet.d.ts"/>
/// <reference path="./_all.d.ts"/>

import * as angular from "angular";

import * as angularAnimate from "angularAnimate";  if (angularAnimate) { ; };
import * as angularAria from "angularAria";  if (angularAria) { ; };
import * as angularMessages from "angularMessages";  if (angularMessages) { ; };
import * as angularCache from "angularCache";  if (angularCache) { ; };
import * as angularTranslate from "angularTranslate";  if (angularTranslate) { ; };
import * as angularTranslateLoader from "angularTranslateLoader";  if (angularTranslateLoader) { ; };
import * as angularElastic from "angularElastic";  if (angularElastic) { ; };
import * as angularFlow from "angularFlow";  if (angularFlow) { ; };

import * as modernizr from "modernizr";
import * as moment from "moment";
import * as webshim from "polyfiller";
import * as leaflet from "leaflet";
import * as leafletMarkerCluster from "leafletMarkerCluster";  if (leafletMarkerCluster) { ; };
import * as markdownit from "markdownit";

import * as AdhAbuseModule from "./Packages/Abuse/Module";
import * as AdhBadgeModule from "./Packages/Badge/Module";
import * as AdhCommentModule from "./Packages/Comment/Module";
import * as AdhConfigModule from "./Packages/Config/Module";
import * as AdhCrossWindowMessagingModule from "./Packages/CrossWindowMessaging/Module";
import * as AdhDateTimeModule from "./Packages/DateTime/Module";
import * as AdhDoneModule from "./Packages/Done/Module";
import * as AdhEmbedModule from "./Packages/Embed/Module";
import * as AdhEventManagerModule from "./Packages/EventManager/Module";
import * as AdhHttpModule from "./Packages/Http/Module";
import * as AdhImageModule from "./Packages/Image/Module";
import * as AdhInjectModule from "./Packages/Inject/Module";
import * as AdhListingModule from "./Packages/Listing/Module";
import * as AdhLocaleModule from "./Packages/Locale/Module";
import * as AdhMarkdownModule from "./Packages/Markdown/Module";
import * as AdhMappingModule from "./Packages/Mapping/Module";
import * as AdhMetaApiModule from "./Packages/MetaApi/Module";
import * as AdhMovingColumnsModule from "./Packages/MovingColumns/Module";
import * as AdhPermissionsModule from "./Packages/Permissions/Module";
import * as AdhPreliminaryNamesModule from "./Packages/PreliminaryNames/Module";
import * as AdhProcessModule from "./Packages/Process/Module";
import * as AdhRateModule from "./Packages/Rate/Module";
import * as AdhAngularHelpersModule from "./Packages/AngularHelpers/Module";
import * as AdhResourceActionsModule from "./Packages/ResourceActions/Module";
import * as AdhResourceAreaModule from "./Packages/ResourceArea/Module";
import * as AdhResourceWidgetsModule from "./Packages/ResourceWidgets/Module";
import * as AdhS1Module from "./Packages/S1/Module";
import * as AdhShareSocialModule from "./Packages/ShareSocial/Module";
import * as AdhStickyModule from "./Packages/Sticky/Module";
import * as AdhTopLevelStateModule from "./Packages/TopLevelState/Module";
import * as AdhTrackingModule from "./Packages/Tracking/Module";
import * as AdhUserModule from "./Packages/User/Module";
import * as AdhUserViewsModule from "./Packages/User/ViewsModule";
import * as AdhWebSocketModule from "./Packages/WebSocket/Module";

import * as AdhConfig from "./Packages/Config/Config";
import * as AdhTopLevelState from "./Packages/TopLevelState/TopLevelState";

import * as AdhTemplates from "adhTemplates";  if (AdhTemplates) { ; };

webshim.setOptions("basePath", "/static/lib/webshim/js-webshim/minified/shims/");
webshim.setOptions("forms-ext", {"replaceUI": true});
webshim.setOptions({"waitReady": false});
webshim.polyfill("forms forms-ext");

var loadComplete = () : void => {
    var w = (<any>window);
    w.adhocracy = w.adhocracy || {};
    w.adhocracy.loadState = "complete";
};


export var init = (config : AdhConfig.IService, metaApi) => {
    "use strict";

    // detect wheter we are running in iframe
    config.embedded = (window !== top);
    if (config.embedded) {
        window.document.body.className += " is-embedded";
    }

    var appDependencies = [
        "monospaced.elastic",
        "pascalprecht.translate",
        "ngAnimate",
        "ngAria",
        "ngMessages",
        "flow",
        AdhCommentModule.moduleName,
        AdhConfigModule.moduleName,
        AdhDoneModule.moduleName,
        AdhCrossWindowMessagingModule.moduleName,
        AdhEmbedModule.moduleName,
        AdhResourceActionsModule.moduleName,
        AdhResourceAreaModule.moduleName,
        AdhStickyModule.moduleName,
        AdhTrackingModule.moduleName,
        AdhUserViewsModule.moduleName,
        AdhMarkdownModule.moduleName,
        AdhS1Module.moduleName
    ];

    if (config.cachebust) {
        appDependencies.push("templates");
    }

    var app = angular.module("a3", appDependencies);

    app.config(["adhTopLevelStateProvider", (adhTopLevelStateProvider : AdhTopLevelState.Provider) => {
        adhTopLevelStateProvider
            .when("", ["$location", ($location) : AdhTopLevelState.IAreaInput => {
                if (config.redirect_url !== "/") {
                    $location.replace();
                    $location.path(config.redirect_url);
                }
                return {
                    skip: true
                };
            }])
            .otherwise(() : AdhTopLevelState.IAreaInput => {
                return {
                    template: "<adh-header></adh-header><div class=\"l-content\"><h1>404 - Not Found</h1></div>"
                };
            });
    }]);
    app.config(["$compileProvider", ($compileProvider) => {
        $compileProvider.debugInfoEnabled(config.debug);
    }]);
    app.config(["$locationProvider", ($locationProvider) => {
        // Make sure HTML5 history API works.  (If support for older
        // browsers is required, we may have to study angular support
        // for conversion between history API and #!-URLs.  See
        // angular documentation for details.)
        $locationProvider.html5Mode(true);
    }]);
    app.config(["$translateProvider", ($translateProvider) => {
         $translateProvider.useStaticFilesLoader({
            files: [{
                prefix: "/static/i18n/core_",
                suffix: config.cachebust ? ".json?" + config.cachebust_suffix : ".json"
            }, {
                prefix: "/static/i18n/countries_",
                suffix: config.cachebust ? ".json?" + config.cachebust_suffix : ".json"
            }, {
                prefix: "/static/i18n/s1_",
                suffix: config.cachebust ? ".json?" + config.cachebust_suffix : ".json"
            }]
        });
        $translateProvider.useSanitizeValueStrategy("escape");
        $translateProvider.preferredLanguage(config.locale);
        $translateProvider.fallbackLanguage("en");
    }]);
    app.config(["$ariaProvider", ($ariaProvider) => {
        $ariaProvider.config({
            tabindex: false
        });
    }]);

    app.value("angular", angular);
    app.value("modernizr", modernizr);
    app.value("moment", moment);
    app.value("leaflet", leaflet);
    app.value("markdownit", markdownit);
    app.value("angularFlow", angularFlow);

    // register our modules
    AdhAbuseModule.register(angular);
    AdhBadgeModule.register(angular);
    AdhCommentModule.register(angular);
    AdhConfigModule.register(angular, config);
    AdhCrossWindowMessagingModule.register(angular);
    AdhDateTimeModule.register(angular);
    AdhDoneModule.register(angular);
    AdhEmbedModule.register(angular);
    AdhEventManagerModule.register(angular);
    AdhHttpModule.register(angular, config);
    AdhImageModule.register(angular);
    AdhInjectModule.register(angular);
    AdhListingModule.register(angular);
    AdhLocaleModule.register(angular);
    AdhMappingModule.register(angular);
    AdhMarkdownModule.register(angular);
    AdhMetaApiModule.register(angular, metaApi);
    AdhMovingColumnsModule.register(angular);
    AdhPermissionsModule.register(angular);
    AdhPreliminaryNamesModule.register(angular);
    AdhProcessModule.register(angular);
    AdhRateModule.register(angular);
    AdhAngularHelpersModule.register(angular);
    AdhResourceActionsModule.register(angular);
    AdhResourceAreaModule.register(angular);
    AdhResourceWidgetsModule.register(angular);
    AdhS1Module.register(angular);
    AdhShareSocialModule.register(angular);
    AdhStickyModule.register(angular);
    AdhTopLevelStateModule.register(angular);
    AdhTrackingModule.register(angular);
    AdhUserModule.register(angular);
    AdhUserViewsModule.register(angular);
    AdhWebSocketModule.register(angular);

    // force-load some services
    var injector = angular.bootstrap(document.body, ["a3"], {strictDi: true});
    injector.get("adhCrossWindowMessaging");

    loadComplete();
};
{'fraction_non_alphanumeric': 0.1313990328497582, 'fraction_numerical': 0.0027235840142293367, 'mean_word_length': 3.5297079556898288, 'pattern_counts': {'":': 4, '<': 27, '<?xml version=': 0, '>': 45, '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': '797725', 'n_tokens_mistral': 5268, 'n_tokens_neox': 5131, 'n_words': 1028}