<commit_before><template>
    <boxed-layout wide="1" mainClass="install">
        <div slot="header">
            <p class="headline">
                <strong>Contao Manager</strong>
                {{ 'ui.package.version' | translate({ version: '@package_version@' }) }}
            </p>
            <p v-html="$t('ui.install.intro')"></p>
        </div>

        <section slot="section">

            <fieldset v-if="!authUsername">
                <legend>{{ 'ui.install.accountHeadline' | translate }}</legend>
                <p>{{ 'ui.install.accountCreate' | translate }}</p>
                <text-field ref="username" name="username" :label="$t('ui.install.accountUsername')" class="inline" :disabled="installing" v-model="username" @enter="install"></text-field>
                <text-field type="password" name="password" :label="$t('ui.install.accountPassword')" :placeholder="$t('ui.install.accountPasswordPlaceholder')" :error="errors.password" :disabled="installing" v-model="password" @input="validatePassword" @enter="install"></text-field>
                <text-field type="password" name="password_confirm" :label="$t('ui.install.accountPasswordConfirm')" :disabled="installing" :error="errors.password_confirm" v-model="password_confirm" @input="validatePasswordConfirm" @enter="install"></text-field>
            </fieldset>

            <fieldset v-else>
                <legend>{{ 'ui.install.accountHeadline' | translate }}</legend>
                <p v-html="$t('ui.install.accountCreated', { username: authUsername })"></p>
            </fieldset>

            <fieldset v-if="!contaoVersion">
                <legend>{{ 'ui.install.contaoHeadline' | translate }}</legend>
                <p>{{ 'ui.install.contaoSelect' | translate }}</p>
                <select-menu name="version" :label="$t('ui.install.contaoVersion')" class="inline" v-bind="version" :options="versions"></select-menu>
            </fieldset>

            <fieldset v-else>
                <legend>{{ 'ui.install.contaoHeadline' | translate }}</legend>
                <p>{{ 'ui.install.contaoSelected' | translate({ version: contaoVersion }) }}</p>
            </fieldset>

            <fieldset v-if="advanced">
                <legend>{{ 'ui.install.expertHeadline' | translate }}</legend>
                <p>{{ 'ui.install.expertDescription' | translate }}</p>
                <text-field ref="github_oauth_token" name="github_oauth_token" :label="$t('ui.install.expertGithub')" :placeholder="$t('ui.install.optional')" :disabled="installing" :error="errors.github_oauth_token" v-model="github_oauth_token" @enter="install"></text-field>
                <text-field ref="php_cli" name="php_cli" :label="$t('ui.install.expertPhp')" :disabled="installing" :error="errors.php_cli" v-model="php_cli" @input="validatePhpCli" @enter="install"></text-field>
            </fieldset>

            <fieldset :class="{ submit: true, advanced: advanced || installing }">
                <button class="primary install" @click="install" :disabled="!inputValid || installing">
                    <span v-if="!installing">{{ buttonLabel }}</span>
                    <loader v-else></loader>
                </button>
                <a href="#" class="button advanced" v-if="!advanced && !installing" @click.prevent="enableAdvanced">{{ 'ui.install.buttonExpert' | translate }}</a>
            </fieldset>

        </section>

    </boxed-layout>
</template>

<script>
    import store from '../store';
    import apiStatus from '../api/status';
    import routes from '../router/routes';

    import BoxedLayout from './layouts/Boxed';
    import TextField from './widgets/TextField';
    import SelectMenu from './widgets/SelectMenu';
    import Checkbox from './widgets/Checkbox';
    import Loader from './fragments/Loader';

    export default {
        components: { BoxedLayout, TextField, SelectMenu, Checkbox, Loader },

        data: () => ({
            username: '',
            password: '',
            password_confirm: '',
            version: '',
            versions: { '4.3.*': '4.3 (latest)' },

            php_cli: '',
            github_oauth_token: '',

            errors: {
                password: '',
                github_oauth_token: '',
                php_cli: '',
            },

            installing: false,
            advanced: false,
        }),

        computed: {<commit_msg>Switch to Contao 4.4<commit_after><template>
    <boxed-layout wide="1" mainClass="install">
        <div slot="header">
            <p class="headline">
                <strong>Contao Manager</strong>
                {{ 'ui.package.version' | translate({ version: '@package_version@' }) }}
            </p>
            <p v-html="$t('ui.install.intro')"></p>
        </div>

        <section slot="section">

            <fieldset v-if="!authUsername">
                <legend>{{ 'ui.install.accountHeadline' | translate }}</legend>
                <p>{{ 'ui.install.accountCreate' | translate }}</p>
                <text-field ref="username" name="username" :label="$t('ui.install.accountUsername')" class="inline" :disabled="installing" v-model="username" @enter="install"></text-field>
                <text-field type="password" name="password" :label="$t('ui.install.accountPassword')" :placeholder="$t('ui.install.accountPasswordPlaceholder')" :error="errors.password" :disabled="installing" v-model="password" @input="validatePassword" @enter="install"></text-field>
                <text-field type="password" name="password_confirm" :label="$t('ui.install.accountPasswordConfirm')" :disabled="installing" :error="errors.password_confirm" v-model="password_confirm" @input="validatePasswordConfirm" @enter="install"></text-field>
            </fieldset>

            <fieldset v-else>
                <legend>{{ 'ui.install.accountHeadline' | translate }}</legend>
                <p v-html="$t('ui.install.accountCreated', { username: authUsername })"></p>
            </fieldset>

            <fieldset v-if="!contaoVersion">
                <legend>{{ 'ui.install.contaoHeadline' | translate }}</legend>
                <p>{{ 'ui.install.contaoSelect' | translate }}</p>
                <select-menu name="version" :label="$t('ui.install.contaoVersion')" class="inline" v-bind="version" :options="versions"></select-menu>
            </fieldset>

            <fieldset v-else>
                <legend>{{ 'ui.install.contaoHeadline' | translate }}</legend>
                <p>{{ 'ui.install.contaoSelected' | translate({ version: contaoVersion }) }}</p>
            </fieldset>

            <fieldset v-if="advanced">
                <legend>{{ 'ui.install.expertHeadline' | translate }}</legend>
                <p>{{ 'ui.install.expertDescription' | translate }}</p>
                <text-field ref="github_oauth_token" name="github_oauth_token" :label="$t('ui.install.expertGithub')" :placeholder="$t('ui.install.optional')" :disabled="installing" :error="errors.github_oauth_token" v-model="github_oauth_token" @enter="install"></text-field>
                <text-field ref="php_cli" name="php_cli" :label="$t('ui.install.expertPhp')" :disabled="installing" :error="errors.php_cli" v-model="php_cli" @input="validatePhpCli" @enter="install"></text-field>
            </fieldset>

            <fieldset :class="{ submit: true, advanced: advanced || installing }">
                <button class="primary install" @click="install" :disabled="!inputValid || installing">
                    <span v-if="!installing">{{ buttonLabel }}</span>
                    <loader v-else></loader>
                </button>
                <a href="#" class="button advanced" v-if="!advanced && !installing" @click.prevent="enableAdvanced">{{ 'ui.install.buttonExpert' | translate }}</a>
            </fieldset>

        </section>

    </boxed-layout>
</template>

<script>
    import store from '../store';
    import apiStatus from '../api/status';
    import routes from '../router/routes';

    import BoxedLayout from './layouts/Boxed';
    import TextField from './widgets/TextField';
    import SelectMenu from './widgets/SelectMenu';
    import Checkbox from './widgets/Checkbox';
    import Loader from './fragments/Loader';

    export default {
        components: { BoxedLayout, TextField, SelectMenu, Checkbox, Loader },

        data: () => ({
            username: '',
            password: '',
            password_confirm: '',
            version: '',
            versions: { '4.4.*': '4.4 (latest)' },

            php_cli: '',
            github_oauth_token: '',

            errors: {
                password: '',
                github_oauth_token: '',
                php_cli: '',
            },

            installing: false,
            advanced: false,
        }),

        computed: {
{'fraction_non_alphanumeric': 0.1738292323392675, 'fraction_numerical': 0.0013606984918925048, 'mean_word_length': 2.482037110146072, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 139, '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': '1974711', 'n_tokens_mistral': 2572, 'n_tokens_neox': 2422, 'n_words': 451}