diff --git a/docs-assets/app/composer.json b/docs-assets/app/composer.json index 23cd665198..c858deda1a 100644 --- a/docs-assets/app/composer.json +++ b/docs-assets/app/composer.json @@ -41,7 +41,7 @@ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], - "post-update-cmd": [ + "post-autoload-dump": [ "@php artisan vendor:publish --tag=laravel-assets --ansi --force", "@php artisan filament:upgrade" ], diff --git a/package-lock.json b/package-lock.json index 265afe8df2..ff127ed121 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3032,9 +3032,9 @@ } }, "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.9.0.tgz", + "integrity": "sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -3634,9 +3634,9 @@ } }, "node_modules/browserslist": { - "version": "4.21.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.8.tgz", - "integrity": "sha512-j+7xYe+v+q2Id9qbBeCI8WX5NmZSRe8es1+0xntD/+gaWXznP8tFEkv5IgSaHf5dS1YwVMbX/4W6m937mj+wQw==", + "version": "4.21.9", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", + "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", "dev": true, "funding": [ { @@ -3653,8 +3653,8 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001502", - "electron-to-chromium": "^1.4.428", + "caniuse-lite": "^1.0.30001503", + "electron-to-chromium": "^1.4.431", "node-releases": "^2.0.12", "update-browserslist-db": "^1.0.11" }, @@ -3757,9 +3757,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001503", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001503.tgz", - "integrity": "sha512-Sf9NiF+wZxPfzv8Z3iS0rXM1Do+iOy2Lxvib38glFX+08TCYYYGR5fRJXk4d77C4AYwhUjgYgMsMudbh2TqCKw==", + "version": "1.0.30001505", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001505.tgz", + "integrity": "sha512-jaAOR5zVtxHfL0NjZyflVTtXm3D3J9P15zSJ7HmQF8dSKGA6tqzQq+0ZI3xkjyQj46I4/M0K2GbMpcAFOcbr3A==", "dev": true, "funding": [ { @@ -4783,9 +4783,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.430", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.430.tgz", - "integrity": "sha512-FytjTbGwz///F+ToZ5XSeXbbSaXalsVRXsz2mHityI5gfxft7ieW3HqFLkU5V1aIrY42aflICqbmFoDxW10etg==", + "version": "1.4.434", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.434.tgz", + "integrity": "sha512-5Gvm09UZTQRaWrimRtWRO5rvaX6Kpk5WHAPKDa7A4Gj6NIPuJ8w8WNpnxCXdd+CJJt6RBU6tUw0KyULoW6XuHw==", "dev": true }, "node_modules/elliptic": { @@ -4856,9 +4856,9 @@ } }, "node_modules/envinfo": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", - "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.9.0.tgz", + "integrity": "sha512-RODB4txU+xImYDemN5DqaKC0CHk05XSVkOX4pq0hK26Qx+1LChkuOyUDlGEjYb3ACr0n9qBhFjg37hQuJvpkRQ==", "dev": true, "bin": { "envinfo": "dist/cli.js" @@ -8125,9 +8125,9 @@ } }, "node_modules/pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", "dev": true, "engines": { "node": ">= 6" @@ -8791,9 +8791,9 @@ } }, "node_modules/prettier-plugin-blade": { - "version": "1.5.6", - "resolved": "https://registry.npmjs.org/prettier-plugin-blade/-/prettier-plugin-blade-1.5.6.tgz", - "integrity": "sha512-2b7dnzvJNyfFJTJUaflZ2S5dbtHkoj+gB6VGWaMJ/zzkSg2EWEEFWOFLgqCel1NZ+XbZyySZyLGx9l4eK7a5Hg==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/prettier-plugin-blade/-/prettier-plugin-blade-1.6.4.tgz", + "integrity": "sha512-uJjKjXXdseu4OR8AcFx1np1lrGQVEHL/dNGr/I5wSkjARtAlVuQQiuKCR3GgFF9EZB3UTfPpWLLT7SZS4iW6nQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -9489,9 +9489,9 @@ } }, "node_modules/semver": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", - "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", + "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -10324,9 +10324,9 @@ } }, "node_modules/terser": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.18.0.tgz", - "integrity": "sha512-pdL757Ig5a0I+owA42l6tIuEycRuM7FPY4n62h44mRLRfnOxJkkOHd6i89dOpwZlpF6JXBwaAHF6yWzFrt+QyA==", + "version": "5.18.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.18.1.tgz", + "integrity": "sha512-j1n0Ao919h/Ai5r43VAnfV/7azUYW43GPxK7qSATzrsERfW7+y2QW9Cp9ufnRF5CQUWbnLSo7UJokSWCqg4tsQ==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -10813,9 +10813,9 @@ } }, "node_modules/webpack": { - "version": "5.86.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.86.0.tgz", - "integrity": "sha512-3BOvworZ8SO/D4GVP+GoRC3fVeg5MO4vzmq8TJJEkdmopxyazGDxN8ClqN12uzrZW9Tv8EED8v5VSb6Sqyi0pg==", + "version": "5.87.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.87.0.tgz", + "integrity": "sha512-GOu1tNbQ7p1bDEoFRs2YPcfyGs8xq52yyPBZ3m2VGnXGtV9MxjrkABHm4V9Ia280OefsSLzvbVoXcfLxjKY/Iw==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", @@ -10827,7 +10827,7 @@ "acorn-import-assertions": "^1.9.0", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.14.1", + "enhanced-resolve": "^5.15.0", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", @@ -10837,7 +10837,7 @@ "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", - "schema-utils": "^3.1.2", + "schema-utils": "^3.2.0", "tapable": "^2.1.1", "terser-webpack-plugin": "^5.3.7", "watchpack": "^2.4.0", diff --git a/packages/actions/docs/01-installation.md b/packages/actions/docs/01-installation.md index 0d8c54e6dd..aa07c2d5d0 100644 --- a/packages/actions/docs/01-installation.md +++ b/packages/actions/docs/01-installation.md @@ -46,40 +46,21 @@ First, use NPM to install Tailwind CSS and its `forms` and `typography` plugins: npm install tailwindcss @tailwindcss/forms @tailwindcss/typography postcss --save-dev ``` -Create a new `tailwind.config.js` file. Ensure that you add Filament's `content` path, custom `colors`, and the `plugins` you installed: +Create a new `tailwind.config.js` file. Ensure that you add Filament's `preset` which configures colors and the plugins you installed: ```js -import colors from 'tailwindcss/colors' -import forms from '@tailwindcss/forms' -import typography from '@tailwindcss/typography' +import preset from './vendor/filament/support/tailwind.config.preset' export default { + presets: [preset], content: [ - './resources/**/*.blade.php', + './app/Filament/**/*.php', + './resources/views/filament/**/*.blade.php', './vendor/filament/**/*.blade.php', ], - darkMode: 'class', - theme: { - extend: { - colors: { - danger: colors.rose, - info: colors.blue, - primary: colors.blue, - secondary: colors.gray, - success: colors.green, - warning: colors.yellow, - }, - }, - }, - plugins: [ - forms, - typography, - ], } ``` -Of course, you may specify your own custom `danger`, `gray`, `info`, `primary`, `secondary`, `success` and `warning` colors, which will be used instead. But each color needs to be a [Tailwind CSS color](https://tailwindcss.com/docs/customizing-colors#color-palette-reference), or have all 50 - 950 variants specified - a single hex code or RGB value won't work here. - ### Configuring styles In `resources/css/app.css`, import Tailwind CSS, and the Filament forms CSS, which is used for action modal forms: @@ -174,10 +155,10 @@ composer update php artisan filament:upgrade ``` -We recommend adding the `filament:upgrade` command to your `composer.json`'s `post-update-cmd` to run it automatically: +We recommend adding the `filament:upgrade` command to your `composer.json`'s `post-autoload-dump` to run it automatically: ```json -"post-update-cmd": [ +"post-autoload-dump": [ // ... "@php artisan filament:upgrade" ], diff --git a/packages/actions/docs/04-modals.md b/packages/actions/docs/04-modals.md index 31fd45fa7c..95cef3f45b 100644 --- a/packages/actions/docs/04-modals.md +++ b/packages/actions/docs/04-modals.md @@ -137,21 +137,58 @@ Action::make('approvePost') }) ``` -## Customizing the modal's heading, subheading, and submit action label +## Customizing the modal's heading, description, and submit action label -You may customize the heading, subheading and label of the submit button in the modal: +You may customize the heading, description and label of the submit button in the modal: ```php Action::make('delete') ->action(fn () => $this->record->delete()) ->requiresConfirmation() ->modalHeading('Delete post') - ->modalSubheading('Are you sure you\'d like to delete this post? This cannot be undone.') + ->modalDescription('Are you sure you\'d like to delete this post? This cannot be undone.') ->modalSubmitActionLabel('Yes, delete it') ``` +## Adding an icon inside the modal + +You may add an [icon](https://blade-ui-kit.com/blade-icons?set=1#search) inside the modal using the `modalIcon()` method: + +```php +Action::make('delete') + ->action(fn () => $this->record->delete()) + ->requiresConfirmation() + ->modalIcon('heroicon-o-trash') +``` + +By default, the icon will inherit the color of the action button. You may customize the color of the icon using the `modalIconColor()` method: + +```php +Action::make('delete') + ->action(fn () => $this->record->delete()) + ->requiresConfirmation() + ->color('danger') + ->modalIcon('heroicon-o-trash') + ->modalIconColor('warning') +``` + +## Customizing the alignment of modal content + +By default, modal content will be aligned to the start, or centered if the modal is `xs` or `sm` in [width](#changing-the-modal-width). If you wish to change the alignment of content in a modal, you can use the `modalAlignment()` method and pass it `start` or `center`: + +```php +Action::make('updateAuthor') + ->form([ + // ... + ]) + ->action(function (array $data): void { + // ... + }) + ->modalAlignment('center') +``` + ## Custom modal content You may define custom content to be rendered inside your modal, which you can specify by passing a Blade view into the `modalContent()` method: @@ -179,12 +216,12 @@ Action::make('advance') ### Adding custom modal content below the form -By default, the custom content is displayed above the modal form if there is one, but you can add content below using `modalFooter()` if you wish: +By default, the custom content is displayed above the modal form if there is one, but you can add content below using `modalContentFooter()` if you wish: ```php Action::make('advance') ->action(fn () => $this->record->advance()) - ->modalFooter(view('filament.pages.actions.advance')) + ->modalContentFooter(view('filament.pages.actions.advance')) ``` ### Adding an action to custom modal content @@ -215,6 +252,7 @@ Now, in the view file, you can render the action button using the name that it w ``` + ## Using a slide-over instead of a modal You can open a "slide-over" dialog instead of a modal by using the `slideOver()` method: @@ -234,6 +272,21 @@ Action::make('updateAuthor') Instead of opening in the center of the screen, the modal content will now slide in from the right and consume the entire height of the browser. +## Making the modal footer sticky + +The footer of a modal is rendered inline after the content by default. Slide-overs, however, have a sticky footer that always shows when scrolling the content. You may enable this for a modal too using `stickyModalFooter()`: + +```php +Action::make('updateAuthor') + ->form([ + // ... + ]) + ->action(function (array $data): void { + // ... + }) + ->stickyModalFooter() +``` + ## Changing the modal width You can change the width of the modal by using the `modalWidth()` method. Options correspond to [Tailwind's max-width scale](https://tailwindcss.com/docs/max-width). The options are `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`, `5xl`, `6xl`, `7xl`, and `screen`: @@ -272,51 +325,13 @@ use Filament\Forms\Form; Action::make('create') ->mountUsing(function (Form $form) { $form->fill(); - + // ... }) ``` Please note that the `mountUsing()` method, by default, is used by Filament to initialize the [form](#modal-forms). If you override this method, you will need to call `$form->fill()` to ensure the form is initialized correctly. If you wish to populate the form with data, you can do so by passing an array to the `fill()` method, instead of [using `fillForm()` on the action itself](#filling-the-form-with-existing-data). -## Centering modal content - -By default, the modal's content will be centered if the modal is `xs` or `sm` in [width](#changing-the-modal-width). If you wish to center the content of a larger modal, you can use the `centerModal()` method: - -```php -Action::make('updateAuthor') - ->form([ - // ... - ]) - ->action(function (array $data): void { - // ... - }) - ->centerModal() -``` - -## Closing the modal by clicking away - -By default, when you click away from a modal, it will close itself. If you wish to disable this behavior for a specific action, you can use the `closeModalByClickingAway(false)` method: - -```php -Action::make('updateAuthor') - ->form([ - // ... - ]) - ->action(function (array $data): void { - // ... - }) - ->closeModalByClickingAway(false) -``` - -If you'd like to change the behaviour for all modals in the application, you can do so by calling `Modal::closedByClickingAway()` inside a service provider or middleware: - -```php -use Filament\Support\View\Components\Modal; - -Modal::closedByClickingAway(false); -``` - ## Customizing the action buttons in the footer of the modal By default, there are two actions in the footer of a modal. The first is a button to submit, which executes the `action()`. The second button closes the modal and cancels the action. @@ -367,9 +382,55 @@ Action::make('create') ]) ->action(function (array $data, array $arguments): void { // Create - + if ($arguments['another'] ?? false) { // Reset the form and don't close the modal } }) ``` + +## Closing the modal by clicking away + +By default, when you click away from a modal, it will close itself. If you wish to disable this behavior for a specific action, you can use the `closeModalByClickingAway(false)` method: + +```php +Action::make('updateAuthor') + ->form([ + // ... + ]) + ->action(function (array $data): void { + // ... + }) + ->closeModalByClickingAway(false) +``` + +If you'd like to change the behaviour for all modals in the application, you can do so by calling `Modal::closedByClickingAway()` inside a service provider or middleware: + +```php +use Filament\Support\View\Components\Modal; + +Modal::closedByClickingAway(false); +``` + +## Hiding the modal close button + +By default, modals have a close button in the top right corner. If you wish to hide the close button, you can use the `modalCloseButton(false)` method: + +```php +Action::make('updateAuthor') + ->form([ + // ... + ]) + ->action(function (array $data): void { + // ... + }) + ->modalCloseButton(false) +``` + +If you'd like to hide the close button for all modals in the application, you can do so by calling `Modal::closeButton(false)` inside a service provider or middleware: + +```php +use Filament\Support\View\Components\Modal; + +Modal::closeButton(false); +``` diff --git a/packages/actions/resources/views/components/actions.blade.php b/packages/actions/resources/views/components/actions.blade.php index a0c333137c..4be60b27e0 100644 --- a/packages/actions/resources/views/components/actions.blade.php +++ b/packages/actions/resources/views/components/actions.blade.php @@ -19,7 +19,7 @@ {{ $attributes->class([ 'filament-actions-actions', - 'flex flex-wrap items-center gap-4' => ! $fullWidth, + 'flex flex-wrap items-center gap-3' => ! $fullWidth, match ($alignment) { 'center' => 'justify-center', 'right' => 'flex-row-reverse space-x-reverse', diff --git a/packages/actions/resources/views/components/modals.blade.php b/packages/actions/resources/views/components/modals.blade.php index fc36f9bd0b..15b14c6c1e 100644 --- a/packages/actions/resources/views/components/modals.blade.php +++ b/packages/actions/resources/views/components/modals.blade.php @@ -1,19 +1,28 @@ @if ($this instanceof \Filament\Actions\Contracts\HasActions && (! $this->hasActionsModalRendered)) -
+ @php $action = $this->getMountedAction(); @endphp @if ($action) - @if ($action->isModalCentered()) - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - @else - - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - - @endif - {{ $action->getModalContent() }} @if (count(($infolist = $action->getInfolist())?->getComponents() ?? [])) @@ -65,19 +52,7 @@ {{ $this->getMountedActionForm() }} @endif - {{ $action->getModalFooter() }} - - @if (count($modalActions = $action->getVisibleModalActions())) - - - @foreach ($modalActions as $modalAction) - {{ $modalAction }} - @endforeach - - - @endif + {{ $action->getModalContentFooter() }} @endif
@@ -88,21 +63,30 @@ @endif @if ($this instanceof \Filament\Infolists\Contracts\HasInfolists && (! $this->hasInfolistsModalRendered)) -
+ @php $action = $this->getMountedInfolistAction(); @endphp @if ($action) - @if ($action->isModalCentered()) - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - @else - - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - - @endif - {{ $action->getModalContent() }} @if (count(($infolist = $action->getInfolist())?->getComponents() ?? [])) @@ -154,19 +116,7 @@ {{ $this->getMountedInfolistActionForm() }} @endif - {{ $action->getModalFooter() }} - - @if (count($modalActions = $action->getVisibleModalActions())) - - - @foreach ($modalActions as $modalAction) - {{ $modalAction }} - @endforeach - - - @endif + {{ $action->getModalContentFooter() }} @endif
@@ -177,21 +127,30 @@ @endif @if ($this instanceof \Filament\Tables\Contracts\HasTable && (! $this->hasTableModalRendered)) -
+ @php $action = $this->getMountedTableAction(); @endphp @if ($action) - @if ($action->isModalCentered()) - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - @else - - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - - @endif - {{ $action->getModalContent() }} @if (count(($infolist = $action->getInfolist())?->getComponents() ?? [])) @@ -243,38 +180,35 @@ {{ $this->getMountedTableActionForm() }} @endif - {{ $action->getModalFooter() }} - - @if (count($modalActions = $action->getVisibleModalActions())) - - - @foreach ($modalActions as $modalAction) - {{ $modalAction }} - @endforeach - - - @endif + {{ $action->getModalContentFooter() }} @endif
-
+ @php $action = $this->getMountedTableBulkAction(); @endphp @if ($action) - @if ($action->isModalCentered()) - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - @else - - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - - @endif - {{ $action->getModalContent() }} @if (count(($infolist = $action->getInfolist())?->getComponents() ?? [])) @@ -326,19 +238,7 @@ {{ $this->getMountedTableBulkActionForm() }} @endif - {{ $action->getModalFooter() }} - - @if (count($modalActions = $action->getVisibleModalActions())) - - - @foreach ($modalActions as $modalAction) - {{ $modalAction }} - @endforeach - - - @endif + {{ $action->getModalContentFooter() }} @endif
@@ -353,52 +253,34 @@ $action = $this->getMountedFormComponentAction(); @endphp -
+ @if ($action) - @if ($action->isModalCentered()) - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - @else - - @if ($heading = $action->getModalHeading()) - - {{ $heading }} - - @endif - - @if ($subheading = $action->getModalSubheading()) - - {{ $subheading }} - - @endif - - @endif - {{ $action->getModalContent() }} @if (count(($infolist = $action->getInfolist())?->getComponents() ?? [])) @@ -407,19 +289,7 @@ {{ $this->getMountedFormComponentActionForm() }} @endif - {{ $action->getModalFooter() }} - - @if (count($modalActions = $action->getVisibleModalActions())) - - - @foreach ($modalActions as $modalAction) - {{ $modalAction }} - @endforeach - - - @endif + {{ $action->getModalContentFooter() }} @endif
diff --git a/packages/actions/src/Concerns/CanOpenModal.php b/packages/actions/src/Concerns/CanOpenModal.php index 3319d05995..1c29c2320b 100644 --- a/packages/actions/src/Concerns/CanOpenModal.php +++ b/packages/actions/src/Concerns/CanOpenModal.php @@ -11,25 +11,44 @@ use Illuminate\Contracts\View\View; trait CanOpenModal { + /** + * @var array + */ + protected array $cachedExtraModalFooterActions; + /** * @var array | Closure */ protected array | Closure $extraModalFooterActions = []; + protected bool | Closure | null $isModalFooterSticky = null; + + /** + * @var array + */ + protected array $cachedModalActions; + /** * @var array */ protected array $modalActions = []; - protected bool | Closure | null $isModalCentered = null; - protected bool | Closure $isModalSlideOver = false; + protected string | Closure | null $modalAlignment = null; + + /** + * @var array + */ + protected array $cachedModalFooterActions; + /** * @var array | Closure | null */ protected array | Closure | null $modalFooterActions = null; + protected string | Closure | null $modalFooterActionsAlignment = null; + protected StaticAction | bool | Closure | null $modalCancelAction = null; protected string | Closure | null $modalCancelActionLabel = null; @@ -40,18 +59,27 @@ trait CanOpenModal protected View | Htmlable | Closure | null $modalContent = null; - protected View | Htmlable | Closure | null $modalFooter = null; + protected View | Htmlable | Closure | null $modalContentFooter = null; protected string | Htmlable | Closure | null $modalHeading = null; - protected string | Htmlable | Closure | null $modalSubheading = null; + protected string | Htmlable | Closure | null $modalDescription = null; protected string | Closure | null $modalWidth = null; protected bool | Closure | null $isModalHidden = false; + protected bool | Closure | null $hasModalCloseButton = null; + protected bool | Closure | null $isModalClosedByClickingAway = null; + protected string | Closure | null $modalIcon = null; + + /** + * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null + */ + protected string | array | Closure | null $modalIconColor = null; + public function closeModalByClickingAway(bool | Closure | null $condition = true): static { $this->isModalClosedByClickingAway = $condition; @@ -59,9 +87,45 @@ trait CanOpenModal return $this; } + /** + * @deprecated Use `modalAlignment('center')` instead. + */ public function centerModal(bool | Closure | null $condition = true): static { - $this->isModalCentered = $condition; + if ($this->evaluate($condition)) { + $this->modalAlignment('center'); + } + + return $this; + } + + public function modalAlignment(string | Closure | null $alignment = null): static + { + $this->modalAlignment = $alignment; + + return $this; + } + + public function modalCloseButton(bool | Closure | null $condition = true): static + { + $this->hasModalCloseButton = $condition; + + return $this; + } + + public function modalIcon(string | Closure | null $icon = null): static + { + $this->modalIcon = $icon; + + return $this; + } + + /** + * @param string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null $color + */ + public function modalIconColor(string | array | Closure | null $color = null): static + { + $this->modalIconColor = $color; return $this; } @@ -90,17 +154,14 @@ trait CanOpenModal */ public function modalFooterActions(array | Closure | null $actions = null): static { - if (! is_array($actions)) { - $this->modalFooterActions = $actions; + $this->modalFooterActions = $actions; - return $this; - } + return $this; + } - $this->modalFooterActions = []; - - foreach ($actions as $action) { - $this->modalFooterActions[$action->getName()] = $action; - } + public function modalFooterActionsAlignment(string | Closure | null $alignment = null): static + { + $this->modalFooterActionsAlignment = $alignment; return $this; } @@ -185,9 +246,17 @@ trait CanOpenModal return $this; } + /** + * @deprecated Use `modalContentFooter()` instead. + */ public function modalFooter(View | Htmlable | Closure | null $footer = null): static { - $this->modalFooter = $footer; + return $this->modalContentFooter($footer); + } + + public function modalContentFooter(View | Htmlable | Closure | null $footer = null): static + { + $this->modalContentFooter = $footer; return $this; } @@ -199,9 +268,19 @@ trait CanOpenModal return $this; } + public function modalDescription(string | Htmlable | Closure | null $description = null): static + { + $this->modalDescription = $description; + + return $this; + } + + /** + * @deprecated Use `modalDescription()` instead. + */ public function modalSubheading(string | Htmlable | Closure | null $subheading = null): static { - $this->modalSubheading = $subheading; + $this->modalDescription($subheading); return $this; } @@ -234,18 +313,18 @@ trait CanOpenModal return []; } - if (is_array($this->modalFooterActions)) { - return $this->modalFooterActions; + if (isset($this->cachedModalFooterActions)) { + return $this->cachedModalFooterActions; } - if ($this->modalFooterActions instanceof Closure) { + if ($this->modalFooterActions) { $actions = []; foreach ($this->evaluate($this->modalFooterActions) as $action) { $actions[$action->getName()] = $this->prepareModalAction($action); } - return $this->modalFooterActions = $actions; + return $this->cachedModalFooterActions = $actions; } $actions = []; @@ -263,11 +342,16 @@ trait CanOpenModal $actions['cancel'] = $cancelAction; } - if ($this->isModalCentered()) { + if ($this->getModalFooterActionsAlignment() === 'center') { $actions = array_reverse($actions); } - return $this->modalFooterActions = $actions; + return $this->cachedModalFooterActions = $actions; + } + + public function getModalFooterActionsAlignment(): ?string + { + return $this->evaluate($this->modalFooterActionsAlignment); } /** @@ -275,12 +359,8 @@ trait CanOpenModal */ public function getModalActions(): array { - if (! count($this->modalActions)) { - return []; - } - - if (! is_numeric(array_key_first($this->modalActions))) { - return $this->modalActions; + if (isset($this->cachedModalActions)) { + return $this->cachedModalActions; } $actions = $this->getModalFooterActions(); @@ -289,7 +369,7 @@ trait CanOpenModal $actions[$action->getName()] = $this->prepareModalAction($action); } - return $this->modalActions = $actions; + return $this->cachedModalActions = $actions; } public function getModalAction(string $name): ?StaticAction @@ -325,7 +405,7 @@ trait CanOpenModal /** * @return array */ - public function getVisibleModalActions(): array + public function getVisibleModalFooterActions(): array { return array_filter( $this->getModalFooterActions(), @@ -377,13 +457,22 @@ trait CanOpenModal */ public function getExtraModalFooterActions(): array { + if (isset($this->cachedExtraModalFooterActions)) { + return $this->cachedExtraModalFooterActions; + } + $actions = []; foreach ($this->evaluate($this->extraModalFooterActions) as $action) { $actions[$action->getName()] = $this->prepareModalAction($action); } - return $this->extraModalFooterActions = $actions; + return $this->cachedExtraModalFooterActions = $actions; + } + + public function getModalAlignment(): string + { + return $this->evaluate($this->modalAlignment) ?? (in_array($this->getModalWidth(), ['xs', 'sm']) ? 'center' : 'start'); } public function getModalSubmitActionLabel(): string @@ -401,9 +490,9 @@ trait CanOpenModal return $this->evaluate($this->modalContent); } - public function getModalFooter(): View | Htmlable | null + public function getModalContentFooter(): View | Htmlable | null { - return $this->evaluate($this->modalFooter); + return $this->evaluate($this->modalContentFooter); } public function getModalHeading(): string | Htmlable @@ -411,9 +500,9 @@ trait CanOpenModal return $this->evaluate($this->modalHeading) ?? $this->getLabel(); } - public function getModalSubheading(): string | Htmlable | null + public function getModalDescription(): string | Htmlable | null { - return $this->evaluate($this->modalSubheading); + return $this->evaluate($this->modalDescription); } public function getModalWidth(): string @@ -421,9 +510,9 @@ trait CanOpenModal return $this->evaluate($this->modalWidth) ?? '4xl'; } - public function isModalCentered(): bool + public function isModalFooterSticky(): bool { - return $this->evaluate($this->isModalCentered) ?? in_array($this->getModalWidth(), ['xs', 'sm']); + return $this->evaluate($this->isModalFooterSticky) ?? $this->isModalSlideOver(); } public function isModalSlideOver(): bool @@ -436,6 +525,11 @@ trait CanOpenModal return $this->evaluate($this->isModalHidden); } + public function hasModalCloseButton(): bool + { + return $this->evaluate($this->hasModalCloseButton) ?? Modal::$hasCloseButton; + } + public function isModalClosedByClickingAway(): bool { return $this->evaluate($this->isModalClosedByClickingAway) ?? Modal::$isClosedByClickingAway; @@ -467,4 +561,24 @@ trait CanOpenModal return StaticAction::make($name) ->button(); } + + public function getModalIcon(): ?string + { + return $this->evaluate($this->modalIcon); + } + + /** + * @return string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | null + */ + public function getModalIconColor(): string | array | null + { + return $this->evaluate($this->modalIconColor) ?? $this->getColor() ?? 'primary'; + } + + public function stickyModalFooter(bool | Closure $condition = true): static + { + $this->isModalFooterSticky = $condition; + + return $this; + } } diff --git a/packages/actions/src/Concerns/CanRequireConfirmation.php b/packages/actions/src/Concerns/CanRequireConfirmation.php index 2206104308..b48c80fdec 100644 --- a/packages/actions/src/Concerns/CanRequireConfirmation.php +++ b/packages/actions/src/Concerns/CanRequireConfirmation.php @@ -9,10 +9,12 @@ trait CanRequireConfirmation { public function requiresConfirmation(bool | Closure $condition = true): static { - $this->modalSubheading(fn (MountableAction $action): ?string => $action->evaluate($condition) ? __('filament-actions::modal.confirmation') : null); + $this->modalAlignment(fn (MountableAction $action): ?string => $action->evaluate($condition) ? 'center' : null); + $this->modalFooterActionsAlignment(fn (MountableAction $action): ?string => $action->evaluate($condition) ? 'center' : null); + $this->modalIcon(fn (MountableAction $action): ?string => $action->evaluate($condition) ? 'heroicon-o-exclamation-triangle' : null); + $this->modalDescription(fn (MountableAction $action): ?string => $action->evaluate($condition) ? __('filament-actions::modal.confirmation') : null); $this->modalSubmitActionLabel(fn (MountableAction $action): ?string => $action->evaluate($condition) ? __('filament-actions::modal.actions.confirm.label') : null); - $this->modalWidth(fn (MountableAction $action): ?string => $action->evaluate($condition) ? 'sm' : null); - $this->centerModal($condition); + $this->modalWidth(fn (MountableAction $action): ?string => $action->evaluate($condition) ? 'md' : null); return $this; } diff --git a/packages/actions/src/Concerns/InteractsWithActions.php b/packages/actions/src/Concerns/InteractsWithActions.php index a09cabedea..60065645fe 100644 --- a/packages/actions/src/Concerns/InteractsWithActions.php +++ b/packages/actions/src/Concerns/InteractsWithActions.php @@ -190,9 +190,9 @@ trait InteractsWithActions return false; } - return $action->getModalSubheading() || + return $action->getModalDescription() || $action->getModalContent() || - $action->getModalFooter() || + $action->getModalContentFooter() || $action->getInfolist() || $this->mountedActionHasForm(); } diff --git a/packages/actions/src/DeleteAction.php b/packages/actions/src/DeleteAction.php index bedfdd2bda..bf60ff78e4 100644 --- a/packages/actions/src/DeleteAction.php +++ b/packages/actions/src/DeleteAction.php @@ -32,6 +32,8 @@ class DeleteAction extends Action $this->requiresConfirmation(); + $this->modalIcon('heroicon-o-trash'); + $this->keyBindings(['mod+d']); $this->hidden(static function (Model $record): bool { diff --git a/packages/actions/src/ForceDeleteAction.php b/packages/actions/src/ForceDeleteAction.php index 09711e82d2..73706aeba8 100644 --- a/packages/actions/src/ForceDeleteAction.php +++ b/packages/actions/src/ForceDeleteAction.php @@ -30,6 +30,8 @@ class ForceDeleteAction extends Action $this->requiresConfirmation(); + $this->modalIcon('heroicon-o-trash'); + $this->action(function (): void { $result = $this->process(static fn (Model $record) => $record->forceDelete()); diff --git a/packages/actions/src/MountableAction.php b/packages/actions/src/MountableAction.php index 116f7b1d2e..57f0d8ebd6 100644 --- a/packages/actions/src/MountableAction.php +++ b/packages/actions/src/MountableAction.php @@ -21,8 +21,6 @@ class MountableAction extends StaticAction implements HasLivewire use Concerns\HasParentActions; use Concerns\HasWizard; - public static string $modalActionsAlignment = 'left'; - protected function setUp(): void { parent::setUp(); @@ -83,24 +81,4 @@ class MountableAction extends StaticAction implements HasLivewire default => parent::resolveDefaultClosureDependencyForEvaluationByName($parameterName), }; } - - public static function alignModalActionsLeft(): void - { - static::$modalActionsAlignment = 'left'; - } - - public static function alignModalActionsCenter(): void - { - static::$modalActionsAlignment = 'center'; - } - - public static function alignModalActionsRight(): void - { - static::$modalActionsAlignment = 'right'; - } - - public static function getModalActionsAlignment(): string - { - return static::$modalActionsAlignment; - } } diff --git a/packages/actions/src/RestoreAction.php b/packages/actions/src/RestoreAction.php index 9dd3ddfead..bec91325a5 100644 --- a/packages/actions/src/RestoreAction.php +++ b/packages/actions/src/RestoreAction.php @@ -32,6 +32,8 @@ class RestoreAction extends Action $this->requiresConfirmation(); + $this->modalIcon('heroicon-o-arrow-uturn-left'); + $this->action(function (Model $record): void { if (! method_exists($record, 'restore')) { $this->failure(); diff --git a/packages/actions/src/Testing/TestsActions.php b/packages/actions/src/Testing/TestsActions.php index 8df1485eac..08cef848b3 100644 --- a/packages/actions/src/Testing/TestsActions.php +++ b/packages/actions/src/Testing/TestsActions.php @@ -60,7 +60,7 @@ class TestsActions public function setActionData(): Closure { return function (array $data): static { - foreach (Arr::prependKeysWith($data, 'mountedActionsData.' . array_key_last($this->instance()->mountedActionsData) . '.') as $key => $value) { + foreach (Arr::dot($data, prepend: 'mountedActionsData.' . array_key_last($this->instance()->mountedActionsData) . '.') as $key => $value) { $this->set($key, $value); } @@ -71,8 +71,8 @@ class TestsActions public function assertActionDataSet(): Closure { return function (array $data): static { - foreach ($data as $key => $value) { - $this->assertSet('mountedActionsData.' . array_key_last($this->instance()->mountedActionsData) . '.' . $key, $value); + foreach (Arr::dot($data, prepend: 'mountedActionsData.' . array_key_last($this->instance()->mountedActionsData) . '.') as $key => $value) { + $this->assertSet($key, $value); } return $this; diff --git a/packages/forms/dist/components/select.js b/packages/forms/dist/components/select.js index 70cec5dd53..79b8b870a4 100644 --- a/packages/forms/dist/components/select.js +++ b/packages/forms/dist/components/select.js @@ -1,4 +1,4 @@ -var lt=Object.create;var Ge=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var ht=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty;var ft=(se,ie)=>()=>(ie||se((ie={exports:{}}).exports,ie),ie.exports);var pt=(se,ie,X,me)=>{if(ie&&typeof ie=="object"||typeof ie=="function")for(let j of ut(ie))!dt.call(se,j)&&j!==X&&Ge(se,j,{get:()=>ie[j],enumerable:!(me=ct(ie,j))||me.enumerable});return se};var mt=(se,ie,X)=>(X=se!=null?lt(ht(se)):{},pt(ie||!se||!se.__esModule?Ge(X,"default",{value:se,enumerable:!0}):X,se));var $e=ft((Ae,Ye)=>{(function(ie,X){typeof Ae=="object"&&typeof Ye=="object"?Ye.exports=X():typeof define=="function"&&define.amd?define([],X):typeof Ae=="object"?Ae.Choices=X():ie.Choices=X()})(window,function(){return function(){"use strict";var se={282:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.clearChoices=i.activateChoices=i.filterChoices=i.addChoice=void 0;var v=b(883),h=function(c){var a=c.value,I=c.label,L=c.id,y=c.groupId,D=c.disabled,k=c.elementId,Q=c.customProperties,Z=c.placeholder,ne=c.keyCode;return{type:v.ACTION_TYPES.ADD_CHOICE,value:a,label:I,id:L,groupId:y,disabled:D,elementId:k,customProperties:Q,placeholder:Z,keyCode:ne}};i.addChoice=h;var d=function(c){return{type:v.ACTION_TYPES.FILTER_CHOICES,results:c}};i.filterChoices=d;var o=function(c){return c===void 0&&(c=!0),{type:v.ACTION_TYPES.ACTIVATE_CHOICES,active:c}};i.activateChoices=o;var r=function(){return{type:v.ACTION_TYPES.CLEAR_CHOICES}};i.clearChoices=r},783:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.addGroup=void 0;var v=b(883),h=function(d){var o=d.value,r=d.id,c=d.active,a=d.disabled;return{type:v.ACTION_TYPES.ADD_GROUP,value:o,id:r,active:c,disabled:a}};i.addGroup=h},464:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.highlightItem=i.removeItem=i.addItem=void 0;var v=b(883),h=function(r){var c=r.value,a=r.label,I=r.id,L=r.choiceId,y=r.groupId,D=r.customProperties,k=r.placeholder,Q=r.keyCode;return{type:v.ACTION_TYPES.ADD_ITEM,value:c,label:a,id:I,choiceId:L,groupId:y,customProperties:D,placeholder:k,keyCode:Q}};i.addItem=h;var d=function(r,c){return{type:v.ACTION_TYPES.REMOVE_ITEM,id:r,choiceId:c}};i.removeItem=d;var o=function(r,c){return{type:v.ACTION_TYPES.HIGHLIGHT_ITEM,id:r,highlighted:c}};i.highlightItem=o},137:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.setIsLoading=i.resetTo=i.clearAll=void 0;var v=b(883),h=function(){return{type:v.ACTION_TYPES.CLEAR_ALL}};i.clearAll=h;var d=function(r){return{type:v.ACTION_TYPES.RESET_TO,state:r}};i.resetTo=d;var o=function(r){return{type:v.ACTION_TYPES.SET_IS_LOADING,isLoading:r}};i.setIsLoading=o},373:function(j,i,b){var v=this&&this.__spreadArray||function(_,e,t){if(t||arguments.length===2)for(var n=0,l=e.length,g;n=0?this._store.getGroupById(g):null;return this._store.dispatch((0,a.highlightItem)(n,!0)),t&&this.passedElement.triggerEvent(y.EVENTS.highlightItem,{id:n,value:M,label:f,groupValue:u&&u.value?u.value:null}),this},_.prototype.unhighlightItem=function(e){if(!e||!e.id)return this;var t=e.id,n=e.groupId,l=n===void 0?-1:n,g=e.value,P=g===void 0?"":g,M=e.label,K=M===void 0?"":M,f=l>=0?this._store.getGroupById(l):null;return this._store.dispatch((0,a.highlightItem)(t,!1)),this.passedElement.triggerEvent(y.EVENTS.highlightItem,{id:t,value:P,label:K,groupValue:f&&f.value?f.value:null}),this},_.prototype.highlightAll=function(){var e=this;return this._store.items.forEach(function(t){return e.highlightItem(t)}),this},_.prototype.unhighlightAll=function(){var e=this;return this._store.items.forEach(function(t){return e.unhighlightItem(t)}),this},_.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.activeItems.filter(function(n){return n.value===e}).forEach(function(n){return t._removeItem(n)}),this},_.prototype.removeActiveItems=function(e){var t=this;return this._store.activeItems.filter(function(n){var l=n.id;return l!==e}).forEach(function(n){return t._removeItem(n)}),this},_.prototype.removeHighlightedItems=function(e){var t=this;return e===void 0&&(e=!1),this._store.highlightedActiveItems.forEach(function(n){t._removeItem(n),e&&t._triggerChange(n.value)}),this},_.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive?this:(requestAnimationFrame(function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent(y.EVENTS.showDropdown,{})}),this)},_.prototype.hideDropdown=function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame(function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(y.EVENTS.hideDropdown,{})}),this):this},_.prototype.getValue=function(e){e===void 0&&(e=!1);var t=this._store.activeItems.reduce(function(n,l){var g=e?l.value:l;return n.push(g),n},[]);return this._isSelectOneElement?t[0]:t},_.prototype.setValue=function(e){var t=this;return this.initialised?(e.forEach(function(n){return t._setChoiceOrItem(n)}),this):this},_.prototype.setChoiceByValue=function(e){var t=this;if(!this.initialised||this._isTextElement)return this;var n=Array.isArray(e)?e:[e];return n.forEach(function(l){return t._findAndSelectChoiceByValue(l)}),this},_.prototype.setChoices=function(e,t,n,l){var g=this;if(e===void 0&&(e=[]),t===void 0&&(t="value"),n===void 0&&(n="label"),l===void 0&&(l=!1),!this.initialised)throw new ReferenceError("setChoices was called on a non-initialized instance of Choices");if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if(typeof t!="string"||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(l&&this.clearChoices(),typeof e=="function"){var P=e(this);if(typeof Promise=="function"&&P instanceof Promise)return new Promise(function(M){return requestAnimationFrame(M)}).then(function(){return g._handleLoadingState(!0)}).then(function(){return P}).then(function(M){return g.setChoices(M,t,n,l)}).catch(function(M){g.config.silent||console.error(M)}).then(function(){return g._handleLoadingState(!1)}).then(function(){return g});if(!Array.isArray(P))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof P));return this.setChoices(P,t,n,!1)}if(!Array.isArray(e))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._startLoading(),e.forEach(function(M){if(M.choices)g._addGroup({id:M.id?parseInt("".concat(M.id),10):null,group:M,valueKey:t,labelKey:n});else{var K=M;g._addChoice({value:K[t],label:K[n],isSelected:!!K.selected,isDisabled:!!K.disabled,placeholder:!!K.placeholder,customProperties:K.customProperties})}}),this._stopLoading(),this},_.prototype.clearChoices=function(){return this._store.dispatch((0,r.clearChoices)()),this},_.prototype.clearStore=function(){return this._store.dispatch((0,I.clearAll)()),this},_.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch((0,r.activateChoices)(!0))),this},_.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,t=this._isSelectElement,n=this._currentState.items!==this._prevState.items;e&&(t&&this._renderChoices(),n&&this._renderItems(),this._prevState=this._currentState)}},_.prototype._renderChoices=function(){var e=this,t=this._store,n=t.activeGroups,l=t.activeChoices,g=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame(function(){return e.choiceList.scrollToTop()}),n.length>=1&&!this._isSearching){var P=l.filter(function(C){return C.placeholder===!0&&C.groupId===-1});P.length>=1&&(g=this._createChoicesFragment(P,g)),g=this._createGroupsFragment(n,l,g)}else l.length>=1&&(g=this._createChoicesFragment(l,g));if(g.childNodes&&g.childNodes.length>0){var M=this._store.activeItems,K=this._canAddItem(M,this.input.value);if(K.response)this.choiceList.append(g),this._highlightChoice();else{var f=this._getTemplate("notice",K.notice);this.choiceList.append(f)}}else{var u=void 0,f=void 0;this._isSearching?(f=typeof this.config.noResultsText=="function"?this.config.noResultsText():this.config.noResultsText,u=this._getTemplate("notice",f,"no-results")):(f=typeof this.config.noChoicesText=="function"?this.config.noChoicesText():this.config.noChoicesText,u=this._getTemplate("notice",f,"no-choices")),this.choiceList.append(u)}},_.prototype._renderItems=function(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},_.prototype._createGroupsFragment=function(e,t,n){var l=this;n===void 0&&(n=document.createDocumentFragment());var g=function(P){return t.filter(function(M){return l._isSelectOneElement?M.groupId===P.id:M.groupId===P.id&&(l.config.renderSelectedChoices==="always"||!M.selected)})};return this.config.shouldSort&&e.sort(this.config.sorter),e.forEach(function(P){var M=g(P);if(M.length>=1){var K=l._getTemplate("choiceGroup",P);n.appendChild(K),l._createChoicesFragment(M,n,!0)}}),n},_.prototype._createChoicesFragment=function(e,t,n){var l=this;t===void 0&&(t=document.createDocumentFragment()),n===void 0&&(n=!1);var g=this.config,P=g.renderSelectedChoices,M=g.searchResultLimit,K=g.renderChoiceLimit,f=this._isSearching?k.sortByScore:this.config.sorter,u=function(z){var ee=P==="auto"?l._isSelectOneElement||!z.selected:!0;if(ee){var ae=l._getTemplate("choice",z,l.config.itemSelectText);t.appendChild(ae)}},C=e;P==="auto"&&!this._isSelectOneElement&&(C=e.filter(function(z){return!z.selected}));var Y=C.reduce(function(z,ee){return ee.placeholder?z.placeholderChoices.push(ee):z.normalChoices.push(ee),z},{placeholderChoices:[],normalChoices:[]}),V=Y.placeholderChoices,U=Y.normalChoices;(this.config.shouldSort||this._isSearching)&&U.sort(f);var $=C.length,W=this._isSelectOneElement?v(v([],V,!0),U,!0):U;this._isSearching?$=M:K&&K>0&&!n&&($=K);for(var J=0;J<$;J+=1)W[J]&&u(W[J]);return t},_.prototype._createItemsFragment=function(e,t){var n=this;t===void 0&&(t=document.createDocumentFragment());var l=this.config,g=l.shouldSortItems,P=l.sorter,M=l.removeItemButton;g&&!this._isSelectOneElement&&e.sort(P),this._isTextElement?this.passedElement.value=e.map(function(f){var u=f.value;return u}).join(this.config.delimiter):this.passedElement.options=e;var K=function(f){var u=n._getTemplate("item",f,M);t.appendChild(u)};return e.forEach(K),t},_.prototype._triggerChange=function(e){e!=null&&this.passedElement.triggerEvent(y.EVENTS.change,{value:e})},_.prototype._selectPlaceholderChoice=function(e){this._addItem({value:e.value,label:e.label,choiceId:e.id,groupId:e.groupId,placeholder:e.placeholder}),this._triggerChange(e.value)},_.prototype._handleButtonAction=function(e,t){if(!(!e||!t||!this.config.removeItems||!this.config.removeItemButton)){var n=t.parentNode&&t.parentNode.dataset.id,l=n&&e.find(function(g){return g.id===parseInt(n,10)});l&&(this._removeItem(l),this._triggerChange(l.value),this._isSelectOneElement&&this._store.placeholderChoice&&this._selectPlaceholderChoice(this._store.placeholderChoice))}},_.prototype._handleItemAction=function(e,t,n){var l=this;if(n===void 0&&(n=!1),!(!e||!t||!this.config.removeItems||this._isSelectOneElement)){var g=t.dataset.id;e.forEach(function(P){P.id===parseInt("".concat(g),10)&&!P.highlighted?l.highlightItem(P):!n&&P.highlighted&&l.unhighlightItem(P)}),this.input.focus()}},_.prototype._handleChoiceAction=function(e,t){if(!(!e||!t)){var n=t.dataset.id,l=n&&this._store.getChoiceById(n);if(l){var g=e[0]&&e[0].keyCode?e[0].keyCode:void 0,P=this.dropdown.isActive;if(l.keyCode=g,this.passedElement.triggerEvent(y.EVENTS.choice,{choice:l}),!l.selected&&!l.disabled){var M=this._canAddItem(e,l.value);M.response&&(this._addItem({value:l.value,label:l.label,choiceId:l.id,groupId:l.groupId,customProperties:l.customProperties,placeholder:l.placeholder,keyCode:l.keyCode}),this._triggerChange(l.value))}this.clearInput(),P&&this._isSelectOneElement&&(this.hideDropdown(!0),this.containerOuter.focus())}}},_.prototype._handleBackspace=function(e){if(!(!this.config.removeItems||!e)){var t=e[e.length-1],n=e.some(function(l){return l.highlighted});this.config.editItems&&!n&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(n||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},_.prototype._startLoading=function(){this._store.dispatch((0,I.setIsLoading)(!0))},_.prototype._stopLoading=function(){this._store.dispatch((0,I.setIsLoading)(!1))},_.prototype._handleLoadingState=function(e){e===void 0&&(e=!0);var t=this.itemList.getChild(".".concat(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),t&&this.itemList.append(t)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},_.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,n=this.config,l=n.searchFloor,g=n.searchChoices,P=t.some(function(K){return!K.active});if(e!==null&&typeof e<"u"&&e.length>=l){var M=g?this._searchChoices(e):0;this.passedElement.triggerEvent(y.EVENTS.search,{value:e,resultCount:M})}else P&&(this._isSearching=!1,this._store.dispatch((0,r.activateChoices)(!0)))}},_.prototype._canAddItem=function(e,t){var n=!0,l=typeof this.config.addItemText=="function"?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var g=(0,k.existsInArray)(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(n=!1,l=typeof this.config.maxItemText=="function"?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),!this.config.duplicateItemsAllowed&&g&&n&&(n=!1,l=typeof this.config.uniqueItemText=="function"?this.config.uniqueItemText(t):this.config.uniqueItemText),this._isTextElement&&this.config.addItems&&n&&typeof this.config.addItemFilter=="function"&&!this.config.addItemFilter(t)&&(n=!1,l=typeof this.config.customAddItemText=="function"?this.config.customAddItemText(t):this.config.customAddItemText)}return{response:n,notice:l}},_.prototype._searchChoices=function(e){var t=typeof e=="string"?e.trim():e,n=typeof this._currentValue=="string"?this._currentValue.trim():this._currentValue;if(t.length<1&&t==="".concat(n," "))return 0;var l=this._store.searchableChoices,g=t,P=Object.assign(this.config.fuseOptions,{keys:v([],this.config.searchFields,!0),includeMatches:!0}),M=new o.default(l,P),K=M.search(g);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch((0,r.filterChoices)(K)),K.length},_.prototype._addEventListeners=function(){var e=document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},_.prototype._removeEventListeners=function(){var e=document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("keyup",this._onKeyUp),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()},_.prototype._onKeyDown=function(e){var t=e.keyCode,n=this._store.activeItems,l=this.input.isFocussed,g=this.dropdown.isActive,P=this.itemList.hasChildren(),M=String.fromCharCode(t),K=/[^\x00-\x1F]/.test(M),f=y.KEY_CODES.BACK_KEY,u=y.KEY_CODES.DELETE_KEY,C=y.KEY_CODES.ENTER_KEY,Y=y.KEY_CODES.A_KEY,V=y.KEY_CODES.ESC_KEY,U=y.KEY_CODES.UP_KEY,$=y.KEY_CODES.DOWN_KEY,W=y.KEY_CODES.PAGE_UP_KEY,J=y.KEY_CODES.PAGE_DOWN_KEY;switch(!this._isTextElement&&!g&&K&&(this.showDropdown(),this.input.isFocussed||(this.input.value+=e.key.toLowerCase())),t){case Y:return this._onSelectKey(e,P);case C:return this._onEnterKey(e,n,g);case V:return this._onEscapeKey(g);case U:case W:case $:case J:return this._onDirectionKey(e,g);case u:case f:return this._onDeleteKey(e,n,l);default:}},_.prototype._onKeyUp=function(e){var t=e.target,n=e.keyCode,l=this.input.value,g=this._store.activeItems,P=this._canAddItem(g,l),M=y.KEY_CODES.BACK_KEY,K=y.KEY_CODES.DELETE_KEY;if(this._isTextElement){var f=P.notice&&l;if(f){var u=this._getTemplate("notice",P.notice);this.dropdown.element.innerHTML=u.outerHTML,this.showDropdown(!0)}else this.hideDropdown(!0)}else{var C=n===M||n===K,Y=C&&t&&!t.value,V=!this._isTextElement&&this._isSearching,U=this._canSearch&&P.response;Y&&V?(this._isSearching=!1,this._store.dispatch((0,r.activateChoices)(!0))):U&&this._handleSearch(this.input.rawValue)}this._canSearch=this.config.searchEnabled},_.prototype._onSelectKey=function(e,t){var n=e.ctrlKey,l=e.metaKey,g=n||l;if(g&&t){this._canSearch=!1;var P=this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement;P&&this.highlightAll()}},_.prototype._onEnterKey=function(e,t,n){var l=e.target,g=y.KEY_CODES.ENTER_KEY,P=l&&l.hasAttribute("data-button");if(this._isTextElement&&l&&l.value){var M=this.input.value,K=this._canAddItem(t,M);K.response&&(this.hideDropdown(!0),this._addItem({value:M}),this._triggerChange(M),this.clearInput())}if(P&&(this._handleButtonAction(t,l),e.preventDefault()),n){var f=this.dropdown.getChild(".".concat(this.config.classNames.highlightedState));f&&(t[0]&&(t[0].keyCode=g),this._handleChoiceAction(t,f)),e.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),e.preventDefault())},_.prototype._onEscapeKey=function(e){e&&(this.hideDropdown(!0),this.containerOuter.focus())},_.prototype._onDirectionKey=function(e,t){var n=e.keyCode,l=e.metaKey,g=y.KEY_CODES.DOWN_KEY,P=y.KEY_CODES.PAGE_UP_KEY,M=y.KEY_CODES.PAGE_DOWN_KEY;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var K=n===g||n===M?1:-1,f=l||n===M||n===P,u="[data-choice-selectable]",C=void 0;if(f)K>0?C=this.dropdown.element.querySelector("".concat(u,":last-of-type")):C=this.dropdown.element.querySelector(u);else{var Y=this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState));Y?C=(0,k.getAdjacentEl)(Y,u,K):C=this.dropdown.element.querySelector(u)}C&&((0,k.isScrolledIntoView)(C,this.choiceList.element,K)||this.choiceList.scrollToChildElement(C,K),this._highlightChoice(C)),e.preventDefault()}},_.prototype._onDeleteKey=function(e,t,n){var l=e.target;!this._isSelectOneElement&&!l.value&&n&&(this._handleBackspace(t),e.preventDefault())},_.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},_.prototype._onTouchEnd=function(e){var t=(e||e.touches[0]).target,n=this._wasTap&&this.containerOuter.element.contains(t);if(n){var l=t===this.containerOuter.element||t===this.containerInner.element;l&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),e.stopPropagation()}this._wasTap=!0},_.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(E&&this.choiceList.element.contains(t)){var n=this.choiceList.element.firstElementChild,l=this._direction==="ltr"?e.offsetX>=n.offsetWidth:e.offsetX0;l&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0)}},_.prototype._onFocus=function(e){var t,n=this,l=e.target,g=l&&this.containerOuter.element.contains(l);if(g){var P=(t={},t[y.TEXT_TYPE]=function(){l===n.input.element&&n.containerOuter.addFocusState()},t[y.SELECT_ONE_TYPE]=function(){n.containerOuter.addFocusState(),l===n.input.element&&n.showDropdown(!0)},t[y.SELECT_MULTIPLE_TYPE]=function(){l===n.input.element&&(n.showDropdown(!0),n.containerOuter.addFocusState())},t);P[this.passedElement.element.type]()}},_.prototype._onBlur=function(e){var t,n=this,l=e.target,g=l&&this.containerOuter.element.contains(l);if(g&&!this._isScrollingOnIe){var P=this._store.activeItems,M=P.some(function(f){return f.highlighted}),K=(t={},t[y.TEXT_TYPE]=function(){l===n.input.element&&(n.containerOuter.removeFocusState(),M&&n.unhighlightAll(),n.hideDropdown(!0))},t[y.SELECT_ONE_TYPE]=function(){n.containerOuter.removeFocusState(),(l===n.input.element||l===n.containerOuter.element&&!n._canSearch)&&n.hideDropdown(!0)},t[y.SELECT_MULTIPLE_TYPE]=function(){l===n.input.element&&(n.containerOuter.removeFocusState(),n.hideDropdown(!0),M&&n.unhighlightAll())},t);K[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()},_.prototype._onFormReset=function(){this._store.dispatch((0,I.resetTo)(this._initialState))},_.prototype._highlightChoice=function(e){var t=this;e===void 0&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var l=e,g=Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState)));g.forEach(function(P){P.classList.remove(t.config.classNames.highlightedState),P.setAttribute("aria-selected","false")}),l?this._highlightPosition=n.indexOf(l):(n.length>this._highlightPosition?l=n[this._highlightPosition]:l=n[n.length-1],l||(l=n[0])),l.classList.add(this.config.classNames.highlightedState),l.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(y.EVENTS.highlightChoice,{el:l}),this.dropdown.isActive&&(this.input.setActiveDescendant(l.id),this.containerOuter.setActiveDescendant(l.id))}},_.prototype._addItem=function(e){var t=e.value,n=e.label,l=n===void 0?null:n,g=e.choiceId,P=g===void 0?-1:g,M=e.groupId,K=M===void 0?-1:M,f=e.customProperties,u=f===void 0?{}:f,C=e.placeholder,Y=C===void 0?!1:C,V=e.keyCode,U=V===void 0?-1:V,$=typeof t=="string"?t.trim():t,W=this._store.items,J=l||$,z=P||-1,ee=K>=0?this._store.getGroupById(K):null,ae=W?W.length+1:1;this.config.prependValue&&($=this.config.prependValue+$.toString()),this.config.appendValue&&($+=this.config.appendValue.toString()),this._store.dispatch((0,a.addItem)({value:$,label:J,id:ae,choiceId:z,groupId:K,customProperties:u,placeholder:Y,keyCode:U})),this._isSelectOneElement&&this.removeActiveItems(ae),this.passedElement.triggerEvent(y.EVENTS.addItem,{id:ae,value:$,label:J,customProperties:u,groupValue:ee&&ee.value?ee.value:null,keyCode:U})},_.prototype._removeItem=function(e){var t=e.id,n=e.value,l=e.label,g=e.customProperties,P=e.choiceId,M=e.groupId,K=M&&M>=0?this._store.getGroupById(M):null;!t||!P||(this._store.dispatch((0,a.removeItem)(t,P)),this.passedElement.triggerEvent(y.EVENTS.removeItem,{id:t,value:n,label:l,customProperties:g,groupValue:K&&K.value?K.value:null}))},_.prototype._addChoice=function(e){var t=e.value,n=e.label,l=n===void 0?null:n,g=e.isSelected,P=g===void 0?!1:g,M=e.isDisabled,K=M===void 0?!1:M,f=e.groupId,u=f===void 0?-1:f,C=e.customProperties,Y=C===void 0?{}:C,V=e.placeholder,U=V===void 0?!1:V,$=e.keyCode,W=$===void 0?-1:$;if(!(typeof t>"u"||t===null)){var J=this._store.choices,z=l||t,ee=J?J.length+1:1,ae="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(ee);this._store.dispatch((0,r.addChoice)({id:ee,groupId:u,elementId:ae,value:t,label:z,disabled:K,customProperties:Y,placeholder:U,keyCode:W})),P&&this._addItem({value:t,label:z,choiceId:ee,customProperties:Y,placeholder:U,keyCode:W})}},_.prototype._addGroup=function(e){var t=this,n=e.group,l=e.id,g=e.valueKey,P=g===void 0?"value":g,M=e.labelKey,K=M===void 0?"label":M,f=(0,k.isType)("Object",n)?n.choices:Array.from(n.getElementsByTagName("OPTION")),u=l||Math.floor(new Date().valueOf()*Math.random()),C=n.disabled?n.disabled:!1;if(f){this._store.dispatch((0,c.addGroup)({value:n.label,id:u,active:!0,disabled:C}));var Y=function(V){var U=V.disabled||V.parentNode&&V.parentNode.disabled;t._addChoice({value:V[P],label:(0,k.isType)("Object",V)?V[K]:V.innerHTML,isSelected:V.selected,isDisabled:U,groupId:u,customProperties:V.customProperties,placeholder:V.placeholder})};f.forEach(Y)}else this._store.dispatch((0,c.addGroup)({value:n.label,id:n.id,active:!1,disabled:n.disabled}))},_.prototype._getTemplate=function(e){for(var t,n=[],l=1;l0?this.element.scrollTop+y-I:o.offsetTop;requestAnimationFrame(function(){c._animateScroll(D,r)})}},d.prototype._scrollDown=function(o,r,c){var a=(c-o)/r,I=a>1?a:1;this.element.scrollTop=o+I},d.prototype._scrollUp=function(o,r,c){var a=(o-c)/r,I=a>1?a:1;this.element.scrollTop=o-I},d.prototype._animateScroll=function(o,r){var c=this,a=v.SCROLLING_SPEED,I=this.element.scrollTop,L=!1;r>0?(this._scrollDown(I,a,o),Io&&(L=!0)),L&&requestAnimationFrame(function(){c._animateScroll(o,r)})},d}();i.default=h},730:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0});var v=b(799),h=function(){function d(o){var r=o.element,c=o.classNames;if(this.element=r,this.classNames=c,!(r instanceof HTMLInputElement)&&!(r instanceof HTMLSelectElement))throw new TypeError("Invalid element passed");this.isDisabled=!1}return Object.defineProperty(d.prototype,"isActive",{get:function(){return this.element.dataset.choice==="active"},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"value",{get:function(){return this.element.value},set:function(o){this.element.value=o},enumerable:!1,configurable:!0}),d.prototype.conceal=function(){this.element.classList.add(this.classNames.input),this.element.hidden=!0,this.element.tabIndex=-1;var o=this.element.getAttribute("style");o&&this.element.setAttribute("data-choice-orig-style",o),this.element.setAttribute("data-choice","active")},d.prototype.reveal=function(){this.element.classList.remove(this.classNames.input),this.element.hidden=!1,this.element.removeAttribute("tabindex");var o=this.element.getAttribute("data-choice-orig-style");o?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",o)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},d.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},d.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},d.prototype.triggerEvent=function(o,r){(0,v.dispatchEvent)(this.element,o,r)},d}();i.default=h},541:function(j,i,b){var v=this&&this.__extends||function(){var r=function(c,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,L){I.__proto__=L}||function(I,L){for(var y in L)Object.prototype.hasOwnProperty.call(L,y)&&(I[y]=L[y])},r(c,a)};return function(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(c,a);function I(){this.constructor=c}c.prototype=a===null?Object.create(a):(I.prototype=a.prototype,new I)}}(),h=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(i,"__esModule",{value:!0});var d=h(b(730)),o=function(r){v(c,r);function c(a){var I=a.element,L=a.classNames,y=a.delimiter,D=r.call(this,{element:I,classNames:L})||this;return D.delimiter=y,D}return Object.defineProperty(c.prototype,"value",{get:function(){return this.element.value},set:function(a){this.element.setAttribute("value",a),this.element.value=a},enumerable:!1,configurable:!0}),c}(d.default);i.default=o},982:function(j,i,b){var v=this&&this.__extends||function(){var r=function(c,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,L){I.__proto__=L}||function(I,L){for(var y in L)Object.prototype.hasOwnProperty.call(L,y)&&(I[y]=L[y])},r(c,a)};return function(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(c,a);function I(){this.constructor=c}c.prototype=a===null?Object.create(a):(I.prototype=a.prototype,new I)}}(),h=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(i,"__esModule",{value:!0});var d=h(b(730)),o=function(r){v(c,r);function c(a){var I=a.element,L=a.classNames,y=a.template,D=r.call(this,{element:I,classNames:L})||this;return D.template=y,D}return Object.defineProperty(c.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"optionGroups",{get:function(){return Array.from(this.element.getElementsByTagName("OPTGROUP"))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"options",{get:function(){return Array.from(this.element.options)},set:function(a){var I=this,L=document.createDocumentFragment(),y=function(D){var k=I.template(D);L.appendChild(k)};a.forEach(function(D){return y(D)}),this.appendDocFragment(L)},enumerable:!1,configurable:!0}),c.prototype.appendDocFragment=function(a){this.element.innerHTML="",this.element.appendChild(a)},c}(d.default);i.default=o},883:function(j,i){Object.defineProperty(i,"__esModule",{value:!0}),i.SCROLLING_SPEED=i.SELECT_MULTIPLE_TYPE=i.SELECT_ONE_TYPE=i.TEXT_TYPE=i.KEY_CODES=i.ACTION_TYPES=i.EVENTS=void 0,i.EVENTS={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice",unhighlightItem:"unhighlightItem"},i.ACTION_TYPES={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL",RESET_TO:"RESET_TO",SET_IS_LOADING:"SET_IS_LOADING"},i.KEY_CODES={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34},i.TEXT_TYPE="text",i.SELECT_ONE_TYPE="select-one",i.SELECT_MULTIPLE_TYPE="select-multiple",i.SCROLLING_SPEED=4},789:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CONFIG=i.DEFAULT_CLASSNAMES=void 0;var v=b(799);i.DEFAULT_CLASSNAMES={containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",selectedState:"is-selected",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"},i.DEFAULT_CONFIG={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,addItemFilter:null,removeItems:!0,removeItemButton:!1,editItems:!1,allowHTML:!0,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:v.sortByAlpha,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(h){return'Press Enter to add "'.concat((0,v.sanitise)(h),'"')},maxItemText:function(h){return"Only ".concat(h," values can be added")},valueComparer:function(h,d){return h===d},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:i.DEFAULT_CLASSNAMES}},18:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},978:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},948:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},359:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},285:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},533:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},187:function(j,i,b){var v=this&&this.__createBinding||(Object.create?function(d,o,r,c){c===void 0&&(c=r);var a=Object.getOwnPropertyDescriptor(o,r);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[r]}}),Object.defineProperty(d,c,a)}:function(d,o,r,c){c===void 0&&(c=r),d[c]=o[r]}),h=this&&this.__exportStar||function(d,o){for(var r in d)r!=="default"&&!Object.prototype.hasOwnProperty.call(o,r)&&v(o,d,r)};Object.defineProperty(i,"__esModule",{value:!0}),h(b(18),i),h(b(978),i),h(b(948),i),h(b(359),i),h(b(285),i),h(b(533),i),h(b(287),i),h(b(132),i),h(b(837),i),h(b(598),i),h(b(369),i),h(b(37),i),h(b(47),i),h(b(923),i),h(b(876),i)},287:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},132:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},837:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},598:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},37:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},369:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},47:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},923:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},876:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},799:function(j,i){Object.defineProperty(i,"__esModule",{value:!0}),i.parseCustomProperties=i.diff=i.cloneObject=i.existsInArray=i.dispatchEvent=i.sortByScore=i.sortByAlpha=i.strToEl=i.sanitise=i.isScrolledIntoView=i.getAdjacentEl=i.wrap=i.isType=i.getType=i.generateId=i.generateChars=i.getRandomNumber=void 0;var b=function(E,w){return Math.floor(Math.random()*(w-E)+E)};i.getRandomNumber=b;var v=function(E){return Array.from({length:E},function(){return(0,i.getRandomNumber)(0,36).toString(36)}).join("")};i.generateChars=v;var h=function(E,w){var N=E.id||E.name&&"".concat(E.name,"-").concat((0,i.generateChars)(2))||(0,i.generateChars)(4);return N=N.replace(/(:|\.|\[|\]|,)/g,""),N="".concat(w,"-").concat(N),N};i.generateId=h;var d=function(E){return Object.prototype.toString.call(E).slice(8,-1)};i.getType=d;var o=function(E,w){return w!=null&&(0,i.getType)(w)===E};i.isType=o;var r=function(E,w){return w===void 0&&(w=document.createElement("div")),E.parentNode&&(E.nextSibling?E.parentNode.insertBefore(w,E.nextSibling):E.parentNode.appendChild(w)),w.appendChild(E)};i.wrap=r;var c=function(E,w,N){N===void 0&&(N=1);for(var _="".concat(N>0?"next":"previous","ElementSibling"),e=E[_];e;){if(e.matches(w))return e;e=e[_]}return e};i.getAdjacentEl=c;var a=function(E,w,N){if(N===void 0&&(N=1),!E)return!1;var _;return N>0?_=w.scrollTop+w.offsetHeight>=E.offsetTop+E.offsetHeight:_=E.offsetTop>=w.scrollTop,_};i.isScrolledIntoView=a;var I=function(E){return typeof E!="string"?E:E.replace(/&/g,"&").replace(/>/g,">").replace(/-1?h.map(function(y){var D=y;return D.id===parseInt("".concat(c.choiceId),10)&&(D.selected=!0),D}):h}case"REMOVE_ITEM":{var a=d;return a.choiceId&&a.choiceId>-1?h.map(function(y){var D=y;return D.id===parseInt("".concat(a.choiceId),10)&&(D.selected=!1),D}):h}case"FILTER_CHOICES":{var I=d;return h.map(function(y){var D=y;return D.active=I.results.some(function(k){var Q=k.item,Z=k.score;return Q.id===D.id?(D.score=Z,!0):!1}),D})}case"ACTIVATE_CHOICES":{var L=d;return h.map(function(y){var D=y;return D.active=L.active,D})}case"CLEAR_CHOICES":return i.defaultState;default:return h}}i.default=v},871:function(j,i){var b=this&&this.__spreadArray||function(h,d,o){if(o||arguments.length===2)for(var r=0,c=d.length,a;r0?"treeitem":"option"),Object.assign(t.dataset,{choice:"",id:Q,value:Z,selectText:d}),N?(t.classList.add(D),t.dataset.choiceDisabled="",t.setAttribute("aria-disabled","true")):(t.classList.add(L),t.dataset.choiceSelectable=""),t},input:function(v,h){var d=v.classNames,o=d.input,r=d.inputCloned,c=Object.assign(document.createElement("input"),{type:"search",name:"search_terms",className:"".concat(o," ").concat(r),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return c.setAttribute("role","textbox"),c.setAttribute("aria-autocomplete","list"),c.setAttribute("aria-label",h),c},dropdown:function(v){var h=v.classNames,d=h.list,o=h.listDropdown,r=document.createElement("div");return r.classList.add(d,o),r.setAttribute("aria-expanded","false"),r},notice:function(v,h,d){var o,r=v.allowHTML,c=v.classNames,a=c.item,I=c.itemChoice,L=c.noResults,y=c.noChoices;d===void 0&&(d="");var D=[a,I];return d==="no-choices"?D.push(y):d==="no-results"&&D.push(L),Object.assign(document.createElement("div"),(o={},o[r?"innerHTML":"innerText"]=h,o.className=D.join(" "),o))},option:function(v){var h=v.label,d=v.value,o=v.customProperties,r=v.active,c=v.disabled,a=new Option(h,d,!1,r);return o&&(a.dataset.customProperties="".concat(o)),a.disabled=!!c,a}};i.default=b},996:function(j){var i=function(w){return b(w)&&!v(w)};function b(E){return!!E&&typeof E=="object"}function v(E){var w=Object.prototype.toString.call(E);return w==="[object RegExp]"||w==="[object Date]"||o(E)}var h=typeof Symbol=="function"&&Symbol.for,d=h?Symbol.for("react.element"):60103;function o(E){return E.$$typeof===d}function r(E){return Array.isArray(E)?[]:{}}function c(E,w){return w.clone!==!1&&w.isMergeableObject(E)?Z(r(E),E,w):E}function a(E,w,N){return E.concat(w).map(function(_){return c(_,N)})}function I(E,w){if(!w.customMerge)return Z;var N=w.customMerge(E);return typeof N=="function"?N:Z}function L(E){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(E).filter(function(w){return E.propertyIsEnumerable(w)}):[]}function y(E){return Object.keys(E).concat(L(E))}function D(E,w){try{return w in E}catch{return!1}}function k(E,w){return D(E,w)&&!(Object.hasOwnProperty.call(E,w)&&Object.propertyIsEnumerable.call(E,w))}function Q(E,w,N){var _={};return N.isMergeableObject(E)&&y(E).forEach(function(e){_[e]=c(E[e],N)}),y(w).forEach(function(e){k(E,e)||(D(E,e)&&N.isMergeableObject(w[e])?_[e]=I(e,N)(E[e],w[e],N):_[e]=c(w[e],N))}),_}function Z(E,w,N){N=N||{},N.arrayMerge=N.arrayMerge||a,N.isMergeableObject=N.isMergeableObject||i,N.cloneUnlessOtherwiseSpecified=c;var _=Array.isArray(w),e=Array.isArray(E),t=_===e;return t?_?N.arrayMerge(E,w,N):Q(E,w,N):c(w,N)}Z.all=function(w,N){if(!Array.isArray(w))throw new Error("first argument should be an array");return w.reduce(function(_,e){return Z(_,e,N)},{})};var ne=Z;j.exports=ne},221:function(j,i,b){b.r(i),b.d(i,{default:function(){return Se}});function v(p){return Array.isArray?Array.isArray(p):k(p)==="[object Array]"}let h=1/0;function d(p){if(typeof p=="string")return p;let s=p+"";return s=="0"&&1/p==-h?"-0":s}function o(p){return p==null?"":d(p)}function r(p){return typeof p=="string"}function c(p){return typeof p=="number"}function a(p){return p===!0||p===!1||L(p)&&k(p)=="[object Boolean]"}function I(p){return typeof p=="object"}function L(p){return I(p)&&p!==null}function y(p){return p!=null}function D(p){return!p.trim().length}function k(p){return p==null?p===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(p)}let Q="Extended search is not available",Z="Incorrect 'index' type",ne=p=>`Invalid value for key ${p}`,E=p=>`Pattern length exceeds max of ${p}.`,w=p=>`Missing ${p} property in key`,N=p=>`Property 'weight' in key '${p}' must be a positive integer`,_=Object.prototype.hasOwnProperty;class e{constructor(s){this._keys=[],this._keyMap={};let m=0;s.forEach(S=>{let O=t(S);m+=O.weight,this._keys.push(O),this._keyMap[O.id]=O,m+=O.weight}),this._keys.forEach(S=>{S.weight/=m})}get(s){return this._keyMap[s]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function t(p){let s=null,m=null,S=null,O=1,T=null;if(r(p)||v(p))S=p,s=n(p),m=l(p);else{if(!_.call(p,"name"))throw new Error(w("name"));let A=p.name;if(S=A,_.call(p,"weight")&&(O=p.weight,O<=0))throw new Error(N(A));s=n(A),m=l(A),T=p.getFn}return{path:s,id:m,weight:O,src:S,getFn:T}}function n(p){return v(p)?p:p.split(".")}function l(p){return v(p)?p.join("."):p}function g(p,s){let m=[],S=!1,O=(T,A,R)=>{if(y(T))if(!A[R])m.push(T);else{let F=A[R],H=T[F];if(!y(H))return;if(R===A.length-1&&(r(H)||c(H)||a(H)))m.push(o(H));else if(v(H)){S=!0;for(let B=0,x=H.length;Bp.score===s.score?p.idx{this._keysMap[m.id]=S})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,r(this.docs[0])?this.docs.forEach((s,m)=>{this._addString(s,m)}):this.docs.forEach((s,m)=>{this._addObject(s,m)}),this.norm.clear())}add(s){let m=this.size();r(s)?this._addString(s,m):this._addObject(s,m)}removeAt(s){this.records.splice(s,1);for(let m=s,S=this.size();m{let A=O.getFn?O.getFn(s):this.getFn(s,O.path);if(y(A)){if(v(A)){let R=[],F=[{nestedArrIndex:-1,value:A}];for(;F.length;){let{nestedArrIndex:H,value:B}=F.pop();if(y(B))if(r(B)&&!D(B)){let x={v:B,i:H,n:this.norm.get(B)};R.push(x)}else v(B)&&B.forEach((x,G)=>{F.push({nestedArrIndex:G,value:x})})}S.$[T]=R}else if(r(A)&&!D(A)){let R={v:A,n:this.norm.get(A)};S.$[T]=R}}}),this.records.push(S)}toJSON(){return{keys:this.keys,records:this.records}}}function U(p,s,{getFn:m=u.getFn,fieldNormWeight:S=u.fieldNormWeight}={}){let O=new V({getFn:m,fieldNormWeight:S});return O.setKeys(p.map(t)),O.setSources(s),O.create(),O}function $(p,{getFn:s=u.getFn,fieldNormWeight:m=u.fieldNormWeight}={}){let{keys:S,records:O}=p,T=new V({getFn:s,fieldNormWeight:m});return T.setKeys(S),T.setIndexRecords(O),T}function W(p,{errors:s=0,currentLocation:m=0,expectedLocation:S=0,distance:O=u.distance,ignoreLocation:T=u.ignoreLocation}={}){let A=s/p.length;if(T)return A;let R=Math.abs(S-m);return O?A+R/O:R?1:A}function J(p=[],s=u.minMatchCharLength){let m=[],S=-1,O=-1,T=0;for(let A=p.length;T=s&&m.push([S,O]),S=-1)}return p[T-1]&&T-S>=s&&m.push([S,T-1]),m}let z=32;function ee(p,s,m,{location:S=u.location,distance:O=u.distance,threshold:T=u.threshold,findAllMatches:A=u.findAllMatches,minMatchCharLength:R=u.minMatchCharLength,includeMatches:F=u.includeMatches,ignoreLocation:H=u.ignoreLocation}={}){if(s.length>z)throw new Error(E(z));let B=s.length,x=p.length,G=Math.max(0,Math.min(S,x)),q=T,re=G,ue=R>1||F,Ee=ue?Array(x):[],ve;for(;(ve=p.indexOf(s,re))>-1;){let he=W(s,{currentLocation:ve,expectedLocation:G,distance:O,ignoreLocation:H});if(q=Math.min(he,q),re=ve+B,ue){let ge=0;for(;ge=Ue;fe-=1){let Le=fe-1,We=m[p.charAt(Le)];if(ue&&(Ee[Le]=+!!We),Ie[fe]=(Ie[fe+1]<<1|1)&We,he&&(Ie[fe]|=(Oe[fe+1]|Oe[fe])<<1|1|Oe[fe+1]),Ie[fe]&at&&(be=W(s,{errors:he,currentLocation:Le,expectedLocation:G,distance:O,ignoreLocation:H}),be<=q)){if(q=be,re=Le,re<=G)break;Ue=Math.max(1,2*G-re)}}if(W(s,{errors:he+1,currentLocation:G,expectedLocation:G,distance:O,ignoreLocation:H})>q)break;Oe=Ie}let Ke={isMatch:re>=0,score:Math.max(.001,be)};if(ue){let he=J(Ee,R);he.length?F&&(Ke.indices=he):Ke.isMatch=!1}return Ke}function ae(p){let s={};for(let m=0,S=p.length;m{this.chunks.push({pattern:G,alphabet:ae(G),startIndex:q})},x=this.pattern.length;if(x>z){let G=0,q=x%z,re=x-q;for(;G{let{isMatch:ve,score:Oe,indices:be}=ee(s,re,ue,{location:O+Ee,distance:T,threshold:A,findAllMatches:R,minMatchCharLength:F,includeMatches:S,ignoreLocation:H});ve&&(G=!0),x+=Oe,ve&&be&&(B=[...B,...be])});let q={isMatch:G,score:G?x/this.chunks.length:1};return G&&S&&(q.indices=B),q}}class le{constructor(s){this.pattern=s}static isMultiMatch(s){return _e(s,this.multiRegex)}static isSingleMatch(s){return _e(s,this.singleRegex)}search(){}}function _e(p,s){let m=p.match(s);return m?m[1]:null}class te extends le{constructor(s){super(s)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(s){let m=s===this.pattern;return{isMatch:m,score:m?0:1,indices:[0,this.pattern.length-1]}}}class de extends le{constructor(s){super(s)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(s){let S=s.indexOf(this.pattern)===-1;return{isMatch:S,score:S?0:1,indices:[0,s.length-1]}}}class pe extends le{constructor(s){super(s)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(s){let m=s.startsWith(this.pattern);return{isMatch:m,score:m?0:1,indices:[0,this.pattern.length-1]}}}class oe extends le{constructor(s){super(s)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(s){let m=!s.startsWith(this.pattern);return{isMatch:m,score:m?0:1,indices:[0,s.length-1]}}}class Te extends le{constructor(s){super(s)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(s){let m=s.endsWith(this.pattern);return{isMatch:m,score:m?0:1,indices:[s.length-this.pattern.length,s.length-1]}}}class Pe extends le{constructor(s){super(s)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(s){let m=!s.endsWith(this.pattern);return{isMatch:m,score:m?0:1,indices:[0,s.length-1]}}}class He extends le{constructor(s,{location:m=u.location,threshold:S=u.threshold,distance:O=u.distance,includeMatches:T=u.includeMatches,findAllMatches:A=u.findAllMatches,minMatchCharLength:R=u.minMatchCharLength,isCaseSensitive:F=u.isCaseSensitive,ignoreLocation:H=u.ignoreLocation}={}){super(s),this._bitapSearch=new ce(s,{location:m,threshold:S,distance:O,includeMatches:T,findAllMatches:A,minMatchCharLength:R,isCaseSensitive:F,ignoreLocation:H})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(s){return this._bitapSearch.searchIn(s)}}class Be extends le{constructor(s){super(s)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(s){let m=0,S,O=[],T=this.pattern.length;for(;(S=s.indexOf(this.pattern,m))>-1;)m=S+T,O.push([S,m-1]);let A=!!O.length;return{isMatch:A,score:A?0:1,indices:O}}}let Me=[te,Be,pe,oe,Pe,Te,de,He],Ve=Me.length,Xe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Je="|";function Qe(p,s={}){return p.split(Je).map(m=>{let S=m.trim().split(Xe).filter(T=>T&&!!T.trim()),O=[];for(let T=0,A=S.length;T!!(p[Ce.AND]||p[Ce.OR]),tt=p=>!!p[je.PATH],it=p=>!v(p)&&I(p)&&!Re(p),ke=p=>({[Ce.AND]:Object.keys(p).map(s=>({[s]:p[s]}))});function xe(p,s,{auto:m=!0}={}){let S=O=>{let T=Object.keys(O),A=tt(O);if(!A&&T.length>1&&!Re(O))return S(ke(O));if(it(O)){let F=A?O[je.PATH]:T[0],H=A?O[je.PATTERN]:O[F];if(!r(H))throw new Error(ne(F));let B={keyId:l(F),pattern:H};return m&&(B.searcher=Ne(H,s)),B}let R={children:[],operator:T[0]};return T.forEach(F=>{let H=O[F];v(H)&&H.forEach(B=>{R.children.push(S(B))})}),R};return Re(p)||(p=ke(p)),S(p)}function nt(p,{ignoreFieldNorm:s=u.ignoreFieldNorm}){p.forEach(m=>{let S=1;m.matches.forEach(({key:O,norm:T,score:A})=>{let R=O?O.weight:null;S*=Math.pow(A===0&&R?Number.EPSILON:A,(R||1)*(s?1:T))}),m.score=S})}function rt(p,s){let m=p.matches;s.matches=[],y(m)&&m.forEach(S=>{if(!y(S.indices)||!S.indices.length)return;let{indices:O,value:T}=S,A={indices:O,value:T};S.key&&(A.key=S.key.src),S.idx>-1&&(A.refIndex=S.idx),s.matches.push(A)})}function st(p,s){s.score=p.score}function ot(p,s,{includeMatches:m=u.includeMatches,includeScore:S=u.includeScore}={}){let O=[];return m&&O.push(rt),S&&O.push(st),p.map(T=>{let{idx:A}=T,R={item:s[A],refIndex:A};return O.length&&O.forEach(F=>{F(T,R)}),R})}class Se{constructor(s,m={},S){this.options={...u,...m},this.options.useExtendedSearch,this._keyStore=new e(this.options.keys),this.setCollection(s,S)}setCollection(s,m){if(this._docs=s,m&&!(m instanceof V))throw new Error(Z);this._myIndex=m||U(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(s){y(s)&&(this._docs.push(s),this._myIndex.add(s))}remove(s=()=>!1){let m=[];for(let S=0,O=this._docs.length;S-1&&(F=F.slice(0,m)),ot(F,this._docs,{includeMatches:S,includeScore:O})}_searchStringList(s){let m=Ne(s,this.options),{records:S}=this._myIndex,O=[];return S.forEach(({v:T,i:A,n:R})=>{if(!y(T))return;let{isMatch:F,score:H,indices:B}=m.searchIn(T);F&&O.push({item:T,idx:A,matches:[{score:H,value:T,norm:R,indices:B}]})}),O}_searchLogical(s){let m=xe(s,this.options),S=(R,F,H)=>{if(!R.children){let{keyId:x,searcher:G}=R,q=this._findMatches({key:this._keyStore.get(x),value:this._myIndex.getValueForItemAtKeyId(F,x),searcher:G});return q&&q.length?[{idx:H,item:F,matches:q}]:[]}let B=[];for(let x=0,G=R.children.length;x{if(y(R)){let H=S(m,R,F);H.length&&(T[F]||(T[F]={idx:F,item:R,matches:[]},A.push(T[F])),H.forEach(({matches:B})=>{T[F].matches.push(...B)}))}}),A}_searchObjectList(s){let m=Ne(s,this.options),{keys:S,records:O}=this._myIndex,T=[];return O.forEach(({$:A,i:R})=>{if(!y(A))return;let F=[];S.forEach((H,B)=>{F.push(...this._findMatches({key:H,value:A[B],searcher:m}))}),F.length&&T.push({idx:R,item:A,matches:F})}),T}_findMatches({key:s,value:m,searcher:S}){if(!y(m))return[];let O=[];if(v(m))m.forEach(({v:T,i:A,n:R})=>{if(!y(T))return;let{isMatch:F,score:H,indices:B}=S.searchIn(T);F&&O.push({score:H,key:s,value:T,idx:A,norm:R,indices:B})});else{let{v:T,n:A}=m,{isMatch:R,score:F,indices:H}=S.searchIn(T);R&&O.push({score:F,key:s,value:T,norm:A,indices:H})}return O}}Se.version="6.6.2",Se.createIndex=U,Se.parseIndex=$,Se.config=u,Se.parseQuery=xe,et(qe)},791:function(j,i,b){b.r(i),b.d(i,{__DO_NOT_USE__ActionTypes:function(){return y},applyMiddleware:function(){return M},bindActionCreators:function(){return g},combineReducers:function(){return n},compose:function(){return P},createStore:function(){return w},legacy_createStore:function(){return N}});function v(f){"@babel/helpers - typeof";return v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},v(f)}function h(f,u){if(v(f)!=="object"||f===null)return f;var C=f[Symbol.toPrimitive];if(C!==void 0){var Y=C.call(f,u||"default");if(v(Y)!=="object")return Y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(f)}function d(f){var u=h(f,"string");return v(u)==="symbol"?u:String(u)}function o(f,u,C){return u=d(u),u in f?Object.defineProperty(f,u,{value:C,enumerable:!0,configurable:!0,writable:!0}):f[u]=C,f}function r(f,u){var C=Object.keys(f);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(f);u&&(Y=Y.filter(function(V){return Object.getOwnPropertyDescriptor(f,V).enumerable})),C.push.apply(C,Y)}return C}function c(f){for(var u=1;u"u"&&(C=u,u=void 0),typeof C<"u"){if(typeof C!="function")throw new Error(a(1));return C(w)(f,u)}if(typeof f!="function")throw new Error(a(2));var V=f,U=u,$=[],W=$,J=!1;function z(){W===$&&(W=$.slice())}function ee(){if(J)throw new Error(a(3));return U}function ae(te){if(typeof te!="function")throw new Error(a(4));if(J)throw new Error(a(5));var de=!0;return z(),W.push(te),function(){if(de){if(J)throw new Error(a(6));de=!1,z();var oe=W.indexOf(te);W.splice(oe,1),$=null}}}function ce(te){if(!D(te))throw new Error(a(7));if(typeof te.type>"u")throw new Error(a(8));if(J)throw new Error(a(9));try{J=!0,U=V(U,te)}finally{J=!1}for(var de=$=W,pe=0;pe0)return"Unexpected "+($.length>1?"keys":"key")+" "+('"'+$.join('", "')+'" found in '+U+". ")+"Expected to find one of the known reducer keys instead: "+('"'+V.join('", "')+'". Unexpected keys will be ignored.')}function t(f){Object.keys(f).forEach(function(u){var C=f[u],Y=C(void 0,{type:y.INIT});if(typeof Y>"u")throw new Error(a(12));if(typeof C(void 0,{type:y.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(a(13))})}function n(f){for(var u=Object.keys(f),C={},Y=0;Y"u"){var Te=ee&&ee.type;throw new Error(a(14))}le[te]=oe,ce=ce||oe!==pe}return ce=ce||U.length!==Object.keys(z).length,ce?le:z}}function l(f,u){return function(){return u(f.apply(this,arguments))}}function g(f,u){if(typeof f=="function")return l(f,u);if(typeof f!="object"||f===null)throw new Error(a(16));var C={};for(var Y in f){var V=f[Y];typeof V=="function"&&(C[Y]=l(V,u))}return C}function P(){for(var f=arguments.length,u=new Array(f),C=0;Cwindow.pluralize(I,e,{count:e}),noChoicesText:E,noResultsText:L,placeholderValue:k,position:Q??"auto",removeItemButton:se,renderChoiceLimit:D,searchFields:w??["label"],searchPlaceholderValue:E,searchResultLimit:D,shouldSort:!1,searchFloor:o?0:1}),await this.refreshChoices({withInitialOptions:!0}),[null,void 0,""].includes(this.state)||this.select.setChoiceByValue(this.formatState(this.state)),this.refreshPlaceholder(),b&&this.select.showDropdown(),this.$refs.input.addEventListener("change",()=>{this.refreshPlaceholder(),!this.isStateBeingUpdated&&(this.isStateBeingUpdated=!0,this.state=this.select.getValue(!0)??null,this.$nextTick(()=>this.isStateBeingUpdated=!1))}),d&&this.$refs.input.addEventListener("showDropdown",async()=>{this.select.clearChoices(),await this.select.setChoices([{label:c,value:"",disabled:!0}]),await this.refreshChoices()}),o&&(this.$refs.input.addEventListener("search",async e=>{let t=e.detail.value?.trim();this.isSearching=!0,this.select.clearChoices(),await this.select.setChoices([{label:[null,void 0,""].includes(t)?c:ne,value:"",disabled:!0}])}),this.$refs.input.addEventListener("search",Alpine.debounce(async e=>{await this.refreshChoices({search:e.detail.value?.trim()}),this.isSearching=!1},Z))),h||window.addEventListener("filament-forms::select.refreshSelectedOptionLabel",async e=>{e.detail.livewireId===r&&e.detail.statePath===_&&await this.refreshSelectedOption()}),this.$watch("state",async()=>{this.select&&(this.refreshPlaceholder(),!this.isStateBeingUpdated&&await this.refreshSelectedOption())})},destroy:function(){this.select.destroy(),this.select=null},refreshChoices:async function(e={}){this.setChoices(await this.getChoices(e))},refreshSelectedOption:async function(){let e=await this.getChoices({withInitialOptions:!d});this.select.clearStore(),this.setChoices(e),[null,void 0,""].includes(this.state)||this.select.setChoiceByValue(this.formatState(this.state))},setChoices:function(e){this.select.setChoices(e,"value","label",!0)},getChoices:async function(e={}){let t=await this.getOptions(e);return t.concat(await this.getMissingOptions(t))},getOptions:async function({search:e,withInitialOptions:t}){return t?y:e!==""&&e!==null&&e!==void 0?await i(e):await j()},refreshPlaceholder:function(){v||h||(this.select._renderItems(),[null,void 0,""].includes(this.state)&&(this.$el.querySelector(".choices__list--single").innerHTML=`
${k}
`))},formatState:function(e){return h?(e??[]).map(t=>t?.toString()):e?.toString()},getMissingOptions:async function(e){let t=this.formatState(this.state);if([null,void 0,"",[],{}].includes(t))return{};let n=new Set(e.length?e.map(l=>l.value):[]);return h?t.every(l=>n.has(l))?{}:await me():n.has(t)?n:[{label:await X(),value:t}]}}}export{vt as default}; +var lt=Object.create;var Ge=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var ht=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty;var ft=(se,ie)=>()=>(ie||se((ie={exports:{}}).exports,ie),ie.exports);var pt=(se,ie,X,me)=>{if(ie&&typeof ie=="object"||typeof ie=="function")for(let j of ut(ie))!dt.call(se,j)&&j!==X&&Ge(se,j,{get:()=>ie[j],enumerable:!(me=ct(ie,j))||me.enumerable});return se};var mt=(se,ie,X)=>(X=se!=null?lt(ht(se)):{},pt(ie||!se||!se.__esModule?Ge(X,"default",{value:se,enumerable:!0}):X,se));var $e=ft((Ae,Ye)=>{(function(ie,X){typeof Ae=="object"&&typeof Ye=="object"?Ye.exports=X():typeof define=="function"&&define.amd?define([],X):typeof Ae=="object"?Ae.Choices=X():ie.Choices=X()})(window,function(){return function(){"use strict";var se={282:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.clearChoices=i.activateChoices=i.filterChoices=i.addChoice=void 0;var v=b(883),h=function(c){var a=c.value,I=c.label,L=c.id,y=c.groupId,D=c.disabled,k=c.elementId,Q=c.customProperties,Z=c.placeholder,ne=c.keyCode;return{type:v.ACTION_TYPES.ADD_CHOICE,value:a,label:I,id:L,groupId:y,disabled:D,elementId:k,customProperties:Q,placeholder:Z,keyCode:ne}};i.addChoice=h;var d=function(c){return{type:v.ACTION_TYPES.FILTER_CHOICES,results:c}};i.filterChoices=d;var o=function(c){return c===void 0&&(c=!0),{type:v.ACTION_TYPES.ACTIVATE_CHOICES,active:c}};i.activateChoices=o;var r=function(){return{type:v.ACTION_TYPES.CLEAR_CHOICES}};i.clearChoices=r},783:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.addGroup=void 0;var v=b(883),h=function(d){var o=d.value,r=d.id,c=d.active,a=d.disabled;return{type:v.ACTION_TYPES.ADD_GROUP,value:o,id:r,active:c,disabled:a}};i.addGroup=h},464:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.highlightItem=i.removeItem=i.addItem=void 0;var v=b(883),h=function(r){var c=r.value,a=r.label,I=r.id,L=r.choiceId,y=r.groupId,D=r.customProperties,k=r.placeholder,Q=r.keyCode;return{type:v.ACTION_TYPES.ADD_ITEM,value:c,label:a,id:I,choiceId:L,groupId:y,customProperties:D,placeholder:k,keyCode:Q}};i.addItem=h;var d=function(r,c){return{type:v.ACTION_TYPES.REMOVE_ITEM,id:r,choiceId:c}};i.removeItem=d;var o=function(r,c){return{type:v.ACTION_TYPES.HIGHLIGHT_ITEM,id:r,highlighted:c}};i.highlightItem=o},137:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.setIsLoading=i.resetTo=i.clearAll=void 0;var v=b(883),h=function(){return{type:v.ACTION_TYPES.CLEAR_ALL}};i.clearAll=h;var d=function(r){return{type:v.ACTION_TYPES.RESET_TO,state:r}};i.resetTo=d;var o=function(r){return{type:v.ACTION_TYPES.SET_IS_LOADING,isLoading:r}};i.setIsLoading=o},373:function(j,i,b){var v=this&&this.__spreadArray||function(_,e,t){if(t||arguments.length===2)for(var n=0,l=e.length,g;n=0?this._store.getGroupById(g):null;return this._store.dispatch((0,a.highlightItem)(n,!0)),t&&this.passedElement.triggerEvent(y.EVENTS.highlightItem,{id:n,value:M,label:f,groupValue:u&&u.value?u.value:null}),this},_.prototype.unhighlightItem=function(e){if(!e||!e.id)return this;var t=e.id,n=e.groupId,l=n===void 0?-1:n,g=e.value,P=g===void 0?"":g,M=e.label,K=M===void 0?"":M,f=l>=0?this._store.getGroupById(l):null;return this._store.dispatch((0,a.highlightItem)(t,!1)),this.passedElement.triggerEvent(y.EVENTS.highlightItem,{id:t,value:P,label:K,groupValue:f&&f.value?f.value:null}),this},_.prototype.highlightAll=function(){var e=this;return this._store.items.forEach(function(t){return e.highlightItem(t)}),this},_.prototype.unhighlightAll=function(){var e=this;return this._store.items.forEach(function(t){return e.unhighlightItem(t)}),this},_.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.activeItems.filter(function(n){return n.value===e}).forEach(function(n){return t._removeItem(n)}),this},_.prototype.removeActiveItems=function(e){var t=this;return this._store.activeItems.filter(function(n){var l=n.id;return l!==e}).forEach(function(n){return t._removeItem(n)}),this},_.prototype.removeHighlightedItems=function(e){var t=this;return e===void 0&&(e=!1),this._store.highlightedActiveItems.forEach(function(n){t._removeItem(n),e&&t._triggerChange(n.value)}),this},_.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive?this:(requestAnimationFrame(function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent(y.EVENTS.showDropdown,{})}),this)},_.prototype.hideDropdown=function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame(function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(y.EVENTS.hideDropdown,{})}),this):this},_.prototype.getValue=function(e){e===void 0&&(e=!1);var t=this._store.activeItems.reduce(function(n,l){var g=e?l.value:l;return n.push(g),n},[]);return this._isSelectOneElement?t[0]:t},_.prototype.setValue=function(e){var t=this;return this.initialised?(e.forEach(function(n){return t._setChoiceOrItem(n)}),this):this},_.prototype.setChoiceByValue=function(e){var t=this;if(!this.initialised||this._isTextElement)return this;var n=Array.isArray(e)?e:[e];return n.forEach(function(l){return t._findAndSelectChoiceByValue(l)}),this},_.prototype.setChoices=function(e,t,n,l){var g=this;if(e===void 0&&(e=[]),t===void 0&&(t="value"),n===void 0&&(n="label"),l===void 0&&(l=!1),!this.initialised)throw new ReferenceError("setChoices was called on a non-initialized instance of Choices");if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if(typeof t!="string"||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(l&&this.clearChoices(),typeof e=="function"){var P=e(this);if(typeof Promise=="function"&&P instanceof Promise)return new Promise(function(M){return requestAnimationFrame(M)}).then(function(){return g._handleLoadingState(!0)}).then(function(){return P}).then(function(M){return g.setChoices(M,t,n,l)}).catch(function(M){g.config.silent||console.error(M)}).then(function(){return g._handleLoadingState(!1)}).then(function(){return g});if(!Array.isArray(P))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof P));return this.setChoices(P,t,n,!1)}if(!Array.isArray(e))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._startLoading(),e.forEach(function(M){if(M.choices)g._addGroup({id:M.id?parseInt("".concat(M.id),10):null,group:M,valueKey:t,labelKey:n});else{var K=M;g._addChoice({value:K[t],label:K[n],isSelected:!!K.selected,isDisabled:!!K.disabled,placeholder:!!K.placeholder,customProperties:K.customProperties})}}),this._stopLoading(),this},_.prototype.clearChoices=function(){return this._store.dispatch((0,r.clearChoices)()),this},_.prototype.clearStore=function(){return this._store.dispatch((0,I.clearAll)()),this},_.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch((0,r.activateChoices)(!0))),this},_.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,t=this._isSelectElement,n=this._currentState.items!==this._prevState.items;e&&(t&&this._renderChoices(),n&&this._renderItems(),this._prevState=this._currentState)}},_.prototype._renderChoices=function(){var e=this,t=this._store,n=t.activeGroups,l=t.activeChoices,g=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame(function(){return e.choiceList.scrollToTop()}),n.length>=1&&!this._isSearching){var P=l.filter(function(C){return C.placeholder===!0&&C.groupId===-1});P.length>=1&&(g=this._createChoicesFragment(P,g)),g=this._createGroupsFragment(n,l,g)}else l.length>=1&&(g=this._createChoicesFragment(l,g));if(g.childNodes&&g.childNodes.length>0){var M=this._store.activeItems,K=this._canAddItem(M,this.input.value);if(K.response)this.choiceList.append(g),this._highlightChoice();else{var f=this._getTemplate("notice",K.notice);this.choiceList.append(f)}}else{var u=void 0,f=void 0;this._isSearching?(f=typeof this.config.noResultsText=="function"?this.config.noResultsText():this.config.noResultsText,u=this._getTemplate("notice",f,"no-results")):(f=typeof this.config.noChoicesText=="function"?this.config.noChoicesText():this.config.noChoicesText,u=this._getTemplate("notice",f,"no-choices")),this.choiceList.append(u)}},_.prototype._renderItems=function(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},_.prototype._createGroupsFragment=function(e,t,n){var l=this;n===void 0&&(n=document.createDocumentFragment());var g=function(P){return t.filter(function(M){return l._isSelectOneElement?M.groupId===P.id:M.groupId===P.id&&(l.config.renderSelectedChoices==="always"||!M.selected)})};return this.config.shouldSort&&e.sort(this.config.sorter),e.forEach(function(P){var M=g(P);if(M.length>=1){var K=l._getTemplate("choiceGroup",P);n.appendChild(K),l._createChoicesFragment(M,n,!0)}}),n},_.prototype._createChoicesFragment=function(e,t,n){var l=this;t===void 0&&(t=document.createDocumentFragment()),n===void 0&&(n=!1);var g=this.config,P=g.renderSelectedChoices,M=g.searchResultLimit,K=g.renderChoiceLimit,f=this._isSearching?k.sortByScore:this.config.sorter,u=function(z){var ee=P==="auto"?l._isSelectOneElement||!z.selected:!0;if(ee){var ae=l._getTemplate("choice",z,l.config.itemSelectText);t.appendChild(ae)}},C=e;P==="auto"&&!this._isSelectOneElement&&(C=e.filter(function(z){return!z.selected}));var Y=C.reduce(function(z,ee){return ee.placeholder?z.placeholderChoices.push(ee):z.normalChoices.push(ee),z},{placeholderChoices:[],normalChoices:[]}),V=Y.placeholderChoices,U=Y.normalChoices;(this.config.shouldSort||this._isSearching)&&U.sort(f);var $=C.length,W=this._isSelectOneElement?v(v([],V,!0),U,!0):U;this._isSearching?$=M:K&&K>0&&!n&&($=K);for(var J=0;J<$;J+=1)W[J]&&u(W[J]);return t},_.prototype._createItemsFragment=function(e,t){var n=this;t===void 0&&(t=document.createDocumentFragment());var l=this.config,g=l.shouldSortItems,P=l.sorter,M=l.removeItemButton;g&&!this._isSelectOneElement&&e.sort(P),this._isTextElement?this.passedElement.value=e.map(function(f){var u=f.value;return u}).join(this.config.delimiter):this.passedElement.options=e;var K=function(f){var u=n._getTemplate("item",f,M);t.appendChild(u)};return e.forEach(K),t},_.prototype._triggerChange=function(e){e!=null&&this.passedElement.triggerEvent(y.EVENTS.change,{value:e})},_.prototype._selectPlaceholderChoice=function(e){this._addItem({value:e.value,label:e.label,choiceId:e.id,groupId:e.groupId,placeholder:e.placeholder}),this._triggerChange(e.value)},_.prototype._handleButtonAction=function(e,t){if(!(!e||!t||!this.config.removeItems||!this.config.removeItemButton)){var n=t.parentNode&&t.parentNode.dataset.id,l=n&&e.find(function(g){return g.id===parseInt(n,10)});l&&(this._removeItem(l),this._triggerChange(l.value),this._isSelectOneElement&&this._store.placeholderChoice&&this._selectPlaceholderChoice(this._store.placeholderChoice))}},_.prototype._handleItemAction=function(e,t,n){var l=this;if(n===void 0&&(n=!1),!(!e||!t||!this.config.removeItems||this._isSelectOneElement)){var g=t.dataset.id;e.forEach(function(P){P.id===parseInt("".concat(g),10)&&!P.highlighted?l.highlightItem(P):!n&&P.highlighted&&l.unhighlightItem(P)}),this.input.focus()}},_.prototype._handleChoiceAction=function(e,t){if(!(!e||!t)){var n=t.dataset.id,l=n&&this._store.getChoiceById(n);if(l){var g=e[0]&&e[0].keyCode?e[0].keyCode:void 0,P=this.dropdown.isActive;if(l.keyCode=g,this.passedElement.triggerEvent(y.EVENTS.choice,{choice:l}),!l.selected&&!l.disabled){var M=this._canAddItem(e,l.value);M.response&&(this._addItem({value:l.value,label:l.label,choiceId:l.id,groupId:l.groupId,customProperties:l.customProperties,placeholder:l.placeholder,keyCode:l.keyCode}),this._triggerChange(l.value))}this.clearInput(),P&&this._isSelectOneElement&&(this.hideDropdown(!0),this.containerOuter.focus())}}},_.prototype._handleBackspace=function(e){if(!(!this.config.removeItems||!e)){var t=e[e.length-1],n=e.some(function(l){return l.highlighted});this.config.editItems&&!n&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(n||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},_.prototype._startLoading=function(){this._store.dispatch((0,I.setIsLoading)(!0))},_.prototype._stopLoading=function(){this._store.dispatch((0,I.setIsLoading)(!1))},_.prototype._handleLoadingState=function(e){e===void 0&&(e=!0);var t=this.itemList.getChild(".".concat(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),t&&this.itemList.append(t)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},_.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,n=this.config,l=n.searchFloor,g=n.searchChoices,P=t.some(function(K){return!K.active});if(e!==null&&typeof e<"u"&&e.length>=l){var M=g?this._searchChoices(e):0;this.passedElement.triggerEvent(y.EVENTS.search,{value:e,resultCount:M})}else P&&(this._isSearching=!1,this._store.dispatch((0,r.activateChoices)(!0)))}},_.prototype._canAddItem=function(e,t){var n=!0,l=typeof this.config.addItemText=="function"?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var g=(0,k.existsInArray)(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(n=!1,l=typeof this.config.maxItemText=="function"?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),!this.config.duplicateItemsAllowed&&g&&n&&(n=!1,l=typeof this.config.uniqueItemText=="function"?this.config.uniqueItemText(t):this.config.uniqueItemText),this._isTextElement&&this.config.addItems&&n&&typeof this.config.addItemFilter=="function"&&!this.config.addItemFilter(t)&&(n=!1,l=typeof this.config.customAddItemText=="function"?this.config.customAddItemText(t):this.config.customAddItemText)}return{response:n,notice:l}},_.prototype._searchChoices=function(e){var t=typeof e=="string"?e.trim():e,n=typeof this._currentValue=="string"?this._currentValue.trim():this._currentValue;if(t.length<1&&t==="".concat(n," "))return 0;var l=this._store.searchableChoices,g=t,P=Object.assign(this.config.fuseOptions,{keys:v([],this.config.searchFields,!0),includeMatches:!0}),M=new o.default(l,P),K=M.search(g);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch((0,r.filterChoices)(K)),K.length},_.prototype._addEventListeners=function(){var e=document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},_.prototype._removeEventListeners=function(){var e=document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("keyup",this._onKeyUp),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()},_.prototype._onKeyDown=function(e){var t=e.keyCode,n=this._store.activeItems,l=this.input.isFocussed,g=this.dropdown.isActive,P=this.itemList.hasChildren(),M=String.fromCharCode(t),K=/[^\x00-\x1F]/.test(M),f=y.KEY_CODES.BACK_KEY,u=y.KEY_CODES.DELETE_KEY,C=y.KEY_CODES.ENTER_KEY,Y=y.KEY_CODES.A_KEY,V=y.KEY_CODES.ESC_KEY,U=y.KEY_CODES.UP_KEY,$=y.KEY_CODES.DOWN_KEY,W=y.KEY_CODES.PAGE_UP_KEY,J=y.KEY_CODES.PAGE_DOWN_KEY;switch(!this._isTextElement&&!g&&K&&(this.showDropdown(),this.input.isFocussed||(this.input.value+=e.key.toLowerCase())),t){case Y:return this._onSelectKey(e,P);case C:return this._onEnterKey(e,n,g);case V:return this._onEscapeKey(g);case U:case W:case $:case J:return this._onDirectionKey(e,g);case u:case f:return this._onDeleteKey(e,n,l);default:}},_.prototype._onKeyUp=function(e){var t=e.target,n=e.keyCode,l=this.input.value,g=this._store.activeItems,P=this._canAddItem(g,l),M=y.KEY_CODES.BACK_KEY,K=y.KEY_CODES.DELETE_KEY;if(this._isTextElement){var f=P.notice&&l;if(f){var u=this._getTemplate("notice",P.notice);this.dropdown.element.innerHTML=u.outerHTML,this.showDropdown(!0)}else this.hideDropdown(!0)}else{var C=n===M||n===K,Y=C&&t&&!t.value,V=!this._isTextElement&&this._isSearching,U=this._canSearch&&P.response;Y&&V?(this._isSearching=!1,this._store.dispatch((0,r.activateChoices)(!0))):U&&this._handleSearch(this.input.rawValue)}this._canSearch=this.config.searchEnabled},_.prototype._onSelectKey=function(e,t){var n=e.ctrlKey,l=e.metaKey,g=n||l;if(g&&t){this._canSearch=!1;var P=this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement;P&&this.highlightAll()}},_.prototype._onEnterKey=function(e,t,n){var l=e.target,g=y.KEY_CODES.ENTER_KEY,P=l&&l.hasAttribute("data-button");if(this._isTextElement&&l&&l.value){var M=this.input.value,K=this._canAddItem(t,M);K.response&&(this.hideDropdown(!0),this._addItem({value:M}),this._triggerChange(M),this.clearInput())}if(P&&(this._handleButtonAction(t,l),e.preventDefault()),n){var f=this.dropdown.getChild(".".concat(this.config.classNames.highlightedState));f&&(t[0]&&(t[0].keyCode=g),this._handleChoiceAction(t,f)),e.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),e.preventDefault())},_.prototype._onEscapeKey=function(e){e&&(this.hideDropdown(!0),this.containerOuter.focus())},_.prototype._onDirectionKey=function(e,t){var n=e.keyCode,l=e.metaKey,g=y.KEY_CODES.DOWN_KEY,P=y.KEY_CODES.PAGE_UP_KEY,M=y.KEY_CODES.PAGE_DOWN_KEY;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var K=n===g||n===M?1:-1,f=l||n===M||n===P,u="[data-choice-selectable]",C=void 0;if(f)K>0?C=this.dropdown.element.querySelector("".concat(u,":last-of-type")):C=this.dropdown.element.querySelector(u);else{var Y=this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState));Y?C=(0,k.getAdjacentEl)(Y,u,K):C=this.dropdown.element.querySelector(u)}C&&((0,k.isScrolledIntoView)(C,this.choiceList.element,K)||this.choiceList.scrollToChildElement(C,K),this._highlightChoice(C)),e.preventDefault()}},_.prototype._onDeleteKey=function(e,t,n){var l=e.target;!this._isSelectOneElement&&!l.value&&n&&(this._handleBackspace(t),e.preventDefault())},_.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},_.prototype._onTouchEnd=function(e){var t=(e||e.touches[0]).target,n=this._wasTap&&this.containerOuter.element.contains(t);if(n){var l=t===this.containerOuter.element||t===this.containerInner.element;l&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),e.stopPropagation()}this._wasTap=!0},_.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(E&&this.choiceList.element.contains(t)){var n=this.choiceList.element.firstElementChild,l=this._direction==="ltr"?e.offsetX>=n.offsetWidth:e.offsetX0;l&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0)}},_.prototype._onFocus=function(e){var t,n=this,l=e.target,g=l&&this.containerOuter.element.contains(l);if(g){var P=(t={},t[y.TEXT_TYPE]=function(){l===n.input.element&&n.containerOuter.addFocusState()},t[y.SELECT_ONE_TYPE]=function(){n.containerOuter.addFocusState(),l===n.input.element&&n.showDropdown(!0)},t[y.SELECT_MULTIPLE_TYPE]=function(){l===n.input.element&&(n.showDropdown(!0),n.containerOuter.addFocusState())},t);P[this.passedElement.element.type]()}},_.prototype._onBlur=function(e){var t,n=this,l=e.target,g=l&&this.containerOuter.element.contains(l);if(g&&!this._isScrollingOnIe){var P=this._store.activeItems,M=P.some(function(f){return f.highlighted}),K=(t={},t[y.TEXT_TYPE]=function(){l===n.input.element&&(n.containerOuter.removeFocusState(),M&&n.unhighlightAll(),n.hideDropdown(!0))},t[y.SELECT_ONE_TYPE]=function(){n.containerOuter.removeFocusState(),(l===n.input.element||l===n.containerOuter.element&&!n._canSearch)&&n.hideDropdown(!0)},t[y.SELECT_MULTIPLE_TYPE]=function(){l===n.input.element&&(n.containerOuter.removeFocusState(),n.hideDropdown(!0),M&&n.unhighlightAll())},t);K[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()},_.prototype._onFormReset=function(){this._store.dispatch((0,I.resetTo)(this._initialState))},_.prototype._highlightChoice=function(e){var t=this;e===void 0&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var l=e,g=Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState)));g.forEach(function(P){P.classList.remove(t.config.classNames.highlightedState),P.setAttribute("aria-selected","false")}),l?this._highlightPosition=n.indexOf(l):(n.length>this._highlightPosition?l=n[this._highlightPosition]:l=n[n.length-1],l||(l=n[0])),l.classList.add(this.config.classNames.highlightedState),l.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(y.EVENTS.highlightChoice,{el:l}),this.dropdown.isActive&&(this.input.setActiveDescendant(l.id),this.containerOuter.setActiveDescendant(l.id))}},_.prototype._addItem=function(e){var t=e.value,n=e.label,l=n===void 0?null:n,g=e.choiceId,P=g===void 0?-1:g,M=e.groupId,K=M===void 0?-1:M,f=e.customProperties,u=f===void 0?{}:f,C=e.placeholder,Y=C===void 0?!1:C,V=e.keyCode,U=V===void 0?-1:V,$=typeof t=="string"?t.trim():t,W=this._store.items,J=l||$,z=P||-1,ee=K>=0?this._store.getGroupById(K):null,ae=W?W.length+1:1;this.config.prependValue&&($=this.config.prependValue+$.toString()),this.config.appendValue&&($+=this.config.appendValue.toString()),this._store.dispatch((0,a.addItem)({value:$,label:J,id:ae,choiceId:z,groupId:K,customProperties:u,placeholder:Y,keyCode:U})),this._isSelectOneElement&&this.removeActiveItems(ae),this.passedElement.triggerEvent(y.EVENTS.addItem,{id:ae,value:$,label:J,customProperties:u,groupValue:ee&&ee.value?ee.value:null,keyCode:U})},_.prototype._removeItem=function(e){var t=e.id,n=e.value,l=e.label,g=e.customProperties,P=e.choiceId,M=e.groupId,K=M&&M>=0?this._store.getGroupById(M):null;!t||!P||(this._store.dispatch((0,a.removeItem)(t,P)),this.passedElement.triggerEvent(y.EVENTS.removeItem,{id:t,value:n,label:l,customProperties:g,groupValue:K&&K.value?K.value:null}))},_.prototype._addChoice=function(e){var t=e.value,n=e.label,l=n===void 0?null:n,g=e.isSelected,P=g===void 0?!1:g,M=e.isDisabled,K=M===void 0?!1:M,f=e.groupId,u=f===void 0?-1:f,C=e.customProperties,Y=C===void 0?{}:C,V=e.placeholder,U=V===void 0?!1:V,$=e.keyCode,W=$===void 0?-1:$;if(!(typeof t>"u"||t===null)){var J=this._store.choices,z=l||t,ee=J?J.length+1:1,ae="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(ee);this._store.dispatch((0,r.addChoice)({id:ee,groupId:u,elementId:ae,value:t,label:z,disabled:K,customProperties:Y,placeholder:U,keyCode:W})),P&&this._addItem({value:t,label:z,choiceId:ee,customProperties:Y,placeholder:U,keyCode:W})}},_.prototype._addGroup=function(e){var t=this,n=e.group,l=e.id,g=e.valueKey,P=g===void 0?"value":g,M=e.labelKey,K=M===void 0?"label":M,f=(0,k.isType)("Object",n)?n.choices:Array.from(n.getElementsByTagName("OPTION")),u=l||Math.floor(new Date().valueOf()*Math.random()),C=n.disabled?n.disabled:!1;if(f){this._store.dispatch((0,c.addGroup)({value:n.label,id:u,active:!0,disabled:C}));var Y=function(V){var U=V.disabled||V.parentNode&&V.parentNode.disabled;t._addChoice({value:V[P],label:(0,k.isType)("Object",V)?V[K]:V.innerHTML,isSelected:V.selected,isDisabled:U,groupId:u,customProperties:V.customProperties,placeholder:V.placeholder})};f.forEach(Y)}else this._store.dispatch((0,c.addGroup)({value:n.label,id:n.id,active:!1,disabled:n.disabled}))},_.prototype._getTemplate=function(e){for(var t,n=[],l=1;l0?this.element.scrollTop+y-I:o.offsetTop;requestAnimationFrame(function(){c._animateScroll(D,r)})}},d.prototype._scrollDown=function(o,r,c){var a=(c-o)/r,I=a>1?a:1;this.element.scrollTop=o+I},d.prototype._scrollUp=function(o,r,c){var a=(o-c)/r,I=a>1?a:1;this.element.scrollTop=o-I},d.prototype._animateScroll=function(o,r){var c=this,a=v.SCROLLING_SPEED,I=this.element.scrollTop,L=!1;r>0?(this._scrollDown(I,a,o),Io&&(L=!0)),L&&requestAnimationFrame(function(){c._animateScroll(o,r)})},d}();i.default=h},730:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0});var v=b(799),h=function(){function d(o){var r=o.element,c=o.classNames;if(this.element=r,this.classNames=c,!(r instanceof HTMLInputElement)&&!(r instanceof HTMLSelectElement))throw new TypeError("Invalid element passed");this.isDisabled=!1}return Object.defineProperty(d.prototype,"isActive",{get:function(){return this.element.dataset.choice==="active"},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"value",{get:function(){return this.element.value},set:function(o){this.element.value=o},enumerable:!1,configurable:!0}),d.prototype.conceal=function(){this.element.classList.add(this.classNames.input),this.element.hidden=!0,this.element.tabIndex=-1;var o=this.element.getAttribute("style");o&&this.element.setAttribute("data-choice-orig-style",o),this.element.setAttribute("data-choice","active")},d.prototype.reveal=function(){this.element.classList.remove(this.classNames.input),this.element.hidden=!1,this.element.removeAttribute("tabindex");var o=this.element.getAttribute("data-choice-orig-style");o?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",o)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},d.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},d.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},d.prototype.triggerEvent=function(o,r){(0,v.dispatchEvent)(this.element,o,r)},d}();i.default=h},541:function(j,i,b){var v=this&&this.__extends||function(){var r=function(c,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,L){I.__proto__=L}||function(I,L){for(var y in L)Object.prototype.hasOwnProperty.call(L,y)&&(I[y]=L[y])},r(c,a)};return function(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(c,a);function I(){this.constructor=c}c.prototype=a===null?Object.create(a):(I.prototype=a.prototype,new I)}}(),h=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(i,"__esModule",{value:!0});var d=h(b(730)),o=function(r){v(c,r);function c(a){var I=a.element,L=a.classNames,y=a.delimiter,D=r.call(this,{element:I,classNames:L})||this;return D.delimiter=y,D}return Object.defineProperty(c.prototype,"value",{get:function(){return this.element.value},set:function(a){this.element.setAttribute("value",a),this.element.value=a},enumerable:!1,configurable:!0}),c}(d.default);i.default=o},982:function(j,i,b){var v=this&&this.__extends||function(){var r=function(c,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,L){I.__proto__=L}||function(I,L){for(var y in L)Object.prototype.hasOwnProperty.call(L,y)&&(I[y]=L[y])},r(c,a)};return function(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(c,a);function I(){this.constructor=c}c.prototype=a===null?Object.create(a):(I.prototype=a.prototype,new I)}}(),h=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(i,"__esModule",{value:!0});var d=h(b(730)),o=function(r){v(c,r);function c(a){var I=a.element,L=a.classNames,y=a.template,D=r.call(this,{element:I,classNames:L})||this;return D.template=y,D}return Object.defineProperty(c.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"optionGroups",{get:function(){return Array.from(this.element.getElementsByTagName("OPTGROUP"))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"options",{get:function(){return Array.from(this.element.options)},set:function(a){var I=this,L=document.createDocumentFragment(),y=function(D){var k=I.template(D);L.appendChild(k)};a.forEach(function(D){return y(D)}),this.appendDocFragment(L)},enumerable:!1,configurable:!0}),c.prototype.appendDocFragment=function(a){this.element.innerHTML="",this.element.appendChild(a)},c}(d.default);i.default=o},883:function(j,i){Object.defineProperty(i,"__esModule",{value:!0}),i.SCROLLING_SPEED=i.SELECT_MULTIPLE_TYPE=i.SELECT_ONE_TYPE=i.TEXT_TYPE=i.KEY_CODES=i.ACTION_TYPES=i.EVENTS=void 0,i.EVENTS={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice",unhighlightItem:"unhighlightItem"},i.ACTION_TYPES={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL",RESET_TO:"RESET_TO",SET_IS_LOADING:"SET_IS_LOADING"},i.KEY_CODES={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34},i.TEXT_TYPE="text",i.SELECT_ONE_TYPE="select-one",i.SELECT_MULTIPLE_TYPE="select-multiple",i.SCROLLING_SPEED=4},789:function(j,i,b){Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CONFIG=i.DEFAULT_CLASSNAMES=void 0;var v=b(799);i.DEFAULT_CLASSNAMES={containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",selectedState:"is-selected",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"},i.DEFAULT_CONFIG={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,addItemFilter:null,removeItems:!0,removeItemButton:!1,editItems:!1,allowHTML:!0,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:v.sortByAlpha,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(h){return'Press Enter to add "'.concat((0,v.sanitise)(h),'"')},maxItemText:function(h){return"Only ".concat(h," values can be added")},valueComparer:function(h,d){return h===d},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:i.DEFAULT_CLASSNAMES}},18:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},978:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},948:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},359:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},285:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},533:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},187:function(j,i,b){var v=this&&this.__createBinding||(Object.create?function(d,o,r,c){c===void 0&&(c=r);var a=Object.getOwnPropertyDescriptor(o,r);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[r]}}),Object.defineProperty(d,c,a)}:function(d,o,r,c){c===void 0&&(c=r),d[c]=o[r]}),h=this&&this.__exportStar||function(d,o){for(var r in d)r!=="default"&&!Object.prototype.hasOwnProperty.call(o,r)&&v(o,d,r)};Object.defineProperty(i,"__esModule",{value:!0}),h(b(18),i),h(b(978),i),h(b(948),i),h(b(359),i),h(b(285),i),h(b(533),i),h(b(287),i),h(b(132),i),h(b(837),i),h(b(598),i),h(b(369),i),h(b(37),i),h(b(47),i),h(b(923),i),h(b(876),i)},287:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},132:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},837:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},598:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},37:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},369:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},47:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},923:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},876:function(j,i){Object.defineProperty(i,"__esModule",{value:!0})},799:function(j,i){Object.defineProperty(i,"__esModule",{value:!0}),i.parseCustomProperties=i.diff=i.cloneObject=i.existsInArray=i.dispatchEvent=i.sortByScore=i.sortByAlpha=i.strToEl=i.sanitise=i.isScrolledIntoView=i.getAdjacentEl=i.wrap=i.isType=i.getType=i.generateId=i.generateChars=i.getRandomNumber=void 0;var b=function(E,w){return Math.floor(Math.random()*(w-E)+E)};i.getRandomNumber=b;var v=function(E){return Array.from({length:E},function(){return(0,i.getRandomNumber)(0,36).toString(36)}).join("")};i.generateChars=v;var h=function(E,w){var N=E.id||E.name&&"".concat(E.name,"-").concat((0,i.generateChars)(2))||(0,i.generateChars)(4);return N=N.replace(/(:|\.|\[|\]|,)/g,""),N="".concat(w,"-").concat(N),N};i.generateId=h;var d=function(E){return Object.prototype.toString.call(E).slice(8,-1)};i.getType=d;var o=function(E,w){return w!=null&&(0,i.getType)(w)===E};i.isType=o;var r=function(E,w){return w===void 0&&(w=document.createElement("div")),E.parentNode&&(E.nextSibling?E.parentNode.insertBefore(w,E.nextSibling):E.parentNode.appendChild(w)),w.appendChild(E)};i.wrap=r;var c=function(E,w,N){N===void 0&&(N=1);for(var _="".concat(N>0?"next":"previous","ElementSibling"),e=E[_];e;){if(e.matches(w))return e;e=e[_]}return e};i.getAdjacentEl=c;var a=function(E,w,N){if(N===void 0&&(N=1),!E)return!1;var _;return N>0?_=w.scrollTop+w.offsetHeight>=E.offsetTop+E.offsetHeight:_=E.offsetTop>=w.scrollTop,_};i.isScrolledIntoView=a;var I=function(E){return typeof E!="string"?E:E.replace(/&/g,"&").replace(/>/g,">").replace(/-1?h.map(function(y){var D=y;return D.id===parseInt("".concat(c.choiceId),10)&&(D.selected=!0),D}):h}case"REMOVE_ITEM":{var a=d;return a.choiceId&&a.choiceId>-1?h.map(function(y){var D=y;return D.id===parseInt("".concat(a.choiceId),10)&&(D.selected=!1),D}):h}case"FILTER_CHOICES":{var I=d;return h.map(function(y){var D=y;return D.active=I.results.some(function(k){var Q=k.item,Z=k.score;return Q.id===D.id?(D.score=Z,!0):!1}),D})}case"ACTIVATE_CHOICES":{var L=d;return h.map(function(y){var D=y;return D.active=L.active,D})}case"CLEAR_CHOICES":return i.defaultState;default:return h}}i.default=v},871:function(j,i){var b=this&&this.__spreadArray||function(h,d,o){if(o||arguments.length===2)for(var r=0,c=d.length,a;r0?"treeitem":"option"),Object.assign(t.dataset,{choice:"",id:Q,value:Z,selectText:d}),N?(t.classList.add(D),t.dataset.choiceDisabled="",t.setAttribute("aria-disabled","true")):(t.classList.add(L),t.dataset.choiceSelectable=""),t},input:function(v,h){var d=v.classNames,o=d.input,r=d.inputCloned,c=Object.assign(document.createElement("input"),{type:"search",name:"search_terms",className:"".concat(o," ").concat(r),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return c.setAttribute("role","textbox"),c.setAttribute("aria-autocomplete","list"),c.setAttribute("aria-label",h),c},dropdown:function(v){var h=v.classNames,d=h.list,o=h.listDropdown,r=document.createElement("div");return r.classList.add(d,o),r.setAttribute("aria-expanded","false"),r},notice:function(v,h,d){var o,r=v.allowHTML,c=v.classNames,a=c.item,I=c.itemChoice,L=c.noResults,y=c.noChoices;d===void 0&&(d="");var D=[a,I];return d==="no-choices"?D.push(y):d==="no-results"&&D.push(L),Object.assign(document.createElement("div"),(o={},o[r?"innerHTML":"innerText"]=h,o.className=D.join(" "),o))},option:function(v){var h=v.label,d=v.value,o=v.customProperties,r=v.active,c=v.disabled,a=new Option(h,d,!1,r);return o&&(a.dataset.customProperties="".concat(o)),a.disabled=!!c,a}};i.default=b},996:function(j){var i=function(w){return b(w)&&!v(w)};function b(E){return!!E&&typeof E=="object"}function v(E){var w=Object.prototype.toString.call(E);return w==="[object RegExp]"||w==="[object Date]"||o(E)}var h=typeof Symbol=="function"&&Symbol.for,d=h?Symbol.for("react.element"):60103;function o(E){return E.$$typeof===d}function r(E){return Array.isArray(E)?[]:{}}function c(E,w){return w.clone!==!1&&w.isMergeableObject(E)?Z(r(E),E,w):E}function a(E,w,N){return E.concat(w).map(function(_){return c(_,N)})}function I(E,w){if(!w.customMerge)return Z;var N=w.customMerge(E);return typeof N=="function"?N:Z}function L(E){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(E).filter(function(w){return E.propertyIsEnumerable(w)}):[]}function y(E){return Object.keys(E).concat(L(E))}function D(E,w){try{return w in E}catch{return!1}}function k(E,w){return D(E,w)&&!(Object.hasOwnProperty.call(E,w)&&Object.propertyIsEnumerable.call(E,w))}function Q(E,w,N){var _={};return N.isMergeableObject(E)&&y(E).forEach(function(e){_[e]=c(E[e],N)}),y(w).forEach(function(e){k(E,e)||(D(E,e)&&N.isMergeableObject(w[e])?_[e]=I(e,N)(E[e],w[e],N):_[e]=c(w[e],N))}),_}function Z(E,w,N){N=N||{},N.arrayMerge=N.arrayMerge||a,N.isMergeableObject=N.isMergeableObject||i,N.cloneUnlessOtherwiseSpecified=c;var _=Array.isArray(w),e=Array.isArray(E),t=_===e;return t?_?N.arrayMerge(E,w,N):Q(E,w,N):c(w,N)}Z.all=function(w,N){if(!Array.isArray(w))throw new Error("first argument should be an array");return w.reduce(function(_,e){return Z(_,e,N)},{})};var ne=Z;j.exports=ne},221:function(j,i,b){b.r(i),b.d(i,{default:function(){return Se}});function v(p){return Array.isArray?Array.isArray(p):k(p)==="[object Array]"}let h=1/0;function d(p){if(typeof p=="string")return p;let s=p+"";return s=="0"&&1/p==-h?"-0":s}function o(p){return p==null?"":d(p)}function r(p){return typeof p=="string"}function c(p){return typeof p=="number"}function a(p){return p===!0||p===!1||L(p)&&k(p)=="[object Boolean]"}function I(p){return typeof p=="object"}function L(p){return I(p)&&p!==null}function y(p){return p!=null}function D(p){return!p.trim().length}function k(p){return p==null?p===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(p)}let Q="Extended search is not available",Z="Incorrect 'index' type",ne=p=>`Invalid value for key ${p}`,E=p=>`Pattern length exceeds max of ${p}.`,w=p=>`Missing ${p} property in key`,N=p=>`Property 'weight' in key '${p}' must be a positive integer`,_=Object.prototype.hasOwnProperty;class e{constructor(s){this._keys=[],this._keyMap={};let m=0;s.forEach(S=>{let O=t(S);m+=O.weight,this._keys.push(O),this._keyMap[O.id]=O,m+=O.weight}),this._keys.forEach(S=>{S.weight/=m})}get(s){return this._keyMap[s]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function t(p){let s=null,m=null,S=null,O=1,T=null;if(r(p)||v(p))S=p,s=n(p),m=l(p);else{if(!_.call(p,"name"))throw new Error(w("name"));let A=p.name;if(S=A,_.call(p,"weight")&&(O=p.weight,O<=0))throw new Error(N(A));s=n(A),m=l(A),T=p.getFn}return{path:s,id:m,weight:O,src:S,getFn:T}}function n(p){return v(p)?p:p.split(".")}function l(p){return v(p)?p.join("."):p}function g(p,s){let m=[],S=!1,O=(T,A,R)=>{if(y(T))if(!A[R])m.push(T);else{let F=A[R],H=T[F];if(!y(H))return;if(R===A.length-1&&(r(H)||c(H)||a(H)))m.push(o(H));else if(v(H)){S=!0;for(let B=0,x=H.length;Bp.score===s.score?p.idx{this._keysMap[m.id]=S})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,r(this.docs[0])?this.docs.forEach((s,m)=>{this._addString(s,m)}):this.docs.forEach((s,m)=>{this._addObject(s,m)}),this.norm.clear())}add(s){let m=this.size();r(s)?this._addString(s,m):this._addObject(s,m)}removeAt(s){this.records.splice(s,1);for(let m=s,S=this.size();m{let A=O.getFn?O.getFn(s):this.getFn(s,O.path);if(y(A)){if(v(A)){let R=[],F=[{nestedArrIndex:-1,value:A}];for(;F.length;){let{nestedArrIndex:H,value:B}=F.pop();if(y(B))if(r(B)&&!D(B)){let x={v:B,i:H,n:this.norm.get(B)};R.push(x)}else v(B)&&B.forEach((x,G)=>{F.push({nestedArrIndex:G,value:x})})}S.$[T]=R}else if(r(A)&&!D(A)){let R={v:A,n:this.norm.get(A)};S.$[T]=R}}}),this.records.push(S)}toJSON(){return{keys:this.keys,records:this.records}}}function U(p,s,{getFn:m=u.getFn,fieldNormWeight:S=u.fieldNormWeight}={}){let O=new V({getFn:m,fieldNormWeight:S});return O.setKeys(p.map(t)),O.setSources(s),O.create(),O}function $(p,{getFn:s=u.getFn,fieldNormWeight:m=u.fieldNormWeight}={}){let{keys:S,records:O}=p,T=new V({getFn:s,fieldNormWeight:m});return T.setKeys(S),T.setIndexRecords(O),T}function W(p,{errors:s=0,currentLocation:m=0,expectedLocation:S=0,distance:O=u.distance,ignoreLocation:T=u.ignoreLocation}={}){let A=s/p.length;if(T)return A;let R=Math.abs(S-m);return O?A+R/O:R?1:A}function J(p=[],s=u.minMatchCharLength){let m=[],S=-1,O=-1,T=0;for(let A=p.length;T=s&&m.push([S,O]),S=-1)}return p[T-1]&&T-S>=s&&m.push([S,T-1]),m}let z=32;function ee(p,s,m,{location:S=u.location,distance:O=u.distance,threshold:T=u.threshold,findAllMatches:A=u.findAllMatches,minMatchCharLength:R=u.minMatchCharLength,includeMatches:F=u.includeMatches,ignoreLocation:H=u.ignoreLocation}={}){if(s.length>z)throw new Error(E(z));let B=s.length,x=p.length,G=Math.max(0,Math.min(S,x)),q=T,re=G,ue=R>1||F,Ee=ue?Array(x):[],ve;for(;(ve=p.indexOf(s,re))>-1;){let he=W(s,{currentLocation:ve,expectedLocation:G,distance:O,ignoreLocation:H});if(q=Math.min(he,q),re=ve+B,ue){let ge=0;for(;ge=Ue;fe-=1){let Le=fe-1,We=m[p.charAt(Le)];if(ue&&(Ee[Le]=+!!We),Ie[fe]=(Ie[fe+1]<<1|1)&We,he&&(Ie[fe]|=(Oe[fe+1]|Oe[fe])<<1|1|Oe[fe+1]),Ie[fe]&at&&(be=W(s,{errors:he,currentLocation:Le,expectedLocation:G,distance:O,ignoreLocation:H}),be<=q)){if(q=be,re=Le,re<=G)break;Ue=Math.max(1,2*G-re)}}if(W(s,{errors:he+1,currentLocation:G,expectedLocation:G,distance:O,ignoreLocation:H})>q)break;Oe=Ie}let Ke={isMatch:re>=0,score:Math.max(.001,be)};if(ue){let he=J(Ee,R);he.length?F&&(Ke.indices=he):Ke.isMatch=!1}return Ke}function ae(p){let s={};for(let m=0,S=p.length;m{this.chunks.push({pattern:G,alphabet:ae(G),startIndex:q})},x=this.pattern.length;if(x>z){let G=0,q=x%z,re=x-q;for(;G{let{isMatch:ve,score:Oe,indices:be}=ee(s,re,ue,{location:O+Ee,distance:T,threshold:A,findAllMatches:R,minMatchCharLength:F,includeMatches:S,ignoreLocation:H});ve&&(G=!0),x+=Oe,ve&&be&&(B=[...B,...be])});let q={isMatch:G,score:G?x/this.chunks.length:1};return G&&S&&(q.indices=B),q}}class le{constructor(s){this.pattern=s}static isMultiMatch(s){return _e(s,this.multiRegex)}static isSingleMatch(s){return _e(s,this.singleRegex)}search(){}}function _e(p,s){let m=p.match(s);return m?m[1]:null}class te extends le{constructor(s){super(s)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(s){let m=s===this.pattern;return{isMatch:m,score:m?0:1,indices:[0,this.pattern.length-1]}}}class de extends le{constructor(s){super(s)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(s){let S=s.indexOf(this.pattern)===-1;return{isMatch:S,score:S?0:1,indices:[0,s.length-1]}}}class pe extends le{constructor(s){super(s)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(s){let m=s.startsWith(this.pattern);return{isMatch:m,score:m?0:1,indices:[0,this.pattern.length-1]}}}class oe extends le{constructor(s){super(s)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(s){let m=!s.startsWith(this.pattern);return{isMatch:m,score:m?0:1,indices:[0,s.length-1]}}}class Te extends le{constructor(s){super(s)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(s){let m=s.endsWith(this.pattern);return{isMatch:m,score:m?0:1,indices:[s.length-this.pattern.length,s.length-1]}}}class Pe extends le{constructor(s){super(s)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(s){let m=!s.endsWith(this.pattern);return{isMatch:m,score:m?0:1,indices:[0,s.length-1]}}}class He extends le{constructor(s,{location:m=u.location,threshold:S=u.threshold,distance:O=u.distance,includeMatches:T=u.includeMatches,findAllMatches:A=u.findAllMatches,minMatchCharLength:R=u.minMatchCharLength,isCaseSensitive:F=u.isCaseSensitive,ignoreLocation:H=u.ignoreLocation}={}){super(s),this._bitapSearch=new ce(s,{location:m,threshold:S,distance:O,includeMatches:T,findAllMatches:A,minMatchCharLength:R,isCaseSensitive:F,ignoreLocation:H})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(s){return this._bitapSearch.searchIn(s)}}class Be extends le{constructor(s){super(s)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(s){let m=0,S,O=[],T=this.pattern.length;for(;(S=s.indexOf(this.pattern,m))>-1;)m=S+T,O.push([S,m-1]);let A=!!O.length;return{isMatch:A,score:A?0:1,indices:O}}}let Me=[te,Be,pe,oe,Pe,Te,de,He],Ve=Me.length,Xe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Je="|";function Qe(p,s={}){return p.split(Je).map(m=>{let S=m.trim().split(Xe).filter(T=>T&&!!T.trim()),O=[];for(let T=0,A=S.length;T!!(p[Ce.AND]||p[Ce.OR]),tt=p=>!!p[je.PATH],it=p=>!v(p)&&I(p)&&!Re(p),ke=p=>({[Ce.AND]:Object.keys(p).map(s=>({[s]:p[s]}))});function xe(p,s,{auto:m=!0}={}){let S=O=>{let T=Object.keys(O),A=tt(O);if(!A&&T.length>1&&!Re(O))return S(ke(O));if(it(O)){let F=A?O[je.PATH]:T[0],H=A?O[je.PATTERN]:O[F];if(!r(H))throw new Error(ne(F));let B={keyId:l(F),pattern:H};return m&&(B.searcher=Ne(H,s)),B}let R={children:[],operator:T[0]};return T.forEach(F=>{let H=O[F];v(H)&&H.forEach(B=>{R.children.push(S(B))})}),R};return Re(p)||(p=ke(p)),S(p)}function nt(p,{ignoreFieldNorm:s=u.ignoreFieldNorm}){p.forEach(m=>{let S=1;m.matches.forEach(({key:O,norm:T,score:A})=>{let R=O?O.weight:null;S*=Math.pow(A===0&&R?Number.EPSILON:A,(R||1)*(s?1:T))}),m.score=S})}function rt(p,s){let m=p.matches;s.matches=[],y(m)&&m.forEach(S=>{if(!y(S.indices)||!S.indices.length)return;let{indices:O,value:T}=S,A={indices:O,value:T};S.key&&(A.key=S.key.src),S.idx>-1&&(A.refIndex=S.idx),s.matches.push(A)})}function st(p,s){s.score=p.score}function ot(p,s,{includeMatches:m=u.includeMatches,includeScore:S=u.includeScore}={}){let O=[];return m&&O.push(rt),S&&O.push(st),p.map(T=>{let{idx:A}=T,R={item:s[A],refIndex:A};return O.length&&O.forEach(F=>{F(T,R)}),R})}class Se{constructor(s,m={},S){this.options={...u,...m},this.options.useExtendedSearch,this._keyStore=new e(this.options.keys),this.setCollection(s,S)}setCollection(s,m){if(this._docs=s,m&&!(m instanceof V))throw new Error(Z);this._myIndex=m||U(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(s){y(s)&&(this._docs.push(s),this._myIndex.add(s))}remove(s=()=>!1){let m=[];for(let S=0,O=this._docs.length;S-1&&(F=F.slice(0,m)),ot(F,this._docs,{includeMatches:S,includeScore:O})}_searchStringList(s){let m=Ne(s,this.options),{records:S}=this._myIndex,O=[];return S.forEach(({v:T,i:A,n:R})=>{if(!y(T))return;let{isMatch:F,score:H,indices:B}=m.searchIn(T);F&&O.push({item:T,idx:A,matches:[{score:H,value:T,norm:R,indices:B}]})}),O}_searchLogical(s){let m=xe(s,this.options),S=(R,F,H)=>{if(!R.children){let{keyId:x,searcher:G}=R,q=this._findMatches({key:this._keyStore.get(x),value:this._myIndex.getValueForItemAtKeyId(F,x),searcher:G});return q&&q.length?[{idx:H,item:F,matches:q}]:[]}let B=[];for(let x=0,G=R.children.length;x{if(y(R)){let H=S(m,R,F);H.length&&(T[F]||(T[F]={idx:F,item:R,matches:[]},A.push(T[F])),H.forEach(({matches:B})=>{T[F].matches.push(...B)}))}}),A}_searchObjectList(s){let m=Ne(s,this.options),{keys:S,records:O}=this._myIndex,T=[];return O.forEach(({$:A,i:R})=>{if(!y(A))return;let F=[];S.forEach((H,B)=>{F.push(...this._findMatches({key:H,value:A[B],searcher:m}))}),F.length&&T.push({idx:R,item:A,matches:F})}),T}_findMatches({key:s,value:m,searcher:S}){if(!y(m))return[];let O=[];if(v(m))m.forEach(({v:T,i:A,n:R})=>{if(!y(T))return;let{isMatch:F,score:H,indices:B}=S.searchIn(T);F&&O.push({score:H,key:s,value:T,idx:A,norm:R,indices:B})});else{let{v:T,n:A}=m,{isMatch:R,score:F,indices:H}=S.searchIn(T);R&&O.push({score:F,key:s,value:T,norm:A,indices:H})}return O}}Se.version="6.6.2",Se.createIndex=U,Se.parseIndex=$,Se.config=u,Se.parseQuery=xe,et(qe)},791:function(j,i,b){b.r(i),b.d(i,{__DO_NOT_USE__ActionTypes:function(){return y},applyMiddleware:function(){return M},bindActionCreators:function(){return g},combineReducers:function(){return n},compose:function(){return P},createStore:function(){return w},legacy_createStore:function(){return N}});function v(f){"@babel/helpers - typeof";return v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},v(f)}function h(f,u){if(v(f)!=="object"||f===null)return f;var C=f[Symbol.toPrimitive];if(C!==void 0){var Y=C.call(f,u||"default");if(v(Y)!=="object")return Y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(f)}function d(f){var u=h(f,"string");return v(u)==="symbol"?u:String(u)}function o(f,u,C){return u=d(u),u in f?Object.defineProperty(f,u,{value:C,enumerable:!0,configurable:!0,writable:!0}):f[u]=C,f}function r(f,u){var C=Object.keys(f);if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(f);u&&(Y=Y.filter(function(V){return Object.getOwnPropertyDescriptor(f,V).enumerable})),C.push.apply(C,Y)}return C}function c(f){for(var u=1;u"u"&&(C=u,u=void 0),typeof C<"u"){if(typeof C!="function")throw new Error(a(1));return C(w)(f,u)}if(typeof f!="function")throw new Error(a(2));var V=f,U=u,$=[],W=$,J=!1;function z(){W===$&&(W=$.slice())}function ee(){if(J)throw new Error(a(3));return U}function ae(te){if(typeof te!="function")throw new Error(a(4));if(J)throw new Error(a(5));var de=!0;return z(),W.push(te),function(){if(de){if(J)throw new Error(a(6));de=!1,z();var oe=W.indexOf(te);W.splice(oe,1),$=null}}}function ce(te){if(!D(te))throw new Error(a(7));if(typeof te.type>"u")throw new Error(a(8));if(J)throw new Error(a(9));try{J=!0,U=V(U,te)}finally{J=!1}for(var de=$=W,pe=0;pe0)return"Unexpected "+($.length>1?"keys":"key")+" "+('"'+$.join('", "')+'" found in '+U+". ")+"Expected to find one of the known reducer keys instead: "+('"'+V.join('", "')+'". Unexpected keys will be ignored.')}function t(f){Object.keys(f).forEach(function(u){var C=f[u],Y=C(void 0,{type:y.INIT});if(typeof Y>"u")throw new Error(a(12));if(typeof C(void 0,{type:y.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(a(13))})}function n(f){for(var u=Object.keys(f),C={},Y=0;Y"u"){var Te=ee&&ee.type;throw new Error(a(14))}le[te]=oe,ce=ce||oe!==pe}return ce=ce||U.length!==Object.keys(z).length,ce?le:z}}function l(f,u){return function(){return u(f.apply(this,arguments))}}function g(f,u){if(typeof f=="function")return l(f,u);if(typeof f!="object"||f===null)throw new Error(a(16));var C={};for(var Y in f){var V=f[Y];typeof V=="function"&&(C[Y]=l(V,u))}return C}function P(){for(var f=arguments.length,u=new Array(f),C=0;Cwindow.pluralize(I,e,{count:e}),noChoicesText:E,noResultsText:L,placeholderValue:k,position:Q??"auto",removeItemButton:se,renderChoiceLimit:D,searchFields:w??["label"],searchPlaceholderValue:E,searchResultLimit:D,shouldSort:!1,searchFloor:o?0:1}),await this.refreshChoices({withInitialOptions:!0}),[null,void 0,""].includes(this.state)||this.select.setChoiceByValue(this.formatState(this.state)),this.refreshPlaceholder(),b&&this.select.showDropdown(),this.$refs.input.addEventListener("change",()=>{this.refreshPlaceholder(),!this.isStateBeingUpdated&&(this.isStateBeingUpdated=!0,this.state=this.select.getValue(!0)??null,this.$nextTick(()=>this.isStateBeingUpdated=!1))}),d&&this.$refs.input.addEventListener("showDropdown",async()=>{this.select.clearChoices(),await this.select.setChoices([{label:c,value:"",disabled:!0}]),await this.refreshChoices()}),o&&(this.$refs.input.addEventListener("search",async e=>{let t=e.detail.value?.trim();this.isSearching=!0,this.select.clearChoices(),await this.select.setChoices([{label:[null,void 0,""].includes(t)?c:ne,value:"",disabled:!0}])}),this.$refs.input.addEventListener("search",Alpine.debounce(async e=>{await this.refreshChoices({search:e.detail.value?.trim()}),this.isSearching=!1},Z))),h||window.addEventListener("filament-forms::select.refreshSelectedOptionLabel",async e=>{e.detail.livewireId===r&&e.detail.statePath===_&&await this.refreshSelectedOption()}),this.$watch("state",async()=>{this.select&&(this.refreshPlaceholder(),!this.isStateBeingUpdated&&await this.refreshSelectedOption())})},destroy:function(){this.select.destroy(),this.select=null},refreshChoices:async function(e={}){this.setChoices(await this.getChoices(e))},refreshSelectedOption:async function(){let e=await this.getChoices({withInitialOptions:!d});this.select.clearStore(),this.refreshPlaceholder(),this.setChoices(e),[null,void 0,""].includes(this.state)||this.select.setChoiceByValue(this.formatState(this.state))},setChoices:function(e){this.select.setChoices(e,"value","label",!0)},getChoices:async function(e={}){let t=await this.getOptions(e);return t.concat(await this.getMissingOptions(t))},getOptions:async function({search:e,withInitialOptions:t}){return t?y:e!==""&&e!==null&&e!==void 0?await i(e):await j()},refreshPlaceholder:function(){v||h||(this.select._renderItems(),[null,void 0,""].includes(this.state)&&(this.$el.querySelector(".choices__list--single").innerHTML=`
${k}
`))},formatState:function(e){return h?(e??[]).map(t=>t?.toString()):e?.toString()},getMissingOptions:async function(e){let t=this.formatState(this.state);if([null,void 0,"",[],{}].includes(t))return{};let n=new Set(e.length?e.map(l=>l.value):[]);return h?t.every(l=>n.has(l))?{}:await me():n.has(t)?n:[{label:await X(),value:t}]}}}export{vt as default}; /*! Bundled license information: choices.js/public/assets/scripts/choices.js: diff --git a/packages/forms/docs/01-installation.md b/packages/forms/docs/01-installation.md index fcb679e15f..98990af94f 100644 --- a/packages/forms/docs/01-installation.md +++ b/packages/forms/docs/01-installation.md @@ -46,40 +46,21 @@ First, use NPM to install Tailwind CSS and its `forms` and `typography` plugins: npm install tailwindcss @tailwindcss/forms @tailwindcss/typography postcss --save-dev ``` -Create a new `tailwind.config.js` file. Ensure that you add Filament's `content` path, custom `colors`, and the `plugins` you installed: +Create a new `tailwind.config.js` file. Ensure that you add Filament's `preset` which configures colors and the plugins you installed: ```js -import colors from 'tailwindcss/colors' -import forms from '@tailwindcss/forms' -import typography from '@tailwindcss/typography' +import preset from './vendor/filament/support/tailwind.config.preset' export default { + presets: [preset], content: [ - './resources/**/*.blade.php', + './app/Filament/**/*.php', + './resources/views/filament/**/*.blade.php', './vendor/filament/**/*.blade.php', ], - darkMode: 'class', - theme: { - extend: { - colors: { - danger: colors.red, - info: colors.blue, - primary: colors.amber, - secondary: colors.gray, - success: colors.green, - warning: colors.amber, - }, - }, - }, - plugins: [ - forms, - typography, - ], } ``` -Of course, you may specify your own custom `danger`, `gray`, `info`, `primary`, `secondary`, `success` and `warning` colors, which will be used instead. But each color needs to be a [Tailwind CSS color](https://tailwindcss.com/docs/customizing-colors#color-palette-reference), or have all 50 - 950 variants specified - a single hex code or RGB value won't work here. - ### Configuring styles In `resources/css/app.css`, import Tailwind CSS, and the form components CSS: @@ -172,10 +153,10 @@ composer update php artisan filament:upgrade ``` -We recommend adding the `filament:upgrade` command to your `composer.json`'s `post-update-cmd` to run it automatically: +We recommend adding the `filament:upgrade` command to your `composer.json`'s `post-autoload-dump` to run it automatically: ```json -"post-update-cmd": [ +"post-autoload-dump": [ // ... "@php artisan filament:upgrade" ], diff --git a/packages/forms/resources/js/components/select.js b/packages/forms/resources/js/components/select.js index 591c16f61b..b7d5ccb843 100644 --- a/packages/forms/resources/js/components/select.js +++ b/packages/forms/resources/js/components/select.js @@ -180,6 +180,8 @@ export default function selectFormComponent({ this.select.clearStore() + this.refreshPlaceholder() + this.setChoices(choices) if (![null, undefined, ''].includes(this.state)) { diff --git a/packages/forms/resources/views/components/affixes.blade.php b/packages/forms/resources/views/components/affixes.blade.php index d233c7f8b9..aee944af53 100644 --- a/packages/forms/resources/views/components/affixes.blade.php +++ b/packages/forms/resources/views/components/affixes.blade.php @@ -58,14 +58,14 @@ @if (filled($prefix)) ! $prefixIcon, ]) @if (filled($statePath)) x-bind:class="{ 'text-gray-400': ! (@js($statePath) in $wire.__instance.snapshot.memo.errors), - 'text-danger-400': (@js($statePath) in $wire.__instance.snapshot.memo.errors), + 'text-danger-400': @js($statePath) in $wire.__instance.snapshot.memo.errors, }" @endif > @@ -80,14 +80,14 @@ @if (filled($suffix)) ! $suffixIcon, ]) @if (filled($statePath)) x-bind:class="{ 'text-gray-400': ! (@js($statePath) in $wire.__instance.snapshot.memo.errors), - 'text-danger-400': (@js($statePath) in $wire.__instance.snapshot.memo.errors), + 'text-danger-400': @js($statePath) in $wire.__instance.snapshot.memo.errors, }" @endif > @@ -104,7 +104,7 @@ @if (filled($statePath)) x-bind:class="{ 'text-gray-400': ! (@js($statePath) in $wire.__instance.snapshot.memo.errors), - 'text-danger-400': (@js($statePath) in $wire.__instance.snapshot.memo.errors), + 'text-danger-400': @js($statePath) in $wire.__instance.snapshot.memo.errors, }" @endif > diff --git a/packages/forms/resources/views/components/builder.blade.php b/packages/forms/resources/views/components/builder.blade.php index 494a2fa021..a8817041a5 100644 --- a/packages/forms/resources/views/components/builder.blade.php +++ b/packages/forms/resources/views/components/builder.blade.php @@ -86,7 +86,15 @@ return } - setTimeout(() => $el.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'start' }), 200) + setTimeout( + () => + $el.scrollIntoView({ + behavior: 'smooth', + block: 'start', + inline: 'start', + }), + 200, + ) " class="filament-forms-builder-component-item relative rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-800 dark:ring-white/20" > @@ -175,7 +183,10 @@ {{ $getAction('collapse') }} -
+
{{ $getAction('expand') }}
@@ -185,7 +196,10 @@ @endif
{{ $item }}
diff --git a/packages/forms/resources/views/components/checkbox-list.blade.php b/packages/forms/resources/views/components/checkbox-list.blade.php index 758f033428..90020b0d29 100644 --- a/packages/forms/resources/views/components/checkbox-list.blade.php +++ b/packages/forms/resources/views/components/checkbox-list.blade.php @@ -11,7 +11,11 @@ x-data="{ areAllCheckboxesChecked: false, - checkboxListOptions: Array.from($root.querySelectorAll('.filament-forms-checkbox-list-component-option-label')), + checkboxListOptions: Array.from( + $root.querySelectorAll( + '.filament-forms-checkbox-list-component-option-label', + ), + ), search: '', @@ -32,7 +36,11 @@ }, checkIfAllCheckboxesAreChecked: function () { - this.areAllCheckboxesChecked = this.visibleCheckboxListOptions.length === this.visibleCheckboxListOptions.filter((checkboxLabel) => checkboxLabel.querySelector('input[type=checkbox]:checked')).length + this.areAllCheckboxesChecked = + this.visibleCheckboxListOptions.length === + this.visibleCheckboxListOptions.filter((checkboxLabel) => + checkboxLabel.querySelector('input[type=checkbox]:checked'), + ).length }, toggleAllCheckboxes: function () { @@ -49,10 +57,17 @@ }, updateVisibleCheckboxListOptions: function () { - this.visibleCheckboxListOptions = this.checkboxListOptions.filter((checkboxListItem) => { - return checkboxListItem.querySelector('.filament-forms-checkbox-list-component-option-label-text').innerText.toLowerCase().includes(this.search.toLowerCase()) - }) - } + this.visibleCheckboxListOptions = this.checkboxListOptions.filter( + (checkboxListItem) => { + return checkboxListItem + .querySelector( + '.filament-forms-checkbox-list-component-option-label-text', + ) + .innerText.toLowerCase() + .includes(this.search.toLowerCase()) + }, + ) + }, }" > @if (! $isDisabled) @@ -99,10 +114,12 @@ :two-xl="$getColumns('2xl')" :direction="$gridDirection ?? 'column'" :x-show="$isSearchable ? 'visibleCheckboxListOptions.length' : null" - :attributes="\Filament\Support\prepare_inherited_attributes($attributes->class([ - 'filament-forms-checkbox-list-component gap-1', - 'space-y-2' => $gridDirection !== 'row', - ]))" + :attributes=" + \Filament\Support\prepare_inherited_attributes($attributes->class([ + 'filament-forms-checkbox-list-component gap-1', + 'space-y-2' => $gridDirection !== 'row', + ])) + " > @forelse ($getOptions() as $optionValue => $optionLabel)
class(['relative flex-1']) }} > @@ -70,7 +70,10 @@ class="pointer-events-none absolute inset-y-0 end-0 flex items-center pe-2" > diff --git a/packages/forms/resources/views/components/date-time-picker.blade.php b/packages/forms/resources/views/components/date-time-picker.blade.php index e20996e942..8f0b32f53e 100644 --- a/packages/forms/resources/views/components/date-time-picker.blade.php +++ b/packages/forms/resources/views/components/date-time-picker.blade.php @@ -25,9 +25,11 @@ @if ($isNative()) to('day.js') }}', + firstDayOfWeek: {{ $getFirstDayOfWeek() }}, + isAutofocused: @js($isAutofocused()), + locale: @js(app()->getLocale()), + shouldCloseOnDateSelection: @js($shouldCloseOnDateSelection()), + state: $wire.{{ $applyStateBindingModifiers("entangle('{$statePath}')") }}, + })" x-on:keydown.esc="isOpen() && $event.stopPropagation()" {{ $attributes @@ -93,7 +96,11 @@