<commit_before>﻿var currentSelection = null;
var currentResult = null;
var useSolutionExplorer = /*USE_SOLUTION_EXPLORER*/true/*USE_SOLUTION_EXPLORER*/;
var anchorSplitChar = ",";

var externalUrlMap = [
    /*EXTERNAL_URL_MAP*/"https://referencesource.microsoft.com/", "http://sourceroslyn.io/"/*EXTERNAL_URL_MAP*/
];

var supportedFileExtensions = [
    "cs",
    "vb",
    "ts",
    "csproj",
    "vbproj",
    "targets",
    "props",
    "xaml",
    "xml",
    "resx"
];

function redirectLocation(frame, newLocation) {
    if (frame.location.href == newLocation) {
        return;
    }

    frame.location.replace(newLocation);
}

function setHash(newHash) {
    if (newHash.charAt(0) == '#') {
        newHash = newHash.slice(1);
    }

    top.history.replaceState(null, top.document.title, '#' + newHash);
}

function onHashChanged(e) {
    processHash();
}

function populateSearchBox(text) {
    ensureSearchBox();
    searchBox.focus();
    searchBox.value = text;
    searchBox.onkeyup();
}

function processHash() {
    var anchor = document.location.hash;
    if (anchor) {
        anchor = anchor.slice(1);

        if (!anchor) {
            if (top.location.pathname != "/") {
                redirectLocation(top, "/");
            }

            return;
        }

        if (startsWithIgnoreCase(anchor, "MSBuildProperty=")) {
            redirectLocation(n, "/MSBuildProperties/R/" + anchor.slice("MSBuildProperty=".length) + ".html");
            return;
        }

        if (startsWithIgnoreCase(anchor, "MSBuildItem=")) {
            redirectLocation(n, "/MSBuildItems/R/" + anchor.slice("MSBuildItem=".length) + ".html");
            return;
        }

        if (startsWithIgnoreCase(anchor, "MSBuildTarget=")) {
            redirectLocation(n, "/MSBuildTargets/R/" + anchor.slice("MSBuildTarget=".length) + ".html");
            return;
        }

        if (startsWithIgnoreCase(anchor, "MSBuildTask=")) {
            redirectLocation(n, "/MSBuildTasks/R/" + anchor.slice("MSBuildTask=".length) + ".html");
            return;
        }

        if (startsWithIgnoreCase(anchor, "EmptyArrayAllocation")) {
            redirectLocation(n, "/mscorlib/R/EmptyArrayAllocation.html");
            return;
        }

        if (startsWith(anchor, "q=")) {
            anchor = anchor.slice(2);
            anchor = unescape(anchor);
            populateSearchBox(anchor);
            return;
        }

        var hashParts = anchor.split(anchorSplitChar);
        if (anchor.indexOf(anchorSplitChar) == -1 && anchor.indexOf("#") > -1) {
            // keep old URLs working for compat
            hashParts = anchor.split("#");
        }

        var potentialFile = anchor;
        var entireAnchorIsFile = true;
        var specialAnchorType = "";
        var hashOrLine = "";
        if (hashParts.length > 1) {
            var lastPart = hashParts[hashParts.length - 1];
            if (lastPart == "references" || lastPart == "namespaces") {
                specialAnchorType = hashParts.pop();
                entireAnchorIsFile = false;
            }
            lastPart = hashParts[hashParts.length - 1];
            var lineNumberRegex = new RegExp("^\\d+$");
            var hashRegex = new RegExp("^[0-9a-f]{16}$")
            if (lineNumberRegex.test(lastPart) || hashRegex.test(lastPart)) {
                hashOrLine = hashParts.pop();
                entireAnchorIsFile = false;
            }
            potentialFile = hashParts.join(anchorSplitChar);
        }

        potentialFile = decodeURIComponent(potentialFile);

        if (potentialFile.charAt(0) == "/") {
            potentialFile = potentialFile.slice(1);
        }

        if (potentialFile.charAt(potentialFile.length - 1) == "/") {
            potentialFile = potentialFile.slice(0, potentialFile.length - 1);
        }

        if (isFile(potentialFile)) {
            var fileUrl = potentialFile;

            if (!endsWithIgnoreCase(fileUrl, ".html")) {
                fileUrl = fileUrl + ".html";
            }

            if (hashOrLine) {
                fileUrl = fileUrl + "#" + createSafeLineNumber(hashOrLine);
            }

            redirectLocation(s, fileUrl);

            var pathParts = potentialFile.split("/");
            if (pathParts.length > 1) {
                if (specialAnchorType == "references") {
                    redirectLocation(n, "/" + pathParts[0] + "/R/" + hashOrLine + ".html");
                }
                else {
                    if (pathParts[0] != "MSBuildFiles" && pathParts[0] != "TypeScriptFiles") {
                        redirectLocation(n, "/" + pathParts[0] + "/ProjectExplorer.html");
                    }
                }
            }
        } else if (entireAnchorIsFile && potentialFile.indexOf("/") == -1) {
            redirectLocation(n, "/" + potentialFile + "/ProjectExplorer.html");<commit_msg>Make sure fileUrl is rooted before redirecting.<commit_after>﻿var currentSelection = null;
var currentResult = null;
var useSolutionExplorer = /*USE_SOLUTION_EXPLORER*/true/*USE_SOLUTION_EXPLORER*/;
var anchorSplitChar = ",";

var externalUrlMap = [
    /*EXTERNAL_URL_MAP*/"https://referencesource.microsoft.com/", "http://sourceroslyn.io/"/*EXTERNAL_URL_MAP*/
];

var supportedFileExtensions = [
    "cs",
    "vb",
    "ts",
    "csproj",
    "vbproj",
    "targets",
    "props",
    "xaml",
    "xml",
    "resx"
];

function redirectLocation(frame, newLocation) {
    if (frame.location.href == newLocation) {
        return;
    }

    frame.location.replace(newLocation);
}

function setHash(newHash) {
    if (newHash.charAt(0) == '#') {
        newHash = newHash.slice(1);
    }

    top.history.replaceState(null, top.document.title, '#' + newHash);
}

function onHashChanged(e) {
    processHash();
}

function populateSearchBox(text) {
    ensureSearchBox();
    searchBox.focus();
    searchBox.value = text;
    searchBox.onkeyup();
}

function processHash() {
    var anchor = document.location.hash;
    if (anchor) {
        anchor = anchor.slice(1);

        if (!anchor) {
            if (top.location.pathname != "/") {
                redirectLocation(top, "/");
            }

            return;
        }

        if (startsWithIgnoreCase(anchor, "MSBuildProperty=")) {
            redirectLocation(n, "/MSBuildProperties/R/" + anchor.slice("MSBuildProperty=".length) + ".html");
            return;
        }

        if (startsWithIgnoreCase(anchor, "MSBuildItem=")) {
            redirectLocation(n, "/MSBuildItems/R/" + anchor.slice("MSBuildItem=".length) + ".html");
            return;
        }

        if (startsWithIgnoreCase(anchor, "MSBuildTarget=")) {
            redirectLocation(n, "/MSBuildTargets/R/" + anchor.slice("MSBuildTarget=".length) + ".html");
            return;
        }

        if (startsWithIgnoreCase(anchor, "MSBuildTask=")) {
            redirectLocation(n, "/MSBuildTasks/R/" + anchor.slice("MSBuildTask=".length) + ".html");
            return;
        }

        if (startsWithIgnoreCase(anchor, "EmptyArrayAllocation")) {
            redirectLocation(n, "/mscorlib/R/EmptyArrayAllocation.html");
            return;
        }

        if (startsWith(anchor, "q=")) {
            anchor = anchor.slice(2);
            anchor = unescape(anchor);
            populateSearchBox(anchor);
            return;
        }

        var hashParts = anchor.split(anchorSplitChar);
        if (anchor.indexOf(anchorSplitChar) == -1 && anchor.indexOf("#") > -1) {
            // keep old URLs working for compat
            hashParts = anchor.split("#");
        }

        var potentialFile = anchor;
        var entireAnchorIsFile = true;
        var specialAnchorType = "";
        var hashOrLine = "";
        if (hashParts.length > 1) {
            var lastPart = hashParts[hashParts.length - 1];
            if (lastPart == "references" || lastPart == "namespaces") {
                specialAnchorType = hashParts.pop();
                entireAnchorIsFile = false;
            }
            lastPart = hashParts[hashParts.length - 1];
            var lineNumberRegex = new RegExp("^\\d+$");
            var hashRegex = new RegExp("^[0-9a-f]{16}$")
            if (lineNumberRegex.test(lastPart) || hashRegex.test(lastPart)) {
                hashOrLine = hashParts.pop();
                entireAnchorIsFile = false;
            }
            potentialFile = hashParts.join(anchorSplitChar);
        }

        potentialFile = decodeURIComponent(potentialFile);

        if (potentialFile.charAt(0) == "/") {
            potentialFile = potentialFile.slice(1);
        }

        if (potentialFile.charAt(potentialFile.length - 1) == "/") {
            potentialFile = potentialFile.slice(0, potentialFile.length - 1);
        }

        if (isFile(potentialFile)) {
            var fileUrl = potentialFile;

            if (!endsWithIgnoreCase(fileUrl, ".html")) {
                fileUrl = fileUrl + ".html";
            }

            if (hashOrLine) {
                fileUrl = fileUrl + "#" + createSafeLineNumber(hashOrLine);
            }

            redirectLocation(s, "/" + fileUrl);

            var pathParts = potentialFile.split("/");
            if (pathParts.length > 1) {
                if (specialAnchorType == "references") {
                    redirectLocation(n, "/" + pathParts[0] + "/R/" + hashOrLine + ".html");
                }
                else {
                    if (pathParts[0] != "MSBuildFiles" && pathParts[0] != "TypeScriptFiles") {
                        redirectLocation(n, "/" + pathParts[0] + "/ProjectExplorer.html");
                    }
                }
            }
        } else if (entireAnchorIsFile && potentialFile.indexOf("/") == -1) {
            redirectLocation(n, "/" + potentialFile + "/ProjectExplorer.html");
{'fraction_non_alphanumeric': 0.14202810018326206, 'fraction_numerical': 0.004886988393402566, 'mean_word_length': 1.9939042974702834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3299918', 'n_tokens_mistral': 2887, 'n_tokens_neox': 2773, 'n_words': 485}