<commit_before>﻿    var connectorPaintStyle = {
        lineWidth: 2,
        strokeStyle: "#999",
        joinstyle: "round",
        //outlineColor: "white",
        //outlineWidth: 7
    };

    var connectorHoverStyle = {
        lineWidth: 2,
        strokeStyle: "#225588"
    };

    var sourceEndpointOptions = {
        endpoint: ["Dot", { cssClass: 'sourceEndpoint', radius: 5 }],
        paintStyle: { fillStyle: '#225588' },
        isSource: true,
        isTarget: false,
        deleteEndpointsOnDetach: false,
        connector: ["Flowchart"], // gap needs to be the same as makeTarget.paintStyle.radius
        connectorStyle: connectorPaintStyle,
        hoverPaintStyle: connectorHoverStyle,
        connectorHoverStyle: connectorHoverStyle,
        overlays: [["Label", { location: [3, -1.5], cssClass: "sourceEndpointLabel" }]]
    };

    jsPlumb.bind("ready", function () {

        jsPlumb.importDefaults({
            Anchor : "Continuous",
            // default drag options
            DragOptions: { cursor: 'pointer', zIndex: 2000 },
            // default to blue at one end and green at the other
            EndpointStyles: [{ fillStyle: '#225588' }],
            // blue endpoints 7 px; Blank endpoints.
            Endpoints: [["Dot", { radius: 7 }], ["Blank"]],
            // the overlays to decorate each connection with.  note that the label overlay uses a function to generate the label text; in this
            // case it returns the 'labelText' member that we set on each connection in the 'init' method below.
            ConnectionOverlays: [
                ["Arrow", { width: 12, length: 12, location: -5 }],
                // ["Label", { location: 0.1, id: "label", cssClass: "aLabel" }]
            ],
            ConnectorZIndex: 5
        });

        // updates the state of any edited activity
        updateActivities(localId);

        // deserialize the previously locally saved workflow
        loadActivities(localId);
        
        // create activity toolbar for controlling their states
        createToolbar();

        // a new connection is created
        jsPlumb.bind("jsPlumbConnection", function (connectionInfo) {
            // ...update your data model here.  The contents of the 'connectionInfo' are described below.
        });

        // a connection is detached
        jsPlumb.bind("jsPlumbConnectionDetached", function (connectionInfo) {
            // ...update your data model here.  The contents of the 'connectionInfo' are described below.
        });

    });

    // instanciates a new workflow widget in the editor
    var createActivity = function (activityName, top, left) {
        return renderActivity(null, -1, activityName, {}, false, top, left);
    };

    
    // create a new activity node on the editor
    $('.activity-toolbox-item').draggable({ helper: 'clone' });
    $('#activity-editor').droppable({ drop: function(event, ui) {
        var activityName = ui.draggable.data('activity-name');
        if (activityName && activityName.length) {
            var offset = $(this).offset();
            if (displaySaveMessage()) {
                createActivity(activityName, event.pageY - offset.top - 40, event.pageX - offset.left); /* The displaySaveMessage's height is 40px */
            }
            else {
                createActivity(activityName, event.pageY - offset.top, event.pageX - offset.left);
            }
        }
        if (displaySaveMessage()) {
            var activityPosition = ui.position;
            activityPosition.top += 40; /* The displaySaveMessage's height is 40px */
        }
    }
    });

    $("#search-box").focus().on("keyup", function (e) {
        var text = $(this).val();
        if (text == "") {
            $(".activity-toolbox-item").show();
        } else {
            var lowerCaseText = text.toLowerCase();
            $(".activity-toolbox-item").each(function () {
                var recordText = $(this).data("activity-text").toLowerCase();
                $(this).toggle(recordText.indexOf(lowerCaseText) >= 0);
            });
        }
    });

    var renderActivity = function (clientId, id, name, state, start, top, left) {

        $.ajax({
            type: 'POST',
            url: renderActivityUrl,
            data: { name: name, state: state, __RequestVerificationToken: requestAntiForgeryToken },
            async: false,
            success: function(data) {
                var dom = $($.parseHTML($.trim(data)));

                if (dom == null) {
                    return null;
                }
<commit_msg>Fixed activity toolbox filtering.<commit_after>﻿    var connectorPaintStyle = {
        lineWidth: 2,
        strokeStyle: "#999",
        joinstyle: "round",
        //outlineColor: "white",
        //outlineWidth: 7
    };

    var connectorHoverStyle = {
        lineWidth: 2,
        strokeStyle: "#225588"
    };

    var sourceEndpointOptions = {
        endpoint: ["Dot", { cssClass: 'sourceEndpoint', radius: 5 }],
        paintStyle: { fillStyle: '#225588' },
        isSource: true,
        isTarget: false,
        deleteEndpointsOnDetach: false,
        connector: ["Flowchart"], // gap needs to be the same as makeTarget.paintStyle.radius
        connectorStyle: connectorPaintStyle,
        hoverPaintStyle: connectorHoverStyle,
        connectorHoverStyle: connectorHoverStyle,
        overlays: [["Label", { location: [3, -1.5], cssClass: "sourceEndpointLabel" }]]
    };

    jsPlumb.bind("ready", function () {

        jsPlumb.importDefaults({
            Anchor : "Continuous",
            // default drag options
            DragOptions: { cursor: 'pointer', zIndex: 2000 },
            // default to blue at one end and green at the other
            EndpointStyles: [{ fillStyle: '#225588' }],
            // blue endpoints 7 px; Blank endpoints.
            Endpoints: [["Dot", { radius: 7 }], ["Blank"]],
            // the overlays to decorate each connection with.  note that the label overlay uses a function to generate the label text; in this
            // case it returns the 'labelText' member that we set on each connection in the 'init' method below.
            ConnectionOverlays: [
                ["Arrow", { width: 12, length: 12, location: -5 }],
                // ["Label", { location: 0.1, id: "label", cssClass: "aLabel" }]
            ],
            ConnectorZIndex: 5
        });

        // updates the state of any edited activity
        updateActivities(localId);

        // deserialize the previously locally saved workflow
        loadActivities(localId);
        
        // create activity toolbar for controlling their states
        createToolbar();

        // a new connection is created
        jsPlumb.bind("jsPlumbConnection", function (connectionInfo) {
            // ...update your data model here.  The contents of the 'connectionInfo' are described below.
        });

        // a connection is detached
        jsPlumb.bind("jsPlumbConnectionDetached", function (connectionInfo) {
            // ...update your data model here.  The contents of the 'connectionInfo' are described below.
        });

    });

    // instanciates a new workflow widget in the editor
    var createActivity = function (activityName, top, left) {
        return renderActivity(null, -1, activityName, {}, false, top, left);
    };

    
    // create a new activity node on the editor
    $('.activity-toolbox-item').draggable({ helper: 'clone' });
    $('#activity-editor').droppable({ drop: function(event, ui) {
        var activityName = ui.draggable.data('activity-name');
        if (activityName && activityName.length) {
            var offset = $(this).offset();
            if (displaySaveMessage()) {
                createActivity(activityName, event.pageY - offset.top - 40, event.pageX - offset.left); /* The displaySaveMessage's height is 40px */
            }
            else {
                createActivity(activityName, event.pageY - offset.top, event.pageX - offset.left);
            }
        }
        if (displaySaveMessage()) {
            var activityPosition = ui.position;
            activityPosition.top += 40; /* The displaySaveMessage's height is 40px */
        }
    }
    });

    $("#search-box").focus().on("keyup", function (e) {
        var text = $(this).val();
        if (text == "") {
            $(".activity-toolbox-item").show();
        } else {
            var lowerCaseText = text.toLowerCase();
            $(".activity-toolbox-item").each(function () {
                var recordText = $(this).data("activity-name").toLowerCase();
                $(this).toggle(recordText.indexOf(lowerCaseText) >= 0);
            });
        }
    });

    var renderActivity = function (clientId, id, name, state, start, top, left) {

        $.ajax({
            type: 'POST',
            url: renderActivityUrl,
            data: { name: name, state: state, __RequestVerificationToken: requestAntiForgeryToken },
            async: false,
            success: function(data) {
                var dom = $($.parseHTML($.trim(data)));

                if (dom == null) {
                    return null;
                }

{'fraction_non_alphanumeric': 0.12402173913043478, 'fraction_numerical': 0.011304347826086957, 'mean_word_length': 2.001957585644372, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3404095', 'n_tokens_mistral': 2528, 'n_tokens_neox': 2380, 'n_words': 695}