<commit_before>@if(empty($name))
<code>&lt;x-boilerplate::select2> The name attribute has not been set</code>
@else
<div class="form-group{{ isset($groupClass) ? ' '.$groupClass : '' }}"{!! isset($groupId) ? ' id="'.$groupId.'"' : '' !!}>
@isset($label)
    <label for="{{ $id }}">{!! __($label) !!}</label>
@endisset
    <select id="{{ $id }}" name="{{ $name }}" class="form-control{{ $errors->first($nameDot,' is-invalid') }}{{ isset($class) ? ' '.$class : '' }}"{!! !empty($attributes) ? ' '.$attributes : '' !!} style="visibility:hidden;height:1rem" autocomplete="off">
@if(!isset($multiple))
        <option></option>
@endif
@if(!empty($options) && is_array($options))
@foreach($options as $k => $v)
        <option value="{{ $k }}"{{ collect($selected ?? [])->contains($k) ? ' selected' : '' }}>{{ $v }}</option>
@endforeach
@else
        {{ $slot }}
@endisset
    </select>
@if($help ?? false)
    <small class="form-text text-muted">@lang($help)</small>
@endif
@error($nameDot)
    <div class="error-bubble"><div>{{ $message }}</div></div>
@enderror
</div>
@include('boilerplate::load.async.select2')
@component('boilerplate::minify')
    <script>
        whenAssetIsLoaded('select2', () => {
            window.{{ 'S2_'.\Str::camel($id) }} = $('#{{ $id }}').select2({
                placeholder: '{{ $placeholder ?? '—' }}',
                allowClear: {{ $allowClear }},
                language: "{{ App::getLocale() }}",
                direction: "@lang('boilerplate::layout.direction')",
                minimumInputLength: {{ $minimumInputLength ?? intval(isset($model)) }},
                minimumResultsForSearch: {{ $minimumResultsForSearch ?? 10 }},
                width: '100%',
                dropdownAutoWidth: true,
                @isset($ajax)
                ajax: {
                    delay: 200,
                    url: '{{ $ajax }}',
                    @isset($model)
                    data: function (param) {
                        return {
                            q: param.term,
                            model: "{!! str_replace('\\', '\\\\', $model) !!}",
                            length: {{ $maxLength ?? 10 }},
                            s: "{{ encrypt($model) }}"
                        }
                    },
                    @endisset
                    method: 'post'
                }
                @endisset
            })
        })
    </script>
@endcomponent
@endif
<commit_msg>Fix select2 when loaded from bootbox<commit_after>@if(empty($name))
<code>&lt;x-boilerplate::select2> The name attribute has not been set</code>
@else
<div class="form-group{{ isset($groupClass) ? ' '.$groupClass : '' }}"{!! isset($groupId) ? ' id="'.$groupId.'"' : '' !!}>
@isset($label)
    <label for="{{ $id }}">{!! __($label) !!}</label>
@endisset
    <select id="{{ $id }}" name="{{ $name }}" class="form-control{{ $errors->first($nameDot,' is-invalid') }}{{ isset($class) ? ' '.$class : '' }}"{!! !empty($attributes) ? ' '.$attributes : '' !!} style="visibility:hidden;height:1rem" autocomplete="off">
@if(!isset($multiple))
        <option></option>
@endif
@if(!empty($options) && is_array($options))
@foreach($options as $k => $v)
        <option value="{{ $k }}"{{ collect($selected ?? [])->contains($k) ? ' selected' : '' }}>{{ $v }}</option>
@endforeach
@else
        {{ $slot }}
@endisset
    </select>
@if($help ?? false)
    <small class="form-text text-muted">@lang($help)</small>
@endif
@error($nameDot)
    <div class="error-bubble"><div>{{ $message }}</div></div>
@enderror
</div>
@include('boilerplate::load.async.select2')
@component('boilerplate::minify')
    <script>
        whenAssetIsLoaded('select2', () => {
            window.{{ 'S2_'.\Str::camel($id) }} = $('#{{ $id }}').select2({
                placeholder: '{{ $placeholder ?? '—' }}',
                allowClear: {{ $allowClear }},
                language: "{{ App::getLocale() }}",
                direction: "@lang('boilerplate::layout.direction')",
                minimumInputLength: {{ $minimumInputLength ?? intval(isset($model)) }},
                minimumResultsForSearch: {{ $minimumResultsForSearch ?? 10 }},
                width: '100%',
                dropdownAutoWidth: true,
                dropdownParent: $('#{{ $id }}').parent(),
                @isset($ajax)
                ajax: {
                    delay: 200,
                    url: '{{ $ajax }}',
                    @isset($model)
                    data: function (param) {
                        return {
                            q: param.term,
                            model: "{!! str_replace('\\', '\\\\', $model) !!}",
                            length: {{ $maxLength ?? 10 }},
                            s: "{{ encrypt($model) }}"
                        }
                    },
                    @endisset
                    method: 'post'
                }
                @endisset
            })
        })
    </script>
@endcomponent
@endif

{'fraction_non_alphanumeric': 0.21361172455330255, 'fraction_numerical': 0.006625175667536639, 'mean_word_length': 1.981448234590066, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 53, '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': '5100644', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1422, 'n_words': 262}