<commit_before>
//
// Copyright 2016 Kary Foundation, Inc.
//   Author: <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//

'use strict'

//
// ─── DEFS ───────────────────────────────────────────────────────────────────────
//

    const electron                          = require( 'electron' )
    const { ipcMain, BrowserWindow, app }   = require( 'electron' )
    const messenger                         = require('messenger')
    const fs                                = require('fs')
    const path                              = require('path')

//
// ─── CONSTANTS ──────────────────────────────────────────────────────────────────
//

    const uniqueWindowIdKey = 'orchestra-unique-window-id'

    const orchestraVersion = '1.0'
    const quartetVersion = '1.2'

//
// ─── STORAGE ────────────────────────────────────────────────────────────────────
//

    let windowCount = 0
    let isHelpWindowOpen = false
    let isAboutWindowOpen = false
    let helpWindow

//
// ─── HELPER TOOLS ───────────────────────────────────────────────────────────────
//

    function existsSync ( filename ) {
        try {
            fs.accessSync( filename )
            return true
        } catch( ex ) {
            return false
        }
    }

//
// ─── GENERATE MAIN WINDOW ───────────────────────────────────────────────────────
//

    function createWindow ( args ) {

        console.log( args )

        let editorWindow
        windowCount++

        const window_width = 1100
        const window_height = 640
        editorWindow = new BrowserWindow({
            show: false,
            width:  window_width,   minWidth: window_width - 150,
            height: window_height,  minHeight: window_height - 100,
            backgroundColor: '#F7F7F7',
            frame: false,
            fullscreen: false,
        })

        editorWindow.maximize( )
        editorWindow.openDevTools( )
        editorWindow.setMenuBarVisibility( false )


        if ( args.mode === 'file' )
            editorWindow.loadURL( `file://${ __dirname }/index.html?${
                encodeURI(JSON.stringify({
                    file: args.file
                }))}`)

        else if ( args.mode === 'parse' )
            editorWindow.loadURL( `file://${ __dirname }/index.html?${
                encodeURI(JSON.stringify({
                    regexp: args.regexp
                }))}`)

        else
            editorWindow.loadURL( `file://${ __dirname }/index.html?{}` )



        editorWindow.once('ready-to-show', ( ) => {
            editorWindow.show( )<commit_msg>min....<commit_after>
//
// Copyright 2016 Kary Foundation, Inc.
//   Author: <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//

'use strict'

//
// ─── DEFS ───────────────────────────────────────────────────────────────────────
//

    const electron                          = require( 'electron' )
    const { ipcMain, BrowserWindow, app }   = require( 'electron' )
    const messenger                         = require('messenger')
    const fs                                = require('fs')
    const path                              = require('path')

//
// ─── CONSTANTS ──────────────────────────────────────────────────────────────────
//

    const uniqueWindowIdKey = 'orchestra-unique-window-id'

    const orchestraVersion = '1.0'
    const quartetVersion = '1.2'

//
// ─── STORAGE ────────────────────────────────────────────────────────────────────
//

    let windowCount = 0
    let isHelpWindowOpen = false
    let isAboutWindowOpen = false
    let helpWindow

//
// ─── HELPER TOOLS ───────────────────────────────────────────────────────────────
//

    function existsSync ( filename ) {
        try {
            fs.accessSync( filename )
            return true
        } catch( ex ) {
            return false
        }
    }

//
// ─── GENERATE MAIN WINDOW ───────────────────────────────────────────────────────
//

    function createWindow ( args = { mode: 'start' } ) {

        console.log( args )

        let editorWindow
        windowCount++

        const window_width = 1100
        const window_height = 640
        editorWindow = new BrowserWindow({
            show: false,
            width:  window_width,   minWidth: window_width - 150,
            height: window_height,  minHeight: window_height - 100,
            backgroundColor: '#F7F7F7',
            frame: false,
            fullscreen: false,
        })

        editorWindow.maximize( )
        editorWindow.setMenuBarVisibility( false )
        //editorWindow.openDevTools( )


        if ( args.mode === 'file' )
            editorWindow.loadURL( `file://${ __dirname }/index.html?${
                encodeURI(JSON.stringify({
                    file: args.file
                }))}`)

        else if ( args.mode === 'parse' )
            editorWindow.loadURL( `file://${ __dirname }/index.html?${
                encodeURI(JSON.stringify({
                    regexp: args.regexp
                }))}`)

        else
            editorWindow.loadURL( `file://${ __dirname }/index.html?{}` )



        editorWindow.once('ready-to-show', ( ) => {
            editorWindow.show( )
{'fraction_non_alphanumeric': 0.22540834845735028, 'fraction_numerical': 0.010526315789473684, 'mean_word_length': 1.8944327731092436, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3467373', 'n_tokens_mistral': 1805, 'n_tokens_neox': 1466, 'n_words': 364}