<commit_before>hqDefine('hqwebapp/js/main', [
    "jquery",
    "knockout",
    "underscore",
    "hqwebapp/js/initial_page_data",
    "hqwebapp/js/alert_user",
    "analytix/js/google",
    "hqwebapp/js/hq_extensions.jquery",
    "jquery.cookie/jquery.cookie",
], function (
    $,
    ko,
    _,
    initialPageData,
    alertUser,
    googleAnalytics
) {
    var eventize = function (that) {
        'use strict';
        var events = {};
        that.on = function (tag, callback) {
            if (events[tag] === undefined) {
                events[tag] = [];
            }
            events[tag].push(callback);
            return that;
        };
        that.fire = function (tag, e) {
            var i;
            if (events[tag] !== undefined) {
                for (i = 0; i < events[tag].length; i += 1) {
                    events[tag][i].apply(that, [e]);
                }
            }
            return that;
        };
        return that;
    };

    var makeHqHelp = function (opts, wrap) {
        'use strict';
        wrap = wrap === undefined ? true : wrap;
        var el = $(
            '<div class="hq-help">' +
                '<a href="#" tabindex="-1">' +
                    '<i class="fa fa-question-circle icon-question-sign"></i></a></div>'
        );
        _.each(['content', 'title', 'html', 'placement', 'container'], function (attr) {
            $('a', el).data(attr, opts[attr]);
        });
        if (wrap) {
            el.hqHelp();
        }
        return el;
    };

    var transformHelpTemplate = function ($template, wrap) {
        'use strict';
        if ($template.data()) {
            var $help = makeHqHelp($template.data(), wrap);
            $help.insertAfter($template);
            $template.remove();
        }
    };

    ko.bindingHandlers.makeHqHelp = {
        update: function (element, valueAccessor) {
            var opts = valueAccessor(),
                name = ko.utils.unwrapObservable(opts.name || $(element).data('title')),
                description = ko.utils.unwrapObservable(opts.description || $(element).data('content')),
                placement = ko.utils.unwrapObservable(opts.placement || $(element).data('placement')),
                format = ko.utils.unwrapObservable(opts.format);
            $(element).find('.hq-help').remove();
            makeHqHelp({
                title: name,
                content: description,
                html: format === 'html',
                placement: placement || 'right',
            }).appendTo(element);
        },
    };

    ko.bindingHandlers.runOnInit = {
        // suggestion from https://github.com/knockout/knockout/issues/2446 to use
        // instead of an anonymous template
        init: function(elem, valueAccessor) {
            valueAccessor();
        }
    };
    ko.virtualElements.allowedBindings.runOnInit = true;

    ko.bindingHandlers.allowDescendantBindings = {
        // fixes an ssue where we try to apply bindings to a parent element<commit_msg>fix typo<commit_after>hqDefine('hqwebapp/js/main', [
    "jquery",
    "knockout",
    "underscore",
    "hqwebapp/js/initial_page_data",
    "hqwebapp/js/alert_user",
    "analytix/js/google",
    "hqwebapp/js/hq_extensions.jquery",
    "jquery.cookie/jquery.cookie",
], function (
    $,
    ko,
    _,
    initialPageData,
    alertUser,
    googleAnalytics
) {
    var eventize = function (that) {
        'use strict';
        var events = {};
        that.on = function (tag, callback) {
            if (events[tag] === undefined) {
                events[tag] = [];
            }
            events[tag].push(callback);
            return that;
        };
        that.fire = function (tag, e) {
            var i;
            if (events[tag] !== undefined) {
                for (i = 0; i < events[tag].length; i += 1) {
                    events[tag][i].apply(that, [e]);
                }
            }
            return that;
        };
        return that;
    };

    var makeHqHelp = function (opts, wrap) {
        'use strict';
        wrap = wrap === undefined ? true : wrap;
        var el = $(
            '<div class="hq-help">' +
                '<a href="#" tabindex="-1">' +
                    '<i class="fa fa-question-circle icon-question-sign"></i></a></div>'
        );
        _.each(['content', 'title', 'html', 'placement', 'container'], function (attr) {
            $('a', el).data(attr, opts[attr]);
        });
        if (wrap) {
            el.hqHelp();
        }
        return el;
    };

    var transformHelpTemplate = function ($template, wrap) {
        'use strict';
        if ($template.data()) {
            var $help = makeHqHelp($template.data(), wrap);
            $help.insertAfter($template);
            $template.remove();
        }
    };

    ko.bindingHandlers.makeHqHelp = {
        update: function (element, valueAccessor) {
            var opts = valueAccessor(),
                name = ko.utils.unwrapObservable(opts.name || $(element).data('title')),
                description = ko.utils.unwrapObservable(opts.description || $(element).data('content')),
                placement = ko.utils.unwrapObservable(opts.placement || $(element).data('placement')),
                format = ko.utils.unwrapObservable(opts.format);
            $(element).find('.hq-help').remove();
            makeHqHelp({
                title: name,
                content: description,
                html: format === 'html',
                placement: placement || 'right',
            }).appendTo(element);
        },
    };

    ko.bindingHandlers.runOnInit = {
        // suggestion from https://github.com/knockout/knockout/issues/2446 to use
        // instead of an anonymous template
        init: function(elem, valueAccessor) {
            valueAccessor();
        }
    };
    ko.virtualElements.allowedBindings.runOnInit = true;

    ko.bindingHandlers.allowDescendantBindings = {
        // fixes an issue where we try to apply bindings to a parent element
{'fraction_non_alphanumeric': 0.14816042426251244, 'fraction_numerical': 0.002320185614849188, 'mean_word_length': 1.7332427536231885, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '1452621', 'n_tokens_mistral': 1742, 'n_tokens_neox': 1695, 'n_words': 342}