<commit_before>/************
* Countly Web SDK
* https://github.com/Countly/countly-sdk-web
************/

/**
 * Countly object to manage the internal queue and send requests to Countly server. More information on {@link http://resources.count.ly/docs/countly-sdk-for-web}
 * @name Countly
 * @global
 * @namespace Countly
 * @example <caption>SDK integration</caption>
 * <script type='text/javascript'>
 *   
 * //some default pre init
 * var Countly = Countly || {};
 * Countly.q = Countly.q || [];
 * 
 * //provide your app key that you retrieved from Countly dashboard
 * Countly.app_key = "YOUR_APP_KEY";
 * 
 * //provide your server IP or name. Use try.count.ly for EE trial server.
 * //if you use your own server, make sure you have https enabled if you use
 * //https below.
 * Countly.url = "https://yourdomain.com"; 
 * 
 * //start pushing function calls to queue
 * //track sessions automatically
 * Countly.q.push(['track_sessions']);
 *   
 * //track sessions automatically
 * Countly.q.push(['track_pageview']);
 *   
 * //load countly script asynchronously
 * (function() {
 *  var cly = document.createElement('script'); cly.type = 'text/javascript'; 
 *  cly.async = true;
 *  //enter url of script here
 *  cly.src = 'https://cdn.jsdelivr.net/countly-sdk-web/latest/countly.min.js';
 *  cly.onload = function(){Countly.init()};
 *  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(cly, s);
 * })();
 * </script>
 */
(function (Countly) {
    'use strict';
    
    var SDK_VERSION = "16.12";
    var SDK_NAME = "javascript_native_web";

    var inited = false,
        sessionStarted = false,
        apiPath = "/i",
        beatInterval = 500,
        queueSize = 1000,
        requestQueue = [],
        eventQueue = [],
        crashLogs = [],
        timedEvents = {},
        ignoreReferrers = [],
        crashSegments = null,
        autoExtend = true,
        lastBeat,
        storedDuration = 0,
        lastView = null,
        lastViewTime = 0,
        lastViewStoredDuration = 0,
        failTimeout = 0,
        failTimeoutAmount = 60,
        inactivityTime = 20,
        inactivityCounter = 0,
        sessionUpdate = 60,
        maxEventBatch = 10,
        lastMsTs = 0,
        readyToProcess = true,
        platform,
        urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
        searchBotRE = /(CountlySiteBot|nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver|bingbot|Google Web Preview|Mediapartners-Google|AdsBot-Google|Baiduspider|Ezooms|YahooSeeker|AltaVista|AVSearch|Mercator|Scooter|InfoSeek|Ultraseek|Lycos|Wget|YandexBot|Yandex|YaDirectFetcher|SiteBot|Exabot|AhrefsBot|MJ12bot|TurnitinBot|magpie-crawler|Nutch Crawler|CMS Crawler|rogerbot|Domnutch|ssearch_bot|XoviBot|netseer|digincore|fr-crawler|wesee|AliasIO)/,
        trackTime = true,
        startTime;

/**
 * Initialize Countly object
 * @param {Object} conf - Countly initialization {@link Init} object with configuration options
 * @param {string} conf.app_key - app key for your app created in Countly
 * @param {string} conf.device_id - to identify a visitor, will be auto generated if not provided
 * @param {string} conf.url - your Countly server url, you can use your server URL or IP here
 * @param {string} [conf.app_version=0.0] - the version of your app or website
 * @param {string=} conf.country_code - country code for your visitor
 * @param {string=} conf.city - name of the city of your visitor
 * @param {string=} conf.ip_address - ip address of your visitor
 * @param {boolean} [conf.debug=false] - output debug info into console
 * @param {boolean} [conf.ignore_bots=true] - option to ignore traffic from bots
 * @param {number} [conf.interval=500] - set an interval how often to check if there is any data to report and report it in miliseconds
 * @param {number} [conf.queue_size=1000] - maximum amount of queued requests to store
 * @param {number} [conf.fail_timeout=60] - set time in seconds to wait after failed connection to server in seconds
 * @param {number} [conf.inactivity_time=20] - after how many minutes user should be counted as inactive, if he did not perform any actions, as mouse move, scroll or keypress
 * @param {number} [conf.session_update=60] - how often in seconds should session be extended
 * @param {number} [conf.max_events=10] - maximum amount of events to send in one batch
 * @param {array=} conf.ignore_referrers - array with referrers to ignore
 * @param {boolean} [conf.ignore_prefetch=true] - ignore prefetching and pre rendering from counting as real website visits
 * @param {boolean} [conf.force_post=false] - force using post method for all requests
 * @example
 * Countly.init({
 *   //provide your app key that you retrieved from Countly dashboard
 *   app_key: "YOUR_APP_KEY",
 *   //provide your server IP or name. Use try.count.ly for EE trial server.
 *   url: "http://yourdomain.com" 
 * });
 */
    Countly.init = function(ob){
        if(!inited){
            startTime = getTimestamp();
            inited = true;
            requestQueue = store("cly_queue") || [];
            timedEvents = {};
            eventQueue = store("cly_event") || [];
            ob = ob || {};
            beatInterval = ob.interval || Countly.interval || beatInterval;
            queueSize = ob.queue_size || Countly.queue_size || queueSize;
            failTimeoutAmount = ob.fail_timeout || Countly.fail_timeout || failTimeoutAmount;
            inactivityTime = ob.inactivity_time || Countly.inactivity_time || inactivityTime;
            sessionUpdate = ob.session_update || Countly.session_update || sessionUpdate;
            maxEventBatch = ob.max_events || Countly.max_events || maxEventBatch;
            Countly.ignore_prefetch = ob.ignore_prefetch || Countly.ignore_prefetch || true;
            Countly.debug = ob.debug || Countly.debug || false;
            Countly.app_key = ob.app_key || Countly.app_key || null;
            Countly.device_id = ob.device_id || Countly.device_id || getId();
            Countly.url = stripTrailingSlash(ob.url || Countly.url || "");
            Countly.app_version = ob.app_version || Countly.app_version || "0.0";
            Countly.country_code = ob.country_code || Countly.country_code || null;
            Countly.city = ob.city || Countly.city || null;
            Countly.ip_address = ob.ip_address || Countly.ip_address || null;
            Countly.ignore_bots = ob.ignore_bots || Countly.ignore_bots || true;
            Countly.force_post = ob.force_post || Countly.force_post || false;
            Countly.q = Countly.q || [];
            Countly.onload = Countly.onload || [];
            Countly.ignore_visitor = ob.ignore_visitor || Countly.ignore_visitor || false;
            if(ob.ignore_referrers && ob.ignore_referrers.constructor === Array){
                ignoreReferrers = ob.ignore_referrers;
            }
            else if(Countly.ignore_referrers && Countly.ignore_referrers.constructor === Array){
                ignoreReferrers = Countly.ignore_referrers;
            }
            
            if(Countly.url === ""){
                log("Please provide server URL");
                Countly.ignore_visitor = true;
            }
            
            if (Countly.ignore_prefetch && typeof document.visibilityState !== 'undefined' && document.visibilityState === 'prerender') {
                Countly.ignore_visitor = true;
            }
            if(Countly.ignore_bots && searchBotRE.test(navigator.userAgent)){
                Countly.ignore_visitor = true;
            }
            if(window.name && window.name.indexOf("cly:") === 0){
                Countly.passed_data = JSON.parse(window.name.replace("cly:", ""));
            }
            else if(location.hash === "#cly:"){
                Countly.passed_data = JSON.parse(location.hash.replace("#cly:", ""));<commit_msg>Correctly read data from hash<commit_after>/************
* Countly Web SDK
* https://github.com/Countly/countly-sdk-web
************/

/**
 * Countly object to manage the internal queue and send requests to Countly server. More information on {@link http://resources.count.ly/docs/countly-sdk-for-web}
 * @name Countly
 * @global
 * @namespace Countly
 * @example <caption>SDK integration</caption>
 * <script type='text/javascript'>
 *   
 * //some default pre init
 * var Countly = Countly || {};
 * Countly.q = Countly.q || [];
 * 
 * //provide your app key that you retrieved from Countly dashboard
 * Countly.app_key = "YOUR_APP_KEY";
 * 
 * //provide your server IP or name. Use try.count.ly for EE trial server.
 * //if you use your own server, make sure you have https enabled if you use
 * //https below.
 * Countly.url = "https://yourdomain.com"; 
 * 
 * //start pushing function calls to queue
 * //track sessions automatically
 * Countly.q.push(['track_sessions']);
 *   
 * //track sessions automatically
 * Countly.q.push(['track_pageview']);
 *   
 * //load countly script asynchronously
 * (function() {
 *  var cly = document.createElement('script'); cly.type = 'text/javascript'; 
 *  cly.async = true;
 *  //enter url of script here
 *  cly.src = 'https://cdn.jsdelivr.net/countly-sdk-web/latest/countly.min.js';
 *  cly.onload = function(){Countly.init()};
 *  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(cly, s);
 * })();
 * </script>
 */
(function (Countly) {
    'use strict';
    
    var SDK_VERSION = "16.12";
    var SDK_NAME = "javascript_native_web";

    var inited = false,
        sessionStarted = false,
        apiPath = "/i",
        beatInterval = 500,
        queueSize = 1000,
        requestQueue = [],
        eventQueue = [],
        crashLogs = [],
        timedEvents = {},
        ignoreReferrers = [],
        crashSegments = null,
        autoExtend = true,
        lastBeat,
        storedDuration = 0,
        lastView = null,
        lastViewTime = 0,
        lastViewStoredDuration = 0,
        failTimeout = 0,
        failTimeoutAmount = 60,
        inactivityTime = 20,
        inactivityCounter = 0,
        sessionUpdate = 60,
        maxEventBatch = 10,
        lastMsTs = 0,
        readyToProcess = true,
        platform,
        urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
        searchBotRE = /(CountlySiteBot|nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver|bingbot|Google Web Preview|Mediapartners-Google|AdsBot-Google|Baiduspider|Ezooms|YahooSeeker|AltaVista|AVSearch|Mercator|Scooter|InfoSeek|Ultraseek|Lycos|Wget|YandexBot|Yandex|YaDirectFetcher|SiteBot|Exabot|AhrefsBot|MJ12bot|TurnitinBot|magpie-crawler|Nutch Crawler|CMS Crawler|rogerbot|Domnutch|ssearch_bot|XoviBot|netseer|digincore|fr-crawler|wesee|AliasIO)/,
        trackTime = true,
        startTime;

/**
 * Initialize Countly object
 * @param {Object} conf - Countly initialization {@link Init} object with configuration options
 * @param {string} conf.app_key - app key for your app created in Countly
 * @param {string} conf.device_id - to identify a visitor, will be auto generated if not provided
 * @param {string} conf.url - your Countly server url, you can use your server URL or IP here
 * @param {string} [conf.app_version=0.0] - the version of your app or website
 * @param {string=} conf.country_code - country code for your visitor
 * @param {string=} conf.city - name of the city of your visitor
 * @param {string=} conf.ip_address - ip address of your visitor
 * @param {boolean} [conf.debug=false] - output debug info into console
 * @param {boolean} [conf.ignore_bots=true] - option to ignore traffic from bots
 * @param {number} [conf.interval=500] - set an interval how often to check if there is any data to report and report it in miliseconds
 * @param {number} [conf.queue_size=1000] - maximum amount of queued requests to store
 * @param {number} [conf.fail_timeout=60] - set time in seconds to wait after failed connection to server in seconds
 * @param {number} [conf.inactivity_time=20] - after how many minutes user should be counted as inactive, if he did not perform any actions, as mouse move, scroll or keypress
 * @param {number} [conf.session_update=60] - how often in seconds should session be extended
 * @param {number} [conf.max_events=10] - maximum amount of events to send in one batch
 * @param {array=} conf.ignore_referrers - array with referrers to ignore
 * @param {boolean} [conf.ignore_prefetch=true] - ignore prefetching and pre rendering from counting as real website visits
 * @param {boolean} [conf.force_post=false] - force using post method for all requests
 * @example
 * Countly.init({
 *   //provide your app key that you retrieved from Countly dashboard
 *   app_key: "YOUR_APP_KEY",
 *   //provide your server IP or name. Use try.count.ly for EE trial server.
 *   url: "http://yourdomain.com" 
 * });
 */
    Countly.init = function(ob){
        if(!inited){
            startTime = getTimestamp();
            inited = true;
            requestQueue = store("cly_queue") || [];
            timedEvents = {};
            eventQueue = store("cly_event") || [];
            ob = ob || {};
            beatInterval = ob.interval || Countly.interval || beatInterval;
            queueSize = ob.queue_size || Countly.queue_size || queueSize;
            failTimeoutAmount = ob.fail_timeout || Countly.fail_timeout || failTimeoutAmount;
            inactivityTime = ob.inactivity_time || Countly.inactivity_time || inactivityTime;
            sessionUpdate = ob.session_update || Countly.session_update || sessionUpdate;
            maxEventBatch = ob.max_events || Countly.max_events || maxEventBatch;
            Countly.ignore_prefetch = ob.ignore_prefetch || Countly.ignore_prefetch || true;
            Countly.debug = ob.debug || Countly.debug || false;
            Countly.app_key = ob.app_key || Countly.app_key || null;
            Countly.device_id = ob.device_id || Countly.device_id || getId();
            Countly.url = stripTrailingSlash(ob.url || Countly.url || "");
            Countly.app_version = ob.app_version || Countly.app_version || "0.0";
            Countly.country_code = ob.country_code || Countly.country_code || null;
            Countly.city = ob.city || Countly.city || null;
            Countly.ip_address = ob.ip_address || Countly.ip_address || null;
            Countly.ignore_bots = ob.ignore_bots || Countly.ignore_bots || true;
            Countly.force_post = ob.force_post || Countly.force_post || false;
            Countly.q = Countly.q || [];
            Countly.onload = Countly.onload || [];
            Countly.ignore_visitor = ob.ignore_visitor || Countly.ignore_visitor || false;
            if(ob.ignore_referrers && ob.ignore_referrers.constructor === Array){
                ignoreReferrers = ob.ignore_referrers;
            }
            else if(Countly.ignore_referrers && Countly.ignore_referrers.constructor === Array){
                ignoreReferrers = Countly.ignore_referrers;
            }
            
            if(Countly.url === ""){
                log("Please provide server URL");
                Countly.ignore_visitor = true;
            }
            
            if (Countly.ignore_prefetch && typeof document.visibilityState !== 'undefined' && document.visibilityState === 'prerender') {
                Countly.ignore_visitor = true;
            }
            if(Countly.ignore_bots && searchBotRE.test(navigator.userAgent)){
                Countly.ignore_visitor = true;
            }
            if(window.name && window.name.indexOf("cly:") === 0){
                Countly.passed_data = JSON.parse(window.name.replace("cly:", ""));
            }
            else if(location.hash && location.hash.indexOf("#cly:") === 0){
                Countly.passed_data = JSON.parse(location.hash.replace("#cly:", ""));
{'fraction_non_alphanumeric': 0.14156215075127282, 'fraction_numerical': 0.006270954923630945, 'mean_word_length': 2.8579640718562875, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, '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': '1402790', 'n_tokens_mistral': 5039, 'n_tokens_neox': 4845, 'n_words': 1183}