{{# uglify }}
/*jslint browser: true, es5: true*/
/*global jQuery */
(function (window, angular) {
    'use strict';

    function Constants() {
        var constants = {};
        try {
            {{# each stache.config.angular.constants }}
                constants['{{{ @key }}}'] = {{{ json this }}};
            {{/ each }}
        }
        catch (e) {}
        return constants;
    }

    function Run($rootScope, bbWait) {
        $rootScope.$on('bbBeginWait', function (e, opts) {
          e.stopPropagation();
          bbWait.beginPageWait(opts);
        });
        $rootScope.$on('bbEndWait', function (e, opts) {
          e.stopPropagation();
          bbWait.endPageWait(opts);
        });
    }

    Run.$inject = [
        '$rootScope',
        'bbWait'
    ];

    angular.module('stache')
        .constant('stacheConfig', Constants.call())
        .run(Run);
    angular.element(document).ready(function () {
        angular.bootstrap(document, [{{# each stache.config.modules  }}
            '{{ this }}'{{# unless @last }},{{/ unless }}{{/ each }}
        ]);
    });

}(window, window.angular));
{{/ uglify }}
