From 3c63b6d127d12fd263c0f31d479f24d7cd15c840 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Mon, 30 Jan 2023 12:56:26 +1300 Subject: [PATCH 1/4] NEW Add sudo mode controller This controller allows checking and setting sudo mode from javascript within /admin --- code/SudoModeController.php | 153 +++++++++++++++++++++++++ lang/da.yml | 3 + lang/de.yml | 3 + lang/en.yml | 3 + lang/eo.yml | 3 + lang/nl.yml | 3 + lang/sl.yml | 3 + lang/sv.yml | 3 + tests/php/SudoModeControllerTest.php | 162 +++++++++++++++++++++++++++ 9 files changed, 336 insertions(+) create mode 100644 code/SudoModeController.php create mode 100644 tests/php/SudoModeControllerTest.php diff --git a/code/SudoModeController.php b/code/SudoModeController.php new file mode 100644 index 000000000..873048eed --- /dev/null +++ b/code/SudoModeController.php @@ -0,0 +1,153 @@ + '%$' . SudoModeServiceInterface::class, + ]; + + /** + * A user help documentation link to find out more about sudo mode + */ + // phpcs:ignore Generic.Files.LineLength.TooLong + private static string $help_link = 'https://userhelp.silverstripe.org/en/5/managing_your_website/logging_in/#sudo-mode'; + + private ?SudoModeServiceInterface $sudoModeService = null; + + /** + * Explicitly disable required permissions for sudo mode checks + */ + private static bool $required_permission_codes = false; + + public function getClientConfig() + { + /** @var HTTPRequest $request */ + $request = Injector::inst()->get(HTTPRequest::class); + + return array_merge_recursive(parent::getClientConfig(), [ + 'endpoints' => [ + 'activate' => $this->Link('activate'), + ], + 'sudoModeActive' => $this->getSudoModeService()->check($request->getSession()), + 'helpLink' => $this->config()->get('help_link'), + ]); + } + + /** + * Checks whether sudo mode is active for the current user + */ + public function check(HTTPRequest $request): HTTPResponse + { + $body = [ + 'active' => $this->getSudoModeService()->check($request->getSession()), + ]; + return $this->jsonResponse($body); + } + + /** + * After validating the request data including password against the current member, activate sudo mode + * for the current member. + * + * @throws HTTPResponse_Exception If the request was not made with POST + */ + public function activate(HTTPRequest $request): HTTPResponse + { + if (!$request->isPOST()) { + return $this->httpError(405); + } + + if (!SecurityToken::inst()->checkRequest($request)) { + return $this->jsonResponse([ + 'result' => false, + 'message' => _t(__CLASS__ . '.TIMEOUT', 'Session timed out, please refresh and try again.'), + ], 403); + } + + // Validate password + if (!$this->checkPassword($request)) { + return $this->jsonResponse([ + 'result' => false, + 'message' => _t(__CLASS__ . '.INVALID', 'Incorrect password'), + ]); + } + + // Activate sudo mode and return successful result + $this->getSudoModeService()->activate($request->getSession()); + return $this->jsonResponse(['result' => true]); + } + + /** + * Checks the provided password is valid for the current member. Will return false if insufficient data + * is available to validate the request. + */ + private function checkPassword(HTTPRequest $request): bool + { + $password = $request->postVar('Password'); + if (!$password) { + return false; + } + + $currentMember = Security::getCurrentUser(); + if (!$currentMember) { + return false; + } + + $result = ValidationResult::create(); + $authenticators = Security::singleton()->getApplicableAuthenticators(Authenticator::CHECK_PASSWORD); + foreach ($authenticators as $authenticator) { + $authenticator->checkPassword($currentMember, $password, $result); + if (!$result->isValid()) { + break; + } + } + return $result->isValid(); + } + + /** + * Returns a JSON response with an encoded body and provided HTTP status code + */ + private function jsonResponse(array $body, int $code = 200): HTTPResponse + { + $response = new HTTPResponse(); + $response + ->addHeader('Content-Type', 'application/json') + ->setBody(json_encode($body)) + ->setStatusCode($code); + return $response; + } + + public function setSudoModeService(SudoModeServiceInterface $sudoModeService): static + { + $this->sudoModeService = $sudoModeService; + return $this; + } + + public function getSudoModeService(): ?SudoModeServiceInterface + { + return $this->sudoModeService; + } +} diff --git a/lang/da.yml b/lang/da.yml index 50b76dccb..0e046e187 100644 --- a/lang/da.yml +++ b/lang/da.yml @@ -89,3 +89,6 @@ da: MemberListCaution: 'Advarsel: Fjerner du brugere fra denne liste, fjernes de fra alle grupper og fra databasen' TABROLES: Roller Users: Brugere + SilverStripe\Admin\SudoModeController: + INVALID: 'Forkert kodeord' + TIMEOUT: 'Sessionen er udløbet, opdater venligts og forsøg igen.' diff --git a/lang/de.yml b/lang/de.yml index 0258381ba..56ad4934e 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -98,3 +98,6 @@ de: MemberListCaution: 'Achtung: Benutzer von dieser Liste zu entfernen, wird diese von allen Gruppen entfernen und aus der Datenbank löschen.' TABROLES: Rollen Users: Benutzer + SilverStripe\Admin\SudoModeController: + INVALID: 'Passwort falsch' + TIMEOUT: 'Sitzung wurde geschlossen, bitte aktualisieren und nochmals versuchen.' diff --git a/lang/en.yml b/lang/en.yml index 0387cace2..50b6431f3 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -113,3 +113,6 @@ en: MemberListCaution: 'Caution: Removing members from this list will remove them from all groups and the database' TABROLES: Roles Users: Users + SilverStripe\Admin\SudoModeController: + INVALID: 'Incorrect password' + TIMEOUT: 'Session timed out, please refresh and try again.' diff --git a/lang/eo.yml b/lang/eo.yml index d76ed1034..c6485b1cf 100644 --- a/lang/eo.yml +++ b/lang/eo.yml @@ -99,3 +99,6 @@ eo: MemberListCaution: 'Averto: forigi membrojn el ĉi tiu listo forigos ilin ankaŭ el ĉiuj grupoj kaj la datumbazo.' TABROLES: Roloj Users: Uzantoj + SilverStripe\Admin\SudoModeController: + INVALID: 'Nevalida pasvorto' + TIMEOUT: 'Seanco eltempiĝis. Bonvolu refreŝigi kaj reprovi.' diff --git a/lang/nl.yml b/lang/nl.yml index 1dd956e85..340c85fa1 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -99,3 +99,6 @@ nl: MemberListCaution: 'Let op: Gebruikers die hier verwijderd worden, worden uit alle groepen én uit de database verwijderd.' TABROLES: Rollen Users: Gebruikers + SilverStripe\Admin\SudoModeController: + INVALID: 'Incorrect wachtwoord' + TIMEOUT: 'Sessie is verlopen, ververs en probeer het opnieuw.' diff --git a/lang/sl.yml b/lang/sl.yml index f73f6b57e..0c4a032e5 100644 --- a/lang/sl.yml +++ b/lang/sl.yml @@ -98,3 +98,6 @@ sl: MemberListCaution: 'Previdno: S tem, ko boste odstranili uporabnike iz vseh skupin, jih boste tudi izbrisali iz baze podatkov.' TABROLES: Vloge Users: Uporabniki + SilverStripe\Admin\SudoModeController: + INVALID: 'Napačno geslo' + TIMEOUT: 'Seja je potekla, osvežite stran in poskusite znova.' diff --git a/lang/sv.yml b/lang/sv.yml index be7fc5e4d..04d93a89c 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -13,3 +13,6 @@ sv: PERMISSIONS: Tillstånd ROLES: Roller ROLESDESCRIPTION: 'Roller är fördefinierade uppsättningar av tillstånd, och kan tilldelas grupper.
De ärvs från föräldragrupper om det krävs.' + SilverStripe\Admin\SudoModeController: + INVALID: 'Fel lösenord' + TIMEOUT: 'Sessionen avbröts, vänligen ladda om och försök igen' diff --git a/tests/php/SudoModeControllerTest.php b/tests/php/SudoModeControllerTest.php new file mode 100644 index 000000000..bd35f8162 --- /dev/null +++ b/tests/php/SudoModeControllerTest.php @@ -0,0 +1,162 @@ +securityTokenEnabled = SecurityToken::is_enabled(); + SecurityToken::disable(); + + $memberID = $this->logInWithPermission(); + + /** @var Member $member */ + $member = Member::get()->byID($memberID); + $member->changePassword('0p3nS3samE!'); + } + + protected function tearDown(): void + { + if ($this->securityTokenEnabled) { + SecurityToken::enable(); + } + + parent::tearDown(); + } + + public function testNotLoggedIn() + { + $this->logOut(); + + $this->autoFollowRedirection = false; + $response = $this->get(SudoModeController::singleton()->Link('check')); + $this->autoFollowRedirection = true; + + // Should redirect to login page + $this->assertSame(302, $response->getStatusCode()); + $this->assertStringEndsWith( + Controller::normaliseTrailingSlash('/Security/login?BackURL=%2Fadmin%2Fsudomode%2Fcheck'), + $response->getHeader('Location'), + 'Should not be able to check sudo mode when not logged in' + ); + } + + public function testLoggedInNotExpired() + { + $response = $this->get(SudoModeController::singleton()->Link('check')); + $this->assertSame(200, $response->getStatusCode()); + $result = json_decode((string) $response->getBody(), true); + $this->assertTrue($result['active'], 'Sudo mode should be active immediately after login'); + } + + public function testSudoModeExpired() + { + $this->expireSudoMode(); + $response = $this->get(SudoModeController::singleton()->Link('check')); + $this->assertSame(200, $response->getStatusCode()); + $result = json_decode((string) $response->getBody(), true); + $this->assertFalse($result['active'], 'Sudo mode should not be active if sudo mode expired'); + } + + public function testActivateFailsWithIncorrectPassword() + { + $this->expireSudoMode(); + $response = $this->post(SudoModeController::singleton()->Link('activate'), [ + 'Password' => 'wrongpassword!', + ]); + + $this->assertSame(200, $response->getStatusCode()); + $result = json_decode((string) $response->getBody(), true); + $this->assertFalse($result['result'], 'Should have failed with incorrect password'); + $this->assertEquals('Incorrect password', $result['message']); + } + + public function testActivateSudoModeWithValidCredentials() + { + $this->expireSudoMode(); + $activateResponse = $this->post(SudoModeController::singleton()->Link('activate'), [ + 'Password' => '0p3nS3samE!', + ]); + + $this->assertSame(200, $activateResponse->getStatusCode()); + $result = json_decode((string) $activateResponse->getBody(), true); + $this->assertTrue($result['result'], 'Should have activated sudo mode'); + + $checkResponse = $this->get(SudoModeController::singleton()->Link('check')); + $this->assertSame(200, $checkResponse->getStatusCode()); + $checkResult = json_decode((string) $checkResponse->getBody(), true); + $this->assertTrue($checkResult['active'], 'Sudo mode should be active after activate() called'); + } + + public function testActivateFailsWithGetRequest() + { + $this->expireSudoMode(); + $response = $this->get(SudoModeController::singleton()->Link('activate')); + $this->assertSame(405, $response->getStatusCode()); + } + + public function testActivateChecksCSRFToken() + { + $this->expireSudoMode(); + SecurityToken::enable(); + $activateResponse = $this->post(SudoModeController::singleton()->Link('activate'), [ + 'Password' => 'wrongpassword!', + ]); + + $this->assertSame(403, $activateResponse->getStatusCode()); + $result = json_decode((string) $activateResponse->getBody(), true); + $this->assertFalse($result['result'], 'Should have failed on CSRF token validation'); + $this->assertSame($result['message'], 'Session timed out, please refresh and try again.'); + } + + public function testClientConfig() + { + $this->expireSudoMode(); + /** @var SudoModeServiceInterface&PHPUnit_Framework_MockObject_MockObject $serviceMock */ + $serviceMock = $this->createMock(SudoModeServiceInterface::class); + $serviceMock->expects($this->once())->method('check')->willReturn(true); + + $controller = new SudoModeController(); + $controller->setSudoModeService($serviceMock); + + $request = new HTTPRequest('GET', '/'); + $request->setSession(new Session([])); + Injector::inst()->registerService($request, HTTPRequest::class); + + $result = $controller->getClientConfig(); + $this->assertArrayHasKey('activate', $result['endpoints'], 'Client config should provide activation endpoint'); + $this->assertTrue($result['sudoModeActive'], 'Client config should expose sudo mode status'); + } + + /** + * Set sudo mode to have expired so that we can test activation of sudo mode via the controller + */ + private function expireSudoMode(): void + { + $expiresAfter = SudoModeService::config()->get('lifetime_minutes') * 60; + DBDatetime::set_mock_now(DBDatetime::now()->getTimestamp() + $expiresAfter); + } +} From ec6567c05e9d0988c97b725495a493260821129b Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Mon, 30 Jan 2023 12:58:11 +1300 Subject: [PATCH 2/4] NEW Add new circular loading react component This is a more generic loading spinner for use in individual components when they're loading some data --- client/src/boot/registerComponents.js | 2 + client/src/bundles/bundle.js | 1 + .../src/components/Loading/CircularLoading.js | 28 ++++++++++ .../components/Loading/CircularLoading.scss | 55 +++++++++++++++++++ client/src/components/Loading/Loading.js | 2 +- .../Loading/tests/CircularLoading-test.js | 27 +++++++++ client/src/styles/bundle.scss | 1 + 7 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 client/src/components/Loading/CircularLoading.js create mode 100644 client/src/components/Loading/CircularLoading.scss create mode 100644 client/src/components/Loading/tests/CircularLoading-test.js diff --git a/client/src/boot/registerComponents.js b/client/src/boot/registerComponents.js index d01ab3ca5..21073b171 100644 --- a/client/src/boot/registerComponents.js +++ b/client/src/boot/registerComponents.js @@ -35,6 +35,7 @@ import Preview from 'components/Preview/Preview'; import ReduxForm from 'containers/Form/Form'; import UsedOnTable from 'components/UsedOnTable/UsedOnTable'; import Loading from 'components/Loading/Loading'; +import CircularLoading from 'components/Loading/CircularLoading'; import VersionedBadge from 'components/VersionedBadge/VersionedBadge'; import ViewModeToggle from 'components/ViewModeToggle/ViewModeToggle'; import ResizeAware from 'components/ResizeAware/ResizeAware'; @@ -87,6 +88,7 @@ export default () => { NotFoundComponent, UsedOnTable, Loading, + CircularLoading, VersionedBadge, ViewModeToggle, ResizeAware, diff --git a/client/src/bundles/bundle.js b/client/src/bundles/bundle.js index f75ec081f..bd11e0545 100644 --- a/client/src/bundles/bundle.js +++ b/client/src/bundles/bundle.js @@ -43,6 +43,7 @@ import 'expose-loader?exposes=HiddenField!components/HiddenField/HiddenField'; import 'expose-loader?exposes=ListGroup!components/ListGroup/ListGroup'; import 'expose-loader?exposes=ListGroupItem!components/ListGroup/ListGroupItem'; import 'expose-loader?exposes=Loading!components/Loading/Loading'; +import 'expose-loader?exposes=CircularLoading!components/Loading/CircularLoading'; import 'expose-loader?exposes=TextField!components/TextField/TextField'; import 'expose-loader?exposes=LiteralField!components/LiteralField/LiteralField'; import 'expose-loader?exposes=Toolbar!components/Toolbar/Toolbar'; diff --git a/client/src/components/Loading/CircularLoading.js b/client/src/components/Loading/CircularLoading.js new file mode 100644 index 000000000..c7ec26c2f --- /dev/null +++ b/client/src/components/Loading/CircularLoading.js @@ -0,0 +1,28 @@ +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import classnames from 'classnames'; + +class CircularLoading extends PureComponent { + render() { + const { className, size, block } = this.props; + + const classNames = classnames('ss-circular-loading-indicator', className, { + 'ss-circular-loading-indicator--block': block, + }); + + return
; + } +} + +CircularLoading.propTypes = { + className: PropTypes.string, + block: PropTypes.bool, + size: PropTypes.string, +}; + +CircularLoading.defaultProps = { + block: false, + size: '6em', +}; + +export default CircularLoading; diff --git a/client/src/components/Loading/CircularLoading.scss b/client/src/components/Loading/CircularLoading.scss new file mode 100644 index 000000000..ef19cd07f --- /dev/null +++ b/client/src/components/Loading/CircularLoading.scss @@ -0,0 +1,55 @@ +$color-blue: rgba(0, 113, 196, 1); +$font-size-small: 10px; + +$loading-indicator-size: 6em; +$loading-indicator-border-size: .4em; +$loading-indicator-border: $loading-indicator-border-size solid transparent; +$loading-indicator-speed: 1.1s; +$loading-indicator-animation: spinner-loader $loading-indicator-speed infinite linear; + +.ss-circular-loading-indicator { + &, + &:after { + border-radius: 50%; + width: $loading-indicator-size; + height: $loading-indicator-size; + } + + &--block { + margin: 30px auto; + } + + font-size: $font-size-small; + position: relative; + text-indent: -9999em; + border: $loading-indicator-border; + border-left: $loading-indicator-border-size solid $color-blue; + -webkit-transform: translateZ(0); + -ms-transform: translateZ(0); + transform: translateZ(0); + -webkit-animation: $loading-indicator-animation; + animation: $loading-indicator-animation; +} + +@-webkit-keyframes spinner-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +@keyframes spinner-loader { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} diff --git a/client/src/components/Loading/Loading.js b/client/src/components/Loading/Loading.js index 09c09897a..a5858608c 100644 --- a/client/src/components/Loading/Loading.js +++ b/client/src/components/Loading/Loading.js @@ -3,7 +3,7 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; /** - * Renders a SilverStripe loading animation + * Renders a Silverstripe loading animation styled after the Silverstripe logo */ class Loading extends PureComponent { render() { diff --git a/client/src/components/Loading/tests/CircularLoading-test.js b/client/src/components/Loading/tests/CircularLoading-test.js new file mode 100644 index 000000000..df7c4f76b --- /dev/null +++ b/client/src/components/Loading/tests/CircularLoading-test.js @@ -0,0 +1,27 @@ +/* global jest, describe, it, expect */ +import React from 'react'; +import Enzyme, { shallow } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import CircularLoading from '../CircularLoading'; + +Enzyme.configure({ adapter: new Adapter() }); + +describe('CircularLoading', () => { + describe('render()', () => { + it('can be displayed as "block"', () => { + const wrapper = shallow( + + ); + + expect(wrapper.find('.ss-circular-loading-indicator--block')).toHaveLength(1); + }); + + it('allows extra classes to be provided', () => { + const wrapper = shallow( + + ); + + expect(wrapper.find('.ss-circular-loading-indicator.hello-world')).toHaveLength(1); + }); + }); +}); diff --git a/client/src/styles/bundle.scss b/client/src/styles/bundle.scss index c6a57d950..79a9dcdf3 100644 --- a/client/src/styles/bundle.scss +++ b/client/src/styles/bundle.scss @@ -48,6 +48,7 @@ @import "../components/IframeDialog/IframeDialog"; @import "../components/Label/Label"; @import "../components/ListGroup/ListGroup"; +@import "../components/Loading/CircularLoading"; @import "../components/Menu/Menu"; @import "../components/MobileMenuToggle/MobileMenuToggle"; @import "../components/Modal/Modal"; From 8aa9b0c3e68963f8fcfc224ed0782fdd8b6805c4 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Mon, 30 Jan 2023 12:58:45 +1300 Subject: [PATCH 3/4] NEW Add HOC to provide sudo mode to child components --- client/lang/src/da.json | 9 +- client/lang/src/en.json | 9 +- client/lang/src/eo.json | 9 +- client/lang/src/nl.json | 9 +- client/lang/src/sl.json | 9 +- client/lang/src/sv.json | 9 +- client/src/bundles/bundle.js | 1 + client/src/containers/SudoMode/SudoMode.js | 239 ++++++++++++++++++ client/src/containers/SudoMode/SudoMode.scss | 39 +++ .../SudoMode/tests/SudoMode-test.js | 231 +++++++++++++++++ client/src/styles/bundle.scss | 3 + 11 files changed, 555 insertions(+), 12 deletions(-) create mode 100644 client/src/containers/SudoMode/SudoMode.js create mode 100644 client/src/containers/SudoMode/SudoMode.scss create mode 100644 client/src/containers/SudoMode/tests/SudoMode-test.js diff --git a/client/lang/src/da.json b/client/lang/src/da.json index 23c47f7c4..3aa15afdb 100644 --- a/client/lang/src/da.json +++ b/client/lang/src/da.json @@ -29,5 +29,10 @@ "Admin.VALIDATOR_MESSAGE_DATE": "{name} er ikke et korrekt dato format.", "Admin.VALIDATOR_MESSAGE_ALPHANUMERIC": "{name} er ikke en alfanumeriskværdi.", "Admin.VALIDATOR_MESSAGE_ALPHA": "{name} er ikke kun bogstaver.", - "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} er ikke en gyldig værdi." -} \ No newline at end of file + "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} er ikke en gyldig værdi.", + "Admin.VERIFY_ITS_YOU": "Bekræft først at det er dig.", + "Admin.WHATS_THIS": "Hvad er dette?", + "Admin.VERIFY_TO_CONTINUE": "Bekræft for at forsætte", + "Admin.ENTER_PASSWORD": "Indtast dit kodeord", + "Admin.VERIFY": "Bekræft" +} diff --git a/client/lang/src/en.json b/client/lang/src/en.json index 9f6947001..cd12002d0 100644 --- a/client/lang/src/en.json +++ b/client/lang/src/en.json @@ -31,5 +31,10 @@ "Admin.VALIDATOR_MESSAGE_DATE": "{name} is not a proper date format.", "Admin.VALIDATOR_MESSAGE_ALPHANUMERIC": "{name} is not an alphanumeric value.", "Admin.VALIDATOR_MESSAGE_ALPHA": "{name} is not only letters.", - "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} is not a valid value." -} \ No newline at end of file + "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} is not a valid value.", + "Admin.ENTER_PASSWORD": "Enter your password", + "Admin.VERIFY": "Verify", + "Admin.VERIFY_ITS_YOU": "Verify it's you first.", + "Admin.VERIFY_TO_CONTINUE": "Verify to continue", + "Admin.WHATS_THIS": "What is this?" +} diff --git a/client/lang/src/eo.json b/client/lang/src/eo.json index f5e6a5f22..5186c2dcd 100644 --- a/client/lang/src/eo.json +++ b/client/lang/src/eo.json @@ -29,5 +29,10 @@ "Admin.VALIDATOR_MESSAGE_DATE": "{name} ne estas ĝusta data formato.", "Admin.VALIDATOR_MESSAGE_ALPHANUMERIC": "{name} ne estas litercifera valoro.", "Admin.VALIDATOR_MESSAGE_ALPHA": "{name} ne estas nur literoj.", - "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} ne estas valida valoro." -} \ No newline at end of file + "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} ne estas valida valoro.", + "Admin.VERIFY_ITS_YOU": "Unue aŭtentigi vin.", + "Admin.WHATS_THIS": "Kio estas tio?", + "Admin.VERIFY_TO_CONTINUE": "Aŭtentigi por daŭrigi", + "Admin.ENTER_PASSWORD": "Enigu vian pasvorton", + "Admin.VERIFY": "Aŭtentigi" +} diff --git a/client/lang/src/nl.json b/client/lang/src/nl.json index d21d2612b..3a0f21b62 100644 --- a/client/lang/src/nl.json +++ b/client/lang/src/nl.json @@ -29,5 +29,10 @@ "Admin.VALIDATOR_MESSAGE_DATE": "{name} is niet in het juiste datum formaat.", "Admin.VALIDATOR_MESSAGE_ALPHANUMERIC": "{name} is geen alpha numerieke waarde.", "Admin.VALIDATOR_MESSAGE_ALPHA": "{name} bestaat niet alleen uit letters.", - "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} is geen geldige waarde." -} \ No newline at end of file + "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} is geen geldige waarde.", + "Admin.VERIFY_ITS_YOU": "Verifieer dat dit je eerste is.", + "Admin.WHATS_THIS": "Wat is dit?", + "Admin.VERIFY_TO_CONTINUE": "Bevestig om door te gaan", + "Admin.ENTER_PASSWORD": "Voer wachtwoord in", + "Admin.VERIFY": "Bevestig" +} diff --git a/client/lang/src/sl.json b/client/lang/src/sl.json index b05cdb7aa..490591bea 100644 --- a/client/lang/src/sl.json +++ b/client/lang/src/sl.json @@ -29,5 +29,10 @@ "Admin.VALIDATOR_MESSAGE_DATE": "{name} ni pravilna oblika datuma.", "Admin.VALIDATOR_MESSAGE_ALPHANUMERIC": "{name} ni alfanumerična vrednost.", "Admin.VALIDATOR_MESSAGE_ALPHA": "{name} niso samo črke.", - "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} ni veljavna vrednost." -} \ No newline at end of file + "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} ni veljavna vrednost.", + "Admin.VERIFY_ITS_YOU": "Najprej potrdite, da ste to res vi.", + "Admin.WHATS_THIS": "Kaj je to?", + "Admin.VERIFY_TO_CONTINUE": "Za nadaljevanje potrdite", + "Admin.ENTER_PASSWORD": "Vnesite vaše geslo", + "Admin.VERIFY": "Preveri" +} diff --git a/client/lang/src/sv.json b/client/lang/src/sv.json index 091c196bb..b954a70cc 100644 --- a/client/lang/src/sv.json +++ b/client/lang/src/sv.json @@ -29,5 +29,10 @@ "Admin.VALIDATOR_MESSAGE_DATE": "{name} is not a proper date format.", "Admin.VALIDATOR_MESSAGE_ALPHANUMERIC": "{name} is not an alphanumeric value.", "Admin.VALIDATOR_MESSAGE_ALPHA": "{name} is not only letters.", - "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} is not a valid value." -} \ No newline at end of file + "Admin.VALIDATOR_MESSAGE_DEFAULT": "{name} is not a valid value.", + "Admin.VERIFY_ITS_YOU": "Verify it's you first.", + "Admin.WHATS_THIS": "Vad är detta?", + "Admin.VERIFY_TO_CONTINUE": "Verifiera för att fortsätta", + "Admin.ENTER_PASSWORD": "Ange ditt lösenord", + "Admin.VERIFY": "Verifiera" +} diff --git a/client/src/bundles/bundle.js b/client/src/bundles/bundle.js index bd11e0545..37d69e08c 100644 --- a/client/src/bundles/bundle.js +++ b/client/src/bundles/bundle.js @@ -28,6 +28,7 @@ import 'expose-loader?exposes=FormBuilderLoader!containers/FormBuilderLoader/For import 'expose-loader?exposes=FormBuilderModal!components/FormBuilderModal/FormBuilderModal'; import 'expose-loader?exposes=FileSchemaModalHandler!containers/InsertLinkModal/fileSchemaModalHandler'; import 'expose-loader?exposes=InsertLinkModal!containers/InsertLinkModal/InsertLinkModal'; +import 'expose-loader?exposes=SudoMode!containers/SudoMode/SudoMode'; import 'expose-loader?exposes=RecordsActions!state/records/RecordsActions'; import 'expose-loader?exposes=GridField!components/GridField/GridField'; import 'expose-loader?exposes=GridFieldCell!components/GridField/GridFieldCell'; diff --git a/client/src/containers/SudoMode/SudoMode.js b/client/src/containers/SudoMode/SudoMode.js new file mode 100644 index 000000000..8fc7515f5 --- /dev/null +++ b/client/src/containers/SudoMode/SudoMode.js @@ -0,0 +1,239 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { Button, InputGroup, InputGroupAddon, Input, FormGroup, Label, FormFeedback } from 'reactstrap'; +import { loadComponent } from 'lib/Injector'; +import fetch from 'isomorphic-fetch'; +import Config from 'lib/Config'; + +// See SudoModeController::getClientConfig() +const configSectionKey = 'SilverStripe\\Admin\\SudoModeController'; + +/** + * Provides a HOC wrapper that will enforce "sudo mode". + * + * This checks that the user has verified that they are them via password + * entry within a certain period of time since they originally logged in. + * If this state is not active then they will be presented with a notice, + * then a verification form, then the passed through component will be + * rendered as normal. + * + * Note that any backend controllers that accept XHR requests from wrapped + * components should enforce backend sudo mode checks, while they can + * assume that sudo mode would be active before requests are actually made + * to them via legitimate use paths. + */ +const withSudoMode = (WrappedComponent) => { + class ComponentWithSudoMode extends Component { + constructor(props) { + super(props); + + this.state = { + active: Config.getSection(configSectionKey).sudoModeActive || false, + showVerification: false, + loading: false, + errorMessage: null, + }; + + this.handleConfirmNotice = this.handleConfirmNotice.bind(this); + this.handleVerify = this.handleVerify.bind(this); + this.handleVerifyInputKeyPress = this.handleVerifyInputKeyPress.bind(this); + + // React 15 compatible ref callback + this.passwordInput = null; + this.setPasswordInput = element => { + this.passwordInput = element; + }; + } + + /** + * Action called when clicking the button to confirm the sudo mode notice + * and trigger the verification form to be rendered. + */ + handleConfirmNotice() { + this.setState({ + showVerification: true, + }, () => this.passwordInput && this.passwordInput.focus()); + } + + /** + * Action called when the user has entered their password and requested + * verification of sudo mode state. + */ + handleVerify() { + this.setState({ + loading: true, + }); + + const payload = new FormData(); + payload.append('SecurityID', Config.get('SecurityID')); + payload.append('Password', this.passwordInput.value); + + // Validate the request + fetch(Config.getSection(configSectionKey).endpoints.activate, { + method: 'POST', + body: payload, + }).then(response => response.json().then(result => { + // Happy path, send the user to the wrapped component + if (result.result) { + return this.setState({ + loading: false, + active: true, + }); + } + + // Validation error, show them the message + return this.setState({ + loading: false, + errorMessage: result.message, + }, () => this.passwordInput.focus()); + })); + } + + /** + * Treat pressing enter on the password field the same as clicking the + * verify button. + * + * @param {object} event + */ + handleVerifyInputKeyPress(event) { + if (event.charCode === 13) { + event.stopPropagation(); + event.preventDefault(); + this.handleVerify(); + } + } + + + /** + * Returns whether "sudo mode" is active for the current user. + * + * @returns {boolean} + */ + isSudoModeActive() { + return this.state.active === true; + } + + /** + * Renders a notice to the user that they will need to verify themself + * to enter sudo mode and continue to use this functionality. + * + * @returns {HTMLElement} + */ + renderSudoModeNotice() { + const { i18n } = window; + const { showVerification } = this.state; + + const helpLink = Config.getSection(configSectionKey).helpLink || null; + + return ( +
+

+ { i18n._t('Admin.VERIFY_ITS_YOU', 'Verify it\'s you first.') } + { helpLink && ( + + { i18n._t('Admin.WHATS_THIS', 'What is this?') } + + ) } +

+ { !showVerification && ( + + ) } +
+ ); + } + + /** + * Renders the password verification form to enter sudo mode + * + * @returns {HTMLElement} + */ + renderSudoModeVerification() { + const { i18n } = window; + const { errorMessage } = this.state; + + const inputProps = { + type: 'password', + name: 'sudoModePassword', + id: 'sudoModePassword', + className: 'no-change-track', + onKeyPress: this.handleVerifyInputKeyPress, + innerRef: this.setPasswordInput, + }; + const validationProps = errorMessage ? { valid: false, invalid: true } : {}; + + return ( +
+ + + + + + + + + { errorMessage } + + +
+ ); + } + + /** + * Renders the "sudo mode" notice or verification screen + * + * @returns {HTMLElement} + */ + renderSudoMode() { + const { showVerification, loading } = this.state; + + const LoadingComponent = this.props.LoadingComponent || loadComponent( + 'CircularLoading', + 'SudoMode' + ); + + if (loading) { + return ( +
+ +
+ ); + } + + return ( +
+ { this.renderSudoModeNotice() } + { showVerification && this.renderSudoModeVerification() } +
+ ); + } + + render() { + if (!this.isSudoModeActive()) { + return this.renderSudoMode(); + } + return ; + } + } + + ComponentWithSudoMode.propTypes = { + LoadingComponent: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), + }; + + return ComponentWithSudoMode; +}; + +export default withSudoMode; diff --git a/client/src/containers/SudoMode/SudoMode.scss b/client/src/containers/SudoMode/SudoMode.scss new file mode 100644 index 000000000..28cc9b951 --- /dev/null +++ b/client/src/containers/SudoMode/SudoMode.scss @@ -0,0 +1,39 @@ +// Note: we don't couple to admin versions, so define our own variables for this module +$form-field-padding-y: .5385rem; +$sudo-mode-icon-size: 1.5rem; +$sudo-mode-notice-spacing: 1rem; +$button-border-radius: .23rem; + +.sudo-mode { + margin-bottom: 0; + padding-bottom: $sudo-mode-notice-spacing; + + &__notice { + margin-bottom: 0; + } + + &__notice-button { + margin-right: $sudo-mode-notice-spacing; + } + + &__notice-help { + margin-left: 3px; + } + + &__verify { + margin-top: $sudo-mode-notice-spacing; + } + + // Removing defaults from admin in SilverStripe 4.x. Specificity required. + &__verify-form-group.form-group { + margin: 0; + } + + // Reactstrap requires form feedback to be places in the same input group as the field + // that is marked as invalid, which causes Bootstrap to remove these properties from the + // attached button. This restores the properties to what they were. + .input-group-append:not(:last-child) .sudo-mode__verify-button { + border-top-right-radius: $button-border-radius; + border-bottom-right-radius: $button-border-radius; + } +} diff --git a/client/src/containers/SudoMode/tests/SudoMode-test.js b/client/src/containers/SudoMode/tests/SudoMode-test.js new file mode 100644 index 000000000..3611f2f24 --- /dev/null +++ b/client/src/containers/SudoMode/tests/SudoMode-test.js @@ -0,0 +1,231 @@ +/* global jest, describe, it, expect */ +import fetch from 'isomorphic-fetch'; +import React from 'react'; +import Enzyme, { shallow, mount } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import withSudoMode from '../SudoMode'; + +Enzyme.configure({ adapter: new Adapter() }); + +jest.unmock('lib/Config'); +jest.mock('isomorphic-fetch'); + +const sectionConfigKey = 'SilverStripe\\Admin\\SudoModeController'; +const TestComponent = () =>
; +const LoadingComponent = () =>
; +let ComponentWithSudoMode = null; + +describe('SudoMode', () => { + beforeEach(() => { + // Set window config + window.ss.config = { + SecurityID: 1234567890, + sections: [ + { + name: sectionConfigKey, + url: 'admin/sudomode', + sudoModeActive: false, + endpoints: { + activate: 'admin/sudomode/activate', + }, + }, + ], + }; + + ComponentWithSudoMode = withSudoMode(TestComponent); + }); + + describe('render()', () => { + it('renders the wrapped component when sudo mode is active', () => { + window.ss.config.sections[0].sudoModeActive = true; + const wrapper = shallow( + + ); + + expect(wrapper.find('TestComponent')).toHaveLength(1); + expect(wrapper.find('.sudo-mode')).toHaveLength(0); + }); + + it('renders a sudo mode verification screen when sudo mode is inactive', () => { + window.ss.config.sections[0].sudoModeActive = false; + const wrapper = shallow( + + ); + + expect(wrapper.find('TestComponent')).toHaveLength(0); + expect(wrapper.find('.sudo-mode')).toHaveLength(1); + }); + }); + + describe('renderSudoMode()', () => { + it('renders a loading component', () => { + const wrapper = shallow( + + ); + wrapper.instance().setState({ + loading: true, + }); + + expect(wrapper.find('LoadingComponent')).toHaveLength(1); + }); + + it('renders a notice', () => { + const wrapper = shallow( + + ); + + expect(wrapper.find('.sudo-mode__notice')).toHaveLength(1); + }); + }); + + describe('renderSudoModeNotice()', () => { + it('renders a help link when one is provided', () => { + window.ss.config.sections[0].helpLink = 'http://google.com'; + const wrapper = shallow( + + ); + + expect(wrapper.find('.sudo-mode__notice-help')).toHaveLength(1); + expect(wrapper.find('.sudo-mode__notice-help').props().href).toBe('http://google.com'); + }); + + it('doesn\'t render a help link when one is not provided', () => { + window.ss.config.sections[0].helpLink = null; + const wrapper = shallow( + + ); + + expect(wrapper.find('.sudo-mode__notice-help')).toHaveLength(0); + }); + + it('shows the verification screen when "Verify" is clicked', () => { + const wrapper = shallow( + + ); + + expect(wrapper.find('.sudo-mode__notice-button')).toHaveLength(1); + wrapper.find('.sudo-mode__notice-button').simulate('click'); + expect(wrapper.find('.sudo-mode__verify')).toHaveLength(1); + }); + }); + + describe('renderSudoModeVerification()', () => { + it('renders a password field', () => { + const wrapper = shallow( + + ); + expect(wrapper.find('.sudo-mode__notice-button')).toHaveLength(1); + wrapper.find('.sudo-mode__notice-button').simulate('click'); + + expect(wrapper.find('#sudoModePassword')).toHaveLength(1); + }); + }); + + describe('handleVerify', () => { + it('posts the request to be verified and returns the wrapped component on success', done => { + // Mock a successful response from the API request + fetch.mockClear(); + fetch.mockImplementation(() => Promise.resolve({ + status: 200, + json: () => Promise.resolve({ + result: true, + }), + })); + + const wrapper = mount( + + ); + + // Confirm the notice + expect(wrapper.find('Button.sudo-mode__notice-button')).toHaveLength(1); + wrapper.find('Button.sudo-mode__notice-button').simulate('click'); + + // Enter a password + expect(wrapper.find('input#sudoModePassword')).toHaveLength(1); + wrapper.find('input#sudoModePassword').getDOMNode().value = '0p3nS3samE!'; + + // Click "Verify" + expect(wrapper.find('Button.sudo-mode__verify-button')).toHaveLength(1); + wrapper.find('Button.sudo-mode__verify-button').simulate('click'); + + // Expect to see a loading indicator + expect(wrapper.find('LoadingComponent')).toHaveLength(1); + + // Expect the request to be sent + setTimeout(() => { + expect(fetch).toHaveBeenCalledTimes(1); + + const mockedCall = fetch.mock.calls[0]; + expect(mockedCall[0]).toBe('admin/sudomode/activate'); + expect(mockedCall[1].method).toBe('POST'); + + const expectedFormData = new FormData(); + expectedFormData.append('SecurityID', '1234567890'); + expectedFormData.append('Password', '0p3nS3samE!'); + expect(mockedCall[1].body).toEqual(expectedFormData); + + // Successful result, check wrapped component is rendered + expect(wrapper.instance().state.active).toBe(true); + expect(wrapper.instance().state.loading).toBe(false); + done(); + }); + }); + + it('posts the request to be verified and shows errors on failure', done => { + // Mock a successful response from the API request + fetch.mockClear(); + fetch.mockImplementation(() => Promise.resolve({ + status: 200, + json: () => Promise.resolve({ + result: false, + message: 'It broke because its a test.', + }), + })); + + const wrapper = mount( + + ); + + // Confirm the notice + expect(wrapper.find('Button.sudo-mode__notice-button')).toHaveLength(1); + wrapper.find('Button.sudo-mode__notice-button').simulate('click'); + + // Enter a password + expect(wrapper.find('input#sudoModePassword')).toHaveLength(1); + wrapper.find('input#sudoModePassword').getDOMNode().value = 'wrongpassword'; + + // Click "Verify" + expect(wrapper.find('Button.sudo-mode__verify-button')).toHaveLength(1); + wrapper.find('Button.sudo-mode__verify-button').simulate('click'); + + // Expect to see a loading indicator + expect(wrapper.find('LoadingComponent')).toHaveLength(1); + + // Expect the request to be sent + setTimeout(() => { + expect(fetch).toHaveBeenCalledTimes(1); + + const mockedCall = fetch.mock.calls[0]; + expect(mockedCall[0]).toBe('admin/sudomode/activate'); + expect(mockedCall[1].method).toBe('POST'); + + const expectedFormData = new FormData(); + expectedFormData.append('SecurityID', '1234567890'); + expectedFormData.append('Password', 'wrongpassword'); + expect(mockedCall[1].body).toEqual(expectedFormData); + + // Failed to verify or activate, check that the error message is shown + expect(wrapper.instance().state.active).toBe(false); + expect(wrapper.instance().state.loading).toBe(false); + expect(wrapper.text()).toContain('It broke because its a test.'); + done(); + }); + }); + }); +}); diff --git a/client/src/styles/bundle.scss b/client/src/styles/bundle.scss index 79a9dcdf3..dcb1b8543 100644 --- a/client/src/styles/bundle.scss +++ b/client/src/styles/bundle.scss @@ -72,6 +72,9 @@ @import "../components/PopoverOptionSet/PopoverOptionSet"; @import "../components/FileStatusIcon/FileStatusIcon"; +// Containers (other than whole sections) +@import "../containers/SudoMode/SudoMode"; + // Layout and sections @import "layout"; @import "../containers/App/App"; From 20e2dc57ab3d29064411c1f5c9d7888f87f8159a Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Mon, 30 Jan 2023 14:22:07 +1300 Subject: [PATCH 4/4] MNT run yarn build --- client/dist/js/bundle.js | 44 +++++++++++++++++------------------ client/dist/styles/bundle.css | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index 9d36e4b0c..85b19c392 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1,38 +1,38 @@ -(self.webpackChunksilverstripe_admin=self.webpackChunksilverstripe_admin||[]).push([[296],{13978:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=b(n(19755)),r=b(n(67294)),i=n(86706),s=b(n(20745)),o=n(79655),l=b(n(94974)),d=b(n(15586)),u=b(n(80507)),c=b(n(55766)),f=n(46398),p=b(n(4754)),h=n(11962),m=b(n(96869)),g=n(89250),v=n(80195);function b(e){return e&&e.__esModule?e:{default:e}}var _=class{constructor(e,t){this.store=e,this.client=t;const n=l.default.get("absoluteBaseUrl");d.default.setAbsoluteBase(n),this.handleBeforeRoute=this.handleBeforeRoute.bind(this),this.handleBeforeUnload=this.handleBeforeUnload.bind(this)}setStore(e){this.store=e}setClient(e){this.client=e}start(e){this.matchesReactRoute(e)?this.initReactRouter():this.initLegacyRouter();const t=window.onbeforeunload;window.onbeforeunload=()=>this.shouldConfirmBeforeUnload()?p.default._t("Admin.CONFIRMUNSAVEDSHORT","WARNING: Your changes have not been saved."):"function"==typeof t?t():void 0}matchesReactRoute(e){const t=l.default.get("sections"),n=d.default.resolveURLToBase(e).replace(/\/$/,"");return!!t.find((e=>{const t=d.default.resolveURLToBase(e.url).replace(/\/$/,"");return!!e.reactRouter&&n.match(t)}))}initReactRouter(){u.default.updateRootRoute({component:c.default});const e=u.default.getRootRoute(),t=u.default.getChildRoutes().map((e=>r.default.createElement(g.Route,{key:e.path,path:e.path,element:r.default.createElement(e.component,null)})));s.default.createRoot(document.getElementsByClassName("cms-content")[0]).render(r.default.createElement(f.ApolloProvider,{client:this.client},r.default.createElement(i.Provider,{store:this.store},r.default.createElement(o.BrowserRouter,{basename:(0,v.joinUrlPaths)(l.default.get("baseUrl"),l.default.get("adminUrl"))},r.default.createElement(g.Routes,null,r.default.createElement(g.Route,{path:e.path,element:r.default.createElement(e.component,null)},t))))))}initLegacyRouter(){const e=l.default.get("sections"),t=this.store;(0,d.default)("*",((e,n)=>{const a=p.default._t("Admin.CONFIRMUNSAVED","Are you sure you want to navigate away from this page?\n\n\n WARNING: Your changes have not been saved.\n\n\n Press OK to continue, or Cancel to stay on the current page.");this.shouldConfirmBeforeUnload()&&!window.confirm(a)||(e.store=t,n())}));let n=null;e.forEach((e=>{let t=d.default.resolveURLToBase(e.url);t=t.replace(/\/$/,""),t=`${t}(/*?)?`,(0,d.default)(t,((e,t)=>{if("complete"!==document.readyState||e.init)return void t();n||(n=window.location.pathname);const r=e.state&&e.state.__forceReload;(e.path!==n||r)&&(n=e.path.replace(/#.*$/,""),(0,a.default)(".cms-container").entwine("ss").handleStateChange(null,e.state))}))}));s.default.createRoot(document.createElement("div")).render(r.default.createElement("a",{role:"none",onClick:()=>{}})),d.default.start()}shouldConfirmBeforeUnload(){const e=this.store.getState(),t=e.unsavedForms||[],n=e.form.formSchemas;return t.filter((t=>{const a=Object.values(n).find((e=>e.name===t.name));return!!(a&&a.state&&a.state.notifyUnsavedChanges)&&(0,h.isDirty)(t.name,m.default)(e)})).length>0}handleBeforeUnload(e,t){return this.shouldConfirmBeforeUnload()?t(confirm(p.default._t("Admin.CONFIRMUNSAVEDSHORT","WARNING: Your changes have not been saved."))):t(!0)}handleBeforeRoute(e,t){return this.shouldConfirmBeforeUnload()?t(confirm(p.default._t("Admin.CONFIRMUNSAVED","Are you sure you want to navigate away\n from this page?\n\nWARNING: Your changes have not been saved.\n\n\n Press OK to continue, or Cancel to stay on the current page."))):t(!0)}};t.default=_},56029:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=n(71745),i=(a=n(2395))&&a.__esModule?a:{default:a};var s=e=>{const t={};return e&&e.__schema.types.forEach((e=>{e.possibleTypes&&(t[e.name]=e.possibleTypes.map((e=>e.name)))})),new r.InMemoryCache({possibleTypes:t,dataIdFromObject:i.default,addTypename:!0})};t.default=s},56062:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=n(46398),r=l(n(94974)),i=l(n(85478)),s=l(n(66783)),o=l(n(56029));function l(e){return e&&e.__esModule?e:{default:e}}var d=async e=>{const t=r.default.getSection("SilverStripe\\Admin\\LeftAndMain").graphql,n=t&&t.cachedTypenames;let l;try{l=await(0,i.default)(e,n)}catch(e){l=null}const d=(0,o.default)(l),u=(0,s.default)(e),c=(0,a.from)(u);return new a.ApolloClient({cache:d,link:c})};t.default=d},66783:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=n(46398),i=n(63200),s=(a=n(94974))&&a.__esModule?a:{default:a},o=n(80195);var l=e=>{const t=new r.HttpLink({uri:(0,o.joinUrlPaths)(e,"admin/graphql"),fetchOptions:{credentials:"same-origin",headers:{accept:"application/json"}}}),n=(0,i.onError)((e=>{let{networkError:t}=e;t&&console.log(`[Network error]: ${t}`)}));return[new r.ApolloLink(((e,t)=>(e.setContext({headers:{"X-CSRF-TOKEN":s.default.get("SecurityID")}}),t(e)))),n,t]};t.default=l},2395:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=e=>{const t=e.id||e.ID;return t&&t>=0&&e.__typename?`${e.__typename}:${t}`:null};t.default=n},85478:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(94301))&&a.__esModule?a:{default:a},i=n(80195);const s=e=>{const t=e.data;return t.__schema.types=t.__schema.types.filter((e=>null!==e.possibleTypes)),t},o=e=>{if(!e.ok)throw new Error("The types.graphql file could not be loaded. You probably need to run a ?flush to generate it.\n Alternatively, you can use the IntrospectionProvider extension to generate the file dynamically.\n More information: https://github.com/silverstripe/silverstripe-graphql/#schema-introspection");return e};var l=async function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=!!document.body.getAttribute("data-graphql-legacy"),a=[(0,i.joinUrlPaths)(e,"_graphql/admin.types.graphql"),(0,i.joinUrlPaths)(e,"admin.types.graphql")],l=[(0,i.joinUrlPaths)(e,"admin/graphql/types"),(0,i.joinUrlPaths)(e,"assets/admin.types.graphql")];let d,u;n?(t&&l.reverse(),[d,u]=l):[d,u]=a;const c={method:"GET",headers:{"Content-Type":"application/json"},uri:e,credentials:"same-origin"},f=async e=>(0,r.default)(e,c).then(o).then((e=>e.json())).then(s);let p;try{p=await f(d)}catch(e){if(!u)return Promise.reject(e);try{p=await f(u)}catch(e){return Promise.reject(e)}}return Promise.resolve(p)};t.default=l},59467:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__,n=window.__REDUX_DEVTOOLS_EXTENSION__||window.devToolsExtension;if("function"==typeof t)return t(e);if("function"==typeof n)return(0,a.compose)(e,n());return e};var a=n(14890)},10374:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=l(n(54582)),r=l(n(39062)),i=l(n(94184)),s=n(48834),o=l(n(98028));function l(e){return e&&e.__esModule?e:{default:e}}const d=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e.extraClass?e.extraClass.split(" ").reduce(((e,t)=>({...e,[t]:!0})),{}):{};"string"==typeof e.data.pristineClass&&(n[e.data.pristineClass]=t),"string"==typeof e.data.dirtyClass&&(n[e.data.dirtyClass]=!t);const a=t?e.data.pristineTitle:e.data.dirtyTitle,r=t?e.data.pristineIcon:e.data.dirtyIcon;return{...e,title:a||e.title,icon:r||e.icon,extraClass:(0,i.default)(n)}};var u=()=>{a.default.transform("field-holders",(e=>{["FieldGroup"].forEach((t=>e.component("FieldGroup",o.default,`${t}Holder`)))})),a.default.transform("form-action-changed",(e=>{e.form.alterSchema("*",(e=>(e.mutateField("action_save",(t=>{const n=e.isPristine();return d(t,n)})),e.mutateField("action_publish",(t=>{const n=t.data.isPublished&&!t.data.isModified&&e.isPristine();return d(t,n)})),e.getState())))})),a.default.transform("schema-validation",(e=>{e.form.addValidation("*",((e,t,n)=>{const a=new r.default(e),i=Object.keys(e).reduce(((e,t)=>{const r=(0,s.findField)(n.fields,t);if(!r)return e;const{valid:i,errors:o}=a.validateFieldSchema(r);return i?e:{...e,[t]:o}}),{});return t.addErrors(i),t.getState()}))}))};t.default=u},27274:function(e,t,n){"use strict";var a=h(n(54582)),r=n(14890),i=h(n(53894)),s=h(n(94974)),o=h(n(56062)),l=n(32212),d=h(n(89521)),u=h(n(24180)),c=h(n(59467)),f=h(n(10374)),p=h(n(13978));function h(e){return e&&e.__esModule?e:{default:e}}window.ss=window.ss||{},window.onload=async function(){const e=s.default.get("absoluteBaseUrl"),t=await(0,o.default)(e);(0,d.default)(),(0,u.default)();const n=[i.default],h=s.default.get("debugging");let m=(0,r.applyMiddleware)(...n);h&&(m=(0,c.default)(m));const g=m(r.createStore);window.ss.apolloClient=t;const v=new p.default(null,t);(0,f.default)(),a.default.init((()=>{const e=(0,r.combineReducers)(a.default.reducer.getAll()),t=g(e,{});t.dispatch((0,l.setConfig)(s.default.getAll())),a.default.reducer.setStore(t),window.ss.store=t,v.setStore(t),v.start(window.location.pathname),window.jQuery&&window.jQuery("body").addClass("js-react-boot").addClass("js-injector-boot")})),window.setTimeout((()=>a.default.load()),0)}},89521:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=n(11962),r=Z(n(54582)),i=Z(n(95393)),s=Z(n(37294)),o=Z(n(22602)),l=Z(n(45332)),d=Z(n(74898)),u=Z(n(19423)),c=Z(n(81463)),f=Z(n(63182)),p=Z(n(79629)),h=Z(n(49954)),m=Z(n(41370)),g=Z(n(5110)),v=Z(n(88940)),b=Z(n(71375)),_=Z(n(63980)),y=Z(n(20693)),w=Z(n(65732)),O=Z(n(7162)),E=Z(n(618)),C=Z(n(21677)),T=Z(n(82432)),S=Z(n(75917)),P=Z(n(61404)),j=Z(n(40505)),M=Z(n(59644)),D=Z(n(52935)),R=Z(n(59888)),k=Z(n(48297)),I=Z(n(55742)),x=Z(n(65963)),A=Z(n(23296)),N=Z(n(3080)),F=Z(n(36800)),L=Z(n(80384)),$=Z(n(34411)),U=Z(n(57129)),B=Z(n(98031)),W=Z(n(72543)),V=Z(n(85362)),H=Z(n(97023)),q=Z(n(97228)),z=Z(n(20164)),G=Z(n(62266)),K=Z(n(65693)),X=Z(n(1922)),Y=Z(n(92227)),Q=Z(n(71255)),J=Z(n(49331));function Z(e){return e&&e.__esModule?e:{default:e}}t.default=()=>{r.default.component.registerMany({ActionMenu:i.default,Badge:s.default,Button:o.default,BackButton:l.default,TextField:d.default,HiddenField:u.default,DateField:c.default,TimeField:f.default,DatetimeField:p.default,CheckboxField:h.default,CheckboxSetField:m.default,OptionsetField:g.default,GridField:v.default,GridFieldActions:b.default,FieldGroup:D.default,SingleSelectField:_.default,PopoverField:y.default,HeaderField:w.default,LiteralField:O.default,HtmlReadonlyField:E.default,LookupField:C.default,CompositeField:T.default,Tabs:P.default,TabItem:j.default,FormAction:M.default,LabelField:S.default,TreeDropdownField:R.default,Preview:N.default,ReduxForm:F.default,ReduxFormField:a.Field,Form:x.default,FormAlert:A.default,FormBuilderModal:k.default,NotFoundComponent:I.default,UsedOnTable:L.default,Loading:$.default,VersionedBadge:U.default,ViewModeToggle:B.default,ResizeAware:W.default,Tag:V.default,TagList:H.default,CompactTagList:q.default,Tip:z.default,Search:G.default,SearchToggle:K.default,HtmlEditorField:X.default,NumberField:Y.default,PopoverOptionSet:Q.default,ToastsContainer:J.default})}},24180:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=b(n(54582)),r=n(14890),i=n(11962),s=b(n(18373)),o=b(n(54191)),l=b(n(81951)),d=b(n(20430)),u=b(n(5452)),c=b(n(54558)),f=b(n(80573)),p=b(n(13346)),h=b(n(11146)),m=b(n(32659)),g=b(n(22793)),v=b(n(84231));function b(e){return e&&e.__esModule?e:{default:e}}t.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(0,r.combineReducers)({formState:i.reducer,formSchemas:o.default});a.default.reducer.registerMany({config:s.default,form:t,records:l.default,breadcrumbs:d.default,treeDropdownField:u.default,tabs:c.default,mobileMenu:f.default,unsavedForms:p.default,usedOn:h.default,viewMode:g.default,toasts:v.default,...e}),a.default.transform("admin",(e=>{e.reducer("form",m.default)}))}},61534:function(e,t,n){"use strict";n(28432),n(77300),n(12523),n(46844),n(58794),n(91044),n(94033),n(39432),n(10452),n(99324),n(66273),n(62746),n(86673),n(92173),n(65986),n(64482),n(4567),n(77511),n(64300),n(16741),n(31968),n(63063),n(16089),n(14755),n(50194),n(37386),n(87577),n(43109),n(4193),n(40127),n(44368),n(40256),n(29094),n(60462),n(49841),n(99511),n(96582),n(1488),n(69860),n(33281),n(79035),n(8592),n(46508),n(28170),n(53438),n(83361),n(94813),n(72472),n(55488),n(40829),n(47157),n(53877),n(71080),n(37904),n(97976),n(8145),n(87746),n(86317),n(87603),n(59628),n(70184),n(91673),n(60128),n(87872),n(60140),n(57006),n(19602),n(27729),n(54218),n(98441),n(96007),n(43893),n(1913),n(88854),n(47640),n(50628),n(62596),n(73843),n(49266),n(95075),n(49958),n(60395),n(41221),n(88615),n(82165),n(56970),n(73366),n(81047),n(87594),n(15878),n(75350),n(8162),n(76406),n(8298),n(40303),n(44686),n(49785),n(13305),n(57893),n(49414),n(42886),n(17106),n(27274)},34625:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(67294))&&a.__esModule?a:{default:a};var i=e=>r.default.createElement("div",{className:"accordion",role:"tablist","aria-multiselectable":"true"},e.children);t.default=i},56448:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(67294))&&a.__esModule?a:{default:a};var i=e=>{const t=`${e.groupid}_Header`,n=`${e.groupid}_Items`,a=n.replace(/\\/g,"_"),i=t.replace(/\\/g,"_"),s={id:a,"aria-expanded":!0,className:"list-group list-group-flush collapse show",role:"tabpanel","aria-labelledby":t};return r.default.createElement("div",{className:"accordion__block"},r.default.createElement("a",{className:"accordion__title","data-toggle":"collapse",href:`#${a}`,"aria-expanded":"true","aria-controls":n,id:i,role:"tab"},e.title),r.default.createElement("div",s,e.children))};t.default=i},95393:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=l(n(45697)),i=n(53556),s=l(n(4754)),o=l(n(94184));function l(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;tthis.setState({isOpen:!this.state.isOpen})),0)}render(){const{dropdownToggleProps:e,dropdownMenuProps:t,dropdownToggleClassNames:n,className:r,toggleCallback:l,...d}=this.props,c=(0,o.default)(n,e.className),f=(0,o.default)("action-menu__dropdown",t.className);return a.default.createElement(i.Dropdown,u({className:(0,o.default)("action-menu",r),isOpen:this.state.isOpen,toggle:this.toggle},d),a.default.createElement(i.DropdownToggle,u({className:c,"aria-label":s.default._t("Admin.ACTIONS","View actions")},e)),a.default.createElement(i.DropdownMenu,u({className:f},t),this.props.children))}}c.propTypes={toggleCallback:r.default.func,dropdownToggleClassNames:r.default.arrayOf(r.default.string)},c.defaultProps={className:"",dropdownToggleClassNames:["action-menu__toggle","btn","btn--no-text","btn--icon-xl","font-icon-dot-3"],dropdownToggleProps:{},dropdownMenuProps:{}};var f=c;t.default=f},37294:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.statuses=t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=s(n(94184)),i=s(n(45697));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}const l=["default","info","success","warning","danger","primary","secondary"];t.statuses=l;class d extends a.PureComponent{render(){const{status:e,inverted:t,className:n,message:i}=this.props;if(!e)return null;const s=t?`badge-${e}--inverted`:"",o=(0,r.default)(n,"badge",`badge-${e}`,s);return a.default.createElement("span",{className:o},i)}}d.propTypes={message:i.default.node,status:i.default.oneOf(l),className:i.default.string,inverted:i.default.bool},d.defaultProps={status:"default",className:"badge-pill",inverted:!1};var u=d;t.default=u},71691:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=n(86706),i=d(n(94184)),s=d(n(45697)),o=d(n(67388)),l=d(n(5257));function d(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class c extends a.Component{getLastCrumb(){return this.props.crumbs&&this.props.crumbs[this.props.crumbs.length-1]}renderBreadcrumbs(){return this.props.crumbs?this.props.crumbs.slice(0,-1).map((e=>a.default.createElement("li",{key:e.text,className:"breadcrumb__item"},a.default.createElement(l.default,{className:"breadcrumb__item-title",href:e.href,onClick:e.onClick},e.text)))):null}renderLastCrumb(){const e=this.getLastCrumb();return e?a.default.createElement("div",{className:"breadcrumb__item breadcrumb__item--last"},a.default.createElement("h2",{className:"breadcrumb__item-title"},e.text,e.icon&&this.renderIcons([e.icon]),e.icons&&this.renderIcons(e.icons))):null}renderIcons(e){return e.map(((e,t)=>{const{nodeName:n,className:r,hasRestrictedAccess:s,...l}=e;let d={...l};const u=(0,i.default)(["breadcrumb__icon",r]);return d={tabIndex:"0",...d},d.hasOwnProperty("onClick")&&(d={role:"button",...d}),d.key=`breadcrumb-icon-${t}`,"FileStatusIcon"===n?(d.fileID=0,d.hasRestrictedAccess=s,d.extraClassName=u,a.default.createElement(o.default,d)):(d.className=u,a.default.createElement("span",d))}))}render(){return a.default.createElement("div",{className:"breadcrumb__container fill-height flexbox-area-grow"},this.props.crumbs&&this.props.crumbs.length>1&&a.default.createElement("div",{className:"breadcrumb__list-container"},a.default.createElement("ol",{className:"breadcrumb"},this.renderBreadcrumbs())),this.renderLastCrumb())}}t.Component=c,c.propTypes={crumbs:s.default.arrayOf(s.default.shape({onClick:s.default.func,text:s.default.string,icon:s.default.shape({nodeName:s.default.string,className:s.default.string,onClick:s.default.func,action:e=>{if(e.action)throw new Error("action: no longer used")}}),icons:s.default.arrayOf(s.default.shape({nodeName:s.default.string,className:s.default.string,onClick:s.default.func}))}))};var f=(0,r.connect)((function(e){return{crumbs:e.breadcrumbs}}))(c);t.default=f},45332:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=o(n(67294)),r=o(n(22602)),i=o(n(94184)),s=o(n(4754));function o(e){return e&&e.__esModule?e:{default:e}}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{className:t,...n}=e;return a.default.createElement(r.default,l({className:(0,i.default)(t,"back-button")},n))};d.propTypes=r.default.propTypes,d.defaultProps={...r.default.defaultProps,noText:!0,icon:"left-open-big",children:s.default._t("Admin.BACK","Back")};var u=d;t.default=u},22602:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=l(n(67294)),r=n(53556),i=l(n(45697)),s=l(n(94184)),o=l(n(29258));function l(e){return e&&e.__esModule?e:{default:e}}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{className:t,noText:n,children:i,...o}=e;return a.default.createElement(r.Button,d({className:(0,s.default)(t,{"btn--no-text":n}),"aria-label":n?i:void 0},o),n?void 0:i)};u.propTypes={...r.Button.propTypes,noText:i.default.bool},u.defaultProps={...r.Button.defaultProps,noText:!1};var c=(0,o.default)(u);t.default=c},29258:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=s(n(67294)),r=s(n(45697)),i=s(n(94184));function s(e){return e&&e.__esModule?e:{default:e}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const t=t=>{let{icon:n,className:r,...s}=t;return a.default.createElement(e,o({className:(0,i.default)(r,n&&`font-icon-${n}`)},s))};return t.propTypes={...e.propTypes,icon:r.default.string},t.defaultProps=e.defaultProps,t.displayName=e.name,t};t.default=l},49954:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=s(n(67294)),r=s(n(98028)),i=s(n(31885));function s(e){return e&&e.__esModule?e:{default:e}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;ta.default.createElement(i.default,o({},e,{type:"checkbox"}));t.Component=l;var d=e=>{const t=(0,r.default)(l);return a.default.createElement(t,o({},e,{hideLabels:!0}))};t.default=d},41370:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=o(n(31885)),i=o(n(98028)),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t`${e}`)):[]}getOptionProps(e,t){const n=this.getValues(),a=this.getItemKey(e,t);return{key:a,id:a,name:this.props.name,className:this.props.itemClass,disabled:e.disabled||this.props.disabled,readOnly:this.props.readOnly,onChange:this.handleChange,value:n.indexOf(`${e.value}`)>-1,title:e.title,type:"checkbox"}}handleChange(e,t){if("function"==typeof this.props.onChange){const n=this.getValues(),a=this.props.source.filter(((e,a)=>this.getItemKey(e,a)===t.id?1===t.value:n.indexOf(`${e.value}`)>-1)).map((e=>`${e.value}`));this.props.onChange(e,{id:this.props.id,value:a})}}render(){return this.props.source?a.default.createElement("div",null,this.props.source.map(((e,t)=>a.default.createElement(r.default,d({},this.getOptionProps(e,t),{hideLabels:!0}))))):null}}t.Component=u,u.propTypes={className:s.default.string,extraClass:s.default.string,itemClass:s.default.string,id:s.default.string,name:s.default.string.isRequired,source:s.default.arrayOf(s.default.shape({value:s.default.oneOfType([s.default.string,s.default.number]),title:s.default.any,disabled:s.default.bool})),onChange:s.default.func,value:s.default.any,readOnly:s.default.bool,disabled:s.default.bool},u.defaultProps={extraClass:"",className:"",value:[]};var c=e=>{const t=(0,i.default)(u);return a.default.createElement(t,e)};t.default=c},82432:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=s(n(10259)),i=s(n(45697));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}class l extends a.Component{getLegend(){return"fieldset"===this.props.data.tag&&this.props.data.legend?(0,r.default)("legend",this.props.data.legend):null}getClassName(){return`${this.props.className} ${this.props.extraClass}`}render(){const e=this.getLegend(),t=this.props.data.tag||"div",n=this.getClassName();return a.default.createElement(t,{className:n},e,this.props.children)}}t.Component=l,l.propTypes={data:i.default.oneOfType([i.default.array,i.default.shape({tag:i.default.string,legend:i.default.string})]),extraClass:i.default.string},l.defaultProps={className:"",extraClass:""};var d=l;t.default=d},81463:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=d(n(98028)),r=n(74898),i=d(n(30381)),s=d(n(68300)),o=d(n(4754)),l=d(n(45697));function d(e){return e&&e.__esModule?e:{default:e}}class u extends r.Component{render(){return super.render()}moment(){return i.default.locale(this.getLang()),(0,i.default)(...arguments)}getLang(){return(this.asHTML5()?this.props.isoLang:this.props.lang)||(0,i.default)().locale()}asHTML5(){return this.props.data.html5&&this.hasNativeSupport()}hasNativeSupport(){return this.props.modernizr.inputtypes.date}getInputProps(){const e=o.default.inject(o.default._t("Admin.FormatExample","Example: {format}"),{format:this.moment().endOf("month").format("L")}),t=this.asHTML5()?this.props.value:this.getLocalisedValue(),n=this.asHTML5()?"date":"text";return{...super.getInputProps(),type:n,value:t,placeholder:e}}getLocalisedValue(){return this.convertToLocalised(this.props.value)}isMultiline(){return!1}handleChange(e){const t=e.target.value;let n="";n=this.asHTML5()?t:this.convertToIso(t),"function"==typeof this.props.onChange&&this.triggerChange(e,n)}triggerChange(e,t){this.props.onChange(e,{id:this.props.id,value:t})}convertToIso(e){let t="";if(e){const n=this.moment(e,["L","YYYY-MM-DD"]);n.isValid()&&(t=n.format("YYYY-MM-DD"))}return t}convertToLocalised(e){let t="";if(e){const n=this.moment(e);n.isValid()&&(t=n.format("L"))}return t}}t.Component=u,u.propTypes={lang:l.default.string,isoLang:l.default.string,modernizr:l.default.object,data:l.default.shape({html5:l.default.bool})},u.defaultProps={modernizr:s.default,data:{}};var c=(0,a.default)(u);t.default=c},79629:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=o(n(98028)),r=n(81463),i=o(n(30381)),s=o(n(4754));function o(e){return e&&e.__esModule?e:{default:e}}const l="L LT";class d extends r.Component{getInputProps(){const e=s.default.inject(s.default._t("Admin.FormatExample","Example: {format}"),{format:this.moment().endOf("month").format(l)}),t=this.asHTML5()?"datetime-local":"text";return{...super.getInputProps(),type:t,placeholder:e}}isMultiline(){return!1}hasNativeSupport(){return this.props.modernizr.inputtypes["datetime-local"]}triggerChange(e,t){/^\d{4}-\d\d-\d\dT\d\d:\d\d$/.test(t)?this.props.onChange(e,{id:this.props.id,value:`${t}:00`}):this.props.onChange(e,{id:this.props.id,value:t})}convertToLocalised(e){i.default.locale(this.props.lang);let t="";if(e){const n=this.moment(e);n.isValid()&&(t=n.format(l))}return t}convertToIso(e){i.default.locale(this.props.lang);let t="";if(e){const n=[l,"L",i.default.ISO_8601],a=this.moment(e,n);a.isValid()&&(t=a.format("YYYY-MM-DDTHH:mm:ss"))}return t}}t.Component=d,d.propTypes=r.Component.propTypes,d.defaultProps=r.Component.defaultProps;var u=(0,a.default)(d);t.default=u},52935:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=s(n(82432)),r=s(n(45697)),i=s(n(94184));function s(e){return e&&e.__esModule?e:{default:e}}class o extends a.default{getClassName(){return(0,i.default)("field-group-component",{"field-group-component__small-holder":this.props.smallholder},super.getClassName())}}o.propTypes={...a.default.propTypes,smallholder:r.default.bool},o.defaultProps={...a.default.defaultProps,smallholder:!0};var l=o;t.default=l},98028:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=c(n(67294)),r=n(53556),i=d(n(10259)),s=d(n(94184)),o=d(n(45697)),l=c(n(20164));function d(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,n&&n.set(e,a),a}var f=function(e){class t extends a.Component{getMessage(){let e=null;this.props.message&&this.props.message.value&&(e=this.props.message);const t=this.props.meta;return t&&t.error&&t.touched&&(!e||t.dirty)&&(e=t.error),e}getHolderProps(){return{className:(0,s.default)({field:!0,[this.props.extraClass]:!0,readonly:this.props.readOnly}),id:this.props.holderId}}renderMessage(){const e=this.getMessage();if(!e)return null;const t=(0,s.default)(["form__field-message",`form__field-message--${e.type}`]),n=(0,i.default)("div",e.value);return a.default.createElement("div",{className:t},n)}renderLeftTitle(){const e=null!==this.props.leftTitle?this.props.leftTitle:this.props.title;return!e||this.props.hideLabels?null:(0,i.default)(r.Label,e,{className:"form__field-label",for:this.props.id})}renderRightTitle(){return!this.props.rightTitle||this.props.hideLabels?null:(0,i.default)(r.Label,this.props.rightTitle,{className:"form__field-label",for:this.props.id})}renderField(){const t=Boolean(this.getMessage()),n={...this.props,extraClass:(0,s.default)(this.props.extraClass,{"is-invalid":t})},i=a.default.createElement(e,n),o=this.props.data.prefix,l=this.props.data.suffix;return o||l?a.default.createElement(r.InputGroup,null,o&&a.default.createElement(r.InputGroupAddon,{addonType:"prepend"},o),i,l&&a.default.createElement(r.InputGroupAddon,{addonType:"append"},l)):i}renderTitleTip(){return this.props.id&&this.props.titleTip&&this.props.titleTip.content?a.default.createElement(l.default,{id:`FieldHolder-${this.props.id}-titleTip`,content:this.props.titleTip.content,fieldTitle:this.props.title,type:l.TIP_TYPES.TITLE,icon:"menu-help"}):null}renderDescription(){return null===this.props.description?null:(0,i.default)("div",this.props.description,{className:"form__field-description"})}render(){return this.props.noHolder?this.renderField():a.default.createElement(r.FormGroup,this.getHolderProps(),this.renderLeftTitle(),this.renderTitleTip(),a.default.createElement("div",{className:"form__field-holder"},this.renderField(),this.renderMessage(),this.renderDescription()),this.renderRightTitle())}}return t.propTypes={leftTitle:o.default.any,rightTitle:o.default.any,title:o.default.any,extraClass:o.default.string,holderId:o.default.string,id:o.default.string,name:o.default.string,description:o.default.any,hideLabels:o.default.bool,message:o.default.shape({extraClass:o.default.string,value:o.default.any,type:o.default.string}),data:o.default.oneOfType([o.default.array,o.default.shape({prefix:o.default.string,suffix:o.default.string})]),titleTip:o.default.shape(l.tipShape)},t.defaultProps={className:"",extraClass:"",leftTitle:null,rightTitle:null,title:"",description:null,hideLabels:!1,noHolder:!1,message:null,data:{}},t};t.default=f},67388:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=l(n(45697)),i=l(n(4754)),s=l(n(94184)),o=n(53556);function l(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t{this.container=e}},this.props.children)}}o.propTypes={children:i.default.any,className:i.default.string,onClickOut:i.default.func.isRequired},o.defaultProps={className:""};var l=o;t.default=l},65963:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=s(n(23296)),i=s(n(45697));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;ta.default.createElement(r.default,l({key:t,className:t?"":"message-box--panel-top"},e)))):null}render(){const e=!1!==this.props.valid,t=this.props.mapFieldsToComponents(this.props.fields),n=this.props.mapActionsToComponents(this.props.actions),r=this.renderMessages(),i=this.props.formTag,s=["form"];!1===e&&s.push("form--invalid"),this.props.attributes&&this.props.attributes.className&&s.push(this.props.attributes.className);const o={...this.props.attributes,onSubmit:this.props.handleSubmit,className:s.join(" ")};return a.default.createElement(i,l({},o,{ref:e=>{this.form=e,this.props.setDOM(e)},role:"form"}),t&&a.default.createElement("fieldset",this.props.fieldHolder,r,this.props.afterMessages,t),n&&n.length?a.default.createElement("div",this.props.actionHolder,n):null)}}t.Component=d,d.propTypes={autoFocus:i.default.bool,setDOM:i.default.func,valid:i.default.bool,actions:i.default.array,fieldHolder:i.default.shape({className:i.default.string}),actionHolder:i.default.shape({className:i.default.string}),extraClass:i.default.string,afterMessages:i.default.node,attributes:i.default.shape({action:i.default.string.isRequired,className:i.default.string,encType:i.default.string,id:i.default.string,method:i.default.string.isRequired}),fields:i.default.array.isRequired,handleSubmit:i.default.func,mapActionsToComponents:i.default.func.isRequired,mapFieldsToComponents:i.default.func.isRequired,messages:i.default.arrayOf(i.default.shape({extraClass:i.default.string,value:i.default.any,type:i.default.string})),formTag:i.default.oneOfType([i.default.func,i.default.string])},d.defaultProps={setDOM:()=>null,formTag:"form",actionHolder:{className:"btn-toolbar"}};var u=d;t.default=u},430:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={CSRF_HEADER:"X-SecurityID"}},59644:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=o(n(10259)),i=o(n(94184)),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class d extends a.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this)}getButtonProps(){const{attributes:e,id:t,name:n}=this.props;return{...void 0===e?{}:e,id:t,name:n,className:this.getButtonClasses(),disabled:this.isDisabled(),onClick:this.handleClick}}getButtonClasses(){const{title:e,loading:t,extraClass:n}=this.props,a={btn:!0,"btn--no-text":"string"!=typeof e,"btn--loading":t,disabled:this.isDisabled()},r=this.getButtonStyle();r&&(a[`btn-${r}`]=!0);const s=this.getIcon();return s&&(a[`font-icon-${s}`]=!0),"string"==typeof n&&(a[n]=!0),(0,i.default)(a)}getButtonStyle(){if(void 0!==this.props.data.buttonStyle)return this.props.data.buttonStyle;if(void 0!==this.props.buttonStyle)return this.props.buttonStyle;return this.props.extraClass.split(" ").find((e=>e.indexOf("btn-")>-1))?null:this.isPrimary()?"primary":"secondary"}getIcon(){return this.props.icon||this.props.data.icon||null}getLoadingIcon(){return this.props.loading?a.default.createElement("div",{className:"btn__loading-icon"},a.default.createElement("span",{className:"btn__circle btn__circle--1"}),a.default.createElement("span",{className:"btn__circle btn__circle--2"}),a.default.createElement("span",{className:"btn__circle btn__circle--3"})):null}isDisabled(){const{disabled:e,readOnly:t}=this.props;return e||t}isPrimary(){const{extraClass:e,name:t}=this.props,n=e.split(" ");return"action_save"===t||!!n.find((e=>"ss-ui-action-constructive"===e))}handleClick(e){"function"==typeof this.props.onClick&&this.props.onClick(e,this.props.name||this.props.id)}render(){const{title:e}=this.props;return a.default.createElement("button",this.getButtonProps(),this.getLoadingIcon(),(0,r.default)("span",e,{className:"btn__title"}))}}d.propTypes={id:s.default.string,name:s.default.string,onClick:s.default.func,title:s.default.string,type:s.default.string,loading:s.default.bool,icon:s.default.string,disabled:s.default.bool,readOnly:s.default.bool,data:s.default.oneOfType([s.default.array,s.default.shape({buttonStyle:s.default.string})]),extraClass:s.default.string,attributes:s.default.object},d.defaultProps={title:"",icon:"",extraClass:"",attributes:{},data:{},disabled:!1,readOnly:!1};var u=d;t.default=u},23296:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=n(53556),i=l(n(10259)),s=l(n(94184)),o=l(n(45697));function l(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}class u extends a.Component{constructor(e){super(e),this.handleClosed=this.handleClosed.bind(this),this.state={visible:!0}}getMessageStyle(){switch(this.props.type){case"good":case"success":return"success";case"info":return"info";case"warn":case"warning":return"warning";default:return"danger"}}getMessageProps(){const e=this.props.type||"no-type";return{className:(0,s.default)(["message-box",`message-box--${e}`,this.props.className,this.props.extraClass]),color:this.getMessageStyle(),toggle:this.props.closeLabel?this.handleClosed:null,isOpen:!this.props.closeLabel||this.state.visible}}handleClosed(){"function"==typeof this.props.onClosed?this.props.onClosed():this.setState({visible:!1})}render(){if("boolean"!=typeof this.props.visible&&this.state.visible||this.props.visible){const e=(0,i.default)("div",this.props.value);if(e)return a.default.createElement(r.Alert,this.getMessageProps(),e)}return null}}u.propTypes={extraClass:o.default.string,value:o.default.any,type:o.default.string,onClosed:o.default.func,closeLabel:o.default.string,visible:o.default.bool},u.defaultProps={extraClass:"",className:""};var c=u;t.default=c},56334:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.schemaPropType=t.default=t.basePropTypes=t.Component=void 0;var a=f(n(67294)),r=u(n(45697)),i=u(n(21965)),s=f(n(48834)),o=n(48942),l=u(n(1591)),d=n(54582);function u(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function f(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,n&&n.set(e,a),a}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;tthis.context.injector.get(e,`${n}.${t}`);switch(e){case"Integer":case"Decimal":return a("NumberField");case"String":case"Text":return a("TextField");case"Date":return a("DateField");case"Time":return a("TimeField");case"Datetime":return a("DatetimeField");case"Hidden":return a("HiddenField");case"SingleSelect":return a("SingleSelectField");case"Custom":return a("GridField");case"Structural":return a("CompositeField");case"Boolean":return a("CheckboxField");case"MultiSelect":return a("CheckboxSetField");default:return null}}validateForm(e){if("function"==typeof this.props.validate)return this.props.validate(e);if(!(this.props.schema&&this.props.schema.schema))return{};const t=this.context.injector.validate(this.props.identifier);let n={};return t&&(n=t(e,this.props.schema.schema)||{}),(0,o.createErrorBlock)(n)}buildComponent(e){const t=e.input||{},n={...e,...e.input,onChange:t.onChange?(e,n)=>{t.onChange(n?n.value:e)}:null};delete n.input;const r=this.getComponent(n);if(null===r)return null;if(null!==n.schemaComponent&&void 0===r)throw Error(`Component not found in injector: ${n.schemaComponent}`);const i=this.props.createFn;return"function"==typeof i?i(r,n):a.default.createElement(r,p({key:n.id},n))}mapFieldsToComponents(e){const t=this.props.baseFieldComponent;return e.map((e=>{let n=e;return e.children&&(n=Object.assign({},e,{children:this.mapFieldsToComponents(e.children)})),n=Object.assign({onAutofill:this.props.onAutofill,formid:this.props.form},n),"Structural"===e.schemaType||!0===e.readOnly?this.buildComponent(n):a.default.createElement(t,p({key:n.id},n,{component:this.buildComponent}))}))}handleAction(e){"function"==typeof this.props.onAction&&this.props.onAction(e,this.props.values),e.isPropagationStopped()||this.setState({submittingAction:e.currentTarget.name})}handleSubmit(e){let t="";this.state.submittingAction?t=this.state.submittingAction:this.props.schema.schema.actions[0]&&(t=this.props.schema.schema.actions[0].name);const n=Object.assign({},e,t?{[t]:1}:{}),a={"X-Formschema-Request":this.props.responseRequestedSchema.join(),"X-Requested-With":"XMLHttpRequest"},r=e=>this.submitApi(e||n,a).then((e=>(this.setState({submittingAction:null}),e))).catch((e=>{throw this.setState({submittingAction:null}),e}));return"function"==typeof this.props.onSubmit?this.props.onSubmit(n,t,r):r()}mapActionsToComponents(e){return e.map((e=>{const t=Object.assign({},e);return e.children?t.children=this.mapActionsToComponents(e.children):(t.onClick=this.handleAction,this.props.submitting&&this.state.submittingAction===e.name&&(t.loading=!0)),this.buildComponent(t)}))}normalizeFields(e,t){return e.map((e=>{const n=t&&t.fields?t.fields.find((t=>t.id===e.id)):{},a=i.default.recursive(!0,(0,s.schemaMerge)(e,n),{schemaComponent:n&&n.component?n.component:e.component});return e.children&&(a.children=this.normalizeFields(e.children,t)),a}))}render(){const e=this.props.schema.schema,t=this.props.schema.state,n=this.props.baseFormComponent,r={...e.attributes,className:e.attributes.class,encType:e.attributes.enctype,noValidate:!0};delete r.class,delete r.enctype;const{asyncValidate:i,fieldHolder:o,actionHolder:l,onSubmitFail:d,onSubmitSuccess:u,shouldAsyncValidate:c,touchOnBlur:f,touchOnChange:p,persistentSubmitErrors:h,form:m,afterMessages:g,autoFocus:v,formTag:b}=this.props,_={form:m,afterMessages:g,fields:this.normalizeFields(e.fields,t),fieldHolder:o,actions:this.normalizeFields(e.actions,t),actionHolder:l,attributes:r,data:e.data,initialValues:(0,s.default)(e,t),onSubmit:this.handleSubmit,valid:t&&t.valid,messages:t&&Array.isArray(t.messages)?t.messages:[],mapActionsToComponents:this.mapActionsToComponents,mapFieldsToComponents:this.mapFieldsToComponents,asyncValidate:i,onSubmitFail:d,onSubmitSuccess:u,shouldAsyncValidate:c,touchOnBlur:f,touchOnChange:p,persistentSubmitErrors:h,validate:this.validateForm,autoFocus:v,setDOM:e=>{this.formDOM=e},formTag:b};return a.default.createElement(n,_)}}t.Component=h;const m=r.default.shape({id:r.default.string,schema:r.default.shape({attributes:r.default.shape({class:r.default.string,enctype:r.default.string}),fields:r.default.array.isRequired}),state:r.default.shape({fields:r.default.array}),loading:r.default.bool,stateOverride:r.default.shape({fields:r.default.array})});t.schemaPropType=m;const g={createFn:r.default.func,onSubmit:r.default.func,onAction:r.default.func,asyncValidate:r.default.func,onSubmitFail:r.default.func,onSubmitSuccess:r.default.func,shouldAsyncValidate:r.default.func,touchOnBlur:r.default.bool,touchOnChange:r.default.bool,persistentSubmitErrors:r.default.bool,validate:r.default.func,values:r.default.object,submitting:r.default.bool,baseFormComponent:r.default.elementType.isRequired,baseFieldComponent:r.default.elementType.isRequired,getCustomFields:r.default.func,responseRequestedSchema:r.default.arrayOf(r.default.oneOf(["schema","state","errors","auto"])),identifier(e,t,n){return/^[A-Za-z0-9_.]+$/.test(e[t])?null:new Error(`\n Invalid identifier supplied to ${n}. Must be a set of\n dot-separated alphanumeric strings.\n `)}};t.basePropTypes=g,h.propTypes=Object.assign({},g,{form:r.default.string.isRequired,schema:m.isRequired,autoFocus:r.default.bool}),h.defaultProps={responseRequestedSchema:["auto"],autoFocus:!1};var v=(0,d.withInjector)(h);t.default=v},48297:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=u(n(4754)),i=n(53556),s=u(n(16304)),o=u(n(10259)),l=u(n(94184)),d=u(n(45697));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}const f=()=>null;class p extends a.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),this.handleHide=this.handleHide.bind(this),this.clearResponse=this.clearResponse.bind(this),this.handleLoadingError=this.handleLoadingError.bind(this)}getForm(){return this.props.schemaUrl?a.default.createElement(s.default,{fieldHolder:{className:(0,l.default)("modal-body",this.props.bodyClassName)},actionHolder:{className:"modal-footer"},autoFocus:this.props.autoFocus,schemaUrl:this.props.schemaUrl,onSubmit:this.handleSubmit,onAction:this.props.onAction,onLoadingError:this.handleLoadingError,identifier:this.props.identifier}):null}getResponse(){if(!this.state||!this.state.response)return null;let e="";return e=this.state.error?this.props.responseClassBad:this.props.responseClassGood,a.default.createElement("div",{className:e},(0,o.default)("span",{html:this.state.response}))}clearResponse(){this.setState({response:null})}handleLoadingError(e){const t=this.props.onLoadingError!==f;if(this.props.showErrorMessage||!t){const t=e.errors&&e.errors[0];this.setState({response:t.value,error:!0})}t&&this.props.onLoadingError(e)}handleHide(){this.clearResponse(),"function"==typeof this.props.onClosed&&this.props.onClosed()}handleSubmit(e,t,n){this.clearResponse();let a=null;if(a="function"==typeof this.props.onSubmit?this.props.onSubmit(e,t,n):n(),!a)throw new Error("Promise was not returned for submitting");return a.then((e=>(e&&this.setState({response:e.message,error:!1}),e))).catch((e=>{e.then((e=>{this.setState({response:e,error:!0})}))})),a}renderHeader(){let{title:e}=this.props;if(!1!==e){if("object"==typeof e){e=(new DOMParser).parseFromString(e.html,"text/html").body.textContent||""}return a.default.createElement(i.ModalHeader,{toggle:this.handleHide},e)}return!0===this.props.showCloseButton&&"function"==typeof this.props.onClosed?a.default.createElement("button",{type:"button",className:"close modal__close-button",onClick:this.handleHide,"aria-label":r.default._t("Admin.CLOSE","Close")}):null}render(){const e=this.getForm(),t=this.getResponse();return a.default.createElement(i.Modal,{isOpen:this.props.isOpen,toggle:this.handleHide,className:this.props.className,modalClassName:this.props.modalClassName,size:this.props.size},this.renderHeader(),t,e,this.props.children)}}p.propTypes={autoFocus:d.default.bool,isOpen:d.default.bool,title:d.default.oneOfType([d.default.string,d.default.bool,d.default.shape({html:d.default.string})]),className:d.default.string,bodyClassName:d.default.string,modalClassName:d.default.string,showCloseButton:d.default.bool,size:d.default.string,onClosed:d.default.func,schemaUrl:d.default.string,onSubmit:d.default.func,onAction:d.default.func,responseClassGood:d.default.string,responseClassBad:d.default.string,identifier:d.default.string,showErrorMessage:d.default.bool,onLoadingError:d.default.func},p.defaultProps={showErrorMessage:!1,showCloseButton:!0,onLoadingError:f,isOpen:!1,title:null,modalClassName:"form-builder-modal",responseClassGood:"alert alert-success",responseClassBad:"alert alert-danger"};var h=p;t.default=h},88940:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=_(n(67294)),r=v(n(4754)),i=n(14890),s=n(86706),o=v(n(59746)),l=v(n(73542)),d=v(n(84002)),u=v(n(58227)),c=v(n(18052)),f=v(n(13527)),p=v(n(430)),h=_(n(30772)),m=v(n(10259)),g=v(n(45697));function v(e){return e&&e.__esModule?e:{default:e}}function b(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(b=function(e){return e?n:t})(e)}function _(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=b(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,n&&n.set(e,a),a}const y=[];class w extends a.Component{constructor(e){super(e),this.deleteRecord=this.deleteRecord.bind(this),this.editRecord=this.editRecord.bind(this)}componentDidMount(){const e=this.props.data;this.props.actions.fetchRecords(e.recordType,e.collectionReadEndpoint.method,e.collectionReadEndpoint.url)}createRowActions(e){return a.default.createElement(c.default,{className:"grid-field__cell--actions",key:"Actions"},a.default.createElement(f.default,{icon:"cog",onClick:this.editRecord,record:e}),a.default.createElement(f.default,{icon:"cancel",onClick:this.deleteRecord,record:e}))}createCell(e,t){const n=this.props.data.onDrillDown,a={className:n?"grid-field__cell--drillable":"",onDrillDown:n?t=>n(t,e):null,key:`${t.name}`,width:t.width},r=t.field.split(".").reduce(((e,t)=>e[t]),e);return(0,m.default)(c.default,r,a)}createRow(e){const t={className:this.props.data.onDrillDown?"grid-field__row--drillable":"",key:`${e.ID}`},n=this.props.data.columns.map((t=>this.createCell(e,t))),r=this.createRowActions(e);return a.default.createElement(u.default,t,n,r)}deleteRecord(e,t){e.preventDefault();const n={};n[p.default.CSRF_HEADER]=this.props.config.SecurityID,confirm(r.default._t("CampaignAdmin.DELETECAMPAIGN","Are you sure you want to delete this record?"))&&this.props.actions.deleteRecord(this.props.data.recordType,t,this.props.data.itemDeleteEndpoint.method,this.props.data.itemDeleteEndpoint.url,n)}editRecord(e,t){e.preventDefault(),this.props.data&&"function"==typeof this.props.data.onEditRecord&&this.props.data.onEditRecord(e,t)}render(){if(this.props.records===y)return a.default.createElement("div",null,r.default._t("CampaignAdmin.LOADING","Loading..."));if(!this.props.records.length)return a.default.createElement("div",null,r.default._t("CampaignAdmin.NO_RECORDS","No campaigns created yet."));const e=a.default.createElement("th",{key:"holder",className:"grid-field__action-placeholder"}),t=this.props.data.columns.map((e=>a.default.createElement(d.default,{key:e.name},e.name))),n=a.default.createElement(l.default,null,t.concat(e)),i=this.props.records.map((e=>this.createRow(e)));return a.default.createElement(o.default,{header:n,rows:i})}}w.propTypes={data:g.default.shape({recordType:g.default.string.isRequired,headerColumns:g.default.array,collectionReadEndpoint:g.default.object,onDrillDown:g.default.func,onEditRecord:g.default.func})};var O=(0,s.connect)((function(e,t){const n=t.data&&t.data.recordType;return{config:e.config,records:n&&e.records[n]?e.records[n]:y}}),(function(e){return{actions:(0,i.bindActionCreators)(h,e)}}))(w);t.default=O},13527:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(a,i,o):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),i=(a=n(45697))&&a.__esModule?a:{default:a};function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}class o extends r.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this)}handleClick(e){this.props.onClick(e,this.props.record.ID)}render(){return r.default.createElement("button",{className:`grid-field__icon-action font-icon-${this.props.icon} btn--icon-lg`,onClick:this.handleClick})}}o.propTypes={onClick:i.default.func.isRequired};var l=o;t.default=l},18052:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=s(n(94184)),i=s(n(45697));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;ta.default.createElement(r.default,null,e.children);t.default=s},84002:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(67294))&&a.__esModule?a:{default:a};var i=e=>r.default.createElement("th",null,e.children);t.default=i},58227:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(67294))&&a.__esModule?a:{default:a};var i=e=>{const t=`grid-field__row ${e.className}`;return r.default.createElement("tr",{tabIndex:0,className:t},e.children)};t.default=i},59746:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(a,i,o):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),i=(a=n(45697))&&a.__esModule?a:{default:a};function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}class o extends r.Component{generateHeader(){return void 0!==this.props.header?this.props.header:(this.props.data,null)}generateRows(){return void 0!==this.props.rows?this.props.rows:(this.props.data,null)}render(){return r.default.createElement("div",{className:"grid-field"},r.default.createElement("table",{className:"table table-hover grid-field__table"},r.default.createElement("thead",null,this.generateHeader()),r.default.createElement("tbody",null,this.generateRows())))}}o.propTypes={data:i.default.object,header:i.default.object,rows:i.default.array};var l=o;t.default=l},71375:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=n(53556),i=d(n(86010)),s=d(n(95393)),o=d(n(94184)),l=d(n(45697));function d(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class c extends a.PureComponent{renderMultipleActions(e){const t=e.reduce(((e,t)=>{const n=e,a=t.group;if(!a)throw new Error(`Action: "${t.title}" has no group assigned`);return n[a]||(n[a]=[]),n[a].push(t),n}),[]);return a.default.createElement(s.default,{dropdownMenuProps:{right:!0},dropdownToggleClassNames:["action-menu__toggle","btn","btn--no-text","btn-sm","font-icon-dot-3"]},Object.keys(t).map(((e,n)=>[0!==n&&a.default.createElement(r.DropdownItem,{divider:!0,key:e}),t[e].map(((e,t)=>a.default.createElement(i.default,{data:e.data,title:e.title,type:e.type,url:e.url,key:t})))])))}renderSingleAction(e){const{type:t,title:n,data:i}=e;let s,{url:l}=e;"submit"===t&&(s="submit",l=void 0);const d=(0,o.default)("action",i.classNames);return a.default.createElement(r.Button,{className:d,type:s,href:l,"data-url":i["data-url"],"data-action-state":i["data-action-state"],name:i.name,color:"secondary"},n)}render(){const{schema:e}=this.props;return e.length>1?this.renderMultipleActions(e):1===e.length?this.renderSingleAction(e[0]):null}}const f=i.default.propTypes;f.group=l.default.string,c.propTypes=l.default.arrayOf(l.default.shape(f)).isRequired;var p=c;t.default=p},86010:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=n(53556),i=o(n(94184)),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class d extends a.PureComponent{render(){const{type:e,title:t,data:n}=this.props;let{url:s}=this.props;const o=(0,i.default)("action",n.classNames);let l=null;switch(e){case"submit":case"button":l="button",s=void 0;break;case"link":l="a";break;default:l=void 0}return a.default.createElement(r.DropdownItem,{className:o,href:s,tag:l,type:"button"===l?"button":void 0,"data-url":n["data-url"],"data-action-state":n["data-action-state"],name:n.name},t)}}d.propTypes={data:s.default.object,title:s.default.string.isRequired,type:s.default.oneOf(["submit","link"]),url:s.default.string};var u=d;t.default=u},65732:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=s(n(67294)),r=s(n(45697)),i=s(n(94184));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){let{className:t,extraClass:n,id:r,data:{headingLevel:s,title:o}}=e;const l=`h${s||3}`;return a.default.createElement("div",{className:"field"},a.default.createElement(l,{className:(0,i.default)(t,n),id:r},o))}o.propTypes={className:r.default.string,extraClass:r.default.string,id:r.default.string,data:r.default.oneOfType([r.default.array,r.default.shape({headingLevel:r.default.number,title:r.default.string})]).isRequired},o.defaultProps={className:"",extraClass:""};var l=o;t.default=l},19423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=n(53556),i=o(n(94184)),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class d extends a.Component{getInputProps(){return{className:(0,i.default)(this.props.className,this.props.extraClass),id:this.props.id,name:this.props.name,type:"hidden",value:this.props.value||""}}render(){return a.default.createElement(r.Input,this.getInputProps())}}d.propTypes={id:s.default.string,extraClass:s.default.string,name:s.default.string.isRequired,value:s.default.any},d.defaultProps={className:"",extraClass:"",value:""};var u=d;t.default=u},1922:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=o(n(67294)),r=o(n(69227)),i=n(74898),s=o(n(98028));function o(e){return e&&e.__esModule?e:{default:e}}n(51726);class l extends i.Component{constructor(e){super(e),this.state={isReady:!e.data.editorjs},this.inputRef=null,this.handleReady=this.handleReady.bind(this)}getInputProps(){return{...super.getInputProps(),...this.props.data.attributes,innerRef:e=>{this.inputRef=e}}}getEditorElement(){return document.getElementById(this.getInputProps().id)}getEditor(){return window.TinyMCE&&window.TinyMCE.get(this.getInputProps().id)}handleReady(){!window.TinyMCE&&window.tinymce&&(window.TinyMCE=window.tinymce),this.setState({isReady:!0})}registerChangeListener(){const e=this.getEditorElement();this.getEditor().on("change keyup setcontent",(()=>{super.handleChange({target:e})}))}renderDependencyScript(){return a.default.createElement(r.default,{url:this.props.data.editorjs,onLoad:this.handleReady})}render(){return this.state.isReady?super.render():this.renderDependencyScript()}componentDidUpdate(e,t){const{isReady:n}=this.state;if(!n)return;n!==t.isReady&&setTimeout((()=>{const{document:e,jQuery:t}=window,n=t.Event("EntwineElementsAdded"),a=this.getEditorElement();n.targets=[a],t(e).triggerHandler(n),this.registerChangeListener()}),1);const{value:a}=this.props;if(a!==e.value){const e=new Event("change",{bubbles:!0});e.simulated=!0,e.value=a,this.inputRef.dispatchEvent(e)}}componentWillUnmount(){if(!this.state.isReady)return;const{document:e,jQuery:t}=window,n=t.Event("EntwineElementsRemoved"),a=this.getEditorElement(),r=this.getEditor();r&&r.save(),n.targets=[a],super.handleChange({target:a}),t(e).triggerHandler(n)}}t.Component=l;var d=(0,s.default)(l);t.default=d},618:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=o(n(98028)),i=n(53556),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{id:t,className:n,title:r,extraClass:i,data:s}=e;const o=s&&s.target,l=`${n} ${i}`;return a.default.createElement("label",{id:t,className:l,htmlFor:o},r)};s.propTypes={id:r.default.number,className:r.default.string,extraClass:r.default.string,title:r.default.node,data:r.default.shape({target:r.default.string})},s.defaultProps={className:"",extraClass:""};var o=s;t.default=o},5257:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=s(n(67294)),r=s(n(45697)),i=n(79655);function s(e){return e&&e.__esModule?e:{default:e}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;ta.default.createElement("div",{className:"list-group"},e.items.map((e=>a.default.createElement(r.default,e))));o.propTypes={items:i.default.array};var l=o;t.default=l},12906:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(a,i,o):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),i=(a=n(45697))&&a.__esModule?a:{default:a};function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}class o extends r.Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this)}handleClick(e){this.props.onClick&&this.props.onClick(e,this.props.onClickArg)}render(){const e=`list-group-item ${this.props.className}`;return r.default.createElement("a",{role:"button",tabIndex:0,className:e,onClick:this.handleClick},this.props.children)}}o.propTypes={onClickArg:i.default.any,onClick:i.default.func};var l=o;t.default=l},7162:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(a,i,o):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),i=(a=n(45697))&&a.__esModule?a:{default:a};function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;tt.value===e));return t?t.title:""}return e&&e.length?e.map((e=>{const t=this.props.source.find((t=>t.value===e));return t&&t.title})).filter((e=>`${e}`.length)).join(", "):""}getFieldProps(){return{id:this.props.id,name:this.props.name,className:`${this.props.className} ${this.props.extraClass}`}}render(){if(!this.props.source)return null;const e=`('${s.default._t("Admin.NONE","None")}')`,t=this.getValueCSV()||e;return a.default.createElement(r.Input,u({plaintext:!0},this.getFieldProps(),{tag:"p"}),t)}}t.Component=c,c.propTypes={extraClass:o.default.string,id:o.default.string,name:o.default.string.isRequired,source:o.default.arrayOf(o.default.shape({value:o.default.oneOfType([o.default.string,o.default.number]),title:o.default.any,disabled:o.default.bool})),value:o.default.any},c.defaultProps={extraClass:"",className:"",value:[]};var f=(0,i.default)(c);t.default=f},86827:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=s(n(94184)),i=s(n(45697));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}class l extends a.Component{constructor(){super(),this.handleClick=this.handleClick.bind(this)}handleClick(e){e.preventDefault(),"function"==typeof this.props.onClick&&this.props.onClick(e)}render(){const e=(0,r.default)({"cms-mobile-menu-toggle":!0,"cms-mobile-menu-toggle--open":this.props.isOpen});return a.default.createElement("button",{type:"button",className:e,href:"#toggle-mobile-menu",onClick:this.handleClick,"aria-controls":this.props.controls,"aria-expanded":Boolean(this.props.isOpen)},a.default.createElement("span",null),a.default.createElement("span",null),a.default.createElement("span",null),a.default.createElement("span",null))}}l.propTypes={isOpen:i.default.bool.isRequired,onClick:i.default.func.isRequired,controls:i.default.string},l.defaultProps={controls:""};var d=l;t.default=d},26195:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=n(11521),i=n(86706),s=(a=n(86827))&&a.__esModule?a:{default:a};var o=(0,i.connect)((e=>({isOpen:e.mobileMenu.isOpen})),(e=>({onClick(){e((0,r.toggleMobileMenu)())}})))(s.default);t.default=o},55742:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=l(n(67294)),r=l(n(4754)),i=l(n(94184)),s=l(n(23296)),o=l(n(45697));function l(e){return e&&e.__esModule?e:{default:e}}const d=e=>{let{itemName:t,name:n,value:o}=e;return a.default.createElement("div",{className:(0,i.default)(t,"not-found-component")},a.default.createElement(s.default,{value:r.default.inject(r.default._t("Admin.NOT_FOUND_COMPONENT","The component here ({component}) failed to load, there is a chance that you may lose data when saving due to this."),{component:t})}),n&&"string"==typeof o?a.default.createElement("input",{type:"hidden",name:n,value:o}):null)};d.propTypes={itemName:o.default.string.isRequired,name:o.default.string,value:o.default.any};var u=d;t.default=u},92227:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=i(n(98028)),r=i(n(16725));function i(e){return e&&e.__esModule?e:{default:e}}class s extends r.default{getInputProps(){const e=super.getInputProps();return Object.assign(e,{type:"number"}),e}}t.Component=s;var o=(0,a.default)(s);t.default=o},31885:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=n(53556),i=l(n(94184)),s=l(n(10259)),o=l(n(45697));function l(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}class u extends a.Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}getInputProps(){const e=(0,i.default)({[this.props.className]:!0,[this.props.extraClass]:!0,"form-check":!0,checked:this.props.value,disabled:this.props.readOnly,"option-field--disabled":this.props.readOnly||this.props.disabled});return{id:this.props.id,type:this.props.type,name:this.props.name,disabled:this.props.disabled||this.props.readOnly,readOnly:this.props.readOnly,className:e,onChange:this.handleChange,checked:!!this.props.value,value:1}}handleChange(e){if(this.props.readOnly||this.props.disabled)return void e.preventDefault();let t=null;"function"==typeof this.props.onChange?t=this.props.onChange:"function"==typeof this.props.onClick&&(t=this.props.onClick),t&&t(e,{id:this.props.id,value:e.target.checked?1:0})}render(){const e=null!==this.props.leftTitle?this.props.leftTitle:this.props.title,t=null!==this.props.rightTitle?`${e} ${this.props.rightTitle}`:e;return a.default.createElement(r.FormGroup,{check:!0},a.default.createElement(r.Label,{check:!0},a.default.createElement(r.Input,this.getInputProps()),(0,s.default)("span",t)))}}t.Component=u,u.propTypes={type:o.default.oneOf(["checkbox","radio"]),leftTitle:o.default.any,rightTitle:o.default.any,title:o.default.any,extraClass:o.default.string,id:o.default.string,name:o.default.string,onChange:o.default.func,value:o.default.oneOfType([o.default.string,o.default.number,o.default.bool]),readOnly:o.default.bool,disabled:o.default.bool},u.defaultProps={extraClass:"",className:"",type:"radio",leftTitle:null,rightTitle:null};var c=u;t.default=c},5110:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=o(n(31885)),i=o(n(98028)),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;tthis.getItemKey(e,n)===t.id));this.props.onChange(e,{id:this.props.id,value:n.value})}}render(){return this.props.source?a.default.createElement("div",null,this.props.source.map(((e,t)=>a.default.createElement(r.default,d({},this.getOptionProps(e,t),{hideLabels:!0}))))):null}}t.Component=u,u.propTypes={extraClass:s.default.string,itemClass:s.default.string,id:s.default.string,name:s.default.string.isRequired,source:s.default.arrayOf(s.default.shape({value:s.default.oneOfType([s.default.string,s.default.number]),title:s.default.oneOfType([s.default.string,s.default.number]),disabled:s.default.bool})),onChange:s.default.func,value:s.default.oneOfType([s.default.string,s.default.number]),readOnly:s.default.bool,disabled:s.default.bool},u.defaultProps={extraClass:"",className:"",itemClass:""};var c=(0,i.default)(u);t.default=c},20693:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=n(53556),i=o(n(94184)),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}class d extends a.Component{constructor(e){super(e),this.toggle=this.toggle.bind(this),this.state={isOpen:!1}}getPlacement(){return this.props.data.placement||"bottom"}getContainer(){return this.props.container?this.props.container:this.wrapper}toggle(){const{toggleCallback:e}=this.props;window.setTimeout((()=>this.setState({isOpen:!this.state.isOpen},e)),0)}render(){const e=this.getPlacement(),t=(0,i.default)({btn:!0,"btn-secondary":!0,[this.props.className]:!0,[this.props.buttonClassName]:!0,"btn--no-focus":this.state.isOpen,"font-icon-dot-3 btn--no-text":!this.props.title,[`btn--icon-${this.props.buttonSize}`]:!this.props.title}),n={id:this.props.id,type:"button",className:t,onClick:this.toggle,title:this.props.data.buttonTooltip},s=(0,i.default)({[this.props.className]:!0,"popover-container":!0,"popover-field":!0});return a.default.createElement("div",{className:s,ref:e=>{this.wrapper=e}},a.default.createElement(r.Button,n,this.props.title),a.default.createElement(r.Popover,{id:`${this.props.id}_Popover`,placement:e,isOpen:this.state.isOpen,target:this.props.id,toggle:this.toggle,className:this.props.popoverClassName,container:this.getContainer()},a.default.createElement(r.PopoverHeader,null,this.props.data.popoverTitle),a.default.createElement(r.PopoverBody,null,this.props.children)))}}d.propTypes={id:s.default.string.isRequired,title:s.default.any,container:s.default.any,className:s.default.string,buttonClassName:s.default.string,popoverClassName:s.default.string,buttonSize:s.default.oneOf(["sm","md","large","xl"]),data:s.default.oneOfType([s.default.array,s.default.shape({popoverTitle:s.default.string,buttonTooltip:s.default.string,placement:s.default.oneOf(["top","bottom","left","right"])})]),toggleCallback:s.default.func},d.defaultProps={data:{},className:"",buttonClassName:"",popoverClassName:"",buttonSize:"xl",toggleCallback:()=>{}};var u=d;t.default=u},71255:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=l(n(45697)),i=n(53556),s=l(n(94184)),o=l(n(4754));function l(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;ta.default.createElement(l,u({},e.buttonProps,{className:(0,s.default)(e.className,i),key:e.key,onClick:e.onClick}),e.content))))}render(){const{container:e,className:t,isOpen:n,placement:r,target:o}=this.props;return a.default.createElement(i.Popover,{className:(0,s.default)(t),container:e,hideArrow:!0,isOpen:n,onKeyDown:this.handleKeyDown,placement:r,target:o,toggle:this.handleToggle,trigger:"legacy"},this.renderSearchBox(),this.renderOptionButtons())}}c.propTypes={buttons:r.default.arrayOf(r.default.shape({key:r.default.string.isRequired,content:r.default.node.isRequired,onClick:r.default.func.isRequired,className:r.default.oneOfType([r.default.string,r.default.object,r.default.arrayOf(r.default.string)]),buttonProps:r.default.object})).isRequired,onSearch:r.default.func,container:r.default.oneOfType([r.default.string,r.default.elementType]),isOpen:r.default.bool.isRequired,placement:r.default.string,target:r.default.oneOfType([r.default.string,r.default.elementType]).isRequired,toggle:r.default.func.isRequired,searchPlaceholder:r.default.string,disableSearch:r.default.bool,ButtonComponent:r.default.elementType,className:r.default.oneOfType([r.default.string,r.default.array,r.default.object]),searchClassName:r.default.oneOfType([r.default.string,r.default.array,r.default.object]),searchInputClassName:r.default.oneOfType([r.default.string,r.default.array,r.default.object]),clearButtonClassName:r.default.oneOfType([r.default.string,r.default.array,r.default.object]),buttonContainerClassName:r.default.oneOfType([r.default.string,r.default.array,r.default.object]),emptyResultClassName:r.default.oneOfType([r.default.string,r.default.array,r.default.object]),buttonClassName:r.default.oneOfType([r.default.string,r.default.array,r.default.object])},c.defaultProps={searchPlaceholder:o.default._t("PopoverOptionSet.SEARCH_PLACEHOLDER","Search"),onSearch:(e,t)=>t.filter((t=>{let{content:n}=t;return n.toLowerCase().includes(e.toLowerCase())})),disableSearch:!1,ButtonComponent:i.Button,className:"popover-option-set",searchClassName:"popover-option-set__search",searchInputClassName:"popover-option-set__search-input",clearButtonClassName:"popover-option-set__search-clear btn btn-link",buttonContainerClassName:"popover-option-set__button-container",emptyResultClassName:"popover-option-set__no-results",buttonClassName:"popover-option-set__button"};var f=c;t.default=f},3080:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=d(n(4754)),i=d(n(95393)),s=d(n(94184)),o=n(54582),l=d(n(45697));function d(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class c extends a.Component{constructor(e){super(e),this.state={frameLoaded:!1},this.handleBackClick=this.handleBackClick.bind(this),this.setFrameLoaded=this.setFrameLoaded.bind(this)}componentDidUpdate(e){this.state.frameLoaded&&e.previewUrl!==this.props.previewUrl&&this.setFrameLoaded(!1)}setFrameLoaded(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setState({frameLoaded:e})}handleBackClick(e){"function"==typeof this.props.onBack&&(e.preventDefault(),this.props.onBack(e))}buildToolbarButtons(){const e=[];if(this.props.itemLinks&&this.props.itemLinks.edit){const t=this.props.itemLinks.edit.href;e.push(a.default.createElement("a",{key:"edit",href:t,className:"btn btn-outline-secondary font-icon-edit"},a.default.createElement("span",{className:"btn__title"},r.default._t("Admin.EDIT","Edit"))))}return e}renderMoreActions(){return this.props.moreActions&&0!==this.props.moreActions.length?a.default.createElement(i.default,null,this.props.moreActions):null}renderBody(){let e=null,t="";return this.props.itemLinks&&this.props.itemLinks.preview&&(this.props.itemLinks.preview.Stage?(e=this.props.itemLinks.preview.Stage.href,t=this.props.itemLinks.preview.Stage.type):this.props.itemLinks.preview.Live&&(e=this.props.itemLinks.preview.Live.href,t=this.props.itemLinks.preview.Live.type)),this.props.itemId?e?t&&0===t.indexOf("image/")?a.default.createElement("div",{className:"preview__file-container panel--scrollable"},a.default.createElement("img",{alt:e,className:"preview__file--fits-space",src:e})):a.default.createElement("iframe",{style:{visibility:this.state.frameLoaded?"visible":"hidden"},className:"flexbox-area-grow preview__iframe",src:e,onLoad:this.setFrameLoaded}):a.default.createElement("div",{className:"preview__overlay"},a.default.createElement("h3",{className:"preview__overlay-text"},r.default._t("Admin.NO_ITEM_PREVIEW","There is no preview available for this item."))):a.default.createElement("div",{className:"preview__overlay"},a.default.createElement("h3",{className:"preview__overlay-text"},r.default._t("Admin.NO_PREVIEW","No preview available.")))}render(){const{className:e,ViewModeComponent:t}=this.props,n=(0,s.default)("preview",e);return a.default.createElement("div",{className:n},this.renderBody(),a.default.createElement("div",{className:"toolbar toolbar--south"},a.default.createElement("div",{className:"btn-toolbar"},this.buildToolbarButtons(),a.default.createElement(t,{id:"view-mode-toggle-in-preview-nb",area:"preview"}),this.renderMoreActions())))}}t.Component=c,c.propTypes={className:l.default.string,itemLinks:l.default.object,itemId:l.default.number,onBack:l.default.func,moreActions:l.default.arrayOf(l.default.element),ViewModeComponent:l.default.elementType},c.defaultProps={className:"flexbox-area-grow fill-height"};var f=(0,o.inject)(["ViewModeToggle"],(e=>({ViewModeComponent:e})),(()=>"Admin.Preview"))(c);t.default=f},72543:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=n(67294),r=s(n(91033)),i=s(n(45697));function s(e){return e&&e.__esModule?e:{default:e}}class o extends a.Component{constructor(e){super(e),this.render=this.render.bind(this),this.handleResize=this.handleResize.bind(this),this.state={},this.observer=new r.default((e=>e.forEach((e=>{let{contentRect:t}=e;return this.handleResize(t)}))))}componentDidMount(){this.observer.observe(this.container);const e={width:this.container.offsetWidth,height:this.container.offsetHeight};this.handleResize(e)}componentWillUnmount(){this.observer.disconnect()}handleResize(e){const{width:t,height:n}=this.state;t===e.width&&n===e.height||this.setState(e),this.props.onResize&&this.props.onResize(e)}render(){const{children:e,onlyEvent:t,component:n,onResize:r,widthPropName:i,heightPropName:s,...o}=this.props,{width:l,height:d}=this.state,u="string"!=typeof n,c={[[i||"width"]]:l,[[s||"height"]]:d};return(0,a.createElement)(n,{[u?"getRef":"ref"]:e=>{this.container=e},...u&&c,...o},"function"==typeof e?e({width:l,height:d}):a.Children.map(e,(e=>(0,a.isValidElement)(e)?(0,a.cloneElement)(e,t?null:c):e)))}}o.propTypes={component:i.default.oneOfType([i.default.string,i.default.elementType]),onResize:i.default.func},o.defaultProps={component:"div"};var l=o;t.default=l},62266:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0,t.hasFilters=T;var a=w(n(4754)),r=y(n(67294)),i=n(86706),s=w(n(73935)),o=n(14890),l=y(n(39042)),d=n(11962),u=n(35237),c=w(n(79298)),f=w(n(90161)),p=w(n(96869)),h=w(n(31824)),m=w(n(97019)),g=w(n(65693)),v=w(n(18992)),b=w(n(45697));function _(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_=function(e){return e?n:t})(e)}function y(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,n&&n.set(e,a),a}function w(e){return e&&e.__esModule?e:{default:e}}function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t0}class S extends r.Component{constructor(e){super(e),this.expand=this.expand.bind(this),this.handleChange=this.handleChange.bind(this),this.getData=this.getData.bind(this),this.doSearch=this.doSearch.bind(this),this.focusInput=this.focusInput.bind(this),this.focusFirstFormField=this.focusFirstFormField.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.toggle=this.toggle.bind(this),this.open=this.open.bind(this),this.searchTermIsDirty=this.searchTermIsDirty.bind(this),this.clearFilters=this.clearFilters.bind(this),this.clearSearchBox=this.clearSearchBox.bind(this),this.clearFormFilter=this.clearFormFilter.bind(this),this.focusFormFilter=this.focusFormFilter.bind(this),this.formatTagData=this.formatTagData.bind(this);const t=e.term||e.filters&&e.filters[`${e.filterPrefix}${e.name}`]||"";this.state={display:e.display,searchText:t,initialSearchText:t}}componentDidMount(){this.setOverrides(this.props)}componentWillUnmount(){this.setOverrides()}setOverrides(e){if(e&&(!T(e.filters)||this.props.formSchemaUrl!==e.formSchemaUrl)){const t=e&&e.formSchemaUrl||this.props.formSchemaUrl;t&&this.props.actions.schema.setSchemaStateOverrides(t,null)}if(e&&T(e.filters)&&e.formSchemaUrl){const t=e.filters||{},n={fields:Object.keys(t).map((e=>({name:e,value:t[e]})))};this.props.actions.schema.setSchemaStateOverrides(e.formSchemaUrl,n)}}getData(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{name:t,filterPrefix:n,formData:a}=this.props,{searchText:r}=this.state,i={};return Object.keys(a).forEach((e=>{const t=a[e];t&&(i[e]=t)})),!e&&r&&void 0===a[`${n}${t}`]&&(i[`${n}${t}`]=r.trim()),i}handleChange(e){const t=e.target.value;this.state.searchText!==t&&this.setState({searchText:t});const{schemaName:n,name:a,filterPrefix:r,actions:i,formData:s}=this.props;void 0!==s[`${r}${a}`]&&i.reduxForm.change(n,`${r}${a}`,t)}focusInput(){if(this.state.display===E.NONE)return;const e=s.default.findDOMNode(this);if(!e)return;const t=e.querySelector(".search-box__content-field");t!==document.activeElement&&(t.focus(),t.select&&t.select())}focusFirstFormField(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"input, textarea, select, button";if(this.state.display!==E.EXPANDED)return;const t=s.default.findDOMNode(this);if(!t)return;const n=t.querySelector(".search-form");if(!n)return;const a=n.querySelector(e);a&&(a.focus(),a.select&&a.select())}clearFormData(e){""!==this.state.searchText&&this.setState({searchText:""});const t=e&&e.formSchemaUrl||this.props.formSchemaUrl;if(t){const n=e&&e.identifier||this.props.identifier;this.props.actions.schema.setSchemaStateOverrides(t,{fields:[]}),this.props.actions.reduxForm.reset(n)}}clearFormFilter(e){const t=this.props.tagData[e],n={[e]:void 0},{schemaName:a,filters:r}=this.props;this.props.actions.reduxForm.change(a,e,""),this.setOverrides({...this.props,filters:{...r,[e]:void 0}}),Array.isArray(t.linkedFields)&&t.linkedFields.forEach((e=>{n[e]=void 0})),this.doSearch(n)}focusFormFilter(e){const t=this.props.tagData[e].focusSelector||`[name=${e}]`;this.expand(),setTimeout((()=>this.focusFirstFormField(t)),50)}open(){this.show(),this.focusInput()}hide(){this.clearSearchBox(),this.props.onHide?this.props.onHide():this.state.display!==E.NONE&&this.setState({display:E.NONE})}show(){this.state.display!==E.VISIBLE&&this.setState({display:E.VISIBLE});const{schemaName:e,formData:t,name:n,actions:a}=this.props;void 0!==t[n]&&a.reduxForm.change(e,n,this.state.searchText)}expand(){this.state.display!==E.EXPANDED&&this.setState({display:E.EXPANDED})}toggle(){switch(this.state.display){case E.VISIBLE:this.expand(),setTimeout(this.focusFirstFormField,50);break;case E.EXPANDED:this.show()}}searchTermIsDirty(){const{searchText:e,initialSearchText:t}=this.state;return e.trim()!==t.trim()}doSearch(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{name:t,filterPrefix:n}=this.props,a={},r=this.getData();Object.entries(r).forEach((i=>{let[s,o]=i,l=s,d=o;e.hasOwnProperty(s)&&(d=e[s]),n.length>0&&s.startsWith(n)&&(l=s.substring(n.length)),(!n.length>0||s!==t||void 0===r[`${n}${t}`])&&(a[l]=d)}));const i=a[t]||"";this.state.display===E.VISIBLE&&this.state.initialSearchText===i&&this.state.searchText===i||this.setState({display:E.VISIBLE,initialSearchText:i,searchText:i}),this.props.onSearch(a)}clearFilters(){this.clearFormData(),this.focusFirstFormField()}clearSearchBox(){this.clearFormData(),this.focusInput()}formatTagData(){const{tagData:e,name:t,filterPrefix:n}=this.props,a=Object.assign({},e),r=`${n}${t}`;return a&&a[r]&&delete a[r],a?Object.values(a).map((e=>{let{key:t,label:n,value:a}=e;return{key:t,label:n,value:a}})):[]}render(){const{formSchemaUrl:e,forceFilters:t,id:n,displayBehavior:a,identifier:i,formIsDirty:s,tagData:o,name:l,...d}=this.props;if(this.state.display===E.NONE)return a===C.TOGGLABLE?r.default.createElement(g.default,{onToggle:this.show}):r.default.createElement("div",null);const u=`${n}_ExtraFields`,c=this.state.searchText,p=this.state.display===E.EXPANDED,v=this.state.display===E.VISIBLE,b=[C.HIDEABLE,C.TOGGLABLE].includes(a),_=s||this.searchTermIsDirty(),y=this.getData(),w=Object.keys(y).length>0;return r.default.createElement(f.default,{onClickOut:this.show,className:"search"},r.default.createElement(h.default,O({},d,{name:`SearchBox__${l}`,onChange:this.handleChange,onSearch:this.doSearch,onToggleFilter:this.toggle,onHideFilter:this.show,onHide:this.hide,onClear:this.clearSearchBox,searchText:c,hideable:b,expanded:p,id:`${n}_searchbox`,showFilters:Boolean(t||e),dirty:_,clearable:w,onTagDelete:this.clearFormFilter,onTagClick:this.focusFormFilter,tagData:this.formatTagData()}),r.default.createElement(m.default,{id:u,identifier:i,visible:v,expanded:p,formSchemaUrl:e,onSearch:this.doSearch,onClear:this.clearFilters,clearable:w})))}}t.Component=S,S.propTypes={onSearch:b.default.func,onHide:b.default.func,id:b.default.string.isRequired,display:b.default.oneOf(Object.values(E)),formSchemaUrl:b.default.string,filters:b.default.object,formData:b.default.object,placeholder:b.default.string,displayBehavior:b.default.oneOf(Object.values(C)),term:b.default.string,name:b.default.string,filterPrefix:b.default.string,forceFilters:b.default.bool,formIsDirty:b.default.bool,identifier:b.default.string,schemaName:b.default.string,tagHandlers:b.default.object,borders:b.default.shape({top:b.default.bool,right:b.default.bool,bottom:b.default.bool,left:b.default.bool})},S.defaultProps={placeholder:a.default._t("Admin.SEARCH","Search"),display:E.VISIBLE,displayBehavior:C.NONE,filters:{},formData:{},term:"",filterPrefix:"",forceFilters:!1,name:"searchTerm",identifier:"Admin.SearchForm"};var P=(0,i.connect)((function(e,t){const n=e.form.formSchemas[t.formSchemaUrl];if(!n||!n.name)return{formData:{}};const a=n.name,r=(0,c.default)((0,p.default)(e),a),i=r&&r.values||{},s=(0,v.default)(n,t.filters,t.tagHandlers||{});return{formData:i,formIsDirty:(0,u.isDirty)(a,p.default)(e),schemaName:a,tagData:s}}),(function(e){return{actions:{schema:(0,o.bindActionCreators)(l,e),reduxForm:(0,o.bindActionCreators)({reset:d.reset,initialize:d.initialize,change:d.change},e)}}}))(S);t.default=P},31824:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=p(n(4754)),r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),i=n(53556),s=p(n(94184)),o=p(n(43117)),l=p(n(97228)),d=p(n(72543)),u=p(n(73935)),c=p(n(45697));function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}function p(e){return e&&e.__esModule?e:{default:e}}class h extends r.Component{constructor(e){super(e),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.renderInput=this.renderInput.bind(this),this.renderFilterButton=this.renderFilterButton.bind(this),this.renderEnterHint=this.renderEnterHint.bind(this),this.renderHideButton=this.renderHideButton.bind(this),this.componentDidUpdate=this.componentDidUpdate.bind(this),this.onResize=this.onResize.bind(this),this.setWidth=this.setWidth.bind(this),this.renderTags=this.renderTags.bind(this),this.getComponentWidth=this.getComponentWidth.bind(this),this.calculateSpaceForTags=this.calculateSpaceForTags.bind(this),this.calculateInputLeftPadding=this.calculateInputLeftPadding.bind(this),this.calculateInputRightPadding=this.calculateInputRightPadding.bind(this),this.onTagListResize=this.onTagListResize.bind(this),this.focusOnLastTag=this.focusOnLastTag.bind(this),this.focusOnInput=this.focusOnInput.bind(this),this.state={hasFocus:!1,width:window.innerWidth-180-55,tagWidth:0}}componentDidUpdate(){const e=this.getComponentWidth();this.setWidth(e)}onResize(e){this.setWidth(e.width)}onTagListResize(e){const t=e.width;this.state.tagWidth!==t&&this.setState({tagWidth:t})}setWidth(e){this.state.width!==e&&this.setState({width:e})}getComponentWidth(){const e=u.default.findDOMNode(this);return e?e.getBoundingClientRect().width:0}calculateInputLeftPadding(){const e=this.state.width>576?55:20;return this.state.tagWidth+e}calculateInputRightPadding(){return this.state.width<576?121:264}calculateSpaceForTags(){let e=this.state.width;e-=150,e=e-55-52;const{hideable:t,showFilters:n}=this.props;return t&&(e-=52),n&&(e-=52),e=Math.max(e,0),e}handleKeyDown(e){"Enter"===e.key?(e.preventDefault(),this.props.onSearch()):0===e.target.selectionStart&&("ArrowLeft"===e.key||"Backspace"===e.key&&e.target.selectionEnd-e.target.selectionStart==0)&&(e.preventDefault(),this.focusOnLastTag())}handleFocus(){this.state.hasFocus||this.setState({hasFocus:!0}),this.props.onHideFilter&&this.props.onHideFilter()}handleBlur(){this.state.hasFocus&&this.setState({hasFocus:!1})}focusOnLastTag(){const e=u.default.findDOMNode(this);if(!e)return;const t=e.querySelector(".compact-tag-list__visible .tag:last-child");t&&t.focus()}focusOnInput(){const e=u.default.findDOMNode(this);if(!e)return;const t=e.querySelector("input");t&&t.focus()}renderInput(){const{id:e,searchText:t,onChange:n,placeholder:a,name:i,borders:o}=this.props,l={paddingLeft:`${this.calculateInputLeftPadding()}px`,paddingRight:`${this.calculateInputRightPadding()}px`},d=Object.assign({},h.defaultProps.borders,o),u="search-box__content-field",c=(0,s.default)("form-control",u,{[`${u}--top-border`]:d.top,[`${u}--right-border`]:d.right,[`${u}--bottom-border`]:d.bottom,[`${u}--left-border`]:d.left});return r.default.createElement("input",{"aria-labelledby":`${e}_label`,type:"search",name:i,placeholder:a,className:c,onKeyDown:this.handleKeyDown,onChange:n,onFocus:this.handleFocus,onBlur:this.handleBlur,value:t,id:e,autoFocus:!0,style:l})}renderTags(){const{tagData:e,onTagDelete:t,onTagClick:n,onToggleFilter:a}=this.props;return r.default.createElement("div",{className:"search-box__tags"},r.default.createElement(d.default,{onResize:this.onTagListResize},r.default.createElement(l.default,{onTagDelete:t,onTagClick:n,onHolderFocus:this.focusOnInput,tags:e,onSummary:a,maxSize:this.calculateSpaceForTags(),deletable:!0})))}renderEnterHint(){return r.default.createElement("div",{role:"presentation",className:"search-box__enter",onClick:e=>{e.stopPropagation(),e.preventDefault(),this.props.onSearch()}},a.default._t("Admin.ENTER","Enter")," ↵")}renderFilterButton(){const{expanded:e,onToggleFilter:t,formId:n}=this.props,o=(0,s.default)("btn--icon","font-icon-caret-down-two","search-box__filter-trigger",this.state.width<576?"search-box--no-label":"",{collapsed:!e}),l=this.state.width<576?"sr-only":"";return r.default.createElement(i.Button,{"aria-expanded":e,"aria-controls":n,"aria-label":a.default._t("Admin.ADVANCED","Advanced"),onClick:t,className:o,title:a.default._t("Admin.ADVANCED","Advanced")},r.default.createElement("span",{className:l},"Search options"))}renderHideButton(){const{id:e,onHide:t}=this.props;return r.default.createElement(i.Button,{onClick:t,title:a.default._t("Admin.CLOSE","Close"),"aria-label":a.default._t("Admin.CLOSE","Close"),className:"font-icon-cancel btn--no-text btn--icon-lg search-box__cancel","aria-controls":e,"aria-expanded":"true"})}render(){const{children:e,id:t,hideable:n,expanded:o,showFilters:l,dirty:u,clearable:c}=this.props,f=(0,s.default)("search-box",{"search-box--hideable":n,"search-box--not-hideable":!n,"search-box--has-focus":this.state.hasFocus,"search-box--has-not-focus":!this.state.hasFocus,"search-box--has-filters":l,"search-box--has-not-filters":!l,"search-box--compact":this.state.width<576,"search-box--expanded":o}),p=(u||!c)&&this.state.hasFocus;return r.default.createElement("div",{className:f},r.default.createElement(d.default,{onResize:this.onResize},r.default.createElement("div",{className:"search-box__group"},r.default.createElement(i.Label,{for:t,id:`${t}_label`,hidden:!0},a.default._t("Admin.SEARCH","Search")),this.renderTags(),this.renderInput(),p&&this.renderEnterHint(),e,r.default.createElement("div",{className:"icon font-icon-search"}),l&&this.renderFilterButton(),n&&this.renderHideButton())))}}t.Component=h,h.propTypes={onSearch:c.default.func,onToggleFilter:c.default.func,onHideFilter:c.default.func,onChange:c.default.func,onHide:c.default.func,onTagDelete:c.default.func,onTagClick:c.default.func,placeholder:c.default.string,expanded:c.default.bool,formId:c.default.string,id:c.default.string,searchText:c.default.string,hideable:c.default.bool,showFilters:c.default.bool,name:c.default.string,dirty:c.default.bool,clearable:c.default.bool,tagData:c.default.arrayOf(o.default)},h.defaultProps={placeholder:a.default._t("Admin.SEARCH","Search"),tagData:[],filters:{},formData:{},term:"",borders:{top:!1,right:!1,bottom:!0,left:!0}};var m=h;t.default=m},97019:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Component=c,t.default=void 0;var a=l(n(4754)),r=l(n(67294)),i=l(n(16304)),s=n(53556),o=l(n(45697));function l(e){return e&&e.__esModule?e:{default:e}}const d=a.default._t("Admin.SEARCH","Search"),u=a.default._t("Admin.CLEAR","Clear");function c(e){let{visible:t,expanded:n,onSearch:a,onClear:o,formSchemaUrl:l,id:c,identifier:f,clearable:p}=e;const h=(m=a,e=>{"Enter"===e.key&&(e.preventDefault(),m())});var m;const g=t||n;return r.default.createElement(s.Collapse,{id:c,isOpen:n,className:"search-form"},r.default.createElement("div",{className:"search-form__wrapper",onKeyDown:h},g&&l&&r.default.createElement(i.default,{className:"no-change-track",formTag:"div",identifier:f,schemaUrl:l,onSubmit:()=>(a(),Promise.resolve())}),r.default.createElement(s.Button,{className:"search-form__submit",onClick:()=>a(),color:"primary",type:"button"},d),p&&r.default.createElement(s.Button,{className:"search-form__clear",onClick:()=>o()},u)))}c.propTypes={onSearch:o.default.func,onClear:o.default.func,visible:o.default.bool,expanded:o.default.bool,id:o.default.string.isRequired,formSchemaUrl:o.default.string,identifier:o.default.string,clearable:o.default.bool},c.defaultProps={formData:{}};var f=c;t.default=f},65693:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=l(n(4754)),r=l(n(67294)),i=n(53556),s=l(n(94184)),o=l(n(45697));function l(e){return e&&e.__esModule?e:{default:e}}const d=a.default._t("Admin.SHOW_SEARCH","Show search"),u=e=>(0,s.default)("btn--no-text","search-toggle","font-icon-search","btn--icon-lg",{"search-toggle__active":e}),c=e=>{let{onToggle:t,toggled:n}=e;return r.default.createElement(i.Button,{title:d,onClick:t,className:u(n)},r.default.createElement("span",{className:"sr-only"},d))};t.Component=c,c.propTypes={onToggle:o.default.func,toggled:o.default.bool};var f=c;t.default=f},47465:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(58592))&&a.__esModule?a:{default:a};const i=(e,t,n)=>{if(!Array.isArray(t)||0===t.length)return!1;const a=n.state.fields.find((t=>{let{name:n}=t;return n===e}));if(a&&a.source){return t.map((e=>{const t=a.source.find((t=>{let{value:n}=t;return n.toString()===e.toString()}));return t&&t.title?t.title:e})).join(", ")||!1}return!1};var s={Date:(0,r.default)("ll"),Time:(0,r.default)("LT"),Datetime:(0,r.default)("lll"),Hidden:()=>!1,SingleSelect:(e,t,n)=>{if(void 0===e.value)return!1;const a=i(e.key,[e.value],n);return!!a&&Object.assign({},e,{value:a})},Boolean:e=>{if(e.value){const{value:t,...n}=e;return n}return!1},MultiSelect:(e,t,n)=>{const a=i(e.key,e.value,n);return!!a&&Object.assign({},e,{value:a})},default:e=>!!e.value&&e};t.default=s},58592:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(30381))&&a.__esModule?a:{default:a};var i=e=>(t,n)=>{let{lang:a}=n;if(!t.value)return!1;if(t.value&&a){r.default.locale(a);const n=(0,r.default)(t.value);if(n.isValid())return Object.assign({},t,{value:n.format(e)})}return t};t.default=i},18992:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(47465))&&a.__esModule?a:{default:a};const i=(e,t)=>{let{key:n,value:a,label:r}=t;return`${e}${r.toLowerCase()||n} ${a||""} `};var s=function(e,t){let n,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e.metadata.loading)return{};const s=a=>{const r={key:a.name,label:a.title,value:t[a.name]};let i;return i="function"==typeof n[`#${r.key}`]?n[`#${r.key}`]:"function"==typeof n[a.schemaType]?n[a.schemaType]:n.default,i(r,a,e,t)},o=(e,t)=>{const{children:n}=t;if(!Array.isArray(n)||0===n.length)return!1;const a=n.map(s).filter((e=>!1!==e)).reduce(i,"").trim(),r=n.map((e=>e.name)),o=`[name=${n[0].name}]`;return!!a&&Object.assign({},e,{value:a,linkedFields:r,focusSelector:o})};n=Object.assign({},r.default,{Structural:o},a);const l=e.schema.fields,d=l.map(s).filter((e=>!1!==e)),u={};return d.forEach((e=>{u[e.key]=e})),u};t.default=s},63980:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=l(n(98028)),i=l(n(4754)),s=n(53556),o=l(n(45697));function l(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;te.value===this.props.value));return e="string"==typeof e?e:this.props.value||"",a.default.createElement(s.Input,u({plaintext:!0},this.getInputProps(),{tag:"p"}),e)}getSelectField(){const e=this.props.source?this.props.source.slice():[];return this.props.data.hasEmptyDefault&&!e.find((e=>!e.value))&&e.unshift({value:"",title:this.props.data.emptyString,disabled:!1}),a.default.createElement(s.Input,u({type:"select"},this.getInputProps()),e.map(((e,t)=>{const n=`${this.props.name}-${e.value||`empty${t}`}`,r=e.description||null;return a.default.createElement("option",{key:n,value:e.value,disabled:e.disabled,title:r},e.title)})))}getInputProps(){const e={className:`${this.props.className} ${this.props.extraClass} no-chosen`,id:this.props.id,name:this.props.name,disabled:this.props.disabled};return this.props.readOnly||Object.assign(e,{onChange:this.handleChange,value:this.props.value||""}),e}handleChange(e){"function"==typeof this.props.onChange&&this.props.onChange(e,{id:this.props.id,value:e.target.value})}render(){let e=null;return e=this.props.readOnly?this.getReadonlyField():this.getSelectField(),e}}t.Component=c,c.propTypes={id:o.default.string,name:o.default.string.isRequired,onChange:o.default.func,value:o.default.oneOfType([o.default.string,o.default.number]),readOnly:o.default.bool,disabled:o.default.bool,source:o.default.arrayOf(o.default.shape({value:o.default.oneOfType([o.default.string,o.default.number]),title:o.default.oneOfType([o.default.string,o.default.number]),description:o.default.string,disabled:o.default.bool})),data:o.default.oneOfType([o.default.array,o.default.shape({hasEmptyDefault:o.default.bool,emptyString:o.default.oneOfType([o.default.string,o.default.number])})])},c.defaultProps={source:[],extraClass:"",className:"",data:{emptyString:i.default._t("Boolean.ANY","Any")}};var f=(0,r.default)(c);t.default=f},10202:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=o(n(67294)),r=n(53556),i=o(n(94184)),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(e){let{title:t,disabled:n,active:s,tabClassName:o,onToggle:l}=e;if(!t)return null;const d=(0,i.default)(o,{active:s});return a.default.createElement(r.NavItem,null,a.default.createElement(r.NavLink,{onClick:l,disabled:n,className:d},t))}l.propTypes={title:s.default.string,disabled:s.default.bool,active:s.default.bool,tabClassName:s.default.string,onToggle:s.default.func.isRequired},l.defaultProps={disabled:!1,active:!1};var d=l;t.default=d},40505:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=d(n(67294)),r=n(53556),i=d(n(45697)),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(93390)),o=d(n(94184));function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}function u(e){let{name:t,className:n,extraClass:i,disabled:l,children:d}=e;const{activeTab:u,isOnActiveTab:c}=(0,s.default)(),f={activeTab:u,currentTab:t,isOnActiveTab:!1!==c&&u===t};return a.default.createElement(s.TabContext.Provider,{value:f},a.default.createElement(r.TabPane,{tabId:t,className:(0,o.default)(n,i),disabled:l},a.default.createElement(r.Fade,{in:c},d)))}u.propTypes={name:i.default.string.isRequired,extraClass:i.default.string,className:i.default.string,disabled:i.default.bool};var c=u;t.default=c},96870:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=o(n(67294)),r=n(53556),i=o(n(45697)),s=o(n(10202));function o(e){return e&&e.__esModule?e:{default:e}}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{props:n}=e;return a.default.createElement(s.default,l({},n,{onToggle:()=>t!==n.name&&i(n.name),active:t===n.name}))}));return o&&o.length>1?a.default.createElement(r.Nav,{tabs:!0,role:"tablist"},o):null}d.propTypes={currentTab:i.default.string,onToggle:i.default.func.isRequired};var u=d;t.default=u},61404:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Component=m,t.default=void 0;var a=h(n(67294)),r=n(53556),i=h(n(94184)),s=h(n(45697)),o=n(86706),l=p(n(53104)),d=h(n(96870)),u=h(n(56204)),c=p(n(93390));function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(f=function(e){return e?n:t})(e)}function p(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=f(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,n&&n.set(e,a),a}function h(e){return e&&e.__esModule?e:{default:e}}function m(e){let{hideNav:t,children:n,activeTab:s,className:o,extraClass:l,id:f,activateTab:p,defaultActiveKey:h}=e;const m={className:(0,i.default)([o,l]),id:f},g=s||(0,u.default)(h,n),v=(0,c.default)(),b={activeTab:g,isOnActiveTab:v?v.isOnActiveTab:void 0};return a.default.createElement("div",m,a.default.createElement("div",{className:"wrapper"},!t&&a.default.createElement(d.default,{currentTab:g,onToggle:p},n),a.default.createElement(r.TabContent,{activeTab:g},a.default.createElement(c.TabContext.Provider,{value:b},n))))}m.propTypes={id:s.default.string.isRequired,defaultActiveKey:s.default.string,extraClass:s.default.string,hideNav:s.default.bool,activateTab:s.default.func,activeTab:s.default.string},m.defaultProps={className:"",extraClass:"",hideNav:!1};const g=e=>`${e.formid}__${e.id}`;var v=(0,o.connect)((function(e,t){const n=g(t);return{...e.tabs.fields[n]?e.tabs.fields[n]:{activeTab:null}}}),(function(e,t){const n=g(t);return{activateTab(t){e(l.activateTab(n,t))}}}))(m);t.default=v},56204:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){const n=a.Children.toArray(t);if(!n||0===n.length)return"";let r;"string"==typeof e&&(r=n.find((t=>{let{props:{name:n}}=t;return n===e})));r||(r=n[0]);return r.props.name};var a=n(67294)},97228:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=u(n(97023)),i=u(n(53621)),s=u(n(72543)),o=u(n(94184)),l=u(n(73935)),d=u(n(45697));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t({showSummaryView:t})))}render(){const{maxSize:e,onSummary:t,...n}=this.props,l=this.state.showSummaryView,d=this.props.tags.length,u=(0,o.default)("compact-tag-list",{"compact-tag-list__show-summary-view":l});return a.default.createElement("div",{className:u},a.default.createElement(s.default,{onResize:this.onResize,className:"compact-tag-list__placeholder","aria-hidden":!0},a.default.createElement(r.default,f({},n,{focusable:!1}))),a.default.createElement("div",{className:"compact-tag-list__visible"},l?a.default.createElement(i.default,{count:d,onClick:t,onNext:n.onHolderFocus}):a.default.createElement(r.default,n)))}}p.propTypes=Object.assign({},r.default.propTypes,{maxSize:d.default.number,onSummary:d.default.func}),p.defaultProps={maxSize:0,onSummary:()=>{}};var h=p;t.default=h},53621:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=o(n(67294)),r=o(n(85362)),i=o(n(4754)),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{label:t,count:n,...i}=e;return a.default.createElement(r.default,l({},i,{deletable:!1,title:`${n} ${t}`}),n," ",a.default.createElement("span",{className:"font-icon-sliders","aria-label":t}))};d.propTypes=Object.assign({},r.default.propTypes,{label:s.default.string,count:s.default.number}),d.defaultProps={label:i.default._t("Admin.SUMMARY_TAG_LABEL","filters")};var u=d;t.default=u},85362:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=l(n(67294)),r=n(53556),i=l(n(94184)),s=l(n(4754)),o=l(n(45697));function l(e){return e&&e.__esModule?e:{default:e}}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{onClick:t,onDelete:n,onDeleteKey:s,onBackSpace:o,onPrevious:l,onNext:u,deletable:c,dataKey:p,label:h,value:m,children:g,focusable:v,...b}=e;const _=((e,t,n)=>(t||e)+(n?`: ${n}`:""))(p,h,m);return a.default.createElement(r.Button,d({},b,{role:"button",className:(0,i.default)("tag-component","btn-sm",{"tag-component--deletable":c}),onClick:e=>{e.preventDefault(),t(p)},tabIndex:v?0:void 0,onKeyDown:e=>{((e,t,n,a,r,i)=>{switch(e.key){case"Backspace":e.preventDefault(),a(t);break;case"Delete":e.preventDefault(),n(t);break;case"ArrowLeft":e.preventDefault(),r(t);break;case"ArrowRight":e.preventDefault(),i(t)}})(e,p,s,o,l,u)},title:_}),c&&a.default.createElement(f,{onDelete:n,dataKey:p}),g||_)},c=e=>{e.target.parentElement.focus()},f=e=>{let{dataKey:t,onDelete:n}=e;return a.default.createElement(r.Button,{onClick:e=>{e.stopPropagation(),e.preventDefault(),n(t)},"aria-label":s.default._t("Admin.REMOVE_TAG","Remove Tag"),title:s.default._t("Admin.REMOVE_TAG","Remove Tag"),onFocus:c,tabIndex:-1,className:"tag-component__delete font-icon-cancel btn--no-text btn--icon-sm"})};u.propTypes={onClick:o.default.func,onDelete:o.default.func,onDeleteKey:o.default.func,onBackSpace:o.default.func,onPrevious:o.default.func,onNext:o.default.func,deletable:o.default.bool,dataKey:o.default.string,label:o.default.string,value:o.default.string,focusable:o.default.bool},u.defaultProps={tag:"span",deletable:!1,onClick:()=>{},onDelete:()=>{},onDeleteKey:()=>{},onBackSpace:()=>{},onPrevious:()=>{},onNext:()=>{},focusable:!0};var p=u;t.default=p},97023:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=o(n(67294)),r=o(n(85362)),i=o(n(43117)),s=o(n(45697));function o(e){return e&&e.__esModule?e:{default:e}}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const t=document.activeElement[e?"nextElementSibling":"previousElementSibling"];return!!t&&(t.focus(),!0)},c=e=>{let{tags:t,deletable:n,focusable:i,onTagDelete:s,onTagClick:o,onHolderFocus:c}=e;const f=e=>{u(d)||c(),s(e)},p=e=>{u(false)||u(d)||c(),s(e)};return a.default.createElement("ul",{className:"tag-list"},t.map((e=>a.default.createElement(r.default,l({},e,{tag:"li",deletable:n,dataKey:e.key,focusable:i,onDelete:s,onDeleteKey:n&&s?f:void 0,onBackSpace:n&&s?p:void 0,onNext:()=>{u(d)||c()},onPrevious:()=>{u(false)},onClick:o})))))};t.Component=c,c.propTypes={onTagClick:s.default.func,onTagDelete:s.default.func,onHolderFocus:s.default.func,deletable:s.default.bool,tags:s.default.arrayOf(i.default),focusable:s.default.bool},c.defaultProps={deletable:!1,focusable:!0,onTagDelete:()=>{},onTagClick:()=>{},onHolderFocus:()=>{}};var f=c;t.default=f},43117:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(45697))&&a.__esModule?a:{default:a};var i=r.default.shape({key:r.default.string.required,label:r.default.string,value:r.default.string});t.default=i},74898:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=i(n(98028)),r=i(n(16725));function i(e){return e&&e.__esModule?e:{default:e}}class s extends r.default{getInputProps(){const e=super.getInputProps();return this.isMultiline()&&Object.assign(e,{type:"textarea",rows:this.props.data.rows,cols:this.props.data.columns}),e}isMultiline(){return this.props.data&&this.props.data.rows>1}}t.Component=s;var o=(0,a.default)(s);t.default=o},63182:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=d(n(98028)),r=n(81463),i=d(n(30381)),s=d(n(68300)),o=d(n(4754)),l=d(n(45697));function d(e){return e&&e.__esModule?e:{default:e}}const u="LT";class c extends r.Component{getInputProps(){const e=o.default.inject(o.default._t("Admin.FormatExample","Example: {format}"),{format:(0,i.default)().endOf("month").format(u)}),t=this.asHTML5()?"time":"text";return{...super.getInputProps(),type:t,placeholder:e}}isMultiline(){return!1}hasNativeSupport(){return this.props.modernizr.inputtypes.time}convertToLocalised(e){let t="";if(e){const n=(0,i.default)(e,"HH:mm:ss");n.isValid()&&(t=n.format(u))}return t}convertToIso(e){let t="";if(e){const n=(0,i.default)(e,u);n.isValid()&&(t=n.format("HH:mm:ss"))}return t}}t.Component=c,c.propTypes={lang:l.default.string,modernizr:l.default.object,data:l.default.shape({html5:l.default.bool})},c.defaultProps={modernizr:s.default,data:{}};var f=(0,a.default)(c);t.default=f},20164:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tipShape=t.default=t.TIP_TYPES=t.TIP_IMPORTANCE_LEVELS=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=d(n(45697)),i=n(53556),s=d(n(4754)),o=d(n(22602)),l=d(n(94184));function d(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}const c={TITLE:"title",INPUT_GROUP:"input-group"};t.TIP_TYPES=c;const f={NORMAL:"normal",HIGH:"high"};t.TIP_IMPORTANCE_LEVELS=f;const p={[f.NORMAL]:{iconColor:"muted",description:s.default._t("Admin.NORMAL_TIP","Tip")},[f.HIGH]:{iconColor:"danger",description:s.default._t("Admin.IMPORTANT_TIP","Important tip")}};function h(e){const{content:t,fieldTitle:n,icon:r,id:d,importance:u}=e,{iconColor:f,description:h}=p[u],m=s.default.inject(s.default._t("Admin.TIP_LABEL","{description} for {fieldTitle}"),{description:h,fieldTitle:n}),g=["tip",e.extraClass];e.type===c.TITLE?g.push("tip--title"):e.type===c.INPUT_GROUP&&g.push("tip--input-group","btn--last","btn-outline-secondary",`text-${f}`);const v=`${d}-tip`,b={id:v,onClick:()=>{},className:(0,l.default)(g),noText:!0,icon:r};return a.default.createElement(a.Fragment,null,a.default.createElement(o.default,b,m),a.default.createElement(i.UncontrolledPopover,{trigger:"legacy",placement:"top-end",target:v},a.default.createElement(i.PopoverBody,null,t)))}const m={content:r.default.string.isRequired,importance:r.default.oneOf(Object.values(f)),type:r.default.oneOf(Object.values(c)),icon:r.default.string};t.tipShape=m,h.propTypes={...m,extraClass:r.default.string,fieldTitle:r.default.string.isRequired,id:r.default.string.isRequired},h.defaultProps={importance:f.NORMAL,icon:"lamp",type:c.INPUT_GROUP};var g=h;t.default=g},87890:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toastShape=t.default=void 0;var a=u(n(67294)),r=u(n(45697)),i=u(n(4754)),s=n(53556),o=u(n(94184)),l=n(46735),d=u(n(22602));function u(e){return e&&e.__esModule?e:{default:e}}const c={text:r.default.string.isRequired,dismissed:r.default.bool.isRequired,type:r.default.string.isRequired,actions:r.default.arrayOf(r.default.shape(d.default.propTypes))};t.toastShape=c;const f=e=>{let{type:t,text:n,onDismiss:r,dismissed:u,actions:c}=e;const f=(0,o.default)("toast",`toast--${t}`,{"toast--dismissing":u});return a.default.createElement(s.Toast,{className:f,isOpen:!0},a.default.createElement(s.ToastBody,{className:"toast__body"},a.default.createElement(d.default,{className:"toast__close",icon:"cancel",noText:!0,onClick:e=>{e.preventDefault(),r()},color:"none"},i.default._t("Admin.DISMISS","Dismiss")),a.default.createElement("div",{className:"toast__content",role:"alert","aria-live":"assertive","aria-atomic":"true"},n)),c.length>0&&a.default.createElement(l.ToastActions,{actions:c,onDismiss:r,dismissed:u}))};f.propTypes={...c,onDismiss:r.default.func.isRequired},f.defaultProps={actions:[]};var p=f;t.default=p},46735:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ToastActions=t.ToastAction=void 0;var a=s(n(67294)),r=s(n(45697)),i=s(n(22602));function s(e){return e&&e.__esModule?e:{default:e}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{label:t,href:n,onClick:r,dismissed:s,onDismiss:l}=e;const d=n?{href:n,tag:"a"}:{onClick:e=>{e.preventDefault(),s||(r&&r(),l())}};return a.default.createElement(i.default,o({color:"link",className:"toast__action"},d),t)};t.ToastAction=l;const d=e=>{let{actions:t,dismissed:n,onDismiss:r}=e;return 0===t.length?null:a.default.createElement("div",{className:"toast__actions"},t.slice(0,2).map(((e,t)=>a.default.createElement(l,o({key:t},e,{onDismiss:r,dismissed:n})))))};t.ToastActions=d,d.propTypes={dismissed:r.default.bool.isRequired,actions:r.default.arrayOf(r.default.shape({label:r.default.string.isRequired,href:r.default.string,onClick:r.default.func})),onDismiss:r.default.func.isRequired},d.defaultProps={actions:[]};var u=d;t.default=u},60452:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=s(n(45697)),i=s(n(87890));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{toasts:t,onDismiss:n,onPause:r,onResume:s}=e;const[o,d]=(0,a.useState)(void 0),u=e=>()=>{o&&clearTimeout(o),d(setTimeout(e,100))},c=u(r),f=u(s),p={onMouseEnter:c,onFocus:c,onMouseLeave:f,onBlur:f};return a.default.createElement("div",l({className:"toasts","aria-live":"polite","aria-atomic":"true"},p),a.default.createElement("div",{className:"toasts__wrapper"},t.map((e=>{let{id:t,...r}=e;return a.default.createElement(i.default,l({key:t,onDismiss:()=>n(t)},r))}))))};d.propTypes={toasts:r.default.arrayOf(r.default.shape(i.default.propTypes)).isRequired,onDismiss:r.default.func.isRequired,onPause:r.default.func.isRequired,onResume:r.default.func.isRequired},d.defaultProps={};var u=d;t.default=u},53330:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=s(n(67294)),r=s(n(45697)),i=s(n(45332));function s(e){return e&&e.__esModule?e:{default:e}}const o=e=>{let{showBackButton:t,children:n,onBackButtonClick:r}=e;return a.default.createElement("div",{className:"toolbar toolbar--north"},a.default.createElement("div",{className:"toolbar__navigation fill-width"},t&&a.default.createElement(i.default,{onClick:e=>{e.preventDefault(),"function"==typeof r&&r(e)},className:"toolbar__back-button"}),n))};o.propTypes={onBackButtonClick:r.default.func,showBackButton:r.default.bool},o.defaultProps={showBackButton:!1};var l=o;t.default=l},59888:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.SINGLE_EMPTY_VALUE=t.MULTI_EMPTY_VALUE=t.ConnectedTreeDropdownField=t.Component=void 0,Object.defineProperty(t,"findTreeByID",{enumerable:!0,get:function(){return b.findTreeByID}}),Object.defineProperty(t,"findTreeByPath",{enumerable:!0,get:function(){return b.findTreeByPath}}),Object.defineProperty(t,"findTreePath",{enumerable:!0,get:function(){return b.findTreePath}});var a=w(n(67294)),r=_(n(45697)),i=n(86706),s=n(14890),o=_(n(10932)),l=_(n(25114)),d=_(n(4754)),u=_(n(98028)),c=_(n(94301)),f=w(n(14504)),p=w(n(25548)),h=_(n(98268)),m=_(n(8575)),g=n(53556),v=n(10259),b=n(11355);function _(e){return e&&e.__esModule?e:{default:e}}function y(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(y=function(e){return e?n:t})(e)}function w(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=y(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,n&&n.set(e,a),a}function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;te));t.length&&this.props.actions.treeDropdownField.addSelectedValues(e,t)}componentDidUpdate(e){if(this.props.readOnly||this.props.disabled)return;let t=!1,n=[];this.props.search!==e.search&&(t=!0,n=this.props.visible),e.data.urlTree!==this.props.data.urlTree&&(t=!0),e.data.cacheKey!==this.props.data.cacheKey&&(t=!0),t&&this.loadTree(n,this.props.search,this.props)}getVisibleTree(){return this.props.findTreeByPath(this.props.tree,this.props.visible)}getBreadcrumbs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.visible;const t=[];if(!e)return t;let n=this.props.tree;for(const a of e){if(!n.children)break;if(n=n.children.find((e=>e.id===a)),!n)break;t.push(n)}return t}getDropdownOptions(){const e=this.props.value,t=this.getVisibleTree();let n=t?[...t.children]:[];const a=this.props.selectedValues.filter((t=>t.id===e||Array.isArray(e)&&e.find((e=>e===t.id))));return!this.state.opened&&this.props.data.showSelectedPath?n=a.map((e=>({...e,title:e.titlePath||e.title}))):a.length&&(n=[...a.filter((e=>!n.find((t=>t.id===e.id)))),...n]),n.unshift({id:this.props.data.multiple?"":0,title:this.props.data.hasEmptyDefault?this.props.data.emptyString:null,disabled:!n.length||!this.props.data.hasEmptyDefault}),n}getPath(e){const t=this.props.findTreePath(this.props.tree,e,this.props.data.treeBaseId);return this.getBreadcrumbs(t).reduce(((e,t)=>`${e}${t.contextString||""}${t.title}/`),"")}initialise(){return this.loadTree([],this.props.search).then((e=>{let t=[];!this.props.data.multiple&&this.props.value&&(t=this.props.findTreePath(e,this.props.value,this.props.data.treeBaseId),t?t.pop():t=[]),this.props.actions.treeDropdownField.setVisible(this.props.id,t)}))}callFetch(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props;const a=m.default.parse(n.data.urlTree,!0);n.data.showSearch&&t.length&&(a.query.search=t,a.query.flatList="1"),e.length?a.query.ID=e[e.length-1]:!n.data.multiple&&n.value&&(a.query.forceValue=n.value),a.query.format="json",a.search=null;const r=m.default.format(a);return this.props.fetch(r,{credentials:"same-origin"}).then((e=>e.json()))}lazyLoad(e){if(e.find((e=>this.props.loading.indexOf(e)>-1||this.props.failed.indexOf(e)>-1)))return Promise.resolve({});const t=this.props.findTreeByPath(this.props.tree,e);return t&&(0===t.count||t.children.length)?Promise.resolve({}):this.loadTree(e)}loadTree(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props;return n.actions.treeDropdownField.beginTreeUpdating(n.id,e),this.callFetch(e,t,n).then((t=>(n.actions.treeDropdownField.updateTree(n.id,e,t),t))).catch((t=>{if(n.actions.treeDropdownField.updateTreeFailed(n.id,e),"function"==typeof n.onLoadingError)return n.onLoadingError({errors:[{value:t.message,type:"error"}]});throw t}))}hasSearch(){return this.props.data.showSearch&&Boolean(this.props.search)}filterOption(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=this.getVisibleTree();if((0===e.value||""===e.value)&&(!this.props.data.hasEmptyDefault||this.props.visible.length||this.hasSearch()))return!1;const a=e.label&&e.label.toLocaleLowerCase(),r=t.toLocaleLowerCase();return r?a&&a.includes(r):!n||!e.value||n.children.find((t=>t.id===e.value))}handleOpen(){this.setState({opened:!0}),this.handleSearchReset()}handleClose(){this.setState({opened:!1})}handleSearchReset(){clearTimeout(this.searchTimer),this.props.actions.treeDropdownField.setSearch(this.props.id,"")}handleSearchChange(e){clearTimeout(this.searchTimer),this.searchTimer=setTimeout((()=>{this.props.actions.treeDropdownField.setSearch(this.props.id,e)}),500)}handleChange(e){let t=null;if(this.handleSearchReset(),this.props.data.multiple){if(t=E,e&&e.length){const n=e&&e.filter(((t,n)=>e.findIndex((e=>e.id===t.id))===n));t=n.map((e=>e.id)),this.props.actions.treeDropdownField.addSelectedValues(this.props.id,n)}}else{const n=e?e.id:null;let a=(this.getVisibleTree()||this.props.tree).children.find((e=>e.id===n));a&&(this.props.data.showSelectedPath&&(a={...a,titlePath:this.getPath(n)}),this.props.actions.treeDropdownField.addSelectedValues(this.props.id,[a])),t=n||0}"function"==typeof this.props.onChange&&this.props.onChange(t)}handleNavigate(e,t){if(this.hasSearch())return;e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),e.preventDefault();let n=this.props.findTreePath(this.props.tree,t,this.props.data.treeBaseId);n||(n=this.props.visible.slice(0),n.push(t)),this.lazyLoad(n),this.props.actions.treeDropdownField.setVisible(this.props.id,n)}handleKeyDown(e){if(this.hasSearch())return void(27===e.keyCode&&this.handleSearchReset(e));const t=this.selectField.state.focusedOption;if(t)switch(e.keyCode){case 37:this.handleBack(e);break;case 39:t.count&&this.handleNavigate(e,t.id)}}handleBack(e){if(this.hasSearch())return;e.stopPropagation(),e.preventDefault();let t=this.props.visible;t.length&&(t=t.slice(0,t.length-1)),this.lazyLoad(t),this.props.actions.treeDropdownField.setVisible(this.props.id,t)}renderInput(e){let{children:t,...n}=e;return n.id=this.props.id,a.default.createElement(f.components.Input,n,t)}renderBreadcrumbs(e,t){let{cx:n,getStyles:r,getClassNames:i,...s}=t;if(0===e.length)return null;e=e.map((e=>e.title)).join(" / ");const l=this.hasSearch()?"font-icon-search":"font-icon-left-open-big",d=n({option:!0,breadcrumbs:!0},i("option",{})),u=o.default.div(r("option",s));return a.default.createElement(u,{className:d,onClick:this.handleBack,role:"button",tabIndex:0},a.default.createElement("button",{type:"button",className:"treedropdownfield__breadcrumbs-button"},a.default.createElement("span",{className:`icon ${l}`})),a.default.createElement("span",{className:"treedropdownfield__breadcrumbs-crumbs flexbox-area-grow"},e))}renderMenuList(e){let{children:t,...n}=e;const r=this.getBreadcrumbs();return a.default.createElement(f.components.MenuList,n,this.renderBreadcrumbs(r,n),t)}renderOption(e){let{children:t,...n}=e,r=null;const i=n.data;if(i.count&&!this.hasSearch()){const e=e=>this.handleNavigate(e,i.id);r=a.default.createElement("button",{type:"button",className:"treedropdownfield__option-button fill-width",onClick:e,onMouseDown:e,onTouchStart:e},a.default.createElement("span",{className:"treedropdownfield__option-count-icon font-icon-right-open-big"}))}let s=null;return this.hasSearch()&&(s=i.contextString,s||!this.props.data.hasEmptyDefault||this.props.visible.length||(s=this.props.data.emptyString)),a.default.createElement(f.components.Option,n,a.default.createElement("span",{className:"treedropdownfield__option-title-box flexbox-area-grow fill-height"},a.default.createElement("span",{className:"treedropdownfield__option-title"},t),s&&a.default.createElement("span",{className:"treedropdownfield__option-context"},s)),r)}renderReadOnly(){const e={id:this.props.id,readOnly:this.props.readOnly,disabled:this.props.disabled},t=this.props.extraClass?`treedropdownfield ${this.props.extraClass}`:"treedropdownfield";let n=this.props.data.hasEmptyDefault?this.props.data.emptyString:"";const r=this.props.selectedValues;if(this.props.data.multiple){n=this.props.value.map((e=>r.find((t=>t.id===e))||e)).map((e=>e.title)).join(", ")}else{const e=r.find((e=>e.id===this.props.value));n=this.props.value,e&&"string"==typeof e.title&&(n=e.title)}return a.default.createElement("div",{className:t},a.default.createElement("span",{className:"treedropdownfield__title"},n),a.default.createElement(g.Input,O({type:"hidden",name:this.props.name,value:this.props.value},e)))}formatOptionLabel(e,t){let{context:n,inputValue:r}=t;const{title:i}=e;return this.props.search.length?(0,v.mapHighlight)(i||"",this.props.search,(e=>{let{children:t}=e;return a.default.createElement("span",{className:"treedropdownfield__option-title--highlighted"},t)})):i}noOptionsMessage(e){let{inputValue:t}=e;const n=this.getVisibleTree()||{};return this.props.failed.indexOf(n.id||0)>=0?d.default._t("Admin.TREEDROPDOWN_FAILED","Failed to load"):t||!n.id?d.default._t("Admin.TREEDROPDOWN_NO_OPTIONS","No options"):d.default._t("Admin.TREEDROPDOWN_NO_CHILDREN","No children")}render(){if(this.props.readOnly||this.props.disabled)return this.renderReadOnly();const e=this.props.extraClass?`treedropdownfield ${this.props.extraClass}`:"treedropdownfield",t=this.getDropdownOptions(),n=Array.isArray(this.props.value)?this.props.value:[this.props.value];let r=this.props.selectedValues.filter((e=>n.includes(e.id)));r.length||(r=t.filter((e=>n.includes(e.id)))),!r.length&&this.props.data.hasEmptyDefault&&(r=t[0]);const i=void 0!==this.props.data.showSearch&&this.props.data.showSearch,s={Input:this.renderInput,MenuList:this.renderMenuList,Option:this.renderOption},o=this.getVisibleTree()||{},u=this.props.loading.indexOf(o.id||0)>=0;return a.default.createElement(l.default,null,a.default.createElement(f.default,{isSearchable:i,isMulti:this.props.data.multiple,isClearable:!0,className:e,name:this.props.name,options:t,delimiter:",",components:s,formatOptionLabel:this.formatOptionLabel,filterOption:this.filterOption,onChange:this.handleChange,onMenuOpen:this.handleOpen,onMenuClose:this.handleClose,onKeyDown:this.handleKeyDown,onInputChange:this.handleSearchChange,isLoading:u,loadingMessage:()=>d.default._t("Admin.TREEDROPDOWN_LOADING","Loading..."),noOptionsMessage:this.noOptionsMessage,value:r,ref:e=>{this.selectField=e},placeholder:this.props.data.emptyString,getOptionLabel:e=>{let{title:t}=e;return t},getOptionValue:e=>{let{id:t}=e;return t},classNamePrefix:"treedropdownfield",classNames:{option:()=>"fill-width"}}))}}t.Component=C,C.propTypes={className:r.default.string,extraClass:r.default.string,id:r.default.string,name:r.default.string.isRequired,onChange:r.default.func,value:r.default.oneOfType([r.default.string,r.default.number,r.default.array]),readOnly:r.default.bool,disabled:r.default.bool,tree:r.default.shape(h.default.propTypes),findTreeByPath:r.default.func,findTreePath:r.default.func,visible:r.default.array,loading:r.default.array,failed:r.default.array,selectedValues:r.default.array,data:r.default.shape({cacheKey:r.default.string,urlTree:r.default.string.isRequired,emptyString:r.default.string,valueObject:r.default.shape(h.default.propTypes),valueObjects:r.default.arrayOf(r.default.shape(h.default.propTypes)),hasEmptyDefault:r.default.bool,showSearch:r.default.bool,multiple:r.default.bool,showSelectedPath:r.default.bool,treeBaseId:r.default.number}),onLoadingError:r.default.func,search:r.default.string,actions:r.default.shape({treeDropdownField:r.default.object}),fetch:r.default.func},C.defaultProps={value:"",extraClass:"",className:"",tree:{},visible:[],loading:[],failed:[],findTreeByPath:b.findTreeByPath,findTreePath:b.findTreePath,fetch:c.default};const T=(0,i.connect)((function(e,t){const n=t.id,a=e.treeDropdownField.fields[n]?e.treeDropdownField.fields[n]:{tree:{},visible:[],loading:[],failed:[],search:"",selectedValues:[]};let r=t.value;return t.data.multiple&&t.value===E&&(r=[]),t.data.multiple||t.value||(r=0),{...a,value:r}}),(function(e){return{actions:{treeDropdownField:(0,s.bindActionCreators)(p,e)}}}))(C);t.ConnectedTreeDropdownField=T;var S=(0,u.default)(T);t.default=S},98268:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(45697))&&a.__esModule?a:{default:a};const i=()=>null;i.propTypes={id:r.default.oneOfType([r.default.string,r.default.number]),title:r.default.string,titlePath:r.default.string,disabled:r.default.bool,parentid:r.default.number,count:r.default.number,depth:r.default.number,expanded:r.default.bool,limited:r.default.bool,marked:r.default.bool,opened:r.default.bool,children:r.default.array};var s=i;t.default=s},11355:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findTreePath=t.findTreeByPath=t.findTreeByID=void 0;const n=(e,t)=>{if(!e||0===Object.keys(e).length)return null;if(0===t.length)return e;const a=t.slice(0),r=a.shift(),i=e.children.find((e=>e.id===r));return i?n(i,a):null};t.findTreeByPath=n;const a=(e,t)=>{if(!t||!e||!e.children||0===Object.keys(e).length)return null;if(e.id===t)return e;for(const n of e.children){const e=a(n,t);if(null!==e)return e}return null};t.findTreeByID=a;const r=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return[];if(!e||0===Object.keys(e).length)return null;if(e.id===t)return[e.id];if(!e.children)return null;for(const a of e.children){const i=r(a,t);if(null!==i)return e.id&&e.id!==n&&i.unshift(e.id),i}return null};t.findTreePath=r},80384:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=d(n(45697)),i=d(n(94184)),s=d(n(4754)),o=d(n(34411)),l=d(n(6732));function d(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}class c extends a.PureComponent{renderHeader(){return a.default.createElement("thead",null,a.default.createElement("tr",null,a.default.createElement("th",{scope:"col",className:"used-on__col--index"},s.default._t("Admin.USED_ON_NUM","#")),a.default.createElement("th",{scope:"col",className:"used-on__col--title"},s.default._t("Admin.USED_ON","Used on"))))}renderBody(){const{usedOn:e,loading:t,error:n}=this.props;if(n||!e||!e.length){let e=null,r=null;n?(e=s.default.inject(s.default._t("Admin.LOADING_ERROR","As error occured when loading the data: {message}"),{message:n}),r="error"):t?(e=a.default.createElement(o.default,null),r="loading"):(e=s.default._t("Admin.NOT_USED","This file is currently not in use."),r="empty");const l=(0,i.default)(["used-on__message",`used-on__message--${r}`]);return a.default.createElement("tbody",{"aria-live":"polite"},a.default.createElement("tr",null,a.default.createElement("td",{className:l,colSpan:"3"},e)))}return a.default.createElement("tbody",{"aria-live":"polite"},e.map(this.renderRow))}renderRow(e,t){const{id:n,type:r}=e,s=[e].concat(e.ancestors).reverse();let o="#",l=!0;const d=s.map(((e,r)=>{let s=e.title;const d=e.link;s&&s.length>=25&&(s=`${s.substring(0,25).trim()}...`),d&&(o=d);const u=`${t}-${n}-${r}`,c=["used-on__title-item"];return l&&(c.push("used-on__title-item--first"),l=!1),a.default.createElement("li",{className:(0,i.default)(c),key:u},s)})),u=`${t}-${n}`;return a.default.createElement("tr",{key:u,className:"used-on__row"},a.default.createElement("td",{className:"used-on__col--index"},a.default.createElement("a",{href:o,className:"used-on__cell-link"},t+1)),a.default.createElement("td",{className:"used-on__col--title"},a.default.createElement("a",{href:o,className:"used-on__cell-link"},a.default.createElement("ul",{className:"used-on__title-items"},d),a.default.createElement("span",{className:"used-on__type"},r))))}render(){return a.default.createElement("table",{className:"table used-on__table"},this.renderHeader(),this.renderBody())}}t.Component=c,c.propTypes={loading:r.default.bool,usedOn:r.default.arrayOf(r.default.shape({id:r.default.oneOfType([r.default.string,r.default.number]),title:r.default.string,type:r.default.string,link:r.default.string,ancestors:r.default.arrayOf(r.default.shape({title:r.default.string,link:r.default.string})).isRequired})),error:r.default.string};var f=(0,l.default)(c);t.default=f},6732:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),i=(a=n(45697))&&a.__esModule?a:{default:a},s=n(86706),o=n(36992),l=n(93390);function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}var u=e=>{class t extends r.Component{componentDidMount(){this.haveFetchedData=!1,this.props.forceFetch&&this.fetchDataFromEndpoint()}componentDidUpdate(e){const t=this.props.tabContext;(e.identifier!==this.props.identifier||!t||t.isOnActiveTab)&&this.fetchDataFromEndpoint()}fetchDataFromEndpoint(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;const{method:t,url:n}=e.data.readUsageEndpoint||{};this.haveFetchedData&&!this.props.forceFetch||e.loadUsedOn(e.identifier,t,n),this.haveFetchedData=!0}render(){return r.default.createElement(e,this.props)}}t.propTypes={identifier:i.default.string,loading:i.default.bool,data:i.default.oneOfType([i.default.array,i.default.shape({recordClass:i.default.string,recordId:i.default.oneOfType([i.default.string,i.default.number]),readUsageEndpoint:i.default.shape({url:i.default.string,method:i.default.string})})]),usedOn:i.default.array,forceFetch:i.default.bool};const n=(0,l.injectTabContext)(t),a=(0,s.connect)(((e,t)=>{const{recordClass:n,recordId:a}=t.data,r=n&&a?`${n}#${a}`:"",i=e.usedOn;return{identifier:r,loading:i.loading.includes(r),usedOn:i.usedOn[r]||null,error:i.errors[r]||null}}),{loadUsedOn:o.loadUsedOn})(n);return a.Component=n,a};t.default=u},57129:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.statuses=t.default=void 0;var a=l(n(67294)),r=l(n(94184)),i=l(n(45697)),s=l(n(37294)),o=l(n(4754));function l(e){return e&&e.__esModule?e:{default:e}}const d=["draft","modified","live","archived"];t.statuses=d;const u=e=>{let{status:t,className:n}=e;const i={className:(0,r.default)(n,"versioned-badge",`versioned-badge--${t}`),message:o.default._t(`ADMIN.${t.toUpperCase()}`,(l=t,l.replace(/^\w/,(e=>e.toUpperCase())))),status:"default"};var l;return a.default.createElement(s.default,i)};u.propTypes={status:i.default.oneOf(d).isRequired,className:i.default.string};var c=u;t.default=c},98031:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(67294)),r=f(n(45697)),i=n(53556),s=f(n(4754)),o=n(86706),l=n(14890),d=n(56486),u=n(15005),c=f(n(94184));function f(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;tthis.setState((e=>({dropdownOpen:!e.dropdownOpen})))),0)}handleSplitSelect(){this.props.onSplitSelect()}handlePreviewSelect(){this.props.onPreviewSelect()}handleEditSelect(){this.props.onEditSelect()}renderSplitDropdownItem(){const{activeState:e,splitAvailable:t,splitIconClass:n}=this.props,r=(0,c.default)("btn","icon-view","first",n,{"viewmode-toggle__button":!0,"viewmode-toggle--selected":e===u.VIEW_MODE_STATES.SPLIT,disabled:!t});return a.default.createElement(i.DropdownItem,{type:"button",disabled:!t,className:r,value:u.VIEW_MODE_STATES.SPLIT,onClick:this.handleSplitSelect,id:"splitModeButton"},s.default._t("Admin.SPLIT_MODE","Split mode"))}renderEditDropDownItem(){const{activeState:e,editIconClass:t}=this.props,n=(0,c.default)("btn","icon-view","last","viewmode-toggle__button",t,{"viewmode-toggle--selected":e===u.VIEW_MODE_STATES.EDIT});return a.default.createElement(i.DropdownItem,{type:"button",className:n,value:"content",onClick:this.handleEditSelect},s.default._t("Admin.EDIT_MODE","Edit mode"))}renderPreviewDropDownItem(){const{activeState:e,previewIconClass:t}=this.props,n=(0,c.default)("btn","icon-view","viewmode-toggle__button",t,{"viewmode-toggle--selected":e===u.VIEW_MODE_STATES.PREVIEW});return a.default.createElement(i.DropdownItem,{type:"button",className:n,value:"preview",onClick:this.handlePreviewSelect},s.default._t("Admin.PREVIEW_MODE","Preview mode"))}render(){const{activeState:e,area:t,splitAvailable:n,dropdownToggleProps:r}=this.props;if(t===u.VIEW_MODE_STATES.EDIT&&e===u.VIEW_MODE_STATES.SPLIT)return null;const o=(0,c.default)(this.getIconClass(),"btn","viewmode-toggle__dropdown",r.classname);return a.default.createElement(i.Dropdown,{isOpen:this.state.dropdownOpen,toggle:this.toggle,className:"viewmode-toggle"},a.default.createElement(i.DropdownToggle,h({className:o,caret:!0},r),a.default.createElement("span",{className:"viewmode-toggle__chosen-view-title"},this.getTitle())),a.default.createElement(i.DropdownMenu,null,this.renderSplitDropdownItem(),this.renderEditDropDownItem(),this.renderPreviewDropDownItem(),!n&&a.default.createElement("div",{className:"disabled-tooltip"},a.default.createElement("span",{className:"disabled-tooltip-span"},s.default._t("Admin.SCREEN_TOO_SMALL","Screen size too small")))))}}t.Component=m,m.propTypes={activeState:r.default.oneOf(Object.values(u.VIEW_MODE_STATES)),area:r.default.string.isRequired,splitAvailable:r.default.bool,onPreviewSelect:r.default.func,onEditSelect:r.default.func,onSplitSelect:r.default.func,editIconClass:r.default.string,previewIconClass:r.default.string,splitIconClass:r.default.string},m.defaultProps={splitAvailable:!0,editIconClass:"font-icon-edit-write",previewIconClass:"font-icon-eye",splitIconClass:"font-icon-columns",dropdownToggleProps:{}};var g=(0,l.compose)((0,o.connect)((function(e){return{activeState:e.viewMode.activeState,splitAvailable:e.viewMode.splitAvailable}}),(function(e){return{onSplitSelect(){e((0,d.selectSplitMode)())},onEditSelect(){e((0,d.selectEditMode)())},onPreviewSelect(){e((0,d.selectPreviewMode)())}}})))(m);t.default=g},55766:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,r=(a=n(67294))&&a.__esModule?a:{default:a},i=n(54582),s=n(89250);var o=(0,i.provideInjector)((()=>r.default.createElement("div",{className:"app"},r.default.createElement(s.Outlet,null))));t.default=o},25114:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=s(n(67294)),r=s(n(66751)),i=n(70917);function s(e){return e&&e.__esModule?e:{default:e}}var o=function(e){let{children:t}=e;return window.ssReactSelectCache||(window.ssReactSelectCache=a.default.useMemo((()=>(0,r.default)({key:"react-select",insertionPoint:document.querySelector("title")})),[])),a.default.createElement(i.CacheProvider,{value:window.ssReactSelectCache},t)};t.default=o},36800:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=l(n(67294)),r=n(11962),i=n(54582),s=l(n(96869)),o=l(n(45697));function l(e){return e&&e.__esModule?e:{default:e}}const d=e=>{const t=e.formComponent,n={...e};return delete n.formComponent,a.default.createElement(t,n)};d.propTypes={formComponent:o.default.elementType.isRequired};const u=(0,i.inject)(["Form"],(e=>({formComponent:e})))(d);var c=(0,r.reduxForm)({getFormState:s.default,destroyOnUnmount:!1})(u);t.default=c},16304:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var a=w(n(4754)),r=y(n(67294)),i=w(n(45697)),s=n(86706),o=n(14890),l=w(n(94301)),d=w(n(16012)),u=n(11962),c=w(n(48834)),f=n(48942),p=y(n(39042)),h=w(n(21965)),m=y(n(56334)),g=w(n(79298)),v=n(54582),b=w(n(96869));function _(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_=function(e){return e?n:t})(e)}function y(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,n&&n.set(e,a),a}function w(e){return e&&e.__esModule?e:{default:e}}function O(e){let{identifier:t,schema:n={}}=e;return[t,n.schema&&n.schema.name].filter((e=>e)).join(".")}class E extends r.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),this.reduceSchemaErrors=this.reduceSchemaErrors.bind(this),this.handleAutofill=this.handleAutofill.bind(this)}componentDidMount(){const{schema:e,refetchSchemaOnMount:t}=this.props;!t&&e||this.fetch()}componentDidUpdate(e){this.props.schemaUrl!==e.schemaUrl&&this.fetch()}getMessages(e){const t={};return e&&e.fields&&e.fields.forEach((e=>{e.message&&(t[e.name]=e.message)})),t}getIdentifier(){return O(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props)}handleSubmit(e,t,n){let a=null;const r=()=>n().then((e=>{let t=e;if(t){const e=void 0!==t.state;if(t=this.reduceSchemaErrors(t),this.props.actions.schema.setSchema(this.props.schemaUrl,t,this.getIdentifier()),e){const e=t.schema||this.props.schema.schema,n=(0,c.default)(e,t.state);this.props.actions.reduxForm.initialize(this.getIdentifier(),n)}}return t}));if(a="function"==typeof this.props.onSubmit?this.props.onSubmit(e,t,r):r(),!a)throw new Error("Promise was not returned for submitting");return a.then((e=>{if(!e||!e.state)return e;const t=this.getMessages(e.state);if(Object.keys(t).length)throw new u.SubmissionError(t);return e}))}reduceSchemaErrors(e){if(!e.errors)return e;let t={...e};return t.state||(t={...t,state:this.props.schema.state}),t={...t,state:{...t.state,fields:t.state.fields.map((t=>{let n=e.errors.find((e=>e.field===t.name));return n&&(n=(0,f.createErrorHtml)([n.value])),{...t,message:n}}))},messages:e.errors.filter((e=>!e.field))},delete t.errors,(0,d.default)(t)}overrideStateData(e){if(!this.props.stateOverrides||!e)return e;const t=this.props.stateOverrides.fields;let n=e.fields;return t&&n&&(n=n.map((e=>{const n=t.find((t=>t.name===e.name));return n?h.default.recursive(!0,e,n):e}))),Object.assign({},e,this.props.stateOverrides,{fields:n})}callFetch(e){return(0,l.default)(this.props.schemaUrl,{headers:{"X-FormSchema-Request":e.join(","),Accept:"application/json"},credentials:"same-origin"}).then((e=>e.status>=200&&e.status<300?e.json():new Promise(((t,n)=>e.json().then((t=>{n({status:e.status,statusText:e.statusText,json:t})})).catch((()=>{n({status:e.status,statusText:e.statusText,json:{}})}))))))}fetch(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.props.loading)return Promise.resolve({});const a=["auto",e&&"schema",t&&"state",n&&"errors"].filter((e=>e));return this.props.actions.schema.setSchemaLoading(this.props.schemaUrl,!0),"function"==typeof this.props.onFetchingSchema&&this.props.onFetchingSchema(),this.callFetch(a).then((e=>{if(this.props.actions.schema.setSchemaLoading(this.props.schemaUrl,!1),e.errors?"function"==typeof this.props.onLoadingError&&this.props.onLoadingError(e):"function"==typeof this.props.onLoadingSuccess&&this.props.onLoadingSuccess(),void 0!==e.id&&e.state){const t=Object.assign({},e,{state:this.overrideStateData(e.state)}),n=O({...this.props,schema:{...this.props.schema,...t}});this.props.actions.schema.setSchema(this.props.schemaUrl,t,n);const a=e.schema||this.props.schema.schema,r=(0,c.default)(a,t.state);return this.props.actions.reduxForm.initialize(n,r,!1,{keepSubmitSucceeded:!0}),"function"==typeof this.props.onReduxFormInit&&this.props.onReduxFormInit(),t}return e})).catch((e=>{if(this.props.actions.schema.setSchemaLoading(this.props.schemaUrl,!1),"function"==typeof this.props.onLoadingError)return this.props.onLoadingError(this.normaliseError(e));throw e}))}normaliseError(e){if(e.json&&e.json.errors)return e.json;if(e.status&&e.statusText)return{errors:[{code:e.status,value:e.statusText,type:"error"}]};return{errors:[{value:e.message||a.default._t("Admin.UNKNOWN_ERROR","An unknown error has occurred."),type:"error"}]}}handleAutofill(e,t){this.props.actions.reduxForm.autofill(this.getIdentifier(),e,t)}render(){const e=this.props.loadingComponent;if(!this.props.schema||!this.props.schema.schema||this.props.loading)return r.default.createElement(e,{containerClass:"loading--form flexbox-area-grow"});const t=Object.assign({},this.props,{form:this.getIdentifier(),onSubmitSuccess:this.props.onSubmitSuccess,onSubmit:this.handleSubmit,onAutofill:this.handleAutofill,autoFocus:this.props.autoFocus});return r.default.createElement(m.default,t)}}t.Component=E,E.propTypes=Object.assign({},m.basePropTypes,{actions:i.default.shape({schema:i.default.object,reduxFrom:i.default.object}),autoFocus:i.default.bool,identifier:i.default.string.isRequired,schemaUrl:i.default.string.isRequired,schema:m.schemaPropType,refetchSchemaOnMount:i.default.bool.isRequired,form:i.default.string,submitting:i.default.bool,onFetchingSchema:i.default.func,onReduxFormInit:i.default.func,loadingComponent:i.default.elementType.isRequired}),E.defaultProps={refetchSchemaOnMount:!0};var C=(0,o.compose)((0,v.inject)(["ReduxForm","ReduxFormField","Loading"],((e,t,n)=>({loadingComponent:n,baseFormComponent:e,baseFieldComponent:t})),(e=>{let{identifier:t}=e;return t})),(0,s.connect)((function(e,t){const n=e.form.formSchemas[t.schemaUrl],a=O({...t,schema:n}),r=(0,g.default)((0,b.default)(e),a);return{schema:n,submitting:r&&r.submitting,values:r&&r.values,stateOverrides:n&&n.stateOverride,loading:n&&n.metadata&&n.metadata.loading}}),(function(e){return{actions:{schema:(0,o.bindActionCreators)(p,e),reduxForm:(0,o.bindActionCreators)({autofill:u.autofill,initialize:u.initialize},e)}}})))(E);t.default=C},52583:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.createInsertLinkModal=t.InsertLinkModal=void 0;var a=f(n(67294)),r=u(n(45697)),i=n(14890),s=n(86706),o=u(n(48297)),l=u(n(63596)),d=f(n(39042));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function f(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,n&&n.set(e,a),a}class p extends a.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),e.isOpen||e.setOverrides(null)}componentDidUpdate(e){const t=this.props;(t.isOpen&&!e.isOpen||!t.isOpen&&e.isOpen)&&t.setOverrides(t.isOpen?t:null)}getModalProps(){const e=Object.assign({},this.props,{onSubmit:this.handleSubmit,onClosed:this.props.onClosed,autoFocus:!0,showErrorMessage:!0});return delete e.onInsert,delete e.sectionConfig,e}handleSubmit(e,t){if("action_cancel"===t)this.props.onClosed();else this.props.onInsert(e,t);return Promise.resolve()}render(){const e=this.getModalProps();return a.default.createElement(o.default,e)}}function h(e){return{actions:{schema:(0,i.bindActionCreators)(d,e)}}}t.InsertLinkModal=p,p.propTypes={isOpen:r.default.bool,schemaUrl:r.default.string,onInsert:r.default.func.isRequired,onClosed:r.default.func.isRequired,setOverrides:r.default.func.isRequired,actions:r.default.object,requireLinkText:r.default.bool,currentPageID:r.default.number},p.defaultProps={};t.createInsertLinkModal=(e,t)=>(0,i.compose)((0,s.connect)((function(n,a){const r=n.config.sections.find((t=>t.name===e)),i=a.requireLinkText?"?requireLinkText":"";return{sectionConfig:r,schemaUrl:`${r.form[t].schemaUrl}${i}`.replace(/:pageid/,a.currentPageID)}}),h),l.default)(p);var m=(0,i.compose)((0,s.connect)((()=>({})),h),l.default)(p);t.default=m},63596:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.FileSchemaHandler=t.ConnectedFileSchemaHandler=void 0;var a,r=u(n(67294)),i=(a=n(45697))&&a.__esModule?a:{default:a},s=n(14890),o=u(n(39042)),l=n(86706);function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,n&&n.set(e,a),a}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:null;if(e){if(e.schemaUrl){const t=Object.assign({},e.fileAttributes);delete t.ID;const n={fields:Object.entries(t).map((e=>{const[t,n]=e;return{name:t,value:n}}))};this.props.actions.schema.setSchemaStateOverrides(e.schemaUrl,n)}}else{const e=this.props.schemaUrl;e&&this.props.actions.schema.setSchemaStateOverrides(e,null)}}render(){const{Component:e,...t}=this.props;return r.default.createElement(e,c({setOverrides:this.setOverrides},t))}}function p(e,t){return{actions:{...t&&t.actions||{},schema:(0,s.bindActionCreators)(o,e)}}}t.FileSchemaHandler=f,f.propTypes={fileAttributes:i.default.object,Component:i.default.elementType,schemaUrl:i.default.string,actions:i.default.object};const h=(0,l.connect)((()=>({})),p())(f);t.ConnectedFileSchemaHandler=h;var m=function(e){return(0,l.connect)((function(){return{Component:e}}),p)(f)};t.default=m},49331:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=d(n(67294)),r=d(n(60452)),i=n(86706),s=n(14890),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}a.default=e,n&&n.set(e,a);return a}(n(36158));function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function d(e){return e&&e.__esModule?e:{default:e}}var u=(0,i.connect)((e=>{let{toasts:{toasts:t}}=e;return{toasts:t}}),(e=>({actions:(0,s.bindActionCreators)(o,e)})))((e=>{let{toasts:t,actions:{dismiss:n,pause:i,resume:s}}=e;return a.default.createElement(r.default,{toasts:t,onDismiss:n,onPause:i,onResume:s})}));t.default=u},93390:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.TabContext=void 0,t.injectTabContext=function(e){return t=>{const n=o();return a.default.createElement(e,i({},t,{tabContext:n}))}},t.useTabFirstShow=function(e){const t=o(),n=!t||t.isOnActiveTab,[r,i]=(0,a.useState)(!1);(0,a.useEffect)((()=>{n&&(i(!0),e(t))}),[r||n])};var a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=r(t);if(n&&n.has(e))return n.get(e);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var o=i?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(a,s,o):a[s]=e[s]}a.default=e,n&&n.set(e,a);return a}(n(67294));function r(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(r=function(e){return e?n:t})(e)}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t1?t-1:0),a=1;a{e(".cms-content-actions .add-to-campaign-action,#add-to-campaign__action").entwine({onclick(){let t=e("#add-to-campaign__dialog-wrapper");return t.length||(t=e('
'),e("body").append(t)),t.open(),!1}}),e(".add-to-campaign-modal .add-to-campaign-modal__nav-link").entwine({onclick:t=>{t.preventDefault();const n=e(t.target);window.location=n.attr("href")}}),e("#add-to-campaign__dialog-wrapper").entwine({ReactRoot:null,onunmatch(){this._clearModal()},open(){this._renderModal(!0)},close(){this._renderModal(!1)},_renderModal(t){var n=this;const r=e("form.cms-edit-form :input[name=ID]").val(),o=`${window.ss.store.getState().config.sections.find((e=>"SilverStripe\\CMS\\Controllers\\CMSPageEditController"===e.name)).form.AddToCampaignForm.schemaUrl}/${r}`,d=a.default._t("Admin.ADD_TO_CAMPAIGN","Add to campaign");let u=this.getReactRoot();u||(u=(0,s.createRoot)(this[0])),u.render(i.default.createElement(l,{title:d,isOpen:t,onSubmit:function(){return n._handleSubmitModal(...arguments)},onClosed:()=>this.close(),schemaUrl:o,bodyClassName:"modal__dialog",className:"add-to-campaign-modal",responseClassBad:"modal__response modal__response--error",responseClassGood:"modal__response modal__response--good",identifier:"Admin.AddToCampaign"})),this.setReactRoot(u)},_clearModal(){const e=this.getReactRoot();e&&(e.unmount(),this.setReactRoot(null))},_handleSubmitModal(e,t,n){return n()}})}))},76406:function(e,t,n){"use strict";var a,r=(a=n(19755))&&a.__esModule?a:{default:a};(0,r.default)(document).on("click",".confirmedpassword .showOnClick a",(function(){var e=(0,r.default)(".showOnClickContainer",(0,r.default)(this).parent());return e.toggle("fast",(function(){e.toggleClass("d-none").find('input[type="hidden"]').val(e.hasClass("d-none")?0:1)})),!1}))},40303:function(e,t,n){"use strict";var a=o(n(19755)),r=o(n(4754)),i=o(n(30381)),s=o(n(68300));function o(e){return e&&e.__esModule?e:{default:e}}a.default.entwine("ss",(e=>{e("input[type=date]").entwine({onadd(){if(s.default.inputtypes.date)return;if(this.prop("disabled")||this.prop("readonly")||this.hasClass("hasDatepicker"))return;const t=e("",{type:"hidden",name:this.attr("name"),value:this.val()});this.parent().append(t),this.removeAttr("name"),i.default.locale(this.attr("lang"));const n=this.val();let a="";if(n){const e=(0,i.default)(n);e.isValid()&&(a=e.format("L"))}this.val(a);const o=r.default.inject(r.default._t("Admin.FormatExample","Example: {format}"),{format:(0,i.default)().endOf("month").format("L")});this.attr("placeholder",o),this.updateValue()},onchange(){this.updateValue()},updateValue(){const e=this.val();let t="";if(e)for(const n of["L","YYYY-MM-DD"]){const a=(0,i.default)(e,n);if(a.isValid()){t=a.format("YYYY-MM-DD");break}}this.parent().find("input[type=hidden]").val(t)}})}))},57893:function(e,t,n){"use strict";var a=o(n(19755)),r=o(n(4754)),i=o(n(30381)),s=o(n(68300));function o(e){return e&&e.__esModule?e:{default:e}}n(881),a.default.entwine("ss",(e=>{e("input[type=datetime-local]").entwine({onadd(){if(s.default.inputtypes["datetime-local"])return;if(this.prop("disabled")||this.prop("readonly")||this.hasClass("hasDatepicker"))return;const t=e("",{type:"hidden",name:this.attr("name"),value:this.val()});this.parent().append(t),this.removeAttr("name"),i.default.locale(this.attr("lang"));const n=this.val();let a="";if(n){const e=(0,i.default)(n);e.isValid()&&(a=e.format("L LT"))}this.val(a);const o=r.default.inject(r.default._t("Admin.FormatExample","Example: {format}"),{format:(0,i.default)().endOf("month").format("L LT")});this.attr("placeholder",o),this.updateValue()},onchange(){this.updateValue()},updateValue(){const e=this.val();let t="";if(e){const n=(0,i.default)(e,["L LT",i.default.ISO_8601]);n.isValid()&&(t=n.format("YYYY-MM-DDTHH:mm:ss"))}this.parent().find("input[type=hidden]").val(t)}})}))},17106:function(e,t,n){"use strict";var a=l(n(19755)),r=l(n(4754)),i=l(n(67294)),s=n(20745),o=(l(n(62266)),n(48834),n(54582));function l(e){return e&&e.__esModule?e:{default:e}}function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t").addClass("ss-gridfield-item loading").attr("colspan",d);l.append(e("").append(u));e.ajax(e.extend({},{headers:{"X-Pjax":"CurrentField"},type:"POST",url:this.data("url"),dataType:"html",success:function(r){if(a.empty().append(e(r).children()),s&&a.find(':input[name="'+s+'"]').focus(),a.find(".grid-field__filter-header, .grid-field__search-holder").length){var i="show"===t.data[0].filter;a.needsColumnFix()&&a.fixColumns(),a.injectSearchButton(i)}n&&n.apply(this,arguments),a.trigger("reload",a),!1!==t.data[0].triggerChange&&a.trigger("change")},error:function(e){alert(r.default._t("Admin.ERRORINTRANSACTION"))},complete:function(e,t){a.find(".loading").removeClass("loading")}},t))},showDetailView:function(e){window.location.href=e},getItems:function(){return this.find(".ss-gridfield-item")},setState:function(e,t){var n=this.getState();n[e]=t,this.find(':input[name="'+this.data("name")+'[GridState]"]').val(JSON.stringify(n))},getState:function(){const e=this.find(':input[name="'+this.data("name")+'[GridState]"]').val();return e?JSON.parse(e):{}},hasFilters:function(){return!!this.getState().GridFieldFilterHeader},needsColumnFix:function(){return this.find(".grid-field__filter-header, .grid-field__search-holder").length&&!this.find(".grid-field__col-compact").length&&!this.find("th.col-Actions").length},fixColumns:function(t){this.find(".sortable-header").append(''),this.find("tbody tr").each((function(){e(this).find("td:last").attr("colspan",2)}));var n=e('');e(".grid-field__filter-header th:last .action").each((function(){e(this).detach(),n.append(e(this))})),e(".grid-field__filter-header").append(n)},injectSearchButton:function(e){const t=this.find(".grid-field__filter-header").length>0;let n;e?(n='',this.addClass("show-filter").find(".grid-field__filter-header, .grid-field__search-holder").removeClass("grid-field__search-holder--hidden"),t||this.find(":button[name=showFilter]").hide()):(n='',this.removeClass("show-filter").find(".grid-field__filter-header, .grid-field__search-holder").addClass("grid-field__search-holder--hidden")),t&&this.find(".sortable-header th:last").html(n)},keepStateInHistory:function(){const t=e(this).find(".gridfield-actionmenu__container").data("schema");t&&t.length>0&&t.filter((e=>{if("link"===e.type){const t=this.buildURLString(e.url),n=t?"?"+t.join("&"):"";window.ss.router.replace(window.location.pathname+n,void 0,void 0,!1)}}))},buildURLString:function(e){const t=[window.location.origin,e].join("/"),n=[window.location.search,new URL(t).searchParams.toString()].join("&").substring(1),a=[],r=[];return n.split("&").forEach((e=>{const t=e.split("=");a[t[0]]=t[1]?t[1]:""})),Object.keys(a).forEach((e=>{r.push([e,a[e]].join("="))})),r}}),e(".grid-field *").entwine({getGridField:function(){return this.closest(".grid-field")}}),e(".gridfield-actionmenu__container").entwine({Timer:null,Component:null,Actions:null,ReactRoot:null,onmatch(){this._super();let t=[];e(".action-menu--handled",this.parent()).each((function(){const n=e(this).detach();t.push(n)})),this.setActions(t);const n=this.closest(".cms-content").attr("id"),a=n?{context:n}:{},r=(0,o.loadComponent)("GridFieldActions",a);this.setComponent(r),this.refresh()},onunmatch(){this._super();const t=this.getReactRoot();t&&(t.unmount(),this.setReactRoot(null));const n=this.getActions(),a=this.parent();n&&e(n).each((function(){e(this).appendTo(a)}))},refresh(){const e=this.data("schema"),t=this.getComponent();let n=this.getReactRoot();n||(n=(0,s.createRoot)(this[0])),n.render(i.default.createElement(t,{schema:e})),this.setReactRoot(n)}}),e(".grid-field :button[name=showFilter]").entwine({onclick:function(e){this.closest(".grid-field").find(".grid-field__filter-header, .grid-field__search-holder").removeClass("grid-field__search-holder--hidden").find(":input:first").focus(),this.closest(".grid-field").addClass("show-filter"),this.parent().html(''),e.preventDefault()}}),e(".grid-field .ss-gridfield-item").entwine({onclick:function(t){if(t.target.classList.contains("action-menu__toggle"))return this._super(t),!1;if(e(t.target).closest(".action").length)return this._super(t),!1;var n=this.find(".edit-link, .view-link");n.length&&this.getGridField().showDetailView(n.prop("href"))},onmouseover:function(){this.find(".edit-link, .view-link").length&&this.css("cursor","pointer")},onmouseout:function(){this.css("cursor","default")}}),e(".grid-field .action.action_import:button").entwine({onclick:function(e){e.preventDefault(),this.openmodal()},onmatch:function(){this._super(),"open"===this.data("state")&&this.openmodal()},onunmatch:function(){this._super()},openmodal:function(){let t=e(this.data("target")),n=e(this.data("modal"));t.length<1?(t=n,t.appendTo(document.body)):t.innerHTML=n.innerHTML;let a=e(".modal-backdrop");function r(){a.removeClass("show"),t.removeClass("show"),setTimeout((function(){a.remove()}),150)}a.length<1&&(a=e(''),a.appendTo(document.body)),t.find("[data-dismiss]").add(".modal-backdrop").on("click",(function(){r()})),e(document).on("keydown",(function(e){27===e.keyCode&&r()})),setTimeout((function(){a.addClass("show"),t.addClass("show")}),0)}}),e(".grid-field .action:button").entwine({onclick:function(t){var n="show";let a=!0;if(this.is(":disabled"))return void t.preventDefault();!this.hasClass("ss-gridfield-button-close")&&this.closest(".grid-field").hasClass("show-filter")||(n="hidden"),(this.hasClass("ss-gridfield-pagination-action")||this.hasClass("grid-field__sort"))&&(a=!1);var r=[{name:this.attr("name"),value:this.val(),filter:n,triggerChange:a}],i=this.data("action-state");i&&r.push({name:"ActionState",value:JSON.stringify(i)});const s=e(this).getGridField();s.reload({data:r},(function(t,n,a){s.keepStateInHistory();const r=a.getResponseHeader("X-Message-Text"),i=a.getResponseHeader("X-Message-Type");if(r&&i){var o=e("#Form_EditForm_error");o.addClass(i),o.html(r),o.show()}})),t.preventDefault()},actionurl:function(){var t=this.closest(":button"),n=this.getGridField(),a=this.closest("form"),r=a.find(":input.gridstate").serialize(),i=a.find('input[name="SecurityID"]').val();r+="&"+encodeURIComponent(t.attr("name"))+"="+encodeURIComponent(t.val()),i&&(r+="&SecurityID="+encodeURIComponent(i));var s=this.data("action-state");s&&(r+="&ActionState="+encodeURIComponent(JSON.stringify(s))),window.location.search&&(r=window.location.search.replace(/^\?/,"")+"&"+r);var o=-1==n.data("url").indexOf("?")?"?":"&";return e.path.makeUrlAbsolute(n.data("url")+o+r,e("base").attr("href"))}}),e(".grid-field .add-existing-autocompleter").entwine({onbuttoncreate:function(){var e=this;this.toggleDisabled(),this.find('input[type="text"]').on("keyup",(function(){e.toggleDisabled()}))},onunmatch:function(){this.find('input[type="text"]').off("keyup")},toggleDisabled:function(){var e=this.find(".ss-ui-button"),t=""!==this.find('input[type="text"]').val(),n=e.is(":disabled");(t&&n||!t&&!n)&&e.attr("disabled",!n)}}),e(".grid-field .grid-field__col-compact .action--delete, .grid-field .grid-field__col-compact .action--archive, .cms-edit-form .btn-toolbar .action--delete, .cms-edit-form .btn-toolbar .action--archive").entwine({onclick:function(t){const n=e(this).hasClass("action--archive")?r.default._t("Admin.ARCHIVECONFIRMMESSAGE","Are you sure you want to archive this record?"):r.default._t("Admin.DELETECONFIRMMESSAGE","Are you sure you want to delete this record?");if(!confirm(n))return t.preventDefault(),!1;this._super(t)}}),e(".grid-field .grid-print-button.action:button").entwine({UUID:null,onmatch:function(){this._super(),this.setUUID((new Date).getTime())},onunmatch:function(){this._super()},onclick:function(e){var t=this.actionurl();return window.open(t),e.preventDefault(),!1}}),e(".ss-gridfield-print-iframe").entwine({onmatch:function(){this._super(),this.hide().on("load",(function(){this.focus(),(this.contentWindow||this).print()}))},onunmatch:function(){this._super()}}),e(".grid-field .action.no-ajax, .grid-field .no-ajax .action:button").entwine({onclick:function(e){return window.location.href=this.actionurl(),e.preventDefault(),!1}}),e(".grid-field .action-detail").entwine({onclick:function(){return this.getGridField().showDetailView(e(this).prop("href")),!1}}),e(".grid-field[data-selectable]").entwine({getSelectedItems:function(){return this.find(".ss-gridfield-item.ui-selected")},getSelectedIDs:function(){return e.map(this.getSelectedItems(),(function(t){return e(t).data("id")}))}}),e(".grid-field[data-selectable] .ss-gridfield-items").entwine({onadd:function(){this._super(),this.selectable()},onremove:function(){this._super(),this.data("selectable")&&this.selectable("destroy")}}),e(".js-injector-boot .grid-field .grid-field__search-holder").entwine({Component:null,ReactRoot:null,onmatch(){this._super(),this.prependTo(this.parent());const e=this.closest(".cms-content").attr("id"),t=e?{context:e}:{},n=(0,o.loadComponent)("Search",t);this.setComponent(n),this.refresh()},onunmatch(){this._super();const e=this.getReactRoot();e&&(e.unmount(),this.setReactRoot(null))},close(){const t=this.data("schema"),n=[{name:t.clearAction,value:"",filter:"hidden",triggerChange:!1}];t.clearActionState&&n.push({name:"ActionState",value:t.clearActionState});const a=e(this).getGridField();a.reload({data:n},(function(){a.keepStateInHistory()}))},search(t){const n=this.data("schema"),a=[{name:n.searchAction,value:"",filter:"show",triggerChange:!1}];n.searchActionState&&a.push({name:"ActionState",value:n.searchActionState});for(const[e,r]of Object.entries(t))if(r){const t=`filter[${n.gridfield}][${e}]`;a.push({name:t,value:r})}const r=e(this).getGridField();r.reload({data:a},(function(){r.keepStateInHistory()}))},refresh(){const e=this.data("schema"),t=this.getComponent();String(e.gridfield).replace(/\-/g,".");let n=this.getReactRoot();n||(n=(0,s.createRoot)(this[0])),n.render(i.default.createElement(t,d({id:`${e.gridfield}Search`,display:"VISIBLE",displayBehavior:"HIDEABLE",filterPrefix:"Search__",onHide:()=>this.close(),onSearch:e=>this.search(e)},e))),this.setReactRoot(n)}}),e(".js-injector-boot .grid-field .search-box__content-field").entwine({onkeydown:function(e){"Enter"===e.key&&e.preventDefault()}}),e(".grid-field .grid-field__filter-header :input").entwine({onmatch:function(){var e=this.closest(".extra").find(".ss-gridfield-button-filter"),t=this.closest(".extra").find(".ss-gridfield-button-reset");this.val()&&(e.addClass("filtered"),t.addClass("filtered")),this._super()},onunmatch:function(){this._super()},onkeydown:function(t){if(!this.closest(".ss-gridfield-button-reset").length){var n=this.closest(".extra").find(".ss-gridfield-button-filter"),a=this.closest(".extra").find(".ss-gridfield-button-reset");if("13"==t.keyCode){var r=this.closest(".grid-field__filter-header").find(".ss-gridfield-button-filter"),i="show";!this.hasClass("ss-gridfield-button-close")&&this.closest(".grid-field").hasClass("show-filter")||(i="hidden");var s=[{name:r.attr("name"),value:r.val(),filter:i,triggerChange:!1}];r.data("action-state")&&s.push({name:"ActionState",value:JSON.stringify(r.data("action-state"))});const t=e(this).getGridField(),n=function(){t.keepStateInHistory()};return t.reload({data:s},n),!1}n.addClass("hover-alike"),a.addClass("hover-alike")}}}),e(".grid-field .relation-search").entwine({onfocusin:function(t){this.autocomplete({source:function(t,n){var a=e(this.element);e(this.element).closest("form");e.ajax({headers:{"X-Pjax":"Partial"},dataType:"json",type:"GET",url:e(a).data("searchUrl"),data:encodeURIComponent(a.attr("name"))+"="+encodeURIComponent(a.val()),success:n,error:function(e){alert(r.default._t("Admin.ERRORINTRANSACTION","An error occured while fetching data from the server\n Please try again later."))}})},select:function(t,n){var a=e('');a.val(n.item.id),e(this).closest(".grid-field").find(".action_gridfield_relationfind").replaceWith(a),e(this).closest(".grid-field").find(".action_gridfield_relationadd").removeAttr("disabled")}})}}),e(".grid-field .pagination-page-number input").entwine({onkeydown:function(t){if(13==t.keyCode){t.preventDefault();var n=parseInt(e(this).val(),10),a=e(this).getGridField();a.setState("GridFieldPaginator",{currentPage:n});const r=function(){a.keepStateInHistory()};return a.reload({},r),!1}}})}))},49414:function(__unused_webpack_module,__unused_webpack_exports,__webpack_require__){"use strict";var _jquery=_interopRequireDefault(__webpack_require__(19755));__webpack_require__(51726);var _lodash=_interopRequireDefault(__webpack_require__(91658));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var ss=void 0!==window.ss?window.ss:{};ss.editorWrappers={},ss.editorWrappers.tinyMCE=function(){var editorID;return{init:function(e){editorID=e,this.create()},destroy:function(){tinymce.EditorManager.execCommand("mceRemoveEditor",!1,editorID)},getInstance:function(){return tinymce.EditorManager.get(editorID)},onopen:function(){},onclose:function(){},getConfig:function(){var e="#"+editorID,t=(0,_jquery.default)(e).data("config"),n=this;return t.selector=e,t.setup=function(e){e.on("change",(function(){n.save()}))},t},save:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t=this.getInstance();t.save(),e.silent||((0,_jquery.default)(t.getElement()).trigger("change"),t.getElement().dispatchEvent(new Event("input",{bubbles:!0})))},create:function(){let e,t,n;function a(a){const r=a.target;!e||(new Date-e)/100>500?(n=$(r).scrollTop(),$(".mce-floatpanel").css("opacity","0")):window.clearTimeout(t),e=new Date,t=window.setTimeout((()=>function(t,n){const a=$(t).scrollTop();$(".mce-floatpanel").each(((e,t)=>{const r=parseFloat(t.style.top);$(t).css("top",r-(a-n)+"px")})),$(".mce-floatpanel").css("opacity","1"),e=void 0}(r,n)),500)}var r=this.getConfig();void 0!==r.baseURL&&(tinymce.EditorManager.baseURL=r.baseURL),tinymce.init(r).then((e=>{if(e.length>0&&e[0].container){$(e[0].container).closest(".panel--scrollable").on("scroll",(e=>a(e)))}}))},repaint:function(){},isDirty:function(){return this.getInstance().isDirty()},getContent:function(){return this.getInstance().getContent()},getSelection:function(){const e=this.getInstance();let t=e.selection.getContent({format:"text"});return t||(t=e.selection.getSel().toString()),t||""},getDOM:function(){return this.getInstance().getElement()},getContainer:function(){return this.getInstance().getContainer()},getSelectedNode:function(){return this.getInstance().selection.getNode()},selectNode:function(e){this.getInstance().selection.select(e)},setContent:function(e,t){this.getInstance().setContent(e,t)},insertContent:function(e,t){this.getInstance().insertContent(e,t)},replaceContent:function(e,t){this.getInstance().execCommand("mceReplaceContent",!1,e,t)},insertLink:function(e,t,n){if(n){n=n.replaceAll("<","<").replaceAll(">",">");const t=this.getInstance().dom.create("a",e,n);this.getInstance().selection.setNode(t)}else this.getInstance().execCommand("mceInsertLink",!1,e,t)},removeLink:function(){this.getInstance().execCommand("unlink",!1)},cleanLink:function(href,node){var settings=this.getConfig,cb=settings.urlconverter_callback,cu=tinyMCE.settings.convert_urls;return cb&&(href=eval(cb+"(href, node, true);")),cu&&href.match(new RegExp("^"+(0,_lodash.default)(tinyMCE.settings.document_base_url)+"(.*)$"))&&(href=RegExp.$1),href.match(/^javascript:\s*mctmp/)&&(href=""),href},createBookmark:function(){return this.getInstance().selection.getBookmark()},moveToBookmark:function(e){this.getInstance().selection.moveToBookmark(e),this.getInstance().focus()},blur:function(){this.getInstance().selection.collapse()},addUndo:function(){this.getInstance().undoManager.add()}}},ss.editorWrappers.default=ss.editorWrappers.tinyMCE,_jquery.default.entwine("ss",(function(e){e("textarea.htmleditor").entwine({Editor:null,onadd:function(){var e=this.data("editor")||"default",t=ss.editorWrappers[e]();this.setEditor(t),t.init(this.attr("id")),this._super()},onmatch:function(){this.getEditor()||this.onadd(),this._super()},onremove:function(){this.getEditor().destroy(),this._super()},onunmatch:function(){this.getEditor()&&this.onremove(),this._super()},"from .cms-edit-form":{onbeforesubmitform:function(){this.getEditor().save({silent:!0}),this._super()}},openLinkDialog:function(){this.openDialog("link")},openMediaDialog:function(){this.openDialog("media")},openEmbedDialog:function(){this.openDialog("embed")},openDialog:function(t){if("media"===t&&window.InsertMediaModal){let t=e("#insert-media-react__dialog-wrapper");return t.length||(t=e('