<commit_before>'use strict'

const isWin = process.platform === 'win32';
let dirname = __dirname;
const remote = require('electron').remote;

if (isWin == true) {
    dirname = dirname.replace(/\\/g, '/');
    console.log(dirname);
}

exports.decorateConfig = (config) => {
    return Object.assign({}, config, {
        css: `
            ${config.css || ''}
            .header_windowHeader {
                height: 22px;
                left: 57px;
                width: calc(100% - 56px);
            }
            .header_windowControls {
                display: none;
            }
            .header_appTitle {
                margin-left: -56px;
            }
            .mac_header {
                position: fixed;
                top: 0;
                left: 0;
                height: 22px;
                width: 56px;
            }
            .mac_actions {
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                top: 0;
            }
            .mac_header .mac_close,
            .mac_header .mac_minimize,
            .mac_header .mac_maximize {
                width: 12px;
                height: 12px;
                border-radius: 50%;
                position: absolute;
                top: 5px;
                background-position: -6px;
            }
            .mac_header .mac_close {
                background-color: #f25056;
                background-image: url('${dirname}/icons/close.svg');
                left: 5px;
            }
            .mac_header .mac_close:hover {
                background-image: url('${dirname}/icons/close_hover.svg');
            }
            .mac_header .mac_minimize {
                background-color: #fac536;
                background-image: url('${dirname}/icons/minimize.svg');
                left: 23px;
            }
            .mac_header .mac_minimize:hover {
                background-image: url('${dirname}/icons/minimize_hover.svg');
            }
            .mac_header .mac_maximize {
                background-color: #39ea49;
                background-image: url('${dirname}/icons/maximize.svg');
                left: 40px;
            }
            .mac_header .mac_maximize:hover {
                background-image: url('${dirname}/icons/maximize_hover.svg');
            }
        `
    })
};

exports.decorateHeader = (Hyper, { React }) => {
    return class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                window: null,
                maximized: false
            }
            this.closeApp = this.closeApp.bind(this);
            this.minimizeApp = this.minimizeApp.bind(this);
            this.maximizeApp = this.maximizeApp.bind(this);
        }
        closeApp() {
            this.state.window.close();
        }
        minimizeApp() {
            this.state.window.minimize();
            this.state.maximized = false;
        }
        maximizeApp() {
            if (this.state.maximized == true) {
                this.state.window.unmaximize();
                this.state.maximized = false;
            } else {
                this.state.window.maximize();
                this.state.maximized = true;
            }
        }
        render() {
            return (
                React.createElement(Hyper, Object.assign({}, this.props, {
                    customChildren: React.createElement('div', { className: 'mac_header' },
                        React.createElement('div', { className: 'mac_actions' },
                            React.createElement('span', { className: 'mac_close', onClick: this.closeApp }),
                            React.createElement('span', { className: 'mac_minimize', onClick: this.minimizeApp }),
                            React.createElement('span', { className: 'mac_maximize', onClick: this.maximizeApp })
                        )
                    )
                }))
            )
        }
        componentDidMount() {
            this.state.window = remote.getCurrentWindow();
        }
    };
};
<commit_msg>Add possibility to change the location of the controls<commit_after>'use strict'

const isWin = process.platform === 'win32';
const remote = require('electron').remote;
let dirname = __dirname;
let defaultConfig = {
    align: 'left',
};

if (isWin == true) {
    dirname = dirname.replace(/\\/g, '/');
}

exports.decorateConfig = (config) => {
    // Extend the default config
    defaultConfig = Object.assign({}, defaultConfig, config.hyperMacControls || {});

    return Object.assign({}, config, {
        css: `
            ${config.css || ''}
            .header_windowHeader {
                height: 22px;
                left: ${defaultConfig.align == 'left' ? '57px' : '0'};
                width: calc(100% - 56px);
            }
            .header_windowControls {
                display: none;
            }
            .header_appTitle {
                margin-left: -56px;
            }
            .mac_header {
                position: fixed;
                top: 0;
                ${defaultConfig.align == 'left' ? 'left: 0;' : 'right: 0;'}
                height: 22px;
                width: 56px;
            }
            .mac_actions {
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                top: 0;
            }
            .mac_header .mac_close,
            .mac_header .mac_minimize,
            .mac_header .mac_maximize {
                width: 12px;
                height: 12px;
                border-radius: 50%;
                position: absolute;
                top: 5px;
                background-position: -6px;
            }
            .mac_header .mac_close {
                background-color: #f25056;
                background-image: url('${dirname}/icons/close.svg');
                left: 5px;
            }
            .mac_header .mac_close:hover {
                background-image: url('${dirname}/icons/close_hover.svg');
            }
            .mac_header .mac_minimize {
                background-color: #fac536;
                background-image: url('${dirname}/icons/minimize.svg');
                left: 23px;
            }
            .mac_header .mac_minimize:hover {
                background-image: url('${dirname}/icons/minimize_hover.svg');
            }
            .mac_header .mac_maximize {
                background-color: #39ea49;
                background-image: url('${dirname}/icons/maximize.svg');
                left: 40px;
            }
            .mac_header .mac_maximize:hover {
                background-image: url('${dirname}/icons/maximize_hover.svg');
            }
        `
    })
};

exports.decorateHeader = (Hyper, { React }) => {
    return class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                window: null,
                maximized: false
            }
            this.closeApp = this.closeApp.bind(this);
            this.minimizeApp = this.minimizeApp.bind(this);
            this.maximizeApp = this.maximizeApp.bind(this);
        }
        closeApp() {
            this.state.window.close();
        }
        minimizeApp() {
            this.state.window.minimize();
            this.state.maximized = false;
        }
        maximizeApp() {
            if (this.state.maximized == true) {
                this.state.window.unmaximize();
                this.state.maximized = false;
            } else {
                this.state.window.maximize();
                this.state.maximized = true;
            }
        }
        render() {
            return (
                React.createElement(Hyper, Object.assign({}, this.props, {
                    customChildren: React.createElement('div', { className: 'mac_header' },
                        React.createElement('div', { className: 'mac_actions' },
                            React.createElement('span', { className: 'mac_close', onClick: this.closeApp }),
                            React.createElement('span', { className: 'mac_minimize', onClick: this.minimizeApp }),
                            React.createElement('span', { className: 'mac_maximize', onClick: this.maximizeApp })
                        )
                    )
                }))
            )
        }
        componentDidMount() {
            this.state.window = remote.getCurrentWindow();
        }
    };
};

{'fraction_non_alphanumeric': 0.1188582124473561, 'fraction_numerical': 0.011464670098268601, 'mean_word_length': 1.2616402116402117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7668159', 'n_tokens_mistral': 2407, 'n_tokens_neox': 2229, 'n_words': 390}