{"size": 2195, "ext": "js", "max_stars_repo_path": "main.js", "max_stars_repo_name": "ComplianceCenter/ui", "max_stars_repo_stars_event_min_datetime": "2018-09-13T18:40:18.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-13T18:40:25.000Z", "max_issues_repo_path": "main.js", "max_issues_repo_name": "ComplianceCenter/ui", "max_issues_repo_issues_event_min_datetime": "2018-09-20T20:29:01.000Z", "max_issues_repo_issues_event_max_datetime": "2018-11-27T22:54:07.000Z", "max_forks_repo_path": "main.js", "max_forks_repo_name": "ComplianceCenter/ui", "max_forks_repo_forks_event_min_datetime": "2018-04-23T17:11:19.000Z", "max_forks_repo_forks_event_max_datetime": "2018-09-27T14:37:57.000Z"}
{"max_stars_count": 2, "max_issues_count": 22, "max_forks_count": 5, "avg_line_length": 33.7692307692, "max_line_length": 96, "alphanum_fraction": 0.6856492027}
import 'babel-polyfill';
import 'whatwg-fetch';

import React from 'react';
import ReactDOM from 'react-dom';
import FastClick from 'fastclick';
import { Provider } from 'react-redux';

import store from './core/store';
import router from './core/router';
import history from './core/history';

let routes = require('./routes.json'); // Loaded with utils/routes-loader.js
const container = document.getElementById('main');

function renderComponent(component) {
  ReactDOM.render(<Provider store={store}>{component}</Provider>, container);
}

// Find and render a web page matching the current URL path,
// if such page is not found then render an error page (see routes.json, core/router.js)
function render(location) {
  router.resolve(routes, location)
    .then(renderComponent)
    .catch(error => router.resolve(routes, { ...location, error }).then(renderComponent));
}

function cors(){
  (function() {
    var cors_api_host = 'cors-anywhere.herokuapp.com';
    var cors_api_url = 'https://' + cors_api_host + '/';
    var slice = [].slice;
    var origin = window.location.protocol + '//' + window.location.host;
    var open = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function() {
        var args = slice.call(arguments);
        var targetOrigin = /^https?:\/\/([^\/]+)/i.exec(args[1]);
        if (targetOrigin && targetOrigin[0].toLowerCase() !== origin &&
            targetOrigin[1] !== cors_api_host) {
            args[1] = cors_api_url + args[1];
        }
        return open.apply(this, args);
    };
  })();
}

// Handle client-side navigation by using HTML5 History API
// For more information visit https://github.com/ReactJSTraining/history/tree/master/docs#readme
history.listen(render);
render(history.getCurrentLocation());
cors();

// Eliminates the 300ms delay between a physical tap
// and the firing of a click event on mobile browsers
// https://github.com/ftlabs/fastclick
FastClick.attach(document.body);

// Enable Hot Module Replacement (HMR)
if (module.hot) {
  module.hot.accept('./routes.json', () => {
    routes = require('./routes.json'); // eslint-disable-line global-require
    render(history.getCurrentLocation());
  });
}
